PageSourceSearch

https://www.mixnpik.com/static/js/firebase.e0e79531.js

js mixnpik.com collected 2026-10-02 16:02:56 UTC 536,187 bytes, 2 lines download raw bytes

1/*! For license information please see firebase.e0e79531.js.LICENSE.txt */
2"use strict";(self.webpackChunkweb=self.webpackChunkweb||[]).push([[708],{78602(e,t,n){n.d(t,{$:()=>dt,A:()=>u,H:()=>h,L:()=>qe,M:()=>$e,P:()=>Yn,Q:()=>Ze,R:()=>$n,V:()=>ce,W:()=>rt,X:()=>ct,Y:()=>ut,Z:()=>lt,_:()=>at,a0:()=>ft,a1:()=>vt,a2:()=>Ct,a3:()=>At,a4:()=>kt,a5:()=>Rt,a6:()=>Mt,a7:()=>xt,a8:()=>Ft,a9:()=>Ut,aA:()=>Ci,aB:()=>_e,aC:()=>v,aD:()=>T,aE:()=>Ii,aF:()=>oe,aG:()=>ue,aH:()=>bi,aI:()=>pi,aJ:()=>fi,aK:()=>Ce,aO:()=>In,aR:()=>ht,aa:()=>Vt,ab:()=>jt,ac:()=>qt,ad:()=>Bt,ae:()=>zt,af:()=>$t,ag:()=>Kt,ah:()=>Ht,ai:()=>Wt,al:()=>Gt,am:()=>Qt,an:()=>Jt,aq:()=>bt,ar:()=>sn,at:()=>cn,au:()=>dn,av:()=>E,aw:()=>we,ax:()=>me,ay:()=>m,az:()=>Ki,b:()=>mn,c:()=>bn,d:()=>oi,e:()=>ci,f:()=>ai,g:()=>vi,h:()=>wi,i:()=>xn,j:()=>yi,k:()=>_i,l:()=>Wn,m:()=>Wi,n:()=>Ji,p:()=>nr,q:()=>c,r:()=>Gn,s:()=>Hn,u:()=>Jn});var i=n(73507),r=n(51252),s=n(46954),o=n(77237),a=n(38183);const c={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},u={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 l(){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 h=function
vendor: 12,062 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`)."}},
2d=l,f=new r.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."}),p=new s.Vy("@firebase/auth");function g(e){if(p.logLevel<=s.$b.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];p.error(`Auth (${i.SDK_VERSION}): ${e}`,...n)}}function m(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw b(e,...n)}function v(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return b(e,...n)}function y(e,t,n){const i=Object.assign(Object.assign({},d()),{[t]:n});return new r.FA("auth","Firebase",i).create(t,{appName:e.name})}function w(e){return y(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&m(e,"argument-error"),y(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){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if("string"!==typeof e){const t=n[0],i=[...n.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(t,...i)}return f.create(e,...n)}function T(e,t){if(!e){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];throw b(t,...i)}}function I(e){const t="INTERNAL ASSERTION FAILED: "+e;throw g(t),new Error(t)}function E(e,t){e||I(t)}function S(){var e;return"undefined"!==typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function C(){return"http:"===A()||"https:"===A()}function A(){var e;return"undefined"!==typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class k{constructor(e,t){this.shortDelay=e,this.longDelay=t,E(t>e,"Short delay should be less than long delay!"),this.isMobile=(0,r.jZ)()||(0,r.lV)()}get(){return"undefined"!==typeof navigator&&navigator&&"onLine"in navigator&&"boolean"===typeof navigator.onLine&&(C()||(0,r.sr)()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function R(e,t){E(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class N{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 I("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:"undefined"!==typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!==typeof Headers?Headers:void I("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 I("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-rec
2aptcha-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"},O=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],D=new k(3e4,6e4);function L(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function M(e,t,n,i){return x(e,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},(async()=>{let s={},o={};i&&("GET"===t?o=i:s={body:JSON.stringify(i)});const a=(0,r.Am)(Object.assign({key:e.config.apiKey},o)).slice(1),c=await e._getAdditionalHeaders();c["Content-Type"]="application/json",e.languageCode&&(c["X-Firebase-Locale"]=e.languageCode);const u=Object.assign({method:t,headers:c},s);return(0,r.c1)()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&(0,r.zJ)(e.emulatorConfig.host)&&(u.credentials="include"),N.fetch()(await U(e,e.config.apiHost,n,a),u)}))}async function x(e,t,n){e._canInitEmulator=!1;const i=Object.assign(Object.assign({},P),t);try{const t=new j(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw q(e,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const t=r.ok?s.errorMessage:s.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw q(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw q(e,"email-already-in-use",s);if("USER_DISABLED"===n)throw q(e,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw y(e,a,o);m(e,a)}}catch(s){if(s instanceof r.g)throw s;m(e,"network-request-failed",{message:String(s)})}}async function F(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=await M(e,t,n,i,r);return"mfaPendingCredential"in s&&m(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function U(e,t,n,i){const r=`${t}${n}?${i}`,s=e,o=s.config.emulator?R(e.config,r):`${e.config.apiScheme}://${r}`;if(O.includes(n)&&(await s._persistenceManagerAvailable,"COOKIE"===s._getPersistenceType())){return s._getPersistence()._getFinalTarget(o).toString()}return o}function V(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"))),D.get())}))}}
2function q(e,t,n){const i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=v(e,t,i);return r.customData._tokenResponse=n,r}function B(e){return void 0!==e&&void 0!==e.getResponse}function z(e){return void 0!==e&&void 0!==e.enterprise}class ${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 V(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 K(e,t){return M(e,"GET","/v2/recaptchaConfig",L(e,t))}async function H(e,t){return M(e,"POST","/v1/accounts:lookup",t)}function W(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(t){}}function G(e){return 1e3*Number(e)}function Q(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return g("JWT malformed, contained fewer than 3 sections"),null;try{const e=(0,r.u)(n);return e?JSON.parse(e):(g("Failed to decode base64 JWT payload"),null)}catch(s){return g("Caught error parsing JWT payload as JSON",null===s||void 0===s?void 0:s.toString()),null}}function J(e){const t=Q(e);return T(t,"internal-error"),T("undefined"!==typeof t.exp,"internal-error"),T("undefined"!==typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function X(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return t;try{return await t}catch(n){throw n instanceof r.g&&function(e){let{code:t}=e;return"auth/user-disabled"===t||"auth/user-token-expired"===t}(n)&&e.auth.currentUser===e&&await e.auth.signOut(),n}}class Y{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){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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"===(null===e||void 0===e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class Z{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=W(this.lastLoginAt),this.creationTime=W(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ee(e){var t;const n=e.auth,i=await e.getIdToken(),r=await X(e,H(n,{idToken:i}));T(null===r||void 0===r?void 0:r.users.length,n,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?te(s.providerUserInfo):[],a=(c=e.providerData,u=o,[...c.filter((e=>!u.some((t=>t.providerId===e.providerId)))),...u]);var c,u;const l=e.isAnonymous,h=!(e.email&&s.passwordHash)&&!(null===a||void 0===a?void 0:a.length),d=!!l&&h,f={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 Z(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,f)}function te(e){return e.map((e=>{var{providerId:t}=e,n=(0,o.Tt)(e,["providerId"]);
2return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}class ne{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){T(e.idToken,"internal-error"),T("undefined"!==typeof e.idToken,"internal-error"),T("undefined"!==typeof e.refreshToken,"internal-error");const t="expiresIn"in e&&"undefined"!==typeof e.expiresIn?Number(e.expiresIn):J(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){T(0!==e.length,"internal-error");const t=J(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]||!this.accessToken||this.isExpired?(T(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:s}=await async function(e,t){const n=await x(e,{},(async()=>{const n=(0,r.Am)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:s}=e.config,o=await U(e,i,"/v1/token",`key=${s}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:a,body:n};return e.emulatorConfig&&(0,r.zJ)(e.emulatorConfig.host)&&(c.credentials="include"),N.fetch()(o,c)}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(s))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:r}=t,s=new ne;return n&&(T("string"===typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(T("string"===typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(T("number"===typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ne,this.toJSON())}_performRefresh(){return I("not implemented")}}function ie(e,t){T("string"===typeof e||"undefined"===typeof e,"internal-error",{appName:t})}class re{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=(0,o.Tt)(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Y(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=i,this.accessToken=i.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 Z(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await X(this,this.stsTokenManager.getToken(this.auth,e));return T(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,r.Ku)(e),i=await n.getIdToken(t),s=Q(i);T(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o="object"===typeof s.firebase?s.firebase:void 0,a=null===o||void 0===o?void 0:o.sign_in_provider;return{claims:s,token:i,authTime:W(G(s.auth_time)),issuedAtTime:W(G(s.iat)),expirationTime:W(G(s.exp)),signInProvider:a||null,signInSecondFactor:(null===o||void 0===o?void 0:o.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=(0,r.Ku)(e);await ee(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(T(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.ph
2otoURL,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=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new re(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){T(!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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await ee(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if((0,i._isFirebaseServerApp)(this.auth.app))return Promise.reject(w(this.auth));const e=await this.getIdToken();return await X(this,async function(e,t){return M(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},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){var n,i,r,s,o,a,c,u;const l=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=t.photoURL)&&void 0!==s?s:void 0,p=null!==(o=t.tenantId)&&void 0!==o?o:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,v=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:y,emailVerified:w,isAnonymous:_,providerData:b,stsTokenManager:I}=t;T(y&&I,e,"internal-error");const E=ne.fromJSON(this.name,I);T("string"===typeof y,e,"internal-error"),ie(l,e.name),ie(h,e.name),T("boolean"===typeof w,e,"internal-error"),T("boolean"===typeof _,e,"internal-error"),ie(d,e.name),ie(f,e.name),ie(p,e.name),ie(g,e.name),ie(m,e.name),ie(v,e.name);const S=new re({uid:y,auth:e,email:h,emailVerified:w,displayName:l,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:v});return b&&Array.isArray(b)&&(S.providerData=b.map((e=>Object.assign({},e)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=new ne;i.updateFromServerResponse(t);const r=new re({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await ee(r),r}static async _fromGetAccountInfoResponse(e,t,n){const i=t.users[0];T(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?te(i.providerUserInfo):[],s=!(i.email&&i.passwordHash)&&!(null===r||void 0===r?void 0:r.length),o=new ne;o.updateFromIdToken(n);const a=new re({uid:i.localId,auth:e,stsTokenManager:o,isAnonymous:s}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:r,metadata:new Z(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(null===r||void 0===r?void 0:r.length)};return Object.assign(a,c),a}}const se=new Map;function oe(e){E(e instanceof Function,"Expected a class definition");let t=se.get(e);return t?(E(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,se.set(e,t),t)}class ae{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){}}ae.type="NONE";const ce=ae;function ue(e,t,n){return`firebase:${e}:${t}:${n}`}class le{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=ue(this.userKey,i.apiKey,r),this.fullPersistenceKey=ue("persistence",i.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"===typeof e){const t=await H(this.auth,{idToken:e}).catch((()=>{}));return t?re._fromGetAccountInfoResponse(this.auth,t,e):null}return re._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){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"authUser";if(!t.length)return new le(oe(ce),e,n);const i=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let r=i[0]||oe(ce);
2const s=ue(n,e.config.apiKey,e.name);let o=null;for(const u of t)try{const t=await u._get(s);if(t){let n;if("string"===typeof t){const i=await H(e,{idToken:t}).catch((()=>{}));if(!i)break;n=await re._fromGetAccountInfoResponse(e,i,t)}else n=re._fromJSON(e,t);u!==r&&(o=n),r=u;break}}catch(c){}const a=i.filter((e=>e._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(t.map((async e=>{if(e!==r)try{await e._remove(s)}catch(c){}}))),new le(r,e,n)):new le(r,e,n)}}function he(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ge(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(de(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ve(t))return"Blackberry";if(ye(t))return"Webos";if(fe(t))return"Safari";if((t.includes("chrome/")||pe(t))&&!t.includes("edge/"))return"Chrome";if(me(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null===n||void 0===n?void 0:n.length))return n[1]}return"Other"}function de(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/firefox\//i.test(e)}function fe(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/crios\//i.test(e)}function ge(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/iemobile/i.test(e)}function me(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/android/i.test(e)}function ve(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/blackberry/i.test(e)}function ye(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/webos/i.test(e)}function we(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function _e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)}function be(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)();return we(e)||me(e)||ye(e)||ve(e)||/windows phone/i.test(e)||ge(e)}function Te(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=he((0,r.ZQ)());break;case"Worker":t=`${he((0,r.ZQ)())}-${e}`;break;default:t=e}const s=n.length?n.join(","):"FirebaseCore-web";return`${t}/JsCore/${i.SDK_VERSION}/${s}`}class Ie{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,i)=>{try{n(e(t))}catch(r){i(r)}}));n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(n){t.reverse();for(const e of t)try{e()}catch(i){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===n||void 0===n?void 0:n.message})}}}class Ee{constructor(e){var t,n,i,r;const s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=s.minPasswordLength)&&void 0!==t?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=e.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&
vendor: 4,427 bytes, line 2
2(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)n=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}class Se{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ae(this),this.idTokenSubscription=new Ae(this),this.beforeStateQueue=new Ie(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=f,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise((e=>this._resolvePersistenceManagerAvailable=e))}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=oe(t)),this._initializationPromise=this.queue((async()=>{var n,i,r;if(!this._deleted&&(this.persistenceManager=await le.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(i=this._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(s){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.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 H(this,{idToken:e}),n=await re._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if((0,i._isFirebaseServerApp)(this.app)){const e=this.app.settings.authIdToken;return e?new Promise((t=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(e).then(t,t)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null===r||void 0===r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==i||!(null===o||void 0===o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);
2if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(o)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return T(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(n){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ee(e)}catch(t){if("auth/network-request-failed"!==(null===t||void 0===t?void 0:t.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,i._isFirebaseServerApp)(this.app))return Promise.reject(w(this));const t=e?(0,r.Ku)(e):null;return t&&T(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._deleted)return e&&T(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,i._isFirebaseServerApp)(this.app)?Promise.reject(w(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return(0,i._isFirebaseServerApp)(this.app)?Promise.reject(w(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(oe(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){return M(e,"GET","/v2/passwordPolicy",L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}(this),t=new Ee(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 r.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)=>{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 M(e,"POST","/v2/accounts:revokeToken",L(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.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&&oe(e)||this._popupRedirectResolver;T(t,this,"argument-error"),this.redirectPersistenceManager=await le.create(this,[oe(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._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(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};const r="function"===typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(T(o,this,"internal-error"),o.then((()=>{s||r(this.currentUser)})),"function"===typeof t){const r=e.addObserver(t,n,i);return()=>{s=!0,r()}}{const n=e.addObserver(t);return()=>{s=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return T(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Te(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if((0,i._isFirebaseServerApp)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null===t||void 0===t?void 0:t.error)&&function(e){if(p.logLevel<=s.$b.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];p.warn(`Auth (${i.SDK_VERSION}): ${e}`,...n)}}(`Error while retrieving App Check token: ${t.error}`),null===t||void 0===t?void 0:t.token}}function Ce(e){return(0,r.Ku)(e)}class Ae{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,r.tD)((e=>this.observer=e))}get next(){return T(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let ke={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Re(e){return ke.loadJS(e)}function Ne(e){return`__${e}${Math.floor(1e6*Math.random())}`}const Pe=1e12;class Oe{constructor(e){this.auth=e,this.counter=Pe,this._widgets=new Map}render(e,t){const n=this.counter;return this._widgets.set(n,new Me(e,this.auth.name,t||{})),this.counter++,n}reset(e){var t;const n=e||Pe;null===(t=this._widgets.get(n))||void 0===t||t.delete(),this._widgets.delete(n)}getResponse(e){var t;const n=e||Pe;return(null===(t=this._widgets.get(n))||void 0===t?void 0:t.getResponse())||""}async execute(e){var t;const n=e||Pe;return null===(t=this._widgets.get(n))||void 0===t||t.execute(),""}}class De{constructor(){this.enterprise=new Le}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Le{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Me{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const i="string"===typeof e?document.getElementById(e):e;T(i,"argument-error",{appName:t}),this.container=i,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 i=0;i<e;i++)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(n){}this.timerId=window.setTimeout((()=>
2{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(n){}this.isVisible&&this.execute()}),6e4)}),500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}const xe="NO_RECAPTCHA";class Fe{constructor(e){this.type="recaptcha-enterprise",this.auth=Ce(e)}async verify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"verify",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(t,n,i){const r=window.grecaptcha;z(r)?r.enterprise.ready((()=>{r.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n(xe)}))})):i(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new De).execute("siteKey",{action:"verify"})}return new Promise(((e,i)=>{(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)=>{K(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void 0!==i.recaptchaKey){const n=new $(i);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((r=>{if(!t&&z(window.grecaptcha))n(r,e,i);else{if("undefined"===typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));let t=ke.recaptchaEnterpriseScript;0!==t.length&&(t+=r),Re(t).then((()=>{n(r,e,i)})).catch((e=>{i(e)}))}})).catch((e=>{i(e)}))}))}}async function Ue(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=new Fe(e);let o;if(r)o=xe;else try{o=await s.verify(n)}catch(c){o=await s.verify(n,!0)}const a=Object.assign({},t);if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Ve(e,t,n,i,r){var s,o;if("EMAIL_PASSWORD_PROVIDER"===r){if(null===(s=e._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Ue(e,t,n,"getOobCode"===n);return i(e,r)}return i(e,t).catch((async r=>{if("auth/missing-recaptcha-token"===r.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const r=await Ue(e,t,n,"getOobCode"===n);return i(e,r)}return Promise.reject(r)}))}if("PHONE_PROVIDER"===r){if(null===(o=e._getRecaptchaConfig())||void 0===o?void 0:o.isProviderEnabled("PHONE_PROVIDER")){const r=await Ue(e,t,n);return i(e,r).catch((async r=>{var s;if("AUDIT"===(null===(s=e._getRecaptchaConfig())||void 0===s?void 0:s.getProviderEnforcementState("PHONE_PROVIDER"))&&("auth/missing-recaptcha-token"===r.code||"auth/invalid-app-credential"===r.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);const r=await Ue(e,t,n,!1,!0);return i(e,r)}return Promise.reject(r)}))}{const r=await Ue(e,t,n,!1,!0);return i(e,r)}}return Promise.reject(r+" provider is not supported.")}async function je(e){const t=Ce(e),n=await K(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),i=new $(n);if(null==t.tenantId?t._agentRecaptchaConfig=i:t._tenantRecaptchaConfigs[t.tenantId]=i,i.isAnyProviderEnabled()){new Fe(t).verify()}}function qe(e,t,n){const i=Ce(e);T(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const s=!!(null===n||void 0===n?void 0:n.disableWarnings),o=Be(t),{host:a,port:c}=function(e){const t=Be(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:ze(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:ze(t)}}}(t),u=null===c?"":`:${c}`,l={url:`${o}//${a}${u}/`},h=Object.freeze({host:a,port:c,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!i._canInitEmulator)return T(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void T((0,r.bD)(l,i.config.emulator)&&(0,r.bD)(h,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=l,i.emulatorConfig=h,i.settings.appVerificationDisabledForTesting=!0,(0,r.zJ)(a)?((0,r.gE)(`${o}//${a}${u}`),(0,r.P1)("Auth",!0)):s||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 Be(e){const t=e.indexOf(":");
2return t<0?"":e.substr(0,t+1)}function ze(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class $e{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return I("not implemented")}_getIdTokenResponse(e){return I("not implemented")}_linkToIdToken(e,t){return I("not implemented")}_getReauthenticationResolver(e){return I("not implemented")}}async function Ke(e,t){return M(e,"POST","/v1/accounts:resetPassword",L(e,t))}async function He(e,t){return M(e,"POST","/v1/accounts:signUp",t)}async function We(e,t){return F(e,"POST","/v1/accounts:signInWithPassword",L(e,t))}async function Ge(e,t){return M(e,"POST","/v1/accounts:sendOobCode",L(e,t))}async function Qe(e,t){return Ge(e,t)}async function Je(e,t){return Ge(e,t)}class Xe extends $e{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new Xe(e,t,"password")}static _fromEmailAndCode(e,t){return new Xe(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}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((null===t||void 0===t?void 0:t.email)&&(null===t||void 0===t?void 0: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 Ve(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",We,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return async function(e,t){return F(e,"POST","/v1/accounts:signInWithEmailLink",L(e,t))}(e,{email:this._email,oobCode:this._password});default:m(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Ve(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",He,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return async function(e,t){return F(e,"POST","/v1/accounts:signInWithEmailLink",L(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:m(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Ye(e,t){return F(e,"POST","/v1/accounts:signInWithIdp",L(e,t))}class Ze extends $e{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Ze(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):m("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
2once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e,{providerId:n,signInMethod:i}=t,r=(0,o.Tt)(t,["providerId","signInMethod"]);if(!n||!i)return null;const s=new Ze(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(e){return Ye(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ye(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ye(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,r.Am)(t)}return e}}async function et(e,t){return M(e,"POST","/v1/accounts:sendVerificationCode",L(e,t))}const tt={USER_NOT_FOUND:"user-not-found"};class nt extends $e{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new nt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new nt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return F(e,"POST","/v1/accounts:signInWithPhoneNumber",L(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await F(e,"POST","/v1/accounts:signInWithPhoneNumber",L(e,t));if(n.temporaryProof)throw q(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return F(e,"POST","/v1/accounts:signInWithPhoneNumber",L(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),tt)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:i}}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:i,temporaryProof:r}=e;return n||t||i||r?new nt({verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:r}):null}}class it{constructor(e){var t,n,i,s,o,a;const c=(0,r.I9)((0,r.hp)(e)),u=null!==(t=c.apiKey)&&void 0!==t?t:null,l=null!==(n=c.oobCode)&&void 0!==n?n:null,h=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}}(null!==(i=c.mode)&&void 0!==i?i:null);T(u&&l&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=l,this.continueUrl=null!==(s=c.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(o=c.lang)&&void 0!==o?o:null,this.tenantId=null!==(a=c.tenantId)&&void 0!==a?a:null}static parseLink(e){const t=function(e){const t=(0,r.I9)((0,r.hp)(e)).link,n=t?(0,r.I9)((0,r.hp)(t)).deep_link_id:null,i=(0,r.I9)((0,r.hp)(e)).deep_link_id;return(i?(0,r.I9)((0,r.hp)(i)).link:null)||i||n||t||e}(e);try{return new it(t)}catch(n){return null}}}class rt{constructor(){this.providerId=rt.PROVIDER_ID}static credential(e,t){return Xe._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=it.parseLink(t);return T(n,"argument-error"),Xe._fromEmailAndCode(e,n.code,n.tenantId)}}rt.PROVIDER_ID="password",rt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",rt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class st{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 ot extends st{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class at extends ot{static credentialFromJSON(e){const t="string"===typeof e?JSON.parse(e):e;return T("providerId"in t&&"signInMethod"in t,"argument-error"),Ze._fromParams(t)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return T(e.idToken||e.accessToken,"argument-error"),Ze._fromParams(Object.assign(Object.assign({}
2,e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return at.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return at.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthIdToken:n,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:a}=t;if(!i&&!r&&!n&&!s)return null;if(!a)return null;try{return new at(a)._credential({idToken:n,accessToken:i,nonce:o,pendingToken:s})}catch(c){return null}}}class ct extends ot{constructor(){super("facebook.com")}static credential(e){return Ze._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return ct.credential(t.oauthAccessToken)}catch(n){return null}}}ct.FACEBOOK_SIGN_IN_METHOD="facebook.com",ct.PROVIDER_ID="facebook.com";class ut extends ot{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Ze._fromParams({providerId:ut.PROVIDER_ID,signInMethod:ut.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ut.credentialFromTaggedObject(e)}static credentialFromError(e){return ut.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthIdToken:n,oauthAccessToken:i}=t;if(!n&&!i)return null;try{return ut.credential(n,i)}catch(r){return null}}}ut.GOOGLE_SIGN_IN_METHOD="google.com",ut.PROVIDER_ID="google.com";class lt extends ot{constructor(){super("github.com")}static credential(e){return Ze._fromParams({providerId:lt.PROVIDER_ID,signInMethod:lt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return lt.credentialFromTaggedObject(e)}static credentialFromError(e){return lt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return lt.credential(t.oauthAccessToken)}catch(n){return null}}}lt.GITHUB_SIGN_IN_METHOD="github.com",lt.PROVIDER_ID="github.com";class ht extends $e{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return Ye(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ye(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ye(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:i,pendingToken:r}=t;return n&&i&&r&&n===i?new ht(n,r):null}static _create(e,t){return new ht(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class dt extends st{constructor(e){T(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return dt.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return dt.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){const t=ht.fromJSON(e);return T(t,"argument-error"),t}static samlCredentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{pendingToken:n,providerId:i}=t;if(!n||!i)return null;try{return ht._create(i,n)}catch(r){return null}}}class ft extends ot{constructor(){super("twitter.com")}static credential(e,t){return Ze._fromParams({providerId:ft.PROVIDER_ID,signInMethod:ft.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return ft.credentialFromTaggedObject(e)}static credentialFromError(e){return ft.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:i}
2=t;if(!n||!i)return null;try{return ft.credential(n,i)}catch(r){return null}}}async function pt(e,t){return F(e,"POST","/v1/accounts:signUp",L(e,t))}ft.TWITTER_SIGN_IN_METHOD="twitter.com",ft.PROVIDER_ID="twitter.com";class gt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await re._fromIdTokenResponse(e,n,i),s=mt(n);return new gt({user:r,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const i=mt(n);return new gt({user:e,providerId:i,_tokenResponse:n,operationType:t})}}function mt(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}async function vt(e){var t;if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const n=Ce(e);if(await n._initializationPromise,null===(t=n.currentUser)||void 0===t?void 0:t.isAnonymous)return new gt({user:n.currentUser,providerId:null,operationType:"signIn"});const r=await pt(n,{returnSecureToken:!0}),s=await gt._fromIdTokenResponse(n,"signIn",r,!0);return await n._updateCurrentUser(s.user),s}class yt extends r.g{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,yt.prototype),this.customData={appName:e.name,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new yt(e,t,n,i)}}function wt(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw yt._fromErrorAndOperation(e,n,t,i);throw n}))}function _t(e){return new Set(e.map((e=>{let{providerId:t}=e;return t})).filter((e=>!!e)))}async function bt(e,t){const n=(0,r.Ku)(e);await It(!0,n,t);const{providerUserInfo:i}=await async function(e,t){return M(e,"POST","/v1/accounts:update",t)}(n.auth,{idToken:await n.getIdToken(),deleteProvider:[t]}),s=_t(i||[]);return n.providerData=n.providerData.filter((e=>s.has(e.providerId))),s.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function Tt(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=await X(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return gt._forOperation(e,"link",i)}async function It(e,t,n){await ee(t);const i=!1===e?"provider-already-linked":"no-such-provider";T(_t(t.providerData).has(n)===e,t.auth,i)}async function Et(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{auth:r}=e;if((0,i._isFirebaseServerApp)(r.app))return Promise.reject(w(r));const s="reauthenticate";try{const i=await X(e,wt(r,s,t,e),n);T(i.idToken,r,"internal-error");const o=Q(i.idToken);T(o,r,"internal-error");const{sub:a}=o;return T(e.uid===a,r,"user-mismatch"),gt._forOperation(e,s,i)}catch(o){throw"auth/user-not-found"===(null===o||void 0===o?void 0:o.code)&&m(r,"user-mismatch"),o}}async function St(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const r="signIn",s=await wt(e,r,t),o=await gt._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}async function Ct(e,t){return St(Ce(e),t)}async function At(e,t){const n=(0,r.Ku)(e);return await It(!1,n,t.providerId),Tt(n,t)}async function kt(e,t){return Et((0,r.Ku)(e),t)}async function Rt(e,t){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const n=Ce(e),r=await async function(e,t){return F(e,"POST","/v1/accounts:signInWithCustomToken",L(e,t))}(n,{token:t,returnSecureToken:!0}),s=await gt._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(s.user),s}class Nt{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?Pt._fromServerResponse(e,t):"totpInfo"in t?Ot._fromServerResponse(e,t):m(e,"internal-error")}}class Pt extends Nt{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new Pt(t)}}class Ot extends Nt{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new Ot(t)}}function Dt(e,t,n){var i;T((null===(i=n.url)||void 0===i?void 0:i.length)>
20,e,"invalid-continue-uri"),T("undefined"===typeof n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),T("undefined"===typeof 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&&(T(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(T(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 Lt(e){const t=Ce(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function Mt(e,t,n){const i=Ce(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};n&&Dt(i,r,n),await Ve(i,r,"getOobCode",Qe,"EMAIL_PASSWORD_PROVIDER")}async function xt(e,t,n){await Ke((0,r.Ku)(e),{oobCode:t,newPassword:n}).catch((async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&Lt(e),t}))}async function Ft(e,t){await async function(e,t){return M(e,"POST","/v1/accounts:update",L(e,t))}((0,r.Ku)(e),{oobCode:t})}async function Ut(e,t){const n=(0,r.Ku)(e),i=await Ke(n,{oobCode:t}),s=i.requestType;switch(T(s,n,"internal-error"),s){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":T(i.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":T(i.mfaInfo,n,"internal-error");default:T(i.email,n,"internal-error")}let o=null;return i.mfaInfo&&(o=Nt._fromServerResponse(Ce(n),i.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:o},operation:s}}async function Vt(e,t){const{data:n}=await Ut((0,r.Ku)(e),t);return n.email}async function jt(e,t,n){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const r=Ce(e),s=Ve(r,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",pt,"EMAIL_PASSWORD_PROVIDER"),o=await s.catch((t=>{throw"auth/password-does-not-meet-requirements"===t.code&&Lt(e),t})),a=await gt._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function qt(e,t,n){return(0,i._isFirebaseServerApp)(e.app)?Promise.reject(w(e)):Ct((0,r.Ku)(e),rt.credential(t,n)).catch((async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&Lt(e),t}))}async function Bt(e,t,n){const i=Ce(e),r={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"};!function(e,t){T(t.handleCodeInApp,i,"argument-error"),t&&Dt(i,e,t)}(r,n),await Ve(i,r,"getOobCode",Je,"EMAIL_PASSWORD_PROVIDER")}function zt(e,t){const n=it.parseLink(t);return"EMAIL_SIGNIN"===(null===n||void 0===n?void 0:n.operation)}async function $t(e,t,n){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const s=(0,r.Ku)(e),o=rt.credentialWithLink(t,n||S());return T(o._tenantId===(s.tenantId||null),s,"tenant-id-mismatch"),Ct(s,o)}async function Kt(e,t){const n={identifier:t,continueUri:C()?S():"http://localhost"},{signinMethods:i}=await async function(e,t){return M(e,"POST","/v1/accounts:createAuthUri",L(e,t))}((0,r.Ku)(e),n);return i||[]}async function Ht(e,t){const n=(0,r.Ku)(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Dt(n.auth,i,t);const{email:s}=await async function(e,t){return Ge(e,t)}(n.auth,i);s!==e.email&&await e.reload()}async function Wt(e,t,n){const i=(0,r.Ku)(e),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&Dt(i.auth,s,n);const{email:o}=await async function(e,t){return Ge(e,t)}(i.auth,s);o!==e.email&&await e.reload()}async function Gt(e,t){let{displayName:n,photoURL:i}=t;if(void 0===n&&void 0===i)return;const s=(0,r.Ku)(e),o={idToken:await s.getIdToken(),displayName:n,photoUrl:i,returnSecureToken:!0},a=await X(s,async function(e,t){return M(e,"POST","/v1/accounts:update",t)}(s.auth,o));s.displayName=a.displayName||null,s.photoURL=a.photoUrl||null;const c=s.providerData.find((e=>{let{providerId:t}=e;return"password"===t}));c&&(c.displayName=s.displayName,c.photoURL=s.photoURL),await s._updateTokensIfNecessary(a)}function Qt(e,t){const n=(0,r.Ku)(e);return(0,i._isFirebaseServerApp)(n.auth.app)?Promise.reject(w(n.auth)):Xt(n,t,null)}function Jt(e,t){return Xt((0,r.Ku)(e),null,t)}async function Xt(e,t,n){const{auth:i}=e,r={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(r.email=t),n&&(r.password=n);const s=await X(e,async function(e,t){return M(e,"POST","/v1/accounts:update",t)}(i,r));await e._updateTokensIfNecessary(s,!0)}
2class Yt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.isNewUser=e,this.providerId=t,this.profile=n}}class Zt extends Yt{constructor(e,t,n,i){super(e,t,n),this.username=i}}class en extends Yt{constructor(e,t){super(e,"facebook.com",t)}}class tn extends Zt{constructor(e,t){super(e,"github.com",t,"string"===typeof(null===t||void 0===t?void 0:t.login)?null===t||void 0===t?void 0:t.login:null)}}class nn extends Yt{constructor(e,t){super(e,"google.com",t)}}class rn extends Zt{constructor(e,t,n){super(e,"twitter.com",t,n)}}function sn(e){const{user:t,_tokenResponse:n}=e;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;const{providerId:i}=e,r=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},s=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!i&&(null===e||void 0===e?void 0:e.idToken)){const i=null===(n=null===(t=Q(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(i)return new Yt(s,"anonymous"!==i&&"custom"!==i?i:null)}if(!i)return null;switch(i){case"facebook.com":return new en(s,r);case"github.com":return new tn(s,r);case"google.com":return new nn(s,r);case"twitter.com":return new rn(s,r,e.screenName||null);case"custom":case"anonymous":return new Yt(s,null);default:return new Yt(s,i,r)}}(n)}class on{constructor(e,t,n){this.type=e,this.credential=t,this.user=n}static _fromIdtoken(e,t){return new on("enroll",e,t)}static _fromMfaPendingCredential(e){return new on("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t,n;if(null===e||void 0===e?void 0:e.multiFactorSession){if(null===(t=e.multiFactorSession)||void 0===t?void 0:t.pendingCredential)return on._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null===(n=e.multiFactorSession)||void 0===n?void 0:n.idToken)return on._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=Ce(e),i=t.customData._serverResponse,r=(i.mfaInfo||[]).map((e=>Nt._fromServerResponse(n,e)));T(i.mfaPendingCredential,n,"internal-error");const s=on._fromMfaPendingCredential(i.mfaPendingCredential);return new an(s,r,(async e=>{const r=await e._process(n,s);delete i.mfaInfo,delete i.mfaPendingCredential;const o=Object.assign(Object.assign({},i),{idToken:r.idToken,refreshToken:r.refreshToken});switch(t.operationType){case"signIn":const e=await gt._fromIdTokenResponse(n,t.operationType,o);return await n._updateCurrentUser(e.user),e;case"reauthenticate":return T(t.user,n,"internal-error"),gt._forOperation(t.user,t.operationType,o);default:m(n,"internal-error")}}))}async resolveSignIn(e){const t=e;return this.signInResolver(t)}}function cn(e,t){var n;const i=(0,r.Ku)(e),s=t;return T(t.customData.operationType,i,"argument-error"),T(null===(n=s.customData._serverResponse)||void 0===n?void 0:n.mfaPendingCredential,i,"argument-error"),an._fromError(i,s)}function un(e,t){return M(e,"POST","/v2/accounts/mfaEnrollment:start",L(e,t))}class ln{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload((t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map((t=>Nt._fromServerResponse(e.auth,t))))}))}static _fromUser(e){return new ln(e)}async getSession(){return on._fromIdtoken(await this.user.getIdToken(),this.user)}
2async enroll(e,t){const n=e,i=await this.getSession(),r=await X(this.user,n._process(this.user.auth,i,t));return await this.user._updateTokensIfNecessary(r),this.user.reload()}async unenroll(e){const t="string"===typeof e?e:e.uid,n=await this.user.getIdToken();try{const e=await X(this.user,(i=this.user.auth,r={idToken:n,mfaEnrollmentId:t},M(i,"POST","/v2/accounts/mfaEnrollment:withdraw",L(i,r))));this.enrolledFactors=this.enrolledFactors.filter((e=>{let{uid:n}=e;return n!==t})),await this.user._updateTokensIfNecessary(e),await this.user.reload()}catch(s){throw s}var i,r}}const hn=new WeakMap;function dn(e){const t=(0,r.Ku)(e);return hn.has(t)||hn.set(t,ln._fromUser(t)),hn.get(t)}const fn="__sak";class pn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(fn,"1"),this.storage.removeItem(fn),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){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 gn extends pn{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=be(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStorageEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;t?this.detachListener():this.stopPolling();const i=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);(0,r.lT)()&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const i of Array.from(n))i(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]}}gn.type="LOCAL";const mn=gn;function vn(e){var t,n;const i=e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=RegExp(`${i}=([^;]+)`);return null!==(n=null===(t=document.cookie.match(r))||void 0===t?void 0:t[1])&&void 0!==n?n:null}function yn(e){return`${"http:"===window.location.protocol?"__dev_":"__HOST-"}FIREBASE_${e.split(":")[3]}`}class wn{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(){var e;return!("boolean"===typeof isSecureContext&&!isSecureContext)&&("undefined"!==typeof navigator&&"undefined"!==typeof document&&(null===(e=navigator.cookieEnabled)||void 0===e||e))}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;const t=yn(e);if(window.cookieStore){const e=await window.cookieStore.get(t);return null===e||void 0===e?void 0:e.value}return vn(t)}async _remove(e){if(!this._isAvailable())return;if(!await this._get(e))return;const t=yn(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=yn(e);if(window.cookieStore){const e=e=>{const i=e.changed.find((e=>e.name===n));i&&t(i.value);e.deleted.find((e=>e.name===n))&&t(null)},i=()=>window.cookieStore.removeEventListener("change",e);return this.listenerUnsubscribes.set(t,i),window.cookieStore.addEventListener("change",e)}let i=vn(n);const r=setInterval((()=>{const e=vn(n);e!==i&&(t(e),i=e)}),1e3);this.listenerUnsubscribes.set(t,(()=>clearInterval(r)))}_removeListener(e,t){const n=this.listenerUnsubscribes.get(t);n&&(n(),this.listenerUnsubscribes.delete(t))}}wn.type="COOKIE";class _n extends pn{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}_n.type="SESSION";const bn=_n;class Tn{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 Tn(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:i,data:r}=t.data,s=this.handlersMap[i];if(!(null===s||void 0===s?void 0:s.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).map((async e=>e(t.origin,r))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function In(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="";for(let i=0;i<t;i++)n+=Math.floor(10*Math.random());return e+n}Tn.receivers=[];class En{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){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;const i="undefined"!==typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise(((o,a)=>{const c=In("",20);i.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:i,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(t.data.response);break;default:clearTimeout(u),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[i.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}function Sn(){return window}function Cn(){return"undefined"!==typeof Sn().WorkerGlobalScope&&"function"===typeof Sn().importScripts}const An="firebaseLocalStorageDb",kn="firebaseLocalStorage",Rn="fbase_key";class Nn{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 Pn(e,t){return e.transaction([kn],t?"readwrite":"readonly").objectStore(kn)}function On(){const e=indexedDB.open(An,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(kn,{keyPath:Rn})}catch(i){n(i)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(kn)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(An);
vendor: 6,591 bytes, line 2
2return new Nn(e).toPromise()}(),t(await On()))}))}))}async function Dn(e,t,n){const i=Pn(e,!0).put({[Rn]:t,value:n});return new Nn(i).toPromise()}function Ln(e,t){const n=Pn(e,!0).delete(t);return new Nn(n).toPromise()}class Mn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await On()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(n){if(t++>3)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Cn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Tn._getInstance(Cn()?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(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new En(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await On();return await Dn(e,fn,"1"),await Ln(e,fn),!0}catch(e){}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=>Dn(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=Pn(e,!1).get(t),i=await new Nn(n).toPromise();return void 0===i?null:i.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>Ln(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Pn(e,!1).getAll();return new Nn(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!n.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const i of Array.from(n))i(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()}}Mn.type="LOCAL";const xn=Mn;function Fn(e,t){return M(e,"POST","/v2/accounts/mfaSignIn:start",L(e,t))}const Un=Ne("rcb"),Vn=new k(3e4,6e4);class jn{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!(null===(e=Sn().grecaptcha)||void 0===e?void 0:e.render)}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return T(function(e){return e.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e)}(t),e,"argument-error"),this.shouldResolveImmediately(t)&&B(Sn().grecaptcha)?Promise.resolve(Sn().grecaptcha):new Promise(((n,i)=>{const s=Sn().setTimeout((()=>{i(v(e,"network-request-failed"))}),Vn.get());Sn()[Un]=()=>{Sn().clearTimeout(s),delete Sn()[Un];const r=Sn().grecaptcha;if(!r||!B(r))return void i(v(e,"internal-error"));const o=r.render;r.render=(e,t)=>{const n=o(e,t);return this.counter++,n},this.hostLanguage=t,n(r)};Re(`${ke.recaptchaV2Script}?${(0,r.Am)({onload:Un,render:"explicit",hl:t})}`).catch((()=>{clearTimeout(s),i(v(e,"internal-error"))}))}))}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!!(null===(t=Sn().grecaptcha)||void 0===t?void 0:t.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}class qn{async load(e){return new Oe(e)}clearedOneInstance(){}}const Bn="recaptcha",zn={theme:"light",type:"image"};class $n{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.assign({},zn);this.parameters=n,this.type=Bn,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=Ce(e),this.isInvisible="invisible"===this.parameters.size,T("undefined"!==typeof document,this.auth,"operation-not-supported-in-this-environment");const i="string"===typeof t?document.getElementById(t):t;T(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new qn:new jn,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),t=this.getAssertedRecaptcha(),n=t.getResponse(e);return n||new Promise((n=>{const i=e=>{e&&(this.tokenChangeListeners.delete(i),n(e))};this.tokenChangeListeners.add(i),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(){T(!this.parameters.sitekey,this.auth,"argument-error"),T(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),T("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=Sn()[e];"function"===typeof n&&n(t)}}}assertNotDestroyed(){T(!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(){T(C()&&!Cn(),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 M(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}(this.auth);
2T(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return T(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class Kn{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){const t=nt._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function Hn(e,t,n){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const s=Ce(e),o=await Qn(s,t,(0,r.Ku)(n));return new Kn(o,(e=>Ct(s,e)))}async function Wn(e,t,n){const i=(0,r.Ku)(e);await It(!1,i,"phone");const s=await Qn(i.auth,t,(0,r.Ku)(n));return new Kn(s,(e=>At(i,e)))}async function Gn(e,t,n){const s=(0,r.Ku)(e);if((0,i._isFirebaseServerApp)(s.auth.app))return Promise.reject(w(s.auth));const o=await Qn(s.auth,t,(0,r.Ku)(n));return new Kn(o,(e=>kt(s,e)))}async function Qn(e,t,n){var i;if(!e._getRecaptchaConfig())try{await je(e)}catch(r){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){T("enroll"===t.type,e,"internal-error");const i={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=Ve(e,i,"mfaSmsEnrollment",(async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===xe){T((null===n||void 0===n?void 0:n.type)===Bn,e,"argument-error");return un(e,await Xn(e,t,n))}return un(e,t)}),"PHONE_PROVIDER");return(await s.catch((e=>Promise.reject(e)))).phoneSessionInfo.sessionInfo}{T("signin"===t.type,e,"internal-error");const s=(null===(i=r.multiFactorHint)||void 0===i?void 0:i.uid)||r.multiFactorUid;T(s,e,"missing-multi-factor-info");const o={mfaPendingCredential:t.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=Ve(e,o,"mfaSmsSignIn",(async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===xe){T((null===n||void 0===n?void 0:n.type)===Bn,e,"argument-error");return Fn(e,await Xn(e,t,n))}return Fn(e,t)}),"PHONE_PROVIDER");return(await a.catch((e=>Promise.reject(e)))).phoneResponseInfo.sessionInfo}}{const t={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"},i=Ve(e,t,"sendVerificationCode",(async(e,t)=>{if(t.captchaResponse===xe){T((null===n||void 0===n?void 0:n.type)===Bn,e,"argument-error");return et(e,await Xn(e,t,n))}return et(e,t)}),"PHONE_PROVIDER");return(await i.catch((e=>Promise.reject(e)))).sessionInfo}}finally{null===n||void 0===n||n._reset()}}async function Jn(e,t){const n=(0,r.Ku)(e);if((0,i._isFirebaseServerApp)(n.auth.app))return Promise.reject(w(n.auth));await Tt(n,t)}async function Xn(e,t,n){T(n.type===Bn,e,"argument-error");const i=await n.verify();T("string"===typeof i,e,"argument-error");const r=Object.assign({},t);if("phoneEnrollmentInfo"in r){const e=r.phoneEnrollmentInfo.phoneNumber,t=r.phoneEnrollmentInfo.captchaResponse,n=r.phoneEnrollmentInfo.clientType,s=r.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(r,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:i,captchaResponse:t,clientType:n,recaptchaVersion:s}}),r}if("phoneSignInInfo"in r){const e=r.phoneSignInInfo.captchaResponse,t=r.phoneSignInInfo.clientType,n=r.phoneSignInInfo.recaptchaVersion;return Object.assign(r,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:e,clientType:t,recaptchaVersion:n}}),r}return Object.assign(r,{recaptchaToken:i}),r}class Yn{constructor(e){this.providerId=Yn.PROVIDER_ID,this.auth=Ce(e)}verifyPhoneNumber(e,t){return Qn(this.auth,e,(0,r.Ku)(t))}static credential(e,t){return nt._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Yn.credentialFromTaggedObject(t)}static credentialFromError(e){return Yn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{phoneNumber:n,temporaryProof:i}=t;return n&&i?nt._fromTokenResponse(n,i):null}}function Zn(e,t){return t?oe(t):(T(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Yn.PROVIDER_ID="phone",Yn.PHONE_SIGN_IN_METHOD="phone";class ei extends $e{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ye(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ye(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ye(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 ti(e){return St(e.auth,new ei(e),e.bypassAuthState)}function ni(e){const{auth:t,user:n}=e;return T(n,t,"internal-error"),Et(n,new ei(e),e.bypassAuthState)}async function ii(e){const{auth:t,user:n}=e;return T(n,t,"internal-error"),Tt(n,new ei(e),e.bypassAuthState)}class ri{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:i,tenantId:r,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ti;case"linkViaPopup":case"linkViaRedirect":return ii;case"reauthViaPopup":case"reauthViaRedirect":return ni;default:m(this.auth,"internal-error")}}resolve(e){E(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){E(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 si=new k(2e3,1e4);async function oi(e,t,n){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(v(e,"operation-not-supported-in-this-environment"));const r=Ce(e);_(e,t,st);const s=Zn(r,n);return new ui(r,"signInViaPopup",t,s).executeNotNull()}async function ai(e,t,n){const s=(0,r.Ku)(e);if((0,i._isFirebaseServerApp)(s.auth.app))return Promise.reject(v(s.auth,"operation-not-supported-in-this-environment"));_(s.auth,t,st);const o=Zn(s.auth,n);return new ui(s.auth,"reauthViaPopup",t,o,s).executeNotNull()}async function ci(e,t,n){const i=(0,r.Ku)(e);_(i.auth,t,st);const s=Zn(i.auth,n);return new ui(i.auth,"linkViaPopup",t,s,i).executeNotNull()}class ui extends ri{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,ui.currentPopupAction&&ui.currentPopupAction.cancel(),ui.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return T(e,this.auth,"internal-error"),e}async onExecution(){E(1===this.filter.length,"Popup operations only handle one event");const e=In();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(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.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,ui.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(v(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,si.get())};e()}}ui.currentPopupAction=null;const li=new Map;class hi extends ri{constructor(e,t){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,arguments.length>2&&void 0!==arguments[2]&&arguments[2]),this.eventId=null}async execute(){let e=li.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=mi(t),i=gi(e);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}li.set(this.auth._key(),e)}return this.bypassAuthState||li.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 di(e,t){return gi(e)._set(mi(t),"true")}function fi(){li.clear()}function pi(e,t){li.set(e._key(),t)}function gi(e){return oe(e._redirectPersistence)}function mi(e){return ue("pendingRedirect",e.config.apiKey,e.name)}function vi(e,t,n){return async function(e,t,n){if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const r=Ce(e);_(e,t,st),await r._initializationPromise;const s=Zn(r,n);return await di(s,r),s._openRedirect(r,t,"signInViaRedirect")}(e,t,n)}function yi(e,t,n){return async function(e,t,n){const s=(0,r.Ku)(e);if(_(s.auth,t,st),(0,i._isFirebaseServerApp)(s.auth.app))return Promise.reject(w(s.auth));await s.auth._initializationPromise;const o=Zn(s.auth,n);await di(o,s.auth);const a=await Ti(s);return o._openRedirect(s.auth,t,"reauthViaRedirect",a)}(e,t,n)}function wi(e,t,n){return async function(e,t,n){const i=(0,r.Ku)(e);_(i.auth,t,st),await i.auth._initializationPromise;const s=Zn(i.auth,n);await It(!1,i,t.providerId),await di(s,i.auth);const o=await Ti(i);return s._openRedirect(i.auth,t,"linkViaRedirect",o)}(e,t,n)}async function _i(e,t){return await Ce(e)._initializationPromise,bi(e,t,!1)}async function bi(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,i._isFirebaseServerApp)(e.app))return Promise.reject(w(e));const r=Ce(e),s=Zn(r,t),o=new hi(r,s,n),a=await o.execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,t)),a}async function Ti(e){const t=In(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Ii{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 Si(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!Si(e)){const i=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(v(this.auth,i))}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(Ei(e))}saveEventToCache(e){this.cachedEventUids.add(Ei(e)),this.lastProcessedEventTime=Date.now()}}function Ei(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function Si(e){let{type:t,error:n}=e;return"unknown"===t&&"auth/no-auth-event"===(null===n||void 0===n?void 0:n.code)}async function Ci(e){return M(e,"GET","/v1/projects",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}const Ai=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ki=/^https?/;function Ri(e){const t=S(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){const r=new URL(e);return""===r.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!ki.test(n))return!1;if(Ai.test(e))return i===e;const r=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}const Ni=new k(3e4,6e4);function Pi(){const e=Sn().___jsl;if(null===e||void 0===e?void 0: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 n=0;n<e.CP.length;n++)e.CP[n]=null}function Oi(e){return new Promise(((t,n)=>{var i,r,s;function o(){Pi(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Pi(),n(v(e,"network-request-failed"))},timeout:Ni.get()})}if(null===(r=null===(i=Sn().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)t(gapi.iframes.getContext());else{if(!(null===(s=Sn().gapi)||void 0===s?void 0:s.load)){const t=Ne("iframefcb");return Sn()[t]=()=>{gapi.load?o():n(v(e,"network-request-failed"))},Re(`${ke.gapiScript}?onload=${t}`).catch((e=>n(e)))}o()}})).catch((e=>{throw Di=null,e}))}let Di=null;const Li=new k(5e3,15e3),Mi={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},xi=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Fi(e){const t=e.config;T(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?R(t,"emulator/auth/iframe"):`https://${e.config.authDomain}
2/__/auth/iframe`,s={apiKey:t.apiKey,appName:e.name,v:i.SDK_VERSION},o=xi.get(e.config.apiHost);o&&(s.eid=o);const a=e._getFrameworks();return a.length&&(s.fw=a.join(",")),`${n}?${(0,r.Am)(s).slice(1)}`}async function Ui(e){const t=await function(e){return Di=Di||Oi(e),Di}(e),n=Sn().gapi;return T(n,e,"internal-error"),t.open({where:document.body,url:Fi(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Mi,dontclear:!0},(t=>new Promise((async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=v(e,"network-request-failed"),s=Sn().setTimeout((()=>{i(r)}),Li.get());function o(){Sn().clearTimeout(s),n(t)}t.ping(o).then(o,(()=>{i(r)}))}))))}const Vi={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ji{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function qi(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600;const o=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-i)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Vi),{width:i.toString(),height:s.toString(),top:o,left:a}),l=(0,r.ZQ)().toLowerCase();n&&(c=pe(l)?"_blank":n),de(l)&&(t=t||"http://localhost",u.scrollbars="yes");const h=Object.entries(u).reduce(((e,t)=>{let[n,i]=t;return`${e}${n}=${i},`}),"");if(function(){var e;return we(arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,r.ZQ)())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==c)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(t||"",c),new ji(null);const d=window.open(t||"",c,h);T(d,e,"popup-blocked");try{d.focus()}catch(f){}return new ji(d)}const Bi="__/auth/handler",zi="emulator/auth/handler",$i=encodeURIComponent("fac");async function Ki(e,t,n,s,o,a){T(e.config.authDomain,e,"auth-domain-config-required"),T(e.config.apiKey,e,"invalid-api-key");const c={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:s,v:i.SDK_VERSION,eventId:o};if(t instanceof st){t.setDefaultLanguage(e.languageCode),c.providerId=t.providerId||"",(0,r.Im)(t.getCustomParameters())||(c.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(a||{}))c[e]=t}if(t instanceof ot){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 i of Object.keys(u))void 0===u[i]&&delete u[i];const l=await e._getAppCheckToken(),h=l?`#${$i}=${encodeURIComponent(l)}`:"";return`${function(e){let{config:t}=e;if(!t.emulator)return`https://${t.authDomain}/${Bi}`;return R(t,zi)}(e)}?${(0,r.Am)(u).slice(1)}${h}`}const Hi="webStorageSupport";const Wi=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=bn,this._completeRedirectFn=bi,this._overrideRedirectResult=pi}async _openPopup(e,t,n,i){var r;E(null===(r=this.eventManagers[e._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return qi(e,await Ki(e,t,n,S(),i),In())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){Sn().location.href=e}(await Ki(e,t,n,S(),i)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(E(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 Ui(e),n=new Ii(e);return t.register("authEvent",(t=>{T(null===t||void 0===t?void 0: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(Hi,{type:Hi},(n=>{var i;const r=null===(i=null===n||void 0===n?void 0:n[0])||void 0===i?void 0:i[Hi];
2void 0!==r&&t(!!r),m(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){if(e.config.emulator)return;const{authorizedDomains:t}=await Ci(e);for(const i of t)try{if(Ri(i))return}catch(n){}m(e,"unauthorized-domain")}(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return be()||fe()||we()}};class Gi{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 I("unexpected MultiFactorSessionType")}}}class Qi extends Gi{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new Qi(e)}_finalizeEnroll(e,t,n){return function(e,t){return M(e,"POST","/v2/accounts/mfaEnrollment:finalize",L(e,t))}(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return function(e,t){return M(e,"POST","/v2/accounts/mfaSignIn:finalize",L(e,t))}(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}class Ji{constructor(){}static assertion(e){return Qi._fromCredential(e)}}Ji.FACTOR_ID="phone";var Xi="@firebase/auth",Yi="1.10.8";class Zi{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.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((null===t||void 0===t?void 0: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(){T(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const er=(0,r.XA)("authIdTokenMaxAge")||300;let tr=null;function nr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.getApp)();const t=(0,i._getProvider)(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=(0,i._getProvider)(e,"auth");if(n.isInitialized()){const e=n.getImmediate(),i=n.getOptions();if((0,r.bD)(i,null!==t&&void 0!==t?t:{}))return e;m(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Wi,persistence:[xn,mn,bn]}),s=(0,r.XA)("authTokenSyncURL");if(s&&"boolean"===typeof isSecureContext&&isSecureContext){const e=new URL(s,location.origin);if(location.origin===e.origin){const t=(o=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>er)return;const i=null===t||void 0===t?void 0:t.token;tr!==i&&(tr=i,await fetch(o,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(e,t,n){(0,r.Ku)(e).beforeAuthStateChanged(t,n)}(n,t,(()=>t(n.currentUser))),function(e,t,n,i){(0,r.Ku)(e).onIdTokenChanged(t,n,i)}(n,(e=>t(e)))}}var o;const a=(0,r.Tj)("auth");return a&&qe(n,`http://${a}`),n}var ir;ke={loadJS:e=>new Promise(((t,n)=>{const i=document.createElement("script");i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=v("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(i)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},ir="Browser",(0,i._registerComponent)(new a.uA("auth",((e,t)=>
2{let{options:n}=t;const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;T(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const c={apiKey:o,authDomain:a,clientPlatform:ir,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Te(ir)},u=new Se(i,r,s,c);return function(e,t){const n=(null===t||void 0===t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(oe);(null===t||void 0===t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null===t||void 0===t?void 0:t.popupRedirectResolver)}(u,n),u}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),(0,i._registerComponent)(new a.uA("auth-internal",(e=>(e=>new Zi(e))(Ce(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,i.registerVersion)(Xi,Yi,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}}(ir)),(0,i.registerVersion)(Xi,Yi,"esm2017")},51252(e,t,n){n.d(t,{cY:()=>g,FA:()=>F,g:()=>x,dM:()=>M,u:()=>a,Uj:()=>o,p9:()=>Q,gR:()=>V,Fy:()=>y,tD:()=>H,bD:()=>q,zw:()=>c,hp:()=>K,T9:()=>f,Tj:()=>h,yU:()=>d,XA:()=>p,mS:()=>u,Ku:()=>J,ZQ:()=>T,Bd:()=>S,sr:()=>k,zJ:()=>m,c1:()=>A,Im:()=>j,lT:()=>N,zW:()=>D,jZ:()=>I,Ll:()=>E,lV:()=>R,nr:()=>P,Ov:()=>O,p7:()=>C,gE:()=>v,Am:()=>z,I9:()=>$,P1:()=>b,eX:()=>L});const i=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296===(64512&r)&&i+1<e.length&&56320===(64512&e.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<e.length;
2r+=3){const t=e[r],s=r+1<e.length,o=s?e[r+1]:0,a=r+2<e.length,c=a?e[r+2]:0,u=t>>2,l=(3&t)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),i.push(n[u],n[l],n[h],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<e.length;){const t=n[e.charAt(r++)],o=r<e.length?n[e.charAt(r)]:0;++r;const a=r<e.length?n[e.charAt(r)]:64;++r;const c=r<e.length?n[e.charAt(r)]:64;if(++r,null==t||null==o||null==a||null==c)throw new s;const u=t<<2|o>>4;if(i.push(u),64!==a){const e=o<<4&240|a>>2;if(i.push(e),64!==c){const e=a<<6&192|c;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(e){return function(e){const t=i(e);return r.encodeByteArray(t,!0)}(e).replace(/\./g,"")},a=function(e){try{return r.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=c(e[n],t[n]));return e}function u(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}const l=()=>{try{return u().__FIREBASE_DEFAULTS__||(()=>{if("undefined"===typeof process)return;const e={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"===typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}const t=e&&a(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},h=e=>{var t,n;return null===(n=null===(t=l())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},d=e=>{const t=h(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]},f=()=>{var e;return null===(e=l())||void 0===e?void 0:e.config},p=e=>{var t;return null===(t=l())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"===typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function m(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch(t){return!1}}async function v(e){return(await fetch(e,{credentials:"include"})).ok}function y(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.');
2const n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(s)),""].join(".")}const w={};let _=!1;function b(e,t){if("undefined"===typeof window||"undefined"===typeof document||!m(window.location.host)||w[e]===t||w[e]||_)return;function n(e){return`__firebase__banner__${e}`}w[e]=t;const i="__firebase__banner",r=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(w))w[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{_=!0,function(){const e=document.getElementById(i);e&&e.remove()}()},e}function o(){const e=function(e){let t=document.getElementById(e),n=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),n=!0),{created:n,element:t}}(i),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),u=n("preprendIcon"),l=document.getElementById(u)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(e.created){const t=e.element;!function(e){e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center"}(t),function(e,t){e.setAttribute("id",t),e.innerText="Learn more",e.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",e.setAttribute("target","__blank"),e.style.paddingLeft="5px",e.style.textDecoration="underline"}(c,a);const n=s();!function(e,t){e.setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px"}(l,u),t.append(l,o,c,n),document.body.appendChild(t)}r?(o.innerText="Preview backend disconnected.",l.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(l.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",t)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}function T(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function I(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(T())}function E(){var e;const t=null===(e=l())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;
2if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(i){return!1}}function S(){return"undefined"!==typeof window||C()}function C(){return"undefined"!==typeof WorkerGlobalScope&&"undefined"!==typeof self&&self instanceof WorkerGlobalScope}function A(){return"undefined"!==typeof navigator&&"Cloudflare-Workers"===navigator.userAgent}function k(){const e="object"===typeof chrome?chrome.runtime:"object"===typeof browser?browser.runtime:void 0;return"object"===typeof e&&void 0!==e.id}function R(){return"object"===typeof navigator&&"ReactNative"===navigator.product}function N(){const e=T();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function P(){return!E()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function O(){return!E()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function D(){try{return"object"===typeof indexedDB}catch(e){return!1}}function L(){return new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.error)||void 0===e?void 0:e.message)||"")}}catch(n){t(n)}}))}function M(){return!("undefined"===typeof navigator||!navigator.cookieEnabled)}class x extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,F.prototype.create)}}class F{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e){const t=(arguments.length<=1?void 0:arguments[1])||{},n=`${this.service}/${e}`,i=this.errors[e],r=i?function(e,t){return e.replace(U,((e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`}))}(i,t):"Error",s=`${this.serviceName}: ${r} (${n}).`;return new x(n,s,t)}}const U=/\{\$([^}]+)}/g;function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function j(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function q(e,t){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);for(const r of n){if(!i.includes(r))return!1;const n=e[r],s=t[r];if(B(n)&&B(s)){if(!q(n,s))return!1}else if(n!==s)return!1}for(const r of i)if(!n.includes(r))return!1;return!0}function B(e){return null!==e&&"object"===typeof e}function z(e){const t=[];for(const[n,i]of Object.entries(e))Array.isArray(i)?i.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function $(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,i]=e.split("=");
2t[decodeURIComponent(n)]=decodeURIComponent(i)}})),t}function K(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}function H(e,t){const n=new W(e,t);return n.subscribe.bind(n)}class W{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let i;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");i=function(e,t){if("object"!==typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"===typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===i.next&&(i.next=G),void 0===i.error&&(i.error=G),void 0===i.complete&&(i.complete=G);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}})),this.observers.push(i),r}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then((()=>
2{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(n){"undefined"!==typeof console&&console.error&&console.error(n)}}))}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 G(){}function Q(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;const n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3)*Math.pow(t,e),i=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+i)}function J(e){return e&&e._delegate?e._delegate:e}},70162(e,t,n){n.d(t,{A:()=>d});var i=n(51252),r=n(38183),s=n(73507),o=n(46954);class a{constructor(e,t){this._delegate=e,this.firebase=t,(0,s._addComponent)(e,new r.uA("app-compat",(()=>this),"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise((e=>{this._delegate.checkDestroyed(),e()})).then((()=>(this.firebase.INTERNAL.removeApp(this.name),(0,s.deleteApp)(this._delegate))))}_getService(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s._DEFAULT_ENTRY_NAME;var n;this._delegate.checkDestroyed();const i=this._delegate.container.getProvider(e);return i.isInitialized()||"EXPLICIT"!==(null===(n=i.getComponent())||void 0===n?void 0:n.instantiationMode)||i.initialize(),i.getImmediate({identifier:t})}_removeServiceInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s._DEFAULT_ENTRY_NAME;this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){(0,s._addComponent)(this._delegate,e)}_addOrOverwriteComponent(e){(0,s._addOrOverwriteComponent)(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}const c={"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."},u=new i.FA("app-compat","Firebase",c);const l=function e(){const t=function(e){const t={},n={__esModule:!0,initializeApp:function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=s.initializeApp(r,o);if((0,i.gR)(t,a.name))return t[a.name];const c=new e(a,n);return t[a.name]=c,c},app:r,registerVersion:s.registerVersion,setLogLevel:s.setLogLevel,onLog:s.onLog,apps:null,SDK_VERSION:s.SDK_VERSION,INTERNAL:{registerComponent:function(t){const o=t.name,a=o.replace("-compat","");if(s._registerComponent(t)&&"PUBLIC"===t.type){const s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r();if("function"!==typeof e[a])throw u.create("invalid-app-argument",{appName:o});return e[a]()};void 0!==t.serviceProps&&(0,i.zw)(s,t.serviceProps),n[a]=s,e.prototype[a]=function(){const e=this._getService.bind(this,o);for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e.apply(this,t.multipleInstances?i:[])}}return"PUBLIC"===t.type?n[a]:null},removeApp:function(e){delete t[e]},useAsService:function(e,t){if("serverAuth"===t)return null;return t},modularAPIs:s}};function r(e){if(e=e||s._DEFAULT_ENTRY_NAME,!(0,i.gR)(t,e))throw u.create("no-app",{appName:e});return t[e]}return n.default=n,Object.defineProperty(n,"apps",{get:function(){return Object.keys(t).map((e=>t[e]))}}),r.App=e,n}(a);return t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){(0,i.zw)(t,e)},createSubscribe:i.tD,ErrorFactory:i.FA,deepExtend:i.zw}),t}(),h=new o.Vy("@firebase/app-compat");try{const e=(0,i.mS)();if(void 0!==e.firebase){h.warn("\n      Warning: Firebase is already defined in the global scope. Please make sure\n      Firebase library is only loaded once.\n    ");const t=e.firebase.SDK_VERSION;t&&t.indexOf("LITE")>=0&&h.warn("\n        Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n        You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n        ")}}catch(p){}const d=l;var f;(0,s.registerVersion)("@firebase/app-compat","0.4.2",f)},73507(e,t,n){n.r(t),n.d(t,{FirebaseError:()=>s.g,SDK_VERSION:()=>R,_DEFAULT_ENTRY_NAME:()=>h,_addComponent:()=>m,_addOrOverwriteComponent:()=>v,_apps:()=>f,_clearComponents:()=>I,_components:()=>g,_getProvider:()=>w,_isFirebaseApp:()=>b,_isFirebaseServerApp:()=>T,_registerComponent:()=>y,_removeServiceInstance:()=>_,_serverApps:()=>p,deleteApp:()=>L,getApp:()=>O,getApps:()=>D,initializeApp:()=>N,initializeServerApp:()=>P,onLog:()=>x,registerVersion:()=>M,setLogLevel:()=>F});var i=n(38183),r=n(46954),s=n(51252),o=n(1986);class a{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null===t||void 0===t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const c="@firebase/app",u="0.13.2",l=new r.Vy("@firebase/app"),h="[DEFAULT]",d={[c]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},f=new Map,p=new Map,g=new Map;function m(e,t){try{e.container.addComponent(t)}catch(n){l.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function v(e,t){e.container.addOrOverwriteComponent(t)}function y(e){const t=e.name;if(g.has(t))return l.debug(`There were multiple attempts to register component ${t}.`),!1;g.set(t,e);for(const n of f.values())m(n,e);for(const n of p.values())m(n,e);return!0}function w(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function _(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h;w(e,t).clearInstance(n)}function b(e){return void 0!==e.options}function T(e){return null!==e&&void 0!==e&&void 0!==e.settings}function I(){g.clear()}const E={"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.","invali
2d-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},S=new s.FA("app","Firebase",E);class C{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new i.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 S.create("app-deleted",{appName:this._name})}}function A(e,t){const n=(0,s.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 k extends C{constructor(e,t,n,i){const r=void 0===t.automaticDataCollectionEnabled||t.automaticDataCollectionEnabled,s={name:n,automaticDataCollectionEnabled:r};if(void 0!==e.apiKey)super(e,s,i);else{super(e.options,s,i)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:r},t),this._serverConfig.authIdToken&&A(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&A(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,M(c,u,"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(){L(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw S.create("server-app-deleted")}}const R="11.10.0";function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;if("object"!==typeof t){t={name:t}}const r=Object.assign({name:h,automaticDataCollectionEnabled:!0},t),o=r.name;if("string"!==typeof o||!o)throw S.create("bad-app-name",{appName:String(o)});if(n||(n=(0,s.T9)()),!n)throw S.create("no-options");const a=f.get(o);if(a){if((0,s.bD)(n,a.options)&&(0,s.bD)(r,a.config))return a;throw S.create("duplicate-app",{appName:o})}const c=new i.h1(o);for(const i of g.values())c.addComponent(i);const u=new C(n,r,c);return f.set(o,u),u}function P(e,t){if((0,s.Bd)()&&!(0,s.p7)())throw S.create("invalid-server-app-environment");let n;void 0===t.automaticDataCollectionEnabled&&(t.automaticDataCollectionEnabled=!0),n=b(e)?e.options:e;const r=Object.assign(Object.assign({},t),n);void 0!==r.releaseOnDeref&&delete r.releaseOnDeref;if(void 0!==t.releaseOnDeref&&"undefined"===typeof FinalizationRegistry)throw S.create("finalization-registry-not-supported",{});const o=""+(a=JSON.stringify(r),[...a].reduce(((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0),0));var a;const c=p.get(o);if(c)return c.incRefCount(t.releaseOnDeref),c;const u=new i.h1(o);for(const i of g.values())u.addComponent(i);const l=new k(n,t,o,u);return p.set(o,l),l}function O(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h;const t=f.get(e);
2if(!t&&e===h&&(0,s.T9)())return N();if(!t)throw S.create("no-app",{appName:e});return t}function D(){return Array.from(f.values())}async function L(e){let t=!1;const n=e.name;if(f.has(n))t=!0,f.delete(n);else if(p.has(n)){e.decRefCount()<=0&&(p.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}function M(e,t,n){var r;let s=null!==(r=d[e])&&void 0!==r?r:e;n&&(s+=`-${n}`);const o=s.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${s}" with version "${t}":`];return o&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}y(new i.uA(`${s}-version`,(()=>({library:s,version:t})),"VERSION"))}function x(e,t){if(null!==e&&"function"!==typeof e)throw S.create("invalid-log-argument");(0,r.Ey)(e,t)}function F(e){(0,r.He)(e)}const U="firebase-heartbeat-store";let V=null;function j(){return V||(V=(0,o.P2)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(U)}catch(n){console.warn(n)}}}).catch((e=>{throw S.create("idb-open",{originalErrorMessage:e.message})}))),V}async function q(e,t){try{const n=(await j()).transaction(U,"readwrite"),i=n.objectStore(U);await i.put(t,B(e)),await n.done}catch(n){if(n instanceof s.g)l.warn(n.message);else{const e=S.create("idb-set",{originalErrorMessage:null===n||void 0===n?void 0:n.message});l.warn(e.message)}}}function B(e){return`${e.name}!${e.options.appId}`}class z{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new K(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=$();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some((e=>e.date===i)))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:n}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let i=1;i<e.length;i++)e[i].date<n&&(n=e[i].date,t=i);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){l.warn(n)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=$(),{heartbeatsToSend:n,unsentEntries:i}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;const n=[];let i=e.slice();for(const r of e){const e=n.find((e=>e.agent===r.agent));if(e){if(e.dates.push(r.date),H(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),H(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=(0,s.Uj)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(t){return l.warn(t),""}}}function $(){return(new Date).toISOString().substring(0,10)}class K{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,s.zW)()&&(0,s.eX)().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await j()).transaction(U),n=await t.objectStore(U).get(B(e));return await t.done,n}catch(t){if(t instanceof s.g)l.warn(t.message);else{const e=S.create("idb-get",{originalErrorMessage:null===t||void 0===t?void 0:t.message});l.warn(e.message)}}}(this.app);return(null===e||void 0===e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return q(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return q(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function H(e){return(0,s.Uj)(JSON.stringify({version:2,heartbeats:e})).length}var W;W="",y(new i.uA("platform-logger",(e=>new a(e)),"PRIVATE")),y(new i.uA("heartbeat",(e=>new z(e)),"PRIVATE")),M(c,u,W),M(c,u,"esm2017"),M("fire-js","")},38183(e,t,n){n.d(t,{h1:()=>a,uA:()=>r});var i=n(51252);
2class r{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 s="[DEFAULT]";class o{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 i.cY;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(n){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null===e||void 0===e?void 0:e.identifier),i=null!==(t=null===e||void 0===e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(r){if(i)return null;throw r}}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:s})}catch(t){}for(const[e,n]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:i});n.resolve(e)}catch(t){}}}}clearInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;return this.instances.has(e)}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;return this.instancesOptions.get(e)||{}}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[r,s]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(r)&&s.resolve(i)}return i}onInit(e,t){var n;const i=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(i,r);const s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(i){}}getOrInitializeService(e){let{instanceIdentifier:t,options:n={}}=e,i=this.instances.get(t);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===s?void 0:r),options:n}),this.instances.set(t,i),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(i,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,i)}catch(o){}var r;return i||null}normalizeInstanceIdentifier(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class a{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 o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},92433(e,t,n){var i=n(73507),r=n(38183),s=n(51252),o=n(1986);const a="@firebase/installations",c="0.6.18",u=1e4,l=`w:${c}`,h="FIS_v2",d=36e5,f={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},p=new s.FA("installations","Installations",f);function g(e){return e instanceof s.g&&e.code.includes("request-failed")}function m(e){let{projectId:t}=e;return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}
2function v(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function y(e,t){const n=(await t.json()).error;return p.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function w(e){let{apiKey:t}=e;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function _(e,t){let{refreshToken:n}=t;const i=w(e);return i.append("Authorization",function(e){return`${h} ${e}`}(n)),i}async function b(e){const t=await e();return t.status>=500&&t.status<600?e():t}function T(e){return new Promise((t=>{setTimeout(t,e)}))}const I=/^[cdef][\w-]{21}$/;function E(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return I.test(t)?t:""}catch(e){return""}}function S(e){return`${e.appName}!${e.appId}`}const C=new Map;function A(e,t){const n=S(e);k(n,t),function(e,t){const n=N();n&&n.postMessage({key:e,fid:t});P()}(n,t)}function k(e,t){const n=C.get(e);if(n)for(const i of n)i(t)}let R=null;function N(){return!R&&"BroadcastChannel"in self&&(R=new BroadcastChannel("[Firebase] FID Change"),R.onmessage=e=>{k(e.data.key,e.data.fid)}),R}function P(){0===C.size&&R&&(R.close(),R=null)}const O="firebase-installations-store";let D=null;function L(){return D||(D=(0,o.P2)("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(O)}})),D}async function M(e,t){const n=S(e),i=(await L()).transaction(O,"readwrite"),r=i.objectStore(O),s=await r.get(n);return await r.put(t,n),await i.done,s&&s.fid===t.fid||A(e,t.fid),t}async function x(e){const t=S(e),n=(await L()).transaction(O,"readwrite");await n.objectStore(O).delete(t),await n.done}async function F(e,t){const n=S(e),i=(await L()).transaction(O,"readwrite"),r=i.objectStore(O),s=await r.get(n),o=t(s);return void 0===o?await r.delete(n):await r.put(o,n),await i.done,!o||s&&s.fid===o.fid||A(e,o.fid),o}async function U(e){let t;const n=await F(e.appConfig,(n=>{const i=function(e){const t=e||{fid:E(),registrationStatus:0};return q(t)}(n),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(p.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function(e,t){let{appConfig:n,heartbeatServiceProvider:i}=e,{fid:r}=t;const s=m(n),o=w(n),a=i.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const c={fid:r,authVersion:h,appId:n.appId,sdkVersion:l},u={method:"POST",headers:o,body:JSON.stringify(c)},d=await b((()=>fetch(s,u)));if(d.ok){const e=await d.json();return{fid:e.fid||r,registrationStatus:2,refreshToken:e.refreshToken,authToken:v(e.authToken)}}throw await y("Create Installation",d)}(e,t);return M(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await x(e.appConfig):await M(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:V(e)}:{installationEntry:t}}(e,i);return t=r.registrationPromise,r.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function V(e){let t=await j(e.appConfig);for(;1===t.registrationStatus;)await T(100),t=await j(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await U(e);return n||t}return t}function j(e){return F(e,(e=>{if(!e)throw p.create("installation-not-found");return q(e)}))}function q(e){return 1===(t=e).registrationStatus&&t.registrationTime+u<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function B(e,t){let{appConfig:n,heartbeatServiceProvider:i}=e;const r=function(e,t){let{fid:n}=t;return`${m(e)}/${n}/authTokens:generate`}(n,t),s=_(n,t),o=i.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const a={installation:{sdkVersion:l,appId:n.appId}},c={method:"POST",headers:s,body:JSON.stringify(a)},u=await b((()=>fetch(r,c)));if(u.ok){return v(await u.json())}throw await y("Generate Auth Token",u)}async function z(e){let t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=await F(e.appConfig,(i=>{if(!K(i))throw p.create("not-registered");const r=i.authToken;if(!n&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();
2return t<e.creationTime||e.creationTime+e.expiresIn<t+d}(e)}(r))return i;if(1===r.requestStatus)return t=async function(e,t){let n=await $(e.appConfig);for(;1===n.authToken.requestStatus;)await T(100),n=await $(e.appConfig);const i=n.authToken;return 0===i.requestStatus?z(e,t):i}(e,n),i;{if(!navigator.onLine)throw p.create("app-offline");const n=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(i);return t=async function(e,t){try{const n=await B(e,t),i=Object.assign(Object.assign({},t),{authToken:n});return await M(e.appConfig,i),n}catch(n){if(!g(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await M(e.appConfig,n)}else await x(e.appConfig);throw n}}(e,n),n}}));return t?await t:i.authToken}function $(e){return F(e,(e=>{if(!K(e))throw p.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+u<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function K(e){return void 0!==e&&2===e.registrationStatus}async function H(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(n);return(await z(n,t)).token}function W(e){return p.create("missing-app-config-values",{valueName:e})}const G="installations",Q=e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw W("App Configuration");if(!e.name)throw W("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw W(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:(0,i._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},J=e=>{const t=e.getProvider("app").getImmediate(),n=(0,i._getProvider)(t,G).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await U(t);return i?i.catch(console.error):z(t).catch(console.error),n.fid}(n),getToken:e=>H(n,e)}};(0,i._registerComponent)(new r.uA(G,Q,"PUBLIC")),(0,i._registerComponent)(new r.uA("installations-internal",J,"PRIVATE")),(0,i.registerVersion)(a,c),(0,i.registerVersion)(a,c,"esm2017")},46954(e,t,n){n.d(t,{$b:()=>r,Ey:()=>h,He:()=>l,Vy:()=>u});const i=[];var r;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(r||(r={}));const s={debug:r.DEBUG,verbose:r.VERBOSE,info:r.INFO,warn:r.WARN,error:r.ERROR,silent:r.SILENT},o=r.INFO,a={[r.DEBUG]:"log",[r.VERBOSE]:"log",[r.INFO]:"info",[r.WARN]:"warn",[r.ERROR]:"error"},c=function(e,t){if(t<e.logLevel)return;const n=(new Date).toISOString(),i=a[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o];console[i](`[${n}]  ${e.name}:`,...s)};class u{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null,i.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in r))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"===typeof e?s[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(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,r.DEBUG,...t),this._logHandler(this,r.DEBUG,...t)}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,r.VERBOSE,...t),this._logHandler(this,r.VERBOSE,...t)}info(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,r.INFO,...t),this._logHandler(this,r.INFO,...t)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,r.WARN,...t),this._logHandler(this,r.WARN,...t)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,r.ERROR,...t),this._logHandler(this,r.ERROR,...t)}}
2function l(e){i.forEach((t=>{t.setLogLevel(e)}))}function h(e,t){for(const n of i){let i=null;t&&t.level&&(i=s[t.level]),n.userLogHandler=null===e?null:function(t,n){for(var s=arguments.length,o=new Array(s>2?s-2:0),a=2;a<s;a++)o[a-2]=arguments[a];const c=o.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(t){return null}})).filter((e=>e)).join(" ");n>=(null!==i&&void 0!==i?i:t.logLevel)&&e({level:r[n].toLowerCase(),message:c,args:o,type:t.name})}}}},8965(e,t,n){n.d(t,{P5:()=>x,TT:()=>F,$s:()=>V,do:()=>U});var i=n(73507),r=n(46954),s=n(51252),o=n(38183);n(92433);const a="analytics",c="https://www.googletagmanager.com/gtag/js",u=new r.Vy("@firebase/analytics"),l={"already-exists":"A Firebase Analytics instance with the appId {$id}  already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."},h=new s.FA("analytics","Analytics",l);function d(e){if(!e.startsWith(c)){const t=h.create("invalid-gtag-resource",{gtagURL:e});return u.warn(t.message),""}return e}function f(e){return Promise.all(e.map((e=>e.catch((e=>e)))))}function p(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:d}),i=document.createElement("script"),r=`${c}?l=${e}&id=${t}`;i.src=n?null===n||void 0===n?void 0:n.createScriptURL(r):r,i.async=!0,document.head.appendChild(i)}function g(e,t,n,i){return async function(r){try{for(var s=arguments.length,o=new Array(s>1?s-1:0),a=1;a<s;a++)o[a-1]=arguments[a];if("event"===r){const[i,r]=o;await async function(e,t,n,i,r){try{let s=[];if(r&&r.send_to){let e=r.send_to;Array.isArray(e)||(e=[e]);const i=await f(n);for(const n of e){const e=i.find((e=>e.measurementId===n)),r=e&&t[e.appId];if(!r){s=[];break}s.push(r)}}0===s.length&&(s=Object.values(t)),await Promise.all(s),e("event",i,r||{})}catch(s){u.error(s)}}(e,t,n,i,r)}else if("config"===r){const[r,s]=o;await async function(e,t,n,i,r,s){const o=i[r];try{if(o)await t[o];else{const e=(await f(n)).find((e=>e.measurementId===r));e&&await t[e.appId]}}catch(a){u.error(a)}e("config",r,s)}(e,t,n,i,r,s)}else if("consent"===r){const[t,n]=o;e("consent",t,n)}else if("get"===r){const[t,n,i]=o;e("get",t,n,i)}else if("set"===r){const[t]=o;e("set",t)}else e(r,...o)}catch(c){u.error(c)}}}const m=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function v(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m,n=arguments.length>2?arguments[2]:void 0;const{appId:i,apiKey:r,measurementId:s}=e.options;if(!i)throw h.create("no-app-id");
2if(!r){if(s)return{measurementId:s,appId:i};throw h.create("no-api-key")}const o=t.getThrottleMetadata(i)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new _;return setTimeout((async()=>{a.abort()}),void 0!==n?n:6e4),w({appId:i,apiKey:r,measurementId:s},o,a,t)}async function w(e,t,n){let{throttleEndTimeMillis:i,backoffCount:r}=t,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:m;var a;const{appId:c,measurementId:l}=e;try{await function(e,t){return new Promise(((n,i)=>{const r=Math.max(t-Date.now(),0),s=setTimeout(n,r);e.addEventListener((()=>{clearTimeout(s),i(h.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(n,i)}catch(d){if(l)return u.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${l} provided in the "measurementId" field in the local Firebase config. [${null===d||void 0===d?void 0:d.message}]`),{appId:c,measurementId:l};throw d}try{const t=await async function(e){var t;const{appId:n,apiKey:i}=e,r={method:"GET",headers:v(i)},s="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",n),o=await fetch(s,r);if(200!==o.status&&304!==o.status){let e="";try{const n=await o.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(a){}throw h.create("config-fetch-failed",{httpStatus:o.status,responseMessage:e})}return o.json()}(e);return o.deleteThrottleMetadata(c),t}catch(d){const t=d;if(!function(e){if(!(e instanceof s.g)||!e.customData)return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(t)){if(o.deleteThrottleMetadata(c),l)return u.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${l} provided in the "measurementId" field in the local Firebase config. [${null===t||void 0===t?void 0:t.message}]`),{appId:c,measurementId:l};throw d}const i=503===Number(null===(a=null===t||void 0===t?void 0:t.customData)||void 0===a?void 0:a.httpStatus)?(0,s.p9)(r,o.intervalMillis,30):(0,s.p9)(r,o.intervalMillis),h={throttleEndTimeMillis:Date.now()+i,backoffCount:r+1};return o.setThrottleMetadata(c,h),u.debug(`Calling attemptFetch again in ${i} millis`),w(e,h,n,o)}}class _{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let b,T;function I(e){T=e}function E(e){b=e}async function S(e,t,n,i,r,o,a){var l;const d=y(e);d.then((t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&u.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)})).catch((e=>u.error(e))),t.push(d);const f=async function(){if(!(0,s.zW)())return u.warn(h.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await(0,s.eX)()}catch(e){return u.warn(h.create("indexeddb-unavailable",{errorInfo:null===e||void 0===e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?i.getId():void 0)),[g,m]=await Promise.all([d,f]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(c)&&n.src.includes(e))return n;return null})(o)||p(o,g.measurementId),T&&(r("consent","default",T),I(void 0)),r("js",new Date);const v=null!==(l=null===a||void 0===a?void 0:a.config)&&void 0!==l?l:{};return v.origin="firebase",v.update=!0,null!=m&&(v.firebase_id=m),r("config",g.measurementId,v),b&&(r("set",b),E(void 0)),g.measurementId}class C{constructor(e){this.app=e}_delete(){return delete A[this.app.options.appId],Promise.resolve()}}let A={},k=[];const R={};let N,P,O="dataLayer",D="gtag",L=!1;function M(e,t,n){!function(){const e=[];if((0,s.sr)()&&e.push("This is a browser extension environment."),(0,s.dM)()||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=h.create("invalid-analytics-context",{errorInfo:t});u.warn(n.message)}}();const i=e.options.appId;if(!i)throw h.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw h.create("no-api-key");u.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=A[i])throw h.create("already-exists",{id:i});if(!L){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(O);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,i,r){let s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];window[i].push(arguments)};return window[r]&&"function"===typeof window[r]&&(s=window[r]),window[r]=g(s,e,t,n),{gtagCore:s,wrappedGtag:window[r]}}(A,k,R,O,D);P=e,N=t,L=!0}A[i]=S(e,k,R,t,N,O,n);return new C(e)}function x(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.getApp)();e=(0,s.Ku)(e);const t=(0,i._getProvider)(e,a);return t.isInitialized()?t.getImmediate():function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,i._getProvider)(e,a);if(n.isInitialized()){const e=n.getImmediate();if((0,s.bD)(t,n.getOptions()))return e;throw h.create("already-initialized")}const r=n.initialize({options:t});return r}(e)}async function F(){if((0,s.sr)())return!1;if(!(0,s.dM)())return!1;if(!(0,s.zW)())return!1;try{return await(0,s.eX)()}catch(e){return!1}}function U(e,t,n){e=(0,s.Ku)(e),async function(e,t,n,i){if(i&&i.global)return e("set",{user_id:n}),Promise.resolve();e("config",await t,{update:!0,user_id:n})}(P,A[e.app.options.appId],t,n).catch((e=>u.error(e)))}function V(e,t,n,i){e=(0,s.Ku)(e),async function(e,t,n,i,r){if(r&&r.global)e("event",n,i);else{const r=await t;e("event",n,Object.assign(Object.assign({},i),{send_to:r}))}}(P,A[e.app.options.appId],t,n,i).catch((e=>u.error(e)))}const j="@firebase/analytics",q="0.10.17";(0,i._registerComponent)(new o.uA(a,((e,t)=>{let{options:n}=t;return M(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),n)}),"PUBLIC")),(0,i._registerComponent)(new o.uA("analytics-internal",(function(e){try{const t=e.getProvider(a).getImmediate();return{logEvent:(e,n,i)=>V(t,e,n,i)}}catch(t){throw h.create("interop-component-reg-failed",{reason:t})}}),"PRIVATE")),(0,i.registerVersion)(j,q),(0,i.registerVersion)(j,q,"esm2017")},77281(e,t,n){n.d(t,{Wp:()=>i.initializeApp});var i=n(73507);(0,i.registerVersion)("firebase","11.10.0","app")},77304(e,t,n){n.d(t,{IX:()=>i.W,sk:()=>i.X,HF:()=>i.Y,Oe:()=>i.P,ny:()=>i.a0,Wq:()=>i.L,xI:()=>i.p,Pj:()=>i.ae,zK:()=>i.a1});var i=n(78602);n(73507),n(51252),n(46954),n(38183)}
2,92086(e,t,n){n.d(t,{A:()=>i.A});var i=n(70162);i.A.registerVersion("firebase","11.10.0","app-compat")},17632(e,t,n){var i=n(70162),r=n(78602),s=n(51252),o=(n(73507),n(46954),n(38183));function a(){return window}async function c(e,t,n){var i;const{BuildInfo:s}=a();(0,r.av)(t.sessionId,"AuthEvent did not contain a session ID");const o=await async function(e){const t=function(e){if((0,r.av)(/[0-9a-zA-Z]+/.test(e),"Can only convert alpha-numeric strings"),"undefined"!==typeof TextEncoder)return(new TextEncoder).encode(e);const t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n}(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")}(t.sessionId),c={};return(0,r.aw)()?c.ibi=s.packageName:(0,r.ax)()?c.apn=s.packageName:(0,r.ay)(e,"operation-not-supported-in-this-environment"),s.displayName&&(c.appDisplayName=s.displayName),c.sessionId=o,(0,r.az)(e,n,t.type,void 0,null!==(i=t.eventId)&&void 0!==i?i:void 0,c)}class u extends r.aE{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise((e=>{this.resolveInitialized=e}))}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(e){return this.resolveInitialized(),this.passiveListeners.forEach((t=>t(e))),super.onEvent(e)}async initialized(){await this.initPromise}}async function l(e){const t=await f()._get(p(e));return t&&await f()._remove(p(e)),t}function h(e,t){var n,i;const s=function(e){const t=g(e),n=t.link?decodeURIComponent(t.link):void 0,i=g(n).link,r=t.deep_link_id?decodeURIComponent(t.deep_link_id):void 0;return g(r).link||r||i||n||e}(t);if(s.includes("/__/auth/callback")){const t=g(s),o=t.firebaseError?function(e){try{return JSON.parse(e)}catch(t){return null}}(decodeURIComponent(t.firebaseError)):null,a=null===(i=null===(n=null===o||void 0===o?void 0:o.code)||void 0===n?void 0:n.split("auth/"))||void 0===i?void 0:i[1],c=a?(0,r.aC)(a):null;return c?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:c,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:s,postBody:null}}return null}function d(){const e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let n=0;n<20;n++){const n=Math.floor(62*Math.random());e.push(t.charAt(n))}return e.join("")}function f(){return(0,r.aF)(r.b)}function p(e){return(0,r.aG)("authEvent",e.config.apiKey,e.name)}function g(e){if(!(null===e||void 0===e?void 0:e.includes("?")))return{};const[t,...n]=e.split("?");return(0,s.I9)(n.join("?"))}const m=class{constructor(){this._redirectPersistence=r.c,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=r.aH,this._overrideRedirectResult=r.aI}async _initialize(e){const t=e._key();let n=this.eventManagers.get(t);return n||(n=new u(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),n}_openPopup(e){(0,r.ay)(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,n,i){!function(e){var t,n,i,s,o,c,u,l,h,d;const f=a();(0,r.aD)("function"===typeof(null===(t=null===f||void 0===f?void 0:f.universalLinks)||void 0===t?void 0:t.subscribe),e,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),(0,r.aD)("undefined"!==typeof(null===(n=null===f||void 0===f?void 0:f.BuildInfo)||void 0===n?void 0:n.packageName),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),(0,r.aD)("function"===typeof(null===(o=null===(s=null===(i=null===f||void 0===f?void 0:f.cordova)||void 0===i?void 0:i.plugins)||void 0===s?void 0:s.browsertab)||void 0===o?void 0:o.openUrl),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),(0,r.aD)("function"===typeof(null===(l=null===(u=null===(c=null===f||void 0===f?void 0:f.cordova)||void 0===c?void 0:c.plugins)||void 0===u?void 0:u.browsertab)||void 0===l?void 0:l.isAvailable),e,"invali
2d-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),(0,r.aD)("function"===typeof(null===(d=null===(h=null===f||void 0===f?void 0:f.cordova)||void 0===h?void 0:h.InAppBrowser)||void 0===d?void 0:d.open),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"})}(e);const s=await this._initialize(e);await s.initialized(),s.resetRedirect(),(0,r.aJ)(),await this._originValidation(e);const o=function(e,t){return{type:t,eventId:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,urlResponse:null,sessionId:d(),postBody:null,tenantId:e.tenantId,error:(0,r.aC)(e,"no-auth-event")}}(e,n,i);await function(e,t){return f()._set(p(e),t)}(e,o);const u=await c(e,o,t);return async function(e,t,n){const{cordova:i}=a();let s=()=>{};try{await new Promise(((o,a)=>{let c=null;function u(){var e;o();const t=null===(e=i.plugins.browsertab)||void 0===e?void 0:e.close;"function"===typeof t&&t(),"function"===typeof(null===n||void 0===n?void 0:n.close)&&n.close()}function l(){c||(c=window.setTimeout((()=>{a((0,r.aC)(e,"redirect-cancelled-by-user"))}),2e3))}function h(){"visible"===(null===document||void 0===document?void 0:document.visibilityState)&&l()}t.addPassiveListener(u),document.addEventListener("resume",l,!1),(0,r.ax)()&&document.addEventListener("visibilitychange",h,!1),s=()=>{t.removePassiveListener(u),document.removeEventListener("resume",l,!1),document.removeEventListener("visibilitychange",h,!1),c&&window.clearTimeout(c)}}))}finally{s()}}(e,s,await function(e){const{cordova:t}=a();return new Promise((n=>{t.plugins.browsertab.isAvailable((i=>{let s=null;i?t.plugins.browsertab.openUrl(e):s=t.InAppBrowser.open(e,(0,r.aB)()?"_blank":"_system","location=yes"),n(s)}))}))}(u))}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){const{BuildInfo:t}=a(),n={};(0,r.aw)()?n.iosBundleId=t.packageName:(0,r.ax)()?n.androidPackageName=t.packageName:(0,r.ay)(e,"operation-not-supported-in-this-environment"),await(0,r.aA)(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(e,t){const{universalLinks:n,handleOpenURL:i,BuildInfo:r}=a(),s=setTimeout((async()=>{await l(e),t.onEvent(v())}),500),o=async n=>{clearTimeout(s);const i=await l(e);let r=null;i&&(null===n||void 0===n?void 0:n.url)&&(r=h(i,n.url)),t.onEvent(r||v())};"undefined"!==typeof n&&"function"===typeof n.subscribe&&n.subscribe(null,o);const c=i,u=`${r.packageName.toLowerCase()}://`;a().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(u)&&o({url:e}),"function"===typeof c)try{c(e)}catch(t){console.error(t)}}}};function v(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:(0,r.aC)("no-auth-event")}}function y(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.ZQ)();return!("file:"!==y()&&"ionic:"!==y()&&"capacitor:"!==y()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function _(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.ZQ)();return(0,s.lT)()&&11===(null===document||void 0===document?void 0:document.documentMode)||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s.ZQ)();return/Edge\/\d+/.test(e)}(e)}function b(){try{const e=self.localStorage,t=r.aO();if(e)return e.setItem(t,"1"),e.removeItem(t),!_()||(0,s.zW)()}catch(e){return T()&&(0,s.zW)()}return!1}function T(){return"undefined"!==typeof n.g&&"WorkerGlobalScope"in n.g&&"importScripts"in n.g}function I(){return("http:"===y()||"https:"===y()||(0,s.sr)()||w())&&!((0,s.lV)()||(0,s.Ll)())&&b()&&!T()}function E(){return w()&&"undefined"!==typeof document}const S={LOCAL:"local",NONE:"none",SESSION:"session"},C=r.aD,A="persistence";async function k(e){await e._initializationPromise;const t=R(),n=r.aG(A,e.config.apiKey,e.name);t&&t.setItem(n,e._getPersistenceType())}function R(){var e;try{return(null===(e="undefined"!==typeof window?window:null)||void 0===e?void 0:e.sessionStorage)||null}catch(t){return null}}const N=r.aD;class P{constructor(){this.browserResolver=r.aF(r.m),this.cordovaResolver=r.aF(m),this.underlyingResolver=null,this._redirectPersistence=r.c,this._completeRedirectFn=r.aH,this._overrideRedirectResult=r.aI}async _initialize(e){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async _openPopup(e,t,n,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,t,n,i)}async _openRedirect(e,t,n,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,t,n,i)}_isIframeWebStorageSupported(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)}_originValidation(e){return this.assertedUnderlyingResolver._originValidation(e)}get _shouldInitProactively(){return E()||this.browserResolver._shouldInitProactively}get assertedUnderlyingResolver(){return N(this.underlyingResolver,"internal-error"),this.underlyingResolver}async selectUnderlyingResolver(){if(this.underlyingResolver)return;const e=await async function(){return!!E()&&new Promise((e=>{const t=setTimeout((()=>{e(!1)}),1e3);document.addEventListener("deviceready",(()=>{clearTimeout(t),e(!0)}))}))}();this.underlyingResolver=e?this.cordovaResolver:this.browserResolver}}function O(e){return e.unwrap()}function D(e){const{_tokenResponse:t}=e instanceof s.g?e.customData:e;if(!t)return null;if(!(e instanceof s.g)&&"temporaryProof"in t&&"phoneNumber"in t)return r.P.credentialFromResult(e);const n=t.providerId;if(!n||n===r.q.PASSWORD)return null;let i;switch(n){case r.q.GOOGLE:i=r.Y;break;case r.q.FACEBOOK:i=r.X;break;case r.q.GITHUB:i=r.Z;break;case r.q.TWITTER:i=r.a0;break;default:const{oauthIdToken:e,oauthAccessToken:s,oauthTokenSecret:o,pendingToken:a,nonce:c}=t;return s||o||e||a?a?n.startsWith("saml.")?r.aR._create(n,a):r.Q._fromParams({providerId:n,signInMethod:n,pendingToken:a,idToken:e,accessToken:s}):new r._(n).credential({idToken:e,accessToken:s,rawNonce:c}):null}return e instanceof s.g?i.credentialFromError(e):i.credentialFromResult(e)}function L(e,t){return t.catch((t=>{throw t instanceof s.g&&function(e,t){var n;const i=null===(n=t.customData)||void 0===n?void 0:n._tokenResponse;if("auth/multi-factor-auth-required"===(null===t||void 0===t?void 0:t.code))t.resolver=new x(e,r.at(e,t));else if(i){const e=D(t),n=t;e&&(n.credential=e,n.tenantId=i.tenantId||void 0,n.email=i.email||void 0,n.phoneNumber=i.phoneNumber||void 0)}}(e,t),t})).then((e=>{const t=e.operationType,n=e.user;return{operationType:t,credential:(i=e,D(i)),additionalUserInfo:r.ar(e),user:F.getOrCreate(n)};var i}))}async function M(e,t){const n=await t;return{verificationId:n.verificationId,confirm:t=>L(e,n.confirm(t))}}class x{constructor(e,t){this.resolver=t,this.auth=e.wrapped()}get session(){return this.resolver.session}get hints(){return this.resolver.hints}resolveSignIn(e){return L(O(this.auth),this.resolver.resolveSignIn(e))}}class F{constructor(e){this._delegate=e,this.multiFactor=r.au(e)}static getOrCreate(e){return F.USER_MAP.has(e)||F.USER_MAP.set(e,new F(e)),F.USER_MAP.get(e)}delete(){return this._delegate.delete()}reload(){return this._delegate.reload()}toJSON(){return this._delegate.toJSON()}getIdTokenResult(e){return this._delegate.getIdTokenResult(e)}getIdToken(e){return this._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){return this.linkWithCredential(e)}async linkWithCredential(e){return L(this.auth,r.a3(this._delegate,e))}async linkWithPhoneNumber(e,t){return M(this.auth,r.l(this._delegate,e,t))}async linkWithPopup(e){return L(this.auth,r.e(this._delegate,e,P))}async linkWithRedirect(e){return await k(r.aK(this.auth)),r.h(this._delegate,e,P)}reauthenticateAndRetrieveDataWithCredential(e){return this.reauthenticateWithCredential(e)}async reauthenticateWithCredential(e){return L(this.auth,r.a4(this._delegate,e))}reauthenticateWithPhoneNumber(e,t){return M(this.auth,r.r(this._delegate,e,t))}reauthenticateWithPopup(e){return L(this.auth,r.f(this._delegate,e,P))}async reauthenticateWithRedirect(e){return await k(r.aK(this.auth)),r.j(this._delegate,e,P)}sendEmailVerification(e){return r.ah(this._delegate,e)}async unlink(e){return await r.aq(this._delegate,e),this}updateEmail(e){return r.am(this._delegate,e)}updatePassword(e){return r.an(this._delegate,e)}updatePhoneNumber(e){return r.u(this._delegate,e)}updateProfile(e){return r.al(this._delegate,e)}verifyBeforeUpdateEmail(e,t){return r.ai(this._delegate,e,t)}get emailVerified(){return this._delegate.emailVerified}get isAnonymous(){return this._delegate.isAnonymous}get metadata(){return this._delegate.metadata}get phoneNumber(){return this._delegate.phoneNumber}get providerData(){return this._delegate.providerData}get refreshToken(){return this._delegate.refreshToken}get tenantId(){return this._delegate.tenantId}get displayName(){return this._delegate.displayName}get email(){return this._delegate.email}get photoURL(){return this._delegate.photoURL}get providerId(){return this._delegate.providerId}get uid(){return this._delegate.uid}get auth(){return this._delegate.auth}}F.USER_MAP=new WeakMap;const U=r.aD;class V{constructor(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();const{apiKey:n}=e.options;
2U(n,"invalid-api-key",{appName:e.name}),U(n,"invalid-api-key",{appName:e.name});const i="undefined"!==typeof window?P:void 0;this._delegate=t.initialize({options:{persistence:q(n,e.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(r.H),this.linkUnderlyingAuth()}get emulatorConfig(){return this._delegate.emulatorConfig}get currentUser(){return this._delegate.currentUser?F.getOrCreate(this._delegate.currentUser):null}get languageCode(){return this._delegate.languageCode}set languageCode(e){this._delegate.languageCode=e}get settings(){return this._delegate.settings}get tenantId(){return this._delegate.tenantId}set tenantId(e){this._delegate.tenantId=e}useDeviceLanguage(){this._delegate.useDeviceLanguage()}signOut(){return this._delegate.signOut()}useEmulator(e,t){r.L(this._delegate,e,t)}applyActionCode(e){return r.a8(this._delegate,e)}checkActionCode(e){return r.a9(this._delegate,e)}confirmPasswordReset(e,t){return r.a7(this._delegate,e,t)}async createUserWithEmailAndPassword(e,t){return L(this._delegate,r.ab(this._delegate,e,t))}fetchProvidersForEmail(e){return this.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){return r.ag(this._delegate,e)}isSignInWithEmailLink(e){return r.ae(this._delegate,e)}async getRedirectResult(){U(I(),this._delegate,"operation-not-supported-in-this-environment");const e=await r.k(this._delegate,P);return e?L(this._delegate,Promise.resolve(e)):{credential:null,user:null}}addFrameworkForLogging(e){!function(e,t){(0,r.aK)(e)._logFramework(t)}(this._delegate,e)}onAuthStateChanged(e,t,n){const{next:i,error:r,complete:s}=j(e,t,n);return this._delegate.onAuthStateChanged(i,r,s)}onIdTokenChanged(e,t,n){const{next:i,error:r,complete:s}=j(e,t,n);return this._delegate.onIdTokenChanged(i,r,s)}sendSignInLinkToEmail(e,t){return r.ad(this._delegate,e,t)}sendPasswordResetEmail(e,t){return r.a6(this._delegate,e,t||void 0)}async setPersistence(e){let t;switch(function(e,t){C(Object.values(S).includes(t),e,"invalid-persistence-type"),(0,s.lV)()?C(t!==S.SESSION,e,"unsupported-persistence-type"):(0,s.Ll)()?C(t===S.NONE,e,"unsupported-persistence-type"):T()?C(t===S.NONE||t===S.LOCAL&&(0,s.zW)(),e,"unsupported-persistence-type"):C(t===S.NONE||b(),e,"unsupported-persistence-type")}(this._delegate,e),e){case S.SESSION:t=r.c;break;case S.LOCAL:t=await r.aF(r.i)._isAvailable()?r.i:r.b;break;case S.NONE:t=r.V;break;default:return r.ay("argument-error",{appName:this._delegate.name})}return this._delegate.setPersistence(t)}signInAndRetrieveDataWithCredential(e){return this.signInWithCredential(e)}signInAnonymously(){return L(this._delegate,r.a1(this._delegate))}signInWithCredential(e){return L(this._delegate,r.a2(this._delegate,e))}signInWithCustomToken(e){return L(this._delegate,r.a5(this._delegate,e))}signInWithEmailAndPassword(e,t){return L(this._delegate,r.ac(this._delegate,e,t))}signInWithEmailLink(e,t){return L(this._delegate,r.af(this._delegate,e,t))}signInWithPhoneNumber(e,t){return M(this._delegate,r.s(this._delegate,e,t))}async signInWithPopup(e){return U(I(),this._delegate,"operation-not-supported-in-this-environment"),L(this._delegate,r.d(this._delegate,e,P))}async signInWithRedirect(e){return U(I(),this._delegate,"operation-not-supported-in-this-environment"),await k(this._delegate),r.g(this._delegate,e,P)}updateCurrentUser(e){return this._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){return r.aa(this._delegate,e)}unwrap(){return this._delegate}_delete(){return this._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}}function j(e,t,n){let i=e;"function"!==typeof e&&({next:i,error:t,complete:n}=e);const r=i;return{next:e=>r(e&&F.getOrCreate(e)),error:t,complete:n}}function q(e,t){const n=function(e,t){const n=R();if(!n)return[];const i=r.aG(A,e,t);switch(n.getItem(i)){case S.NONE:return[r.V];case S.LOCAL:return[r.i,r.c];case S.SESSION:return[r.c];default:return[]}}(e,t);if("undefined"===typeof self||n.includes(r.i)||n.push(r.i),"undefined"!==typeof window)for(const i of[r.b,r.c])n.includes(i)||n.push(i);return n.includes(r.V)||n.push(r.V),n}V.Persistence=S;class B{static credential(e,t){return r.P.credential(e,t)}constructor(){this.providerId="phone",this._delegate=new r.P(O(i.A.auth()))}verifyPhoneNumber(e,t){return this._delegate.verifyPhoneNumber(e,t)}unwrap(){return this._delegate}}B.PHONE_SIGN_IN_METHOD=r.P.PHONE_SIGN_IN_METHOD,B.PROVIDER_ID=r.P.PROVIDER_ID;const z=r.aD;class ${constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.A.app();var s;z(null===(s=n.options)||void 0===s?void 0:s.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new r.R(n.auth(),e,t),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){return this._delegate.render()}verify(){return this._delegate.verify()}}var K;(K=i.A).INTERNAL.registerComponent(new o.uA("auth-compat",(e=>{const t=e.getProvider("app-compat").getImmediate(),n=e.getProvider("auth");return new V(t,n)}),"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:r.A.EMAIL_SIGNIN,PASSWORD_RESET:r.A.PASSWORD_RESET,RECOVER_EMAIL:r.A.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:r.A.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:r.A.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:r.A.VERIFY_EMAIL}},EmailAuthProvider:r.W,FacebookAuthProvider:r.X,GithubAuthProvider:r.Z,GoogleAuthProvider:r.Y,OAuthProvider:r._,SAMLAuthProvider:r.$,PhoneAuthProvider:B,PhoneMultiFactorGenerator:r.n,RecaptchaVerifier:$,TwitterAuthProvider:r.a0,Auth:V,AuthCredential:r.M,Error:s.g}).setInstantiationMode("LAZY").setMultipleInstances(!1)),K.registerVersion("@firebase/auth-compat","0.5.28")},63814(e,t,n){n.d(t,{Dc:()=>ve,gS:()=>pu,rJ:()=>Za,Cs:()=>ec,vN:()=>Qa,CL:()=>_u,H9:()=>tc,Fs:()=>dc,x7:()=>cu,GG:()=>lu,Rr:()=>hu,aU:()=>ac,AB:()=>Xc,aQ:()=>gu,My:()=>Qc,P:()=>$c,O5:()=>bu,BN:()=>du,mZ:()=>fu,_M:()=>Hc,wP:()=>Tu});var i,r,s=n(73507),o=n(38183),a=n(46954),c=n(51252),u="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{},l={};(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var i=Array(16);if("string"===typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],o=t+(s^n&(r^s))+i[0]+3614090360&4294967295;o=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=n+(o<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[4]+4118548399&4294967295)<<7&4294967295|o>>>
225))+((o=s+(r^t&(n^r))+i[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^s&(n^r))+i[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^r^s)+i[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(r^(n|~s))+i[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((s=(t=n+((o=t+(r^(n|~s))+i[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((r=s+((o=r+(t^(s|~n))+i[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+s&4294967295}function s(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}(t,(function(){this.blockSize=-1})),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var i=t-this.blockSize,r=this.B,s=this.h,o=0;o<t;){if(0==s)for(;o<=i;)n(this,e,o),o+=this.blockSize;if("string"===typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){n(this,r),s=0;break}}this.h=s,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var o={};function a(e){return-128<=e&&128>e?function(e,t){var n=o;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new s([0|e],0>e?-1:0)})):new s([0|e],0>e?-1:0)}function c(e){if(isNaN(e)||!isFinite(e))return u;if(0>e)return g(c(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=4294967296;return new s(t,0)}var u=a(0),h=a(1),d=a(16777216);function f(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function p(e){return-1==e.h}function g(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new s(n,~e.h).add(h)}function m(e,t){return e.add(g(t))}function v(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function y(e,t){this.g=e,this.h=t}function w(e,t){if(f(t))throw Error("division by zero");if(f(e))return new y(u,u);if(p(e))return t=w(g(e),t),new y(g(t.g),g(t.h));if(p(t))return t=w(e,g(t)),new y(g(t.g),t.h);if(30<e.g.length){if(p(e)||p(t))throw Error("slowDivide_ only works with positive integers.");for(var n=h,i=t;0>=i.l(e);)n=_(n),i=_(i);var r=b(n,1),s=b(i,1);for(i=b(i,2),n=b(n,2);!f(i);){var o=s.add(i);0>=o.l(e)&&(r=r.add(n),s=o),i=b(i,1),n=b(n,1)}return t=m(e,r.j(t)),new y(r,t)}for(r=u;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),i=48>=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),o=(s=c(n)).j(t);p(o)||0<o.l(e);)o=(s=c(n-=i)).j(t);f(s)&&(s=h),r=r.add(s),e=m(e,o)}return new y(r,e)}function _(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.i(i)<<1|e.i(i-1)>>>31;return new s(n,e.h)}function b(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,r=[],o=0;o<i;o++)r[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new s(r,e.h)}(e=s.prototype).m=function(){if(p(this))return-g(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.i(n);e+=(0<=i?i:4294967296+i)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(f(this))return"0";if(p(this))return"-"+g(this).toString(e);for(var t=c(Math.pow(e,6)),n=this,i="";;){var r=w(n,t).g,s=((0<(n=m(n,r.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(f(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return p(e=m(this,e))?-1:f(e)?0:1}
2,e.abs=function(){return p(this)?g(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,r=0;r<=t;r++){var o=i+(65535&this.i(r))+(65535&e.i(r)),a=(o>>>16)+(this.i(r)>>>16)+(e.i(r)>>>16);i=a>>>16,o&=65535,a&=65535,n[r]=a<<16|o}return new s(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(f(this)||f(e))return u;if(p(this))return p(e)?g(this).j(g(e)):g(g(this).j(e));if(p(e))return g(this.j(g(e)));if(0>this.l(d)&&0>e.l(d))return c(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var r=0;r<e.g.length;r++){var o=this.i(i)>>>16,a=65535&this.i(i),l=e.i(r)>>>16,h=65535&e.i(r);n[2*i+2*r]+=a*h,v(n,2*i+2*r),n[2*i+2*r+1]+=o*h,v(n,2*i+2*r+1),n[2*i+2*r+1]+=a*l,v(n,2*i+2*r+1),n[2*i+2*r+2]+=o*l,v(n,2*i+2*r+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new s(n,0)},e.A=function(e){return w(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)&e.i(i);return new s(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)|e.i(i);return new s(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)^e.i(i);return new s(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,r=l.Md5=t,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.A,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=c,s.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return g(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=c(Math.pow(n,8)),r=u,s=0;s<t.length;s+=8){var o=Math.min(8,t.length-s),a=parseInt(t.substring(s,s+o),n);8>o?(o=c(Math.pow(n,o)),r=r.j(o).add(c(a))):r=(r=r.j(i)).add(c(a))}return r},i=l.Integer=s}).apply("undefined"!==typeof u?u:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{});var h,d,f,p,g,m,v,y,w="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{},_={};(function(){var e,t="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof w&&w];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(e,i){if(i)e:{var r=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in r))break e;r=r[o]}(i=i(s=r[e=e[e.length-1]]))!=s&&null!=i&&t(r,e,{configurable:!0,writable:!0,value:i})}}("Array.prototype.values",(function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,i=!1,r={next:function(){if(!i&&n<e.length){var r=n++;return{value:t(r,e[r]),done:!1}}return i=!0,{done:!0,value:void 0}}};return r[Symbol.iterator]=function(){return r},r}(this,(function(e,t){return t}))}}));var i=i||{},r=this||self;function s(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function u(e,t,n){return(u=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}
2function l(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function b(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function T(e){const t=e.length;if(0<t){const n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function I(e,t){for(let n=1;n<arguments.length;n++){const t=arguments[n];if(s(t)){const n=e.length||0,i=t.length||0;e.length=n+i;for(let r=0;r<i;r++)e[n+r]=t[r]}else e.push(t)}}function E(e){return/^[\s\xa0]*$/.test(e)}function S(){var e=r.navigator;return e&&(e=e.userAgent)?e:""}function C(e){return C[" "](e),e}C[" "]=function(){};var A=-1!=S().indexOf("Gecko")&&!(-1!=S().toLowerCase().indexOf("webkit")&&-1==S().indexOf("Edge"))&&!(-1!=S().indexOf("Trident")||-1!=S().indexOf("MSIE"))&&-1==S().indexOf("Edge");function k(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function R(e){const t={};for(const n in e)t[n]=e[n];return t}const N="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function P(e,t){let n,i;for(let r=1;r<arguments.length;r++){for(n in i=arguments[r],i)e[n]=i[n];for(let t=0;t<N.length;t++)n=N[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function O(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function D(e){r.setTimeout((()=>{throw e}),0)}function L(){var e=V;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var M=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}((()=>new x),(e=>e.reset()));class x{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 F,U=!1,V=new class{constructor(){this.h=this.g=null}add(e,t){const n=M.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},j=()=>{const e=r.Promise.resolve(void 0);F=()=>{e.then(q)}};var q=()=>{for(var e;e=L();){try{e.h.call(e.g)}catch(n){D(n)}var t=M;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}U=!1};function B(){this.s=this.s,this.C=this.C}function z(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}B.prototype.s=!1,B.prototype.ma=function(){this.s||(this.s=!0,this.N())},B.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},z.prototype.h=function(){this.defaultPrevented=!0};var $=function(){if(!r.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};r.addEventListener("test",e,t),r.removeEventListener("test",e,t)}catch(n){}return e}();function K(e,t){if(z.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){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(A){e:{try{C(t.nodeName);var r=!0;break e}catch(s){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"===typeof e.pointerType?e.pointerType:H[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&K.aa.h.call(this)}}b(K,z);var H={2:"touch",3:"pen",4:"mouse"};K.prototype.h=function(){K.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var W="closure_listenable_"+(1e6*Math.random()|0),G=0;function Q(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++G,this.da=this.fa=!1}function J(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function X(e){this.src=e,this.g={},this.h=0}function Y(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(J(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function Z(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==i)return r}return-1}X.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=Z(e,t,i,r);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new Q(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var ee="closure_lm_"+(1e6*Math.random()|0),te={};function ne(e,t,n,i,r){if(i&&i.once)return re(e,t,n,i,r);if(Array.isArray(t)){for(var s=0;s<t.length;s++)ne(e,t[s],n,i,r);return null}return n=he(n),e&&e[W]?e.K(t,n,o(i)?!!i.capture:!!i,r):ie(e,t,n,!1,i,r)}function ie(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var a=o(r)?!!r.capture:!!r,c=ue(e);
2if(c||(e[ee]=c=new X(e)),(n=c.add(t,n,i,a,s)).proxy)return n;if(i=function(){function e(n){return t.call(e.src,e.listener,n)}const t=ce;return e}(),n.proxy=i,i.src=e,i.listener=n,e.addEventListener)$||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(ae(t.toString()),i);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(i)}return n}function re(e,t,n,i,r){if(Array.isArray(t)){for(var s=0;s<t.length;s++)re(e,t[s],n,i,r);return null}return n=he(n),e&&e[W]?e.L(t,n,o(i)?!!i.capture:!!i,r):ie(e,t,n,!0,i,r)}function se(e,t,n,i,r){if(Array.isArray(t))for(var s=0;s<t.length;s++)se(e,t[s],n,i,r);else i=o(i)?!!i.capture:!!i,n=he(n),e&&e[W]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=Z(s=e.g[t],n,i,r))&&(J(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete e.g[t],e.h--)))):e&&(e=ue(e))&&(t=e.g[t.toString()],e=-1,t&&(e=Z(t,n,i,r)),(n=-1<e?t[e]:null)&&oe(n))}function oe(e){if("number"!==typeof e&&e&&!e.da){var t=e.src;if(t&&t[W])Y(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(ae(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=ue(t))?(Y(n,e),0==n.h&&(n.src=null,t[ee]=null)):J(e)}}}function ae(e){return e in te?te[e]:te[e]="on"+e}function ce(e,t){if(e.da)e=!0;else{t=new K(t,this);var n=e.listener,i=e.ha||e.src;e.fa&&oe(e),e=n.call(i,t)}return e}function ue(e){return(e=e[ee])instanceof X?e:null}var le="__closure_events_fn_"+(1e9*Math.random()>>>0);function he(e){return"function"===typeof e?e:(e[le]||(e[le]=function(t){return e.handleEvent(t)}),e[le])}function de(){B.call(this),this.i=new X(this),this.M=this,this.F=null}function fe(e,t){var n,i=e.F;if(i)for(n=[];i;i=i.F)n.push(i);if(e=e.M,i=t.type||t,"string"===typeof t)t=new z(t,e);else if(t instanceof z)t.target=t.target||e;else{var r=t;P(t=new z(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];r=pe(o,i,!0,t)&&r}if(r=pe(o=t.g=e,i,!0,t)&&r,r=pe(o,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=pe(o=t.g=n[s],i,!1,t)&&r}function pe(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&Y(e.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}function ge(e,t,n){if("function"===typeof e)n&&(e=u(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=u(e.handleEvent,e)}return 2147483647<Number(t)?-1:r.setTimeout(e,t||0)}function me(e){e.g=ge((()=>{e.g=null,e.i&&(e.i=!1,me(e))}),e.l);const t=e.h;e.h=null,e.m.apply(null,t)}b(de,B),de.prototype[W]=!0,de.prototype.removeEventListener=function(e,t,n,i){se(this,e,t,n,i)},de.prototype.N=function(){if(de.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)J(n[i]);delete t.g[e],t.h--}}this.F=null},de.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},de.prototype.L=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class ve extends B{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:me(this)}N(){super.N(),this.g&&(r.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ye(e){B.call(this),this.h=e,this.g={}}b(ye,B);var we=[];function _e(e){k(e.g,(function(e,t){this.g.hasOwnProperty(t)&&oe(e)}),e),e.g={}}ye.prototype.N=function(){ye.aa.N.call(this),_e(this)},ye.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var be=r.JSON.stringify,Te=r.JSON.parse,Ie=class{stringify(e){return r.JSON.stringify(e,void 0)}parse(e){return r.JSON.parse(e,void 0)}};function Ee(){}function Se(e){return e.h||(e.h=e.i())}function Ce(){}Ee.prototype.h=null;var Ae={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function ke(){z.call(this,"d")}function Re(){z.call(this,"c")}b(ke,z),b(Re,z);var Ne={},Pe=null;function Oe(){return Pe=Pe||new de}function De(e){z.call(this,Ne.La,e)}function Le(e){const t=Oe();fe(t,new De(t))}function Me(e,t){z.call(this,Ne.STAT_EVENT,e),this.stat=t}function xe(e){const t=Oe();fe(t,new Me(t,e))}function Fe(e,t){z.call(this,Ne.Ma,e),this.size=t}function Ue(e,t){if("function"!==typeof e)throw Error("Fn must not be null and must be a function");return r.setTimeout((function(){e()}),t)}function Ve(){this.g=!0}function je(e,t,n,i){e.info((function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<r.length;o++)r[o]=""}}}return be(n)}catch(a){return t}}(e,n)+(i?" "+i:"")}))}Ne.La="serverreachability",b(De,z),Ne.STAT_EVENT="statevent",b(Me,z),Ne.Ma="timingevent",b(Fe,z),Ve.prototype.xa=function(){this.g=!1},Ve.prototype.info=function(){};var qe,Be={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},ze={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function $e(){}function Ke(e,t,n,i){this.j=e,this.i=t,this.l=n,this.R=i||1,this.U=new ye(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new He}function He(){this.i=null,this.g="",this.h=!1}b($e,Ee),$e.prototype.g=function(){return new XMLHttpRequest},$e.prototype.i=function(){return{}},qe=new $e;var We={},Ge={};function Qe(e,t,n){e.L=1,e.v=_t(gt(t)),e.m=n,e.P=!0,Je(e,null)}function Je(e,t){e.F=Date.now(),Ze(e),e.A=gt(e.v);var n=e.A,i=e.R;Array.isArray(i)||(i=[String(i)]),Lt(n.i,"t",i),e.C=0,n=e.j.J,e.h=new He,e.g=Tn(e.j,n?t:null,!e.m),
20<e.O&&(e.M=new ve(u(e.Y,e,e.g),e.O)),t=e.U,n=e.g,i=e.ca;var r="readystatechange";Array.isArray(r)||(r&&(we[0]=r.toString()),r=we);for(var s=0;s<r.length;s++){var o=ne(n,r[s],i||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?R(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Le(),function(e,t,n,i,r,s){e.info((function(){if(e.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&"type"==h[1]?o+(l+"=")+u+"&":o+(l+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+t+"\n"+n+"\n"+o}))}(e.i,e.u,e.A,e.l,e.R,e.m)}function Xe(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Ye(e,t){var n=e.C,i=t.indexOf("\n",n);return-1==i?Ge:(n=Number(t.substring(n,i)),isNaN(n)?We:(i+=1)+n>t.length?Ge:(t=t.slice(i,i+n),e.C=i+n,t))}function Ze(e){e.S=Date.now()+e.I,et(e,e.I)}function et(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ue(u(e.ba,e),t)}function tt(e){e.B&&(r.clearTimeout(e.B),e.B=null)}function nt(e){0==e.j.G||e.J||vn(e.j,e)}function it(e){tt(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,_e(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function rt(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||ct(n.h,e)))if(!e.K&&ct(n.h,e)&&3==n.G){try{var i=n.Da.g.parse(t)}catch(l){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;mn(n),on(n)}fn(n),xe(18)}}else n.za=r[1],0<n.za-n.T&&37500>r[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ue(u(n.Za,n),6e3));if(1>=at(n.h)&&n.ca){try{n.ca()}catch(l){}n.ca=void 0}}else wn(n,11)}else if((e.K||n.g==e)&&mn(n),!E(t))for(r=n.Da.g.parse(t),t=0;t<r.length;t++){let u=r[t];if(n.T=u[0],u=u[1],2==n.G)if("c"==u[0]){n.K=u[1],n.ia=u[2];const t=u[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const r=u[4];null!=r&&(n.Aa=r,n.j.info("SVER="+n.Aa));const l=u[5];null!=l&&"number"===typeof l&&0<l&&(i=1.5*l,n.L=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(ut(s,s.h),s.h=null))}if(i.D){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,wt(i.I,i.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((i=n).qa=bn(i,i.J?i.ia:null,i.W),o.K){lt(i.h,o);var a=o,c=i.L;c&&(a.I=c),a.B&&(tt(a),Ze(a)),i.g=o}else dn(i);0<n.i.length&&cn(n)}else"stop"!=u[0]&&"close"!=u[0]||wn(n,7);else 3==n.G&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?wn(n,7):sn(n):"noop"!=u[0]&&n.l&&n.l.ta(u),n.v=0)}Le()}catch(l){}}Ke.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==en(e)?t.j():this.Y(e)},Ke.prototype.Y=function(e){try{if(e==this.g)e:{const d=en(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||tn(this.g)))){this.J||4!=d||7==t||Le(),tt(this);var n=this.g.Z();this.X=n;t:if(Xe(this)){var i=tn(this.g);e="";var s=i.length,o=4==en(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){it(this),nt(this);var a="";break t}this.h.i=new r.TextDecoder}for(t=0;t<s;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(o&&t==s-1)});i.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,i,r,s,o){e.info((function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+o}))}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!E(c)){var l=c;break t}}l=null}if(!(n=l)){this.o=!1,this.s=3,xe(12),it(this),nt(this);break e}je(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,rt(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=Ye(this,a),e==Ge){4==d&&(this.s=4,xe(14),n=!1),je(this.i,this.l,null,"[Incomplete Response]");break}if(e==We){this.s=4,xe(15),je(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}je(this.i,this.l,e,null),rt(this,e)}if(Xe(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,xe(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var h=this.j;h.g==this&&h.ba&&!h.M&&(h.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),pn(h),h.M=!0,xe(11))}}else je(this.i,this.l,a,"[Invalid Chunked Response]"),it(this),nt(this)}else je(this.i,this.l,a,null),rt(this,a);4==d&&it(this),this.o&&!this.J&&(4==d?vn(this.j,this):(this.o=!1,Ze(this)))}else(function(e){const t={};e=(e.g&&2<=en(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(E(e[i]))continue;var n=O(e[i]);const r=n[0];if("string"!==typeof(n=n[1]))continue;n=n.trim();const s=t[r]||[];t[r]=s,s.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,(function(e){return e.join(", ")}))})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,xe(12)):(this.s=0,xe(13)),it(this),nt(this)}}}catch(d){}},Ke.prototype.cancel=function(){this.J=!0,it(this)},Ke.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info((function(){return"TIMEOUT: "+t}))}(this.i,this.A),2!=this.L&&(Le(),xe(17)),it(this),this.s=2,nt(this)):et(this,this.S-e)};function st(e){this.l=e||10,r.PerformanceNavigationTiming?e=0<(e=r.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(r.chrome&&r.chrome.loadTimes&&r.chrome.loadTimes()&&r.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function ot(e){return!!e.h||!!e.g&&e.g.size>=e.j}function at(e){return e.h?1:e.g?e.g.size:0}function ct(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function ut(e,t){e.g?e.g.add(t):e.h=t}function lt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function ht(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return T(e.i)}function dt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(s(e)||"string"===typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!==typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!==typeof Set&&e instanceof Set)){if(s(e)||"string"===typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const i in e)t[n++]=i;return t}}}(e),i=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!==typeof Map&&e instanceof Map||"undefined"!==typeof Set&&e instanceof Set)return Array.from(e.values());if("string"===typeof e)return e.split("");
2if(s(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,o=0;o<r;o++)t.call(void 0,i[o],n&&n[o],e)}st.prototype.cancel=function(){if(this.i=ht(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 ft=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function pt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof pt){this.h=e.h,mt(this,e.j),this.o=e.o,this.g=e.g,vt(this,e.s),this.l=e.l;var t=e.i,n=new Nt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),yt(this,n),this.m=e.m}else e&&(t=String(e).match(ft))?(this.h=!1,mt(this,t[1]||"",!0),this.o=bt(t[2]||""),this.g=bt(t[3]||"",!0),vt(this,t[4]),this.l=bt(t[5]||"",!0),yt(this,t[6]||"",!0),this.m=bt(t[7]||"")):(this.h=!1,this.i=new Nt(null,this.h))}function gt(e){return new pt(e)}function mt(e,t,n){e.j=n?bt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function vt(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function yt(e,t,n){t instanceof Nt?(e.i=t,function(e,t){t&&!e.j&&(Pt(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(Ot(this,t),Lt(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=Tt(t,kt)),e.i=new Nt(t,e.h))}function wt(e,t,n){e.i.set(t,n)}function _t(e){return wt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function bt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Tt(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,It),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function It(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}pt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Tt(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(Tt(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(Tt(n,"/"==n.charAt(0)?At:Ct,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",Tt(n,Rt)),e.join("")};var Et,St=/[#\/\?@]/g,Ct=/[#\?:]/g,At=/[#\?]/g,kt=/[#\?@]/g,Rt=/#/g;function Nt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Pt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function Ot(e,t){Pt(e),t=Mt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Dt(e,t){return Pt(e),t=Mt(e,t),e.g.has(t)}function Lt(e,t,n){Ot(e,t),0<n.length&&(e.i=null,e.g.set(Mt(e,t),T(n)),e.h+=n.length)}function Mt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function xt(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(s){}}function Ft(){this.g=new Ie}function Ut(e,t,n){const i=n||"";try{dt(e,(function(e,n){let r=e;o(e)&&(r=be(e)),t.push(i+n+"="+encodeURIComponent(r))}))}catch(r){throw t.push(i+"type="+encodeURIComponent("_badmap")),r}}function Vt(e){this.l=e.Ub||null,this.j=e.eb||!1}function jt(e,t){de.call(this),this.D=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.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function qt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function Bt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,zt(e)}function zt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function $t(e){let t="";return k(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Kt(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=$t(n),"string"===typeof e?null!=n&&encodeURIComponent(String(n)):wt(e,t,n))}function Ht(e){de.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=Nt.prototype).add=function(e,t){Pt(this),this.i=null,e=Mt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Pt(this),this.g.forEach((function(n,i){n.forEac
2h((function(n){e.call(t,n,i,this)}),this)}),this)},e.na=function(){Pt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){const r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},e.V=function(e){Pt(this);let t=[];if("string"===typeof e)Dt(this,e)&&(t=t.concat(this.g.get(Mt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Pt(this),this.i=null,Dt(this,e=Mt(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&&0<(e=this.V(e)).length?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(var n=0;n<t.length;n++){var i=t[n];const s=encodeURIComponent(String(i)),o=this.V(i);for(i=0;i<o.length;i++){var r=s;""!==o[i]&&(r+="="+encodeURIComponent(String(o[i]))),e.push(r)}}return this.i=e.join("&")},b(Vt,Ee),Vt.prototype.g=function(){return new jt(this.l,this.j)},Vt.prototype.i=(Et={},function(){return Et}),b(jt,de),(e=jt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,zt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||r).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Bt(this)),this.readyState=0},e.Sa=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,zt(this)),this.g&&(this.readyState=3,zt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if("undefined"!==typeof r.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.v=new TextDecoder;qt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=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.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Bt(this):zt(this),3==this.readyState&&qt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,Bt(this))},e.Qa=function(e){this.g&&(this.response=e,Bt(this))},e.ga=function(){this.g&&Bt(this)},e.setRequestHeader=function(e,t){this.u.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(jt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),b(Ht,de);var Wt=/^https?$/i,Gt=["POST","PUT"];function Qt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Jt(e),Yt(e)}function Jt(e){e.A||(e.A=!0,fe(e,"complete"),fe(e,"error"))}function Xt(e){if(e.h&&"undefined"!=typeof i&&(!e.v[1]||4!=en(e)||2!=e.Z()))if(e.u&&4==en(e))ge(e.Ea,0,e);else if(fe(e,"readystatechange"),4==en(e)){e.h=!1;try{const i=e.Z();e:switch(i){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===i){var o=String(e.D).match(ft)[1]||null;!o&&r.self&&r.self.location&&(o=r.self.location.protocol.slice(0,-1)),s=!Wt.test(o?o.toLowerCase():"")}n=s}if(n)fe(e,"complete"),fe(e,"success");else{e.m=6;try{var a=2<en(e)?e.g.statusText:""}catch(c){a=""}e.l=a+" ["+e.Z()+"]",Jt(e)}}finally{Yt(e)}}}function Yt(e,t){if(e.g){Zt(e);const i=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||fe(e,"ready");try{i.onreadystatechange=r}catch(n){}}}function Zt(e){e.I&&(r.clearTimeout(e.I),e.I=null)}function en(e){return e.g?e.g.readyState:0}function tn(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(t){return null}}
2function nn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function rn(e){this.Aa=0,this.i=[],this.j=new Ve,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=nn("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=nn("baseRetryDelayMs",5e3,e),this.cb=nn("retryDelaySeedMs",1e4,e),this.Wa=nn("forwardChannelMaxRetries",2,e),this.wa=nn("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new st(e&&e.concurrentRequestLimit),this.Da=new Ft,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function sn(e){if(an(e),3==e.G){var t=e.U++,n=gt(e.I);if(wt(n,"SID",e.K),wt(n,"RID",t),wt(n,"TYPE","terminate"),ln(e,n),(t=new Ke(e,e.j,t)).L=2,t.v=_t(gt(n)),n=!1,r.navigator&&r.navigator.sendBeacon)try{n=r.navigator.sendBeacon(t.v.toString(),"")}catch(i){}!n&&r.Image&&((new Image).src=t.v,n=!0),n||(t.g=Tn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Ze(t)}_n(e)}function on(e){e.g&&(pn(e),e.g.cancel(),e.g=null)}function an(e){on(e),e.u&&(r.clearTimeout(e.u),e.u=null),mn(e),e.h.cancel(),e.s&&("number"===typeof e.s&&r.clearTimeout(e.s),e.s=null)}function cn(e){if(!ot(e.h)&&!e.s){e.s=!0;var t=e.Ga;F||j(),U||(F(),U=!0),V.add(t,e),e.B=0}}function un(e,t){var n;n=t?t.l:e.U++;const i=gt(e.I);wt(i,"SID",e.K),wt(i,"RID",n),wt(i,"AID",e.T),ln(e,i),e.m&&e.o&&Kt(i,e.m,e.o),n=new Ke(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=hn(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),ut(e.h,n),Qe(n,i,t)}function ln(e,t){e.H&&k(e.H,(function(e,n){wt(t,n,e)})),e.l&&dt({},(function(e,n){wt(t,n,e)}))}function hn(e,t,n){n=Math.min(e.i.length,n);var i=e.l?u(e.l.Na,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let o=!0;for(let a=0;a<n;a++){let n=r[a].g;const c=r[a].map;if(n-=t,0>n)t=Math.max(0,r[a].g-100),o=!1;else try{Ut(c,e,"req"+n+"_")}catch(s){i&&i(c)}}if(o){i=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,i}function dn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;F||j(),U||(F(),U=!0),V.add(t,e),e.v=0}}function fn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ue(u(e.Fa,e),yn(e,e.v)),e.v++,!0)}function pn(e){null!=e.A&&(r.clearTimeout(e.A),e.A=null)}function gn(e){e.g=new Ke(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=gt(e.qa);wt(t,"RID","rpc"),wt(t,"SID",e.K),wt(t,"AID",e.T),wt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&wt(t,"TO",e.ja),wt(t,"TYPE","xmlhttp"),ln(e,t),e.m&&e.o&&Kt(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=_t(gt(t)),n.m=null,n.P=!0,Je(n,e)}function mn(e){null!=e.C&&(r.clearTimeout(e.C),e.C=null)}function vn(e,t){var n=null;if(e.g==t){mn(e),pn(e),e.g=null;var i=2}else{if(!ct(e.h,t))return;n=t.D,lt(e.h,t),i=1}if(0!=e.G)if(t.o)if(1==i){n=t.m?t.m.length:0,t=Date.now()-t.F;var r=e.B;fe(i=Oe(),new Fe(i,n)),cn(e)}else dn(e);else if(3==(r=t.s)||0==r&&0<t.X||!(1==i&&function(e,t){return!(at(e.h)>=e.h.j-(e.s?1:0))&&(e.s?(e.i=t.D.concat(e.i),!0):!(1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa))&&(e.s=Ue(u(e.Ga,e,t),yn(e,e.B)),e.B++,!0))}(e,t)||2==i&&fn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),r){case 1:wn(e,5);break;case 4:wn(e,10);break;case 3:wn(e,6);break;default:wn(e,2)}}function yn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function wn(e,t){if(e.j.info("Error code "+t),2==t){var n=u(e.fb,e),i=e.Xa;const t=!i;i=new pt(i||"//www.google.com/images/cleardot.gif"),r.location&&"http"==r.location.protocol||mt(i,"https"),_t(i),t?function(e,t){const n=new Ve;if(r.Image){const i=new Image;i.onload=l(xt,n,"TestLoadImage: loaded",!0,t,i),i.onerror=l(xt,n,"TestLoadImage: error",!1,t,i),i.onabort=l(xt,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=l(xt,n,"TestLoadImage: timeout",!1,t,i),r.setTimeout((function(){i.ontimeout&&i.ontimeout()}),1e4),i.src=e}else t(!1)}(i.toString(),n):function(e,t){new Ve;const n=new AbortController,i=setTimeout((()=>{n.abort(),xt(0,0,!1,t)}),1e4);fetch(e,{signal:n.signal}).then((e=>{clearTimeout(i),e.ok?xt(0,0,!0,t):xt(0,0,!1,t)})).catch((()=>{clearTimeout(i),xt(0,0,!1,t)}))}(i.toString(),n)}else xe(2);e.G=0,e.l&&e.l.sa(t),_n(e),an(e)}function _n(e){if(e.G=0,e.ka=[],e.l){const t=ht(e.h);
20==t.length&&0==e.i.length||(I(e.ka,t),I(e.ka,e.i),e.h.i.length=0,T(e.i),e.i.length=0),e.l.ra()}}function bn(e,t,n){var i=n instanceof pt?gt(n):new pt(n);if(""!=i.g)t&&(i.g=t+"."+i.g),vt(i,i.s);else{var s=r.location;i=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var o=new pt(null);i&&mt(o,i),t&&(o.g=t),s&&vt(o,s),n&&(o.l=n),i=o}return n=e.D,t=e.ya,n&&t&&wt(i,n,t),wt(i,"VER",e.la),ln(e,i),i}function Tn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new Ht(new Vt({eb:n})):new Ht(e.pa)).Ha(e.J),t}function In(){}function En(){}function Sn(e,t){de.call(this),this.g=new rn(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.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!E(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!E(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new kn(this)}function Cn(e){ke.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 An(){Re.call(this),this.status=1}function kn(e){this.g=e}(e=Ht.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():qe.g(),this.v=this.o?Se(this.o):Se(qe),this.g.onreadystatechange=u(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(o){return void Qt(this,o)}if(e=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else{if("function"!==typeof i.keys||"function"!==typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),s=r.FormData&&e instanceof r.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[r,a]of n)this.g.setRequestHeader(r,a);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Zt(this),this.u=!0,this.g.send(e),this.u=!1}catch(o){Qt(this,o)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,fe(this,"complete"),fe(this,"abort"),Yt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Yt(this,!0)),Ht.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Xt(this):this.bb())},e.bb=function(){Xt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<en(this)?this.g.status:-1}catch(Et){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(Et){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),Te(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"===typeof this.l?this.l:String(this.l)},(e=rn.prototype).la=8,e.G=1,e.connect=function(e,t,n,i){xe(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.I=bn(this,null,this.W),cn(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const r=new Ke(this,this.j,e);let s=this.o;if(this.S&&(s?(s=R(s),P(s,this.S)):s=this.S),null!==this.m||this.O||(r.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"===typeof(i=i.map.__data__)?i.length:void 0))break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;
2t=hn(this,r,t),wt(n=gt(this.I),"RID",e),wt(n,"CVER",22),this.D&&wt(n,"X-HTTP-Session-Id",this.D),ln(this,n),s&&(this.O?t="headers="+encodeURIComponent(String($t(s)))+"&"+t:this.m&&Kt(n,this.m,s)),ut(this.h,r),this.Ua&&wt(n,"TYPE","init"),this.P?(wt(n,"$req",t),wt(n,"SID","null"),r.T=!0,Qe(r,n,null)):Qe(r,n,t),this.G=2}}else 3==this.G&&(e?un(this,e):0==this.i.length||ot(this.h)||un(this))},e.Fa=function(){if(this.u=null,gn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ue(u(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,xe(10),on(this),gn(this))},e.Za=function(){null!=this.C&&(this.C=null,on(this),fn(this),xe(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),xe(2)):(this.j.info("Failed to ping google.com"),xe(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=In.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},En.prototype.g=function(e,t){return new Sn(e,t)},b(Sn,de),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){sn(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"===typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=be(e),e=n);t.i.push(new class{constructor(e,t){this.g=e,this.map=t}}(t.Ya++,e)),3==t.G&&cn(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,sn(this.g),delete this.g,Sn.aa.N.call(this)},b(Cn,ke),b(An,Re),b(kn,In),kn.prototype.ua=function(){fe(this.g,"a")},kn.prototype.ta=function(e){fe(this.g,new Cn(e))},kn.prototype.sa=function(e){fe(this.g,new An)},kn.prototype.ra=function(){fe(this.g,"b")},En.prototype.createWebChannel=En.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,y=_.createWebChannelTransport=function(){return new En},v=_.getStatEventTarget=function(){return Oe()},m=_.Event=Ne,g=_.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Be.NO_ERROR=0,Be.TIMEOUT=8,Be.HTTP_ERROR=6,p=_.ErrorCode=Be,ze.COMPLETE="complete",f=_.EventType=ze,Ce.EventType=Ae,Ae.OPEN="a",Ae.CLOSE="b",Ae.ERROR="c",Ae.MESSAGE="d",de.prototype.listen=de.prototype.K,d=_.WebChannel=Ce,_.FetchXmlHttpFactory=Vt,Ht.prototype.listenOnce=Ht.prototype.L,Ht.prototype.getLastError=Ht.prototype.Ka,Ht.prototype.getLastErrorCode=Ht.prototype.Ba,Ht.prototype.getStatus=Ht.prototype.Z,Ht.prototype.getResponseJson=Ht.prototype.Oa,Ht.prototype.getResponseText=Ht.prototype.oa,Ht.prototype.send=Ht.prototype.ea,Ht.prototype.setWithCredentials=Ht.prototype.Ha,h=_.XhrIo=Ht}).apply("undefined"!==typeof w?w:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{});const b="@firebase/firestore",T="4.8.0";class I{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}}I.UNAUTHENTICATED=new I(null),I.GOOGLE_CREDENTIALS=new I("google-credentials-uid"),I.FIRST_PARTY=new I("first-party-uid"),I.MOCK_USER=new I("mock-user");let E="11.10.0";const S=new a.Vy("@firebase/firestore");function C(){return S.logLevel}function A(e){if(S.logLevel<=a.$b.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];const r=n.map(N);S.debug(`Firestore (${E}): ${e}`,...r)}}function k(e){if(S.logLevel<=a.$b.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];const r=n.map(N);S.error(`Firestore (${E}): ${e}`,...r)}}function R(e){if(S.logLevel<=a.$b.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];const r=n.map(N);S.warn(`Firestore (${E}): ${e}`,...r)}}function N(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function P(e,t,n){let i="Unexpected state";"string"==typeof t?i=t:n=t,O(e,i,n)}function O(e,t,n){let i=`FIRESTORE (${E}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{i+=" CONTEXT: "+JSON.stringify(n)}catch(e){i+=" CONTEXT: "+n}throw k(i),new Error(i)}function D(e,t,n,i){let r="Unexpected state";"string"==typeof n?r=n:i=n,e||O(t,r,i)}function L(e,t){return e}const M={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",UNIMPLEMENT
vendor: 22,497 bytes, line 2
2ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class x extends c.g{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class F{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class U{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class V{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(I.UNAUTHENTICATED)))}shutdown(){}}class j{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 q{constructor(e){this.t=e,this.currentUser=I.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){D(void 0===this.o,42304);let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new F;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new F,e.enqueueRetryable((()=>i(this.currentUser)))};const s=()=>{const t=r;e.enqueueRetryable((async()=>{await t.promise,await i(this.currentUser)}))},o=e=>{A("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(A("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new F)}}),0),s()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(A("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(D("string"==typeof t.accessToken,31837,{l:t}),new U(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 D(null===e||"string"==typeof e,2055,{h:e}),new I(e)}}class B{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=I.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class z{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new B(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable((()=>t(I.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class ${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 K{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,(0,s._isFirebaseServerApp)(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){D(void 0===this.o,3512);const n=e=>{null!=e.error&&A("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,A("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const i=e=>{A("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((e=>i(e))),setTimeout((()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?i(e):A("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new $(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(D("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new $(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function H(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 i=0;i<e;i++)n[i]=Math.floor(256*Math.random());return n}function W(){return new TextEncoder}class G{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=H(40);for(let i=0;i<n.length;++i)t.length<20&&n[i]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[i]%62))}return t}}function Q(e,t){return e<t?-1:e>t?1:0}function J(e,t){let n=0;for(;n<e.length&&n<t.length;){const i=e.codePointAt(n),r=t.codePointAt(n);if(i!==r){if(i<128&&r<128)return Q(i,r);{const s=W(),o=Y(s.encode(X(e,n)),s.encode(X(t,n)));return 0!==o?o:Q(i,r)}}n+=i>65535?2:1}return Q(e.length,t.length)}function X(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function Y(e,t){for(let n=0;n<e.length&&n<t.length;++n)if(e[n]!==t[n])return Q(e[n],t[n]);return Q(e.length,t.length)}function Z(e,t,n){return e.length===t.length&&e.every(((e,i)=>n(e,t[i])))}const ee="__name__";class te{constructor(e,t,n){void 0===t?t=0:t>e.length&&P(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&P(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===te.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof te?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++){const n=te.compareSegments(e.get(i),t.get(i));if(0!==n)return n}return Q(e.length,t.length)}static compareSegments(e,t){const n=te.isNumericId(e),i=te.isNumericId(t);return n&&!i?-1:!n&&i?1:n&&i?te.extractNumericId(e).compare(te.extractNumericId(t)):J(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return i.fromString(e.substring(4,e.length-2))}}class ne extends te{construct(e,t,n){return new ne(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(){const e=[];for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(const r of n){if(r.indexOf("//")>=0)throw new x(M.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);e.push(...r.split("/").filter((e=>e.length>0)))}return new ne(e)}static emptyPath(){return new ne([])}}const ie=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class re extends te{construct(e,t,n){return new re(e,t,n)}static isValidIdentifier(e){return ie.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),re.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===ee}static keyField(){return new re([ee])}static fromServerFormat(e){const t=[];let n="",i=0;const r=()=>{if(0===n.length)throw new x(M.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let s=!1;for(;i<e.length;){const t=e[i];if("\\"===t){if(i+1===e.length)throw new x(M.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new x(M.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?(s=!s,i++):"."!==t||s?(n+=t,i++):(r(),i++)}if(r(),s)throw new x(M.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new re(t)}static emptyPath(){return new re([])}}class se{constructor(e){this.path=e}static fromPath(e){return new se(ne.fromString(e))}static fromName(e){return new se(ne.fromString(e).popFirst(5))}static empty(){return new se(ne.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===ne.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return ne.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new se(new ne(e.slice()))}}function oe(e,t,n){if(!n)throw new x(M.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function ae(e){if(!se.isDocumentKey(e))throw new x(M.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function ce(e){if(se.isDocumentKey(e))throw new x(M.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function ue(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function le(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":P(12329,{type:typeof e})}function he(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new x(M.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=le(e);throw new x(M.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function de(e,t){if(t<=0)throw new x(M.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}function fe(e,t){const n={typeString:e};return t&&(n.value=t),n}function pe(e,t){if(!ue(e))throw new x(M.INVALID_ARGUMENT,"JSON must be an object");let n;for(const i in t)if(t[i]){const r=t[i].typeString,s="value"in t[i]?{value:t[i].value}:void 0;if(!(i in e)){n=`JSON missing required field: '${i}'`;break}const o=e[i];if(r&&typeof o!==r){n=`JSON field '${i}' must be a ${r}.`;break}if(void 0!==s&&o!==s.value){n=`Expected '${i}' field to equal '${s.value}'`;break}}if(n)throw new x(M.INVALID_ARGUMENT,n);return!0}const ge=-62135596800,me=1e6;class ve{static now(){return ve.fromMillis(Date.now())}static fromDate(e){return ve.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*me);return new ve(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new x(M.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new x(M.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<ge)throw new x(M.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new x(M.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/me}_compareTo(e){return this.seconds===e.seconds?Q(this.nanoseconds,e.nanoseconds):Q(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:ve._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(pe(e,ve._jsonSchema))return new ve(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-ge;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}ve._jsonSchemaVersion="firestore/timestamp/1.0",ve._jsonSchema={type:fe("string",ve._jsonSchemaVersion),seconds:fe("number"),nanoseconds:fe("number")};class ye{static fromTimestamp(e){return new ye(e)}static min(){return new ye(new ve(0,0))}static max(){return new ye(new ve(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 we=-1;class _e{constructor(e,t,n,i){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=i}}_e.UNKNOWN_ID=-1;function be(e,t){const n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,r=ye.fromTimestamp(1e9===i?new ve(n+1,0):new ve(n,i));return new Ie(r,se.empty(),t)}function Te(e){return new Ie(e.readTime,e.key,we)}class Ie{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new Ie(ye.min(),se.empty(),we)}static max(){return new Ie(ye.max(),se.empty(),we)}}function Ee(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=se.comparator(e.documentKey,t.documentKey),0!==n?n:Q(e.largestBatchId,t.largestBatchId))}const Se="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Ce{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function Ae(e){if(e.code!==M.FAILED_PRECONDITION||e.message!==Se)throw e;A("LocalStore","Unexpectedly lost primary lease")}class ke{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&&P(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new ke(((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof ke?t:ke.resolve(t)}catch(e){return ke.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):ke.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):ke.reject(t)}static resolve(e){return new ke(((t,n)=>{t(e)}))}static reject(e){return new ke(((t,n)=>{n(e)}))}static waitFor(e){return new ke(((t,n)=>{let i=0,r=0,s=!1;e.forEach((e=>{++i,e.next((()=>{++r,s&&r===i&&t()}),(e=>n(e)))})),s=!0,r===i&&t()}))}static or(e){let t=ke.resolve(!1);for(const n of e)t=t.next((e=>e?ke.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,i)=>{n.push(t.call(this,e,i))})),this.waitFor(n)}static mapArray(e,t){return new ke(((n,i)=>{const r=e.length,s=new Array(r);let o=0;for(let a=0;a<r;a++){const c=a;t(e[c]).next((e=>{s[c]=e,++o,o===r&&n(s)}),(e=>i(e)))}}))}static doWhile(e,t){return new ke(((n,i)=>{const r=()=>{!0===e()?t().next((()=>{r()}),i):n()};r()}))}}function Re(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Ne(e){return"IndexedDbTransactionError"===e.name}class Pe{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this._e(e),this.ae=e=>t.writeSequenceNumber(e))}_e(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ae&&this.ae(e),e}}Pe.ue=-1;const Oe=-1;function De(e){return null==e}function Le(e){return 0===e&&1/e==-1/0}function Me(e){return"number"==typeof e&&Number.isInteger(e)&&!Le(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}const xe="\x01";function Fe(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=Ve(t)),t=Ue(e.get(n),t);return Ve(t)}function Ue(e,t){let n=t;const i=e.length;for(let r=0;r<i;r++){const t=e.charAt(r);switch(t){case"\0":n+="\x01\x10";break;case xe:n+="\x01\x11";break;default:n+=t}}return n}function Ve(e){return e+xe+"\x01"}const je="remoteDocuments",qe="owner",Be="mutationQueues",ze="mutations";const $e="documentMutations",Ke="remoteDocumentsV14",He="remoteDocumentGlobal",We="targets",Ge="targetDocuments",Qe="targetGlobal",Je="collectionParents",Xe="clientMetadata",Ye="bundles",Ze="namedQueries",et="indexConfiguration",tt="indexState",nt="indexEntries",it="documentOverlays",rt="globals",st=[Be,ze,$e,je,We,qe,Qe,Ge,Xe,He,Je,Ye,Ze],ot=[Be,ze,$e,Ke,We,qe,Qe,Ge,Xe,He,Je,Ye,Ze,it],at=ot,ct=[...at,et,tt,nt];function ut(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function lt(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function ht(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class dt{constructor(e,t){this.comparator=e,this.root=t||pt.EMPTY}insert(e,t){return new dt(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,pt.BLACK,null,null))}remove(e){return new dt(this.comparator,this.root.remove(e,this.comparator).copy(null,null,pt.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 i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<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 ft(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ft(this.root,e,this.comparator,!1)}getReverseIterator(){return new ft(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ft(this.root,e,this.comparator,!0)}}class ft{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&i&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){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 pt{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:pt.RED,this.left=null!=i?i:pt.EMPTY,this.right=null!=r?r:pt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,r){return new pt(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r: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 i=this;const r=n(e,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return pt.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,i=this;if(t(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return pt.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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,pt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,pt.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 P(43730,{key:this.key,value:this.value});if(this.right.isRed())throw P(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw P(27949);return e+(this.isRed()?0:1)}}
vendor: 4,984 bytes, line 2
2pt.EMPTY=null,pt.RED=!0,pt.BLACK=!1,pt.EMPTY=new class{constructor(){this.size=0}get key(){throw P(57766)}get value(){throw P(16141)}get color(){throw P(16727)}get left(){throw P(29726)}get right(){throw P(36894)}copy(e,t,n,i,r){return this}insert(e,t,n){return new pt(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 gt{constructor(e){this.comparator=e,this.data=new dt(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 i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.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 mt(this.data.getIterator())}getIteratorFrom(e){return new mt(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 gt))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,i=n.getNext().key;if(0!==this.comparator(e,i))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 gt(this.comparator);return t.data=e,t}}class mt{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class vt{constructor(e){this.fields=e,e.sort(re.comparator)}static empty(){return new vt([])}unionWith(e){let t=new gt(re.comparator);for(const n of this.fields)t=t.add(n);for(const n of e)t=t.add(n);return new vt(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Z(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class yt extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class wt{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 yt("Invalid base64 string: "+e):e}}(e);return new wt(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 wt(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 Q(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}wt.EMPTY_BYTE_STRING=new wt("");const _t=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bt(e){if(D(!!e,39018),"string"==typeof e){let t=0;const n=_t.exec(e);if(D(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:Tt(e.seconds),nanos:Tt(e.nanos)}}function Tt(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function It(e){return"string"==typeof e?wt.fromBase64String(e):wt.fromUint8Array(e)}const Et="server_timestamp",St="__type__",Ct="__previous_value__",At="__local_write_time__";function kt(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[St])||void 0===n?void 0:n.stringValue)===Et}function Rt(e){const t=e.mapValue.fields[Ct];return kt(t)?Rt(t):t}function Nt(e){const t=bt(e.mapValue.fields[At].timestampValue);return new ve(t.seconds,t.nanos)}class Pt{constructor(e,t,n,i,r,s,o,a,c,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=r,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c,this.isUsingEmulator=u}}const Ot="(default)";class Dt{constructor(e,t){this.projectId=e,this.database=t||Ot}static empty(){return new Dt("","")}get isDefaultDatabase(){return this.database===Ot}isEqual(e){return e instanceof Dt&&e.projectId===this.projectId&&e.database===this.database}}const Lt="__type__",Mt="__max__",xt={mapValue:{fields:{__type__:{stringValue:
2Mt}}}},Ft="__vector__",Ut="value";function Vt(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?kt(e)?4:nn(e)?9007199254740991:en(e)?10:11:P(28295,{value:e})}function jt(e,t){if(e===t)return!0;const n=Vt(e);if(n!==Vt(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Nt(e).isEqual(Nt(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=bt(e.timestampValue),i=bt(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return It(e.bytesValue).isEqual(It(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Tt(e.geoPointValue.latitude)===Tt(t.geoPointValue.latitude)&&Tt(e.geoPointValue.longitude)===Tt(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Tt(e.integerValue)===Tt(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Tt(e.doubleValue),i=Tt(t.doubleValue);return n===i?Le(n)===Le(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return Z(e.arrayValue.values||[],t.arrayValue.values||[],jt);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(ut(n)!==ut(i))return!1;for(const r in n)if(n.hasOwnProperty(r)&&(void 0===i[r]||!jt(n[r],i[r])))return!1;return!0}(e,t);default:return P(52216,{left:e})}}function qt(e,t){return void 0!==(e.values||[]).find((e=>jt(e,t)))}function Bt(e,t){if(e===t)return 0;const n=Vt(e),i=Vt(t);if(n!==i)return Q(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return Q(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Tt(e.integerValue||e.doubleValue),i=Tt(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return zt(e.timestampValue,t.timestampValue);case 4:return zt(Nt(e),Nt(t));case 5:return J(e.stringValue,t.stringValue);case 6:return function(e,t){const n=It(e),i=It(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),i=t.split("/");for(let r=0;r<n.length&&r<i.length;r++){const e=Q(n[r],i[r]);if(0!==e)return e}return Q(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Q(Tt(e.latitude),Tt(t.latitude));return 0!==n?n:Q(Tt(e.longitude),Tt(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return $t(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,i,r,s;const o=e.fields||{},a=t.fields||{},c=null===(n=o[Ut])||void 0===n?void 0:n.arrayValue,u=null===(i=a[Ut])||void 0===i?void 0:i.arrayValue,l=Q((null===(r=null==c?void 0:c.values)||void 0===r?void 0:r.length)||0,(null===(s=null==u?void 0:u.values)||void 0===s?void 0:s.length)||0);return 0!==l?l:$t(c,u)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===xt.mapValue&&t===xt.mapValue)return 0;if(e===xt.mapValue)return 1;if(t===xt.mapValue)return-1;const n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let o=0;o<i.length&&o<s.length;++o){const e=J(i[o],s[o]);if(0!==e)return e;const t=Bt(n[i[o]],r[s[o]]);if(0!==t)return t}return Q(i.length,s.length)}(e.mapValue,t.mapValue);default:throw P(23264,{le:n})}}function zt(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Q(e,t);const n=bt(e),i=bt(t),r=Q(n.seconds,i.seconds);return 0!==r?r:Q(n.nanos,i.nanos)}function $t(e,t){const n=e.values||[],i=t.values||[];for(let r=0;r<n.length&&r<i.length;++r){const e=Bt(n[r],i[r]);if(e)return e}return Q(n.length,i.length)}function Kt(e){return Ht(e)}function Ht(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=bt(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return It(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return se.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 i of e.values||[])n?n=!1:t+=",",t+=Ht(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",i=!0;for(const r of t)i?i=!1:n+=",",n+=`${r}:${Ht(e.fields[r])}`;return n+"}"}(e.mapValue):P(61005,{value:e})}function Wt(e){switch(Vt(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Rt(e);return t?16+Wt(t):16;case 5:return 2*e.stringValue.length;case 6:return It(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce(((e,t)=>e+Wt(t)),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return lt(e.fields,((e,n)=>{t+=e.length+Wt(n)})),t}(e.mapValue);default:throw P(13486,{value:e})}}function Gt(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function Qt(e){return!!e&&"integerValue"in e}function Jt(e){return!!e&&"arrayValue"in e}function Xt(e){return!!e&&"nullValue"in e}function Yt(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Zt(e){return!!e&&"mapValue"in e}function en(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Lt])||void 0===n?void 0:n.stringValue)===Ft}function tn(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return lt(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=tn(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=tn(e.arrayValue.values[n]);return t}return Object.assign({},e)}function nn(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===Mt}class rn{constructor(e){this.value=e}static empty(){return new rn({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)],!Zt(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=tn(t)}setAll(e){let t=re.emptyPath(),n={},i=[];e.forEach(((e,r)=>{if(!t.isImmediateParentOf(r)){const e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=tn(e):i.push(r.lastSegment())}
vendor: 5,228 bytes, line 2
2));const r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){const t=this.field(e.popLast());Zt(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return jt(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 i=t.mapValue.fields[e.get(n)];Zt(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){lt(t,((t,n)=>e[t]=n));for(const i of n)delete e[i]}clone(){return new rn(tn(this.value))}}function sn(e){const t=[];return lt(e.fields,((e,n)=>{const i=new re([e]);if(Zt(n)){const e=sn(n.mapValue).fields;if(0===e.length)t.push(i);else for(const n of e)t.push(i.child(n))}else t.push(i)})),new vt(t)}class on{constructor(e,t,n,i,r,s,o){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=r,this.data=s,this.documentState=o}static newInvalidDocument(e){return new on(e,0,ye.min(),ye.min(),ye.min(),rn.empty(),0)}static newFoundDocument(e,t,n,i){return new on(e,1,t,ye.min(),n,i,0)}static newNoDocument(e,t){return new on(e,2,t,ye.min(),ye.min(),rn.empty(),0)}static newUnknownDocument(e,t){return new on(e,3,t,ye.min(),ye.min(),rn.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(ye.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=rn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=rn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ye.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 on&&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 on(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class an{constructor(e,t){this.position=e,this.inclusive=t}}function cn(e,t,n){let i=0;for(let r=0;r<e.position.length;r++){const s=t[r],o=e.position[r];if(i=s.field.isKeyField()?se.comparator(se.fromName(o.referenceValue),n.key):Bt(o,n.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function un(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(!jt(e.position[n],t.position[n]))return!1;return!0}class ln{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";this.field=e,this.dir=t}}function hn(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class dn{}class fn extends dn{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 bn(e,t,n):"array-contains"===t?new Sn(e,n):"in"===t?new Cn(e,n):"not-in"===t?new An(e,n):"array-contains-any"===t?new kn(e,n):new fn(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Tn(e,n):new In(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(Bt(t,this.value)):null!==t&&Vt(this.value)===Vt(t)&&this.matchesComparison(Bt(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 P(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class pn extends dn{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new pn(e,t)}matches(e){return gn(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function gn(e){return"and"===e.op}function mn(e){return vn(e)&&gn(e)}function vn(e){for(const t of e.filters)if(t instanceof pn)return!1;return!0}function yn(e){if(e instanceof fn)return e.field.canonicalString()+e.op.toString()+Kt(e.value);if(mn(e))return e.filters.map((e=>yn(e))).join(",");{const t=e.filters.map((e=>yn(e))).join(",");
2return`${e.op}(${t})`}}function wn(e,t){return e instanceof fn?function(e,t){return t instanceof fn&&e.op===t.op&&e.field.isEqual(t.field)&&jt(e.value,t.value)}(e,t):e instanceof pn?function(e,t){return t instanceof pn&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,i)=>e&&wn(n,t.filters[i])),!0)}(e,t):void P(19439)}function _n(e){return e instanceof fn?function(e){return`${e.field.canonicalString()} ${e.op} ${Kt(e.value)}`}(e):e instanceof pn?function(e){return e.op.toString()+" {"+e.getFilters().map(_n).join(" ,")+"}"}(e):"Filter"}class bn extends fn{constructor(e,t,n){super(e,t,n),this.key=se.fromName(n.referenceValue)}matches(e){const t=se.comparator(e.key,this.key);return this.matchesComparison(t)}}class Tn extends fn{constructor(e,t){super(e,"in",t),this.keys=En("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class In extends fn{constructor(e,t){super(e,"not-in",t),this.keys=En("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function En(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>se.fromName(e.referenceValue)))}class Sn extends fn{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Jt(t)&&qt(t.arrayValue,this.value)}}class Cn extends fn{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&qt(this.value.arrayValue,t)}}class An extends fn{constructor(e,t){super(e,"not-in",t)}matches(e){if(qt(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!qt(this.value.arrayValue,t)}}class kn extends fn{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Jt(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>qt(this.value.arrayValue,e)))}}class Rn{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=s,this.endAt=o,this.Pe=null}}function Nn(e){return new Rn(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function Pn(e){const t=L(e);if(null===t.Pe){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>yn(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),De(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Kt(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Kt(e))).join(",")),t.Pe=e}return t.Pe}function On(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(!hn(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(!wn(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!un(e.startAt,t.startAt)&&un(e.endAt,t.endAt)}function Dn(e){return se.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class Ln{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=o,this.endAt=a,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function Mn(e,t,n,i,r,s,o,a){return new Ln(e,t,n,i,r,s,o,a)}function xn(e){return new Ln(e)}function Fn(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 Un(e){return null!==e.collectionGroup}function Vn(e){const t=L(e);if(null===t.Te){t.Te=[];const e=new Set;for(const r of t.explicitOrderBy)t.Te.push(r),e.add(r.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",i=function(e){let t=new gt(re.comparator);
vendor: 5,162 bytes, line 2
2return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t}(t);i.forEach((i=>{e.has(i.canonicalString())||i.isKeyField()||t.Te.push(new ln(i,n))})),e.has(re.keyField().canonicalString())||t.Te.push(new ln(re.keyField(),n))}return t.Te}function jn(e){const t=L(e);return t.Ie||(t.Ie=qn(t,Vn(e))),t.Ie}function qn(e,t){if("F"===e.limitType)return Nn(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 ln(e.field,t)}));const n=e.endAt?new an(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new an(e.startAt.position,e.startAt.inclusive):null;return Nn(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}function Bn(e,t){const n=e.filters.concat([t]);return new Ln(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function zn(e,t,n){return new Ln(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function $n(e,t){return On(jn(e),jn(t))&&e.limitType===t.limitType}function Kn(e){return`${Pn(jn(e))}|lt:${e.limitType}`}function Hn(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=>_n(e))).join(", ")}]`),De(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=>Kt(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Kt(e))).join(",")),`Target(${t})`}(jn(e))}; limitType=${e.limitType})`}function Wn(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):se.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Vn(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 i=cn(e,t,n);return e.inclusive?i<=0:i<0}(e.startAt,Vn(e),t))&&!(e.endAt&&!function(e,t,n){const i=cn(e,t,n);return e.inclusive?i>=0:i>0}(e.endAt,Vn(e),t))}(e,t)}function Gn(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Qn(e){return(t,n)=>{let i=!1;for(const r of Vn(e)){const e=Jn(r,t,n);if(0!==e)return e;i=i||r.field.isKeyField()}return 0}}function Jn(e,t,n){const i=e.field.isKeyField()?se.comparator(t.key,n.key):function(e,t,n){const i=t.data.field(e),r=n.data.field(e);return null!==i&&null!==r?Bt(i,r):P(42886)}(e.field,t,n);switch(e.dir){case"asc":return i;case"desc":return-1*i;default:return P(19790,{direction:e.dir})}}class Xn{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[i,r]of n)if(this.equalsFn(i,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let r=0;r<i.length;r++)if(this.equalsFn(i[r][0],e))return void(i[r]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return 1===n.length?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){lt(this.inner,((t,n)=>{for(const[i,r]of n)e(i,r)}))}isEmpty(){return ht(this.inner)}size(){return this.innerSize}}const Yn=new dt(se.comparator);function Zn(){return Yn}const ei=new dt(se.comparator);function ti(){let e=ei;for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(const r of n)e=e.insert(r.key,r);return e}function ni(e){let t=ei;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function ii(){return si()}function ri(){return si()}function si(){return new Xn((e=>e.toString()),((e,t)=>e.isEqual(t)))}const oi=new dt(se.comparator),ai=new gt(se.comparator);function ci(){let e=ai;for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(const r of n)e=e.add(r);return e}const ui=new gt(Q);function li(){return ui}function hi(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:Le(t)?"-0":t}}function di(e){return{integerValue:""+e}}function fi(e,t){return Me(t)?di(t):hi(e,t)}class pi{constructor(){this._=void 0}}function gi(e,t,n){return e instanceof yi?function(e,t){const n={fields:{[St]:{stringValue:Et},[At]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&kt(t)&&(t=Rt(t)),t&&(n.fields[Ct]=t),{mapValue:n}}(n,t):e instanceof wi?_i(e,t):e instanceof bi?Ti(e,t):function(e,t){const n=vi(e,t),i=Ei(n)+Ei(e.Ee);return Qt(n)&&Qt(e.Ee)?di(i):hi(e.serializer,i)}(e,t)}
2function mi(e,t,n){return e instanceof wi?_i(e,t):e instanceof bi?Ti(e,t):n}function vi(e,t){return e instanceof Ii?function(e){return Qt(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class yi extends pi{}class wi extends pi{constructor(e){super(),this.elements=e}}function _i(e,t){const n=Si(t);for(const i of e.elements)n.some((e=>jt(e,i)))||n.push(i);return{arrayValue:{values:n}}}class bi extends pi{constructor(e){super(),this.elements=e}}function Ti(e,t){let n=Si(t);for(const i of e.elements)n=n.filter((e=>!jt(e,i)));return{arrayValue:{values:n}}}class Ii extends pi{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Ei(e){return Tt(e.integerValue||e.doubleValue)}function Si(e){return Jt(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Ci{constructor(e,t){this.field=e,this.transform=t}}class Ai{constructor(e,t){this.version=e,this.transformResults=t}}class ki{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new ki}static exists(e){return new ki(void 0,e)}static updateTime(e){return new ki(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 Ri(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Ni{}function Pi(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new qi(e.key,ki.none()):new xi(e.key,e.data,ki.none());{const n=e.data,i=rn.empty();let r=new gt(re.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new Fi(e.key,i,new vt(r.toArray()),ki.none())}}function Oi(e,t,n){e instanceof xi?function(e,t,n){const i=e.value.clone(),r=Vi(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):e instanceof Fi?function(e,t,n){if(!Ri(e.precondition,t))return void t.convertToUnknownDocument(n.version);const i=Vi(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(Ui(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Di(e,t,n,i){return e instanceof xi?function(e,t,n,i){if(!Ri(e.precondition,t))return n;const r=e.value.clone(),s=ji(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof Fi?function(e,t,n,i){if(!Ri(e.precondition,t))return n;const r=ji(e.fieldTransforms,i,t),s=t.data;return s.setAll(Ui(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,i):function(e,t,n){return Ri(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Li(e,t){let n=null;for(const i of e.fieldTransforms){const e=t.data.field(i.field),r=vi(i.transform,e||null);null!=r&&(null===n&&(n=rn.empty()),n.set(i.field,r))}return n||null}function Mi(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)&&Z(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof wi&&t instanceof wi||e instanceof bi&&t instanceof bi?Z(e.elements,t.elements,jt):e instanceof Ii&&t instanceof Ii?jt(e.Ee,t.Ee):e instanceof yi&&t instanceof yi}(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 xi extends Ni{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Fi extends Ni{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];
vendor: 4,328 bytes, line 2
2super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function Ui(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}})),t}function Vi(e,t,n){const i=new Map;D(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let r=0;r<n.length;r++){const s=e[r],o=s.transform,a=t.data.field(s.field);i.set(s.field,mi(o,a,n[r]))}return i}function ji(e,t,n){const i=new Map;for(const r of e){const e=r.transform,s=n.data.field(r.field);i.set(r.field,gi(e,s,t))}return i}class qi extends Ni{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Bi extends Ni{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class zi{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let i=0;i<this.mutations.length;i++){const t=this.mutations[i];t.key.isEqual(e.key)&&Oi(t,e,n[i])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=Di(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=Di(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=ri();return this.mutations.forEach((i=>{const r=e.get(i.key),s=r.overlayedDocument;let o=this.applyToLocalView(s,r.mutatedFields);o=t.has(i.key)?null:o;const a=Pi(s,o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(ye.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),ci())}isEqual(e){return this.batchId===e.batchId&&Z(this.mutations,e.mutations,((e,t)=>Mi(e,t)))&&Z(this.baseMutations,e.baseMutations,((e,t)=>Mi(e,t)))}}class $i{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){D(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let i=oi;const r=e.mutations;for(let s=0;s<r.length;s++)i=i.insert(r[s].key,n[s].version);return new $i(e,t,n,i)}}class Ki{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 Hi{constructor(e,t){this.count=e,this.unchangedNames=t}}var Wi,Gi;function Qi(e){switch(e){case M.OK:return P(64938);case M.CANCELLED:case M.UNKNOWN:case M.DEADLINE_EXCEEDED:case M.RESOURCE_EXHAUSTED:case M.INTERNAL:case M.UNAVAILABLE:case M.UNAUTHENTICATED:return!1;case M.INVALID_ARGUMENT:case M.NOT_FOUND:case M.ALREADY_EXISTS:case M.PERMISSION_DENIED:case M.FAILED_PRECONDITION:case M.ABORTED:case M.OUT_OF_RANGE:case M.UNIMPLEMENTED:case M.DATA_LOSS:return!0;default:return P(15467,{code:e})}}function Ji(e){if(void 0===e)return k("GRPC error has no .code"),M.UNKNOWN;switch(e){case Wi.OK:return M.OK;case Wi.CANCELLED:return M.CANCELLED;case Wi.UNKNOWN:return M.UNKNOWN;case Wi.DEADLINE_EXCEEDED:return M.DEADLINE_EXCEEDED;case Wi.RESOURCE_EXHAUSTED:return M.RESOURCE_EXHAUSTED;case Wi.INTERNAL:return M.INTERNAL;case Wi.UNAVAILABLE:return M.UNAVAILABLE;case Wi.UNAUTHENTICATED:return M.UNAUTHENTICATED;case Wi.INVALID_ARGUMENT:return M.INVALID_ARGUMENT;case Wi.NOT_FOUND:return M.NOT_FOUND;case Wi.ALREADY_EXISTS:return M.ALREADY_EXISTS;case Wi.PERMISSION_DENIED:return M.PERMISSION_DENIED;case Wi.FAILED_PRECONDITION:return M.FAILED_PRECONDITION;case Wi.ABORTED:return M.ABORTED;case Wi.OUT_OF_RANGE:return M.OUT_OF_RANGE;case Wi.UNIMPLEMENTED:return M.UNIMPLEMENTED;case Wi.DATA_LOSS:return M.DATA_LOSS;default:return P(39323,{code:e})}}(Gi=Wi||(Wi={}))[Gi.OK=0]="OK",Gi[Gi.CANCELLED=1]="CANCELLED",Gi[Gi.UNKNOWN=2]="UNKNOWN",Gi[Gi.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Gi[Gi.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Gi[Gi.NOT_FOUND=5]="NOT_FOUND",Gi[Gi.ALREADY_EXISTS=6]="ALREADY_EXISTS",Gi[Gi.PERMISSION_DENIED=7]="PERMISSION_DENIED",Gi[Gi.UNAUTHENTICATED=16]="UNAUTHENTICATED",Gi[Gi.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Gi[Gi.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Gi[Gi.ABORTED=10]="ABORTED",Gi[Gi.OUT_OF_RANGE=11]="OUT_OF_RANGE",Gi[Gi.UNIMPLEMENT
2ED=12]="UNIMPLEMENTED",Gi[Gi.INTERNAL=13]="INTERNAL",Gi[Gi.UNAVAILABLE=14]="UNAVAILABLE",Gi[Gi.DATA_LOSS=15]="DATA_LOSS";let Xi=null;const Yi=new i([4294967295,4294967295],0);function Zi(e){const t=W().encode(e),n=new r;return n.update(t),new Uint8Array(n.digest())}function er(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),s=t.getUint32(8,!0),o=t.getUint32(12,!0);return[new i([n,r],0),new i([s,o],0)]}class tr{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new nr(`Invalid padding: ${t}`);if(n<0)throw new nr(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new nr(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new nr(`Invalid padding when bitmap length is 0: ${t}`);this.fe=8*e.length-t,this.ge=i.fromNumber(this.fe)}pe(e,t,n){let r=e.add(t.multiply(i.fromNumber(n)));return 1===r.compare(Yi)&&(r=new i([r.getBits(0),r.getBits(1)],0)),r.modulo(this.ge).toNumber()}ye(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.fe)return!1;const t=Zi(e),[n,i]=er(t);for(let r=0;r<this.hashCount;r++){const e=this.pe(n,i,r);if(!this.ye(e))return!1}return!0}static create(e,t,n){const i=e%8==0?0:8-e%8,r=new Uint8Array(Math.ceil(e/8)),s=new tr(r,i,t);return n.forEach((e=>s.insert(e))),s}insert(e){if(0===this.fe)return;const t=Zi(e),[n,i]=er(t);for(let r=0;r<this.hashCount;r++){const e=this.pe(n,i,r);this.we(e)}}we(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class nr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class ir{constructor(e,t,n,i,r){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const i=new Map;return i.set(e,rr.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ir(ye.min(),i,new dt(Q),Zn(),ci())}}class rr{constructor(e,t,n,i,r){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new rr(n,t,ci(),ci(),ci())}}class sr{constructor(e,t,n,i){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=i}}class or{constructor(e,t){this.targetId=e,this.De=t}}class ar{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wt.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class cr{constructor(){this.ve=0,this.Ce=hr(),this.Fe=wt.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=ci(),t=ci(),n=ci();return this.Ce.forEach(((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:P(38017,{changeType:r})}})),new rr(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=hr()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,D(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class ur{constructor(e){this.We=e,this.Ge=new Map,this.ze=Zn(),this.je=lr(),this.Je=lr(),this.He=new dt(Q)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,(t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:P(56790,{state:e.state})}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach(((e,n)=>{this.nt(n)&&t(n)}))}it(e){const t=e.targetId,n=e.De.count,i=this.st(t);if(i){const r=i.target;if(Dn(r))if(0===n){const e=new se(r.path);this.Xe(t,e,on.newNoDocument(e,ye.min()))}else D(1===n,20013,{expectedCount:n});else{const i=this.ot(t);if(i!==n){const n=this._t(e),r=n?this.ut(n,e,i):1;if(0!==r){this.rt(t);const e=2===r?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}null==Xi||Xi.ct(function(e,t,n,i,r){var s,o,a,c,u,l;const h={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},d=t.unchangedNames;return d&&(h.bloomFilter={applied:0===r,hashCount:null!==(s=null==d?void 0:d.hashCount)&&void 0!==s?s:0,bitmapLength:null!==(c=null===(a=null===(o=null==d?void 0:d.bits)||void 0===o?void 0:o.bitmap)||void 0===a?void 0:a.length)&&void 0!==c?c:0,padding:null!==(l=null===(u=null==d?void 0:d.bits)||void 0===u?void 0:u.padding)&&void 0!==l?l:0,mightContain:e=>{var t;return null!==(t=null==i?void 0:i.mightContain(e))&&void 0!==t&&t}}),h}(i,e.De,this.We.lt(),n,r))}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:r=0}=t;let s,o;try{s=It(n).toUint8Array()}catch(e){if(e instanceof yt)return R("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{o=new tr(s,i,r)}catch(e){return R(e instanceof nr?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let i=0;
2return n.forEach((n=>{const r=this.We.lt(),s=`projects/${r.projectId}/databases/${r.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Xe(t,n,null),i++)})),i}Pt(e){const t=new Map;this.Ge.forEach(((n,i)=>{const r=this.st(i);if(r){if(n.current&&Dn(r.target)){const t=new se(r.target.path);this.Tt(t).has(i)||this.It(i,t)||this.Xe(i,t,on.newNoDocument(t,e))}n.Ne&&(t.set(i,n.Le()),n.ke())}}));let n=ci();this.Je.forEach(((e,t)=>{let i=!0;t.forEachWhile((e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)})),i&&(n=n.add(e))})),this.ze.forEach(((t,n)=>n.setReadTime(e)));const i=new ir(e,t,this.He,this.ze,n);return this.ze=Zn(),this.je=lr(),this.Je=lr(),this.He=new dt(Q),i}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const i=this.tt(e);this.It(e,t)?i.qe(t,1):i.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new cr,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new gt(Q),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new gt(Q),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||A("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new cr),this.We.getRemoteKeysForTarget(e).forEach((t=>{this.Xe(e,t,null)}))}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function lr(){return new dt(se.comparator)}function hr(){return new dt(se.comparator)}const dr={asc:"ASCENDING",desc:"DESCENDING"},fr={"<":"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"},pr={and:"AND",or:"OR"};class gr{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function mr(e,t){return e.useProto3Json||De(t)?t:{value:t}}function vr(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 yr(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function wr(e,t){return vr(e,t.toTimestamp())}function _r(e){return D(!!e,49232),ye.fromTimestamp(function(e){const t=bt(e);return new ve(t.seconds,t.nanos)}(e))}function br(e,t){return Tr(e,t).canonicalString()}function Tr(e,t){const n=function(e){return new ne(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Ir(e){const t=ne.fromString(e);return D(zr(t),10190,{key:t.toString()}),t}function Er(e,t){return br(e.databaseId,t.path)}function Sr(e,t){const n=Ir(t);if(n.get(1)!==e.databaseId.projectId)throw new x(M.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 x(M.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new se(Rr(n))}function Cr(e,t){return br(e.databaseId,t)}function Ar(e){const t=Ir(e);return 4===t.length?ne.emptyPath():Rr(t)}function kr(e){return new ne(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Rr(e){return D(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Nr(e,t,n){return{name:Er(e,t),fields:n.value.mapValue.fields}}function Pr(e,t){let n;if(t instanceof xi)n={update:Nr(e,t.key,t.value)};else if(t instanceof qi)n={delete:Er(e,t.key)};else if(t instanceof Fi)n={update:Nr(e,t.key,t.data),updateMask:Br(t.fieldMask)};else{if(!(t instanceof Bi))return P(16599,{Rt:t.type});
2n={verify:Er(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){const n=t.transform;if(n instanceof yi)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof wi)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof bi)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ii)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw P(20930,{transform:t.transform})}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:wr(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:P(27497)}(e,t.precondition)),n}function Or(e,t){return{documents:[Cr(e,t.path)]}}function Dr(e,t){const n={structuredQuery:{}},i=t.path;let r;null!==t.collectionGroup?(r=i,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r=i.popLast(),n.structuredQuery.from=[{collectionId:i.lastSegment()}]),n.parent=Cr(e,r);const s=function(e){if(0!==e.length)return qr(pn.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const o=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:Vr(e.field),direction:xr(e.dir)}}(e)))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=mr(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),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)),{Vt:n,parent:r}}function Lr(e){let t=Ar(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){D(1===i,65062);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let s=[];n.where&&(s=function(e){const t=Mr(e);return t instanceof pn&&mn(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map((e=>function(e){return new ln(jr(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,De(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new an(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new an(n,t)}(n.endAt)),Mn(t,r,o,s,a,"F",c,u)}function Mr(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=jr(e.unaryFilter.field);return fn.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=jr(e.unaryFilter.field);return fn.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=jr(e.unaryFilter.field);return fn.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=jr(e.unaryFilter.field);return fn.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return P(61313);default:return P(60726)}}(e):void 0!==e.fieldFilter?function(e){return fn.create(jr(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 P(58110);default:return P(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return pn.create(e.compositeFilter.filters.map((e=>Mr(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return P(1026)}}(e.compositeFilter.op))}(e):P(30097,{filter:e})}function xr(e){return dr[e]}function Fr(e){return fr[e]}function Ur(e){return pr[e]}function Vr(e){return{fieldPath:e.canonicalString()}}function jr(e){return re.fromServerFormat(e.fieldPath)}function qr(e){return e instanceof fn?function(e){if("=="===e.op){if(Yt(e.value))return{unaryFilter:{field:Vr(e.field),op:"IS_NAN"}};if(Xt(e.value))return{unaryFilter:{field:Vr(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Yt(e.value))return{unaryFilter:{field:Vr(e.field),op:"IS_NOT_NA
2N"}};if(Xt(e.value))return{unaryFilter:{field:Vr(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Vr(e.field),op:Fr(e.op),value:e.value}}}(e):e instanceof pn?function(e){const t=e.getFilters().map((e=>qr(e)));return 1===t.length?t[0]:{compositeFilter:{op:Ur(e.op),filters:t}}}(e):P(54877,{filter:e})}function Br(e){const t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function zr(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class $r{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ye.min(),s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ye.min(),o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:wt.EMPTY_BYTE_STRING,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new $r(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new $r(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new $r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new $r(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Kr{constructor(e){this.gt=e}}function Hr(e){const t=Lr({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?zn(t,t.limit,"L"):t}class Wr{constructor(){}bt(e,t){this.Dt(e,t),t.vt()}Dt(e,t){if("nullValue"in e)this.Ct(t,5);else if("booleanValue"in e)this.Ct(t,10),t.Ft(e.booleanValue?1:0);else if("integerValue"in e)this.Ct(t,15),t.Ft(Tt(e.integerValue));else if("doubleValue"in e){const n=Tt(e.doubleValue);isNaN(n)?this.Ct(t,13):(this.Ct(t,15),Le(n)?t.Ft(0):t.Ft(n))}else if("timestampValue"in e){let n=e.timestampValue;this.Ct(t,20),"string"==typeof n&&(n=bt(n)),t.Mt(`${n.seconds||""}`),t.Ft(n.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,t),this.Ot(t);else if("bytesValue"in e)this.Ct(t,30),t.Nt(It(e.bytesValue)),this.Ot(t);else if("referenceValue"in e)this.Bt(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.Ct(t,45),t.Ft(n.latitude||0),t.Ft(n.longitude||0)}else"mapValue"in e?nn(e)?this.Ct(t,Number.MAX_SAFE_INTEGER):en(e)?this.Lt(e.mapValue,t):(this.kt(e.mapValue,t),this.Ot(t)):"arrayValue"in e?(this.qt(e.arrayValue,t),this.Ot(t)):P(19022,{Qt:e})}xt(e,t){this.Ct(t,25),this.$t(e,t)}$t(e,t){t.Mt(e)}kt(e,t){const n=e.fields||{};this.Ct(t,55);for(const i of Object.keys(n))this.xt(i,t),this.Dt(n[i],t)}Lt(e,t){var n,i;const r=e.fields||{};this.Ct(t,53);const s=Ut,o=(null===(i=null===(n=r[s].arrayValue)||void 0===n?void 0:n.values)||void 0===i?void 0:i.length)||0;this.Ct(t,15),t.Ft(Tt(o)),this.xt(s,t),this.Dt(r[s],t)}qt(e,t){const n=e.values||[];this.Ct(t,50);for(const i of n)this.Dt(i,t)}Bt(e,t){this.Ct(t,37),se.fromName(e).path.forEach((e=>{this.Ct(t,60),this.$t(e,t)}))}Ct(e,t){e.Ft(t)}Ot(e){e.Ft(2)}}Wr.Ut=new Wr;class Gr{constructor(){this.Dn=new Qr}addToCollectionParentIndex(e,t){return this.Dn.add(t),ke.resolve()}getCollectionParents(e,t){return ke.resolve(this.Dn.getEntries(t))}addFieldIndex(e,t){return ke.resolve()}deleteFieldIndex(e,t){return ke.resolve()}deleteAllFieldIndexes(e){return ke.resolve()}createTargetIndexes(e,t){return ke.resolve()}getDocumentsMatchingTarget(e,t){return ke.resolve(null)}getIndexType(e,t){return ke.resolve(0)}getFieldIndexes(e,t){return ke.resolve([])}getNextCollectionGroupToUpdate(e){return ke.resolve(null)}getMinOffset(e,t){return ke.resolve(Ie.min())}getMinOffsetFromCollectionGroup(e,t){return ke.resolve(Ie.min())}updateCollectionGroup(e,t,n){return ke.resolve()}updateIndexEntries(e,t){return ke.resolve()}}class Qr{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new gt(ne.comparator),r=!i.has(n);return this.index[t]=i.add(n),r}has(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new gt(ne.comparator)).toArray()}}new Uint8Array(0);const Jr={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Xr=41943040;class Yr{static withCacheSize(e){return new Yr(e,Yr.DEFAULT_COLLECTION_PE
vendor: 4,844 bytes, line 2
2RCENTILE,Yr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}Yr.DEFAULT_COLLECTION_PERCENTILE=10,Yr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Yr.DEFAULT=new Yr(Xr,Yr.DEFAULT_COLLECTION_PERCENTILE,Yr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Yr.DISABLED=new Yr(-1,0,0);class Zr{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new Zr(0)}static ur(){return new Zr(-1)}}const es="LruGarbageCollector",ts=1048576;function ns(e,t){let[n,i]=e,[r,s]=t;const o=Q(n,r);return 0===o?Q(i,s):o}class is{constructor(e){this.Tr=e,this.buffer=new gt(ns),this.Ir=0}dr(){return++this.Ir}Er(e){const t=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();ns(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class rs{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Ar=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return null!==this.Ar}Rr(e){A(es,`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){Ne(e)?A(es,"Ignoring IndexedDB error during garbage collection: ",e):await Ae(e)}await this.Rr(3e5)}))}}class ss{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.mr(e).next((e=>Math.floor(t/100*e)))}nthSequenceNumber(e,t){if(0===t)return ke.resolve(Pe.ue);const n=new is(t);return this.Vr.forEachTarget(e,(e=>n.Er(e.sequenceNumber))).next((()=>this.Vr.gr(e,(e=>n.Er(e))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.Vr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(A("LruGarbageCollector","Garbage collection skipped; disabled"),ke.resolve(Jr)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(A("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Jr):this.pr(e,t)))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,t){let n,i,r,s,o,c,u;const l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((t=>(t>this.params.maximumSequenceNumbersToCollect?(A("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),i=this.params.maximumSequenceNumbersToCollect):i=t,s=Date.now(),this.nthSequenceNumber(e,i)))).next((i=>(n=i,o=Date.now(),this.removeTargets(e,n,t)))).next((t=>(r=t,c=Date.now(),this.removeOrphanedDocuments(e,n)))).next((e=>(u=Date.now(),C()<=a.$b.DEBUG&&A("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${s-l}ms\n\tDetermined least recently used ${i} in `+(o-s)+"ms\n"+`\tRemoved ${r} targets in `+(c-o)+"ms\n"+`\tRemoved ${e} documents in `+(u-c)+"ms\n"+`Total Duration: ${u-l}ms`),ke.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:r,documentsRemoved:e}))))}}function os(e,t){return new ss(e,t)}class as{constructor(){this.changes=new Xn((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,on.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?ke.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 cs{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class us{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((i=>(n=i,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(null!==n&&Di(n.mutation,e,vt.empty(),ve.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,ci()).next((()=>t))))}getLocalViewOfDocuments(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ci();const i=ii();return this.populateOverlays(e,i,t).next((()=>this.computeViews(e,t,i,n).next((e=>{let t=ti();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=ii();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,ci())))}populateOverlays(e,t,n){const i=[];
vendor: 6,521 bytes, line 2
2return n.forEach((e=>{t.has(e)||i.push(e)})),this.documentOverlayCache.getOverlays(e,i).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,i){let r=Zn();const s=si(),o=si();return t.forEach(((e,t)=>{const o=n.get(t.key);i.has(t.key)&&(void 0===o||o.mutation instanceof Fi)?r=r.insert(t.key,t):void 0!==o?(s.set(t.key,o.mutation.getFieldMask()),Di(o.mutation,t,o.mutation.getFieldMask(),ve.now())):s.set(t.key,vt.empty())})),this.recalculateAndSaveOverlays(e,r).next((e=>(e.forEach(((e,t)=>s.set(e,t))),t.forEach(((e,t)=>{var n;return o.set(e,new cs(t,null!==(n=s.get(e))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(e,t){const n=si();let i=new dt(((e,t)=>e-t)),r=ci();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const r of e)r.keys().forEach((e=>{const s=t.get(e);if(null===s)return;let o=n.get(e)||vt.empty();o=r.applyToLocalView(s,o),n.set(e,o);const a=(i.get(r.batchId)||ci()).add(e);i=i.insert(r.batchId,a)}))})).next((()=>{const s=[],o=i.getReverseIterator();for(;o.hasNext();){const i=o.getNext(),a=i.key,c=i.value,u=ri();c.forEach((e=>{if(!r.has(e)){const i=Pi(t.get(e),n.get(e));null!==i&&u.set(e,i),r=r.add(e)}})),s.push(this.documentOverlayCache.saveOverlays(e,a,u))}return ke.waitFor(s)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,i){return function(e){return se.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Un(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next((r=>{const s=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-r.size):ke.resolve(ii());let o=we,a=r;return s.next((t=>ke.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(t)?ke.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,r))).next((()=>this.computeViews(e,a,t,ci()))).next((e=>({batchId:o,changes:ni(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new se(t)).next((e=>{let t=ti();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){const r=t.collectionGroup;let s=ti();return this.indexManager.getCollectionParents(e,r).next((o=>ke.forEach(o,(o=>{const a=function(e,t){return new Ln(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(r));return this.getDocumentsMatchingCollectionQuery(e,a,n,i).next((e=>{e.forEach(((e,t)=>{s=s.insert(e,t)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(e,t,n,i){let r;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((s=>(r=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,i)))).next((e=>{r.forEach(((t,n)=>{const i=n.getKey();null===e.get(i)&&(e=e.insert(i,on.newInvalidDocument(i)))}));let n=ti();return e.forEach(((e,i)=>{const s=r.get(e);void 0!==s&&Di(s.mutation,i,vt.empty(),ve.now()),Wn(t,i)&&(n=n.insert(e,i))})),n}))}}class ls{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,t){return ke.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,function(e){return{id:e.id,version:e.version,createTime:_r(e.createTime)}}(t)),ke.resolve()}getNamedQuery(e,t){return ke.resolve(this.Lr.get(t))}saveNamedQuery(e,t){return this.Lr.set(t.name,function(e){return{name:e.name,query:Hr(e.bundledQuery),readTime:_r(e.readTime)}}(t)),ke.resolve()}}class hs{constructor(){this.overlays=new dt(se.comparator),this.kr=new Map}getOverlay(e,t){return ke.resolve(this.overlays.get(t))}getOverlays(e,t){const n=ii();return ke.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,i)=>{this.wt(e,t,i)})),ke.resolve()}removeOverlaysForBatchId(e,t,n){const i=this.kr.get(n);return void 0!==i&&(i.forEach((e=>this.overlays=this.overlays.remove(e))),this.kr.delete(n)),ke.resolve()}getOverlaysForCollection(e,t,n){const i=ii(),r=t.length+1,s=new se(t.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const e=o.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===r&&e.largestBatchId>n&&i.set(e.getKey(),e)}return ke.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let r=new dt(((e,t)=>e-t));const s=this.overlays.getIterator();for(;s.hasNext();){const e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=ii(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=ii(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=i)););return ke.resolve(o)}wt(e,t,n){const i=this.overlays.get(n.key);if(null!==i){const e=this.kr.get(i.largestBatchId).delete(n.key);this.kr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Ki(t,n));let r=this.kr.get(t);void 0===r&&(r=ci(),this.kr.set(t,r)),this.kr.set(t,r.add(n.key))}}class ds{constructor(){this.sessionToken=wt.EMPTY_BYTE_STRING}getSessionToken(e){return ke.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,ke.resolve()}}class fs{constructor(){this.qr=new gt(ps.Qr),this.$r=new gt(ps.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,t){const n=new ps(e,t);this.qr=this.qr.add(n),this.$r=this.$r.add(n)}Kr(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.Wr(new ps(e,t))}Gr(e,t){e.forEach((e=>this.removeReference(e,t)))}zr(e){const t=new se(new ne([])),n=new ps(t,e),i=new ps(t,e+1),r=[];return this.$r.forEachInRange([n,i],(e=>{this.Wr(e),r.push(e.key)})),r}jr(){this.qr.forEach((e=>this.Wr(e)))}Wr(e){this.qr=this.qr.delete(e),this.$r=this.$r.delete(e)}Jr(e){const t=new se(new ne([])),n=new ps(t,e),i=new ps(t,e+1);let r=ci();return this.$r.forEachInRange([n,i],(e=>{r=r.add(e.key)})),r}containsKey(e){const t=new ps(e,0),n=this.qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class ps{constructor(e,t){this.key=e,this.Hr=t}static Qr(e,t){return se.comparator(e.key,t.key)||Q(e.Hr,t.Hr)}static Ur(e,t){return Q(e.Hr,t.Hr)||se.comparator(e.key,t.key)}}class gs{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutation
vendor: 11,742 bytes, line 2
2Queue=[],this.er=1,this.Yr=new gt(ps.Qr)}checkEmpty(e){return ke.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){const r=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new zi(r,t,n,i);this.mutationQueue.push(s);for(const o of i)this.Yr=this.Yr.add(new ps(o.key,r)),this.indexManager.addToCollectionParentIndex(e,o.key.path.popLast());return ke.resolve(s)}lookupMutationBatch(e,t){return ke.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,i=this.Xr(n),r=i<0?0:i;return ke.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return ke.resolve(0===this.mutationQueue.length?Oe:this.er-1)}getAllMutationBatches(e){return ke.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new ps(t,0),i=new ps(t,Number.POSITIVE_INFINITY),r=[];return this.Yr.forEachInRange([n,i],(e=>{const t=this.Zr(e.Hr);r.push(t)})),ke.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new gt(Q);return t.forEach((e=>{const t=new ps(e,0),i=new ps(e,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([t,i],(e=>{n=n.add(e.Hr)}))})),ke.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,i=n.length+1;let r=n;se.isDocumentKey(r)||(r=r.child(""));const s=new ps(new se(r),0);let o=new gt(Q);return this.Yr.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(o=o.add(e.Hr)),!0)}),s),ke.resolve(this.ei(o))}ei(e){const t=[];return e.forEach((e=>{const n=this.Zr(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){D(0===this.ti(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.Yr;return ke.forEach(t.mutations,(i=>{const r=new ps(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)})).next((()=>{this.Yr=n}))}rr(e){}containsKey(e,t){const n=new ps(t,0),i=this.Yr.firstAfterOrEqual(n);return ke.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,ke.resolve()}ti(e,t){return this.Xr(e)}Xr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Zr(e){const t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class ms{constructor(e){this.ni=e,this.docs=new dt(se.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,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 ke.resolve(n?n.document.mutableCopy():on.newInvalidDocument(t))}getEntries(e,t){let n=Zn();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():on.newInvalidDocument(e))})),ke.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=Zn();const s=t.path,o=new se(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||Ee(Te(o),n)<=0||(i.has(o.key)||Wn(t,o))&&(r=r.insert(o.key,o.mutableCopy()))}return ke.resolve(r)}getAllFromCollectionGroup(e,t,n,i){P(9500)}ri(e,t){return ke.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new vs(this)}getSize(e){return ke.resolve(this.size)}}class vs extends as{constructor(e){super(),this.Or=e}applyChanges(e){const t=[];return this.changes.forEach(((n,i)=>{i.isValidDocument()?t.push(this.Or.addEntry(e,i)):this.Or.removeEntry(n)})),ke.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}class ys{constructor(e){this.persistence=e,this.ii=new Xn((e=>Pn(e)),On),this.lastRemoteSnapshotVersion=ye.min(),this.highestTargetId=0,this.si=0,this.oi=new fs,this.targetCount=0,this._i=Zr.ar()}forEachTarget(e,t){return this.ii.forEach(((e,n)=>t(n))),ke.resolve()}getLastRemoteSnapshotVersion(e){return ke.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return ke.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),ke.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.si&&(this.si=t),ke.resolve()}hr(e){this.ii.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this._i=new Zr(t),this.highestTargetId=t),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,t){return this.hr(t),this.targetCount+=1,ke.resolve()}updateTargetData(e,t){return this.hr(t),ke.resolve()}removeTargetData(e,t){return this.ii.delete(t.target),this.oi.zr(t.targetId),this.targetCount-=1,ke.resolve()}removeTargets(e,t,n){let i=0;const r=[];return this.ii.forEach(((s,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.ii.delete(s),r.push(this.removeMatchingKeysForTargetId(e,o.targetId)),i++)})),ke.waitFor(r).next((()=>i))}getTargetCount(e){return ke.resolve(this.targetCount)}getTargetData(e,t){const n=this.ii.get(t)||null;return ke.resolve(n)}addMatchingKeys(e,t,n){return this.oi.Kr(t,n),ke.resolve()}removeMatchingKeys(e,t,n){this.oi.Gr(t,n);const i=this.persistence.referenceDelegate,r=[];return i&&t.forEach((t=>{r.push(i.markPotentiallyOrphaned(e,t))})),ke.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.oi.zr(t),ke.resolve()}getMatchingKeysForTargetId(e,t){const n=this.oi.Jr(t);return ke.resolve(n)}containsKey(e,t){return ke.resolve(this.oi.containsKey(t))}}class ws{constructor(e,t){this.ai={},this.overlays={},this.ui=new Pe(0),this.ci=!1,this.ci=!0,this.li=new ds,this.referenceDelegate=e(this),this.hi=new ys(this),this.indexManager=new Gr,this.remoteDocumentCache=function(e){return new ms(e)}((e=>this.referenceDelegate.Pi(e))),this.serializer=new Kr(t),this.Ti=new ls(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new hs,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new gs(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){A("MemoryPersistence","Starting transaction:",e);const i=new _s(this.ui.next());return this.referenceDelegate.Ii(),n(i).next((e=>this.referenceDelegate.di(i).next((()=>e)))).toPromise().then((e=>(i.raiseOnCommittedEvent(),e)))}Ei(e,t){return ke.or(Object.values(this.ai).map((n=>()=>n.containsKey(e,t))))}}class _s extends Ce{constructor(e){super(),this.currentSequenceNumber=e}}class bs{constructor(e){this.persistence=e,this.Ai=new fs,this.Ri=null}static Vi(e){return new bs(e)}get mi(){if(this.Ri)return this.Ri;throw P(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),ke.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),ke.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),ke.resolve()}removeTarget(e,t){this.Ai.zr(t.targetId).forEach((e=>this.mi.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.mi.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Ii(){this.Ri=new Set}di(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ke.forEach(this.mi,(n=>{const i=se.fromPath(n);return this.fi(e,i).next((e=>{e||t.removeEntry(i,ye.min())}))})).next((()=>(this.Ri=null,t.apply(e))))}updateLimboDocument(e,t){return this.fi(e,t).next((e=>{e?this.mi.delete(t.toString()):this.mi.add(t.toString())}))}Pi(e){return 0}fi(e,t){return ke.or([()=>ke.resolve(this.Ai.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}}class Ts{constructor(e,t){this.persistence=e,this.gi=new Xn((e=>Fe(e.path)),((e,t)=>e.isEqual(t))),this.garbageCollector=os(this,t)}static Vi(e,t){return new Ts(e,t)}Ii(){}di(e){return ke.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}mr(e){const t=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next((e=>t.next((t=>e+t))))}yr(e){let t=0;return this.gr(e,(e=>{t++})).next((()=>t))}gr(e,t){return ke.forEach(this.gi,((n,i)=>this.Sr(e,n,i).next((e=>e?ke.resolve():t(i)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const i=this.persistence.getRemoteDocumentCache(),r=i.newChangeBuffer();return i.ri(e,(i=>this.Sr(e,i,t).next((e=>{e||(n++,r.removeEntry(i,ye.min()))})))).next((()=>r.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),ke.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),ke.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),ke.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),ke.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Wt(e.data.value)),t}Sr(e,t,n){return ke.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.gi.get(t);return ke.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class Is{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Is=n,this.ds=i}static Es(e,t){let n=ci(),i=ci();for(const r of t.docChanges)switch(r.type){case 0:n=n.add(r.doc.key);break;case 1:i=i.add(r.doc.key)}return new Is(e,t.fromCache,n,i)}}class Es{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class Ss{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(0,c.nr)()?8:Re((0,c.ZQ)())>0?6:4}initialize(e,t){this.gs=e,this.indexManager=t,this.As=!0}getDocumentsMatchingQuery(e,t,n,i){const r={result:null};return this.ps(e,t).next((e=>{r.result=e})).next((()=>{if(!r.result)return this.ys(e,t,i,n).next((e=>{r.result=e}))})).next((()=>{if(r.result)return;const n=new Es;return this.ws(e,t,n).next((i=>{if(r.result=i,this.Rs)return this.Ss(e,t,n,i.size)}))})).next((()=>r.result))}Ss(e,t,n,i){return n.documentReadCount<this.Vs?(C()<=a.$b.DEBUG&&A("QueryEngine","SDK will not create cache indexes for query:",Hn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),ke.resolve()):(C()<=a.$b.DEBUG&&A("QueryEngine","Query:",Hn(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.fs*i?(C()<=a.$b.DEBUG&&A("QueryEngine","The SDK decides to create cache indexes for query:",Hn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,jn(t))):ke.resolve())}ps(e,t){if(Fn(t))return ke.resolve(null);let n=jn(t);return this.indexManager.getIndexType(e,n).next((i=>0===i?null:(null!==t.limit&&1===i&&(t=zn(t,null,"F"),n=jn(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((i=>{const r=ci(...i);return this.gs.getDocuments(e,r).next((i=>this.indexManager.getMinOffset(e,n).next((n=>{const s=this.bs(t,i);return this.Ds(t,s,r,n.readTime)?this.ps(e,zn(t,null,"F")):this.vs(e,s,t,n)}))))}
2)))))}ys(e,t,n,i){return Fn(t)||i.isEqual(ye.min())?ke.resolve(null):this.gs.getDocuments(e,n).next((r=>{const s=this.bs(t,r);return this.Ds(t,s,n,i)?ke.resolve(null):(C()<=a.$b.DEBUG&&A("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Hn(t)),this.vs(e,s,t,be(i,we)).next((e=>e)))}))}bs(e,t){let n=new gt(Qn(e));return t.forEach(((t,i)=>{Wn(e,i)&&(n=n.add(i))})),n}Ds(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(i)>0)}ws(e,t,n){return C()<=a.$b.DEBUG&&A("QueryEngine","Using full collection scan to execute query:",Hn(t)),this.gs.getDocumentsMatchingQuery(e,t,Ie.min(),n)}vs(e,t,n,i){return this.gs.getDocumentsMatchingQuery(e,n,i).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}const Cs="LocalStore";class As{constructor(e,t,n,i){this.persistence=e,this.Cs=t,this.serializer=i,this.Fs=new dt(Q),this.Ms=new Xn((e=>Pn(e)),On),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new us(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.Fs)))}}function ks(e,t,n,i){return new As(e,t,n,i)}async function Rs(e,t){const n=L(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let i;
2return n.mutationQueue.getAllMutationBatches(e).next((r=>(i=r,n.Ns(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const r=[],s=[];let o=ci();for(const e of i){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({Bs:e,removedBatchIds:r,addedBatchIds:s})))}))}))}function Ns(e){const t=L(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.hi.getLastRemoteSnapshotVersion(e)))}function Ps(e,t,n){let i=ci(),r=ci();return n.forEach((e=>i=i.add(e))),t.getEntries(e,i).next((e=>{let i=Zn();return n.forEach(((n,s)=>{const o=e.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),s.isNoDocument()&&s.version.isEqual(ye.min())?(t.removeEntry(n,s.readTime),i=i.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(s),i=i.insert(n,s)):A(Cs,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)})),{Ls:i,ks:r}}))}function Os(e,t){const n=L(e);return n.persistence.runTransaction("Get next mutation batch","readonly",(e=>(void 0===t&&(t=Oe),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function Ds(e,t){const n=L(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let i;return n.hi.getTargetData(e,t).next((r=>r?(i=r,ke.resolve(i)):n.hi.allocateTargetId(e).next((r=>(i=new $r(t,r,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,i).next((()=>i)))))))})).then((e=>{const i=n.Fs.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e}))}async function Ls(e,t,n){const i=L(e),r=i.Fs.get(t),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,(e=>i.persistence.referenceDelegate.removeTarget(e,r)))}catch(e){if(!Ne(e))throw e;A(Cs,`Failed to update sequence numbers for target ${t}: ${e}`)}i.Fs=i.Fs.remove(t),i.Ms.delete(r.target)}function Ms(e,t,n){const i=L(e);let r=ye.min(),s=ci();return i.persistence.runTransaction("Execute query","readwrite",(e=>function(e,t,n){const i=L(e),r=i.Ms.get(n);return void 0!==r?ke.resolve(i.Fs.get(r)):i.hi.getTargetData(t,n)}(i,e,jn(t)).next((t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,i.hi.getMatchingKeysForTargetId(e,t.targetId).next((e=>{s=e}))})).next((()=>i.Cs.getDocumentsMatchingQuery(e,t,n?r:ye.min(),n?s:ci()))).next((e=>(xs(i,Gn(t),e),{documents:e,qs:s})))))}function xs(e,t,n){let i=e.xs.get(t)||ye.min();n.forEach(((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)})),e.xs.set(t,i)}class Fs{constructor(){this.activeTargetIds=li()}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Us{constructor(){this.Fo=new Fs,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new Fs,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class Vs{xo(e){}shutdown(){}}const js="ConnectivityMonitor";class qs{constructor(){this.Oo=()=>this.No(),this.Bo=()=>this.Lo(),this.ko=[],this.qo()}xo(e){this.ko.push(e)}shutdown(){window.removeEventListener("online",this.Oo),window.removeEventListener("offline",this.Bo)}qo(){window.addEventListener("online",this.Oo),window.addEventListener("offline",this.Bo)}No(){A(js,"Network connectivity changed: AVAILABLE");for(const e of this.ko)e(0)}Lo(){A(js,"Network connectivity changed: UNAVAILABLE");for(const e of this.ko)e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let Bs=null;function zs(){return null===Bs?Bs=268435456+Math.round(2147483648*Math.random()):Bs++,"0x"+Bs.toString(16)}const $s="RestConnection",Ks={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
2Query:"runAggregationQuery"};class Hs{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=t+"://"+e.host,this.Uo=`projects/${n}/databases/${i}`,this.Ko=this.databaseId.database===Ot?`project_id=${n}`:`project_id=${n}&database_id=${i}`}Wo(e,t,n,i,r){const s=zs(),o=this.Go(e,t.toUriEncodedString());A($s,`Sending RPC '${e}' ${s}:`,o,n);const a={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(a,i,r);const{host:u}=new URL(o),l=(0,c.zJ)(u);return this.jo(e,o,a,n,l).then((t=>(A($s,`Received RPC '${e}' ${s}: `,t),t)),(t=>{throw R($s,`RPC '${e}' ${s} failed with error: `,t,"url: ",o,"request:",n),t}))}Jo(e,t,n,i,r,s){return this.Wo(e,t,n,i,r)}zo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+E,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))}Go(e,t){const n=Ks[e];return`${this.$o}/v1/${t}:${n}`}terminate(){}}class Ws{constructor(e){this.Ho=e.Ho,this.Yo=e.Yo}Zo(e){this.Xo=e}e_(e){this.t_=e}n_(e){this.r_=e}onMessage(e){this.i_=e}close(){this.Yo()}send(e){this.Ho(e)}s_(){this.Xo()}o_(){this.t_()}__(e){this.r_(e)}a_(e){this.i_(e)}}const Gs="WebChannelConnection";class Qs extends Hs{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,t,n,i,r){const s=zs();return new Promise(((r,o)=>{const a=new h;a.setWithCredentials(!0),a.listenOnce(f.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case p.NO_ERROR:const t=a.getResponseJson();A(Gs,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(t)),r(t);break;case p.TIMEOUT:A(Gs,`RPC '${e}' ${s} timed out`),o(new x(M.DEADLINE_EXCEEDED,"Request time out"));break;case p.HTTP_ERROR:const n=a.getStatus();if(A(Gs,`RPC '${e}' ${s} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(M).indexOf(t)>=0?t:M.UNKNOWN}(t.status);o(new x(e,t.message))}else o(new x(M.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new x(M.UNAVAILABLE,"Connection failed."));break;default:P(9055,{c_:e,streamId:s,l_:a.getLastErrorCode(),h_:a.getLastError()})}}finally{A(Gs,`RPC '${e}' ${s} completed.`)}}));const c=JSON.stringify(i);A(Gs,`RPC '${e}' ${s} sending request:`,i),a.send(t,"POST",c,n,15)}))}P_(e,t,n){const i=zs(),r=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=y(),o=v(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.useFetchStreams=!0),this.zo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const u=r.join("");A(Gs,`Creating RPC '${e}' stream ${i}: ${u}`,a);const l=s.createWebChannel(u,a);this.T_(l);let h=!1,f=!1;const p=new Ws({Ho:t=>{f?A(Gs,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(h||(A(Gs,`Opening RPC '${e}' stream ${i} transport.`),l.open(),h=!0),A(Gs,`RPC '${e}' stream ${i} sending:`,t),l.send(t))},Yo:()=>l.close()}),w=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return w(l,d.EventType.OPEN,(()=>{f||(A(Gs,`RPC '${e}' stream ${i} transport opened.`),p.s_())})),w(l,d.EventType.CLOSE,(()=>{f||(f=!0,A(Gs,`RPC '${e}' stream ${i} transport closed`),p.__(),this.I_(l))})),w(l,d.EventType.ERROR,(t=>{f||(f=!0,R(Gs,`RPC '${e}' stream ${i} transport errored. Name:`,t.name,"Message:",t.message),p.__(new x(M.UNAVAILABLE,"The operation could not be completed")))})),w(l,d.EventType.MESSAGE,(t=>{var n;if(!f){const r=t.data[0];D(!!r,16349);const s=r,o=(null==s?void 0:s.error)||(null===(n=s[0])||void 0===n?void 0:n.error);if(o){A(Gs,`RPC '${e}' stream ${i} received error:`,o);const t=o.status;let n=function(e){const t=Wi[e];if(void 0!==t)return Ji(t)}(t),r=o.message;void 0===n&&(n=M.INTERNAL,r="Unknown error status: "+t+" with message "+o.message),f=!0,p.__(new x(n,r)),l.close()}else A(Gs,`RPC '${e}' stream ${i} received:`,r),p.a_(r)}})),w(o,m.STAT_EVENT,(t=>{t.stat===g.PROXY?A(Gs,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===g.NOPROXY&&A(Gs,`RPC '${e}' stream ${i} detected no buffering proxy`)})),setTimeout((()=>{p.o_()}),0),p}terminate(){this.u_.forEach((e=>e.close())),this.u_=[]}T_(e){this.u_.push(e)}I_(e){this.u_=this.u_.filter((t=>t===e))}}function Js(){return"undefined"!=typeof document?document:null}function Xs(e){return new gr(e,!0)}class Ys{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;this.Fi=e,this.timerId=t,this.d_=n,this.E_=i,this.A_=r,this.R_=0,this.V_=null,this.m_=Date.now(),this.reset()}reset(){this.R_=0}f_(){this.R_=this.A_}g_(e){this.cancel();
vendor: 9,171 bytes, line 2
2const t=Math.floor(this.R_+this.p_()),n=Math.max(0,Date.now()-this.m_),i=Math.max(0,t-n);i>0&&A("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.R_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.V_=this.Fi.enqueueAfterDelay(this.timerId,i,(()=>(this.m_=Date.now(),e()))),this.R_*=this.E_,this.R_<this.d_&&(this.R_=this.d_),this.R_>this.A_&&(this.R_=this.A_)}y_(){null!==this.V_&&(this.V_.skipDelay(),this.V_=null)}cancel(){null!==this.V_&&(this.V_.cancel(),this.V_=null)}p_(){return(Math.random()-.5)*this.R_}}const Zs="PersistentStream";class eo{constructor(e,t,n,i,r,s,o,a){this.Fi=e,this.w_=n,this.S_=i,this.connection=r,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Ys(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,(()=>this.L_())))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===M.RESOURCE_EXHAUSTED?(k(t.toString()),k("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===M.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;const e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((e=>{let[n,i]=e;this.b_===t&&this.W_(n,i)}),(t=>{e((()=>{const e=new x(M.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)}))}))}W_(e,t){const n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo((()=>{n((()=>this.listener.Zo()))})),this.stream.e_((()=>{n((()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,(()=>(this.x_()&&(this.state=3),Promise.resolve()))),this.listener.e_())))})),this.stream.n_((e=>{n((()=>this.G_(e)))})),this.stream.onMessage((e=>{n((()=>1==++this.C_?this.j_(e):this.onNext(e)))}))}O_(){this.state=5,this.F_.g_((async()=>{this.state=0,this.start()}))}G_(e){return A(Zs,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget((()=>this.b_===e?t():(A(Zs,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class to extends eo{constructor(e,t,n,i,r,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const i=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:P(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],s=function(e,t){return e.useProto3Json?(D(void 0===t||"string"==typeof t,58123),wt.fromBase64String(t||"")):(D(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),wt.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?M.UNKNOWN:Ji(e.code);return new x(t,e.message||"")}(o);n=new ar(i,r,s,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=Sr(e,i.document.name),s=_r(i.document.updateTime),o=i.document.createTime?_r(i.document.createTime):ye.min(),a=new rn({mapValue:{fields:i.document.fields}}),c=on.newFoundDocument(r,s,o,a),u=i.targetIds||[],l=i.removedTargetIds||[];n=new sr(u,l,c.key,c)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=Sr(e,i.document),s=i.readTime?_r(i.readTime):ye.min(),o=on.newNoDocument(r,s),a=i.removedTargetIds||[];n=new sr([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=Sr(e,i.document),s=i.removedTargetIds||[];n=new sr([],s,r,null)}else{if(!("filter"in t))return P(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:i=0,unchangedNames:r}=e,s=new Hi(i,r),o=e.targetId;n=new or(o,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return ye.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?ye.min():t.readTime?_r(t.readTime):ye.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=kr(this.serializer),t.addTarget=function(e,t){let n;const i=t.target;if(n=Dn(i)?{documents:Or(e,i)}:{query:Dr(e,i).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=yr(e,t.resumeToken);const i=mr(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(ye.min())>0){n.readTime=vr(e,t.snapshotVersion.toTimestamp());const i=mr(e,t.expectedCount);null!==i&&(n.expectedCount=i)}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 P(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){const t={};t.database=kr(this.serializer),t.removeTarget=e,this.k_(t)}}class no extends eo{constructor(e,t,n,i,r,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return D(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,D(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){D(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(D(void 0!==t,14353),e.map((e=>function(e,t){let n=e.updateTime?_r(e.updateTime):_r(t);return n.isEqual(ye.min())&&(n=_r(t)),new Ai(n,e.transformResults||[])}(e,t)))):[]}(e.writeResults,e.commitTime),n=_r(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=kr(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map((e=>Pr(this.serializer,e)))};this.k_(t)}}class io{}class ro extends io{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new x(M.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((r=>{let[s,o]=r;return this.connection.Wo(e,Tr(t,n),i,s,o)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new x(M.UNKNOWN,e.toString())}))}Jo(e,t,n,i,r){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((s=>{let[o,a]=s;return this.connection.Jo(e,Tr(t,n),i,o,a,r)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new x(M.UNKNOWN,e.toString())}))}terminate(){this.ra=!0,this.connection.terminate()}}class so{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){0===this.sa&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve()))))}la(e){"Online"===this.state?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ua("Offline")))}set(e){this.ha(),this.sa=0,"Online"===e&&(this._a=!1),this.ua(e)}ua(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ca(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._a?(k(t),this._a=!1):A("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}const oo="RemoteStore";class ao{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=r,this.Ea.xo((e=>{n.enqueueAndForget((async()=>
2{vo(this)&&(A(oo,"Restarting streams for network reachability change."),await async function(e){const t=L(e);t.Ia.add(4),await uo(t),t.Aa.set("Unknown"),t.Ia.delete(4),await co(t)}(this))}))})),this.Aa=new so(n,i)}}async function co(e){if(vo(e))for(const t of e.da)await t(!0)}async function uo(e){for(const t of e.da)await t(!1)}function lo(e,t){const n=L(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),mo(n)?go(n):xo(n).x_()&&fo(n,t))}function ho(e,t){const n=L(e),i=xo(n);n.Ta.delete(t),i.x_()&&po(n,t),0===n.Ta.size&&(i.x_()?i.B_():vo(n)&&n.Aa.set("Unknown"))}function fo(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(ye.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}xo(e).H_(t)}function po(e,t){e.Ra.$e(t),xo(e).Y_(t)}function go(e){e.Ra=new ur({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),xo(e).start(),e.Aa.aa()}function mo(e){return vo(e)&&!xo(e).M_()&&e.Ta.size>0}function vo(e){return 0===L(e).Ia.size}function yo(e){e.Ra=void 0}async function wo(e){e.Aa.set("Online")}async function _o(e){e.Ta.forEach(((t,n)=>{fo(e,t)}))}async function bo(e,t){yo(e),mo(e)?(e.Aa.la(t),go(e)):e.Aa.set("Unknown")}async function To(e,t,n){if(e.Aa.set("Online"),t instanceof ar&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const i of t.targetIds)e.Ta.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.Ta.delete(i),e.Ra.removeTarget(i))}(e,t)}catch(n){A(oo,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Io(e,n)}else if(t instanceof sr?e.Ra.Ye(t):t instanceof or?e.Ra.it(t):e.Ra.et(t),!n.isEqual(ye.min()))try{const t=await Ns(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);
vendor: 8,124 bytes, line 2
2return n.targetChanges.forEach(((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=e.Ta.get(i);r&&e.Ta.set(i,r.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const i=e.Ta.get(t);if(!i)return;e.Ta.set(t,i.withResumeToken(wt.EMPTY_BYTE_STRING,i.snapshotVersion)),po(e,t);const r=new $r(i.target,t,n,i.sequenceNumber);fo(e,r)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){A(oo,"Failed to raise snapshot:",t),await Io(e,t)}}async function Io(e,t,n){if(!Ne(t))throw t;e.Ia.add(1),await uo(e),e.Aa.set("Offline"),n||(n=()=>Ns(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{A(oo,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await co(e)}))}function Eo(e,t){return t().catch((n=>Io(e,n,t)))}async function So(e){const t=L(e),n=Fo(t);let i=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:Oe;for(;Co(t);)try{const e=await Os(t.localStore,i);if(null===e){0===t.Pa.length&&n.B_();break}i=e.batchId,Ao(t,e)}catch(e){await Io(t,e)}ko(t)&&Ro(t)}function Co(e){return vo(e)&&e.Pa.length<10}function Ao(e,t){e.Pa.push(t);const n=Fo(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function ko(e){return vo(e)&&!Fo(e).M_()&&e.Pa.length>0}function Ro(e){Fo(e).start()}async function No(e){Fo(e).na()}async function Po(e){const t=Fo(e);for(const n of e.Pa)t.X_(n.mutations)}async function Oo(e,t,n){const i=e.Pa.shift(),r=$i.from(i,t,n);await Eo(e,(()=>e.remoteSyncer.applySuccessfulWrite(r))),await So(e)}async function Do(e,t){t&&Fo(e).Z_&&await async function(e,t){if(function(e){return Qi(e)&&e!==M.ABORTED}(t.code)){const n=e.Pa.shift();Fo(e).N_(),await Eo(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await So(e)}}(e,t),ko(e)&&Ro(e)}async function Lo(e,t){const n=L(e);n.asyncQueue.verifyOperationInProgress(),A(oo,"RemoteStore received new credentials");const i=vo(n);n.Ia.add(3),await uo(n),i&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await co(n)}async function Mo(e,t){const n=L(e);t?(n.Ia.delete(2),await co(n)):t||(n.Ia.add(2),await uo(n),n.Aa.set("Unknown"))}function xo(e){return e.Va||(e.Va=function(e,t,n){const i=L(e);return i.ia(),new to(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Zo:wo.bind(null,e),e_:_o.bind(null,e),n_:bo.bind(null,e),J_:To.bind(null,e)}),e.da.push((async t=>{t?(e.Va.N_(),mo(e)?go(e):e.Aa.set("Unknown")):(await e.Va.stop(),yo(e))}))),e.Va}function Fo(e){return e.ma||(e.ma=function(e,t,n){const i=L(e);return i.ia(),new no(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),e_:No.bind(null,e),n_:Do.bind(null,e),ea:Po.bind(null,e),ta:Oo.bind(null,e)}),e.da.push((async t=>{t?(e.ma.N_(),await So(e)):(await e.ma.stop(),e.Pa.length>0&&(A(oo,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))}))),e.ma}class Uo{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new F,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,r){const s=Date.now()+n,o=new Uo(e,t,s,i,r);return o.start(n),o}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new x(M.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 Vo(e,t){if(k("AsyncQueue",`${t}: ${e}`),Ne(e))return new x(M.UNAVAILABLE,`${t}: ${e}`);throw e}class jo{static emptySet(e){return new jo(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||se.comparator(t.key,n.key):(e,t)=>se.comparator(e.key,t.key),this.keyedMap=ti(),this.sortedSet=new dt(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 jo))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,i=n.getNext().key;if(!e.isEqual(i))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 jo;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class qo{constructor(){this.fa=new dt(se.comparator)}track(e){const t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):P(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){const e=[];return this.fa.inorderTraversal(((t,n)=>{e.push(n)})),e}}class Bo{constructor(e,t,n,i,r,s,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,i,r){const s=[];return t.forEach((e=>{s.push({type:0,doc:e})})),new Bo(e,t,jo.emptySet(t),s,n,i,!0,!1,r)}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)&&$n(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 i=0;i<t.length;i++)if(t[i].type!==n[i].type||!t[i].doc.isEqual(n[i].doc))return!1;return!0}}class zo{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some((e=>e.ba()))}}class $o{constructor(){this.queries=Ko(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=L(e),i=n.queries;n.queries=Ko(),i.forEach(((e,n)=>{for(const i of n.wa)i.onError(t)}))}(this,new x(M.ABORTED,"Firestore shutting down"))}}function Ko(){return new Xn((e=>Kn(e)),$n)}async function Ho(e,t){const n=L(e);let i=3;const r=t.query;let s=n.queries.get(r);s?!s.Sa()&&t.ba()&&(i=2):(s=new zo,i=t.ba()?0:1);try{switch(i){case 0:s.ya=await n.onListen(r,!0);break;case 1:s.ya=await n.onListen(r,!1);break;case 2:await n.onFirstRemoteStoreListen(r)}}catch(e){const n=Vo(e,`Initialization of query '${Hn(t.query)}' failed`);return void t.onError(n)}n.queries.set(r,s),s.wa.push(t),t.va(n.onlineState),s.ya&&t.Ca(s.ya)&&Jo(n)}async function Wo(e,t){const n=L(e),i=t.query;let r=3;const s=n.queries.get(i);if(s){const e=s.wa.indexOf(t);e>=0&&(s.wa.splice(e,1),0===s.wa.length?r=t.ba()?0:1:!s.Sa()&&t.ba()&&(r=2))}switch(r){case 0:return n.queries.delete(i),n.onUnlisten(i,!0);case 1:return n.queries.delete(i),n.onUnlisten(i,!1);case 2:return n.onLastRemoteStoreUnlisten(i);default:return}}function Go(e,t){const n=L(e);let i=!1;for(const r of t){const e=r.query,t=n.queries.get(e);if(t){for(const e of t.wa)e.Ca(r)&&(i=!0);t.ya=r}}i&&Jo(n)}function Qo(e,t,n){const i=L(e),r=i.queries.get(t);if(r)for(const s of r.wa)s.onError(n);i.queries.delete(t)}
2function Jo(e){e.Da.forEach((e=>{e.next()}))}var Xo,Yo;(Yo=Xo||(Xo={})).Fa="default",Yo.Cache="cache";class Zo{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new Bo(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){if(!e.fromCache)return!0;if(!this.ba())return!0;const n="Offline"!==t;return(!this.options.ka||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;const t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=Bo.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==Xo.Cache}}class ea{constructor(e){this.key=e}}class ta{constructor(e){this.key=e}}class na{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=ci(),this.mutatedKeys=ci(),this.Xa=Qn(e),this.eu=new jo(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new qo,i=t?t.eu:this.eu;let r=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal(((e,t)=>{const u=i.get(e),l=Wn(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.iu(u,l)||(n.track({type:2,doc:l}),f=!0,(a&&this.Xa(l,a)>0||c&&this.Xa(l,c)<0)&&(o=!0)):!u&&l?(n.track({type:0,doc:l}),f=!0):u&&!l&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(l?(s=s.add(l),r=d?r.add(e):r.delete(e)):(s=s.delete(e),r=r.delete(e)))})),null!==this.query.limit)for(;s.size>this.query.limit;){const e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{eu:s,ru:n,Ds:o,mutatedKeys:r}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){const r=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const s=e.ru.pa();s.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 P(20277,{At:e})}};return n(e)-n(t)}(e.type,t.type)||this.Xa(e.doc,t.doc))),this.su(n),i=null!=i&&i;const o=t&&!i?this.ou():[],a=0===this.Za.size&&this.current&&!i?1:0,c=a!==this.Ya;return this.Ya=a,0!==s.length||c?{snapshot:new Bo(this.query,e.eu,r,s,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new qo,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach((e=>this.Ha=this.Ha.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.Ha=this.Ha.delete(e))),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=ci(),this.eu.forEach((e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))}));const t=[];return e.forEach((e=>{this.Za.has(e)||t.push(new ta(e))}
2)),this.Za.forEach((n=>{e.has(n)||t.push(new ea(n))})),t}uu(e){this.Ha=e.qs,this.Za=ci();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Bo.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const ia="SyncEngine";class ra{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class sa{constructor(e){this.key=e,this.lu=!1}}class oa{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new Xn((e=>Kn(e)),$n),this.Tu=new Map,this.Iu=new Set,this.du=new dt(se.comparator),this.Eu=new Map,this.Au=new fs,this.Ru={},this.Vu=new Map,this.mu=Zr.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function aa(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=ka(e);let r;const s=i.Pu.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.cu()):r=await ua(i,t,n,!0),r}async function ca(e,t){const n=ka(e);await ua(n,t,!0,!1)}async function ua(e,t,n,i){const r=await Ds(e.localStore,jn(t)),s=r.targetId,o=e.sharedCl
2ientState.addLocalQueryTarget(s,n);let a;return i&&(a=await la(e,t,s,"current"===o,r.resumeToken)),e.isPrimaryClient&&n&&lo(e.remoteStore,r),a}async function la(e,t,n,i,r){e.gu=(t,n,i)=>async function(e,t,n,i){let r=t.view.nu(n);r.Ds&&(r=await Ms(e.localStore,t.query,!1).then((e=>{let{documents:n}=e;return t.view.nu(n,r)})));const s=i&&i.targetChanges.get(t.targetId),o=i&&null!=i.targetMismatches.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,s,o);return Ta(e,t.targetId,a._u),a.snapshot}(e,t,n,i);const s=await Ms(e.localStore,t,!0),o=new na(t,s.qs),a=o.nu(s.documents),c=rr.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),u=o.applyChanges(a,e.isPrimaryClient,c);Ta(e,n,u._u);const l=new ra(t,n,o);return e.Pu.set(t,l),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),u.snapshot}async function ha(e,t,n){const i=L(e),r=i.Pu.get(t),s=i.Tu.get(r.targetId);if(s.length>1)return i.Tu.set(r.targetId,s.filter((e=>!$n(e,t)))),void i.Pu.delete(t);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await Ls(i.localStore,r.targetId,!1).then((()=>{i.sharedClientState.clearQueryState(r.targetId),n&&ho(i.remoteStore,r.targetId),_a(i,r.targetId)})).catch(Ae)):(_a(i,r.targetId),await Ls(i.localStore,r.targetId,!0))}async function da(e,t){const n=L(e),i=n.Pu.get(t),r=n.Tu.get(i.targetId);n.isPrimaryClient&&1===r.length&&(n.sharedClientState.removeLocalQueryTarget(i.targetId),ho(n.remoteStore,i.targetId))}async function fa(e,t){const n=L(e);try{const e=await function(e,t){const n=L(e),i=t.snapshotVersion;let r=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const s=n.Os.newChangeBuffer({trackRemovals:!0});r=n.Fs;const o=[];
vendor: 7,882 bytes, line 2
2t.targetChanges.forEach(((s,a)=>{const c=r.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,s.removedDocuments,a).next((()=>n.hi.addMatchingKeys(e,s.addedDocuments,a))));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?u=u.withResumeToken(wt.EMPTY_BYTE_STRING,ye.min()).withLastLimboFreeSnapshotVersion(ye.min()):s.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(s.resumeToken,i)),r=r.insert(a,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,s)&&o.push(n.hi.updateTargetData(e,u))}));let a=Zn(),c=ci();if(t.documentUpdates.forEach((i=>{t.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))})),o.push(Ps(e,s,t.documentUpdates).next((e=>{a=e.Ls,c=e.ks}))),!i.isEqual(ye.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next((t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,i)));o.push(t)}return ke.waitFor(o).next((()=>s.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,c))).next((()=>a))})).then((e=>(n.Fs=r,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const i=n.Eu.get(t);i&&(D(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?i.lu=!0:e.modifiedDocuments.size>0?D(i.lu,14607):e.removedDocuments.size>0&&(D(i.lu,42227),i.lu=!1))})),await Sa(n,e,t)}catch(e){await Ae(e)}}function pa(e,t,n){const i=L(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const e=[];i.Pu.forEach(((n,i)=>{const r=i.view.va(t);r.snapshot&&e.push(r.snapshot)})),function(e,t){const n=L(e);n.onlineState=t;let i=!1;n.queries.forEach(((e,n)=>{for(const r of n.wa)r.va(t)&&(i=!0)})),i&&Jo(n)}(i.eventManager,t),e.length&&i.hu.J_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function ga(e,t,n){const i=L(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.Eu.get(t),s=r&&r.key;if(s){let e=new dt(se.comparator);e=e.insert(s,on.newNoDocument(s,ye.min()));const n=ci().add(s),r=new ir(ye.min(),new Map,new dt(Q),e,n);await fa(i,r),i.du=i.du.remove(s),i.Eu.delete(t),Ea(i)}else await Ls(i.localStore,t,!1).then((()=>_a(i,t,n))).catch(Ae)}async function ma(e,t){const n=L(e),i=t.batch.batchId;try{const e=await function(e,t){const n=L(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(e=>{const i=t.batch.keys(),r=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,i){const r=n.batch,s=r.keys();let o=ke.resolve();return s.forEach((e=>{o=o.next((()=>i.getEntry(t,e))).next((t=>{const s=n.docVersions.get(e);D(null!==s,48541),t.version.compareTo(s)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))}))})),o.next((()=>e.mutationQueue.removeMutationBatch(t,r)))}(n,e,t,r).next((()=>r.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=ci();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,i)))}))}(n.localStore,t);wa(n,i,null),ya(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await Sa(n,e)}catch(e){await Ae(e)}}async function va(e,t,n){const i=L(e);try{const e=await function(e,t){const n=L(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",(e=>{let i;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(D(null!==t,37113),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,i))).next((()=>n.localDocuments.getDocuments(e,i)))}))}(i.localStore,t);wa(i,t,n),ya(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),await Sa(i,e)}catch(n){await Ae(n)}}function ya(e,t){(e.Vu.get(t)||[]).forEach((e=>{e.resolve()})),e.Vu.delete(t)}function wa(e,t,n){const i=L(e);let r=i.Ru[i.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),i.Ru[i.currentUser.toKey()]=r}}function _a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.Tu.get(t))e.Pu.delete(i),n&&e.hu.pu(i,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach((t=>{e.Au.containsKey(t)||ba(e,t)}))}function ba(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ho(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Ea(e))}function Ta(e,t,n){for(const i of n)i instanceof ea?(e.Au.addReference(i.key,t),Ia(e,i)):i instanceof ta?(A(ia,"Document no longer in limbo: "+i.key),e.Au.removeReference(i.key,t),e.Au.containsKey(i.key)||ba(e,i.key)):P(19791,{yu:i})}function Ia(e,t){const n=t.key,i=n.path.canonicalString();e.du.get(n)||e.Iu.has(i)||(A(ia,"New document in limbo: "+n),e.Iu.add(i),Ea(e))}function Ea(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new se(ne.fromString(t)),i=e.mu.next();e.Eu.set(i,new sa(n)),e.du=e.du.insert(n,i),lo(e.remoteStore,new $r(jn(xn(n.path)),i,"TargetPurposeLimboResolution",Pe.ue))}}async function Sa(e,t,n){const i=L(e),r=[],s=[],o=[];i.Pu.isEmpty()||(i.Pu.forEach(((e,a)=>{o.push(i.gu(a,t,n).then((e=>{var t;if((e||n)&&i.isPrimaryClient){const r=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;i.sharedClientState.updateQueryState(a.targetId,r?"current":"not-current")}if(e){r.push(e);const t=Is.Es(a.targetId,e);s.push(t)}})))})),await Promise.all(o),i.hu.J_(r),await async function(e,t){const n=L(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>ke.forEach(t,(t=>ke.forEach(t.Is,(i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i))).next((()=>ke.forEach(t.ds,(i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))))))}catch(e){if(!Ne(e))throw e;A(Cs,"Failed to update sequence numbers: "+e)}for(const i of t){const e=i.targetId;if(!i.fromCache){const t=n.Fs.get(e),i=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(i);n.Fs=n.Fs.insert(e,r)}}}(i.localStore,s))}async function Ca(e,t){const n=L(e);if(!n.currentUser.isEqual(t)){A(ia,"User change. New user:",t.toKey());const e=await Rs(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach((e=>{e.forEach((e=>{e.reject(new x(M.CANCELLED,t))}))})),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Sa(n,e.Bs)}}function Aa(e,t){const n=L(e),i=n.Eu.get(t);if(i&&i.lu)return ci().add(i.key);{let e=ci();const i=n.Tu.get(t);if(!i)return e;for(const t of i){const i=n.Pu.get(t);e=e.unionWith(i.view.tu)}return e}}function ka(e){const t=L(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=fa.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Aa.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=ga.bind(null,t),t.hu.J_=Go.bind(null,t.eventManager),t.hu.pu=Qo.bind(null,t.eventManager),t}function Ra(e){const t=L(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=ma.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=va.bind(null,t),t}class Na{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Xs(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler
2=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return ks(this.persistence,new Ss,e.initialUser,this.serializer)}Du(e){return new ws(bs.Vi,this.serializer)}bu(e){return new Us}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Na.provider={build:()=>new Na};class Pa extends Na{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){D(this.persistence.referenceDelegate instanceof Ts,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new rs(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?Yr.withCacheSize(this.cacheSizeBytes):Yr.DEFAULT;return new ws((e=>Ts.Vi(e,t)),this.serializer)}}class Oa{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=>pa(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Ca.bind(null,this.syncEngine),await Mo(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new $o}createDatastore(e){const t=Xs(e.databaseInfo.databaseId),n=function(e){return new Qs(e)}(e.databaseInfo);return function(e,t,n,i){return new ro(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,i,r){return new ao(e,t,n,i,r)}(this.localStore,this.datastore,e.asyncQueue,(e=>pa(this.syncEngine,e,0)),qs.C()?new qs:new Vs)}createSyncEngine(e,t){return function(e,t,n,i,r,s,o){const a=new oa(e,t,n,i,r,s);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=L(e);A(oo,"RemoteStore shutting down."),t.Ia.add(5),await uo(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}Oa.provider={build:()=>new Oa};class Da{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):k("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,t){setTimeout((()=>{this.muted||e(t)}),0)}}const La="FirestoreClient";class Ma{constructor(e,t,n,i,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=I.UNAUTHENTICATED,this.clientId=G.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,(async e=>{A(La,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(A(La,"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 F;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=Vo(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function xa(e,t){e.asyncQueue.verifyOperationInProgress(),A(La,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener((async e=>{i.isEqual(e)||(await Rs(t.localStore,e),i=e)})),t.persistence.setDatabaseDeletedListener((()=>{R("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then((()=>{A("Terminating Firestore due to IndexedDb database deletion completed successfully")}
2)).catch((e=>{R("Terminating Firestore due to IndexedDb database deletion failed",e)}))})),e._offlineComponents=t}async function Fa(e,t){e.asyncQueue.verifyOperationInProgress();const n=await Ua(e);A(La,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>Lo(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Lo(t.remoteStore,n))),e._onlineComponents=t}async function Ua(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){A(La,"Using user provided OfflineComponentProvider");try{await xa(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===M.FAILED_PRECONDITION||e.code===M.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;R("Error using user provided cache. Falling back to memory cache: "+n),await xa(e,new Na)}}else A(La,"Using default OfflineComponentProvider"),await xa(e,new Pa(void 0));return e._offlineComponents}async function Va(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(A(La,"Using user provided OnlineComponentProvider"),await Fa(e,e._uninitializedComponentsProvider._online)):(A(La,"Using default OnlineComponentProvider"),await Fa(e,new Oa))),e._onlineComponents}function ja(e){return Va(e).then((e=>e.syncEngine))}async function qa(e){const t=await Va(e),n=t.eventManager;return n.onListen=aa.bind(null,t.syncEngine),n.onUnlisten=ha.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=ca.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=da.bind(null,t.syncEngine),n}function Ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=new F;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,i,r){const s=new Da({next:a=>{s.Ou(),t.enqueueAndForget((()=>Wo(e,o)));const c=a.docs.has(n);!c&&a.fromCache?r.reject(new x(M.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&i&&"server"===i.source?r.reject(new x(M.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.)')):r.resolve(a)},error:e=>r.reject(e)}),o=new Zo(xn(n.path),s,{includeMetadataChanges:!0,ka:!0});return Ho(e,o)}(await qa(e),e.asyncQueue,t,n,i))),i.promise}function za(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=new F;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,i,r){const s=new Da({next:n=>{s.Ou(),t.enqueueAndForget((()=>Wo(e,o))),n.fromCache&&"server"===i.source?r.reject(new x(M.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.)')):r.resolve(n)},error:e=>r.reject(e)}),o=new Zo(n,s,{includeMetadataChanges:!0,ka:!0});return Ho(e,o)}(await qa(e),e.asyncQueue,t,n,i))),i.promise}function $a(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const Ka=new Map,Ha="firestore.googleapis.com";class Wa{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new x(M.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Ha,this.ssl=true}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;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=Xr;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<ts)throw new x(M.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new x(M.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=$a(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new x(M.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new x(M.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new x(M.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 Ga{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Wa({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new x(M.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 x(M.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 Wa(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new V;switch(e.type){case"firstParty":return new z(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new x(M.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=Ka.get(e);t&&(A("ComponentProvider","Removing Datastore"),Ka.delete(e),t.terminate())}(this),Promise.resolve()}}function Qa(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};var r;e=he(e,Ga);const s=(0,c.zJ)(t),o=e._getSettings(),a=Object.assign(Object.assign({},o),{emulatorOptions:e._getEmulatorOptions()}),u=`${t}:${n}`;s&&((0,c.gE)(`https://${u}`),(0,c.P1)("Firestore",!0)),o.host!==Ha&&o.host!==u&&R("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const l=Object.assign(Object.assign({},o),{host:u,ssl:s,emulatorOptions:i});if(!(0,c.bD)(l,a)&&(e._setSettings(l),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=I.MOCK_USER;else{t=(0,c.Fy)(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new x(M.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new I(s)}e._authCredentials=new j(new U(t,n))}}class Ja{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Ja(this.firestore,e,this._query)}}class Xa{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 Ya(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Xa(this.firestore,e,this._key)}toJSON(){return{type:Xa._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(pe(t,Xa._jsonSchema))return new Xa(e,n||null,new se(ne.fromString(t.referencePath)))}}Xa._jsonSchemaVersion="firestore/documentReference/1.0",Xa._jsonSchema={type:fe("string",Xa._jsonSchemaVersion),referencePath:fe("string")};class Ya extends Ja{constructor(e,t,n){super(e,t,xn(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 Xa(this.firestore,null,new se(e))}withConverter(e){return new Ya(this.firestore,e,this._path)}}function Za(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];if(e=(0,c.Ku)(e),oe("collection","path",t),e instanceof Ga){const n=ne.fromString(t,...i);return ce(n),new Ya(e,null,n)}{if(!(e instanceof Xa||e instanceof Ya))throw new x(M.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=e._path.child(ne.fromString(t,...i));return ce(n),new Ya(e.firestore,null,n)}}function ec(e,t){if(e=he(e,Ga),oe("collectionGroup","collection id",t),t.indexOf("/")>=0)throw new x(M.INVALID_ARGUMENT,`Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Ja(e,null,function(e){return new Ln(ne.emptyPath(),e)}(t))}function tc(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];if(e=(0,c.Ku)(e),1===arguments.length&&(t=G.newId()),oe("doc","path",t),e instanceof Ga){const n=ne.fromString(t,...i);return ae(n),new Xa(e,null,new se(n))}{if(!(e instanceof Xa||e instanceof Ya))throw new x(M.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=e._path.child(ne.fromString(t,...i));return ae(n),new Xa(e.firestore,e instanceof Ya?e.converter:null,new se(n))}}const nc="AsyncQueue";class ic{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Promise.resolve();this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new Ys(this,"async_queue_retry"),this.oc=()=>{const e=Js();e&&A(nc,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;const t=Js();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;const t=Js();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise((()=>{}));const t=new F;return this.uc((()=>this.Xu&&this.rc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Zu.push(e),this.cc())))}async cc(){if(0!==this.Zu.length){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!Ne(e))throw e;A(nc,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_((()=>this.cc()))}}uc(e){const t=this._c.then((()=>(this.nc=!0,e().catch((e=>{throw this.tc=e,this.nc=!1,k("INTERNAL UNHANDLED ERROR: ",rc(e)),e})).then((e=>(this.nc=!1,e))))));return this._c=t,t}enqueueAfterDelay(e,t,n){this.ac(),this.sc.indexOf(e)>-1&&(t=0);const i=Uo.createAndSchedule(this,e,t,n,(e=>this.lc(e)));return this.ec.push(i),i}ac(){this.tc&&P(47125,{hc:rc(this.tc)})}verifyOperationInProgress(){}async Pc(){let e;do{e=this._c,await e}while(e!==this._c)}Tc(e){for(const t of this.ec)if(t.timerId===e)return!0;return!1}Ic(e){return this.Pc().then((()=>{this.ec.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.ec)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Pc()}))}dc(e){this.sc.push(e)}lc(e){const t=this.ec.indexOf(e);this.ec.splice(t,1)}}function rc(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}function sc(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const i of t)if(i in n&&"function"==typeof n[i])return!0;return!1}(e,["next","error","complete"])}class oc extends Ga{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new ic,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new ic(e),this._firestoreClient=void 0,await e}}}function ac(e,t){const n="object"==typeof e?e:(0,s.getApp)(),i="string"==typeof e?e:t||Ot,r=(0,s._getProvider)(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const e=(0,c.yU)("firestore");e&&Qa(r,...e)}return r}function cc(e){if(e._terminated)throw new x(M.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||uc(e),e._firestoreClient}function uc(e){var t,n,i;const r=e._freezeSettings(),s=function(e,t,n,i){return new Pt(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,$a(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,r);e._componentsProvider||(null===(n=r.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=r.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),e._firestoreClient=new Ma(e._authCredentials,e._appCheckCredentials,e._queue,s,e._componentsProvider&&function(e){const t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}class lc{constructor(e){this._byteString=e}static fromBase64String(e){try{return new lc(wt.fromBase64String(e))}catch(e){throw new x(M.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new lc(wt.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:lc._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(pe(e,lc._jsonSchema))return lc.fromBase64String(e.bytes)}}
vendor: 6,321 bytes, line 2
2lc._jsonSchemaVersion="firestore/bytes/1.0",lc._jsonSchema={type:fe("string",lc._jsonSchemaVersion),bytes:fe("string")};class hc{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(let i=0;i<t.length;++i)if(0===t[i].length)throw new x(M.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new re(t)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function dc(){return new hc(ee)}class fc{constructor(e){this._methodName=e}}class pc{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new x(M.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new x(M.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 Q(this._lat,e._lat)||Q(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:pc._jsonSchemaVersion}}static fromJSON(e){if(pe(e,pc._jsonSchema))return new pc(e.latitude,e.longitude)}}pc._jsonSchemaVersion="firestore/geoPoint/1.0",pc._jsonSchema={type:fe("string",pc._jsonSchemaVersion),latitude:fe("number"),longitude:fe("number")};class gc{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:gc._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(pe(e,gc._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((e=>"number"==typeof e)))return new gc(e.vectorValues);throw new x(M.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}gc._jsonSchemaVersion="firestore/vectorValue/1.0",gc._jsonSchema={type:fe("string",gc._jsonSchemaVersion),vectorValues:fe("object")};const mc=/^__.*__$/;class vc{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new Fi(e,this.data,this.fieldMask,t,this.fieldTransforms):new xi(e,this.data,t,this.fieldTransforms)}}class yc{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new Fi(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function wc(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw P(40011,{Ec:e})}}class _c{constructor(e,t,n,i,r,s){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===r&&this.Ac(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new _c(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.fc(e),i}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return xc(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(wc(this.Ec)&&mc.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class bc{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Xs(e)}Dc(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new _c({Ec:e,methodName:t,bc:n,path:re.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Tc(e){const t=e._freezeSettings(),n=Xs(e._databaseId);return new bc(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Ic(e,t,n,i,r){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const o=e.Dc(s.merge||s.mergeFields?2:0,t,n,r);Oc("Data must be an object, but it was:",o,i);const a=Nc(i,o);let c,u;if(s.merge)c=new vt(o.fieldMask),u=o.fieldTransforms;else if(s.mergeFields){const e=[];for(const i of s.mergeFields){const r=Dc(t,i,n);if(!o.contains(r))throw new x(M.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);Fc(e,r)||e.push(r)}c=new vt(e),u=o.fieldTransforms.filter((e=>c.covers(e.field)))}else c=null,u=o.fieldTransforms;return new vc(new rn(a),c,u)}class Ec extends fc{_toFieldTransform(e){if(2!==e.Ec)throw 1===e.Ec?e.wc(`${this._methodName}() can only appear at the top level of your update data`):e.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Ec}}class Sc extends fc{_toFieldTransform(e){return new Ci(e.path,new yi)}isEqual(e){return e instanceof Sc}}function Cc(e,t,n,i){const r=e.Dc(1,t,n);Oc("Data must be an object, but it was:",r,i);const s=[],o=rn.empty();lt(i,((e,i)=>{const a=Mc(t,e,n);i=(0,c.Ku)(i);const u=r.gc(a);if(i instanceof Ec)s.push(a);else{const e=Rc(i,u);null!=e&&(s.push(a),o.set(a,e))}}));const a=new vt(s);return new yc(o,a,r.fieldTransforms)}function Ac(e,t,n,i,r,s){const o=e.Dc(1,t,n),a=[Dc(t,i,n)],u=[r];if(s.length%2!=0)throw new x(M.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let c=0;c<s.length;c+=2)a.push(Dc(t,s[c])),u.push(s[c+1]);const l=[],h=rn.empty();for(let f=a.length-1;f>=0;--f)if(!Fc(l,a[f])){const e=a[f];let t=u[f];t=(0,c.Ku)(t);const n=o.gc(e);if(t instanceof Ec)l.push(e);else{const i=Rc(t,n);null!=i&&(l.push(e),h.set(e,i))}}const d=new vt(l);return new yc(h,d,o.fieldTransforms)}function kc(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Rc(n,e.Dc(i?4:3,t))}function Rc(e,t){if(Pc(e=(0,c.Ku)(e)))return Oc("Unsupported field value:",t,e),Nc(e,t);if(e instanceof fc)return function(e,t){if(!wc(t.Ec))throw t.wc(`${e._methodName}
2() can only be used with update() and set()`);if(!t.path)throw t.wc(`${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.mc&&4!==t.Ec)throw t.wc("Nested arrays are not supported");return function(e,t){const n=[];let i=0;for(const r of e){let e=Rc(r,t.yc(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=(0,c.Ku)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return fi(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=ve.fromDate(e);return{timestampValue:vr(t.serializer,n)}}if(e instanceof ve){const n=new ve(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:vr(t.serializer,n)}}if(e instanceof pc)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof lc)return{bytesValue:yr(t.serializer,e._byteString)};if(e instanceof Xa){const n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t.wc(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:br(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof gc)return function(e,t){return{mapValue:{fields:{[Lt]:{stringValue:Ft},[Ut]:{arrayValue:{values:e.toArray().map((e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return hi(t.serializer,e)}))}}}}}}(e,t);throw t.wc(`Unsupported field value: ${le(e)}`)}(e,t)}function Nc(e,t){const n={};return ht(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):lt(e,((e,i)=>{const r=Rc(i,t.Vc(e));null!=r&&(n[e]=r)})),{mapValue:{fields:n}}}function Pc(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof ve||e instanceof pc||e instanceof lc||e instanceof Xa||e instanceof fc||e instanceof gc)}function Oc(e,t,n){if(!Pc(n)||!ue(n)){const i=le(n);throw"an object"===i?t.wc(e+" a custom object"):t.wc(e+" "+i)}}function Dc(e,t,n){if((t=(0,c.Ku)(t))instanceof hc)return t._internalPath;if("string"==typeof t)return Mc(e,t);throw xc("Field path arguments must be of type string or ",e,!1,void 0,n)}const Lc=new RegExp("[~\\*/\\[\\]]");function Mc(e,t,n){if(t.search(Lc)>=0)throw xc(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new hc(...t.split("."))._internalPath}catch(i){throw xc(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function xc(e,t,n,i,r){const s=i&&!i.isEmpty(),o=void 0!==r;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${i}`),o&&(c+=` in document ${r}`),c+=")"),new x(M.INVALID_ARGUMENT,a+e+c)}function Fc(e,t){return e.some((e=>e.isEqual(t)))}class Uc{constructor(e,t,n,i,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Xa(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Vc(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(jc("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Vc extends Uc{data(){return super.data()}}function jc(e,t){return"string"==typeof t?Mc(e,t):t instanceof hc?t._internalPath:t._delegate._internalPath}function qc(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new x(M.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Bc{}class zc extends Bc{}function $c(e,t){let n=[];for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];t instanceof Bc&&n.push(t),n=n.concat(r),function(e){const t=e.filter((e=>e instanceof Wc)).length,n=e.filter((e=>e instanceof Kc)).length;if(t>1||t>0&&n>0)throw new x(M.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(...)))`.")}(n);for(const o of n)e=o._apply(e);return e}class Kc extends zc{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Kc(e,t,n)}_apply(e){const t=this._parse(e);return eu(e._query,t),new Ja(e.firestore,e.converter,Bn(e._query,t))}_parse(e){const t=Tc(e.firestore),n=function(e,t,n,i,r,s,o){let a;
2if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new x(M.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Zc(o,s);const t=[];for(const n of o)t.push(Yc(i,e,n));a={arrayValue:{values:t}}}else a=Yc(i,e,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Zc(o,s),a=kc(n,t,o,"in"===s||"not-in"===s);return fn.create(r,s,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Hc(e,t,n){const i=t,r=jc("where",e);return Kc._create(r,i,n)}class Wc extends Bc{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Wc(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]:pn.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const i=t.getFlattenedFilters();for(const r of i)eu(n,r),n=Bn(n,r)}(e._query,t),new Ja(e.firestore,e.converter,Bn(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class Gc extends zc{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Gc(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new x(M.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new x(M.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new ln(t,n)}(e._query,this._field,this._direction);return new Ja(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new Ln(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}function Qc(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc",n=jc("orderBy",e);return Gc._create(n,t)}class Jc extends zc{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new Jc(e,t,n)}_apply(e){return new Ja(e.firestore,e.converter,zn(e._query,this._limit,this._limitType))}}function Xc(e){return de("limit",e),Jc._create("limit",e,"F")}function Yc(e,t,n){if("string"==typeof(n=(0,c.Ku)(n))){if(""===n)throw new x(M.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Un(t)&&-1!==n.indexOf("/"))throw new x(M.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=t.path.child(ne.fromString(n));if(!se.isDocumentKey(i))throw new x(M.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return Gt(e,new se(i))}if(n instanceof Xa)return Gt(e,n._key);throw new x(M.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${le(n)}.`)}function Zc(e,t){if(!Array.isArray(e)||0===e.length)throw new x(M.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function eu(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 x(M.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new x(M.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class tu{convertValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(Vt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Tt(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(It(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 P(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";const n={};return lt(e,((e,i)=>{n[e]=this.convertValue(i,t)})),n}convertVectorValue(e){var t,n,i;const r=null===(i=null===(n=null===(t=e.fields)||void 0===t?void 0:t[Ut].arrayValue)||void 0===n?void 0:n.values)||void 0===i?void 0:i.map((e=>Tt(e.doubleValue)));return new gc(r)}convertGeoPoint(e){return new pc(Tt(e.latitude),Tt(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Rt(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Nt(e));default:return null}}convertTimestamp(e){const t=bt(e);return new ve(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=ne.fromString(e);D(zr(n),9688,{name:e});const i=new Dt(n.get(1),n.get(3)),r=new se(n.popFirst(5));return i.isEqual(t)||k(`Document ${r} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),r}}function nu(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}class iu{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class ru extends Uc{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){const t=new su(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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){const n=this._document.data.field(jc("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new x(M.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=ru._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}}ru._jsonSchemaVersion="firestore/documentSnapshot/1.0",ru._jsonSchema={type:fe("string",ru._jsonSchemaVersion),bundleSource:fe("string","DocumentSnapshot"),bundleName:fe("string"),bundle:fe("string")};class su extends ru{data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return super.data(e)}}class ou{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new iu(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new su(this._firestore,this._userDataWriter,n.key,n,new iu(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(){const e=!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new x(M.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const i=new su(e._firestore,e._userDataWriter,n.doc.key,n.doc,new iu(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const i=new su(e._firestore,e._userDataWriter,t.doc.key,t.doc,new iu(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:au(t.type),doc:i,oldIndex:r,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new x(M.FAILED_PRECONDITION,"QuerySnapsh
2ot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ou._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=G.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],i=[];return this.docs.forEach((e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),i.push(e.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function au(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return P(61501,{type:e})}}function cu(e){e=he(e,Xa);const t=he(e.firestore,oc);return Ba(cc(t),e._key).then((n=>vu(t,e,n)))}ou._jsonSchemaVersion="firestore/querySnapshot/1.0",ou._jsonSchema={type:fe("string",ou._jsonSchemaVersion),bundleSource:fe("string","QuerySnapshot"),bundleName:fe("string"),bundle:fe("string")};class uu extends tu{constructor(e){super(),this.firestore=e}convertBytes(e){return new lc(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Xa(this.firestore,null,t)}}function lu(e){e=he(e,Ja);const t=he(e.firestore,oc),n=cc(t),i=new uu(t);return qc(e._query),za(n,e._query).then((n=>new ou(t,i,e,n)))}function hu(e){e=he(e,Ja);const t=he(e.firestore,oc),n=cc(t),i=new uu(t);return za(n,e._query,{source:"server"}).then((n=>new ou(t,i,e,n)))}function du(e,t,n){e=he(e,Xa);const i=he(e.firestore,oc),r=nu(e.converter,t,n);return mu(i,[Ic(Tc(i),"setDoc",e._key,r,null!==e.converter,n).toMutation(e._key,ki.none())])}function fu(e,t,n){e=he(e,Xa);const i=he(e.firestore,oc),r=Tc(i);let s;for(var o=arguments.length,a=new Array(o>3?o-3:0),u=3;u<o;u++)a[u-3]=arguments[u];return s="string"==typeof(t=(0,c.Ku)(t))||t instanceof hc?Ac(r,"updateDoc",e._key,t,n,a):Cc(r,"updateDoc",e._key,t),mu(i,[s.toMutation(e._key,ki.exists(!0))])}function pu(e,t){const n=he(e.firestore,oc),i=tc(e),r=nu(e.converter,t);return mu(n,[Ic(Tc(e.firestore),"addDoc",i._key,r,null!==e.converter,{}).toMutation(i._key,ki.exists(!1))]).then((()=>i))}function gu(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r,s,o;e=(0,c.Ku)(e);let a={includeMetadataChanges:!1,source:"default"},u=0;"object"!=typeof n[u]||sc(n[u])||(a=n[u++]);const l={includeMetadataChanges:a.includeMetadataChanges,source:a.source};if(sc(n[u])){const e=n[u];n[u]=null===(r=e.next)||void 0===r?void 0:r.bind(e),n[u+1]=null===(s=e.error)||void 0===s?void 0:s.bind(e),n[u+2]=null===(o=e.complete)||void 0===o?void 0:o.bind(e)}let h,d,f;if(e instanceof Xa)d=he(e.firestore,oc),f=xn(e._key.path),h={next:t=>{n[u]&&n[u](vu(d,e,t))},error:n[u+1],complete:n[u+2]};else{const t=he(e,Ja);d=he(t.firestore,oc),f=t._query;const i=new uu(d);h={next:e=>{n[u]&&n[u](new ou(d,i,t,e))},error:n[u+1],complete:n[u+2]},qc(e._query)}return function(e,t,n,i){const r=new Da(i),s=new Zo(t,r,n);return e.asyncQueue.enqueueAndForget((async()=>Ho(await qa(e),s))),()=>{r.Ou(),e.asyncQueue.enqueueAndForget((async()=>Wo(await qa(e),s)))}}(cc(d),f,l,h)}function mu(e,t){return function(e,t){const n=new F;return e.asyncQueue.enqueueAndForget((async()=>async function(e,t,n){const i=Ra(e);try{const e=await function(e,t){const n=L(e),i=ve.now(),r=t.reduce(((e,t)=>e.add(t.key)),ci());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(e=>{let a=Zn(),c=ci();return n.Os.getEntries(e,r).next((e=>{a=e,a.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,a))).next((r=>{s=r;const o=[];for(const e of t){const t=Li(e,s.get(e.key).overlayedDocument);null!=t&&o.push(new Fi(e.key,t,sn(t.value.mapValue),ki.exists(!0)))}
2return n.mutationQueue.addMutationBatch(e,i,o,t)})).next((t=>{o=t;const i=t.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,i)}))})).then((()=>({batchId:o.batchId,changes:ni(s)})))}(i.localStore,t);i.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let i=e.Ru[e.currentUser.toKey()];i||(i=new dt(Q)),i=i.insert(t,n),e.Ru[e.currentUser.toKey()]=i}(i,e.batchId,n),await Sa(i,e.changes),await So(i.remoteStore)}catch(e){const t=Vo(e,"Failed to persist write");n.reject(t)}}(await ja(e),t,n))),n.promise}(cc(e),t)}function vu(e,t,n){const i=n.docs.get(t._key),r=new uu(e);return new ru(e,r,t._key,i,new iu(n.hasPendingWrites,n.fromCache),t.converter)}class yu{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Tc(e)}set(e,t,n){this._verifyNotCommitted();const i=wu(e,this._firestore),r=nu(i.converter,t,n),s=Ic(this._dataReader,"WriteBatch.set",i._key,r,null!==i.converter,n);return this._mutations.push(s.toMutation(i._key,ki.none())),this}update(e,t,n){this._verifyNotCommitted();const i=wu(e,this._firestore);let r;for(var s=arguments.length,o=new Array(s>3?s-3:0),a=3;a<s;a++)o[a-3]=arguments[a];return r="string"==typeof(t=(0,c.Ku)(t))||t instanceof hc?Ac(this._dataReader,"WriteBatch.update",i._key,t,n,o):Cc(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(r.toMutation(i._key,ki.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=wu(e,this._firestore);return this._mutations=this._mutations.concat(new qi(t._key,ki.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 x(M.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function wu(e,t){if((e=(0,c.Ku)(e)).firestore!==t)throw new x(M.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}function _u(){return new Ec("deleteField")}function bu(){return new Sc("serverTimestamp")}function Tu(e){return cc(e=he(e,oc)),new yu(e,(t=>mu(e,t)))}new WeakMap;!function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){E=e}(s.SDK_VERSION),(0,s._registerComponent)(new o.uA("firestore",((e,n)=>{let{instanceIdentifier:i,options:r}=n;const s=e.getProvider("app").getImmediate(),o=new oc(new q(e.getProvider("auth-internal")),new K(s,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new x(M.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Dt(e.options.projectId,t)}(s,i),s);return r=Object.assign({useFetchStreams:t},r),o._setSettings(r),o}),"PUBLIC").setMultipleInstances(!0)),(0,s.registerVersion)(b,T,e),(0,s.registerVersion)(b,T,"esm2017")}()},30609(e,t,n){n(92433);var i=n(38183),r=n(1986),s=n(51252),o=n(73507);const a="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="google.c.a.c_id",u=1e4;var l,h;function d(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function f(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(l||(l={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(h||(h={}));const p="fcm_token_details_db",g="fcm_token_object_Store";const m="firebase-messaging-store";let v=null;function y(){return v||(v=(0,r.P2)("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(m)}})),v}async function w(e){const t=b(e),n=await y(),i=await n.transaction(m).objectStore(m).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(p))return null}let t=null;return(await(0,r.P2)(p,5,{upgrade:async(n,i,r,s)=>{var o;if(i<2)return;if(!n.objectStoreNames.contains(g))return;const a=s.objectStore(g),c=await a.index("fcmSenderId").get(e);if(await a.clear(),c)if(2===i){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"===typeof e.vapidKey?e.vapidKey:d(e.vapidKey)}}}else if(3===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}else if(4===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}}})).close(),await(0,r.MR)(p),await(0,r.MR)("fcm_vapid_details_db"),await(0,r.MR)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"===typeof e.createTime&&e.createTime>0&&"string"===typeof e.token&&e.token.length>0&&"string"===typeof t.auth&&t.auth.length>0&&"string"===typeof t.p256dh&&t.p256dh.length>0&&"string"===typeof t.endpoint&&t.endpoint.length>0&&"string"===typeof t.swScope&&t.swScope.length>0&&"string"===typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await _(e,t),t}}async function _(e,t){const n=b(e),i=(await y()).transaction(m,"readwrite");return await i.objectStore(m).put(t,n),await i.done,t}function b(e){let{appConfig:t}=e;return t.appId}const T={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invali
2d-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},I=new s.FA("messaging","Messaging",T);async function E(e,t){const n={method:"DELETE",headers:await C(e)};try{const i=await fetch(`${S(e.appConfig)}/${t}`,n),r=await i.json();if(r.error){const e=r.error.message;throw I.create("token-unsubscribe-failed",{errorInfo:e})}}catch(i){throw I.create("token-unsubscribe-failed",{errorInfo:null===i||void 0===i?void 0:i.toString()})}}function S(e){let{projectId:t}=e;return`https://fcmregistrations.googleapis.com/v1/projects/${t}/registrations`}async function C(e){let{appConfig:t,installations:n}=e;const i=await n.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t.apiKey,"x-goog-firebase-installations-auth":`FIS ${i}`})}function A(e){let{p256dh:t,auth:n,endpoint:i,vapidKey:r}=e;const s={web:{endpoint:i,auth:n,p256dh:t}};return r!==a&&(s.web.applicationPubKey=r),s}async function k(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:d(t.getKey("auth")),p256dh:d(t.getKey("p256dh"))},i=await w(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,r=t.auth===e.auth,s=t.p256dh===e.p256dh;return n&&i&&r&&s}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await C(e),i=A(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(i)};let s;try{const n=await fetch(`${S(e.appConfig)}/${t.token}`,r);s=await n.json()}catch(o){throw I.create("token-update-failed",{errorInfo:null===o||void 0===o?void 0:o.toString()})}if(s.error){const e=s.error.message;throw I.create("token-update-failed",{errorInfo:e})}if(!s.token)throw I.create("token-update-no-token");return s.token}(e.firebaseDependencies,t),i=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await _(e.firebaseDependencies,i),n}catch(n){throw n}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await E(e.firebaseDependencies,i.token)}catch(r){console.warn(r)}return R(e.firebaseDependencies,n)}return R(e.firebaseDependencies,n)}async function R(e,t){const n=await async function(e,t){const n=await C(e),i=A(t),r={method:"POST",headers:n,body:JSON.stringify(i)};let s;try{const t=await fetch(S(e.appConfig),r);s=await t.json()}catch(o){throw I.create("token-subscribe-failed",{errorInfo:null===o||void 0===o?void 0:o.toString()})}if(s.error){const e=s.error.message;throw I.create("token-subscribe-failed",{errorInfo:e})}if(!s.token)throw I.create("token-subscribe-no-token");return s.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await _(e,i),i.token}function N(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const r=t.notification.image;r&&(e.notification.image=r);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,i,r,s,o;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const a=null!==(r=null===(i=t.fcmOptions)||void 0===i?void 0:i.link)&&void 0!==r?r:null===(s=t.notification)||void 0===s?void 0:s.click_action;a&&(e.fcmOptions.link=a);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}function P(e){return I.create("missing-app-config-values",{valueName:e})}!function(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e.charAt(i)),i<t.length&&n.push(t.charAt(i));n.join("")}("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class O{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroun
2dMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw P("App Configuration Object");if(!e.name)throw P("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const i of t)if(!n[i])throw P(i);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function D(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch((()=>{})),await async function(e){return new Promise(((t,n)=>{const i=setTimeout((()=>n(new Error("Service worker not registered after 10000 ms"))),u),r=e.installing||e.waiting;e.active?(clearTimeout(i),t()):r?r.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(r.onstatechange=null,clearTimeout(i),t())}:(clearTimeout(i),n(new Error("No incoming service worker found.")))}))}(e.swRegistration)}catch(t){throw I.create("failed-service-worker-registration",{browserErrorMessage:null===t||void 0===t?void 0:t.message})}}async function L(e,t){if(!navigator)throw I.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw I.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=a)}(e,null===t||void 0===t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await D(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw I.create("invalid-sw-registration");e.swRegistration=t}}(e,null===t||void 0===t?void 0:t.serviceWorkerRegistration),k(e)}async function M(e,t,n){const i=function(e){switch(e){case h.NOTIFICATION_CLICKED:return"notification_open";case h.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(i,{message_id:n[c],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function x(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===h.PUSH_RECEIVED&&("function"===typeof e.onMessageHandler?e.onMessageHandler(N(n)):e.onMessageHandler.next(N(n)));const i=n.data;var r;"object"===typeof(r=i)&&r&&c in r&&"1"===i["google.c.a.e"]&&await M(e,n.messageType,i)}const F="@firebase/messaging",U="0.12.22",V=e=>{const t=new O(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>x(t,e))),t},j=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>L(t,e)}};(0,o._registerComponent)(new i.uA("messaging",V,"PUBLIC")),(0,o._registerComponent)(new i.uA("messaging-internal",j,"PRIVATE")),(0,o.registerVersion)(F,U),(0,o.registerVersion)(F,U,"esm2017")},70036(e,t,n){n.d(t,{RN:()=>wt});var i,r,s=n(51252),o=n(46954),a=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=function(e){if("loading"===document.readyState)return"loading";var t=a();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},u=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},l=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var i=e,r=i.id?"#"+i.id:u(i)+(i.classList&&i.classList.value&&i.classList.value.trim()&&i.classList.value.trim().length?"."+i.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+r.length>(t||100)-1)return n||r;if(n=n?r+">"+n:r,i.id)break;e=i.parentNode}}catch(e){}return n},h=-1,d=function(){return h},f=function(e){addEventListener("pageshow",(function(t){t.persisted&&(h=t.t
vendor: 9,159 bytes, line 2
2imeStamp,e(t))}),!0)},p=function(){var e=a();return e&&e.activationStart||0},g=function(e,t){var n=a(),i="navigate";return d()>=0?i="back-forward-cache":n&&(document.prerendering||p()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},m=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},v=function(e,t,n,i){var r,s;return function(o){t.value>=0&&(o||i)&&((s=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=s,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},w=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},_=function(e){var t=!1;return function(){t||(e(),t=!0)}},b=-1,T=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},I=function(e){"hidden"===document.visibilityState&&b>-1&&(b="visibilitychange"===e.type?e.timeStamp:0,S())},E=function(){addEventListener("visibilitychange",I,!0),addEventListener("prerenderingchange",I,!0)},S=function(){removeEventListener("visibilitychange",I,!0),removeEventListener("prerenderingchange",I,!0)},C=function(){return b<0&&(b=T(),E(),f((function(){setTimeout((function(){b=T(),E()}),0)}))),{get firstHiddenTime(){return b}}},A=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},k=[1800,3e3],R=function(e,t){t=t||{},A((function(){var n,i=C(),r=g("FCP"),s=m("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-p(),0),r.entries.push(e),n(!0)))}))}));s&&(n=v(e,r,k,t.reportAllChanges),f((function(i){r=g("FCP"),n=v(e,r,k,t.reportAllChanges),y((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},N=[.1,.25],P=function(e,t){!function(e,t){t=t||{},R(_((function(){var n,i=g("CLS",0),r=0,s=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=s[0],n=s[s.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,s.push(e)):(r=e.value,s=[e])}})),r>i.value&&(i.value=r,i.entries=s,n())},a=m("layout-shift",o);a&&(n=v(e,i,N,t.reportAllChanges),w((function(){o(a.takeRecords()),n(!0)})),f((function(){r=0,i=g("CLS",0),n=v(e,i,N,t.reportAllChanges),y((function(){return n()}))})),setTimeout(n,0))})))}((function(t){var n=function(e){var t,n={};if(e.entries.length){var i=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(i&&i.sources&&i.sources.length){var r=(t=i.sources).find((function(e){return e.node&&1===e.node.nodeType}))||t[0];r&&(n={largestShiftTarget:l(r.node),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:r,largestShiftEntry:i,loadState:c(i.startTime)})}}return Object.assign(e,{attribution:n})}(t);e(n)}),t)},O=0,D=1/0,L=0,M=function(e){e.forEach((function(e){e.interactionId&&(D=Math.min(D,e.interactionId),L=Math.max(L,e.interactionId),O=L?(L-D)/7+1:0)}))},x=function(){return i?O:performance.interactionCount||0},F=function(){"interactionCount"in performance||i||(i=m("event",M,{type:"event",buffered:!0,durationThreshold:0}))},U=[],V=new Map,j=0,q=[],B=function(e){if(q.forEach((function(t){return t(e)})),e.interactionId||"first-input"===e.entryType){var t=U[U.length-1],n=V.get(e.interactionId);if(n||U.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};V.set(i.id,i),U.push(i)}U.sort((function(e,t){return t.latency-e.latency})),U.length>10&&U.splice(10).forEach((function(e){return V.delete(e.id)}))}}},z=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=_(e),"hidden"===document.visibilityState?e():(n=t(e),w(e)),n},$=[200,500],K=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},A((function(){var n;F();var i,r=g("INP"),s=function(e){z((function(){e.forEach(B);var t=function(){var e=Math.min(U.length-1,Math.floor((x()-j)/50));return U[e]}();t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())}))},o=m("event",s,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});i=v(e,r,$,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),w((function(){s(o.takeRecords()),i(!0)})),f((function(){j=x(),U.length=0,V.clear(),r=g("INP"),i=v(e,r,$,t.reportAllChanges)})))})))},H=[],W=[],G=0,Q=new WeakMap,J=new Map,X=-1,Y=function(e){H=H.concat(e),Z()},Z=function(){X<0&&(X=z(ee))},ee=function(){J.size>10&&J.forEach((function(e,t){V.has(t)||J.delete(t)}));var e=U.map((function(e){return Q.get(e.entries[0])})),t=W.length-50;W=W.filter((function(n,i){return i>=t||e.includes(n)}));for(var n=new Set,i=0;i<W.length;i++){var r=W[i];te(r.startTime,r.processingEnd).forEach((function(e){n.add(e)}))}var s=H.length-1-50;H=H.filter((function(e,t){return e.startTime>G&&t>s||n.has(e)})),X=-1};q.push((function(e){e.interactionId&&e.target&&!J.has(e.interactionId)&&J.set(e.interactionId,e.target)}),(function(e){var t,n=e.startTime+e.duration;G=Math.max(G,e.processingEnd);for(var i=W.length-1;i>=0;i--){var r=W[i];if(Math.abs(n-r.renderTime)<=8){(t=r).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:[e]},W.push(t)),(e.interactionId||"first-input"===e.entryType)&&Q.set(e,t),Z()}));var te=function(e,t){for(var n,i=[],r=0;n=H[r];r++)if(!(n.startTime+n.duration<e)){if(n.startTime>t)break;i.push(n)}return i},ne=function(e,t){r||(r=m("long-animation-frame",Y)),K((function(t){var n=function(e){var t=e.entries[0],n=Q.get(t),i=t.processingStart,r=n.processingEnd,s=n.entries.sort((function(e,t){return e.processingStart-t.processingStart})),o=te(t.startTime,r),a=e.entries.find((function(e){return e.target})),u=a&&a.target||J.get(t.interactionId),h=[t.startTime+t.duration,r].concat(o.map((function(e){return e.startTime+e.duration}))),d=Math.max.apply(Math,h),f={interactionTarget:l(u),interactionTargetElement:u,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:d,processedEventEntries:s,longAnimationFrameEntries:o,inputDelay:i-t.startTime,processingDuration:r-i,presentationDelay:Math.max(d-r,0),loadState:c(t.startTime)};return Object.assign(e,{attribution:f})}(t);e(n)}),t)},ie=[2500,4e3],re={},se=function(e,t){!function(e,t){t=t||{},A((function(){var n,i=C(),r=g("LCP"),s=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-p(),0),r.entries=[e],n())}))},o=m("largest-contentful-paint",s);if(o){n=v(e,r,ie,t.reportAllChanges);var a=_((function(){re[r.id]||(s(o.takeRecords()),o.disconnect(),re[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return z(a)}),{once:!0,capture:!0})})),w(a),f((function(i){r=g("LCP"),n=v(e,r,ie,t.reportAllChanges),y((function(){r.value=performance.now()-i.timeStamp,re[r.id]=!0,n(!0)}))}))}}))}((function(t){var n=function(e){var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n=a();if(n){var i=n.activationStart||0,r=e.entries[e.entries.length-1],s=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],o=Math.max(0,n.responseStart-i),c=Math.max(o,s?(s.requestStart||s.startTime)-i:0),u=Math.max(c,s?s.responseEnd-i:0),h=Math.max(u,r.startTime-i);t={element:l(r.element),timeToFirstByte:o,resourceLoadDelay:c-o,resourceLoadDuration:u-c,elementRenderDelay:h-u,navigationEntry:n,lcpEntry:r},r.url&&(t.url=r.url),s&&(t.lcpResourceEntry=s)}}return Object.assign(e,{attribution:t})}(t);e(n)}),t)},oe=(new Date,n(73507)),ae=n(38183);n(92433);const ce="@firebase/performance",ue="0.7.7",le=ue,he="FB-PERF-TRACE-MEASURE",de="_wt_",fe="_fcp",pe="_fid",ge="_lcp",me="_inp",ve="_cls",ye="@firebase/performance/config",we="@firebase/performance/configexpire",_e="Performance",be={"trace started":"Trace {$traceName} was started before.","trace stopped":"Trace {$traceName} is not running.","nonpositive trace startTime":"Trace {$traceName} startTime should be positive.","nonpositive trace duration":"Trace {$traceName} duration should be positive.","no window":"Window is not available.","no app id":"App id is not available.","no project id":"Project id is not available.","no api key":"Api key is not available.","invali
2d cc log":"Attempted to queue invalid cc event","FB not default":"Performance can only start when Firebase app instance is the default one.","RC response not ok":"RC response is not ok","invalid attribute name":"Attribute name {$attributeName} is invalid.","invalid attribute value":"Attribute value {$attributeValue} is invalid.","invalid custom metric name":"Custom metric name {$customMetricName} is invalid","invalid String merger input":"Input for String merger is invalid, contact support team to resolve.","already initialized":"initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance."},Te=new s.FA("performance",_e,be),Ie=new o.Vy(_e);let Ee,Se,Ce,Ae;Ie.logLevel=o.$b.INFO;class ke{constructor(e){if(this.window=e,!e)throw Te.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay),this.onLCP=se,this.onINP=ne,this.onCLS=P}getUrl(){return this.windowLocation.href.split("?")[0]}mark(e){this.performance&&this.performance.mark&&this.performance.mark(e)}measure(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)}getEntriesByType(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]}getEntriesByName(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]}getTimeOrigin(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)}requiredApisAvailable(){return fetch&&Promise&&(0,s.dM)()?!!(0,s.zW)()||(Ie.info("IndexedDB is not supported by current browser"),!1):(Ie.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)}setupObserver(e,t){if(!this.PerformanceObserver)return;new this.PerformanceObserver((e=>{for(const n of e.getEntries())t(n)})).observe({entryTypes:[e]})}static getInstance(){return void 0===Ee&&(Ee=new ke(Se)),Ee}}function Re(){return Ce}function Ne(e,t){const n=e.length-t.length;if(n<0||n>1)throw Te.create("invalid String merger input");const i=[];for(let r=0;r<e.length;r++)i.push(e.charAt(r)),t.length>r&&i.push(t.charAt(r));return i.join("")}class Pe{constructor(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=Ne("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=Ne("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}getFlTransportFullUrl(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)}static getInstance(){return void 0===Ae&&(Ae=new Pe),Ae}}var Oe;!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.VISIBLE=1]="VISIBLE",e[e.HIDDEN=2]="HIDDEN"}(Oe||(Oe={}));const De=["firebase_","google_","ga_"],Le=new RegExp("^[a-zA-Z]\\w*$");function Me(){const e=ke.getInstance().navigator;return(null===e||void 0===e?void 0:e.serviceWorker)?e.serviceWorker.controller?2:3:1}function xe(){switch(ke.getInstance().document.visibilityState){case"visible":return Oe.VISIBLE;case"hidden":return Oe.HIDDEN;default:return Oe.UNKNOWN}}function Fe(){const e=ke.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}function Ue(e){var t;const n=null===(t=e.options)||void 0===t?void 0:t.appId;if(!n)throw Te.create("no app id");return n}const Ve="0.0.1",je={loggingEnabled:!0},qe="FIREBASE_INSTALLATIONS_AUTH";function Be(e,t){const n=function(){const e=ke.getInstance().localStorage;if(!e)return;const t=e.getItem(we);if(!t||(n=t,!(Number(n)>Date.now())))return;var n;const i=e.getItem(ye);if(!i)return;try{return JSON.parse(i)}catch(r){return}}();return n?($e(n),Promise.resolve()):function(e,t){return function(e){const t=e.getToken();return t.then((e=>{})),t}(e.installations).then((n=>{const i=function(e){var t;const n=null===(t=e.options)||void 0===t?void 0:t.projectId;if(!n)throw Te.create("no project id");return n}(e.app),r=function(e){var t;const n=null===(t=e.options)||void 0===t?void 0:t.apiKey;if(!n)throw Te.create("no api key");return n}
2(e.app),s=new Request(`https://firebaseremoteconfig.googleapis.com/v1/projects/${i}/namespaces/fireperf:fetch?key=${r}`,{method:"POST",headers:{Authorization:`${qe} ${n}`},body:JSON.stringify({app_instance_id:t,app_instance_id_token:n,app_id:Ue(e.app),app_version:le,sdk_version:Ve})});return fetch(s).then((e=>{if(e.ok)return e.json();throw Te.create("RC response not ok")}))})).catch((()=>{Ie.info(ze)}))}(e,t).then($e).then((e=>function(e){const t=ke.getInstance().localStorage;if(!e||!t)return;t.setItem(ye,JSON.stringify(e)),t.setItem(we,String(Date.now()+60*Pe.getInstance().configTimeToLive*60*1e3))}(e)),(()=>{}))}const ze="Could not fetch config, will use default configs";function $e(e){if(!e)return e;const t=Pe.getInstance(),n=e.entries||{};return void 0!==n.fpr_enabled?t.loggingEnabled="true"===String(n.fpr_enabled):t.loggingEnabled=je.loggingEnabled,n.fpr_log_source?t.logSource=Number(n.fpr_log_source):je.logSource&&(t.logSource=je.logSource),n.fpr_log_endpoint_url?t.logEndPointUrl=n.fpr_log_endpoint_url:je.logEndPointUrl&&(t.logEndPointUrl=je.logEndPointUrl),n.fpr_log_transport_key?t.transportKey=n.fpr_log_transport_key:je.transportKey&&(t.transportKey=je.transportKey),void 0!==n.fpr_vc_network_request_sampling_rate?t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate):void 0!==je.networkRequestsSamplingRate&&(t.networkRequestsSamplingRate=je.networkRequestsSamplingRate),void 0!==n.fpr_vc_trace_sampling_rate?t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate):void 0!==je.tracesSamplingRate&&(t.tracesSamplingRate=je.tracesSamplingRate),t.logTraceAfterSampling=Ke(t.tracesSamplingRate),t.logNetworkAfterSampling=Ke(t.networkRequestsSamplingRate),e}function Ke(e){return Math.random()<=e}let He,We=1;function Ge(e){return We=2,He=He||function(e){return function(){const e=ke.getInstance().document;return new Promise((t=>{if(e&&"complete"!==e.readyState){const n=()=>{"complete"===e.readyState&&(e.removeEventListener("readystatechange",n),t())};e.addEventListener("readystatechange",n)}else t()}))}().then((()=>function(e){const t=e.getId();return t.then((e=>{Ce=e})),t}(e.installations))).then((t=>Be(e,t))).then((()=>Qe()),(()=>Qe()))}(e),He}function Qe(){We=3}let Je,Xe=3,Ye=[],Ze=!1;function et(e){setTimeout((()=>{Xe<=0||(Ye.length>0&&tt(),et(1e4))}),e)}function tt(){const e=Ye.splice(0,1e3),t=e.map((e=>({source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)})));(function(e){const t=Pe.getInstance().getFlTransportFullUrl(),n=JSON.stringify(e);return navigator.sendBeacon&&navigator.sendBeacon(t,n)?Promise.resolve():fetch(t,{method:"POST",body:n,keepalive:!0}).then()})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:Pe.getInstance().logSource,log_event:t}).then((()=>{Xe=3})).catch((()=>{Ye=[...e,...Ye],Xe--,Ie.info(`Tries left: ${Xe}.`),et(1e4)}))}function nt(e){return function(){!function(e){if(!e.eventTime||!e.message)throw Te.create("invalid cc log");Ye=[...Ye,e]}({message:e(...arguments),eventTime:Date.now()})}}function it(){for(;Ye.length>0;)tt()}function rt(e,t){Je||(Je={send:nt(at),flush:it}),Je.send(e,t)}function st(e){const t=Pe.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&ke.getInstance().requiredApisAvailable()&&(3===We?ot(e):Ge(e.performanceController).then((()=>ot(e)),(()=>ot(e))))}function ot(e){if(!Re())return;const t=Pe.getInstance();t.loggingEnabled&&t.logTraceAfterSampling&&rt(e,1)}function at(e,t){return 0===t?function(e){const t={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},n={application_info:ct(e.performanceController.app),network_request_metric:t};return JSON.stringify(n)}(e):function(e){const t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=e.counters);const n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=n);const i={application_info:ct(e.performanceController.app),trace_metric:t};return JSON.stringify(i)}(e)}function ct(e){return{google_app_id:Ue(e),app_instance_id:Re(),web_app_info:{sdk_version:le,page_url:ke.getInstance().getUrl(),service_worker_status:Me(),visibility_state:xe(),effective_connection_type:Fe()},application_process_state:0}}function ut(e,t){const n=t;if(!n||void 0===n.responseStart)return;const i=ke.getInstance().getTimeOrigin(),r=Math.floor(1e3*(n.startTime+i)),s=n.responseStart?Math.floor(1e3*(n.responseStart-n.startTime)):void 0,o=Math.floor(1e3*(n.responseEnd-n.startTime));!function(e){const t=Pe.getInstance();if(!t.instrumentationEnabled)return;const n=e.url,i=t.logEndPointUrl.split("?")[0],r=t.flTransportEndpointUrl.split("?")[0];n!==i&&n!==r&&t.loggingEnabled&&t.logNetworkAfterSampling&&rt(e,0)}({performanceController:e,url:n.name&&n.name.split("?")[0],responsePayloadBytes:n.transferSize,startTimeUs:r,timeToResponseInitiatedUs:s,timeToResponseCompletedUs:o})}const lt=["_fp",fe,pe,ge,ve,me];class ht{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;this.performanceController=e,this.name=t,this.isAuto=n,this.state=1,this.customAttributes={},this.counters={},this.api=ke.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark=`FB-PERF-TRACE-START-${this.randomId}-${this.name}`,this.traceStopMark=`FB-PERF-TRACE-STOP-${this.randomId}-${this.name}`,this.traceMeasure=i||`${he}-${this.randomId}-${this.name}`,i&&this.calculateTraceMetrics())}
2start(){if(1!==this.state)throw Te.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2}stop(){if(2!==this.state)throw Te.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),st(this)}record(e,t,n){if(e<=0)throw Te.create("nonpositive trace startTime",{traceName:this.name});if(t<=0)throw Te.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=Object.assign({},n.attributes)),n&&n.metrics)for(const i of Object.keys(n.metrics))isNaN(Number(n.metrics[i]))||(this.counters[i]=Math.floor(Number(n.metrics[i])));st(this)}incrementMetric(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;void 0===this.counters[e]?this.putMetric(e,t):this.putMetric(e,this.counters[e]+t)}putMetric(e,t){if(n=e,i=this.name,0===n.length||n.length>100||!(i&&i.startsWith(de)&&lt.indexOf(n)>-1)&&n.startsWith("_"))throw Te.create("invalid custom metric name",{customMetricName:e});var n,i;this.counters[e]=function(e){const t=Math.floor(e);return t<e&&Ie.info(`Metric value should be an Integer, setting the value as : ${t}.`),t}(null!==t&&void 0!==t?t:0)}getMetric(e){return this.counters[e]||0}putAttribute(e,t){const n=!(0===(i=e).length||i.length>40)&&!De.some((e=>i.startsWith(e)))&&!!i.match(Le);var i;const r=function(e){return 0!==e.length&&e.length<=100}(t);if(n&&r)this.customAttributes[e]=t;else{if(!n)throw Te.create("invalid attribute name",{attributeName:e});if(!r)throw Te.create("invalid attribute value",{attributeValue:t})}}getAttribute(e){return this.customAttributes[e]}removeAttribute(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]}getAttributes(){return Object.assign({},this.customAttributes)}setStartTime(e){this.startTimeUs=e}setDuration(e){this.durationUs=e}calculateTraceMetrics(){const e=this.api.getEntriesByName(this.traceMeasure),t=e&&e[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))}static createOobTrace(e,t,n,i,r){const s=ke.getInstance().getUrl();if(!s)return;const o=new ht(e,de+s,!0),a=Math.floor(1e3*ke.getInstance().getTimeOrigin());o.setStartTime(a),t&&t[0]&&(o.setDuration(Math.floor(1e3*t[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd)));if(n){const e=n.find((e=>"first-paint"===e.name));e&&e.startTime&&o.putMetric("_fp",Math.floor(1e3*e.startTime));const t=n.find((e=>"first-contentful-paint"===e.name));t&&t.startTime&&o.putMetric(fe,Math.floor(1e3*t.startTime)),r&&o.putMetric(pe,Math.floor(1e3*r))}this.addWebVitalMetric(o,ge,"lcp_element",i.lcp),this.addWebVitalMetric(o,ve,"cls_largestShiftTarget",i.cls),this.addWebVitalMetric(o,me,"inp_interactionTarget",i.inp),st(o),Je&&Je.flush()}static addWebVitalMetric(e,t,n,i){i&&(e.putMetric(t,Math.floor(1e3*i.value)),i.elementAttribution&&e.putAttribute(n,i.elementAttribution))}static createUserTimingTrace(e,t){st(new ht(e,t,!1,t))}}let dt,ft={},pt=!1;function gt(e){Re()&&(setTimeout((()=>function(e){const t=ke.getInstance();"onpagehide"in window?t.document.addEventListener("pagehide",(()=>vt(e))):t.document.addEventListener("unload",(()=>vt(e)));t.document.addEventListener("visibilitychange",(()=>{"hidden"===t.document.visibilityState&&vt(e)})),t.onFirstInputDelay&&t.onFirstInputDelay((e=>{dt=e}));t.onLCP((e=>{var t;ft.lcp={value:e.value,elementAttribution:null===(t=e.attribution)||void 0===t?void 0:t.element}})),t.onCLS((e=>{var t;ft.cls={value:e.value,elementAttribution:null===(t=e.attribution)||void 0===t?void 0:t.largestShiftTarget}})),t.onINP((e=>{var t;ft.inp={value:e.value,elementAttribution:null===(t=e.attribution)||void 0===t?void 0:t.interactionTarget}}))}(e)),0),setTimeout((()=>function(e){const t=ke.getInstance(),n=t.getEntriesByType("resource");for(const i of n)ut(e,i);t.setupObserver("resource",(t=>ut(e,t)))}(e)),0),setTimeout((()=>function(e){const t=ke.getInstance(),n=t.getEntriesByType("measure");for(const i of n)mt(e,i);t.setupObserver("measure",(t=>mt(e,t)))}(e)),0))}function mt(e,t){const n=t.name;n.substring(0,21)!==he&&ht.createUserTimingTrace(e,n)}function vt(e){if(!pt){pt=!0;const t=ke.getInstance(),n=t.getEntriesByType("navigation"),i=t.getEntriesByType("paint");setTimeout((()=>{ht.createOobTrace(e,n,i,ft,dt)}),0)}}class yt{constructor(e,t){this.app=e,this.installations=t,this.initialized=!1}_init(e){this.initialized||(void 0!==(null===e||void 0===e?void 0:e.dataCollectionEnabled)&&(this.dataCollectionEnabled=e.dataCollectionEnabled),void 0!==(null===e||void 0===e?void 0:e.instrumentationEnabled)&&(this.instrumentationEnabled=e.instrumentationEnabled),ke.getInstance().requiredApisAvailable()?(0,s.eX)().then((e=>{e&&(Ze||(et(5500),Ze=!0),Ge(this).then((()=>gt(this)),(()=>gt(this))),this.initialized=!0)})).catch((e=>{Ie.info(`Environment doesn't support IndexedDB: ${e}`)})):Ie.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))}set instrumentationEnabled(e){Pe.getInstance().instrumentationEnabled=e}get instrumentationEnabled(){return Pe.getInstance().instrumentationEnabled}set dataCollectionEnabled(e){Pe.getInstance().dataCollectionEnabled=e}get dataCollectionEnabled(){return Pe.getInstance().dataCollectionEnabled}}function wt(e,t){e=(0,s.Ku)(e);const n=(0,oe._getProvider)(e,"performance");if(n.isInitialized()){const e=n.getImmediate(),i=n.getOptions();if((0,s.bD)(i,null!==t&&void 0!==t?t:{}))return e;throw Te.create("already initialized")}return n.initialize({options:t})}const _t=(e,t)=>{let{options:n}=t;const i=e.getProvider("app").getImmediate(),r=e.getProvider("installations-internal").getImmediate();if("[DEFAULT]"!==i.name)throw Te.create("FB not default");if("undefined"===typeof window)throw Te.create("no window");
2!function(e){Se=e}(window);const s=new yt(i,r);return s._init(n),s};(0,oe._registerComponent)(new ae.uA("performance",_t,"PUBLIC")),(0,oe.registerVersion)(ce,ue),(0,oe.registerVersion)(ce,ue,"esm2017")},53906(e,t,n){n.d(t,{LF:()=>P,UK:()=>v,LO:()=>g});var i=n(73507),r=n(51252),s=n(38183),o=n(46954);n(92433);const a="@firebase/remote-config",c="0.6.5";class u{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}const l="remote-config",h={"already-initialized":"Remote Config already initialized","registration-window":"Undefined window object. This SDK only supports usage in a browser environment.","registration-project-id":"Undefined project identifier. Check Firebase app initialization.","registration-api-key":"Undefined API key. Check Firebase app initialization.","registration-app-id":"Undefined app identifier. Check Firebase app initialization.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}.","fetch-client-network":"Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-timeout":'The config fetch request timed out.  Configure timeout using "fetchTimeoutMillis" SDK setting.',"fetch-throttle":'The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',"fetch-client-parse":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","indexed-db-unavailable":"Indexed DB is not supported by current browser","custom-signal-max-allowed-signals":"Setting more than {$maxSignals} custom signals is not supported."},d=new r.FA("remoteconfig","Remote Config",h);const f=["1","true","t","yes","y","on"];class p{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this._source=e,this._value=t}asString(){return this._value}asBoolean(){return"static"!==this._source&&f.indexOf(this._value.toLowerCase())>=0}asNumber(){if("static"===this._source)return 0;let e=Number(this._value);return isNaN(e)&&(e=0),e}getSource(){return this._source}}function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.getApp)(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,s;e=(0,r.Ku)(e);const o=(0,i._getProvider)(e,l);if(o.isInitialized()){const e=o.getOptions();if((0,r.bD)(e,t))return o.getImmediate();throw d.create("already-initialized")}o.initialize({options:t});const a=o.getImmediate();return t.initialFetchResponse&&(a._initializePromise=Promise.all([a._storage.setLastSuccessfulFetchResponse(t.initialFetchResponse),a._storage.setActiveConfigEtag((null===(n=t.initialFetchResponse)||void 0===n?void 0:n.eTag)||""),a._storageCache.setLastSuccessfulFetchTimestampMillis(Date.now()),a._storageCache.setLastFetchStatus("success"),a._storageCache.setActiveConfig((null===(s=t.initialFetchResponse)||void 0===s?void 0:s.config)||{})]).then(),a._isInitializationComplete=!0),a}async function m(e){const t=(0,r.Ku)(e),n=new u;setTimeout((async()=>{n.abort()}),t.settings.fetchTimeoutMillis);const i=t._storageCache.getCustomSignals();i&&t._logger.debug(`Fetching config with custom signals: ${JSON.stringify(i)}`);try{await t._client.fetch({cacheMaxAgeMillis:t.settings.minimumFetchIntervalMillis,signal:n,customSignals:i}),await t._storageCache.setLastFetchStatus("success")}catch(s){const e=function(e,t){return e instanceof r.g&&-1!==e.code.indexOf(t)}(s,"fetch-throttle")?"throttle":"failure";throw await t._storageCache.setLastFetchStatus(e),s}}function v(e){const t=(0,r.Ku)(e);return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(Object.assign(Object.assign({},e),t))}(t._storageCache.getActiveConfig(),t.defaultConfig).reduce(((t,n)=>(t[n]=y(e,n),t)),{})}function y(e,t){const n=(0,r.Ku)(e);
2n._isInitializationComplete||n._logger.debug(`A value was requested for key "${t}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);const i=n._storageCache.getActiveConfig();return i&&void 0!==i[t]?new p("remote",i[t]):n.defaultConfig&&void 0!==n.defaultConfig[t]?new p("default",String(n.defaultConfig[t])):(n._logger.debug(`Returning static value for key "${t}". Define a default or remote value if this is unintentional.`),new p("static"))}class w{constructor(e,t,n,i){this.client=e,this.storage=t,this.storageCache=n,this.logger=i}isCachedDataFresh(e,t){if(!t)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;const n=Date.now()-t,i=n<=e;return this.logger.debug(`Config fetch cache check. Cache age millis: ${n}. Cache max age millis (minimumFetchIntervalMillis setting): ${e}. Is cache hit: ${i}.`),i}async fetch(e){const[t,n]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(n&&this.isCachedDataFresh(e.cacheMaxAgeMillis,t))return n;e.eTag=n&&n.eTag;const i=await this.client.fetch(e),r=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===i.status&&r.push(this.storage.setLastSuccessfulFetchResponse(i)),await Promise.all(r),i}}function _(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator;return e.languages&&e.languages[0]||e.language}class b{constructor(e,t,n,i,r,s){this.firebaseInstallations=e,this.sdkVersion=t,this.namespace=n,this.projectId=i,this.apiKey=r,this.appId=s}async fetch(e){const[t,n]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),i=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,r={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":e.eTag||"*"},s={sdk_version:this.sdkVersion,app_instance_id:t,app_instance_id_token:n,app_id:this.appId,language_code:_(),custom_signals:e.customSignals},o={method:"POST",headers:r,body:JSON.stringify(s)},a=fetch(i,o),c=new Promise(((t,n)=>{e.signal.addEventListener((()=>{const e=new Error("The operation was aborted.");e.name="AbortError",n(e)}))}));let u;try{await Promise.race([a,c]),u=await a}catch(g){let e="fetch-client-network";throw"AbortError"===(null===g||void 0===g?void 0:g.name)&&(e="fetch-timeout"),d.create(e,{originalErrorMessage:null===g||void 0===g?void 0:g.message})}let l=u.status;const h=u.headers.get("ETag")||void 0;let f,p;if(200===u.status){let e;try{e=await u.json()}catch(g){throw d.create("fetch-client-parse",{originalErrorMessage:null===g||void 0===g?void 0:g.message})}f=e.entries,p=e.state}if("INSTANCE_STATE_UNSPECIFIED"===p?l=500:"NO_CHANGE"===p?l=304:"NO_TEMPLATE"!==p&&"EMPTY_CONFIG"!==p||(f={}),304!==l&&200!==l)throw d.create("fetch-status",{httpStatus:l});return{status:l,eTag:h,config:f}}}class T{constructor(e,t){this.client=e,this.storage=t}async fetch(e){const t=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(e,t)}async attemptFetch(e,t){let{throttleEndTimeMillis:n,backoffCount:i}=t;await function(e,t){return new Promise(((n,i)=>{const r=Math.max(t-Date.now(),0),s=setTimeout(n,r);e.addEventListener((()=>{clearTimeout(s),i(d.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(e.signal,n);try{const t=await this.client.fetch(e);return await this.storage.deleteThrottleMetadata(),t}catch(s){if(!function(e){if(!(e instanceof r.g)||!e.customData)return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(s))throw s;const t={throttleEndTimeMillis:Date.now()+(0,r.p9)(i),backoffCount:i+1};return await this.storage.setThrottleMetadata(t),this.attemptFetch(e,t)}}}class I{get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}constructor(e,t,n,i,r){this.app=e,this._client=t,this._storageCache=n,this._storage=i,this._logger=r,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}}function E(e,t){const n=e.target.error||void 0;return d.create(t,{originalErrorMessage:n&&(null===n||void 0===n?void 0:n.message)})}const S="app_namespace_store";class C{getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(e){return this.set("last_fetch_status",e)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(e){return this.set("last_successful_fetch_timestamp_millis",e)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(e){return this.set("last_successful_fetch_response",e)}getActiveConfig(){return this.get("active_config")}setActiveConfig(e){return this.set("active_config",e)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(e){return this.set("active_config_etag",e)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(e){return this.set("throttle_metadata",e)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}getCustomSignals(){return this.get("custom_signals")}}class A extends C{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Promise(((e,t)=>{try{const n=indexedDB.open("firebase_remote_config",1);n.onerror=e=>{t(E(e,"storage-open"))},n.onsuccess=t=>{e(t.target.result)},n.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(S,{keyPath:"compositeKey"})}}catch(n){t(d.create("storage-open",{originalErrorMessage:null===n||void 0===n?void 0:n.message}))}}));super(),this.appId=e,this.appName=t,this.namespace=n,this.openDbPromise=i}async setCustomSignals(e){const t=(await this.openDbPromise).transaction([S],"readwrite"),n=R(e,await this.getWithTransaction("custom_signals",t)||{});return await this.setWithTransaction("custom_signals",n,t),n}async getWithTransaction(e,t){return new Promise(((n,i)=>{const r=t.objectStore(S),s=this.createCompositeKey(e);try{const e=r.get(s);e.onerror=e=>{i(E(e,"storage-get"))},e.onsuccess=e=>{const t=e.target.result;n(t?t.value:void 0)}}catch(o){i(d.create("storage-get",{originalErrorMessage:null===o||void 0===o?void 0:o.message}))}}))}async setWithTransaction(e,t,n){return new Promise(((i,r)=>{const s=n.objectStore(S),o=this.createCompositeKey(e);try{const e=s.put({compositeKey:o,value:t});e.onerror=e=>{r(E(e,"storage-set"))},e.onsuccess=()=>{i()}}catch(a){r(d.create("storage-set",{originalErrorMessage:null===a||void 0===a?void 0:a.message}))}}))}async get(e){const t=(await this.openDbPromise).transaction([S],"readonly");return this.getWithTransaction(e,t)}async set(e,t){const n=(await this.openDbPromise).transaction([S],"readwrite");return this.setWithTransaction(e,t,n)}async delete(e){const t=await this.openDbPromise;return new Promise(((n,i)=>{const r=t.transaction([S],"readwrite").objectStore(S),s=this.createCompositeKey(e);try{const e=r.delete(s);e.onerror=e=>{i(E(e,"storage-delete"))},e.onsuccess=()=>{n()}}catch(o){i(d.create("storage-delete",{originalErrorMessage:null===o||void 0===o?void 0:o.message}))}}))}createCompositeKey(e){return[this.appId,this.appName,this.namespace,e].join()}}class k extends C{constructor(){super(...arguments),this.storage={}}async get(e){return Promise.resolve(this.storage[e])}async set(e,t){return this.storage[e]=t,Promise.resolve(void 0)}async delete(e){return this.storage[e]=void 0,Promise.resolve()}async setCustomSignals(e){const t=this.storage.custom_signals||{};return this.storage.custom_signals=R(e,t),Promise.resolve(this.storage.custom_signals)}}function R(e,t){const n=Object.assign(Object.assign({},t),e),i=Object.fromEntries(Object.entries(n).filter((e=>{let[t,n]=e;return null!==n})).map((e=>{let[t,n]=e;return"number"===typeof n?[t,n.toString()]:[t,n]})));if(Object.keys(i).length>100)throw d.create("custom-signal-max-allowed-signals",{maxSignals:100});return i}class N{constructor(e){this.storage=e}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}getCustomSignals(){return this.customSignals}async loadFromStorage(){const e=this.storage.getLastFetchStatus(),t=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),i=this.storage.getCustomSignals(),r=await e;r&&(this.lastFetchStatus=r);const s=await t;s&&(this.lastSuccessfulFetchTimestampMillis=s);const o=await n;o&&(this.activeConfig=o);const a=await i;a&&(this.customSignals=a)}setLastFetchStatus(e){return this.lastFetchStatus=e,this.storage.setLastFetchStatus(e)}setLastSuccessfulFetchTimestampMillis(e){return this.lastSuccessfulFetchTimestampMillis=e,this.storage.setLastSuccessfulFetchTimestampMillis(e)}setActiveConfig(e){return this.activeConfig=e,this.storage.setActiveConfig(e)}async setCustomSignals(e){this.customSignals=await this.storage.setCustomSignals(e)}}async function P(e){return e=(0,r.Ku)(e),await m(e),async function(e){const t=(0,r.Ku)(e),[n,i]=await Promise.all([t._storage.getLastSuccessfulFetchResponse(),t._storage.getActiveConfigEtag()]);return!!(n&&n.config&&n.eTag&&n.eTag!==i)&&(await Promise.all([t._storageCache.setActiveConfig(n.config),t._storage.setActiveConfigEtag(n.eTag)]),!0)}(e)}(0,i._registerComponent)(new s.uA(l,(function(e,t){let{options:n}=t;const s=e.getProvider("app").getImmediate(),c=e.getProvider("installations-internal").getImmediate(),{projectId:u,apiKey:l,appId:h}=s.options;if(!u)throw d.create("registration-project-id");if(!l)throw d.create("registration-api-key");if(!h)throw d.create("registration-app-id");const f=(null===n||void 0===n?void 0:n.templateId)||"firebase",p=(0,r.zW)()?new A(h,s.name,f):new k,g=new N(
2p),m=new o.Vy(a);m.logLevel=o.$b.ERROR;const v=new b(c,i.SDK_VERSION,f,u,l,h),y=new T(v,p),_=new w(y,p,g,m),E=new I(s,_,g,p,m);return function(e){const t=(0,r.Ku)(e);t._initializePromise||(t._initializePromise=t._storageCache.loadFromStorage().then((()=>{t._isInitializationComplete=!0}))),t._initializePromise}(E),E}),"PUBLIC").setMultipleInstances(!0)),(0,i.registerVersion)(a,c),(0,i.registerVersion)(a,c,"esm2017")},3573(e,t,n){n.d(t,{nb:()=>Me,c7:()=>Le,KR:()=>De,bp:()=>Oe});var i=n(73507),r=n(51252),s=n(38183);const o="firebasestorage.googleapis.com",a="storageBucket";class c extends r.g{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(h(e),`Firebase Storage: ${t} (${h(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,c.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return h(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var u,l;function h(e){return"storage/"+e}function d(){return new c(u.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function f(){return new c(u.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function p(){return new c(u.CANCELED,"User canceled the upload/download.")}function g(){return new c(u.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function m(e){return new c(u.INVALID_ARGUMENT,e)}function v(){return new c(u.APP_DELETED,"The Firebase app was deleted.")}function y(e,t){return new c(u.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function w(e){throw new c(u.INTERNAL_ERROR,"Internal error: "+e)}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(u||(u={}));class _{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=_.makeFromUrl(e,t)}catch(r){return new _(e,"")}if(""===n.path)return n;throw i=e,new c(u.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+i+"'.");var i}static makeFromUrl(e,t){let n=null;const i="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+i+"(/(.*))?$","i");function s(e){e.path_=decodeURIComponent(e.path)}const a=t.replace(/[.]/g,"\\."),l=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${a}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:s},{regex:new RegExp(`^https?://${t===o?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${i}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:s}];for(let o=0;o<l.length;o++){const t=l[o],i=t.regex.exec(e);if(i){const e=i[t.indices.bucket];let r=i[t.indices.path];r||(r=""),n=new _(e,r),t.postModify(n);break}}if(null==n)throw function(e){return new c(u.INVALID_URL,"Invalid URL '"+e+"'.")}(e);return n}}class b{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(){}}function T(e){return"string"===typeof e||e instanceof String}function I(e){return E()&&e instanceof Blob}function E(){return"undefined"!==typeof Blob}function S(e,t,n,i){if(i<t)throw m(`Invalid value for '${e}'. Expected ${t} or greater.`);if(i>n)throw m(`Invalid value for '${e}'. Expected ${n} or less.`)}
2function C(e,t,n){let i=t;return null==n&&(i=`https://${t}`),`${n}://${i}/v0${e}`}function A(e){const t=encodeURIComponent;let n="?";for(const i in e)if(e.hasOwnProperty(i)){n=n+(t(i)+"="+t(e[i]))+"&"}return n=n.slice(0,-1),n}function k(e,t){const n=e>=500&&e<600,i=-1!==[408,429].indexOf(e),r=-1!==t.indexOf(e);return n||i||r}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(l||(l={}));class R{constructor(e,t,n,i,r,s,o,a,c,u,l){let h=!(arguments.length>11&&void 0!==arguments[11])||arguments[11],d=arguments.length>12&&void 0!==arguments[12]&&arguments[12];this.url_=e,this.method_=t,this.headers_=n,this.body_=i,this.successCodes_=r,this.additionalRetryCodes_=s,this.callback_=o,this.errorCallback_=a,this.timeout_=c,this.progressCallback_=u,this.connectionFactory_=l,this.retry=h,this.isUsingEmulator=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise(((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()}))}start_(){const e=(e,t)=>{if(t)return void e(!1,new N(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const i=e=>{const t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then((()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;const t=n.getErrorCode()===l.NO_ERROR,r=n.getStatus();if(!t||k(r,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===l.ABORT;return void e(!1,new N(!1,null,t))}const s=-1!==this.successCodes_.indexOf(r);e(!0,new N(s,n))}))},t=(e,t)=>{const n=this.resolve_,i=this.reject_,r=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(r,r.getResponse());void 0!==e?n(e):n()}catch(s){i(s)}else if(null!==r){const e=d();e.serverResponse=r.getErrorText(),this.errorCallback_?i(this.errorCallback_(r,e)):i(e)}else if(t.canceled){i(this.appDelete_?v():p())}else{i(f())}};this.canceled_?t(0,new N(!1,null,!0)):this.backoffId_=function(e,t,n){let i=1,r=null,s=null,o=!1,a=0;function c(){return 2===a}let u=!1;function l(){if(!u){u=!0;for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];t.apply(null,n)}}function h(t){r=setTimeout((()=>{r=null,e(f,c())}),t)}function d(){s&&clearTimeout(s)}function f(e){if(u)return void d();for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(e)return d(),void l.call(null,e,...n);if(c()||o)return d(),void l.call(null,e,...n);let s;i<64&&(i*=2),1===a?(a=2,s=0):s=1e3*(i+Math.random()),h(s)}let p=!1;function g(e){p||(p=!0,d(),u||(null!==r?(e||(a=2),clearTimeout(r),h(0)):e||(a=1)))}return h(0),s=setTimeout((()=>{o=!0,g(!0)}),n),g}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class N{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function P(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function O(){const e=P();for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(void 0!==e){const t=new e;for(let e=0;e<n.length;e++)t.append(n[e]);return t.getBlob()}if(E())return new Blob(n);throw new c(u.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function D(e){if("undefined"===typeof atob)throw t="base-64",new c(u.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var t;return atob(e)}const L="raw",M="base64",x="base64url",F="data_url";class U{constructor(e,t){this.data=e,this.contentType=t||null}}function V(e,t){switch(e){case L:return new U(j(t));case M:case x:return new U(q(e,t));case F:return new U(function(e){const t=new B(e);return t.base64?q(M,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(n){throw y(F,"Malformed data URL.")}return j(t)}(t.rest)}(t),new B(t).contentType)}throw d()}function j(e){const t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>6,128|63&i);else if(55296===(64512&i)){if(n<e.length-1&&56320===(64512&e.charCodeAt(n+1))){i=65536|(1023&i)<<10|1023&e.charCodeAt(++n),t.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i)}else t.push(239,191,189)}else 56320===(64512&i)?t.push(239,191,189):t.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(t)}function q(e,t){switch(e){case M:{const n=-1!==t.indexOf("-"),i=-1!==t.indexOf("_");if(n||i){throw y(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case x:{const n=-1!==t.indexOf("+"),i=-1!==t.indexOf("/");if(n||i){throw y(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=D(t)}
2catch(r){if(r.message.includes("polyfill"))throw r;throw y(e,"Invalid character found")}const i=new Uint8Array(n.length);for(let s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return i}class B{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(null===t)throw y(F,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=t[1]||null;null!=n&&(this.base64=function(e,t){if(!(e.length>=t.length))return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(",")+1)}}class z{constructor(e,t){let n=0,i="";I(e)?(this.data_=e,n=e.size,i=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=i}size(){return this.size_}type(){return this.type_}slice(e,t){if(I(this.data_)){const n=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,e,t);return null===n?null:new z(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new z(n,!0)}}static getBlob(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(E()){const e=t.map((e=>e instanceof z?e.data_:e));return new z(O.apply(null,e))}{const e=t.map((e=>T(e)?V(L,e).data:e.data_));let n=0;e.forEach((e=>{n+=e.byteLength}));const i=new Uint8Array(n);let r=0;return e.forEach((e=>{for(let t=0;t<e.length;t++)i[r++]=e[t]})),new z(i,!0)}}uploadData(){return this.data_}}function $(e){let t;try{t=JSON.parse(e)}catch(i){return null}return"object"!==typeof(n=t)||Array.isArray(n)?null:t;var n}function K(e){const t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function H(e,t){return t}class W{constructor(e,t,n,i){this.server=e,this.local=t||e,this.writable=!!n,this.xform=i||H}}let G=null;function Q(){if(G)return G;const e=[];e.push(new W("bucket")),e.push(new W("generation")),e.push(new W("metageneration")),e.push(new W("name","fullPath",!0));const t=new W("name");t.xform=function(e,t){return function(e){return!T(e)||e.length<2?e:K(e)}(t)},e.push(t);const n=new W("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new W("timeCreated")),e.push(new W("updated")),e.push(new W("md5Hash",null,!0)),e.push(new W("cacheControl",null,!0)),e.push(new W("contentDisposition",null,!0)),e.push(new W("contentEncoding",null,!0)),e.push(new W("contentLanguage",null,!0)),e.push(new W("contentType",null,!0)),e.push(new W("metadata","customMetadata",!0)),G=e,G}function J(e,t,n){const i={type:"file"},r=n.length;for(let s=0;s<r;s++){const e=n[s];i[e.local]=e.xform(i,t[e.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){const n=e.bucket,i=e.fullPath,r=new _(n,i);return t._makeStorageReference(r)}})}(i,e),i}function X(e,t,n){const i=$(t);if(null===i)return null;return J(e,i,n)}function Y(e,t){const n={},i=t.length;for(let r=0;r<i;r++){const i=t[r];i.writable&&(n[i.server]=e[i.local])}return JSON.stringify(n)}class Z{constructor(e,t,n,i){this.url=e,this.method=t,this.handler=n,this.timeout=i,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function ee(e){if(!e)throw d()}function te(e,t){return function(n,i){const r=X(e,i,t);return ee(null!==r),r}}function ne(e){return function(t,n){let i;var r,s;return 401===t.getStatus()?i=t.getErrorText().includes("Firebase App Check token is invalid")?new c(u.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new c(u.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(s=e.bucket,i=new c(u.QUOTA_EXCEEDED,"Quota for bucket '"+s+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=e.path,i=new c(u.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):i=n,i.status=t.getStatus(),i.serverResponse=n.serverResponse,i}}function ie(e){const t=ne(e);return function(n,i){let r=t(n,i);var s;
2return 404===n.getStatus()&&(s=e.path,r=new c(u.OBJECT_NOT_FOUND,"Object '"+s+"' does not exist.")),r.serverResponse=i.serverResponse,r}}function re(e,t,n){const i=C(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,s=new Z(i,"GET",te(e,n),r);return s.errorHandler=ie(t),s}function se(e,t,n){const i=Object.assign({},n);return i.fullPath=e.path,i.size=t.size(),i.contentType||(i.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),i}function oe(e,t,n,i,r){const s=t.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};const a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();o["Content-Type"]="multipart/related; boundary="+a;const c=se(t,i,r),u="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+Y(c,n)+"\r\n--"+a+"\r\nContent-Type: "+c.contentType+"\r\n\r\n",l="\r\n--"+a+"--",h=z.getBlob(u,i,l);if(null===h)throw g();const d={name:c.fullPath},f=C(s,e.host,e._protocol),p=e.maxUploadRetryTime,m=new Z(f,"POST",te(e,n),p);return m.urlParams=d,m.headers=o,m.body=h.uploadData(),m.errorHandler=ne(t),m}class ae{constructor(e,t,n,i){this.current=e,this.total=t,this.finalized=!!n,this.metadata=i||null}}function ce(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(i){ee(!1)}return ee(!!n&&-1!==(t||["active"]).indexOf(n)),n}const ue=262144;function le(e,t,n,i,r,s,o,a){const l=new ae(0,0);if(o?(l.current=o.current,l.total=o.total):(l.current=0,l.total=i.size()),i.size()!==l.total)throw new c(u.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const h=l.total-l.current;let d=h;r>0&&(d=Math.min(d,r));const f=l.current,p=f+d;let m="";m=0===d?"finalize":h===d?"upload, finalize":"upload";const v={"X-Goog-Upload-Command":m,"X-Goog-Upload-Offset":`${l.current}`},y=i.slice(f,p);if(null===y)throw g();const w=t.maxUploadRetryTime,_=new Z(n,"POST",(function(e,n){const r=ce(e,["active","final"]),o=l.current+d,a=i.size();let c;return c="final"===r?te(t,s)(e,n):null,new ae(o,a,"final"===r,c)}),w);return _.headers=v,_.body=y.uploadData(),_.progressCallback=a||null,_.errorHandler=ne(e),_}const he="running",de="paused",fe="success",pe="canceled",ge="error";function me(e){switch(e){case"running":case"pausing":case"canceling":return he;case"paused":return de;case"success":return fe;case"canceled":return pe;default:return ge}}class ve{constructor(e,t,n){if("function"===typeof e||null!=t||null!=n)this.next=e,this.error=null!==t&&void 0!==t?t:void 0,this.complete=null!==n&&void 0!==n?n:void 0;else{const t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}}function ye(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];Promise.resolve().then((()=>e(...n)))}}class we{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=l.NO_ERROR,this.sendPromise_=new Promise((e=>{this.xhr_.addEventListener("abort",(()=>{this.errorCode_=l.ABORT,e()})),this.xhr_.addEventListener("error",(()=>{this.errorCode_=l.NETWORK_ERROR,e()})),this.xhr_.addEventListener("load",(()=>{e()}))}))}send(e,t,n,i,s){if(this.sent_)throw w("cannot .send() more than once");if((0,r.zJ)(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==s)for(const r in s)s.hasOwnProperty(r)&&this.xhr_.setRequestHeader(r,s[r].toString());return void 0!==i?this.xhr_.send(i):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw w("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw w("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw w("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw w("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class _e extends we{initXhr(){this.xhr_.responseType="text"}}function be(){return new _e}class Te{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=Q(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(u.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(k(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=f()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(u.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t,this._start()})),this._promise.then(null,(()=>{}))}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout((()=>{this.pendingTimeout=void 0,this._continueUpload()}),this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then((t=>{let[n,i]=t;switch(this._state){case"running":e(n,i);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}}))}_createResumable(){this._resolveToken(((e,t)=>{const n=function(e,t,n,i,r){const s=t.bucketOnlyServerUrl(),o=se(t,i,r),a={name:o.fullPath},c=C(s,e.host,e._protocol),u={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${i.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=Y(o,n),h=e.maxUploadRetryTime,d=new Z(c,"POST",(function(e){let t;ce(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(n){ee(!1)}return ee(T(t)),t}),h);
2return d.urlParams=a,d.headers=u,d.body=l,d.errorHandler=ne(t),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,be,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()}),this._errorHandler)}))}_fetchStatus(){const e=this._uploadUrl;this._resolveToken(((t,n)=>{const i=function(e,t,n,i){const r=e.maxUploadRetryTime,s=new Z(n,"POST",(function(e){const t=ce(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(s){ee(!1)}n||ee(!1);const r=Number(n);return ee(!isNaN(r)),new ae(r,i.size(),"final"===t)}),r);return s.headers={"X-Goog-Upload-Command":"query"},s.errorHandler=ne(t),s}(this._ref.storage,this._ref._location,e,this._blob),r=this._ref.storage._makeRequest(i,be,t,n);this._request=r,r.getPromise().then((e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()}),this._errorHandler)}))}_continueUpload(){const e=ue*this._chunkMultiplier,t=new ae(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken(((i,r)=>{let s;try{s=le(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(a){return this._error=a,void this._transition("error")}const o=this._ref.storage._makeRequest(s,be,i,r,!1);this._request=o,o.getPromise().then((e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()}),this._errorHandler)}))}_increaseMultiplier(){2*(ue*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken(((e,t)=>{const n=re(this._ref.storage,this._ref._location,this._mappings),i=this._ref.storage._makeRequest(n,be,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._metadata=e,this._transition("success")}),this._metadataErrorHandler)}))}_oneShotUpload(){this._resolveToken(((e,t)=>{const n=oe(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,be,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")}),this._errorHandler)}))}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=p(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const e=me(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,i){const r=new ve(t||void 0,n||void 0,i||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach((e=>{this._notifyObserver(e)}))}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(me(this._state)){case fe:ye(this._resolve.bind(null,this.snapshot))();break;case pe:case ge:ye(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(me(this._state)){case he:case de:e.next&&ye(e.next.bind(e,this.snapshot))();break;case fe:e.complete&&ye(e.complete.bind(e))();break;default:e.error&&ye(e.error.bind(e,this._error))()}}resume(){const e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){const e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){const e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class Ie{constructor(e,t){this._service=e,this._location=t instanceof _?t:_.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Ie(e,t)}get root(){const e=new _(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return K(this._location.path)}get storage(){return this._service}get parent(){const e=function(e){if(0===e.length)return null;const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;const t=new _(this._location.bucket,e);return new Ie(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new c(u.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(e)}}function Ee(e,t){const n=function(e,t){const n=t.split("/").filter((e=>e.length>0)).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),i=new _(e._location.bucket,n);return new Ie(e.storage,i)}function Se(e,t){if(e instanceof ke){const n=e;if(null==n._bucket)throw new c(u.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+a+"' property when initializing the app?");const i=new Ie(n,n._bucket);return null!=t?Se(i,t):i}return void 0!==t?Ee(e,t):e}function Ce(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof ke)return new Ie(e,t);throw m("To use ref(service, url), the first argument must be a Storage instance.")}return Se(e,t)}function Ae(e,t){const n=null===t||void 0===t?void 0:t[a];return null==n?null:_.makeFromBucketSpec(n,e)}class ke{constructor(e,t,n,i,r){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=i,this._firebaseVersion=r,this._isUsingEmulator=s,this._bucket=null,this._host=o,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=i?_.makeFromBucketSpec(i,this._host):Ae(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=_.makeFromBucketSpec(this._url,e):this._bucket=Ae(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){S("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){S("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){if((0,i._isFirebaseServerApp)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});if(e){return(await e.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEac
2h((e=>e.cancel())),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Ie(this,e)}_makeRequest(e,t,n,i){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(this._deleted)return new b(v());{const s=function(e,t,n,i,r,s){let o=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];const c=A(e.urlParams),u=e.url+c,l=Object.assign({},e.headers);return function(e,t){t&&(e["X-Firebase-GMPID"]=t)}(l,t),function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(l,n),function(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(null!==t&&void 0!==t?t:"AppManager")}(l,s),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(l,i),new R(u,e.method,l,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,o,a)}(e,this._appId,n,i,t,this._firebaseVersion,r,this._isUsingEmulator);return this._requests.add(s),s.getPromise().then((()=>this._requests.delete(s)),(()=>this._requests.delete(s))),s}}async makeRequestWithTokens(e,t){const[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,i).getPromise()}}const Re="@firebase/storage",Ne="0.13.14",Pe="storage";function Oe(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new Te(e,new z(t),n)}(e=(0,r.Ku)(e),t,n)}function De(e,t){return Ce(e=(0,r.Ku)(e),t)}function Le(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,i.getApp)(),t=arguments.length>1?arguments[1]:void 0;e=(0,r.Ku)(e);const n=(0,i._getProvider)(e,Pe).getImmediate({identifier:t}),s=(0,r.yU)("storage");return s&&Me(n,...s),n}function Me(e,t,n){!function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e.host=`${t}:${n}`;const s=(0,r.zJ)(t);s&&((0,r.gE)(`https://${e.host}/b`),(0,r.P1)("Storage",!0)),e._isUsingEmulator=!0,e._protocol=s?"https":"http";const{mockUserToken:o}=i;o&&(e._overrideAuthToken="string"===typeof o?o:(0,r.Fy)(o,e.app.options.projectId))}(e,t,n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:{})}function xe(e,t){let{instanceIdentifier:n}=t;const r=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),o=e.getProvider("app-check-internal");return new ke(r,s,o,n,i.SDK_VERSION)}(0,i._registerComponent)(new s.uA(Pe,xe,"PUBLIC").setMultipleInstances(!0)),(0,i.registerVersion)(Re,Ne,""),(0,i.registerVersion)(Re,Ne,"esm2017")}}]);

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.