fleetbo-svro 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- var R=(t,o)=>()=>{try{return o||t((o={exports:{}}).exports,o),o.exports}catch(r){throw o=0,r}};var j=R((re,k)=>{var b=require("fs"),p=require("path"),J=require("https"),{execSync:L}=require("child_process"),$="\x1B[38;2;231;233;237m",D="\x1B[31m",x="\x1B[0m";function f(t){console.log(` ${$}${t}${x}`)}function d(t){console.error(` ${D}${t}${x}`)}function A(t){let o={};return t.forEach(r=>{if(r.startsWith("--")){let[s,l]=r.slice(2).split("=");s&&l&&(o[s]=l)}}),o}function E(t,o){try{let r=JSON.parse(b.readFileSync(t,"utf8"));return!!(r.dependencies&&r.dependencies[o]||r.devDependencies&&r.devDependencies[o])}catch{return!1}}function N(t,o){if(!E(o,"fleetbo-svro")){f("\u2192 Installing fleetbo-svro into the project...");try{L("npm install fleetbo-svro",{cwd:t,stdio:"inherit"}),f("fleetbo-svro installed successfully!")}catch{d("\u26A0\uFE0F Automatic installation failed. Please run 'npm install fleetbo-svro' manually.")}}}function U(t){let o=p.join(t,"svro.schema.json");if(b.existsSync(o))return;let r=new Date().toISOString(),s={createdAt:r,patchedAt:r,schemaVersion:1,collections:{}};b.writeFileSync(o,JSON.stringify(s,null,2)+`
3
- `),f("\u2192 Created svro.schema.json at project root.")}function B(t){let o=p.join(t,"src");if(!b.existsSync(o))return;let r=p.join(o,"auto-imports.d.ts");if(b.existsSync(r))return;let s=`/* eslint-disable */
2
+ var J=(t,o)=>()=>{try{return o||t((o={exports:{}}).exports,o),o.exports}catch(n){throw o=0,n}};var _=J((le,k)=>{var c=require("fs"),p=require("path"),$=require("https"),{execSync:L}=require("child_process"),A="\x1B[38;2;231;233;237m",D="\x1B[31m",T="\x1B[0m";function f(t){console.log(` ${A}${t}${T}`)}function d(t){console.error(` ${D}${t}${T}`)}function N(t){let o={};return t.forEach(n=>{if(n.startsWith("--")){let[s,l]=n.slice(2).split("=");s&&l&&(o[s]=l)}}),o}function S(t,o){try{let n=JSON.parse(c.readFileSync(t,"utf8"));return!!(n.dependencies&&n.dependencies[o]||n.devDependencies&&n.devDependencies[o])}catch{return!1}}function U(t,o){if(!S(o,"fleetbo-svro")){f("\u2192 Installing fleetbo-svro into the project...");try{L("npm install fleetbo-svro",{cwd:t,stdio:"inherit"}),f("fleetbo-svro installed successfully!")}catch{d("\u26A0\uFE0F Automatic installation failed. Please run 'npm install fleetbo-svro' manually.")}}}function B(t){let o=p.join(t,"svro.schema.json");if(c.existsSync(o))return;let n=new Date().toISOString(),s={createdAt:n,patchedAt:n,schemaVersion:1,collections:{}};c.writeFileSync(o,JSON.stringify(s,null,2)+`
3
+ `),f("\u2192 Created svro.schema.json at project root.")}function M(t){let o=p.join(t,"src");if(!c.existsSync(o))return;let n=p.join(o,"auto-imports.d.ts");if(c.existsSync(n))return;let s=`/* eslint-disable */
4
4
  /* prettier-ignore */
5
5
  // @ts-nocheck
6
6
  // Generated by fleetbo-svro setup
@@ -110,23 +110,31 @@ declare module 'svelte/elements' {
110
110
  'fleetbo-reference': FleetboProp;
111
111
  }
112
112
  }
113
- `;try{b.writeFileSync(r,s),f("\u2192 Created src/auto-imports.d.ts stub for instant IDE auto-completion.")}catch(l){d(`\u26A0\uFE0F Unable to create src/auto-imports.d.ts: ${l.message}`)}}function M(t){let o=p.join(t,"index.d.ts");b.existsSync(o)||f("\u2192 Verified index.d.ts presence.")}function q(t){let o=["tsconfig.json","jsconfig.json"];for(let r of o){let s=p.join(t,r);if(b.existsSync(s)){let l=new Date;b.utimesSync(s,l,l);break}}}function H(t){return new Promise((o,r)=>{let s=JSON.stringify({token:t}),l={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},c=J.request(l,e=>{let i="";e.on("data",n=>{i+=n}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{o(JSON.parse(i))}catch{r(new Error("Invalid response received from Fleetbo server."))}else try{let n=JSON.parse(i);r(new Error(n.error||`Server error ${e.statusCode}`))}catch{r(new Error(`Server error ${e.statusCode}`))}})});c.on("error",e=>r(e)),c.write(s),c.end()})}async function V(t,o=[]){let r=p.join(t,".env");if(b.existsSync(r)&&b.readFileSync(r,"utf8").includes("VITE_FLEETBO_DB_KEY")){f("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let s=A(o),l=s.keyApp,c=s.token||s.bootstrapToken,e=s.email||"";(!l||!c)&&(d("\u26A0\uFE0F Missing required parameters."),d("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),f("\u2192 Exchanging bootstrap token for project keys...");let i;try{i=await H(c)}catch(a){d(`\u26A0\uFE0F Token exchange failed: ${a.message}`),d("\u{1F449} The token may have expired (15 min limit) or was already used. Please regenerate one from the Fleetbo dashboard."),process.exit(1)}(!i.enterpriseId||!i.fleetboDBKey)&&(d("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let n=`
114
- VITE_FLEETBO_DB_KEY=${i.fleetboDBKey}
115
- VITE_FLEETBO_ENTERPRISE_ID=${i.enterpriseId}
113
+ `;try{c.writeFileSync(n,s),f("\u2192 Created src/auto-imports.d.ts stub for instant IDE auto-completion.")}catch(l){d(`\u26A0\uFE0F Unable to create src/auto-imports.d.ts: ${l.message}`)}}function q(t){let o=p.join(t,"index.d.ts");c.existsSync(o)||f("\u2192 Verified index.d.ts presence.")}function V(t){let o=["tsconfig.json","jsconfig.json"];for(let n of o){let s=p.join(t,n);if(c.existsSync(s)){let l=new Date;c.utimesSync(s,l,l);break}}}function H(t){return new Promise((o,n)=>{let s=JSON.stringify({token:t}),l={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},i=$.request(l,e=>{let a="";e.on("data",r=>{a+=r}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{o(JSON.parse(a))}catch{n(new Error("Invalid response received from Fleetbo server."))}else try{let r=JSON.parse(a);n(new Error(r.error||`Server error ${e.statusCode}`))}catch{n(new Error(`Server error ${e.statusCode}`))}})});i.on("error",e=>n(e)),i.write(s),i.end()})}async function W(t,o=[]){let n=p.join(t,".env");if(c.existsSync(n)&&c.readFileSync(n,"utf8").includes("VITE_FLEETBO_DB_KEY")){f("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let s=N(o),l=s.keyApp,i=s.token||s.bootstrapToken,e=s.email||"";(!l||!i)&&(d("\u26A0\uFE0F Missing required parameters."),d("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),f("\u2192 Exchanging bootstrap token for project keys...");let a;try{a=await H(i)}catch(b){d(`\u26A0\uFE0F Token exchange failed: ${b.message}`),d("\u{1F449} The token may have expired (15 min limit) or was already used. Please regenerate one from the Fleetbo dashboard."),process.exit(1)}(!a.enterpriseId||!a.fleetboDBKey)&&(d("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let r=`
114
+ VITE_FLEETBO_DB_KEY=${a.fleetboDBKey}
115
+ VITE_FLEETBO_ENTERPRISE_ID=${a.enterpriseId}
116
116
  VITE_FLEETBO_KEY_APP=${l}
117
117
  ${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
118
- `:""}`;b.appendFileSync(r,n),f(".env file updated successfully with Fleetbo keys!")}function I(t){let o=p.join(t,"svro.d.ts");if(b.existsSync(o))try{b.unlinkSync(o),f("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function O(t,o){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let r=p.join(t,"tsconfig.json"),s=p.join(t,"jsconfig.json"),l=b.existsSync(r)?r:s,c=!b.existsSync(l),e={};if(!c)try{e=JSON.parse(b.readFileSync(l,"utf8"))}catch{d(`\u26A0\uFE0F Unable to read ${p.basename(l)} (Invalid JSON).`);return}e.compilerOptions=e.compilerOptions||{};let i=!1,n=E(o,"react"),a=E(o,"vite");c?(e.compilerOptions.checkJs=!0,e.compilerOptions.allowJs=!0,e.compilerOptions.target=e.compilerOptions.target||"ES2020",e.compilerOptions.module=e.compilerOptions.module||"ESNext",e.compilerOptions.moduleResolution=e.compilerOptions.moduleResolution||"bundler",e.include=e.include||["src"],i=!0):(e.compilerOptions.checkJs===void 0&&(e.compilerOptions.checkJs=!0,i=!0),e.compilerOptions.allowJs===void 0&&(e.compilerOptions.allowJs=!0,i=!0)),n&&e.compilerOptions.jsx===void 0&&(e.compilerOptions.jsx="react-jsx",i=!0),a&&e.compilerOptions.types===void 0&&(e.compilerOptions.types=["vite/client"],i=!0),i&&(b.writeFileSync(l,JSON.stringify(e,null,2)+`
119
- `),f(`\u2192 Updated ${p.basename(l)}.`))}function w(t,o){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let s=["vite.config.ts","vite.config.js","vite.config.mjs"].map(n=>p.join(t,n)).find(n=>b.existsSync(n));if(!s)return;let l;try{l=b.readFileSync(s,"utf8")}catch{return}let c="fleetbo-svro",e=l,i=`{
120
- name: 'fleetbo-schema-sync-middleware',
121
- transformIndexHtml() {
122
- return [
123
- {
124
- tag: 'script',
125
- attrs: { type: 'module' },
126
- children: "import 'fleetbo-svro';",
127
- injectTo: 'head-prepend'
128
- }
129
- ];
118
+ `:""}`;c.appendFileSync(n,r),f(".env file updated successfully with Fleetbo keys!")}function I(t){let o=p.join(t,"svro.d.ts");if(c.existsSync(o))try{c.unlinkSync(o),f("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function O(t,o){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let n=p.join(t,"tsconfig.json"),s=p.join(t,"jsconfig.json"),l=c.existsSync(n)?n:s,i=!c.existsSync(l),e={};if(!i)try{e=JSON.parse(c.readFileSync(l,"utf8"))}catch{d(`\u26A0\uFE0F Unable to read ${p.basename(l)} (Invalid JSON).`);return}e.compilerOptions=e.compilerOptions||{};let a=!1,r=S(o,"react"),b=S(o,"vite");i?(e.compilerOptions.checkJs=!0,e.compilerOptions.allowJs=!0,e.compilerOptions.target=e.compilerOptions.target||"ES2020",e.compilerOptions.module=e.compilerOptions.module||"ESNext",e.compilerOptions.moduleResolution=e.compilerOptions.moduleResolution||"bundler",e.include=e.include||["src"],a=!0):(e.compilerOptions.checkJs===void 0&&(e.compilerOptions.checkJs=!0,a=!0),e.compilerOptions.allowJs===void 0&&(e.compilerOptions.allowJs=!0,a=!0)),r&&e.compilerOptions.jsx===void 0&&(e.compilerOptions.jsx="react-jsx",a=!0),b&&e.compilerOptions.types===void 0&&(e.compilerOptions.types=["vite/client"],a=!0),a&&(c.writeFileSync(l,JSON.stringify(e,null,2)+`
119
+ `),f(`\u2192 Updated ${p.basename(l)}.`))}function j(t){let o=["src/app/layout.tsx","src/app/layout.jsx","app/layout.tsx","app/layout.jsx","src/pages/_app.tsx","src/pages/_app.jsx","pages/_app.tsx","pages/_app.jsx","src/main.tsx","src/main.jsx","src/main.ts","src/main.js","src/index.tsx","src/index.jsx","src/index.ts","src/index.js","src/App.tsx","src/App.jsx","src/App.vue","app.vue","src/routes/+layout.svelte","src/routes/+layout.ts","src/main.singletons.ts"];for(let s of o){let l=p.join(t,s);if(c.existsSync(l)){let i=c.readFileSync(l,"utf8");i.includes("fleetbo-svro")||(i.startsWith('"use client"')||i.startsWith("'use client'")?i=i.replace(/(['"]use client['"];?\r?\n)/,`$1import 'fleetbo-svro';
120
+ `):i=`import 'fleetbo-svro';
121
+ `+i,c.writeFileSync(l,i),f(`\u2192 Injected automatic runtime import into ${s}`));return}}let n=[p.join(t,"index.html"),p.join(t,"public","index.html")];for(let s of n)if(c.existsSync(s)){let l=c.readFileSync(s,"utf8");l.includes("fleetbo-svro")||(l=l.replace("<head>",`<head>
122
+ <script type="module">import "fleetbo-svro";</script>`),c.writeFileSync(s,l),f(`\u2192 Injected runtime script into ${p.relative(t,s)}`));return}}function w(t,o){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let s=["vite.config.ts","vite.config.js","vite.config.mjs"].map(r=>p.join(t,r)).find(r=>c.existsSync(r));if(!s)return;let l;try{l=c.readFileSync(s,"utf8")}catch{return}let i="fleetbo-svro",e=l,a=`{
123
+ name: 'fleetbo-auto-runtime',
124
+ transformIndexHtml(html) {
125
+ if (!html.includes('fleetbo-svro')) {
126
+ return html.replace('<head>', '<head>\\n <script type="module">import "fleetbo-svro";</script>');
127
+ }
128
+ return html;
129
+ },
130
+ transform(code, id) {
131
+ if (!id.includes('node_modules') && !code.includes('fleetbo-svro') && /(src[\\\\/](main|index|App|root))\\.(jsx?|tsx?|vue|svelte)/i.test(id)) {
132
+ return {
133
+ code: "import 'fleetbo-svro';\\n" + code,
134
+ map: null
135
+ };
136
+ }
137
+ return null;
130
138
  },
131
139
  configureServer(server) {
132
140
  server.middlewares.use('/__fleetbo_sync_schema', (req, res) => {
@@ -169,22 +177,22 @@ ${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
169
177
  watch: {
170
178
  ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts']
171
179
  }
172
- },`))),e.includes("unplugin-auto-import"))e.includes("fleetbo-svro")&&!e.includes("FleetboUI")&&(e=e.replace(/imports\s*:\s*\[\s*\{\s*['"]fleetbo-svro(?:|\/vue)['"]\s*:\s*\[[^\]]*\]\s*\}\s*\]/g,`imports: [{ '${c}': ['Fleetbo'] }]`));else{let n=e.match(/plugins\s*:\s*\[/);if(n){let a=n.index+n[0].length,P=`
180
+ },`))),!e.includes("unplugin-auto-import")){let r=e.match(/plugins\s*:\s*\[/);if(r){let b=r.index+r[0].length,P=`
173
181
  AutoImport({
174
- imports: [{ '${c}': ['Fleetbo'] }],
182
+ imports: [{ '${i}': ['Fleetbo'] }],
175
183
  dts: 'src/auto-imports.d.ts'
176
- }),`;if(e=e.slice(0,a)+P+e.slice(a),!e.includes("import AutoImport")){let h=[...e.matchAll(/^import .+;?$/gm)].pop(),v=`import AutoImport from 'unplugin-auto-import/vite';
177
- `;if(h){let u=h.index+h[0].length;e=e.slice(0,u)+`
178
- `+v+e.slice(u)}else e=v+e}}}if(!e.includes("transformIndexHtml")){if(e.includes("fleetbo-schema-sync-middleware")){let a=e.indexOf("{");e=e.replace(/\{[^{}]*name:\s*['"]fleetbo-schema-sync-middleware['"][\s\S]*?configureServer[\s\S]*?\}\s*\},?/g,"")}let n=e.match(/plugins\s*:\s*\[/);if(n){let a=n.index+n[0].length;e=e.slice(0,a)+`
179
- `+i+e.slice(a),f("\u2192 Updated Fleetbo Vite plugin with universal runtime injection.")}}if(e!==l)try{b.writeFileSync(s,e),f(`\u2192 Updated ${p.basename(s)} with Watcher and AutoImport configuration.`)}catch(n){d(`\u26A0\uFE0F Failed to write to ${p.basename(s)}: ${n.message}`)}try{let n=JSON.parse(b.readFileSync(o,"utf8"));n.devDependencies=n.devDependencies||{},n.devDependencies["unplugin-auto-import"]||(n.devDependencies["unplugin-auto-import"]="^0.18.0",b.writeFileSync(o,JSON.stringify(n,null,2)+`
180
- `),f("\u2192 Added unplugin-auto-import to devDependencies."))}catch(n){d(`\u26A0\uFE0F Failed to update ${p.basename(o)}: ${n.message}`)}}function W(t,o,r={}){let{skipSelfInstall:s=!1}=r,l=p.join(__dirname,"..");s||N(t,o),U(t),M(l),B(t),I(t),O(t,o),w(t,o)}k.exports={touchTsConfig:q,log:f,logError:d,handleAuthAndEnv:V,detectDependency:E,cleanupLegacyRootDts:I,patchJsOrTsConfig:O,attemptViteAutoImportPatch:w,runFullSetup:W}});var g=require("fs"),F=require("path"),C=require("https"),{runFullSetup:X,handleAuthAndEnv:K,touchTsConfig:G,attemptViteAutoImportPatch:Y}=j(),z="\x1B[34m",Q="\x1B[31m",_="\x1B[0m";function m(t){console.log(`${z}${t}${_}`)}function y(t){console.error(`${Q}${t}${_}`)}function Z(t,o){return new Promise((r,s)=>{let l=JSON.stringify({enterpriseID:t,schema:o}),c={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(l)}},e=C.request(c,i=>{let n="";i.on("data",a=>{n+=a}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?r(JSON.parse(n)):s(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});e.on("error",i=>s(i)),e.write(l),e.end()})}function ee(t){let o=F.join(t,".env");if(!g.existsSync(o))return{};let r=g.readFileSync(o,"utf8"),s={};return r.split(`
181
- `).forEach(l=>{let[c,...e]=l.split("=");c&&e.length>0&&(s[c.trim()]=e.join("=").trim())}),s}function te(t){return new Promise((o,r)=>{let s=JSON.stringify({projectId:t,moduleName:"svro.schema.json"}),l={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},c=C.request(l,e=>{let i="";e.on("data",n=>{i+=n}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{let n=JSON.parse(i);if(n.success&&n.found&&n.module){let a=n.module.code||n.module.mockCode;o(typeof a=="string"?JSON.parse(a):a)}else r(new Error("Schema not found in Fleetbo Cloud."))}catch{r(new Error("Invalid JSON response received from Fleetbo server."))}else r(new Error(`Server error ${e.statusCode}`))})});c.on("error",e=>r(e)),c.write(s),c.end()})}var T=process.argv.slice(2),S=T[0];async function oe(){let t=process.cwd(),o=F.join(t,"package.json");if(S==="init"||S==="doctor")m(`
182
- [Fleetbo] Initializing and configuring Fleetbo...`),await K(t,T),X(t,o),m(`
184
+ }),`;if(e=e.slice(0,b)+P+e.slice(b),!e.includes("import AutoImport")){let h=[...e.matchAll(/^import .+;?$/gm)].pop(),v=`import AutoImport from 'unplugin-auto-import/vite';
185
+ `;if(h){let m=h.index+h[0].length;e=e.slice(0,m)+`
186
+ `+v+e.slice(m)}else e=v+e}}}if(!e.includes("fleetbo-auto-runtime")){let r=e.match(/plugins\s*:\s*\[/);if(r){let b=r.index+r[0].length;e=e.slice(0,b)+`
187
+ `+a+e.slice(b),f("\u2192 Configured Fleetbo runtime auto-injection in Vite.")}}if(e!==l)try{c.writeFileSync(s,e),f(`\u2192 Updated ${p.basename(s)} with Watcher, AutoImport and Runtime configuration.`)}catch(r){d(`\u26A0\uFE0F Failed to write to ${p.basename(s)}: ${r.message}`)}try{let r=JSON.parse(c.readFileSync(o,"utf8"));r.devDependencies=r.devDependencies||{},r.devDependencies["unplugin-auto-import"]||(r.devDependencies["unplugin-auto-import"]="^0.18.0",c.writeFileSync(o,JSON.stringify(r,null,2)+`
188
+ `),f("\u2192 Added unplugin-auto-import to devDependencies."))}catch(r){d(`\u26A0\uFE0F Failed to update ${p.basename(o)}: ${r.message}`)}}function X(t,o,n={}){let{skipSelfInstall:s=!1}=n,l=p.join(__dirname,"..");s||U(t,o),B(t),q(l),M(t),I(t),O(t,o),w(t,o),j(t)}k.exports={touchTsConfig:V,log:f,logError:d,handleAuthAndEnv:W,detectDependency:S,cleanupLegacyRootDts:I,patchJsOrTsConfig:O,attemptViteAutoImportPatch:w,injectUniversalRuntime:j,runFullSetup:X}});var g=require("fs"),F=require("path"),C=require("https"),{runFullSetup:K,handleAuthAndEnv:G,touchTsConfig:Y,attemptViteAutoImportPatch:z,injectUniversalRuntime:Q}=_(),Z="\x1B[34m",ee="\x1B[31m",R="\x1B[0m";function u(t){console.log(`${Z}${t}${R}`)}function y(t){console.error(`${ee}${t}${R}`)}function te(t,o){return new Promise((n,s)=>{let l=JSON.stringify({enterpriseID:t,schema:o}),i={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(l)}},e=C.request(i,a=>{let r="";a.on("data",b=>{r+=b}),a.on("end",()=>{a.statusCode>=200&&a.statusCode<300?n(JSON.parse(r)):s(new Error(`Edge sync failed with HTTP ${a.statusCode}`))})});e.on("error",a=>s(a)),e.write(l),e.end()})}function oe(t){let o=F.join(t,".env");if(!g.existsSync(o))return{};let n=g.readFileSync(o,"utf8"),s={};return n.split(`
189
+ `).forEach(l=>{let[i,...e]=l.split("=");i&&e.length>0&&(s[i.trim()]=e.join("=").trim())}),s}function ne(t){return new Promise((o,n)=>{let s=JSON.stringify({projectId:t,moduleName:"svro.schema.json"}),l={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},i=C.request(l,e=>{let a="";e.on("data",r=>{a+=r}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{let r=JSON.parse(a);if(r.success&&r.found&&r.module){let b=r.module.code||r.module.mockCode;o(typeof b=="string"?JSON.parse(b):b)}else n(new Error("Schema not found in Fleetbo Cloud."))}catch{n(new Error("Invalid JSON response received from Fleetbo server."))}else n(new Error(`Server error ${e.statusCode}`))})});i.on("error",e=>n(e)),i.write(s),i.end()})}var E=process.argv.slice(2),x=E[0];async function re(){let t=process.cwd(),o=F.join(t,"package.json");if(x==="init"||x==="doctor")u(`
190
+ [Fleetbo] Initializing and configuring Fleetbo...`),await G(t,E),K(t,o),u(`
183
191
  [Fleetbo] Configuration completed successfully!
184
- `),m(`
185
- Next step:`),m(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
186
- `);else if(S==="sync"){let r=T.includes("--dry-run");m(`[Fleetbo] Syncing schema...${r?" (dry-run)":""}`);let s=F.join(t,"svro.schema.json"),l=F.join(__dirname,".."),c=F.join(l,"index.d.ts"),e=F.join(t,"src","auto-imports.d.ts"),n=ee(t).VITE_FLEETBO_ENTERPRISE_ID;if(n)try{m("\u2192 Fetching latest svro.schema.json from Fleetbo OS...");let a=await te(n);g.writeFileSync(s,JSON.stringify(a,null,2)+`
187
- `),m("\u2192 Local svro.schema.json updated from FLeetbo OS.")}catch(a){y(`\u26A0\uFE0F Cloud fetch bypassed: ${a.message}. Using local file fallback.`)}else y("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");g.existsSync(s)||(y("Error: svro.schema.json not found."),process.exit(1));try{let a=JSON.parse(g.readFileSync(s,"utf8")),P=Object.keys(a.collections||{});if(n)try{await Z(n,a),m("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(u){y(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${u.message}`)}let h=P.length>0?P.map(u=>`'${u}'`).join(" | "):"string",v=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
192
+ `),u(`
193
+ Next step:`),u(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
194
+ `);else if(x==="sync"){let n=E.includes("--dry-run");u(`[Fleetbo] Syncing schema...${n?" (dry-run)":""}`);let s=F.join(t,"svro.schema.json"),l=F.join(__dirname,".."),i=F.join(l,"index.d.ts"),e=F.join(t,"src","auto-imports.d.ts"),r=oe(t).VITE_FLEETBO_ENTERPRISE_ID;if(r)try{u("\u2192 Fetching latest svro.schema.json from Fleetbo OS...");let b=await ne(r);g.writeFileSync(s,JSON.stringify(b,null,2)+`
195
+ `),u("\u2192 Local svro.schema.json updated from FLeetbo OS.")}catch(b){y(`\u26A0\uFE0F Cloud fetch bypassed: ${b.message}. Using local file fallback.`)}else y("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");g.existsSync(s)||(y("Error: svro.schema.json not found."),process.exit(1));try{let b=JSON.parse(g.readFileSync(s,"utf8")),P=Object.keys(b.collections||{});if(r)try{await te(r,b),u("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(m){y(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${m.message}`)}let h=P.length>0?P.map(m=>`'${m}'`).join(" | "):"string",v=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
188
196
 
189
197
  export type FleetboTables = ${h};
190
198
 
@@ -389,7 +397,7 @@ declare module 'svelte/elements' {
389
397
  'fleetbo-reference': FleetboProp;
390
398
  }
391
399
  }
392
- `;if(g.writeFileSync(c,v),g.existsSync(F.dirname(e))){let u=`/* eslint-disable */
400
+ `;if(g.writeFileSync(i,v),g.existsSync(F.dirname(e))){let m=`/* eslint-disable */
393
401
  /* prettier-ignore */
394
402
  // @ts-nocheck
395
403
  // Generated by fleetbo-svro \u2014 Updated via fleetbo sync
@@ -499,4 +507,4 @@ declare module 'svelte/elements' {
499
507
  'fleetbo-reference': FleetboProp;
500
508
  }
501
509
  }
502
- `;g.writeFileSync(e,u)}G(t),Y(t,o),m(`[Fleetbo] Schema synced successfully (${P.length} collection(s)).`),r&&m("\u2192 [Dry-run] Schema is valid.")}catch(a){y(`Error during synchronization: ${a.message}`),process.exit(1)}}else y('Unknown command. Usage: "npx fleetbo-svro init" or "npx fleetbo-svro sync"'),process.exit(1)}oe().catch(t=>{y(`Fleetbo CLI Error: ${t.message}`),process.exit(1)});
510
+ `;g.writeFileSync(e,m)}Y(t),z(t,o),Q(t),u(`[Fleetbo] Schema synced successfully (${P.length} collection(s)).`),n&&u("\u2192 [Dry-run] Schema is valid.")}catch(b){y(`Error during synchronization: ${b.message}`),process.exit(1)}}else y('Unknown command. Usage: "npx fleetbo-svro init" or "npx fleetbo-svro sync"'),process.exit(1)}re().catch(t=>{y(`Fleetbo CLI Error: ${t.message}`),process.exit(1)});
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var va=Object.defineProperty;var P=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var Or=(n,e)=>{for(var t in e)va(n,t,{get:e[t],enumerable:!0})};var Nr,Dr=P(()=>{Nr=()=>{}});function ka(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}function v(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Fr(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())}function Vr(){return typeof window<"u"||tn()}function tn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Hr(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Wr(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Br(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function $r(){let n=v();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function jr(){try{return typeof indexedDB=="object"}catch{return!1}}function zr(){return new Promise((n,e)=>{try{let t=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(t){e(t)}})}function Na(n,e){return n.replace(Da,(t,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}function qr(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function K(n,e){if(n===e)return!0;let t=Object.keys(n),r=Object.keys(e);for(let i of t){if(!r.includes(i))return!1;let s=n[i],a=e[i];if(Lr(s)&&Lr(a)){if(!K(s,a))return!1}else if(s!==a)return!1}for(let i of r)if(!t.includes(i))return!1;return!0}function Lr(n){return n!==null&&typeof n=="object"}function ne(n){let e=[];for(let[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function fe(n){let e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function pe(n){let e=n.indexOf("?");if(!e)return"";let t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Gr(n,e){let t=new Xt(n,e);return t.subscribe.bind(t)}function La(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Jt(){}function h(n){return n&&n._delegate?n._delegate:n}function Ze(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Kr(n){return(await fetch(n,{credentials:"include"})).ok}var Mr,Aa,Ur,Yt,Sa,Qt,Re,Ra,Ca,Pa,Zt,xr,Qe,en,he,Oa,R,V,Da,Xt,cl,me=P(()=>{Dr();Mr=function(n){let e=[],t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},Aa=function(n){let e=[],t=0,r=0;for(;t<n.length;){let i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=n[t++],a=n[t++],o=n[t++],c=((i&7)<<18|(s&63)<<12|(a&63)<<6|o&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{let s=n[t++],a=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},Ur={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:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){let s=n[i],a=i+1<n.length,o=a?n[i+1]:0,c=i+2<n.length,u=c?n[i+2]:0,d=s>>2,f=(s&3)<<4|o>>4,m=(o&15)<<2|u>>6,F=u&63;c||(F=64,a||(m=64)),r.push(t[d],t[f],t[m],t[F])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Mr(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Aa(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){let s=t[n.charAt(i++)],o=i<n.length?t[n.charAt(i)]:0;++i;let u=i<n.length?t[n.charAt(i)]:64;++i;let f=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||o==null||u==null||f==null)throw new Yt;let m=s<<2|o>>4;if(r.push(m),u!==64){let F=o<<4&240|u>>2;if(r.push(F),f!==64){let te=u<<6&192|f;r.push(te)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},Yt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},Sa=function(n){let e=Mr(n);return Ur.encodeByteArray(e,!0)},Qt=function(n){return Sa(n).replace(/\./g,"")},Re=function(n){try{return Ur.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};Ra=()=>ka().__FIREBASE_DEFAULTS__,Ca=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Pa=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Re(n[1]);return e&&JSON.parse(e)},Zt=()=>{try{return Nr()||Ra()||Ca()||Pa()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},xr=n=>Zt()?.emulatorHosts?.[n],Qe=()=>Zt()?.config,en=n=>Zt()?.[`_${n}`];he=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}};Oa="FirebaseError",R=class n extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=Oa,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}},V=class{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){let r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?Na(s,r):"Error",o=`${this.serviceName}: ${a} (${i}).`;return new R(i,o,r)}};Da=/\{\$([^}]+)}/g;Xt=class{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(r=>{this.error(r)})}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,r){let i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");La(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=Jt),i.error===void 0&&(i.error=Jt),i.complete===void 0&&(i.complete=Jt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};cl=14400*1e3;});function Ma(n){return n===re?void 0:n}function Ua(n){return n.instantiationMode==="EAGER"}var D,re,nn,Ce,et=P(()=>{me();D=class{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,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}};re="[DEFAULT]";nn=class{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){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let r=new he;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}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(Ua(e))try{this.getOrInitializeService({instanceIdentifier:re})}catch{}for(let[t,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=re){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=re){return this.instances.has(e)}getOptions(e=re){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[s,a]of this.instancesDeferred.entries()){let o=this.normalizeInstanceIdentifier(s);r===o&&a.resolve(i)}return i}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Ma(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=re){return this.component?this.component.multipleInstances?e:re:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Ce=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let 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);let t=new nn(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}});function Yr(n){rn.forEach(e=>{e.setLogLevel(n)})}function Xr(n,e){for(let t of rn){let r=null;e&&e.level&&(r=Jr[e.level]),n===null?t.userLogHandler=null:t.userLogHandler=(i,s,...a)=>{let o=a.map(c=>{if(c==null)return null;if(typeof c=="string")return c;if(typeof c=="number"||typeof c=="boolean")return c.toString();if(c instanceof Error)return c.message;try{return JSON.stringify(c)}catch{return null}}).filter(c=>c).join(" ");s>=(r??i.logLevel)&&n({level:p[s].toLowerCase(),message:o,args:a,type:i.name})}}}var rn,p,Jr,xa,Fa,Va,ge,tt=P(()=>{rn=[];(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(p||(p={}));Jr={debug:p.DEBUG,verbose:p.VERBOSE,info:p.INFO,warn:p.WARN,error:p.ERROR,silent:p.SILENT},xa=p.INFO,Fa={[p.DEBUG]:"log",[p.VERBOSE]:"log",[p.INFO]:"info",[p.WARN]:"warn",[p.ERROR]:"error"},Va=(n,e,...t)=>{if(e<n.logLevel)return;let r=new Date().toISOString(),i=Fa[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},ge=class{constructor(e){this.name=e,this._logLevel=xa,this._logHandler=Va,this._userLogHandler=null,rn.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in p))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Jr[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,p.DEBUG,...e),this._logHandler(this,p.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,p.VERBOSE,...e),this._logHandler(this,p.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,p.INFO,...e),this._logHandler(this,p.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,p.WARN,...e),this._logHandler(this,p.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,p.ERROR,...e),this._logHandler(this,p.ERROR,...e)}}});function Wa(){return Qr||(Qr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ba(){return Zr||(Zr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function $a(n){let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",a)},s=()=>{t(L(n.result)),i()},a=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&ei.set(t,n)}).catch(()=>{}),cn.set(e,n),e}function ja(n){if(an.has(n))return;let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",a),n.removeEventListener("abort",a)},s=()=>{t(),i()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",a),n.addEventListener("abort",a)});an.set(n,e)}function ni(n){on=n(on)}function za(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let r=n.call(nt(this),e,...t);return ti.set(r,e.sort?e.sort():[e]),L(r)}:Ba().includes(n)?function(...e){return n.apply(nt(this),e),L(ei.get(this))}:function(...e){return L(n.apply(nt(this),e))}}function qa(n){return typeof n=="function"?za(n):(n instanceof IDBTransaction&&ja(n),Ha(n,Wa())?new Proxy(n,on):n)}function L(n){if(n instanceof IDBRequest)return $a(n);if(sn.has(n))return sn.get(n);let e=qa(n);return e!==n&&(sn.set(n,e),cn.set(e,n)),e}var Ha,Qr,Zr,ei,an,ti,sn,cn,on,nt,un=P(()=>{Ha=(n,e)=>e.some(t=>n instanceof t);ei=new WeakMap,an=new WeakMap,ti=new WeakMap,sn=new WeakMap,cn=new WeakMap;on={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return an.get(n);if(e==="objectStoreNames")return n.objectStoreNames||ti.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return L(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};nt=n=>cn.get(n)});function ii(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(n,e),o=L(a);return r&&a.addEventListener("upgradeneeded",c=>{r(L(a.result),c.oldVersion,c.newVersion,L(a.transaction),c)}),t&&a.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),o.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),o}function ri(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(ln.get(e))return ln.get(e);let t=e.replace(/FromIndex$/,""),r=e!==t,i=Ka.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ga.includes(t)))return;let s=async function(a,...o){let c=this.transaction(a,i?"readwrite":"readonly"),u=c.store;return r&&(u=u.index(o.shift())),(await Promise.all([u[t](...o),i&&c.done]))[0]};return ln.set(e,s),s}var Ga,Ka,ln,si=P(()=>{un();un();Ga=["get","getKey","getAll","getAllKeys","count"],Ka=["put","add","delete","clear"],ln=new Map;ni(n=>({...n,get:(e,t,r)=>ri(e,t)||n.get(e,t,r),has:(e,t)=>!!ri(e,t)||n.has(e,t)}))});function Ja(n){return n.getComponent()?.type==="VERSION"}function pn(n,e){try{n.container.addComponent(e)}catch(t){H.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ao(n,e){n.container.addOrOverwriteComponent(e)}function ie(n){let e=n.name;if(Ie.has(e))return H.debug(`There were multiple attempts to register component ${e}.`),!1;Ie.set(e,n);for(let t of J.values())pn(t,n);for(let t of _e.values())pn(t,n);return!0}function Ne(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function So(n,e,t=Pe){Ne(n,e).clearInstance(t)}function In(n){return n.options!==void 0}function li(n){return In(n)?!1:"authIdToken"in n||"appCheckToken"in n||"releaseOnDeref"in n||"automaticDataCollectionEnabled"in n}function I(n){return n==null?!1:n.settings!==void 0}function ko(){Ie.clear()}function ai(n,e){let t=Re(n.split(".")[1]);if(t===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(t).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let i=JSON.parse(t).exp*1e3,s=new Date().getTime();i-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function di(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let r={name:Pe,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw k.create("bad-app-name",{appName:String(i)});if(t||(t=Qe()),!t)throw k.create("no-options");let s=J.get(i);if(s){if(K(t,s.options)&&K(r,s.config))return s;throw k.create("duplicate-app",{appName:i})}let a=new Ce(i);for(let c of Ie.values())a.addComponent(c);let o=new it(t,r,a);return J.set(i,o),o}function Co(n,e={}){if(Vr()&&!tn())throw k.create("invalid-server-app-environment");let t,r=e||{};if(n&&(In(n)?t=n.options:li(n)?r=n:t=n),r.automaticDataCollectionEnabled===void 0&&(r.automaticDataCollectionEnabled=!0),t||(t=Qe()),!t)throw k.create("no-options");let i={...r,...t};i.releaseOnDeref!==void 0&&delete i.releaseOnDeref;let s=d=>[...d].reduce((f,m)=>Math.imul(31,f)+m.charCodeAt(0)|0,0);if(r.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw k.create("finalization-registry-not-supported",{});let a=""+s(JSON.stringify(i)),o=_e.get(a);if(o)return o.incRefCount(r.releaseOnDeref),o;let c=new Ce(a);for(let d of Ie.values())c.addComponent(d);let u=new mn(t,r,a,c);return _e.set(a,u),u}function En(n=Pe){let e=J.get(n);if(!e&&n===Pe&&Qe())return di();if(!e)throw k.create("no-app",{appName:n});return e}function Po(){return Array.from(J.values())}async function hi(n){let e=!1,t=n.name;J.has(t)?(e=!0,J.delete(t)):_e.has(t)&&n.decRefCount()<=0&&(_e.delete(t),e=!0),e&&(await Promise.all(n.container.getProviders().map(r=>r.delete())),n.isDeleted=!0)}function M(n,e,t){let r=vo[n]??n;t&&(r+=`-${t}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),H.warn(a.join(" "));return}ie(new D(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}function Oo(n,e){if(n!==null&&typeof n!="function")throw k.create("invalid-log-argument");Xr(n,e)}function No(n){Yr(n)}function fi(){return dn||(dn=ii(Do,Lo,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(Oe)}catch(t){console.warn(t)}}}}).catch(n=>{throw k.create("idb-open",{originalErrorMessage:n.message})})),dn}async function Mo(n){try{let t=(await fi()).transaction(Oe),r=await t.objectStore(Oe).get(pi(n));return await t.done,r}catch(e){if(e instanceof R)H.warn(e.message);else{let t=k.create("idb-get",{originalErrorMessage:e?.message});H.warn(t.message)}}}async function oi(n,e){try{let r=(await fi()).transaction(Oe,"readwrite");await r.objectStore(Oe).put(e,pi(n)),await r.done}catch(t){if(t instanceof R)H.warn(t.message);else{let r=k.create("idb-set",{originalErrorMessage:t?.message});H.warn(r.message)}}}function pi(n){return`${n.name}!${n.options.appId}`}function ci(){return new Date().toISOString().substring(0,10)}function Fo(n,e=Uo){let t=[],r=n.slice();for(let i of n){let s=t.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),ui(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),ui(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}function ui(n){return Qt(JSON.stringify({version:2,heartbeats:n})).length}function Vo(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}function Ho(n){ie(new D("platform-logger",e=>new hn(e),"PRIVATE")),ie(new D("heartbeat",e=>new gn(e),"PRIVATE")),M(rt,fn,n),M(rt,fn,"esm2020"),M("fire-js","")}var hn,rt,fn,H,Ya,Xa,Qa,Za,eo,to,no,ro,io,so,ao,oo,co,uo,lo,ho,fo,po,mo,go,_o,Io,Eo,yo,wo,To,bo,Pe,vo,J,_e,Ie,Ro,k,it,mn,se,Do,Lo,Oe,dn,Uo,xo,gn,_n,De=P(()=>{et();tt();me();me();si();hn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ja(t)){let r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}};rt="@firebase/app",fn="0.15.1";H=new ge("@firebase/app"),Ya="@firebase/app-compat",Xa="@firebase/analytics-compat",Qa="@firebase/analytics",Za="@firebase/app-check-compat",eo="@firebase/app-check",to="@firebase/auth",no="@firebase/auth-compat",ro="@firebase/database",io="@firebase/data-connect",so="@firebase/database-compat",ao="@firebase/functions",oo="@firebase/functions-compat",co="@firebase/installations",uo="@firebase/installations-compat",lo="@firebase/messaging",ho="@firebase/messaging-compat",fo="@firebase/performance",po="@firebase/performance-compat",mo="@firebase/remote-config",go="@firebase/remote-config-compat",_o="@firebase/storage",Io="@firebase/storage-compat",Eo="@firebase/firestore",yo="@firebase/ai",wo="@firebase/firestore-compat",To="firebase",bo="12.16.0";Pe="[DEFAULT]",vo={[rt]:"fire-core",[Ya]:"fire-core-compat",[Qa]:"fire-analytics",[Xa]:"fire-analytics-compat",[eo]:"fire-app-check",[Za]:"fire-app-check-compat",[to]:"fire-auth",[no]:"fire-auth-compat",[ro]:"fire-rtdb",[io]:"fire-data-connect",[so]:"fire-rtdb-compat",[ao]:"fire-fn",[oo]:"fire-fn-compat",[co]:"fire-iid",[uo]:"fire-iid-compat",[lo]:"fire-fcm",[ho]:"fire-fcm-compat",[fo]:"fire-perf",[po]:"fire-perf-compat",[mo]:"fire-rc",[go]:"fire-rc-compat",[_o]:"fire-gcs",[Io]:"fire-gcs-compat",[Eo]:"fire-fst",[wo]:"fire-fst-compat",[yo]:"fire-vertex","fire-js":"fire-js",[To]:"fire-js-all"};J=new Map,_e=new Map,Ie=new Map;Ro={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},k=new V("app","Firebase",Ro);it=class{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new D("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 k.create("app-deleted",{appName:this._name})}};mn=class extends it{constructor(e,t,r,i){let s=t.automaticDataCollectionEnabled!==void 0?t.automaticDataCollectionEnabled:!0,a={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,a,i);else{let o=e;super(o.options,a,i)}this._serverConfig={automaticDataCollectionEnabled:s,...t},this._serverConfig.authIdToken&&ai(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&ai(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,M(rt,fn,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){hi(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw k.create("server-app-deleted")}};se=bo;Do="firebase-heartbeat-database",Lo=1,Oe="firebase-heartbeat-store",dn=null;Uo=1024,xo=30,gn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new _n(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=ci();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats.length>xo){let i=Vo(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){H.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=ci(),{heartbeatsToSend:t,unsentEntries:r}=Fo(this._heartbeatsCache.heartbeats),i=Qt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return H.warn(e),""}}};_n=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return jr()?zr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await Mo(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return oi(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return oi(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};Ho("")});var mi={};Or(mi,{FirebaseError:()=>R,SDK_VERSION:()=>se,_DEFAULT_ENTRY_NAME:()=>Pe,_addComponent:()=>pn,_addOrOverwriteComponent:()=>Ao,_apps:()=>J,_clearComponents:()=>ko,_components:()=>Ie,_getProvider:()=>Ne,_isFirebaseApp:()=>In,_isFirebaseServerApp:()=>I,_isFirebaseServerAppSettings:()=>li,_registerComponent:()=>ie,_removeServiceInstance:()=>So,_serverApps:()=>_e,deleteApp:()=>hi,getApp:()=>En,getApps:()=>Po,initializeApp:()=>di,initializeServerApp:()=>Co,onLog:()=>Oo,registerVersion:()=>M,setLogLevel:()=>No});var Wo,Bo,gi=P(()=>{De();De();Wo="firebase",Bo="12.16.0";M(Wo,Bo,"app")});function $o(){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`)."}}function Bi(){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."}}function jo(n,...e){dt.logLevel<=p.WARN&&dt.warn(`Auth (${se}): ${n}`,...e)}function ot(n,...e){dt.logLevel<=p.ERROR&&dt.error(`Auth (${se}): ${n}`,...e)}function S(n,...e){throw tr(n,...e)}function A(n,...e){return tr(n,...e)}function er(n,e,t){let r={...Zn(),[e]:t};return new V("auth","Firebase",r).create(e,{appName:n.name})}function w(n){return er(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Se(n,e,t){let r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&S(n,"argument-error"),er(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function tr(n,...e){if(typeof n!="string"){let t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return ji.create(n,...e)}function l(n,e,...t){if(!n)throw tr(e,...t)}function U(n){let e="INTERNAL ASSERTION FAILED: "+n;throw ot(e),new Error(e)}function $(n,e){n||U(e)}function He(){return typeof self<"u"&&self.location?.href||""}function nr(){return _i()==="http:"||_i()==="https:"}function _i(){return typeof self<"u"&&self.location?.protocol||null}function zo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(nr()||Wr()||"connection"in navigator)?navigator.onLine:!0}function qo(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}function rr(n,e){$(n.emulator,"Emulator should always be set here");let{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}function g(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function _(n,e,t,r,i={}){return qi(n,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});let o=ne({...a,key:n.config.apiKey}).slice(1),c=await n._getAdditionalHeaders();c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode);let u={method:e,headers:c,...s};return Hr()||(u.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&Ze(n.emulatorConfig.host)&&(u.credentials="include"),ht.fetch()(await Gi(n,n.config.apiHost,t,o),u)})}async function qi(n,e,t){n._canInitEmulator=!1;let r={...Go,...e};try{let i=new kn(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();let a=await s.json();if("needConfirmation"in a)throw Me(n,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{let o=s.ok?a.errorMessage:a.error.message,[c,u]=o.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw Me(n,"credential-already-in-use",a);if(c==="EMAIL_EXISTS")throw Me(n,"email-already-in-use",a);if(c==="USER_DISABLED")throw Me(n,"user-disabled",a);let d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw er(n,d,u);S(n,d)}}catch(i){if(i instanceof R)throw i;S(n,"network-request-failed",{message:String(i)})}}async function G(n,e,t,r,i={}){let s=await _(n,e,t,r,i);return"mfaPendingCredential"in s&&S(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Gi(n,e,t,r){let i=`${e}${t}?${r}`,s=n,a=s.config.emulator?rr(n.config,i):`${n.config.apiScheme}://${i}`;return Ko.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function Yo(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function Me(n,e,t){let r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);let i=A(n,e,r);return i.customData._tokenResponse=t,i}function Ii(n){return n!==void 0&&n.getResponse!==void 0}function Ei(n){return n!==void 0&&n.enterprise!==void 0}async function Xo(n){return(await _(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function Ki(n,e){return _(n,"GET","/v2/recaptchaConfig",g(n,e))}async function Qo(n,e){return _(n,"POST","/v1/accounts:delete",e)}async function Zo(n,e){return _(n,"POST","/v1/accounts:update",e)}async function pt(n,e){return _(n,"POST","/v1/accounts:lookup",e)}function Ue(n){if(n)try{let e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function Ji(n,e=!1){return h(n).getIdToken(e)}async function ir(n,e=!1){let t=h(n),r=await t.getIdToken(e),i=xt(r);l(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:Ue(yn(i.auth_time)),issuedAtTime:Ue(yn(i.iat)),expirationTime:Ue(yn(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function yn(n){return Number(n)*1e3}function xt(n){let[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ot("JWT malformed, contained fewer than 3 sections"),null;try{let i=Re(t);return i?JSON.parse(i):(ot("Failed to decode base64 JWT payload"),null)}catch(i){return ot("Caught error parsing JWT payload as JSON",i?.toString()),null}}function yi(n){let e=xt(n);return l(e,"internal-error"),l(typeof e.exp<"u","internal-error"),l(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function j(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof R&&ec(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function ec({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}async function Be(n){let e=n.auth,t=await n.getIdToken(),r=await j(n,pt(e,{idToken:t}));l(r?.users.length,e,"internal-error");let i=r.users[0];n._notifyReloadListener(i);let s=i.providerUserInfo?.length?Yi(i.providerUserInfo):[],a=tc(n.providerData,s),o=n.isAnonymous,c=!(n.email&&i.passwordHash)&&!a?.length,u=o?c:!1,d={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:a,metadata:new We(i.createdAt,i.lastLoginAt),isAnonymous:u};Object.assign(n,d)}async function sr(n){let e=h(n);await Be(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function tc(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Yi(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function nc(n,e){let t=await qi(n,{},async()=>{let r=ne({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,a=await Gi(n,i,"/v1/token",`key=${s}`),o=await n._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";let c={method:"POST",headers:o,body:r};return n.emulatorConfig&&Ze(n.emulatorConfig.host)&&(c.credentials="include"),ht.fetch()(a,c)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function rc(n,e){return _(n,"POST","/v2/accounts:revokeToken",g(n,e))}function Y(n,e){l(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}function W(n){$(n instanceof Function,"Expected a class definition");let e=wi.get(n);return e?($(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,wi.set(n,e),e)}function ct(n,e,t){return`firebase:${n}:${e}:${t}`}function Ti(n){let e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(es(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Xi(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ns(e))return"Blackberry";if(rs(e))return"Webos";if(Qi(e))return"Safari";if((e.includes("chrome/")||Zi(e))&&!e.includes("edge/"))return"Chrome";if(ts(e))return"Android";{let t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if(r?.length===2)return r[1]}return"Other"}function Xi(n=v()){return/firefox\//i.test(n)}function Qi(n=v()){let e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Zi(n=v()){return/crios\//i.test(n)}function es(n=v()){return/iemobile/i.test(n)}function ts(n=v()){return/android/i.test(n)}function ns(n=v()){return/blackberry/i.test(n)}function rs(n=v()){return/webos/i.test(n)}function ar(n=v()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function ic(n=v()){return ar(n)&&!!window.navigator?.standalone}function sc(){return $r()&&document.documentMode===10}function is(n=v()){return ar(n)||ts(n)||rs(n)||ns(n)||/windows phone/i.test(n)||es(n)}function ss(n,e=[]){let t;switch(n){case"Browser":t=Ti(v());break;case"Worker":t=`${Ti(v())}-${n}`;break;default:t=n}let r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${se}/${r}`}async function ac(n,e={}){return _(n,"GET","/v2/passwordPolicy",g(n,e))}function E(n){return h(n)}function cc(n){Je=n}function or(n){return Je.loadJS(n)}function uc(){return Je.recaptchaV2Script}function lc(){return Je.recaptchaEnterpriseScript}function dc(){return Je.gapiScript}function as(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function pc(n){let e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<n;r++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}async function Le(n,e,t,r=!1,i=!1){let s=new $e(n),a;if(i)a=Fe;else try{a=await s.verify(t)}catch{a=await s.verify(t,!0)}let o={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in o){let c=o.phoneEnrollmentInfo.phoneNumber,u=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:c,recaptchaToken:u,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){let c=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:c,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return r?Object.assign(o,{captchaResp:a}):Object.assign(o,{captchaResponse:a}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Q(n,e,t,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Le(n,e,t,t==="getOobCode");return r(n,s)}else return r(n,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let a=await Le(n,e,t,t==="getOobCode");return r(n,a)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Le(n,e,t);return r(n,s).catch(async a=>{if(n._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);let o=await Le(n,e,t,!1,!0);return r(n,o)}return Promise.reject(a)})}else{let s=await Le(n,e,t,!1,!0);return r(n,s)}else return Promise.reject(i+" provider is not supported.")}async function os(n){let e=E(n),t=await Ki(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new ft(t);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new $e(e).verify()}function cr(n,e){let t=Ne(n,"auth");if(t.isInitialized()){let i=t.getImmediate(),s=t.getOptions();if(K(s,e??{}))return i;S(i,"already-initialized")}return t.initialize({options:e})}function gc(n,e){let t=e?.persistence||[],r=(Array.isArray(t)?t:[t]).map(W);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e?.popupRedirectResolver)}function ur(n,e,t){let r=E(n);l(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!t?.disableWarnings,s=cs(e),{host:a,port:o}=_c(e),c=o===null?"":`:${o}`,u={url:`${s}//${a}${c}/`},d=Object.freeze({host:a,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){l(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),l(K(u,r.config.emulator)&&K(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,Ze(a)?Kr(`${s}//${a}${c}`):i||Ic()}function cs(n){let e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function _c(n){let e=cs(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};let r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let s=i[1];return{host:s,port:vi(r.substr(s.length+1))}}else{let[s,a]=r.split(":");return{host:s,port:vi(a)}}}function vi(n){if(!n)return null;let e=Number(n);return isNaN(e)?null:e}function Ic(){function n(){let 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)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}async function us(n,e){return _(n,"POST","/v1/accounts:resetPassword",g(n,e))}async function Ec(n,e){return _(n,"POST","/v1/accounts:update",e)}async function yc(n,e){return _(n,"POST","/v1/accounts:signUp",e)}async function wc(n,e){return _(n,"POST","/v1/accounts:update",g(n,e))}async function Tc(n,e){return G(n,"POST","/v1/accounts:signInWithPassword",g(n,e))}async function Ft(n,e){return _(n,"POST","/v1/accounts:sendOobCode",g(n,e))}async function bc(n,e){return Ft(n,e)}async function vc(n,e){return Ft(n,e)}async function Ac(n,e){return Ft(n,e)}async function Sc(n,e){return Ft(n,e)}async function kc(n,e){return G(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function Rc(n,e){return G(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function B(n,e){return G(n,"POST","/v1/accounts:signInWithIdp",g(n,e))}async function Ai(n,e){return _(n,"POST","/v1/accounts:sendVerificationCode",g(n,e))}async function Pc(n,e){return G(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e))}async function Oc(n,e){let t=await G(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e));if(t.temporaryProof)throw Me(n,"account-exists-with-different-credential",t);return t}async function Dc(n,e){let t={...e,operation:"REAUTH"};return G(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,t),Nc)}function Lc(n){switch(n){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}}function Mc(n){let e=fe(pe(n)).link,t=e?fe(pe(e)).deep_link_id:null,r=fe(pe(n)).deep_link_id;return(r?fe(pe(r)).link:null)||r||t||e||n}function ls(n){return ce.parseLink(n)}async function ds(n,e){return G(n,"POST","/v1/accounts:signUp",g(n,e))}function Si(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}async function hs(n){if(I(n.app))return Promise.reject(w(n));let e=E(n);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new N({user:e.currentUser,providerId:null,operationType:"signIn"});let t=await ds(e,{returnSecureToken:!0}),r=await N._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(r.user),r}function fs(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Un._fromErrorAndOperation(n,s,e,r):s})}function ps(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}async function ms(n,e){let t=h(n);await Vt(!0,t,e);let{providerUserInfo:r}=await Zo(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),i=ps(r||[]);return t.providerData=t.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function lr(n,e,t=!1){let r=await j(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return N._forOperation(n,"link",r)}async function Vt(n,e,t){await Be(e);let r=ps(e.providerData),i=n===!1?"provider-already-linked":"no-such-provider";l(r.has(t)===n,e.auth,i)}async function gs(n,e,t=!1){let{auth:r}=n;if(I(r.app))return Promise.reject(w(r));let i="reauthenticate";try{let s=await j(n,fs(r,i,e,n),t);l(s.idToken,r,"internal-error");let a=xt(s.idToken);l(a,r,"internal-error");let{sub:o}=a;return l(n.uid===o,r,"user-mismatch"),N._forOperation(n,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&S(r,"user-mismatch"),s}}async function _s(n,e,t=!1){if(I(n.app))return Promise.reject(w(n));let r="signIn",i=await fs(n,r,e),s=await N._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}async function Ye(n,e){return _s(E(n),e)}async function dr(n,e){let t=h(n);return await Vt(!1,t,e.providerId),lr(t,e)}async function hr(n,e){return gs(h(n),e)}async function Fc(n,e){return G(n,"POST","/v1/accounts:signInWithCustomToken",g(n,e))}async function Is(n,e){if(I(n.app))return Promise.reject(w(n));let t=E(n),r=await Fc(t,{token:e,returnSecureToken:!0}),i=await N._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(i.user),i}function Ht(n,e,t){l(t.url?.length>0,n,"invalid-continue-uri"),l(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),l(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(l(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(l(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}async function fr(n){let e=E(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Es(n,e,t){let r=E(n),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&Ht(r,i,t),await Q(r,i,"getOobCode",vc,"EMAIL_PASSWORD_PROVIDER")}async function ys(n,e,t){await us(h(n),{oobCode:e,newPassword:t}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&fr(n),r})}async function ws(n,e){await wc(h(n),{oobCode:e})}async function pr(n,e){let t=h(n),r=await us(t,{oobCode:e}),i=r.requestType;switch(l(i,t,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":l(r.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":l(r.mfaInfo,t,"internal-error");default:l(r.email,t,"internal-error")}let s=null;return r.mfaInfo&&(s=ue._fromServerResponse(E(t),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function Ts(n,e){let{data:t}=await pr(h(n),e);return t.email}async function bs(n,e,t){if(I(n.app))return Promise.reject(w(n));let r=E(n),a=await Q(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ds,"EMAIL_PASSWORD_PROVIDER").catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&fr(n),c}),o=await N._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(o.user),o}function vs(n,e,t){return I(n.app)?Promise.reject(w(n)):Ye(h(n),q.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&fr(n),r})}async function As(n,e,t){let r=E(n),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(a,o){l(o.handleCodeInApp,r,"argument-error"),o&&Ht(r,a,o)}s(i,t),await Q(r,i,"getOobCode",Ac,"EMAIL_PASSWORD_PROVIDER")}function Ss(n,e){return ce.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function ks(n,e,t){if(I(n.app))return Promise.reject(w(n));let r=h(n),i=q.credentialWithLink(e,t||He());return l(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),Ye(r,i)}async function Vc(n,e){return _(n,"POST","/v1/accounts:createAuthUri",g(n,e))}async function Rs(n,e){let t=nr()?He():"http://localhost",r={identifier:e,continueUri:t},{signinMethods:i}=await Vc(h(n),r);return i||[]}async function Cs(n,e){let t=h(n),i={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Ht(t.auth,i,e);let{email:s}=await bc(t.auth,i);s!==n.email&&await n.reload()}async function Ps(n,e,t){let r=h(n),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await n.getIdToken(),newEmail:e};t&&Ht(r.auth,s,t);let{email:a}=await Sc(r.auth,s);a!==n.email&&await n.reload()}async function Hc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function Os(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;let r=h(n),s={idToken:await r.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},a=await j(r,Hc(r.auth,s));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let o=r.providerData.find(({providerId:c})=>c==="password");o&&(o.displayName=r.displayName,o.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function Ns(n,e){let t=h(n);return I(t.auth.app)?Promise.reject(w(t.auth)):Ls(t,e,null)}function Ds(n,e){return Ls(h(n),null,e)}async function Ls(n,e,t){let{auth:r}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);let a=await j(n,Ec(r,s));await n._updateTokensIfNecessary(a,!0)}function Wc(n){if(!n)return null;let{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},r=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&n?.idToken){let i=xt(n.idToken)?.firebase?.sign_in_provider;if(i){let s=i!=="anonymous"&&i!=="custom"?i:null;return new Z(r,s)}}if(!e)return null;switch(e){case"facebook.com":return new Vn(r,t);case"github.com":return new Hn(r,t);case"google.com":return new Wn(r,t);case"twitter.com":return new Bn(r,t,n.screenName||null);case"custom":case"anonymous":return new Z(r,null);default:return new Z(r,e,t)}}function Ms(n){let{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Wc(t)}function Us(n,e){return h(n).setPersistence(e)}function xs(n){return os(n)}async function Fs(n,e){return E(n).validatePassword(e)}function mr(n,e,t,r){return h(n).onIdTokenChanged(e,t,r)}function gr(n,e,t){return h(n).beforeAuthStateChanged(e,t)}function Vs(n,e,t,r){return h(n).onAuthStateChanged(e,t,r)}function Hs(n){h(n).useDeviceLanguage()}function Ws(n,e){return h(n).updateCurrentUser(e)}function Bs(n){return h(n).signOut()}function $s(n,e){return E(n).revokeAccessToken(e)}async function js(n){return h(n).delete()}function zs(n,e){let t=h(n),r=e;return l(e.customData.operationType,t,"argument-error"),l(r.customData._serverResponse?.mfaPendingCredential,t,"argument-error"),$n._fromError(t,r)}function ki(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Bc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function $c(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function jc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function zc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:withdraw",g(n,e))}function qs(n){let e=h(n);return wn.has(e)||wn.set(e,jn._fromUser(e)),wn.get(e)}function Tn(n){let e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),t=RegExp(`${e}=([^;]+)`);return document.cookie.match(t)?.[1]??null}function bn(n){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${n.split(":")[3]}`}function Jc(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}function Bt(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}function y(){return window}function Yc(n){y().location.href=n}function Ir(){return typeof y().WorkerGlobalScope<"u"&&typeof y().importScripts=="function"}async function Xc(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Qc(){return navigator?.serviceWorker?.controller||null}function Zc(){return Ir()?self:null}function $t(n,e){return n.transaction([Pt],e?"readwrite":"readonly").objectStore(Pt)}function tu(){let n=indexedDB.deleteDatabase(Ks);return new le(n).toPromise()}function Ys(){let n=indexedDB.open(Ks,eu);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{let r=n.result;try{r.createObjectStore(Pt,{keyPath:Js})}catch(i){t(i)}}),n.addEventListener("success",async()=>{let r=n.result;r.objectStoreNames.contains(Pt)?e(r):(r.close(),await tu(),e(await Ys()))})})}async function Ri(n,e,t){let r=$t(n,!0).put({[Js]:e,value:t});return new le(r).toPromise()}async function nu(n,e){let t=$t(n,!1).get(e),r=await new le(t).toPromise();return r===void 0?null:r.value}function Ci(n,e){let t=$t(n,!0).delete(e);return new le(t).toPromise()}function Pi(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:start",g(n,e))}function su(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function au(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function cu(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}function lu(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}async function Xs(n,e,t){if(I(n.app))return Promise.reject(w(n));let r=E(n),i=await jt(r,e,h(t));return new je(i,s=>Ye(r,s))}async function Qs(n,e,t){let r=h(n);await Vt(!1,r,"phone");let i=await jt(r.auth,e,h(t));return new je(i,s=>dr(r,s))}async function Zs(n,e,t){let r=h(n);if(I(r.auth.app))return Promise.reject(w(r.auth));let i=await jt(r.auth,e,h(t));return new je(i,s=>hr(r,s))}async function jt(n,e,t){if(!n._getRecaptchaConfig())try{await os(n)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){let i=r.session;if("phoneNumber"in r){l(i.type==="enroll",n,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await Q(n,s,"mfaSmsEnrollment",async(u,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===Fe){l(t?.type===Ve,u,"argument-error");let f=await An(u,d,t);return ki(u,f)}return ki(u,d)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneSessionInfo.sessionInfo}else{l(i.type==="signin",n,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;l(s,n,"missing-multi-factor-info");let a={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await Q(n,a,"mfaSmsSignIn",async(d,f)=>{if(f.phoneSignInInfo.captchaResponse===Fe){l(t?.type===Ve,d,"argument-error");let m=await An(d,f,t);return Pi(d,m)}return Pi(d,f)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await Q(n,i,"sendVerificationCode",async(c,u)=>{if(u.captchaResponse===Fe){l(t?.type===Ve,c,"argument-error");let d=await An(c,u,t);return Ai(c,d)}return Ai(c,u)},"PHONE_PROVIDER").catch(c=>Promise.reject(c))).sessionInfo}}finally{t?._reset()}}async function ea(n,e){let t=h(n);if(I(t.auth.app))return Promise.reject(w(t.auth));await lr(t,e)}async function An(n,e,t){l(t.type===Ve,n,"argument-error");let r=await t.verify();l(typeof r=="string",n,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,a=i.phoneEnrollmentInfo.captchaResponse,o=i.phoneEnrollmentInfo.clientType,c=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:a,clientType:o,recaptchaVersion:c}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,a=i.phoneSignInInfo.clientType,o=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:a,recaptchaVersion:o}}),i}else return Object.assign(i,{recaptchaToken:r}),i}function de(n,e){return e?W(e):(l(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}function du(n){return _s(n.auth,new ze(n),n.bypassAuthState)}function hu(n){let{auth:e,user:t}=n;return l(t,e,"internal-error"),gs(t,new ze(n),n.bypassAuthState)}async function fu(n){let{auth:e,user:t}=n;return l(t,e,"internal-error"),lr(t,new ze(n),n.bypassAuthState)}async function ta(n,e,t){if(I(n.app))return Promise.reject(A(n,"operation-not-supported-in-this-environment"));let r=E(n);Se(n,e,O);let i=de(r,t);return new Ae(r,"signInViaPopup",e,i).executeNotNull()}async function na(n,e,t){let r=h(n);if(I(r.auth.app))return Promise.reject(A(r.auth,"operation-not-supported-in-this-environment"));Se(r.auth,e,O);let i=de(r.auth,t);return new Ae(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function ra(n,e,t){let r=h(n);Se(r.auth,e,O);let i=de(r.auth,t);return new Ae(r.auth,"linkViaPopup",e,i,r).executeNotNull()}async function gu(n,e){let t=sa(e),r=ia(n);if(!await r._isAvailable())return!1;let i=await r._get(t)==="true";return await r._remove(t),i}async function yr(n,e){return ia(n)._set(sa(e),"true")}function _u(n,e){ut.set(n._key(),e)}function ia(n){return W(n._redirectPersistence)}function sa(n){return ct(mu,n.config.apiKey,n.name)}function aa(n,e,t){return Iu(n,e,t)}async function Iu(n,e,t){if(I(n.app))return Promise.reject(w(n));let r=E(n);Se(n,e,O),await r._initializationPromise;let i=de(r,t);return await yr(i,r),i._openRedirect(r,e,"signInViaRedirect")}function oa(n,e,t){return Eu(n,e,t)}async function Eu(n,e,t){let r=h(n);if(Se(r.auth,e,O),I(r.auth.app))return Promise.reject(w(r.auth));await r.auth._initializationPromise;let i=de(r.auth,t);await yr(i,r.auth);let s=await da(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function ca(n,e,t){return yu(n,e,t)}async function yu(n,e,t){let r=h(n);Se(r.auth,e,O),await r.auth._initializationPromise;let i=de(r.auth,t);await Vt(!1,r,e.providerId),await yr(i,r.auth);let s=await da(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function ua(n,e){return await E(n)._initializationPromise,la(n,e,!1)}async function la(n,e,t=!1){if(I(n.app))return Promise.reject(w(n));let r=E(n),i=de(r,e),a=await new Kn(r,i,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}async function da(n){let e=Bt(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}function Oi(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function ha({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function Tu(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ha(n);default:return!1}}async function bu(n,e={}){return _(n,"GET","/v1/projects",e)}async function Su(n){if(n.config.emulator)return;let{authorizedDomains:e}=await bu(n);for(let t of e)try{if(ku(t))return}catch{}S(n,"unauthorized-domain")}function ku(n){let e=He(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){let a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!Au.test(t))return!1;if(vu.test(n))return r===n;let i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}function Ni(){let n=y().___jsl;if(n?.H){for(let e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function Cu(n){return new Promise((e,t)=>{function r(){Ni(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ni(),t(A(n,"network-request-failed"))},timeout:Ru.get()})}if(y().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(y().gapi?.load)r();else{let i=as("iframefcb");return y()[i]=()=>{gapi.load?r():t(A(n,"network-request-failed"))},or(`${dc()}?onload=${i}`).catch(s=>t(s))}}).catch(e=>{throw lt=null,e})}function Pu(n){return lt=lt||Cu(n),lt}function Uu(n){let e=n.config;l(e.authDomain,n,"auth-domain-config-required");let t=e.emulator?rr(e,Du):`https://${n.config.authDomain}/${Nu}`,r={apiKey:e.apiKey,appName:n.name,v:se},i=Mu.get(n.config.apiHost);i&&(r.eid=i);let s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${ne(r).slice(1)}`}async function xu(n){let e=await Pu(n),t=y().gapi;return l(t,n,"internal-error"),e.open({where:document.body,url:Uu(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Lu,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let a=A(n,"network-request-failed"),o=y().setTimeout(()=>{s(a)},Ou.get());function c(){y().clearTimeout(o),i(r)}r.ping(c).then(c,()=>{s(a)})}))}function $u(n,e,t,r=Vu,i=Hu){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),o="",c={...Fu,width:r.toString(),height:i.toString(),top:s,left:a},u=v().toLowerCase();t&&(o=Zi(u)?Wu:t),Xi(u)&&(e=e||Bu,c.scrollbars="yes");let d=Object.entries(c).reduce((m,[F,te])=>`${m}${F}=${te},`,"");if(ic(u)&&o!=="_self")return ju(e||"",o),new Lt(null);let f=window.open(e||"",o,d);l(f,n,"popup-blocked");try{f.focus()}catch{}return new Lt(f)}function ju(n,e){let t=document.createElement("a");t.href=n,t.target=e;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}async function Di(n,e,t,r,i,s){l(n.config.authDomain,n,"auth-domain-config-required"),l(n.config.apiKey,n,"invalid-api-key");let a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:se,eventId:i};if(e instanceof O){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",qr(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,f]of Object.entries(s||{}))a[d]=f}if(e instanceof ee){let d=e.getScopes().filter(f=>f!=="");d.length>0&&(a.scopes=d.join(","))}n.tenantId&&(a.tid=n.tenantId);let o=a;for(let d of Object.keys(o))o[d]===void 0&&delete o[d];let c=await n._getAppCheckToken(),u=c?`#${Gu}=${encodeURIComponent(c)}`:"";return`${Ku(n)}?${ne(o).slice(1)}${u}`}function Ku({config:n}){return n.emulator?rr(n,qu):`https://${n.authDomain}/${zu}`}function at(n){return typeof n>"u"||n?.length===0}function Ju(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Yu(n){ie(new D("auth",(e,{options:t})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:o}=r.options;l(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});let c={apiKey:a,authDomain:o,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ss(n)},u=new On(r,i,s,c);return gc(u,t),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),ie(new D("auth-internal",e=>{let t=E(e.getProvider("auth").getImmediate());return(r=>new Qn(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),M(Li,Mi,Ju(n)),M(Li,Mi,"esm2020")}function fa(n=En()){let e=Ne(n,"auth");if(e.isInitialized())return e.getImmediate();let t=cr(n,{popupRedirectResolver:wr,persistence:[Er,_r,Wt]}),r=en("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let a=Zu(s.toString());gr(t,a,()=>a(t.currentUser)),mr(t,o=>a(o))}}let i=xr("auth");return i&&ur(t,`http://${i}`),t}function el(){return document.getElementsByTagName("head")?.[0]??document}var xi,Fi,Vi,Hi,Wi,$i,Zn,ji,zi,dt,ae,ht,Go,Ko,Jo,kn,ft,Rn,We,xe,X,wi,mt,gt,_t,Cn,oc,Pn,On,It,Je,hc,fc,st,Nn,Dn,Ln,Mn,mc,Fe,bi,$e,z,Ee,Cc,x,Nc,oe,ce,q,O,ee,Et,ye,we,Te,Uc,yt,xc,wt,be,N,Un,ue,xn,Fn,Z,Tt,Vn,Hn,Wn,Bn,bt,$n,jn,wn,vt,At,qc,Gc,St,_r,Kc,kt,Gs,Rt,Wt,Ct,zn,Ks,eu,Pt,Js,le,ru,iu,Ot,Er,vn,ou,qn,Gn,Ve,uu,Nt,je,ve,ze,Dt,pu,Ae,mu,ut,Kn,wu,Jn,vu,Au,Ru,lt,Ou,Nu,Du,Lu,Mu,Fu,Vu,Hu,Wu,Bu,Lt,zu,qu,Gu,Sn,Yn,wr,Mt,Xn,qe,Ge,Ut,Ke,Li,Mi,Qn,Xu,Qu,Ui,Zu,pa=P(()=>{De();me();tt();et();xi={PHONE:"phone",TOTP:"totp"},Fi={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Vi={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Hi={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Wi={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"};$i=$o,Zn=Bi,ji=new V("auth","Firebase",Bi()),zi={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};dt=new ge("@firebase/auth");ae=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,$(t>e,"Short delay should be less than long delay!"),this.isMobile=Fr()||Br()}get(){return zo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};ht=class{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;U("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;U("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;U("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};Go={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};Ko=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Jo=new ae(3e4,6e4);kn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(A(this.auth,"network-request-failed")),Jo.get())})}};ft=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Yo(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};Rn=class{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};We=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ue(this.lastLoginAt),this.creationTime=Ue(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};xe=class n{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){l(e.idToken,"internal-error"),l(typeof e.idToken<"u","internal-error"),l(typeof e.refreshToken<"u","internal-error");let t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):yi(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){l(e.length!==0,"internal-error");let t=yi(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(l(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:r,refreshToken:i,expiresIn:s}=await nc(e,t);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){let{refreshToken:r,accessToken:i,expirationTime:s}=t,a=new n;return r&&(l(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(l(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(l(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 n,this.toJSON())}_performRefresh(){return U("not implemented")}};X=class n{constructor({uid:e,auth:t,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new Rn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new We(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let t=await j(this,this.stsTokenManager.getToken(this.auth,e));return l(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return ir(this,e)}reload(){return sr(this)}_assign(e){this!==e&&(l(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new n({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){l(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Be(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(I(this.auth.app))return Promise.reject(w(this.auth));let e=await this.getIdToken();return await j(this,Qo(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){let r=t.displayName??void 0,i=t.email??void 0,s=t.phoneNumber??void 0,a=t.photoURL??void 0,o=t.tenantId??void 0,c=t._redirectEventId??void 0,u=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:F,providerData:te,stsTokenManager:Pr}=t;l(f&&Pr,e,"internal-error");let Ta=xe.fromJSON(this.name,Pr);l(typeof f=="string",e,"internal-error"),Y(r,e.name),Y(i,e.name),l(typeof m=="boolean",e,"internal-error"),l(typeof F=="boolean",e,"internal-error"),Y(s,e.name),Y(a,e.name),Y(o,e.name),Y(c,e.name),Y(u,e.name),Y(d,e.name);let Kt=new n({uid:f,auth:e,email:i,emailVerified:m,displayName:r,isAnonymous:F,photoURL:a,phoneNumber:s,tenantId:o,stsTokenManager:Ta,createdAt:u,lastLoginAt:d});return te&&Array.isArray(te)&&(Kt.providerData=te.map(ba=>({...ba}))),c&&(Kt._redirectEventId=c),Kt}static async _fromIdTokenResponse(e,t,r=!1){let i=new xe;i.updateFromServerResponse(t);let s=new n({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Be(s),s}static async _fromGetAccountInfoResponse(e,t,r){let i=t.users[0];l(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?Yi(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,o=new xe;o.updateFromIdToken(r);let c=new n({uid:i.localId,auth:e,stsTokenManager:o,isAnonymous:a}),u={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new We(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,u),c}};wi=new Map;mt=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};mt.type="NONE";gt=mt;_t=class n{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=ct(this.userKey,i.apiKey,s),this.fullPersistenceKey=ct("persistence",i.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let t=await pt(this.auth,{idToken:e}).catch(()=>{});return t?X._fromGetAccountInfoResponse(this.auth,t,e):null}return X._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;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new n(W(gt),e,r);let i=(await Promise.all(t.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u),s=i[0]||W(gt),a=ct(r,e.config.apiKey,e.name),o=null;for(let u of t)try{let d=await u._get(a);if(d){let f;if(typeof d=="string"){let m=await pt(e,{idToken:d}).catch(()=>{});if(!m)break;f=await X._fromGetAccountInfoResponse(e,m,d)}else f=X._fromJSON(e,d);u!==s&&(o=f),s=u;break}}catch{}let c=i.filter(u=>u._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new n(s,e,r):(s=c[0],o&&await s._set(a,o.toJSON()),await Promise.all(t.map(async u=>{if(u!==s)try{await u._remove(a)}catch{}})),new n(s,e,r))}};Cn=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let r=s=>new Promise((a,o)=>{try{let c=e(s);a(c)}catch(c){o(c)}});r.onAbort=t,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(let i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}};oc=6,Pn=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??oc,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};On=class{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new It(this),this.idTokenSubscription=new It(this),this.beforeStateQueue=new Cn(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=ji,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(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=W(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await _t.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await pt(this,{idToken:e}),r=await X._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(I(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),r=t,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,a=r?._redirectEventId,o=await this.tryRedirectSignIn(e);(!s||s===a)&&o?.user&&(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return l(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{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Be(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=qo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(I(this.app))return Promise.reject(w(this));let t=e?h(e):null;return t&&l(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&l(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 I(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 I(this.app)?Promise.reject(w(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(W(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let 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 this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await ac(this),t=new Pn(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new V("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await rc(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&W(e)||this._popupRedirectResolver;l(t,this,"argument-error"),this.redirectPersistenceManager=await _t.create(this,[W(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};let s=typeof t=="function"?t:t.next.bind(t),a=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(l(o,this,"internal-error"),o.then(()=>{a||s(this.currentUser)}),typeof t=="function"){let c=e.addObserver(t,r,i);return()=>{a=!0,c()}}else{let c=e.addObserver(t);return()=>{a=!0,c()}}}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 l(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ss(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(I(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&jo(`Error while retrieving App Check token: ${e.error}`),e?.token}};It=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Gr(t=>this.observer=t)}get next(){return l(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};Je={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};hc=500,fc=6e4,st=1e12,Nn=class{constructor(e){this.auth=e,this.counter=st,this._widgets=new Map}render(e,t){let r=this.counter;return this._widgets.set(r,new Mn(e,this.auth.name,t||{})),this.counter++,r}reset(e){let t=e||st;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){let t=e||st;return this._widgets.get(t)?.getResponse()||""}async execute(e){let t=e||st;return this._widgets.get(t)?.execute(),""}},Dn=class{constructor(){this.enterprise=new Ln}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Ln=class{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Mn=class{constructor(e,t,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i=typeof e=="string"?document.getElementById(e):e;l(i,"argument-error",{appName:t}),this.container=i,this.isVisible=this.params.size!=="invisible",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=pc(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},fc)},hc))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};mc="recaptcha-enterprise",Fe="NO_RECAPTCHA",bi="onFirebaseAuthREInstanceReady",$e=class n{constructor(e){this.type=mc,this.auth=E(e)}async verify(e="verify",t=!1){async function r(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(a,o)=>{Ki(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)o(new Error("recaptcha Enterprise site key undefined"));else{let u=new ft(c);return s.tenantId==null?s._agentRecaptchaConfig=u:s._tenantRecaptchaConfigs[s.tenantId]=u,a(u.siteKey)}}).catch(c=>{o(c)})})}function i(s,a,o){let c=window.grecaptcha;Ei(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(u=>{a(u)}).catch(()=>{a(Fe)})}):o(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Dn().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async o=>{if(!t&&Ei(window.grecaptcha)&&n.scriptInjectionDeferred)await n.scriptInjectionDeferred.promise,i(o,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let c=lc();c.length!==0&&(c+=o+`&onload=${bi}`),n.scriptInjectionDeferred=new he,window[bi]=()=>{n.scriptInjectionDeferred?.resolve()},or(c).then(()=>n.scriptInjectionDeferred?.promise).then(()=>{i(o,s,a)}).catch(u=>{a(u)})}}).catch(o=>{a(o)})})}};$e.scriptInjectionDeferred=null;z=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return U("not implemented")}_getIdTokenResponse(e){return U("not implemented")}_linkToIdToken(e,t){return U("not implemented")}_getReauthenticationResolver(e){return U("not implemented")}};Ee=class n extends z{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new n(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new n(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Q(e,t,"signInWithPassword",Tc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return kc(e,{email:this._email,oobCode:this._password});default:S(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":let r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Q(e,r,"signUpPassword",yc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Rc(e,{idToken:t,email:this._email,oobCode:this._password});default:S(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};Cc="http://localhost",x=class n extends z{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new n(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):S("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=t;if(!r||!i)return null;let a=new n(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){let t=this.buildRequest();return B(e,t)}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,B(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,B(e,t)}buildRequest(){let e={requestUri:Cc,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let 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=ne(t)}return e}};Nc={USER_NOT_FOUND:"user-not-found"};oe=class n extends z{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new n({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new n({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return Pc(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return Oc(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Dc(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:i}}toJSON(){let 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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:t,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!t&&!i&&!s?null:new n({verificationId:t,verificationCode:r,phoneNumber:i,temporaryProof:s})}};ce=class n{constructor(e){let t=fe(pe(e)),r=t.apiKey??null,i=t.oobCode??null,s=Lc(t.mode??null);l(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t=Mc(e);try{return new n(t)}catch{return null}}};q=class n{constructor(){this.providerId=n.PROVIDER_ID}static credential(e,t){return Ee._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let r=ce.parseLink(t);return l(r,"argument-error"),Ee._fromEmailAndCode(e,r.code,r.tenantId)}};q.PROVIDER_ID="password";q.EMAIL_PASSWORD_SIGN_IN_METHOD="password";q.EMAIL_LINK_SIGN_IN_METHOD="emailLink";O=class{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}};ee=class extends O{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Et=class n extends ee{static credentialFromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;return l("providerId"in t&&"signInMethod"in t,"argument-error"),x._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return l(e.idToken||e.accessToken,"argument-error"),x._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return n.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return n.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:o}=e;if(!r&&!i&&!t&&!s||!o)return null;try{return new n(o)._credential({idToken:t,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}};ye=class n extends ee{constructor(){super("facebook.com")}static credential(e){return x._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};ye.FACEBOOK_SIGN_IN_METHOD="facebook.com";ye.PROVIDER_ID="facebook.com";we=class n extends ee{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return x._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return n.credential(t,r)}catch{return null}}};we.GOOGLE_SIGN_IN_METHOD="google.com";we.PROVIDER_ID="google.com";Te=class n extends ee{constructor(){super("github.com")}static credential(e){return x._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};Te.GITHUB_SIGN_IN_METHOD="github.com";Te.PROVIDER_ID="github.com";Uc="http://localhost",yt=class n extends z{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){let t=this.buildRequest();return B(e,t)}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,B(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,B(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=t;return!r||!i||!s||r!==i?null:new n(r,s)}static _create(e,t){return new n(e,t)}buildRequest(){return{requestUri:Uc,returnSecureToken:!0,pendingToken:this.pendingToken}}};xc="saml.",wt=class n extends O{constructor(e){l(e.startsWith(xc),"argument-error"),super(e)}static credentialFromResult(e){return n.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return n.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let t=yt.fromJSON(e);return l(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:t,providerId:r}=e;if(!t||!r)return null;try{return yt._create(r,t)}catch{return null}}};be=class n extends ee{constructor(){super("twitter.com")}static credential(e,t){return x._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return n.credential(t,r)}catch{return null}}};be.TWITTER_SIGN_IN_METHOD="twitter.com";be.PROVIDER_ID="twitter.com";N=class n{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){let s=await X._fromIdTokenResponse(e,r,i),a=Si(r);return new n({user:s,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);let i=Si(r);return new n({user:e,providerId:i,_tokenResponse:r,operationType:t})}};Un=class n extends R{constructor(e,t,r,i){super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,n.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new n(e,t,r,i)}};ue=class{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?xn._fromServerResponse(e,t):"totpInfo"in t?Fn._fromServerResponse(e,t):S(e,"internal-error")}},xn=class n extends ue{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new n(t)}},Fn=class n extends ue{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new n(t)}};Z=class{constructor(e,t,r={}){this.isNewUser=e,this.providerId=t,this.profile=r}},Tt=class extends Z{constructor(e,t,r,i){super(e,t,r),this.username=i}},Vn=class extends Z{constructor(e,t){super(e,"facebook.com",t)}},Hn=class extends Tt{constructor(e,t){super(e,"github.com",t,typeof t?.login=="string"?t?.login:null)}},Wn=class extends Z{constructor(e,t){super(e,"google.com",t)}},Bn=class extends Tt{constructor(e,t,r){super(e,"twitter.com",t,r)}};bt=class n{constructor(e,t,r){this.type=e,this.credential=t,this.user=r}static _fromIdtoken(e,t){return new n("enroll",e,t)}static _fromMfaPendingCredential(e){return new n("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return n._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return n._fromIdtoken(e.multiFactorSession.idToken)}return null}};$n=class n{constructor(e,t,r){this.session=e,this.hints=t,this.signInResolver=r}static _fromError(e,t){let r=E(e),i=t.customData._serverResponse,s=(i.mfaInfo||[]).map(o=>ue._fromServerResponse(r,o));l(i.mfaPendingCredential,r,"internal-error");let a=bt._fromMfaPendingCredential(i.mfaPendingCredential);return new n(a,s,async o=>{let c=await o._process(r,a);delete i.mfaInfo,delete i.mfaPendingCredential;let u={...i,idToken:c.idToken,refreshToken:c.refreshToken};switch(t.operationType){case"signIn":let d=await N._fromIdTokenResponse(r,t.operationType,u);return await r._updateCurrentUser(d.user),d;case"reauthenticate":return l(t.user,r,"internal-error"),N._forOperation(t.user,t.operationType,u);default:S(r,"internal-error")}})}async resolveSignIn(e){let t=e;return this.signInResolver(t)}};jn=class n{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(r=>ue._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new n(e)}async getSession(){return bt._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){let r=e,i=await this.getSession(),s=await j(this.user,r._process(this.user.auth,i,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let t=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{let i=await j(this.user,zc(this.user.auth,{idToken:r,mfaEnrollmentId:t}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==t),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}},wn=new WeakMap;vt="__sak";At=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(vt,"1"),this.storage.removeItem(vt),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let 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()}};qc=1e3,Gc=10,St=class extends At{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=is(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((a,o,c)=>{this.notifyListeners(a,c)});return}let r=e.key;t?this.detachListener():this.stopPolling();let i=()=>{let a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);sc()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Gc):i()}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},qc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};St.type="LOCAL";_r=St;Kc=1e3;kt=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=bn(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:Tn(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=bn(e);document.cookie=`${r}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;let r=bn(e);if(window.cookieStore){let o=(u=>{let d=u.changed.find(m=>m.name===r);d&&t(d.value),u.deleted.find(m=>m.name===r)&&t(null)}),c=()=>window.cookieStore.removeEventListener("change",o);return this.listenerUnsubscribes.set(t,c),window.cookieStore.addEventListener("change",o)}let i=Tn(r),s=setInterval(()=>{let o=Tn(r);o!==i&&(t(o),i=o)},Kc),a=()=>clearInterval(s);this.listenerUnsubscribes.set(t,a)}_removeListener(e,t){let r=this.listenerUnsubscribes.get(t);r&&(r(),this.listenerUnsubscribes.delete(t))}};kt.type="COOKIE";Gs=kt;Rt=class extends At{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}};Rt.type="SESSION";Wt=Rt;Ct=class n{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;let r=new n(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:r,eventType:i,data:s}=t.data,a=this.handlersMap[i];if(!a?.size)return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let o=Array.from(a).map(async u=>u(t.origin,s)),c=await Jc(o);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Ct.receivers=[];zn=class{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,r=50){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,a;return new Promise((o,c)=>{let u=Bt("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(f){let m=f;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),o(m.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:u,data:t},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};Ks="firebaseLocalStorageDb",eu=1,Pt="firebaseLocalStorage",Js="fbase_key",le=class{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)})})}};ru=800,iu=3,Ot=class{constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=Ys(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(t++>iu)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Ir()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ct._getInstance(Zc()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Xc(),!this.activeServiceWorker)return;this.sender=new zn(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Qc()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await Ri(e,vt,"1"),await Ci(e,vt)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Ri(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(r=>nu(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Ci(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=$t(i,!1).getAll();return new le(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let t=[],r=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),ru)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};Ot.type="LOCAL";Er=Ot;vn=as("rcb"),ou=new ae(3e4,6e4),qn=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!y().grecaptcha?.render}load(e,t=""){return l(cu(t),e,"argument-error"),this.shouldResolveImmediately(t)&&Ii(y().grecaptcha)?Promise.resolve(y().grecaptcha):new Promise((r,i)=>{let s=y().setTimeout(()=>{i(A(e,"network-request-failed"))},ou.get());y()[vn]=()=>{y().clearTimeout(s),delete y()[vn];let o=y().grecaptcha;if(!o||!Ii(o)){i(A(e,"internal-error"));return}let c=o.render;o.render=(u,d)=>{let f=c(u,d);return this.counter++,f},this.hostLanguage=t,r(o)};let a=`${uc()}?${ne({onload:vn,render:"explicit",hl:t})}`;or(a).catch(()=>{clearTimeout(s),i(A(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!y().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Gn=class{async load(e){return new Nn(e)}clearedOneInstance(){}};Ve="recaptcha",uu={theme:"light",type:"image"},Nt=class{constructor(e,t,r={...uu}){this.parameters=r,this.type=Ve,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=E(e),this.isInvisible=this.parameters.size==="invisible",l(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let i=typeof t=="string"?document.getElementById(t):t;l(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Gn:new qn,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),r=t.getResponse(e);return r||new Promise(i=>{let s=a=>{a&&(this.tokenChangeListeners.delete(s),i(a))};this.tokenChangeListeners.add(s),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){l(!this.parameters.sitekey,this.auth,"argument-error"),l(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),l(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(r=>r(t)),typeof e=="function")e(t);else if(typeof e=="string"){let r=y()[e];typeof r=="function"&&r(t)}}}assertNotDestroyed(){l(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){l(nr()&&!Ir(),this.auth,"internal-error"),await lu(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await Xo(this.auth);l(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return l(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};je=class{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=oe._fromVerification(this.verificationId,e);return this.onConfirmation(t)}};ve=class n{constructor(e){this.providerId=n.PROVIDER_ID,this.auth=E(e)}verifyPhoneNumber(e,t){return jt(this.auth,e,h(t))}static credential(e,t){return oe._fromVerification(e,t)}static credentialFromResult(e){let t=e;return n.credentialFromTaggedObject(t)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:r}=e;return t&&r?oe._fromTokenResponse(t,r):null}};ve.PROVIDER_ID="phone";ve.PHONE_SIGN_IN_METHOD="phone";ze=class extends z{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return B(e,this._buildIdpRequest())}_linkToIdToken(e,t){return B(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return B(e,this._buildIdpRequest())}_buildIdpRequest(e){let 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}};Dt=class{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:r,postBody:i,tenantId:s,error:a,type:o}=e;if(a){this.reject(a);return}let c={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return du;case"linkViaPopup":case"linkViaRedirect":return fu;case"reauthViaPopup":case"reauthViaRedirect":return hu;default:S(this.auth,"internal-error")}}resolve(e){$(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(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()}};pu=new ae(2e3,1e4);Ae=class n extends Dt{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return l(e,this.auth,"internal-error"),e}async onExecution(){$(this.filter.length===1,"Popup operations only handle one event");let e=Bt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(A(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(A(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(A(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,pu.get())};e()}};Ae.currentPopupAction=null;mu="pendingRedirect",ut=new Map,Kn=class extends Dt{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=ut.get(this.auth._key());if(!e){try{let r=await gu(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}ut.set(this.auth._key(),e)}return this.bypassAuthState||ut.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};wu=600*1e3,Jn=class{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(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Tu(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!ha(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(A(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=wu&&this.cachedEventUids.clear(),this.cachedEventUids.has(Oi(e))}saveEventToCache(e){this.cachedEventUids.add(Oi(e)),this.lastProcessedEventTime=Date.now()}};vu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Au=/^https?/;Ru=new ae(3e4,6e4);lt=null;Ou=new ae(5e3,15e3),Nu="__/auth/iframe",Du="emulator/auth/iframe",Lu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Mu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);Fu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Vu=500,Hu=600,Wu="_blank",Bu="http://localhost",Lt=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};zu="__/auth/handler",qu="emulator/auth/handler",Gu=encodeURIComponent("fac");Sn="webStorageSupport",Yn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Wt,this._completeRedirectFn=la,this._overrideRedirectResult=_u}async _openPopup(e,t,r,i){$(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Di(e,t,r,He(),i);return $u(e,s,Bt())}async _openRedirect(e,t,r,i){await this._originValidation(e);let s=await Di(e,t,r,He(),i);return Yc(s),new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):($(s,"If manager is not set, promise should be"),s)}let r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){let t=await xu(e),r=new Jn(e);return t.register("authEvent",i=>(l(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Sn,{type:Sn},i=>{let s=i?.[0]?.[Sn];s!==void 0&&t(!!s),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Su(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return is()||Qi()||ar()}},wr=Yn,Mt=class{constructor(e){this.factorId=e}_process(e,t,r){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,r);case"signin":return this._finalizeSignIn(e,t.credential);default:return U("unexpected MultiFactorSessionType")}}},Xn=class n extends Mt{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new n(e)}_finalizeEnroll(e,t,r){return Bc(e,{idToken:t,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return su(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},qe=class{constructor(){}static assertion(e){return Xn._fromCredential(e)}};qe.FACTOR_ID="phone";Ge=class{static assertionForEnrollment(e,t){return Ut._fromSecret(e,t)}static assertionForSignIn(e,t){return Ut._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;l(typeof t.user?.auth<"u","internal-error");let r=await $c(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ke._fromStartTotpMfaEnrollmentResponse(r,t.user.auth)}};Ge.FACTOR_ID="totp";Ut=class n extends Mt{constructor(e,t,r){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=r}static _fromSecret(e,t){return new n(t,void 0,e)}static _fromEnrollmentId(e,t){return new n(t,e)}async _finalizeEnroll(e,t,r){return l(typeof this.secret<"u",e,"argument-error"),jc(e,{idToken:t,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){l(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return au(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},Ke=class n{constructor(e,t,r,i,s,a,o){this.sessionInfo=a,this.auth=o,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new n(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let r=!1;return(at(e)||at(t))&&(r=!0),r&&(at(e)&&(e=this.auth.currentUser?.email||"unknownuser"),at(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Li="@firebase/auth",Mi="1.13.3";Qn=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){l(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};Xu=300,Qu=en("authIdTokenMaxAge")||Xu,Ui=null,Zu=n=>async e=>{let t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>Qu)return;let i=t?.token;Ui!==i&&(Ui=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};cc({loadJS(n){return new Promise((e,t)=>{let r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{let s=A("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",el().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Yu("Browser")});var ma=P(()=>{pa();De();me();tt();et()});var zt={};Or(zt,{ActionCodeOperation:()=>Wi,ActionCodeURL:()=>ce,AuthCredential:()=>z,AuthErrorCodes:()=>zi,EmailAuthCredential:()=>Ee,EmailAuthProvider:()=>q,FacebookAuthProvider:()=>ye,FactorId:()=>xi,GithubAuthProvider:()=>Te,GoogleAuthProvider:()=>we,OAuthCredential:()=>x,OAuthProvider:()=>Et,OperationType:()=>Hi,PhoneAuthCredential:()=>oe,PhoneAuthProvider:()=>ve,PhoneMultiFactorGenerator:()=>qe,ProviderId:()=>Fi,RecaptchaVerifier:()=>Nt,SAMLAuthProvider:()=>wt,SignInMethod:()=>Vi,TotpMultiFactorGenerator:()=>Ge,TotpSecret:()=>Ke,TwitterAuthProvider:()=>be,applyActionCode:()=>ws,beforeAuthStateChanged:()=>gr,browserCookiePersistence:()=>Gs,browserLocalPersistence:()=>_r,browserPopupRedirectResolver:()=>wr,browserSessionPersistence:()=>Wt,checkActionCode:()=>pr,confirmPasswordReset:()=>ys,connectAuthEmulator:()=>ur,createUserWithEmailAndPassword:()=>bs,debugErrorMap:()=>$i,deleteUser:()=>js,fetchSignInMethodsForEmail:()=>Rs,getAdditionalUserInfo:()=>Ms,getAuth:()=>fa,getIdToken:()=>Ji,getIdTokenResult:()=>ir,getMultiFactorResolver:()=>zs,getRedirectResult:()=>ua,inMemoryPersistence:()=>gt,indexedDBLocalPersistence:()=>Er,initializeAuth:()=>cr,initializeRecaptchaConfig:()=>xs,isSignInWithEmailLink:()=>Ss,linkWithCredential:()=>dr,linkWithPhoneNumber:()=>Qs,linkWithPopup:()=>ra,linkWithRedirect:()=>ca,multiFactor:()=>qs,onAuthStateChanged:()=>Vs,onIdTokenChanged:()=>mr,parseActionCodeURL:()=>ls,prodErrorMap:()=>Zn,reauthenticateWithCredential:()=>hr,reauthenticateWithPhoneNumber:()=>Zs,reauthenticateWithPopup:()=>na,reauthenticateWithRedirect:()=>oa,reload:()=>sr,revokeAccessToken:()=>$s,sendEmailVerification:()=>Cs,sendPasswordResetEmail:()=>Es,sendSignInLinkToEmail:()=>As,setPersistence:()=>Us,signInAnonymously:()=>hs,signInWithCredential:()=>Ye,signInWithCustomToken:()=>Is,signInWithEmailAndPassword:()=>vs,signInWithEmailLink:()=>ks,signInWithPhoneNumber:()=>Xs,signInWithPopup:()=>ta,signInWithRedirect:()=>aa,signOut:()=>Bs,unlink:()=>ms,updateCurrentUser:()=>Ws,updateEmail:()=>Ns,updatePassword:()=>Ds,updatePhoneNumber:()=>ea,updateProfile:()=>Os,useDeviceLanguage:()=>Hs,validatePassword:()=>Fs,verifyBeforeUpdateEmail:()=>Ps,verifyPasswordResetCode:()=>Ts});var qt=P(()=>{ma()});var tl={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},Tr=null,Gt=null;async function Xe(){return typeof window>"u"?null:(Tr||(Tr=(async()=>{let{initializeApp:n,getApps:e}=await Promise.resolve().then(()=>(gi(),mi)),{getAuth:t,signInAnonymously:r,onAuthStateChanged:i}=await Promise.resolve().then(()=>(qt(),zt)),s=e().length?e()[0]:n(tl);if(Gt=t(s),!await new Promise(o=>{let c=i(Gt,u=>{c(),o(u)})}))try{await r(Gt)}catch(o){console.warn("[Fleetbo Auth] Anonymous session created in offline mode or delayed:",o.message)}return Gt})()),Tr)}async function ga(){try{let n=await Xe();return!n||!n.currentUser?null:await n.currentUser.getIdToken()}catch(n){return console.error("[Fleetbo Auth Debug]",n),null}}async function _a(n){let e=await Xe(),{signInWithCustomToken:t}=await Promise.resolve().then(()=>(qt(),zt)),r=await t(e,n);return{uid:r.user.uid,email:r.user.email,isAnonymous:r.user.isAnonymous}}async function Ia(){let n=await Xe(),{signOut:e,signInAnonymously:t}=await Promise.resolve().then(()=>(qt(),zt));return await e(n),await t(n),!0}async function Ea(){let n=await Xe();return!n||!n.currentUser?null:{uid:n.currentUser.uid,email:n.currentUser.email,isAnonymous:n.currentUser.isAnonymous}}async function ya(n=!1){try{let e=await Xe();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(n)).claims.elog===!0}catch(e){return console.error("[Fleetbo Auth Debug]",e),!1}}var nl="https://fleetbo-gatekeeper.fleetbo.workers.dev/",T=async(n,e=null)=>{try{let t=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_DB_KEY:process.env.VITE_FLEETBO_DB_KEY,r=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_ENTERPRISE_ID:process.env.VITE_FLEETBO_ENTERPRISE_ID,i=n.replace("https://","").split("-")[0]||"add",s={"Content-Type":"application/json"},a=await ga();a&&(s.Authorization=`Bearer ${a}`);let o={targetFunction:i,enterpriseID:r,fleetboDB:t,fleetboTable:e?.fleetboTable||null,jsonData:e?.jsonData||e,data:{fleetboDB:t,enterpriseID:r,...e}},c=await fetch(nl,{method:"POST",headers:s,body:JSON.stringify(o)}),u=await c.json(),d=u.result||u;return{success:c.ok,...d}}catch(t){return{success:!1,error:t.message}}};var br=class extends HTMLElement{static get observedAttributes(){return["value","fallback"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=this.getAttribute("fallback")||"\u2014";this.textContent=e!=null&&e!=="null"&&e!=="undefined"?String(e):t}},vr=class extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=this.getAttribute("invalid-fallback")||"0",r=Number(e);if(e===null||e===""||Number.isNaN(r)){this.textContent=t;return}let i=this.getAttribute("currency");i?this.textContent=new Intl.NumberFormat("fr-FR",{style:"currency",currency:i}).format(r):this.textContent=String(r)}},Ar=class extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=this.getAttribute("label-true")||"Oui",r=this.getAttribute("label-false")||"Non",i=this.getAttribute("invalid-fallback")||"Inconnu";e==="true"||e==="1"?this.textContent=t:e==="false"||e==="0"?this.textContent=r:this.textContent=i}},Sr=class extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=this.getAttribute("invalid-fallback")||"Date invalide",r=this.getAttribute("locale")||"fr-FR",i=new Date(e);if(!e||Number.isNaN(i.getTime())){this.textContent=t;return}this.textContent=i.toLocaleDateString(r)}},kr=class extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=(this.getAttribute("allowed")||"").split(",").map(i=>i.trim()),r=this.getAttribute("invalid-fallback")||"Statut non autoris\xE9";if(!t.includes(e)){this.textContent=r;return}this.textContent=String(e)}},Rr=class extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let e=this.getAttribute("value"),t=this.getAttribute("fallback")||"",r=this.getAttribute("alt")||"Media";this.innerHTML="";let i=document.createElement("img");i.src=e&&e!=="null"?e:t,i.alt=r,this.appendChild(i)}},Cr=class extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let e=this.getAttribute("table"),t=this.getAttribute("id"),r=this.getAttribute("field")||"name",i=this.getAttribute("orphan-fallback")||"Supprim\xE9",s=this.getAttribute("loading-fallback")||"Chargement...",a=this.getAttribute("malformed-fallback")||"ID invalide";if(!t||typeof t!="string"||t.trim()===""||t==="null"||t==="undefined"){this.textContent=a;return}if(!e){this.textContent=a;return}this.textContent=s;try{let o=await window.Fleetbo.getDoc(e,t);o&&o[r]!==void 0?this.textContent=String(o[r]):o?this.textContent=o.name||o.title||o.label||JSON.stringify(o):this.textContent=i}catch{this.textContent=i}}};if(typeof window<"u"&&typeof customElements<"u"){let n=(e,t)=>{customElements.get(e)||customElements.define(e,t)};n("fleetbo-text",br),n("fleetbo-number",vr),n("fleetbo-toggle",Ar),n("fleetbo-date",Sr),n("fleetbo-enum",kr),n("fleetbo-media",Rr),n("fleetbo-reference",Cr)}var wa={Text:"fleetbo-text",Number:"fleetbo-number",Toggle:"fleetbo-toggle",Date:"fleetbo-date",Enum:"fleetbo-enum",Media:"fleetbo-media",Reference:"fleetbo-reference"};function ke(n){typeof window>"u"&&typeof process<"u"&&process.env}async function C(n){if(n&&n._schemaVersion&&n._schemaData){let e=n._schemaVersion,t=n._schemaData;if(typeof window<"u")try{await fetch("/__fleetbo_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:t,version:e})})}catch{}else typeof process<"u"&&process.env}return n}var b=n=>`https://${n.toLowerCase()}-jqycakhlxa-uc.a.run.app`,rl=()=>new Proxy({},{get(n,e){let t=String(e);return async(r={})=>{let i=await T(b("call"),{functionName:t,payload:r});return C(i)}}}),il={...wa,call:rl(),add:async(n,e)=>{ke(n);let t=await T(b("add"),{fleetboTable:n,jsonData:e});return C(t)},addWithId:async(n,e,t)=>{ke(n);let r=await T(b("addWithId"),{fleetboTable:n,id:t,jsonData:e});return C(r)},addWithUserId:async(n,e)=>{ke(n);let t=await T(b("addWithUserId"),{fleetboTable:n,jsonData:e});return C(t)},addWithMedia:async(n,e,t,r=null)=>{ke(n);let i=await T(b("addWithMedia"),{fleetboTable:n,jsonData:e,fileBase64:t,fileName:r});return C(i)},delete:async(n,e)=>{let t=await T(b("delete"),{fleetboTable:n,id:e});return C(t)},getDocsG:async n=>{let e=await T(b("getDocsG"),{fleetboTable:n}),t=await C(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDocsU:async n=>{let e=await T(b("getDocsU"),{fleetboTable:n}),t=await C(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDoc:async(n,e)=>{let t=await T(b("getDoc"),{fleetboTable:n,id:e}),r=await C(t);return r?r.data!==void 0?r.data:r.success===!1?null:r:null},getUser:async()=>await Ea(),getAuthUser:async()=>{let n=await T(b("getAuthUser")),e=await C(n);return e?e.data!==void 0?e.data:e.success===!1?null:e:null},update:async(n,e,t)=>{let r=await T(b("update"),{fleetboTable:n,id:e,...t});return C(r)},join:async(n,e)=>{ke(n),e?.innerJoin?.collection&&ke(e.innerJoin.collection);let t=await T(b("join"),{fleetboTable:n,joinOptions:e}),r=await C(t);return Array.isArray(r)?r:r&&Array.isArray(r.data)?r.data:[]},sendotpsvro:async n=>await T(b("sendOtpSvro"),{email:n}),verifyotpsvro:async(n,e)=>{let t=await T(b("verifyOtpSvro"),{email:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await _a(t.customToken)}}catch(r){return{success:!1,error:r.message}}return t},isAuthenticated:async(n=!1)=>await ya(n),logout:async()=>{try{return await Ia(),{success:!0}}catch(n){return{success:!1,error:n.message}}},acl:{grant:async(n,e,t,r="*")=>await T(b("grantAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:r}),revoke:async(n,e,t,r="*")=>await T(b("revokeAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:r}),can:async(n,e,t="*")=>{let r=await T(b("checkAcl"),{action:n,resourceTable:e,resourceId:t});return!!(r&&(r.allowed===!0||r.can===!0))}}};typeof window<"u"&&(window.Fleetbo=il,window.FleetboUI=wa);export{il as Fleetbo,wa as FleetboUI};
1
+ var _a=Object.defineProperty;var O=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(i){throw t=[i],i}};var Ai=(n,e)=>{for(var t in e)_a(n,t,{get:e[t],enumerable:!0})};var Si,ki=O(()=>{Si=()=>{}});function Ea(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}function v(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ni(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())}function Di(){return typeof window<"u"||rn()}function rn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Li(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Mi(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Ui(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Fi(){let n=v();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function xi(){try{return typeof indexedDB=="object"}catch{return!1}}function Vi(){return new Promise((n,e)=>{try{let t=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},r.onupgradeneeded=()=>{t=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Aa(n,e){return n.replace(Sa,(t,i)=>{let r=e[i];return r!=null?String(r):`<${i}?>`})}function Hi(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Y(n,e){if(n===e)return!0;let t=Object.keys(n),i=Object.keys(e);for(let r of t){if(!i.includes(r))return!1;let s=n[r],o=e[r];if(Ri(s)&&Ri(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let r of i)if(!t.includes(r))return!1;return!0}function Ri(n){return n!==null&&typeof n=="object"}function re(n){let e=[];for(let[t,i]of Object.entries(n))Array.isArray(i)?i.forEach(r=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function me(n){let e={};return n.replace(/^\?/,"").split("&").forEach(i=>{if(i){let[r,s]=i.split("=");e[decodeURIComponent(r)]=decodeURIComponent(s)}}),e}function ge(n){let e=n.indexOf("?");if(!e)return"";let t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Wi(n,e){let t=new Zt(n,e);return t.subscribe.bind(t)}function ka(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Xt(){}function p(n){return n&&n._delegate?n._delegate:n}function tt(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Bi(n){return(await fetch(n,{credentials:"include"})).ok}var Ci,Ia,Pi,Qt,ba,en,Pe,ya,wa,Ta,tn,Oi,et,nn,pe,va,C,W,Sa,Zt,tu,_e=O(()=>{ki();Ci=function(n){let e=[],t=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):(r&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++i)&1023),e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},Ia=function(n){let e=[],t=0,i=0;for(;t<n.length;){let r=n[t++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){let s=n[t++];e[i++]=String.fromCharCode((r&31)<<6|s&63)}else if(r>239&&r<365){let s=n[t++],o=n[t++],c=n[t++],l=((r&7)<<18|(s&63)<<12|(o&63)<<6|c&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{let s=n[t++],o=n[t++];e[i++]=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Pi={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:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<n.length;r+=3){let s=n[r],o=r+1<n.length,c=o?n[r+1]:0,l=r+2<n.length,a=l?n[r+2]:0,d=s>>2,h=(s&3)<<4|c>>4,f=(c&15)<<2|a>>6,A=a&63;l||(A=64,o||(f=64)),i.push(t[d],t[h],t[f],t[A])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Ci(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Ia(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<n.length;){let s=t[n.charAt(r++)],c=r<n.length?t[n.charAt(r)]:0;++r;let a=r<n.length?t[n.charAt(r)]:64;++r;let h=r<n.length?t[n.charAt(r)]:64;if(++r,s==null||c==null||a==null||h==null)throw new Qt;let f=s<<2|c>>4;if(i.push(f),a!==64){let A=c<<4&240|a>>2;if(i.push(A),h!==64){let L=a<<6&192|h;i.push(L)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},Qt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ba=function(n){let e=Ci(n);return Pi.encodeByteArray(e,!0)},en=function(n){return ba(n).replace(/\./g,"")},Pe=function(n){try{return Pi.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};ya=()=>Ea().__FIREBASE_DEFAULTS__,wa=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Ta=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Pe(n[1]);return e&&JSON.parse(e)},tn=()=>{try{return Si()||ya()||wa()||Ta()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Oi=n=>tn()?.emulatorHosts?.[n],et=()=>tn()?.config,nn=n=>tn()?.[`_${n}`];pe=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,i)=>{t?this.reject(t):this.resolve(i),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,i))}}};va="FirebaseError",C=class n extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=va,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,W.prototype.create)}},W=class{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){let i=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],o=s?Aa(s,i):"Error",c=`${this.serviceName}: ${o} (${r}).`;return new C(r,c,i)}};Sa=/\{\$([^}]+)}/g;Zt=class{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(i=>{this.error(i)})}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,i){let r;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");ka(e,["next","error","complete"])?r=e:r={next:e,error:t,complete:i},r.next===void 0&&(r.next=Xt),r.error===void 0&&(r.error=Xt),r.complete===void 0&&(r.complete=Xt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(i){typeof console<"u"&&console.error&&console.error(i)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};tu=14400*1e3;});function Ra(n){return n===se?void 0:n}function Ca(n){return n.instantiationMode==="EAGER"}var U,se,sn,Oe,nt=O(()=>{_e();U=class{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,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}};se="[DEFAULT]";sn=class{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){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let i=new pe;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),i=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(r){if(i)return null;throw r}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}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(Ca(e))try{this.getOrInitializeService({instanceIdentifier:se})}catch{}for(let[t,i]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:r});i.resolve(s)}catch{}}}}clearInstance(e=se){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=se){return this.instances.has(e)}getOptions(e=se){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:i,options:t});for(let[s,o]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);i===c&&o.resolve(r)}return r}onInit(e,t){let i=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(i)??new Set;r.add(e),this.onInitCallbacks.set(i,r);let s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let i=this.onInitCallbacks.get(t);if(i)for(let r of i)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:Ra(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=se){return this.component?this.component.multipleInstances?e:se:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Oe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let 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);let t=new sn(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}});function ji(n){an.forEach(e=>{e.setLogLevel(n)})}function zi(n,e){for(let t of an){let i=null;e&&e.level&&(i=$i[e.level]),n===null?t.userLogHandler=null:t.userLogHandler=(r,s,...o)=>{let c=o.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(i??r.logLevel)&&n({level:m[s].toLowerCase(),message:c,args:o,type:r.name})}}}var an,m,$i,Pa,Oa,Na,Ie,it=O(()=>{an=[];(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(m||(m={}));$i={debug:m.DEBUG,verbose:m.VERBOSE,info:m.INFO,warn:m.WARN,error:m.ERROR,silent:m.SILENT},Pa=m.INFO,Oa={[m.DEBUG]:"log",[m.VERBOSE]:"log",[m.INFO]:"info",[m.WARN]:"warn",[m.ERROR]:"error"},Na=(n,e,...t)=>{if(e<n.logLevel)return;let i=new Date().toISOString(),r=Oa[e];if(r)console[r](`[${i}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Ie=class{constructor(e){this.name=e,this._logLevel=Pa,this._logHandler=Na,this._userLogHandler=null,an.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in m))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?$i[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,m.DEBUG,...e),this._logHandler(this,m.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,m.VERBOSE,...e),this._logHandler(this,m.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,m.INFO,...e),this._logHandler(this,m.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,m.WARN,...e),this._logHandler(this,m.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,m.ERROR,...e),this._logHandler(this,m.ERROR,...e)}}});function La(){return qi||(qi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ma(){return Gi||(Gi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function Ua(n){let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(F(n.result)),r()},o=()=>{i(n.error),r()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ki.set(t,n)}).catch(()=>{}),un.set(e,n),e}function Fa(n){if(cn.has(n))return;let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),r()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});cn.set(n,e)}function Yi(n){ln=n(ln)}function xa(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let i=n.call(rt(this),e,...t);return Ji.set(i,e.sort?e.sort():[e]),F(i)}:Ma().includes(n)?function(...e){return n.apply(rt(this),e),F(Ki.get(this))}:function(...e){return F(n.apply(rt(this),e))}}function Va(n){return typeof n=="function"?xa(n):(n instanceof IDBTransaction&&Fa(n),Da(n,La())?new Proxy(n,ln):n)}function F(n){if(n instanceof IDBRequest)return Ua(n);if(on.has(n))return on.get(n);let e=Va(n);return e!==n&&(on.set(n,e),un.set(e,n)),e}var Da,qi,Gi,Ki,cn,Ji,on,un,ln,rt,dn=O(()=>{Da=(n,e)=>e.some(t=>n instanceof t);Ki=new WeakMap,cn=new WeakMap,Ji=new WeakMap,on=new WeakMap,un=new WeakMap;ln={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return cn.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Ji.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return F(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};rt=n=>un.get(n)});function Qi(n,e,{blocked:t,upgrade:i,blocking:r,terminated:s}={}){let o=indexedDB.open(n,e),c=F(o);return i&&o.addEventListener("upgradeneeded",l=>{i(F(o.result),l.oldVersion,l.newVersion,F(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",a=>r(a.oldVersion,a.newVersion,a))}).catch(()=>{}),c}function Xi(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(hn.get(e))return hn.get(e);let t=e.replace(/FromIndex$/,""),i=e!==t,r=Wa.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(r||Ha.includes(t)))return;let s=async function(o,...c){let l=this.transaction(o,r?"readwrite":"readonly"),a=l.store;return i&&(a=a.index(c.shift())),(await Promise.all([a[t](...c),r&&l.done]))[0]};return hn.set(e,s),s}var Ha,Wa,hn,Zi=O(()=>{dn();dn();Ha=["get","getKey","getAll","getAllKeys","count"],Wa=["put","add","delete","clear"],hn=new Map;Yi(n=>({...n,get:(e,t,i)=>Xi(e,t)||n.get(e,t,i),has:(e,t)=>!!Xi(e,t)||n.has(e,t)}))});function Ba(n){return n.getComponent()?.type==="VERSION"}function gn(n,e){try{n.container.addComponent(e)}catch(t){B.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Io(n,e){n.container.addOrOverwriteComponent(e)}function ae(n){let e=n.name;if(Ee.has(e))return B.debug(`There were multiple attempts to register component ${e}.`),!1;Ee.set(e,n);for(let t of X.values())gn(t,n);for(let t of be.values())gn(t,n);return!0}function Le(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function bo(n,e,t=Ne){Le(n,e).clearInstance(t)}function En(n){return n.options!==void 0}function rr(n){return En(n)?!1:"authIdToken"in n||"appCheckToken"in n||"releaseOnDeref"in n||"automaticDataCollectionEnabled"in n}function I(n){return n==null?!1:n.settings!==void 0}function Eo(){Ee.clear()}function er(n,e){let t=Pe(n.split(".")[1]);if(t===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(t).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let r=JSON.parse(t).exp*1e3,s=new Date().getTime();r-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function sr(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let i={name:Ne,automaticDataCollectionEnabled:!0,...e},r=i.name;if(typeof r!="string"||!r)throw R.create("bad-app-name",{appName:String(r)});if(t||(t=et()),!t)throw R.create("no-options");let s=X.get(r);if(s){if(Y(t,s.options)&&Y(i,s.config))return s;throw R.create("duplicate-app",{appName:r})}let o=new Oe(r);for(let l of Ee.values())o.addComponent(l);let c=new at(t,i,o);return X.set(r,c),c}function wo(n,e={}){if(Di()&&!rn())throw R.create("invalid-server-app-environment");let t,i=e||{};if(n&&(En(n)?t=n.options:rr(n)?i=n:t=n),i.automaticDataCollectionEnabled===void 0&&(i.automaticDataCollectionEnabled=!0),t||(t=et()),!t)throw R.create("no-options");let r={...i,...t};r.releaseOnDeref!==void 0&&delete r.releaseOnDeref;let s=d=>[...d].reduce((h,f)=>Math.imul(31,h)+f.charCodeAt(0)|0,0);if(i.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw R.create("finalization-registry-not-supported",{});let o=""+s(JSON.stringify(r)),c=be.get(o);if(c)return c.incRefCount(i.releaseOnDeref),c;let l=new Oe(o);for(let d of Ee.values())l.addComponent(d);let a=new _n(t,i,o,l);return be.set(o,a),a}function yn(n=Ne){let e=X.get(n);if(!e&&n===Ne&&et())return sr();if(!e)throw R.create("no-app",{appName:n});return e}function To(){return Array.from(X.values())}async function ar(n){let e=!1,t=n.name;X.has(t)?(e=!0,X.delete(t)):be.has(t)&&n.decRefCount()<=0&&(be.delete(t),e=!0),e&&(await Promise.all(n.container.getProviders().map(i=>i.delete())),n.isDeleted=!0)}function x(n,e,t){let i=_o[n]??n;t&&(i+=`-${t}`);let r=i.match(/\s|\//),s=e.match(/\s|\//);if(r||s){let o=[`Unable to register library "${i}" with version "${e}":`];r&&o.push(`library name "${i}" contains illegal characters (whitespace or "/")`),r&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),B.warn(o.join(" "));return}ae(new U(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function vo(n,e){if(n!==null&&typeof n!="function")throw R.create("invalid-log-argument");zi(n,e)}function Ao(n){ji(n)}function or(){return fn||(fn=Qi(So,ko,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(De)}catch(t){console.warn(t)}}}}).catch(n=>{throw R.create("idb-open",{originalErrorMessage:n.message})})),fn}async function Ro(n){try{let t=(await or()).transaction(De),i=await t.objectStore(De).get(cr(n));return await t.done,i}catch(e){if(e instanceof C)B.warn(e.message);else{let t=R.create("idb-get",{originalErrorMessage:e?.message});B.warn(t.message)}}}async function tr(n,e){try{let i=(await or()).transaction(De,"readwrite");await i.objectStore(De).put(e,cr(n)),await i.done}catch(t){if(t instanceof C)B.warn(t.message);else{let i=R.create("idb-set",{originalErrorMessage:t?.message});B.warn(i.message)}}}function cr(n){return`${n.name}!${n.options.appId}`}function nr(){return new Date().toISOString().substring(0,10)}function Oo(n,e=Co){let t=[],i=n.slice();for(let r of n){let s=t.find(o=>o.agent===r.agent);if(s){if(s.dates.push(r.date),ir(t)>e){s.dates.pop();break}}else if(t.push({agent:r.agent,dates:[r.date]}),ir(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}function ir(n){return en(JSON.stringify({version:2,heartbeats:n})).length}function No(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let i=1;i<n.length;i++)n[i].date<t&&(t=n[i].date,e=i);return e}function Do(n){ae(new U("platform-logger",e=>new pn(e),"PRIVATE")),ae(new U("heartbeat",e=>new In(e),"PRIVATE")),x(st,mn,n),x(st,mn,"esm2020"),x("fire-js","")}var pn,st,mn,B,$a,ja,za,qa,Ga,Ka,Ja,Ya,Xa,Qa,Za,eo,to,no,io,ro,so,ao,oo,co,lo,uo,ho,fo,po,mo,go,Ne,_o,X,be,Ee,yo,R,at,_n,oe,So,ko,De,fn,Co,Po,In,bn,Me=O(()=>{nt();it();_e();_e();Zi();pn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ba(t)){let i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}};st="@firebase/app",mn="0.15.1";B=new Ie("@firebase/app"),$a="@firebase/app-compat",ja="@firebase/analytics-compat",za="@firebase/analytics",qa="@firebase/app-check-compat",Ga="@firebase/app-check",Ka="@firebase/auth",Ja="@firebase/auth-compat",Ya="@firebase/database",Xa="@firebase/data-connect",Qa="@firebase/database-compat",Za="@firebase/functions",eo="@firebase/functions-compat",to="@firebase/installations",no="@firebase/installations-compat",io="@firebase/messaging",ro="@firebase/messaging-compat",so="@firebase/performance",ao="@firebase/performance-compat",oo="@firebase/remote-config",co="@firebase/remote-config-compat",lo="@firebase/storage",uo="@firebase/storage-compat",ho="@firebase/firestore",fo="@firebase/ai",po="@firebase/firestore-compat",mo="firebase",go="12.16.0";Ne="[DEFAULT]",_o={[st]:"fire-core",[$a]:"fire-core-compat",[za]:"fire-analytics",[ja]:"fire-analytics-compat",[Ga]:"fire-app-check",[qa]:"fire-app-check-compat",[Ka]:"fire-auth",[Ja]:"fire-auth-compat",[Ya]:"fire-rtdb",[Xa]:"fire-data-connect",[Qa]:"fire-rtdb-compat",[Za]:"fire-fn",[eo]:"fire-fn-compat",[to]:"fire-iid",[no]:"fire-iid-compat",[io]:"fire-fcm",[ro]:"fire-fcm-compat",[so]:"fire-perf",[ao]:"fire-perf-compat",[oo]:"fire-rc",[co]:"fire-rc-compat",[lo]:"fire-gcs",[uo]:"fire-gcs-compat",[ho]:"fire-fst",[po]:"fire-fst-compat",[fo]:"fire-vertex","fire-js":"fire-js",[mo]:"fire-js-all"};X=new Map,be=new Map,Ee=new Map;yo={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},R=new W("app","Firebase",yo);at=class{constructor(e,t,i){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new U("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 R.create("app-deleted",{appName:this._name})}};_n=class extends at{constructor(e,t,i,r){let s=t.automaticDataCollectionEnabled!==void 0?t.automaticDataCollectionEnabled:!0,o={name:i,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,o,r);else{let c=e;super(c.options,o,r)}this._serverConfig={automaticDataCollectionEnabled:s,...t},this._serverConfig.authIdToken&&er(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&er(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,x(st,mn,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){ar(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw R.create("server-app-deleted")}};oe=go;So="firebase-heartbeat-database",ko=1,De="firebase-heartbeat-store",fn=null;Co=1024,Po=30,In=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new bn(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=nr();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(r=>r.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:t}),this._heartbeatsCache.heartbeats.length>Po){let r=No(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(r,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){B.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=nr(),{heartbeatsToSend:t,unsentEntries:i}=Oo(this._heartbeatsCache.heartbeats),r=en(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return B.warn(e),""}}};bn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return xi()?Vi().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await Ro(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return tr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return tr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};Do("")});var lr={};Ai(lr,{FirebaseError:()=>C,SDK_VERSION:()=>oe,_DEFAULT_ENTRY_NAME:()=>Ne,_addComponent:()=>gn,_addOrOverwriteComponent:()=>Io,_apps:()=>X,_clearComponents:()=>Eo,_components:()=>Ee,_getProvider:()=>Le,_isFirebaseApp:()=>En,_isFirebaseServerApp:()=>I,_isFirebaseServerAppSettings:()=>rr,_registerComponent:()=>ae,_removeServiceInstance:()=>bo,_serverApps:()=>be,deleteApp:()=>ar,getApp:()=>yn,getApps:()=>To,initializeApp:()=>sr,initializeServerApp:()=>wo,onLog:()=>vo,registerVersion:()=>x,setLogLevel:()=>Ao});var Lo,Mo,ur=O(()=>{Me();Me();Lo="firebase",Mo="12.16.0";x(Lo,Mo,"app")});function Uo(){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`)."}}function Ur(){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."}}function Fo(n,...e){ft.logLevel<=m.WARN&&ft.warn(`Auth (${oe}): ${n}`,...e)}function lt(n,...e){ft.logLevel<=m.ERROR&&ft.error(`Auth (${oe}): ${n}`,...e)}function k(n,...e){throw ii(n,...e)}function S(n,...e){return ii(n,...e)}function ni(n,e,t){let i={...ti(),[e]:t};return new W("auth","Firebase",i).create(e,{appName:n.name})}function y(n){return ni(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Re(n,e,t){let i=t;if(!(e instanceof i))throw i.name!==e.constructor.name&&k(n,"argument-error"),ni(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function ii(n,...e){if(typeof n!="string"){let t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return xr.create(n,...e)}function u(n,e,...t){if(!n)throw ii(e,...t)}function V(n){let e="INTERNAL ASSERTION FAILED: "+n;throw lt(e),new Error(e)}function z(n,e){n||V(e)}function Be(){return typeof self<"u"&&self.location?.href||""}function ri(){return dr()==="http:"||dr()==="https:"}function dr(){return typeof self<"u"&&self.location?.protocol||null}function xo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ri()||Mi()||"connection"in navigator)?navigator.onLine:!0}function Vo(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}function si(n,e){z(n.emulator,"Emulator should always be set here");let{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}function g(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function _(n,e,t,i,r={}){return Hr(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});let c=re({...o,key:n.config.apiKey}).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);let a={method:e,headers:l,...s};return Li()||(a.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&tt(n.emulatorConfig.host)&&(a.credentials="include"),pt.fetch()(await Wr(n,n.config.apiHost,t,c),a)})}async function Hr(n,e,t){n._canInitEmulator=!1;let i={...Ho,...e};try{let r=new Cn(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw Fe(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let c=s.ok?o.errorMessage:o.error.message,[l,a]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Fe(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw Fe(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw Fe(n,"user-disabled",o);let d=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw ni(n,d,a);k(n,d)}}catch(r){if(r instanceof C)throw r;k(n,"network-request-failed",{message:String(r)})}}async function J(n,e,t,i,r={}){let s=await _(n,e,t,i,r);return"mfaPendingCredential"in s&&k(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Wr(n,e,t,i){let r=`${e}${t}?${i}`,s=n,o=s.config.emulator?si(n.config,r):`${n.config.apiScheme}://${r}`;return Wo.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function $o(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function Fe(n,e,t){let i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);let r=S(n,e,i);return r.customData._tokenResponse=t,r}function hr(n){return n!==void 0&&n.getResponse!==void 0}function fr(n){return n!==void 0&&n.enterprise!==void 0}async function jo(n){return(await _(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function Br(n,e){return _(n,"GET","/v2/recaptchaConfig",g(n,e))}async function zo(n,e){return _(n,"POST","/v1/accounts:delete",e)}async function qo(n,e){return _(n,"POST","/v1/accounts:update",e)}async function gt(n,e){return _(n,"POST","/v1/accounts:lookup",e)}function xe(n){if(n)try{let e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function $r(n,e=!1){return p(n).getIdToken(e)}async function ai(n,e=!1){let t=p(n),i=await t.getIdToken(e),r=Vt(i);u(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");let s=typeof r.firebase=="object"?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:xe(wn(r.auth_time)),issuedAtTime:xe(wn(r.iat)),expirationTime:xe(wn(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function wn(n){return Number(n)*1e3}function Vt(n){let[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return lt("JWT malformed, contained fewer than 3 sections"),null;try{let r=Pe(t);return r?JSON.parse(r):(lt("Failed to decode base64 JWT payload"),null)}catch(r){return lt("Caught error parsing JWT payload as JSON",r?.toString()),null}}function pr(n){let e=Vt(n);return u(e,"internal-error"),u(typeof e.exp<"u","internal-error"),u(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function q(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof C&&Go(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Go({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}async function je(n){let e=n.auth,t=await n.getIdToken(),i=await q(n,gt(e,{idToken:t}));u(i?.users.length,e,"internal-error");let r=i.users[0];n._notifyReloadListener(r);let s=r.providerUserInfo?.length?jr(r.providerUserInfo):[],o=Ko(n.providerData,s),c=n.isAnonymous,l=!(n.email&&r.passwordHash)&&!o?.length,a=c?l:!1,d={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:a};Object.assign(n,d)}async function oi(n){let e=p(n);await je(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ko(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function jr(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function Jo(n,e){let t=await Hr(n,{},async()=>{let i=re({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=await Wr(n,r,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:i};return n.emulatorConfig&&tt(n.emulatorConfig.host)&&(l.credentials="include"),pt.fetch()(o,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Yo(n,e){return _(n,"POST","/v2/accounts:revokeToken",g(n,e))}function Q(n,e){u(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}function $(n){z(n instanceof Function,"Expected a class definition");let e=mr.get(n);return e?(z(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,mr.set(n,e),e)}function ut(n,e,t){return`firebase:${n}:${e}:${t}`}function gr(n){let e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Kr(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(zr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Yr(e))return"Blackberry";if(Xr(e))return"Webos";if(qr(e))return"Safari";if((e.includes("chrome/")||Gr(e))&&!e.includes("edge/"))return"Chrome";if(Jr(e))return"Android";{let t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if(i?.length===2)return i[1]}return"Other"}function zr(n=v()){return/firefox\//i.test(n)}function qr(n=v()){let e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Gr(n=v()){return/crios\//i.test(n)}function Kr(n=v()){return/iemobile/i.test(n)}function Jr(n=v()){return/android/i.test(n)}function Yr(n=v()){return/blackberry/i.test(n)}function Xr(n=v()){return/webos/i.test(n)}function ci(n=v()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Xo(n=v()){return ci(n)&&!!window.navigator?.standalone}function Qo(){return Fi()&&document.documentMode===10}function Qr(n=v()){return ci(n)||Jr(n)||Xr(n)||Yr(n)||/windows phone/i.test(n)||Kr(n)}function Zr(n,e=[]){let t;switch(n){case"Browser":t=gr(v());break;case"Worker":t=`${gr(v())}-${n}`;break;default:t=n}let i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${oe}/${i}`}async function Zo(n,e={}){return _(n,"GET","/v2/passwordPolicy",g(n,e))}function b(n){return p(n)}function tc(n){Xe=n}function li(n){return Xe.loadJS(n)}function nc(){return Xe.recaptchaV2Script}function ic(){return Xe.recaptchaEnterpriseScript}function rc(){return Xe.gapiScript}function es(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function oc(n){let e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let i=0;i<n;i++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}async function Ue(n,e,t,i=!1,r=!1){let s=new ze(n),o;if(r)o=He;else try{o=await s.verify(t)}catch{o=await s.verify(t,!0)}let c={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,a=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:a,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return i?Object.assign(c,{captchaResp:o}):Object.assign(c,{captchaResponse:o}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ee(n,e,t,i,r){if(r==="EMAIL_PASSWORD_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Ue(n,e,t,t==="getOobCode");return i(n,s)}else return i(n,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Ue(n,e,t,t==="getOobCode");return i(n,o)}else return Promise.reject(s)});else if(r==="PHONE_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Ue(n,e,t);return i(n,s).catch(async o=>{if(n._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);let c=await Ue(n,e,t,!1,!0);return i(n,c)}return Promise.reject(o)})}else{let s=await Ue(n,e,t,!1,!0);return i(n,s)}else return Promise.reject(r+" provider is not supported.")}async function ts(n){let e=b(n),t=await Br(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),i=new mt(t);e.tenantId==null?e._agentRecaptchaConfig=i:e._tenantRecaptchaConfigs[e.tenantId]=i,i.isAnyProviderEnabled()&&new ze(e).verify()}function ui(n,e){let t=Le(n,"auth");if(t.isInitialized()){let r=t.getImmediate(),s=t.getOptions();if(Y(s,e??{}))return r;k(r,"already-initialized")}return t.initialize({options:e})}function lc(n,e){let t=e?.persistence||[],i=(Array.isArray(t)?t:[t]).map($);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e?.popupRedirectResolver)}function di(n,e,t){let i=b(n);u(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");let r=!!t?.disableWarnings,s=ns(e),{host:o,port:c}=uc(e),l=c===null?"":`:${c}`,a={url:`${s}//${o}${l}/`},d=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})});if(!i._canInitEmulator){u(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),u(Y(a,i.config.emulator)&&Y(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=a,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,tt(o)?Bi(`${s}//${o}${l}`):r||dc()}function ns(n){let e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function uc(n){let e=ns(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};let i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){let s=r[1];return{host:s,port:Ir(i.substr(s.length+1))}}else{let[s,o]=i.split(":");return{host:s,port:Ir(o)}}}function Ir(n){if(!n)return null;let e=Number(n);return isNaN(e)?null:e}function dc(){function n(){let 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)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}async function is(n,e){return _(n,"POST","/v1/accounts:resetPassword",g(n,e))}async function hc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function fc(n,e){return _(n,"POST","/v1/accounts:signUp",e)}async function pc(n,e){return _(n,"POST","/v1/accounts:update",g(n,e))}async function mc(n,e){return J(n,"POST","/v1/accounts:signInWithPassword",g(n,e))}async function Ht(n,e){return _(n,"POST","/v1/accounts:sendOobCode",g(n,e))}async function gc(n,e){return Ht(n,e)}async function _c(n,e){return Ht(n,e)}async function Ic(n,e){return Ht(n,e)}async function bc(n,e){return Ht(n,e)}async function Ec(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function yc(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function j(n,e){return J(n,"POST","/v1/accounts:signInWithIdp",g(n,e))}async function br(n,e){return _(n,"POST","/v1/accounts:sendVerificationCode",g(n,e))}async function Tc(n,e){return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e))}async function vc(n,e){let t=await J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e));if(t.temporaryProof)throw Fe(n,"account-exists-with-different-credential",t);return t}async function Sc(n,e){let t={...e,operation:"REAUTH"};return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,t),Ac)}function kc(n){switch(n){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}}function Rc(n){let e=me(ge(n)).link,t=e?me(ge(e)).deep_link_id:null,i=me(ge(n)).deep_link_id;return(i?me(ge(i)).link:null)||i||t||e||n}function rs(n){return ue.parseLink(n)}async function ss(n,e){return J(n,"POST","/v1/accounts:signUp",g(n,e))}function Er(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}async function as(n){if(I(n.app))return Promise.reject(y(n));let e=b(n);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new D({user:e.currentUser,providerId:null,operationType:"signIn"});let t=await ss(e,{returnSecureToken:!0}),i=await D._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(i.user),i}function os(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?xn._fromErrorAndOperation(n,s,e,i):s})}function cs(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}async function ls(n,e){let t=p(n);await Wt(!0,t,e);let{providerUserInfo:i}=await qo(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),r=cs(i||[]);return t.providerData=t.providerData.filter(s=>r.has(s.providerId)),r.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function hi(n,e,t=!1){let i=await q(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return D._forOperation(n,"link",i)}async function Wt(n,e,t){await je(e);let i=cs(e.providerData),r=n===!1?"provider-already-linked":"no-such-provider";u(i.has(t)===n,e.auth,r)}async function us(n,e,t=!1){let{auth:i}=n;if(I(i.app))return Promise.reject(y(i));let r="reauthenticate";try{let s=await q(n,os(i,r,e,n),t);u(s.idToken,i,"internal-error");let o=Vt(s.idToken);u(o,i,"internal-error");let{sub:c}=o;return u(n.uid===c,i,"user-mismatch"),D._forOperation(n,r,s)}catch(s){throw s?.code==="auth/user-not-found"&&k(i,"user-mismatch"),s}}async function ds(n,e,t=!1){if(I(n.app))return Promise.reject(y(n));let i="signIn",r=await os(n,i,e),s=await D._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function Qe(n,e){return ds(b(n),e)}async function fi(n,e){let t=p(n);return await Wt(!1,t,e.providerId),hi(t,e)}async function pi(n,e){return us(p(n),e)}async function Oc(n,e){return J(n,"POST","/v1/accounts:signInWithCustomToken",g(n,e))}async function hs(n,e){if(I(n.app))return Promise.reject(y(n));let t=b(n),i=await Oc(t,{token:e,returnSecureToken:!0}),r=await D._fromIdTokenResponse(t,"signIn",i);return await t._updateCurrentUser(r.user),r}function Bt(n,e,t){u(t.url?.length>0,n,"invalid-continue-uri"),u(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),u(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(u(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(u(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}async function mi(n){let e=b(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function fs(n,e,t){let i=b(n),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&Bt(i,r,t),await ee(i,r,"getOobCode",_c,"EMAIL_PASSWORD_PROVIDER")}async function ps(n,e,t){await is(p(n),{oobCode:e,newPassword:t}).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&mi(n),i})}async function ms(n,e){await pc(p(n),{oobCode:e})}async function gi(n,e){let t=p(n),i=await is(t,{oobCode:e}),r=i.requestType;switch(u(r,t,"internal-error"),r){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":u(i.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":u(i.mfaInfo,t,"internal-error");default:u(i.email,t,"internal-error")}let s=null;return i.mfaInfo&&(s=de._fromServerResponse(b(t),i.mfaInfo)),{data:{email:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.newEmail:i.email)||null,previousEmail:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.email:i.newEmail)||null,multiFactorInfo:s},operation:r}}async function gs(n,e){let{data:t}=await gi(p(n),e);return t.email}async function _s(n,e,t){if(I(n.app))return Promise.reject(y(n));let i=b(n),o=await ee(i,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ss,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&mi(n),l}),c=await D._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(c.user),c}function Is(n,e,t){return I(n.app)?Promise.reject(y(n)):Qe(p(n),K.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&mi(n),i})}async function bs(n,e,t){let i=b(n),r={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(o,c){u(c.handleCodeInApp,i,"argument-error"),c&&Bt(i,o,c)}s(r,t),await ee(i,r,"getOobCode",Ic,"EMAIL_PASSWORD_PROVIDER")}function Es(n,e){return ue.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function ys(n,e,t){if(I(n.app))return Promise.reject(y(n));let i=p(n),r=K.credentialWithLink(e,t||Be());return u(r._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),Qe(i,r)}async function Nc(n,e){return _(n,"POST","/v1/accounts:createAuthUri",g(n,e))}async function ws(n,e){let t=ri()?Be():"http://localhost",i={identifier:e,continueUri:t},{signinMethods:r}=await Nc(p(n),i);return r||[]}async function Ts(n,e){let t=p(n),r={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Bt(t.auth,r,e);let{email:s}=await gc(t.auth,r);s!==n.email&&await n.reload()}async function vs(n,e,t){let i=p(n),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await n.getIdToken(),newEmail:e};t&&Bt(i.auth,s,t);let{email:o}=await bc(i.auth,s);o!==n.email&&await n.reload()}async function Dc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function As(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;let i=p(n),s={idToken:await i.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await q(i,Dc(i.auth,s));i.displayName=o.displayName||null,i.photoURL=o.photoUrl||null;let c=i.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=i.displayName,c.photoURL=i.photoURL),await i._updateTokensIfNecessary(o)}function Ss(n,e){let t=p(n);return I(t.auth.app)?Promise.reject(y(t.auth)):Rs(t,e,null)}function ks(n,e){return Rs(p(n),null,e)}async function Rs(n,e,t){let{auth:i}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);let o=await q(n,hc(i,s));await n._updateTokensIfNecessary(o,!0)}function Lc(n){if(!n)return null;let{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},i=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&n?.idToken){let r=Vt(n.idToken)?.firebase?.sign_in_provider;if(r){let s=r!=="anonymous"&&r!=="custom"?r:null;return new te(i,s)}}if(!e)return null;switch(e){case"facebook.com":return new Wn(i,t);case"github.com":return new Bn(i,t);case"google.com":return new $n(i,t);case"twitter.com":return new jn(i,t,n.screenName||null);case"custom":case"anonymous":return new te(i,null);default:return new te(i,e,t)}}function Cs(n){let{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Lc(t)}function Ps(n,e){return p(n).setPersistence(e)}function Os(n){return ts(n)}async function Ns(n,e){return b(n).validatePassword(e)}function _i(n,e,t,i){return p(n).onIdTokenChanged(e,t,i)}function Ii(n,e,t){return p(n).beforeAuthStateChanged(e,t)}function Ds(n,e,t,i){return p(n).onAuthStateChanged(e,t,i)}function Ls(n){p(n).useDeviceLanguage()}function Ms(n,e){return p(n).updateCurrentUser(e)}function Us(n){return p(n).signOut()}function Fs(n,e){return b(n).revokeAccessToken(e)}async function xs(n){return p(n).delete()}function Vs(n,e){let t=p(n),i=e;return u(e.customData.operationType,t,"argument-error"),u(i.customData._serverResponse?.mfaPendingCredential,t,"argument-error"),zn._fromError(t,i)}function yr(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Mc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function Uc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Fc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function xc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:withdraw",g(n,e))}function Hs(n){let e=p(n);return Tn.has(e)||Tn.set(e,qn._fromUser(e)),Tn.get(e)}function vn(n){let e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),t=RegExp(`${e}=([^;]+)`);return document.cookie.match(t)?.[1]??null}function An(n){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${n.split(":")[3]}`}function Bc(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}function jt(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}function E(){return window}function $c(n){E().location.href=n}function Ei(){return typeof E().WorkerGlobalScope<"u"&&typeof E().importScripts=="function"}async function jc(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function zc(){return navigator?.serviceWorker?.controller||null}function qc(){return Ei()?self:null}function zt(n,e){return n.transaction([Nt],e?"readwrite":"readonly").objectStore(Nt)}function Kc(){let n=indexedDB.deleteDatabase(Bs);return new he(n).toPromise()}function js(){let n=indexedDB.open(Bs,Gc);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{let i=n.result;try{i.createObjectStore(Nt,{keyPath:$s})}catch(r){t(r)}}),n.addEventListener("success",async()=>{let i=n.result;i.objectStoreNames.contains(Nt)?e(i):(i.close(),await Kc(),e(await js()))})})}async function wr(n,e,t){let i=zt(n,!0).put({[$s]:e,value:t});return new he(i).toPromise()}async function Jc(n,e){let t=zt(n,!1).get(e),i=await new he(t).toPromise();return i===void 0?null:i.value}function Tr(n,e){let t=zt(n,!0).delete(e);return new he(t).toPromise()}function vr(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:start",g(n,e))}function Qc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function Zc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function tl(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}function il(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}async function zs(n,e,t){if(I(n.app))return Promise.reject(y(n));let i=b(n),r=await qt(i,e,p(t));return new qe(r,s=>Qe(i,s))}async function qs(n,e,t){let i=p(n);await Wt(!1,i,"phone");let r=await qt(i.auth,e,p(t));return new qe(r,s=>fi(i,s))}async function Gs(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(y(i.auth));let r=await qt(i.auth,e,p(t));return new qe(r,s=>pi(i,s))}async function qt(n,e,t){if(!n._getRecaptchaConfig())try{await ts(n)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let i;if(typeof e=="string"?i={phoneNumber:e}:i=e,"session"in i){let r=i.session;if("phoneNumber"in i){u(r.type==="enroll",n,"internal-error");let s={idToken:r.credential,phoneEnrollmentInfo:{phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,s,"mfaSmsEnrollment",async(a,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===He){u(t?.type===We,a,"argument-error");let h=await kn(a,d,t);return yr(a,h)}return yr(a,d)},"PHONE_PROVIDER").catch(a=>Promise.reject(a))).phoneSessionInfo.sessionInfo}else{u(r.type==="signin",n,"internal-error");let s=i.multiFactorHint?.uid||i.multiFactorUid;u(s,n,"missing-multi-factor-info");let o={mfaPendingCredential:r.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,o,"mfaSmsSignIn",async(d,h)=>{if(h.phoneSignInInfo.captchaResponse===He){u(t?.type===We,d,"argument-error");let f=await kn(d,h,t);return vr(d,f)}return vr(d,h)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{let r={phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ee(n,r,"sendVerificationCode",async(l,a)=>{if(a.captchaResponse===He){u(t?.type===We,l,"argument-error");let d=await kn(l,a,t);return br(l,d)}return br(l,a)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{t?._reset()}}async function Ks(n,e){let t=p(n);if(I(t.auth.app))return Promise.reject(y(t.auth));await hi(t,e)}async function kn(n,e,t){u(t.type===We,n,"argument-error");let i=await t.verify();u(typeof i=="string",n,"argument-error");let r={...e};if("phoneEnrollmentInfo"in r){let s=r.phoneEnrollmentInfo.phoneNumber,o=r.phoneEnrollmentInfo.captchaResponse,c=r.phoneEnrollmentInfo.clientType,l=r.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(r,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:i,captchaResponse:o,clientType:c,recaptchaVersion:l}}),r}else if("phoneSignInInfo"in r){let s=r.phoneSignInInfo.captchaResponse,o=r.phoneSignInInfo.clientType,c=r.phoneSignInInfo.recaptchaVersion;return Object.assign(r,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:s,clientType:o,recaptchaVersion:c}}),r}else return Object.assign(r,{recaptchaToken:i}),r}function fe(n,e){return e?$(e):(u(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}function rl(n){return ds(n.auth,new Ge(n),n.bypassAuthState)}function sl(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),us(t,new Ge(n),n.bypassAuthState)}async function al(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),hi(t,new Ge(n),n.bypassAuthState)}async function Js(n,e,t){if(I(n.app))return Promise.reject(S(n,"operation-not-supported-in-this-environment"));let i=b(n);Re(n,e,N);let r=fe(i,t);return new ke(i,"signInViaPopup",e,r).executeNotNull()}async function Ys(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(S(i.auth,"operation-not-supported-in-this-environment"));Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"reauthViaPopup",e,r,i).executeNotNull()}async function Xs(n,e,t){let i=p(n);Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"linkViaPopup",e,r,i).executeNotNull()}async function ll(n,e){let t=Zs(e),i=Qs(n);if(!await i._isAvailable())return!1;let r=await i._get(t)==="true";return await i._remove(t),r}async function wi(n,e){return Qs(n)._set(Zs(e),"true")}function ul(n,e){dt.set(n._key(),e)}function Qs(n){return $(n._redirectPersistence)}function Zs(n){return ut(cl,n.config.apiKey,n.name)}function ea(n,e,t){return dl(n,e,t)}async function dl(n,e,t){if(I(n.app))return Promise.reject(y(n));let i=b(n);Re(n,e,N),await i._initializationPromise;let r=fe(i,t);return await wi(r,i),r._openRedirect(i,e,"signInViaRedirect")}function ta(n,e,t){return hl(n,e,t)}async function hl(n,e,t){let i=p(n);if(Re(i.auth,e,N),I(i.auth.app))return Promise.reject(y(i.auth));await i.auth._initializationPromise;let r=fe(i.auth,t);await wi(r,i.auth);let s=await sa(i);return r._openRedirect(i.auth,e,"reauthViaRedirect",s)}function na(n,e,t){return fl(n,e,t)}async function fl(n,e,t){let i=p(n);Re(i.auth,e,N),await i.auth._initializationPromise;let r=fe(i.auth,t);await Wt(!1,i,e.providerId),await wi(r,i.auth);let s=await sa(i);return r._openRedirect(i.auth,e,"linkViaRedirect",s)}async function ia(n,e){return await b(n)._initializationPromise,ra(n,e,!1)}async function ra(n,e,t=!1){if(I(n.app))return Promise.reject(y(n));let i=b(n),r=fe(i,e),o=await new Yn(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}async function sa(n){let e=jt(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}function Ar(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function aa({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function ml(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return aa(n);default:return!1}}async function gl(n,e={}){return _(n,"GET","/v1/projects",e)}async function bl(n){if(n.config.emulator)return;let{authorizedDomains:e}=await gl(n);for(let t of e)try{if(El(t))return}catch{}k(n,"unauthorized-domain")}function El(n){let e=Be(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){let o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!Il.test(t))return!1;if(_l.test(n))return i===n;let r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}function Sr(){let n=E().___jsl;if(n?.H){for(let e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function wl(n){return new Promise((e,t)=>{function i(){Sr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Sr(),t(S(n,"network-request-failed"))},timeout:yl.get()})}if(E().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(E().gapi?.load)i();else{let r=es("iframefcb");return E()[r]=()=>{gapi.load?i():t(S(n,"network-request-failed"))},li(`${rc()}?onload=${r}`).catch(s=>t(s))}}).catch(e=>{throw ht=null,e})}function Tl(n){return ht=ht||wl(n),ht}function Cl(n){let e=n.config;u(e.authDomain,n,"auth-domain-config-required");let t=e.emulator?si(e,Sl):`https://${n.config.authDomain}/${Al}`,i={apiKey:e.apiKey,appName:n.name,v:oe},r=Rl.get(n.config.apiHost);r&&(i.eid=r);let s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${re(i).slice(1)}`}async function Pl(n){let e=await Tl(n),t=E().gapi;return u(t,n,"internal-error"),e.open({where:document.body,url:Cl(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:kl,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});let o=S(n,"network-request-failed"),c=E().setTimeout(()=>{s(o)},vl.get());function l(){E().clearTimeout(c),r(i)}i.ping(l).then(l,()=>{s(o)})}))}function Ul(n,e,t,i=Nl,r=Dl){let s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString(),c="",l={...Ol,width:i.toString(),height:r.toString(),top:s,left:o},a=v().toLowerCase();t&&(c=Gr(a)?Ll:t),zr(a)&&(e=e||Ml,l.scrollbars="yes");let d=Object.entries(l).reduce((f,[A,L])=>`${f}${A}=${L},`,"");if(Xo(a)&&c!=="_self")return Fl(e||"",c),new Ut(null);let h=window.open(e||"",c,d);u(h,n,"popup-blocked");try{h.focus()}catch{}return new Ut(h)}function Fl(n,e){let t=document.createElement("a");t.href=n,t.target=e;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}async function kr(n,e,t,i,r,s){u(n.config.authDomain,n,"auth-domain-config-required"),u(n.config.apiKey,n,"invalid-api-key");let o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:oe,eventId:r};if(e instanceof N){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Hi(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof ne){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);let c=o;for(let d of Object.keys(c))c[d]===void 0&&delete c[d];let l=await n._getAppCheckToken(),a=l?`#${Hl}=${encodeURIComponent(l)}`:"";return`${Wl(n)}?${re(c).slice(1)}${a}`}function Wl({config:n}){return n.emulator?si(n,Vl):`https://${n.authDomain}/${xl}`}function ct(n){return typeof n>"u"||n?.length===0}function Bl(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function $l(n){ae(new U("auth",(e,{options:t})=>{let i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=i.options;u(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});let l={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Zr(n)},a=new Dn(i,r,s,l);return lc(a,t),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),ae(new U("auth-internal",e=>{let t=b(e.getProvider("auth").getImmediate());return(i=>new ei(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),x(Rr,Cr,Bl(n)),x(Rr,Cr,"esm2020")}function oa(n=yn()){let e=Le(n,"auth");if(e.isInitialized())return e.getImmediate();let t=ui(n,{popupRedirectResolver:Ti,persistence:[yi,bi,$t]}),i=nn("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(i,location.origin);if(location.origin===s.origin){let o=ql(s.toString());Ii(t,o,()=>o(t.currentUser)),_i(t,c=>o(c))}}let r=Oi("auth");return r&&di(t,`http://${r}`),t}function Gl(){return document.getElementsByTagName("head")?.[0]??document}var Or,Nr,Dr,Lr,Mr,Fr,ti,xr,Vr,ft,ce,pt,Ho,Wo,Bo,Cn,mt,Pn,$e,Ve,Z,mr,_t,It,bt,On,ec,Nn,Dn,Et,Xe,sc,ac,ot,Ln,Mn,Un,Fn,cc,He,_r,ze,G,ye,wc,H,Ac,le,ue,K,N,ne,yt,we,Te,ve,Cc,wt,Pc,Tt,Ae,D,xn,de,Vn,Hn,te,vt,Wn,Bn,$n,jn,At,zn,qn,Tn,St,kt,Vc,Hc,Rt,bi,Wc,Ct,Ws,Pt,$t,Ot,Gn,Bs,Gc,Nt,$s,he,Yc,Xc,Dt,yi,Sn,el,Kn,Jn,We,nl,Lt,qe,Se,Ge,Mt,ol,ke,cl,dt,Yn,pl,Xn,_l,Il,yl,ht,vl,Al,Sl,kl,Rl,Ol,Nl,Dl,Ll,Ml,Ut,xl,Vl,Hl,Rn,Qn,Ti,Ft,Zn,Ke,Je,xt,Ye,Rr,Cr,ei,jl,zl,Pr,ql,ca=O(()=>{Me();_e();it();nt();Or={PHONE:"phone",TOTP:"totp"},Nr={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Dr={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Lr={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Mr={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"};Fr=Uo,ti=Ur,xr=new W("auth","Firebase",Ur()),Vr={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};ft=new Ie("@firebase/auth");ce=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,z(t>e,"Short delay should be less than long delay!"),this.isMobile=Ni()||Ui()}get(){return xo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};pt=class{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;V("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;V("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;V("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};Ho={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};Wo=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Bo=new ce(3e4,6e4);Cn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(S(this.auth,"network-request-failed")),Bo.get())})}};mt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return $o(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};Pn=class{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};$e=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xe(this.lastLoginAt),this.creationTime=xe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};Ve=class n{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){u(e.idToken,"internal-error"),u(typeof e.idToken<"u","internal-error"),u(typeof e.refreshToken<"u","internal-error");let t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):pr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){u(e.length!==0,"internal-error");let t=pr(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(u(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:i,refreshToken:r,expiresIn:s}=await Jo(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){let{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new n;return i&&(u(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(u(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(u(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}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 n,this.toJSON())}_performRefresh(){return V("not implemented")}};Z=class n{constructor({uid:e,auth:t,stsTokenManager:i,...r}){this.providerId="firebase",this.proactiveRefresh=new Pn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,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 $e(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await q(this,this.stsTokenManager.getToken(this.auth,e));return u(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return ai(this,e)}reload(){return oi(this)}_assign(e){this!==e&&(u(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new n({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){u(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await je(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(I(this.auth.app))return Promise.reject(y(this.auth));let e=await this.getIdToken();return await q(this,zo(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){let i=t.displayName??void 0,r=t.email??void 0,s=t.phoneNumber??void 0,o=t.photoURL??void 0,c=t.tenantId??void 0,l=t._redirectEventId??void 0,a=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:h,emailVerified:f,isAnonymous:A,providerData:L,stsTokenManager:ie}=t;u(h&&ie,e,"internal-error");let M=Ve.fromJSON(this.name,ie);u(typeof h=="string",e,"internal-error"),Q(i,e.name),Q(r,e.name),u(typeof f=="boolean",e,"internal-error"),u(typeof A=="boolean",e,"internal-error"),Q(s,e.name),Q(o,e.name),Q(c,e.name),Q(l,e.name),Q(a,e.name),Q(d,e.name);let Yt=new n({uid:h,auth:e,email:r,emailVerified:f,displayName:i,isAnonymous:A,photoURL:o,phoneNumber:s,tenantId:c,stsTokenManager:M,createdAt:a,lastLoginAt:d});return L&&Array.isArray(L)&&(Yt.providerData=L.map(ga=>({...ga}))),l&&(Yt._redirectEventId=l),Yt}static async _fromIdTokenResponse(e,t,i=!1){let r=new Ve;r.updateFromServerResponse(t);let s=new n({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await je(s),s}static async _fromGetAccountInfoResponse(e,t,i){let r=t.users[0];u(r.localId!==void 0,"internal-error");let s=r.providerUserInfo!==void 0?jr(r.providerUserInfo):[],o=!(r.email&&r.passwordHash)&&!s?.length,c=new Ve;c.updateFromIdToken(i);let l=new n({uid:r.localId,auth:e,stsTokenManager:c,isAnonymous:o}),a={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!s?.length};return Object.assign(l,a),l}};mr=new Map;_t=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};_t.type="NONE";It=_t;bt=class n{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;let{config:r,name:s}=this.auth;this.fullUserKey=ut(this.userKey,r.apiKey,s),this.fullPersistenceKey=ut("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let t=await gt(this.auth,{idToken:e}).catch(()=>{});return t?Z._fromGetAccountInfoResponse(this.auth,t,e):null}return Z._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;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,i="authUser"){if(!t.length)return new n($(It),e,i);let r=(await Promise.all(t.map(async a=>{if(await a._isAvailable())return a}))).filter(a=>a),s=r[0]||$(It),o=ut(i,e.config.apiKey,e.name),c=null;for(let a of t)try{let d=await a._get(o);if(d){let h;if(typeof d=="string"){let f=await gt(e,{idToken:d}).catch(()=>{});if(!f)break;h=await Z._fromGetAccountInfoResponse(e,f,d)}else h=Z._fromJSON(e,d);a!==s&&(c=h),s=a;break}}catch{}let l=r.filter(a=>a._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new n(s,e,i):(s=l[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async a=>{if(a!==s)try{await a._remove(o)}catch{}})),new n(s,e,i))}};On=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let i=s=>new Promise((o,c)=>{try{let l=e(s);o(l)}catch(l){c(l)}});i.onAbort=t,this.queue.push(i);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(let r of t)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i?.message})}}};ec=6,Nn=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ec,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let r=0;r<e.length;r++)i=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};Dn=class{constructor(e,t,i,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Et(this),this.idTokenSubscription=new Et(this),this.beforeStateQueue=new On(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=xr,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=$(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await bt.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await gt(this,{idToken:e}),i=await Z._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(I(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,o=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===o)&&c?.user&&(i=c.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(s){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return u(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await je(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Vo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(I(this.app))return Promise.reject(y(this));let t=e?p(e):null;return t&&u(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&u(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 I(this.app)?Promise.reject(y(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return I(this.app)?Promise.reject(y(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence($(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let 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 this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Zo(this),t=new Nn(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new W("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await Yo(this,i)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&$(e)||this._popupRedirectResolver;u(t,this,"argument-error"),this.redirectPersistenceManager=await bt.create(this,[$(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,r){if(this._deleted)return()=>{};let s=typeof t=="function"?t:t.next.bind(t),o=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(u(c,this,"internal-error"),c.then(()=>{o||s(this.currentUser)}),typeof t=="function"){let l=e.addObserver(t,i,r);return()=>{o=!0,l()}}else{let l=e.addObserver(t);return()=>{o=!0,l()}}}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 u(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Zr(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){if(I(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Fo(`Error while retrieving App Check token: ${e.error}`),e?.token}};Et=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Wi(t=>this.observer=t)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};Xe={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};sc=500,ac=6e4,ot=1e12,Ln=class{constructor(e){this.auth=e,this.counter=ot,this._widgets=new Map}render(e,t){let i=this.counter;return this._widgets.set(i,new Fn(e,this.auth.name,t||{})),this.counter++,i}reset(e){let t=e||ot;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){let t=e||ot;return this._widgets.get(t)?.getResponse()||""}async execute(e){let t=e||ot;return this._widgets.get(t)?.execute(),""}},Mn=class{constructor(){this.enterprise=new Un}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Un=class{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Fn=class{constructor(e,t,i){this.params=i,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let r=typeof e=="string"?document.getElementById(e):e;u(r,"argument-error",{appName:t}),this.container=r,this.isVisible=this.params.size!=="invisible",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=oc(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},ac)},sc))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};cc="recaptcha-enterprise",He="NO_RECAPTCHA",_r="onFirebaseAuthREInstanceReady",ze=class n{constructor(e){this.type=cc,this.auth=b(e)}async verify(e="verify",t=!1){async function i(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,c)=>{Br(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{let a=new mt(l);return s.tenantId==null?s._agentRecaptchaConfig=a:s._tenantRecaptchaConfigs[s.tenantId]=a,o(a.siteKey)}}).catch(l=>{c(l)})})}function r(s,o,c){let l=window.grecaptcha;fr(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(a=>{o(a)}).catch(()=>{o(He)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Mn().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{i(this.auth).then(async c=>{if(!t&&fr(window.grecaptcha)&&n.scriptInjectionDeferred)await n.scriptInjectionDeferred.promise,r(c,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ic();l.length!==0&&(l+=c+`&onload=${_r}`),n.scriptInjectionDeferred=new pe,window[_r]=()=>{n.scriptInjectionDeferred?.resolve()},li(l).then(()=>n.scriptInjectionDeferred?.promise).then(()=>{r(c,s,o)}).catch(a=>{o(a)})}}).catch(c=>{o(c)})})}};ze.scriptInjectionDeferred=null;G=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return V("not implemented")}_getIdTokenResponse(e){return V("not implemented")}_linkToIdToken(e,t){return V("not implemented")}_getReauthenticationResolver(e){return V("not implemented")}};ye=class n extends G{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new n(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new n(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,t,"signInWithPassword",mc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Ec(e,{email:this._email,oobCode:this._password});default:k(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":let i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,i,"signUpPassword",fc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return yc(e,{idToken:t,email:this._email,oobCode:this._password});default:k(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};wc="http://localhost",H=class n extends G{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new n(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):k("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,...s}=t;if(!i||!r)return null;let o=new n(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}buildRequest(){let e={requestUri:wc,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let 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=re(t)}return e}};Ac={USER_NOT_FOUND:"user-not-found"};le=class n extends G{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new n({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new n({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return Tc(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return vc(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Sc(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:i,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:i,code:r}}toJSON(){let 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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s}=e;return!i&&!t&&!r&&!s?null:new n({verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s})}};ue=class n{constructor(e){let t=me(ge(e)),i=t.apiKey??null,r=t.oobCode??null,s=kc(t.mode??null);u(i&&r&&s,"argument-error"),this.apiKey=i,this.operation=s,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t=Rc(e);try{return new n(t)}catch{return null}}};K=class n{constructor(){this.providerId=n.PROVIDER_ID}static credential(e,t){return ye._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let i=ue.parseLink(t);return u(i,"argument-error"),ye._fromEmailAndCode(e,i.code,i.tenantId)}};K.PROVIDER_ID="password";K.EMAIL_PASSWORD_SIGN_IN_METHOD="password";K.EMAIL_LINK_SIGN_IN_METHOD="emailLink";N=class{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}};ne=class extends N{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},yt=class n extends ne{static credentialFromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;return u("providerId"in t&&"signInMethod"in t,"argument-error"),H._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return u(e.idToken||e.accessToken,"argument-error"),H._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return n.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return n.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:c}=e;if(!i&&!r&&!t&&!s||!c)return null;try{return new n(c)._credential({idToken:t,accessToken:i,nonce:o,pendingToken:s})}catch{return null}}};we=class n extends ne{constructor(){super("facebook.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};we.FACEBOOK_SIGN_IN_METHOD="facebook.com";we.PROVIDER_ID="facebook.com";Te=class n extends ne{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return n.credential(t,i)}catch{return null}}};Te.GOOGLE_SIGN_IN_METHOD="google.com";Te.PROVIDER_ID="google.com";ve=class n extends ne{constructor(){super("github.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};ve.GITHUB_SIGN_IN_METHOD="github.com";ve.PROVIDER_ID="github.com";Cc="http://localhost",wt=class n extends G{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,pendingToken:s}=t;return!i||!r||!s||i!==r?null:new n(i,s)}static _create(e,t){return new n(e,t)}buildRequest(){return{requestUri:Cc,returnSecureToken:!0,pendingToken:this.pendingToken}}};Pc="saml.",Tt=class n extends N{constructor(e){u(e.startsWith(Pc),"argument-error"),super(e)}static credentialFromResult(e){return n.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return n.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let t=wt.fromJSON(e);return u(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:t,providerId:i}=e;if(!t||!i)return null;try{return wt._create(i,t)}catch{return null}}};Ae=class n extends ne{constructor(){super("twitter.com")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return n.credential(t,i)}catch{return null}}};Ae.TWITTER_SIGN_IN_METHOD="twitter.com";Ae.PROVIDER_ID="twitter.com";D=class n{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){let s=await Z._fromIdTokenResponse(e,i,r),o=Er(i);return new n({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);let r=Er(i);return new n({user:e,providerId:r,_tokenResponse:i,operationType:t})}};xn=class n extends C{constructor(e,t,i,r){super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,n.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new n(e,t,i,r)}};de=class{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?Vn._fromServerResponse(e,t):"totpInfo"in t?Hn._fromServerResponse(e,t):k(e,"internal-error")}},Vn=class n extends de{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new n(t)}},Hn=class n extends de{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new n(t)}};te=class{constructor(e,t,i={}){this.isNewUser=e,this.providerId=t,this.profile=i}},vt=class extends te{constructor(e,t,i,r){super(e,t,i),this.username=r}},Wn=class extends te{constructor(e,t){super(e,"facebook.com",t)}},Bn=class extends vt{constructor(e,t){super(e,"github.com",t,typeof t?.login=="string"?t?.login:null)}},$n=class extends te{constructor(e,t){super(e,"google.com",t)}},jn=class extends vt{constructor(e,t,i){super(e,"twitter.com",t,i)}};At=class n{constructor(e,t,i){this.type=e,this.credential=t,this.user=i}static _fromIdtoken(e,t){return new n("enroll",e,t)}static _fromMfaPendingCredential(e){return new n("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return n._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return n._fromIdtoken(e.multiFactorSession.idToken)}return null}};zn=class n{constructor(e,t,i){this.session=e,this.hints=t,this.signInResolver=i}static _fromError(e,t){let i=b(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(c=>de._fromServerResponse(i,c));u(r.mfaPendingCredential,i,"internal-error");let o=At._fromMfaPendingCredential(r.mfaPendingCredential);return new n(o,s,async c=>{let l=await c._process(i,o);delete r.mfaInfo,delete r.mfaPendingCredential;let a={...r,idToken:l.idToken,refreshToken:l.refreshToken};switch(t.operationType){case"signIn":let d=await D._fromIdTokenResponse(i,t.operationType,a);return await i._updateCurrentUser(d.user),d;case"reauthenticate":return u(t.user,i,"internal-error"),D._forOperation(t.user,t.operationType,a);default:k(i,"internal-error")}})}async resolveSignIn(e){let t=e;return this.signInResolver(t)}};qn=class n{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(i=>de._fromServerResponse(e.auth,i)))})}static _fromUser(e){return new n(e)}async getSession(){return At._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){let i=e,r=await this.getSession(),s=await q(this.user,i._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let t=typeof e=="string"?e:e.uid,i=await this.user.getIdToken();try{let r=await q(this.user,xc(this.user.auth,{idToken:i,mfaEnrollmentId:t}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==t),await this.user._updateTokensIfNecessary(r),await this.user.reload()}catch(r){throw r}}},Tn=new WeakMap;St="__sak";kt=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(St,"1"),this.storage.removeItem(St),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let 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()}};Vc=1e3,Hc=10,Rt=class extends kt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Qr(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,l)=>{this.notifyListeners(o,l)});return}let i=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);Qo()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Hc):r()}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Vc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};Rt.type="LOCAL";bi=Rt;Wc=1e3;Ct=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=An(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:vn(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let i=An(e);document.cookie=`${i}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;let i=An(e);if(window.cookieStore){let c=(a=>{let d=a.changed.find(f=>f.name===i);d&&t(d.value),a.deleted.find(f=>f.name===i)&&t(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(t,l),window.cookieStore.addEventListener("change",c)}let r=vn(i),s=setInterval(()=>{let c=vn(i);c!==r&&(t(c),r=c)},Wc),o=()=>clearInterval(s);this.listenerUnsubscribes.set(t,o)}_removeListener(e,t){let i=this.listenerUnsubscribes.get(t);i&&(i(),this.listenerUnsubscribes.delete(t))}};Ct.type="COOKIE";Ws=Ct;Pt=class extends kt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}};Pt.type="SESSION";$t=Pt;Ot=class n{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;let i=new n(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});let c=Array.from(o).map(async a=>a(t.origin,s)),l=await Bc(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Ot.receivers=[];Gn=class{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,i=50){let r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((c,l)=>{let a=jt("",20);r.port1.start();let d=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){let f=h;if(f.data.eventId===a)switch(f.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(f.data.response);break;default:clearTimeout(d),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:a,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};Bs="firebaseLocalStorageDb",Gc=1,Nt="firebaseLocalStorage",$s="fbase_key",he=class{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)})})}};Yc=800,Xc=3,Dt=class{constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=js(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{let i=await this._openDb();return await e(i)}catch(i){if(t++>Xc)throw i;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Ei()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ot._getInstance(qc()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await jc(),!this.activeServiceWorker)return;this.sender=new Gn(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||zc()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await wr(e,St,"1"),await Tr(e,St)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>wr(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(i=>Jc(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Tr(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(r=>{let s=zt(r,!1).getAll();return new he(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let t=[],i=new Set;if(e.length!==0)for(let{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(let r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Yc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};Dt.type="LOCAL";yi=Dt;Sn=es("rcb"),el=new ce(3e4,6e4),Kn=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!E().grecaptcha?.render}load(e,t=""){return u(tl(t),e,"argument-error"),this.shouldResolveImmediately(t)&&hr(E().grecaptcha)?Promise.resolve(E().grecaptcha):new Promise((i,r)=>{let s=E().setTimeout(()=>{r(S(e,"network-request-failed"))},el.get());E()[Sn]=()=>{E().clearTimeout(s),delete E()[Sn];let c=E().grecaptcha;if(!c||!hr(c)){r(S(e,"internal-error"));return}let l=c.render;c.render=(a,d)=>{let h=l(a,d);return this.counter++,h},this.hostLanguage=t,i(c)};let o=`${nc()}?${re({onload:Sn,render:"explicit",hl:t})}`;li(o).catch(()=>{clearTimeout(s),r(S(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!E().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Jn=class{async load(e){return new Ln(e)}clearedOneInstance(){}};We="recaptcha",nl={theme:"light",type:"image"},Lt=class{constructor(e,t,i={...nl}){this.parameters=i,this.type=We,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=b(e),this.isInvisible=this.parameters.size==="invisible",u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let r=typeof t=="string"?document.getElementById(t):t;u(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Jn:new Kn,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),i=t.getResponse(e);return i||new Promise(r=>{let s=o=>{o&&(this.tokenChangeListeners.delete(s),r(o))};this.tokenChangeListeners.add(s),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){u(!this.parameters.sitekey,this.auth,"argument-error"),u(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(i=>i(t)),typeof e=="function")e(t);else if(typeof e=="string"){let i=E()[e];typeof i=="function"&&i(t)}}}assertNotDestroyed(){u(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){u(ri()&&!Ei(),this.auth,"internal-error"),await il(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await jo(this.auth);u(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return u(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};qe=class{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=le._fromVerification(this.verificationId,e);return this.onConfirmation(t)}};Se=class n{constructor(e){this.providerId=n.PROVIDER_ID,this.auth=b(e)}verifyPhoneNumber(e,t){return qt(this.auth,e,p(t))}static credential(e,t){return le._fromVerification(e,t)}static credentialFromResult(e){let t=e;return n.credentialFromTaggedObject(t)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:i}=e;return t&&i?le._fromTokenResponse(t,i):null}};Se.PROVIDER_ID="phone";Se.PHONE_SIGN_IN_METHOD="phone";Ge=class extends G{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return j(e,this._buildIdpRequest())}_linkToIdToken(e,t){return j(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return j(e,this._buildIdpRequest())}_buildIdpRequest(e){let 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}};Mt=class{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}let l={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(a){this.reject(a)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return rl;case"linkViaPopup":case"linkViaRedirect":return al;case"reauthViaPopup":case"reauthViaRedirect":return sl;default:k(this.auth,"internal-error")}}resolve(e){z(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){z(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()}};ol=new ce(2e3,1e4);ke=class n extends Mt{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){z(this.filter.length===1,"Popup operations only handle one event");let e=jt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(S(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(S(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(S(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ol.get())};e()}};ke.currentPopupAction=null;cl="pendingRedirect",dt=new Map,Yn=class extends Mt{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=dt.get(this.auth._key());if(!e){try{let i=await ll(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}dt.set(this.auth._key(),e)}return this.bypassAuthState||dt.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};pl=600*1e3,Xn=class{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(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ml(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!aa(e)){let i=e.error.code?.split("auth/")[1]||"internal-error";t.onError(S(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=pl&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ar(e))}saveEventToCache(e){this.cachedEventUids.add(Ar(e)),this.lastProcessedEventTime=Date.now()}};_l=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Il=/^https?/;yl=new ce(3e4,6e4);ht=null;vl=new ce(5e3,15e3),Al="__/auth/iframe",Sl="emulator/auth/iframe",kl={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Rl=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);Ol={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Nl=500,Dl=600,Ll="_blank",Ml="http://localhost",Ut=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};xl="__/auth/handler",Vl="emulator/auth/handler",Hl=encodeURIComponent("fac");Rn="webStorageSupport",Qn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=$t,this._completeRedirectFn=ra,this._overrideRedirectResult=ul}async _openPopup(e,t,i,r){z(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await kr(e,t,i,Be(),r);return Ul(e,s,jt())}async _openRedirect(e,t,i,r){await this._originValidation(e);let s=await kr(e,t,i,Be(),r);return $c(s),new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(z(s,"If manager is not set, promise should be"),s)}let i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){let t=await Pl(e),i=new Xn(e);return t.register("authEvent",r=>(u(r?.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Rn,{type:Rn},r=>{let s=r?.[0]?.[Rn];s!==void 0&&t(!!s),k(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=bl(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Qr()||qr()||ci()}},Ti=Qn,Ft=class{constructor(e){this.factorId=e}_process(e,t,i){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,i);case"signin":return this._finalizeSignIn(e,t.credential);default:return V("unexpected MultiFactorSessionType")}}},Zn=class n extends Ft{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new n(e)}_finalizeEnroll(e,t,i){return Mc(e,{idToken:t,displayName:i,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return Qc(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ke=class{constructor(){}static assertion(e){return Zn._fromCredential(e)}};Ke.FACTOR_ID="phone";Je=class{static assertionForEnrollment(e,t){return xt._fromSecret(e,t)}static assertionForSignIn(e,t){return xt._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;u(typeof t.user?.auth<"u","internal-error");let i=await Uc(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ye._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Je.FACTOR_ID="totp";xt=class n extends Ft{constructor(e,t,i){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=i}static _fromSecret(e,t){return new n(t,void 0,e)}static _fromEnrollmentId(e,t){return new n(t,e)}async _finalizeEnroll(e,t,i){return u(typeof this.secret<"u",e,"argument-error"),Fc(e,{idToken:t,displayName:i,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){u(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let i={verificationCode:this.otp};return Zc(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:i})}},Ye=class n{constructor(e,t,i,r,s,o,c){this.sessionInfo=o,this.auth=c,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=i,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new n(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let i=!1;return(ct(e)||ct(t))&&(i=!0),i&&(ct(e)&&(e=this.auth.currentUser?.email||"unknownuser"),ct(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Rr="@firebase/auth",Cr="1.13.3";ei=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(i=>{e(i?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};jl=300,zl=nn("authIdTokenMaxAge")||jl,Pr=null,ql=n=>async e=>{let t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>zl)return;let r=t?.token;Pr!==r&&(Pr=r,await fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};tc({loadJS(n){return new Promise((e,t)=>{let i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{let s=S("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Gl().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="});$l("Browser")});var la=O(()=>{ca();Me();_e();it();nt()});var Gt={};Ai(Gt,{ActionCodeOperation:()=>Mr,ActionCodeURL:()=>ue,AuthCredential:()=>G,AuthErrorCodes:()=>Vr,EmailAuthCredential:()=>ye,EmailAuthProvider:()=>K,FacebookAuthProvider:()=>we,FactorId:()=>Or,GithubAuthProvider:()=>ve,GoogleAuthProvider:()=>Te,OAuthCredential:()=>H,OAuthProvider:()=>yt,OperationType:()=>Lr,PhoneAuthCredential:()=>le,PhoneAuthProvider:()=>Se,PhoneMultiFactorGenerator:()=>Ke,ProviderId:()=>Nr,RecaptchaVerifier:()=>Lt,SAMLAuthProvider:()=>Tt,SignInMethod:()=>Dr,TotpMultiFactorGenerator:()=>Je,TotpSecret:()=>Ye,TwitterAuthProvider:()=>Ae,applyActionCode:()=>ms,beforeAuthStateChanged:()=>Ii,browserCookiePersistence:()=>Ws,browserLocalPersistence:()=>bi,browserPopupRedirectResolver:()=>Ti,browserSessionPersistence:()=>$t,checkActionCode:()=>gi,confirmPasswordReset:()=>ps,connectAuthEmulator:()=>di,createUserWithEmailAndPassword:()=>_s,debugErrorMap:()=>Fr,deleteUser:()=>xs,fetchSignInMethodsForEmail:()=>ws,getAdditionalUserInfo:()=>Cs,getAuth:()=>oa,getIdToken:()=>$r,getIdTokenResult:()=>ai,getMultiFactorResolver:()=>Vs,getRedirectResult:()=>ia,inMemoryPersistence:()=>It,indexedDBLocalPersistence:()=>yi,initializeAuth:()=>ui,initializeRecaptchaConfig:()=>Os,isSignInWithEmailLink:()=>Es,linkWithCredential:()=>fi,linkWithPhoneNumber:()=>qs,linkWithPopup:()=>Xs,linkWithRedirect:()=>na,multiFactor:()=>Hs,onAuthStateChanged:()=>Ds,onIdTokenChanged:()=>_i,parseActionCodeURL:()=>rs,prodErrorMap:()=>ti,reauthenticateWithCredential:()=>pi,reauthenticateWithPhoneNumber:()=>Gs,reauthenticateWithPopup:()=>Ys,reauthenticateWithRedirect:()=>ta,reload:()=>oi,revokeAccessToken:()=>Fs,sendEmailVerification:()=>Ts,sendPasswordResetEmail:()=>fs,sendSignInLinkToEmail:()=>bs,setPersistence:()=>Ps,signInAnonymously:()=>as,signInWithCredential:()=>Qe,signInWithCustomToken:()=>hs,signInWithEmailAndPassword:()=>Is,signInWithEmailLink:()=>ys,signInWithPhoneNumber:()=>zs,signInWithPopup:()=>Js,signInWithRedirect:()=>ea,signOut:()=>Us,unlink:()=>ls,updateCurrentUser:()=>Ms,updateEmail:()=>Ss,updatePassword:()=>ks,updatePhoneNumber:()=>Ks,updateProfile:()=>As,useDeviceLanguage:()=>Ls,validatePassword:()=>Ns,verifyBeforeUpdateEmail:()=>vs,verifyPasswordResetCode:()=>gs});var Kt=O(()=>{la()});var Kl={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},vi=null,Jt=null;async function Ze(){return typeof window>"u"?null:(vi||(vi=(async()=>{let{initializeApp:n,getApps:e}=await Promise.resolve().then(()=>(ur(),lr)),{getAuth:t,signInAnonymously:i,onAuthStateChanged:r}=await Promise.resolve().then(()=>(Kt(),Gt)),s=e().length?e()[0]:n(Kl);if(Jt=t(s),!await new Promise(c=>{let l=r(Jt,a=>{l(),c(a)})}))try{await i(Jt)}catch(c){console.warn("[Fleetbo Auth] Anonymous session created in offline mode or delayed:",c.message)}return Jt})()),vi)}async function ua(){try{let n=await Ze();return!n||!n.currentUser?null:await n.currentUser.getIdToken()}catch(n){return console.error("[Fleetbo Auth Debug]",n),null}}async function da(n){let e=await Ze(),{signInWithCustomToken:t}=await Promise.resolve().then(()=>(Kt(),Gt)),i=await t(e,n);return{uid:i.user.uid,email:i.user.email,isAnonymous:i.user.isAnonymous}}async function ha(){let n=await Ze(),{signOut:e,signInAnonymously:t}=await Promise.resolve().then(()=>(Kt(),Gt));return await e(n),await t(n),!0}async function fa(){let n=await Ze();return!n||!n.currentUser?null:{uid:n.currentUser.uid,email:n.currentUser.email,isAnonymous:n.currentUser.isAnonymous}}async function pa(n=!1){try{let e=await Ze();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(n)).claims.elog===!0}catch(e){return console.error("[Fleetbo Auth Debug]",e),!1}}var Jl="https://fleetbo-gatekeeper.fleetbo.workers.dev/",w=async(n,e=null)=>{try{let t=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_DB_KEY:process.env.VITE_FLEETBO_DB_KEY,i=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_ENTERPRISE_ID:process.env.VITE_FLEETBO_ENTERPRISE_ID,r=n.replace("https://","").split("-")[0]||"add",s={"Content-Type":"application/json"},o=await ua();o&&(s.Authorization=`Bearer ${o}`);let c={targetFunction:r,enterpriseID:i,fleetboDB:t,fleetboTable:e?.fleetboTable||null,jsonData:e?.jsonData||e,data:{fleetboDB:t,enterpriseID:i,...e}},l=await fetch(Jl,{method:"POST",headers:s,body:JSON.stringify(c)}),a=await l.json(),d=a.result||a;return{success:l.ok,...d}}catch(t){return{success:!1,error:t.message}}};if(typeof window<"u"&&typeof customElements<"u"){class n extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"\u2014",h=a!=null&&a.trim()!==""&&a!=="null"&&a!=="undefined";this.textContent=h?a:d}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):this.setAttribute("value",String(a))}get currency(){return this.getAttribute("currency")}set currency(a){a==null?this.removeAttribute("currency"):this.setAttribute("currency",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"0";if(a==null||a===""||a==="null"||a==="undefined"){this.textContent=d;return}let h=Number(a);if(Number.isNaN(h)){this.textContent=d;return}let f=this.getAttribute("currency");if(f)try{this.textContent=new Intl.NumberFormat("fr-FR",{style:"currency",currency:f}).format(h)}catch{this.textContent=`${h} ${f}`}else this.textContent=String(h)}}class t extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(a){a==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(a))}get"label-true"(){return this.labelTrue}set"label-true"(a){this.labelTrue=a}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(a){a==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(a))}get"label-false"(){return this.labelFalse}set"label-false"(a){this.labelFalse=a}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("label-true")||"Oui",h=this.getAttribute("label-false")||"Non",f=this.getAttribute("invalid-fallback")||"Inconnu";a==="true"||a==="1"?this.textContent=d:a==="false"||a==="0"?this.textContent=h:this.textContent=f}}class i extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):a&&typeof a.toISOString=="function"?this.setAttribute("value",a.toISOString()):this.setAttribute("value",String(a))}get locale(){return this.getAttribute("locale")}set locale(a){a==null?this.removeAttribute("locale"):this.setAttribute("locale",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"Date invalide",h=this.getAttribute("locale")||"fr-FR";if(!a||a==="null"||a==="undefined"||a===""){this.textContent=d;return}let f=new Date(a);if(Number.isNaN(f.getTime())){this.textContent=d;return}try{this.textContent=f.toLocaleDateString(h)}catch{this.textContent=f.toLocaleDateString("fr-FR")}}}class r extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get allowed(){return this.getAttribute("allowed")}set allowed(a){a==null?this.removeAttribute("allowed"):Array.isArray(a)?this.setAttribute("allowed",a.join(",")):this.setAttribute("allowed",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=(this.getAttribute("allowed")||"").split(",").map(f=>f.trim()).filter(Boolean),h=this.getAttribute("invalid-fallback")||"Statut non autoris\xE9";if(!a||a==="null"||a==="undefined"||!d.includes(a)){this.textContent=h;return}this.textContent=String(a)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get alt(){return this.getAttribute("alt")}set alt(a){a==null?this.removeAttribute("alt"):this.setAttribute("alt",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"",h=this.getAttribute("alt")||"Media";this.innerHTML="";let f=document.createElement("img"),A=a&&a!=="null"&&a!=="undefined"&&a.trim()!=="";f.src=A?a:d,f.alt=h,this.appendChild(f)}}class o extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(a){a==null?this.removeAttribute("table"):this.setAttribute("table",String(a))}get id(){return this.getAttribute("id")}set id(a){a==null?this.removeAttribute("id"):this.setAttribute("id",String(a))}get field(){return this.getAttribute("field")}set field(a){a==null?this.removeAttribute("field"):this.setAttribute("field",String(a))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(a){a==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(a))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(a){this.orphanFallback=a}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(a){a==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(a))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(a){this.loadingFallback=a}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(a){a==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(a))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(a){this.malformedFallback=a}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let a=this.getAttribute("table"),d=this.getAttribute("id"),h=this.getAttribute("field")||"name",f=this.getAttribute("orphan-fallback")||"Supprim\xE9",A=this.getAttribute("loading-fallback")||"Chargement...",L=this.getAttribute("malformed-fallback")||"ID invalide";if(!d||typeof d!="string"||d.trim()===""||d==="null"||d==="undefined"){this.textContent=L;return}if(!a){this.textContent=L;return}this.textContent=A;try{let ie=window.Fleetbo||globalThis.Fleetbo;if(!ie||typeof ie.getDoc!="function"){this.textContent=f;return}let M=await ie.getDoc(a,d);M&&M[h]!==void 0?this.textContent=String(M[h]):M?this.textContent=M.name||M.title||M.label||JSON.stringify(M):this.textContent=f}catch{this.textContent=f}}}let c=(l,a)=>{customElements.get(l)||customElements.define(l,a)};c("fleetbo-text",n),c("fleetbo-number",e),c("fleetbo-toggle",t),c("fleetbo-date",i),c("fleetbo-enum",r),c("fleetbo-media",s),c("fleetbo-reference",o)}var Yl={Text:"fleetbo-text",Number:"fleetbo-number",Toggle:"fleetbo-toggle",Date:"fleetbo-date",Enum:"fleetbo-enum",Media:"fleetbo-media",Reference:"fleetbo-reference"};function Ce(n){typeof window>"u"&&typeof process<"u"&&process.env}async function P(n){if(n&&n._schemaVersion&&n._schemaData){let e=n._schemaVersion,t=n._schemaData;if(typeof window<"u")try{await fetch("/__fleetbo_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:t,version:e})})}catch{}else typeof process<"u"&&process.env}return n}var T=n=>`https://${n.toLowerCase()}-jqycakhlxa-uc.a.run.app`,Xl=()=>new Proxy({},{get(n,e){let t=String(e);return async(i={})=>{let r=await w(T("call"),{functionName:t,payload:i});return P(r)}}}),ma={...Yl,call:Xl(),add:async(n,e)=>{Ce(n);let t=await w(T("add"),{fleetboTable:n,jsonData:e});return P(t)},addWithId:async(n,e,t)=>{Ce(n);let i=await w(T("addWithId"),{fleetboTable:n,id:t,jsonData:e});return P(i)},addWithUserId:async(n,e)=>{Ce(n);let t=await w(T("addWithUserId"),{fleetboTable:n,jsonData:e});return P(t)},addWithMedia:async(n,e,t,i=null)=>{Ce(n);let r=await w(T("addWithMedia"),{fleetboTable:n,jsonData:e,fileBase64:t,fileName:i});return P(r)},delete:async(n,e)=>{let t=await w(T("delete"),{fleetboTable:n,id:e});return P(t)},getDocsG:async n=>{let e=await w(T("getDocsG"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDocsU:async n=>{let e=await w(T("getDocsU"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDoc:async(n,e)=>{let t=await w(T("getDoc"),{fleetboTable:n,id:e}),i=await P(t);return i?i.data!==void 0?i.data:i.success===!1?null:i:null},getUser:async()=>await fa(),getAuthUser:async()=>{let n=await w(T("getAuthUser")),e=await P(n);return e?e.data!==void 0?e.data:e.success===!1?null:e:null},update:async(n,e,t)=>{let i=await w(T("update"),{fleetboTable:n,id:e,...t});return P(i)},join:async(n,e)=>{Ce(n),e?.innerJoin?.collection&&Ce(e.innerJoin.collection);let t=await w(T("join"),{fleetboTable:n,joinOptions:e}),i=await P(t);return Array.isArray(i)?i:i&&Array.isArray(i.data)?i.data:[]},sendotpsvro:async n=>await w(T("sendOtpSvro"),{email:n}),verifyotpsvro:async(n,e)=>{let t=await w(T("verifyOtpSvro"),{email:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await da(t.customToken)}}catch(i){return{success:!1,error:i.message}}return t},isAuthenticated:async(n=!1)=>await pa(n),logout:async()=>{try{return await ha(),{success:!0}}catch(n){return{success:!1,error:n.message}}},acl:{grant:async(n,e,t,i="*")=>await w(T("grantAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),revoke:async(n,e,t,i="*")=>await w(T("revokeAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),can:async(n,e,t="*")=>{let i=await w(T("checkAcl"),{action:n,resourceTable:e,resourceId:t});return!!(i&&(i.allowed===!0||i.can===!0))}}};typeof globalThis<"u"&&Reflect.set(globalThis,"Fleetbo",ma);typeof window<"u"&&Reflect.set(window,"Fleetbo",ma);export{ma as Fleetbo,Yl as FleetboUI};
2
2
  /*! Bundled license information:
3
3
 
4
4
  @firebase/util/dist/index.esm.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-svro",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",