pwa-auth 3.0.4 → 3.1.1

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +53 -42
  3. package/demonstration/compiled/pwa-auth.js +35 -34
  4. package/demonstration/compiled/pwa-auth.js.map +1 -0
  5. package/demonstration/compiled/pwa-helpers-BN4uXXdl.js +8 -0
  6. package/demonstration/compiled/pwa-helpers-BN4uXXdl.js.map +1 -0
  7. package/demonstration/compiled/pwa-helpers.js +8 -0
  8. package/demonstration/compiled/pwa-helpers.js.map +1 -0
  9. package/package.json +16 -3
  10. package/src/compiled/pwa-auth.js +35 -34
  11. package/src/compiled/pwa-auth.js.map +1 -0
  12. package/src/compiled/pwa-helpers-BN4uXXdl.js +8 -0
  13. package/src/compiled/pwa-helpers-BN4uXXdl.js.map +1 -0
  14. package/src/compiled/pwa-helpers.js +8 -0
  15. package/src/compiled/pwa-helpers.js.map +1 -0
  16. package/src/pwa-auth.js +0 -1
  17. package/src/pwa-helpers.js +1 -0
  18. package/src-classes/pwa-auth.js +3 -0
  19. package/src-compiled/pwa-auth.js +881 -0
  20. package/src-compiled/pwa-auth.js.map +1 -0
  21. package/src-compiled/pwa-helpers-BN4uXXdl.js +8 -0
  22. package/src-compiled/pwa-helpers-BN4uXXdl.js.map +1 -0
  23. package/src-compiled/pwa-helpers.js +8 -0
  24. package/src-compiled/pwa-helpers.js.map +1 -0
  25. package/src-export/pwa-auth.ts +3 -0
  26. package/src-export/pwa-helpers.ts +1 -0
  27. package/src-export/tsconfig.production.json +53 -0
  28. package/src-functions/pwa-helpers.js +1 -0
  29. package/src-typescript/development/helpers-array.ts +0 -0
  30. package/transpiled/src-export/pwa-auth.d.ts +4 -0
  31. package/transpiled/src-export/pwa-auth.d.ts.map +1 -0
  32. package/transpiled/src-export/pwa-auth.js +3 -0
  33. package/transpiled/src-export/pwa-helpers.d.ts +2 -0
  34. package/transpiled/src-export/pwa-helpers.d.ts.map +1 -0
  35. package/transpiled/src-export/pwa-helpers.js +1 -0
  36. package/transpiled/src-typescript/css/form/button.d.ts +3 -0
  37. package/transpiled/src-typescript/css/form/button.d.ts.map +1 -0
  38. package/transpiled/src-typescript/css/form/button.js +54 -0
  39. package/transpiled/src-typescript/css/form/input.d.ts +3 -0
  40. package/transpiled/src-typescript/css/form/input.d.ts.map +1 -0
  41. package/transpiled/src-typescript/css/form/input.js +24 -0
  42. package/transpiled/src-typescript/css/form/label.d.ts +3 -0
  43. package/transpiled/src-typescript/css/form/label.d.ts.map +1 -0
  44. package/transpiled/src-typescript/css/form/label.js +22 -0
  45. package/transpiled/src-typescript/css/form/list.d.ts +3 -0
  46. package/transpiled/src-typescript/css/form/list.d.ts.map +1 -0
  47. package/transpiled/src-typescript/css/form/list.js +22 -0
  48. package/transpiled/src-typescript/css/svg.d.ts +4 -0
  49. package/transpiled/src-typescript/css/svg.d.ts.map +1 -0
  50. package/transpiled/src-typescript/css/svg.js +4 -0
  51. package/transpiled/src-typescript/css/toggle.d.ts +2 -0
  52. package/transpiled/src-typescript/css/toggle.d.ts.map +1 -0
  53. package/transpiled/src-typescript/css/toggle.js +8 -0
  54. package/transpiled/src-typescript/firebase/authentication.d.ts +11 -0
  55. package/transpiled/src-typescript/firebase/authentication.d.ts.map +1 -0
  56. package/transpiled/src-typescript/firebase/authentication.js +10 -0
  57. package/transpiled/src-typescript/firebase/interface.d.ts +5 -0
  58. package/transpiled/src-typescript/firebase/interface.d.ts.map +1 -0
  59. package/transpiled/src-typescript/firebase/interface.js +79 -0
  60. package/transpiled/src-typescript/redux/backend.d.ts +16 -0
  61. package/transpiled/src-typescript/redux/backend.d.ts.map +1 -0
  62. package/transpiled/src-typescript/redux/backend.js +43 -0
  63. package/transpiled/src-typescript/redux/drawer.d.ts +20 -0
  64. package/transpiled/src-typescript/redux/drawer.d.ts.map +1 -0
  65. package/transpiled/src-typescript/redux/drawer.js +21 -0
  66. package/transpiled/src-typescript/redux/frontend.d.ts +17 -0
  67. package/transpiled/src-typescript/redux/frontend.d.ts.map +1 -0
  68. package/transpiled/src-typescript/redux/frontend.js +67 -0
  69. package/transpiled/src-typescript/redux/object.d.ts +24 -0
  70. package/transpiled/src-typescript/redux/object.d.ts.map +1 -0
  71. package/transpiled/src-typescript/redux/object.js +1 -0
  72. package/transpiled/src-typescript/store.d.ts +19 -0
  73. package/transpiled/src-typescript/store.d.ts.map +1 -0
  74. package/transpiled/src-typescript/store.js +13 -0
  75. package/transpiled/src-typescript/webcomponents/drawer/css/drawer.d.ts +3 -0
  76. package/transpiled/src-typescript/webcomponents/drawer/css/drawer.d.ts.map +1 -0
  77. package/transpiled/src-typescript/webcomponents/drawer/css/drawer.js +55 -0
  78. package/transpiled/src-typescript/webcomponents/drawer/css/exit.d.ts +3 -0
  79. package/transpiled/src-typescript/webcomponents/drawer/css/exit.d.ts.map +1 -0
  80. package/transpiled/src-typescript/webcomponents/drawer/css/exit.js +48 -0
  81. package/transpiled/src-typescript/webcomponents/drawer/css/link.d.ts +3 -0
  82. package/transpiled/src-typescript/webcomponents/drawer/css/link.d.ts.map +1 -0
  83. package/transpiled/src-typescript/webcomponents/drawer/css/link.js +12 -0
  84. package/transpiled/src-typescript/webcomponents/drawer/css/paragraph.d.ts +3 -0
  85. package/transpiled/src-typescript/webcomponents/drawer/css/paragraph.d.ts.map +1 -0
  86. package/transpiled/src-typescript/webcomponents/drawer/css/paragraph.js +10 -0
  87. package/transpiled/src-typescript/webcomponents/drawer/css/toggle.d.ts +3 -0
  88. package/transpiled/src-typescript/webcomponents/drawer/css/toggle.d.ts.map +1 -0
  89. package/transpiled/src-typescript/webcomponents/drawer/css/toggle.js +18 -0
  90. package/transpiled/src-typescript/webcomponents/drawer/drawer.d.ts +37 -0
  91. package/transpiled/src-typescript/webcomponents/drawer/drawer.d.ts.map +1 -0
  92. package/transpiled/src-typescript/webcomponents/drawer/drawer.js +138 -0
  93. package/transpiled/src-typescript/webcomponents/drawer/input/login.d.ts +20 -0
  94. package/transpiled/src-typescript/webcomponents/drawer/input/login.d.ts.map +1 -0
  95. package/transpiled/src-typescript/webcomponents/drawer/input/login.js +134 -0
  96. package/transpiled/src-typescript/webcomponents/drawer/input/sign-up.d.ts +20 -0
  97. package/transpiled/src-typescript/webcomponents/drawer/input/sign-up.d.ts.map +1 -0
  98. package/transpiled/src-typescript/webcomponents/drawer/input/sign-up.js +144 -0
  99. package/transpiled/src-typescript/webcomponents/icon/css/icon.d.ts +2 -0
  100. package/transpiled/src-typescript/webcomponents/icon/css/icon.d.ts.map +1 -0
  101. package/transpiled/src-typescript/webcomponents/icon/css/icon.js +59 -0
  102. package/transpiled/src-typescript/webcomponents/icon/icon.d.ts +33 -0
  103. package/transpiled/src-typescript/webcomponents/icon/icon.d.ts.map +1 -0
  104. package/transpiled/src-typescript/webcomponents/icon/icon.js +81 -0
  105. package/transpiled/src-typescript/webcomponents/settings/css/navigation.d.ts +2 -0
  106. package/transpiled/src-typescript/webcomponents/settings/css/navigation.d.ts.map +1 -0
  107. package/transpiled/src-typescript/webcomponents/settings/css/navigation.js +51 -0
  108. package/transpiled/src-typescript/webcomponents/settings/input/delete.d.ts +34 -0
  109. package/transpiled/src-typescript/webcomponents/settings/input/delete.d.ts.map +1 -0
  110. package/transpiled/src-typescript/webcomponents/settings/input/delete.js +92 -0
  111. package/transpiled/src-typescript/webcomponents/settings/input/email.d.ts +34 -0
  112. package/transpiled/src-typescript/webcomponents/settings/input/email.d.ts.map +1 -0
  113. package/transpiled/src-typescript/webcomponents/settings/input/email.js +104 -0
  114. package/transpiled/src-typescript/webcomponents/settings/input/name.d.ts +33 -0
  115. package/transpiled/src-typescript/webcomponents/settings/input/name.d.ts.map +1 -0
  116. package/transpiled/src-typescript/webcomponents/settings/input/name.js +95 -0
  117. package/transpiled/src-typescript/webcomponents/settings/input/password.d.ts +36 -0
  118. package/transpiled/src-typescript/webcomponents/settings/input/password.d.ts.map +1 -0
  119. package/transpiled/src-typescript/webcomponents/settings/input/password.js +151 -0
  120. package/transpiled/src-typescript/webcomponents/settings/input/uploader.d.ts +37 -0
  121. package/transpiled/src-typescript/webcomponents/settings/input/uploader.d.ts.map +1 -0
  122. package/transpiled/src-typescript/webcomponents/settings/input/uploader.js +235 -0
  123. package/transpiled/src-typescript/webcomponents/settings/settings.d.ts +37 -0
  124. package/transpiled/src-typescript/webcomponents/settings/settings.d.ts.map +1 -0
  125. package/transpiled/src-typescript/webcomponents/settings/settings.js +204 -0
  126. package/pwa-auth.js +0 -4
  127. /package/src-typescript/development/{object.ts → utilities-object.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * pwa-auth
3
+ * Copyright (c) 2025 Jacek Markiewicz
4
+ * Licensed under MIT
5
+ */
6
+
7
+ const t=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},e={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let e=0;e<t.length;e+=3){const s=t[e],r=e+1<t.length,o=r?t[e+1]:0,a=e+2<t.length,h=a?t[e+2]:0,c=s>>2,l=(3&s)<<4|o>>4;let u=(15&o)<<2|h>>6,d=63&h;a||(d=64,r||(u=64)),i.push(n[c],n[l],n[u],n[d])}return i.join("")},encodeString(e,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(e):this.encodeByteArray(t(e),n)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const s=t[n++];if(s<128)e[i++]=String.fromCharCode(s);else if(s>191&&s<224){const r=t[n++];e[i++]=String.fromCharCode((31&s)<<6|63&r)}else if(s>239&&s<365){const r=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(r>>10)),e[i++]=String.fromCharCode(56320+(1023&r))}else{const r=t[n++],o=t[n++];e[i++]=String.fromCharCode((15&s)<<12|(63&r)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const i=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let e=0;e<t.length;){const r=i[t.charAt(e++)],o=e<t.length?i[t.charAt(e)]:0;++e;const a=e<t.length?i[t.charAt(e)]:64;++e;const h=e<t.length?i[t.charAt(e)]:64;if(++e,null==r||null==o||null==a||null==h)throw new n;const c=r<<2|o>>4;if(s.push(c),64!==a){const t=o<<4&240|a>>2;if(s.push(t),64!==h){const t=a<<6&192|h;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class n extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const i=function(n){return function(n){const i=t(n);return e.encodeByteArray(i,!0)}(n).replace(/\./g,"")},s=function(t){try{return e.decodeString(t,!0)}catch(t){}return null};const r=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,o=()=>{try{return r()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&s(t[1]);return e&&JSON.parse(e)})()}catch(t){return}},a=t=>o()?.emulatorHosts?.[t],h=t=>{const e=a(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const i=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),i]:[e.substring(0,n),i]},c=()=>o()?.config,l=t=>o()?.[`_${t}`];class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch(()=>{}),1===t.length?t(e):t(e,n))}}}function d(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function p(t){return(await fetch(t,{credentials:"include"})).ok}function f(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}},...t};return[i(JSON.stringify({alg:"none",type:"JWT"})),i(JSON.stringify(o)),""].join(".")}const g={};let m=!1;function _(t,e){if("undefined"==typeof window||"undefined"==typeof document||!d(window.location.host)||g[t]===e||g[t]||m)return;function n(t){return`__firebase__banner__${t}`}g[t]=e;const i="__firebase__banner",s=function(){const t={prod:[],emulator:[]};for(const e of Object.keys(g))g[e]?t.emulator.push(e):t.prod.push(e);return t}().prod.length>0;function r(){const t=document.createElement("span");return t.style.cursor="pointer",t.style.marginLeft="16px",t.style.fontSize="24px",t.innerHTML=" &times;",t.onclick=()=>{m=!0,function(){const t=document.getElementById(i);t&&t.remove()}()},t}function o(){const t=function(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}(i),e=n("text"),o=document.getElementById(e)||document.createElement("span"),a=n("learnmore"),h=document.getElementById(a)||document.createElement("a"),c=n("preprendIcon"),l=document.getElementById(c)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(t.created){const e=t.element;!function(t){t.style.display="flex",t.style.background="#7faaf0",t.style.position="fixed",t.style.bottom="5px",t.style.left="5px",t.style.padding=".5em",t.style.borderRadius="5px",t.style.alignItems="center"}(e),function(t,e){t.setAttribute("id",e),t.innerText="Learn more",t.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",t.setAttribute("target","__blank"),t.style.paddingLeft="5px",t.style.textDecoration="underline"}(h,a);const n=r();!function(t,e){t.setAttribute("width","24"),t.setAttribute("id",e),t.setAttribute("height","24"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.style.marginLeft="-6px"}(l,c),e.append(l,o,h,n),document.body.appendChild(e)}s?(o.innerText="Preview backend disconnected.",l.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(l.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",e)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}function y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function v(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function w(){try{return"object"==typeof indexedDB}catch(t){return!1}}function b(){return new Promise((t,e)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(i),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{e(s.error?.message||"")}}catch(t){e(t)}})}function T(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class I extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,I.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,E.prototype.create)}}class E{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},i=`${this.service}/${t}`,s=this.errors[t],r=s?function(t,e){return t.replace(S,(t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`})}(s,n):"Error",o=`${this.serviceName}: ${r} (${i}).`;return new I(i,o,n)}}const S=/\{\$([^}]+)}/g;function k(t,e){if(t===e)return!0;const n=Object.keys(t),i=Object.keys(e);for(const s of n){if(!i.includes(s))return!1;const n=t[s],r=e[s];if(C(n)&&C(r)){if(!k(n,r))return!1}else if(n!==r)return!1}for(const t of i)if(!n.includes(t))return!1;return!0}function C(t){return null!==t&&"object"==typeof t}function A(t){const e=[];for(const[n,i]of Object.entries(t))Array.isArray(i)?i.forEach(t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function R(t){const e={};return t.replace(/^\?/,"").split("&").forEach(t=>{if(t){const[n,i]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(i)}}),e}function O(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class P{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(()=>{t(this)}).catch(t=>{this.error(t)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,e,n){let i;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");i=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===i.next&&(i.next=N),void 0===i.error&&(i.error=N),void 0===i.complete&&(i.complete=N);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(t){}}),this.observers.push(i),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error}})}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function N(){}function D(t,e=1e3,n=2){const i=e*Math.pow(n,t),s=Math.round(.5*i*(Math.random()-.5)*2);return Math.min(144e5,i+s)}function L(t){return t&&t._delegate?t._delegate:t}class U{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}const M="[DEFAULT]";class x{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new u;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){const e=this.normalizeInstanceIdentifier(t?.identifier),n=t?.optional??!1;if(!this.isInitialized(e)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:e})}catch(t){if(n)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:M})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=M){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...t.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return null!=this.component}isInitialized(t=M){return this.instances.has(t)}getOptions(t=M){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(i)}return i}onInit(t,e){const n=this.normalizeInstanceIdentifier(e),i=this.onInitCallbacks.get(n)??new Set;i.add(t),this.onInitCallbacks.set(n,i);const s=this.instances.get(n);return s&&t(s,n),()=>{i.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const i of n)try{i(t,e)}catch{}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(i=t,i===M?void 0:i),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}var i;return n||null}normalizeInstanceIdentifier(t=M){return this.component?this.component.multipleInstances?t:M:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class j{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new x(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}var F;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(F||(F={}));const V={debug:F.DEBUG,verbose:F.VERBOSE,info:F.INFO,warn:F.WARN,error:F.ERROR,silent:F.SILENT},B=F.INFO,H={[F.DEBUG]:"log",[F.VERBOSE]:"log",[F.INFO]:"info",[F.WARN]:"warn",[F.ERROR]:"error"},z=(t,e,...n)=>{if(e<t.logLevel)return;(new Date).toISOString();if(!H[e])throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class ${constructor(t){this.name=t,this._logLevel=B,this._logHandler=z,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in F))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?V[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,F.DEBUG,...t),this._logHandler(this,F.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,F.VERBOSE,...t),this._logHandler(this,F.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,F.INFO,...t),this._logHandler(this,F.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,F.WARN,...t),this._logHandler(this,F.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,F.ERROR,...t),this._logHandler(this,F.ERROR,...t)}}let W,q;const K=new WeakMap,G=new WeakMap,J=new WeakMap,X=new WeakMap,Y=new WeakMap;let Z={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return G.get(t);if("objectStoreNames"===e)return t.objectStoreNames||J.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return et(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function Q(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(q||(q=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(nt(this),e),et(K.get(this))}:function(...e){return et(t.apply(nt(this),e))}:function(e,...n){const i=t.call(nt(this),e,...n);return J.set(i,e.sort?e.sort():[e]),et(i)}}function tt(t){return"function"==typeof t?Q(t):(t instanceof IDBTransaction&&function(t){if(G.has(t))return;const e=new Promise((e,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",r),t.removeEventListener("abort",r)},s=()=>{e(),i()},r=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",r),t.addEventListener("abort",r)});G.set(t,e)}(t),e=t,(W||(W=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,Z):t);var e}function et(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",r)},s=()=>{e(et(t.result)),i()},r=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",r)});return e.then(e=>{e instanceof IDBCursor&&K.set(e,t)}).catch(()=>{}),Y.set(e,t),e}(t);if(X.has(t))return X.get(t);const e=tt(t);return e!==t&&(X.set(t,e),Y.set(e,t)),e}const nt=t=>Y.get(t);function it(t,e,{blocked:n,upgrade:i,blocking:s,terminated:r}={}){const o=indexedDB.open(t,e),a=et(o);return i&&o.addEventListener("upgradeneeded",t=>{i(et(o.result),t.oldVersion,t.newVersion,et(o.transaction),t)}),n&&o.addEventListener("blocked",t=>n(t.oldVersion,t.newVersion,t)),a.then(t=>{r&&t.addEventListener("close",()=>r()),s&&t.addEventListener("versionchange",t=>s(t.oldVersion,t.newVersion,t))}).catch(()=>{}),a}function st(t,{blocked:e}={}){const n=indexedDB.deleteDatabase(t);return e&&n.addEventListener("blocked",t=>e(t.oldVersion,t)),et(n).then(()=>{})}const rt=["get","getKey","getAll","getAllKeys","count"],ot=["put","add","delete","clear"],at=new Map;function ht(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(at.get(e))return at.get(e);const n=e.replace(/FromIndex$/,""),i=e!==n,s=ot.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!s&&!rt.includes(n))return;const r=async function(t,...e){const r=this.transaction(t,s?"readwrite":"readonly");let o=r.store;return i&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&r.done]))[0]};return at.set(e,r),r}Z=(t=>({...t,get:(e,n,i)=>ht(e,n)||t.get(e,n,i),has:(e,n)=>!!ht(e,n)||t.has(e,n)}))(Z);class ct{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(function(t){const e=t.getComponent();return"VERSION"===e?.type}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null}).filter(t=>t).join(" ")}}const lt="@firebase/app",ut="0.14.3",dt=new $("@firebase/app"),pt="@firebase/app-compat",ft="@firebase/analytics-compat",gt="@firebase/analytics",mt="@firebase/app-check-compat",_t="@firebase/app-check",yt="@firebase/auth",vt="@firebase/auth-compat",wt="@firebase/database",bt="@firebase/data-connect",Tt="@firebase/database-compat",It="@firebase/functions",Et="@firebase/functions-compat",St="@firebase/installations",kt="@firebase/installations-compat",Ct="@firebase/messaging",At="@firebase/messaging-compat",Rt="@firebase/performance",Ot="@firebase/performance-compat",Pt="@firebase/remote-config",Nt="@firebase/remote-config-compat",Dt="@firebase/storage",Lt="@firebase/storage-compat",Ut="@firebase/firestore",Mt="@firebase/ai",xt="@firebase/firestore-compat",jt="firebase",Ft="[DEFAULT]",Vt={[lt]:"fire-core",[pt]:"fire-core-compat",[gt]:"fire-analytics",[ft]:"fire-analytics-compat",[_t]:"fire-app-check",[mt]:"fire-app-check-compat",[yt]:"fire-auth",[vt]:"fire-auth-compat",[wt]:"fire-rtdb",[bt]:"fire-data-connect",[Tt]:"fire-rtdb-compat",[It]:"fire-fn",[Et]:"fire-fn-compat",[St]:"fire-iid",[kt]:"fire-iid-compat",[Ct]:"fire-fcm",[At]:"fire-fcm-compat",[Rt]:"fire-perf",[Ot]:"fire-perf-compat",[Pt]:"fire-rc",[Nt]:"fire-rc-compat",[Dt]:"fire-gcs",[Lt]:"fire-gcs-compat",[Ut]:"fire-fst",[xt]:"fire-fst-compat",[Mt]:"fire-vertex","fire-js":"fire-js",[jt]:"fire-js-all"},Bt=new Map,Ht=new Map,zt=new Map;function $t(t,e){try{t.container.addComponent(e)}catch(n){dt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Wt(t){const e=t.name;if(zt.has(e))return dt.debug(`There were multiple attempts to register component ${e}.`),!1;zt.set(e,t);for(const e of Bt.values())$t(e,t);for(const e of Ht.values())$t(e,t);return!0}function qt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Kt(t){return null!=t&&void 0!==t.settings}const Gt=new E("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different 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."});class Jt{constructor(t,e,n){this._isDeleted=!1,this._options={...t},this._config={...e},this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new U("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Gt.create("app-deleted",{appName:this._name})}}const Xt="12.3.0";function Yt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const i={name:Ft,automaticDataCollectionEnabled:!0,...e},s=i.name;if("string"!=typeof s||!s)throw Gt.create("bad-app-name",{appName:String(s)});if(n||(n=c()),!n)throw Gt.create("no-options");const r=Bt.get(s);if(r){if(k(n,r.options)&&k(i,r.config))return r;throw Gt.create("duplicate-app",{appName:s})}const o=new j(s);for(const t of zt.values())o.addComponent(t);const a=new Jt(n,i,o);return Bt.set(s,a),a}function Zt(t=Ft){const e=Bt.get(t);if(!e&&t===Ft&&c())return Yt();if(!e)throw Gt.create("no-app",{appName:t});return e}function Qt(t,e,n){let i=Vt[t]??t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),r=e.match(/\s|\//);if(s||r){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&r&&t.push("and"),r&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void dt.warn(t.join(" "))}Wt(new U(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}const te="firebase-heartbeat-store";let ee=null;function ne(){return ee||(ee=it("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(te)}catch(t){}}}).catch(t=>{throw Gt.create("idb-open",{originalErrorMessage:t.message})})),ee}async function ie(t,e){try{const n=(await ne()).transaction(te,"readwrite"),i=n.objectStore(te);await i.put(e,se(t)),await n.done}catch(t){if(t instanceof I)dt.warn(t.message);else{const e=Gt.create("idb-set",{originalErrorMessage:t?.message});dt.warn(e.message)}}}function se(t){return`${t.name}!${t.options.appId}`}class re{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new ae(e),this._heartbeatsCachePromise=this._storage.read().then(t=>(this._heartbeatsCache=t,t))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=oe();if(null==this._heartbeatsCache?.heartbeats&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats))return;if(this._heartbeatsCache.lastSentHeartbeatDate===e||this._heartbeatsCache.heartbeats.some(t=>t.date===e))return;if(this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats.length>30){const t=function(t){if(0===t.length)return-1;let e=0,n=t[0].date;for(let i=1;i<t.length;i++)t[i].date<n&&(n=t[i].date,e=i);return e}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(t,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){dt.warn(t)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==this._heartbeatsCache?.heartbeats||0===this._heartbeatsCache.heartbeats.length)return"";const t=oe(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let i=t.slice();for(const s of t){const t=n.find(t=>t.agent===s.agent);if(t){if(t.dates.push(s.date),he(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),he(n)>e){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return dt.warn(t),""}}}function oe(){return(new Date).toISOString().substring(0,10)}class ae{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!w()&&b().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await ne()).transaction(te),n=await e.objectStore(te).get(se(t));return await e.done,n}catch(t){if(t instanceof I)dt.warn(t.message);else{const e=Gt.create("idb-get",{originalErrorMessage:t?.message});dt.warn(e.message)}}}(this.app);return t?.heartbeats?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return ie(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){if(await this._canUseIndexedDBPromise){const e=await this.read();return ie(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function he(t){return i(JSON.stringify({version:2,heartbeats:t})).length}var ce;function le(){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."}}ce="",Wt(new U("platform-logger",t=>new ct(t),"PRIVATE")),Wt(new U("heartbeat",t=>new re(t),"PRIVATE")),Qt(lt,ut,ce),Qt(lt,ut,"esm2020"),Qt("fire-js","");const ue=le,de=new E("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),pe=new $("@firebase/auth");function fe(t,...e){pe.logLevel<=F.ERROR&&pe.error(`Auth (${Xt}): ${t}`,...e)}function ge(t,...e){throw ve(t,...e)}function me(t,...e){return ve(t,...e)}function _e(t,e,n){const i={...ue(),[e]:n};return new E("auth","Firebase",i).create(e,{appName:t.name})}function ye(t){return _e(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ve(t,...e){if("string"!=typeof t){const n=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=t.name),t._errorFactory.create(n,...i)}return de.create(t,...e)}function we(t,e,...n){if(!t)throw ve(e,...n)}function be(t){const e="INTERNAL ASSERTION FAILED: "+t;throw fe(e),new Error(e)}function Te(t,e){t||be(e)}function Ie(){return"undefined"!=typeof self&&self.location?.href||""}function Ee(){return"undefined"!=typeof self&&self.location?.protocol||null}function Se(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Ee()&&"https:"!==Ee()&&!v()&&!("connection"in navigator)||navigator.onLine}class ke{constructor(t,e){this.shortDelay=t,this.longDelay=e,Te(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(y())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Se()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Ce(t,e){Te(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class Ae{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void be("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void be("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void be("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Re={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"},Oe=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Pe=new ke(3e4,6e4);function Ne(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function De(t,e,n,i,s={}){return Le(t,s,async()=>{let s={},r={};i&&("GET"===e?r=i:s={body:JSON.stringify(i)});const o=A({key:t.config.apiKey,...r}).slice(1),a=await t._getAdditionalHeaders();a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode);const h={method:e,headers:a,...s};return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(h.referrerPolicy="no-referrer"),t.emulatorConfig&&d(t.emulatorConfig.host)&&(h.credentials="include"),Ae.fetch()(await Me(t,t.config.apiHost,n,o),h)})}async function Le(t,e,n){t._canInitEmulator=!1;const i={...Re,...e};try{const e=new je(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const r=await s.json();if("needConfirmation"in r)throw Fe(t,"account-exists-with-different-credential",r);if(s.ok&&!("errorMessage"in r))return r;{const e=s.ok?r.errorMessage:r.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Fe(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===n)throw Fe(t,"email-already-in-use",r);if("USER_DISABLED"===n)throw Fe(t,"user-disabled",r);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw _e(t,a,o);ge(t,a)}}catch(e){if(e instanceof I)throw e;ge(t,"network-request-failed",{message:String(e)})}}async function Ue(t,e,n,i,s={}){const r=await De(t,e,n,i,s);return"mfaPendingCredential"in r&&ge(t,"multi-factor-auth-required",{_serverResponse:r}),r}async function Me(t,e,n,i){const s=`${e}${n}?${i}`,r=t,o=r.config.emulator?Ce(t.config,s):`${t.config.apiScheme}://${s}`;if(Oe.includes(n)&&(await r._persistenceManagerAvailable,"COOKIE"===r._getPersistenceType())){return r._getPersistence()._getFinalTarget(o).toString()}return o}function xe(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class je{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((t,e)=>{this.timer=setTimeout(()=>e(me(this.auth,"network-request-failed")),Pe.get())})}}function Fe(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const s=me(t,e,i);return s.customData._tokenResponse=n,s}function Ve(t){return void 0!==t&&void 0!==t.enterprise}class Be{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return xe(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function He(t,e){return De(t,"POST","/v1/accounts:lookup",e)}function ze(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function $e(t){return 1e3*Number(t)}function We(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return fe("JWT malformed, contained fewer than 3 sections"),null;try{const t=s(n);return t?JSON.parse(t):(fe("Failed to decode base64 JWT payload"),null)}catch(t){return fe("Caught error parsing JWT payload as JSON",t?.toString()),null}}function qe(t){const e=We(t);return we(e,"internal-error"),we(void 0!==e.exp,"internal-error"),we(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function Ke(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof I&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Ge{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===t?.code&&this.schedule(!0))}this.schedule()}}class Je{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=ze(this.lastLoginAt),this.creationTime=ze(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Xe(t){const e=t.auth,n=await t.getIdToken(),i=await Ke(t,He(e,{idToken:n}));we(i?.users.length,e,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const r=s.providerUserInfo?.length?Ye(s.providerUserInfo):[],o=(a=t.providerData,h=r,[...a.filter(t=>!h.some(e=>e.providerId===t.providerId)),...h]);var a,h;const c=t.isAnonymous,l=!(t.email&&s.passwordHash||o?.length),u=!!c&&l,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Je(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,d)}function Ye(t){return t.map(({providerId:t,...e})=>({providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}))}class Ze{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){we(t.idToken,"internal-error"),we(void 0!==t.idToken,"internal-error"),we(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):qe(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){we(0!==t.length,"internal-error");const e=qe(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(we(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:i,expiresIn:s}=await async function(t,e){const n=await Le(t,{},async()=>{const n=A({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,r=await Me(t,i,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return t.emulatorConfig&&d(t.emulatorConfig.host)&&(a.credentials="include"),Ae.fetch()(r,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,i,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:i,expirationTime:s}=e,r=new Ze;return n&&(we("string"==typeof n,"internal-error",{appName:t}),r.refreshToken=n),i&&(we("string"==typeof i,"internal-error",{appName:t}),r.accessToken=i),s&&(we("number"==typeof s,"internal-error",{appName:t}),r.expirationTime=s),r}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Ze,this.toJSON())}_performRefresh(){return be("not implemented")}}function Qe(t,e){we("string"==typeof t||void 0===t,"internal-error",{appName:e})}class tn{constructor({uid:t,auth:e,stsTokenManager:n,...i}){this.providerId="firebase",this.proactiveRefresh=new Ge(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=e,this.stsTokenManager=n,this.accessToken=n.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 Je(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await Ke(this,this.stsTokenManager.getToken(this.auth,t));return we(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=L(t),i=await n.getIdToken(e),s=We(i);we(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const r="object"==typeof s.firebase?s.firebase:void 0,o=r?.sign_in_provider;return{claims:s,token:i,authTime:ze($e(s.auth_time)),issuedAtTime:ze($e(s.iat)),expirationTime:ze($e(s.exp)),signInProvider:o||null,signInSecondFactor:r?.sign_in_second_factor||null}}(this,t)}reload(){return async function(t){const e=L(t);await Xe(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(we(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(t=>({...t})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new tn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return e.metadata._copy(this.metadata),e}_onReload(t){we(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Xe(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Kt(this.auth.app))return Promise.reject(ye(this.auth));const t=await this.getIdToken();return await Ke(this,async function(t,e){return De(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){const n=e.displayName??void 0,i=e.email??void 0,s=e.phoneNumber??void 0,r=e.photoURL??void 0,o=e.tenantId??void 0,a=e._redirectEventId??void 0,h=e.createdAt??void 0,c=e.lastLoginAt??void 0,{uid:l,emailVerified:u,isAnonymous:d,providerData:p,stsTokenManager:f}=e;we(l&&f,t,"internal-error");const g=Ze.fromJSON(this.name,f);we("string"==typeof l,t,"internal-error"),Qe(n,t.name),Qe(i,t.name),we("boolean"==typeof u,t,"internal-error"),we("boolean"==typeof d,t,"internal-error"),Qe(s,t.name),Qe(r,t.name),Qe(o,t.name),Qe(a,t.name),Qe(h,t.name),Qe(c,t.name);const m=new tn({uid:l,auth:t,email:i,emailVerified:u,displayName:n,isAnonymous:d,photoURL:r,phoneNumber:s,tenantId:o,stsTokenManager:g,createdAt:h,lastLoginAt:c});return p&&Array.isArray(p)&&(m.providerData=p.map(t=>({...t}))),a&&(m._redirectEventId=a),m}static async _fromIdTokenResponse(t,e,n=!1){const i=new Ze;i.updateFromServerResponse(e);const s=new tn({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await Xe(s),s}static async _fromGetAccountInfoResponse(t,e,n){const i=e.users[0];we(void 0!==i.localId,"internal-error");const s=void 0!==i.providerUserInfo?Ye(i.providerUserInfo):[],r=!(i.email&&i.passwordHash||s?.length),o=new Ze;o.updateFromIdToken(n);const a=new tn({uid:i.localId,auth:t,stsTokenManager:o,isAnonymous:r}),h={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 Je(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||s?.length)};return Object.assign(a,h),a}}const en=new Map;function nn(t){Te(t instanceof Function,"Expected a class definition");let e=en.get(t);return e?(Te(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,en.set(t,e),e)}class sn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}sn.type="NONE";const rn=sn;function on(t,e,n){return`firebase:${t}:${e}:${n}`}class an{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:i,name:s}=this.auth;this.fullUserKey=on(this.userKey,i.apiKey,s),this.fullPersistenceKey=on("persistence",i.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if("string"==typeof t){const e=await He(this.auth,{idToken:t}).catch(()=>{});return e?tn._fromGetAccountInfoResponse(this.auth,e,t):null}return tn._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new an(nn(rn),t,n);const i=(await Promise.all(e.map(async t=>{if(await t._isAvailable())return t}))).filter(t=>t);let s=i[0]||nn(rn);const r=on(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(r);if(e){let i;if("string"==typeof e){const n=await He(t,{idToken:e}).catch(()=>{});if(!n)break;i=await tn._fromGetAccountInfoResponse(t,n,e)}else i=tn._fromJSON(t,e);n!==s&&(o=i),s=n;break}}catch{}const a=i.filter(t=>t._shouldAllowMigration);return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(r,o.toJSON()),await Promise.all(e.map(async t=>{if(t!==s)try{await t._remove(r)}catch{}})),new an(s,t,n)):new an(s,t,n)}}function hn(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(dn(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(cn(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(fn(e))return"Blackberry";if(gn(e))return"Webos";if(ln(e))return"Safari";if((e.includes("chrome/")||un(e))&&!e.includes("edge/"))return"Chrome";if(pn(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===n?.length)return n[1]}return"Other"}function cn(t=y()){return/firefox\//i.test(t)}function ln(t=y()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function un(t=y()){return/crios\//i.test(t)}function dn(t=y()){return/iemobile/i.test(t)}function pn(t=y()){return/android/i.test(t)}function fn(t=y()){return/blackberry/i.test(t)}function gn(t=y()){return/webos/i.test(t)}function mn(t=y()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function _n(){return function(){const t=y();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function yn(t=y()){return mn(t)||pn(t)||gn(t)||fn(t)||/windows phone/i.test(t)||dn(t)}function vn(t,e=[]){let n;switch(t){case"Browser":n=hn(y());break;case"Worker":n=`${hn(y())}-${t}`;break;default:n=t}const i=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Xt}/${i}`}class wn{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise((n,i)=>{try{n(t(e))}catch(t){i(t)}});n.onAbort=e,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:t?.message})}}}class bn{constructor(t){const e=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=e.minPasswordLength??6,e.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=e.maxPasswordLength),void 0!==e.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=e.containsLowercaseCharacter),void 0!==e.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=e.containsUppercaseCharacter),void 0!==e.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=e.containsNumericCharacter),void 0!==e.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=e.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=t.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const e={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,e),this.validatePasswordCharacterOptions(t,e),e.isValid&&(e.isValid=e.meetsMinPasswordLength??!0),e.isValid&&(e.isValid=e.meetsMaxPasswordLength??!0),e.isValid&&(e.isValid=e.containsLowercaseLetter??!0),e.isValid&&(e.isValid=e.containsUppercaseLetter??!0),e.isValid&&(e.isValid=e.containsNumericCharacter??!0),e.isValid&&(e.isValid=e.containsNonAlphanumericCharacter??!0),e}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),i&&(e.meetsMaxPasswordLength=t.length<=i)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let i=0;i<t.length;i++)n=t.charAt(i),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,i,s){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=s))}}class Tn{constructor(t,e,n,i){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new En(this),this.idTokenSubscription=new En(this),this.beforeStateQueue=new wn(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=de,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(t=>this._resolvePersistenceManagerAvailable=t)}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=nn(e)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await an.create(this,t),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await He(this,{idToken:t}),n=await tn._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){if(Kt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}const e=await this.assertedPersistence.getCurrentUser();let n=e,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const e=this.redirectUser?._redirectEventId,s=n?._redirectEventId,r=await this.tryRedirectSignIn(t);e&&e!==s||!r?.user||(n=r.user,i=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(n)}catch(t){n=e,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(t))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return we(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Xe(t)}catch(t){if("auth/network-request-failed"!==t?.code)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Kt(this.app))return Promise.reject(ye(this));const e=t?L(t):null;return e&&we(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&we(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return Kt(this.app)?Promise.reject(ye(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Kt(this.app)?Promise.reject(ye(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(nn(t))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return De(t,"GET","/v2/passwordPolicy",Ne(t,e))}(this),e=new bn(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new E("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged(()=>{n(),t()},e)}})}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return De(t,"POST","/v2/accounts:revokeToken",Ne(t,e))}(this,e)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&nn(t)||this._popupRedirectResolver;we(e,this,"argument-error"),this.redirectPersistenceManager=await an.create(this,[nn(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===t?this._currentUser:this.redirectUser?._redirectEventId===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=this.currentUser?.uid??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,i){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e);let r=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(we(o,this,"internal-error"),o.then(()=>{r||s(this.currentUser)}),"function"==typeof e){const s=t.addObserver(e,n,i);return()=>{r=!0,s()}}{const n=t.addObserver(e);return()=>{r=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return we(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=vn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const e=await(this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader());e&&(t["X-Firebase-Client"]=e);const n=await this._getAppCheckToken();return n&&(t["X-Firebase-AppCheck"]=n),t}async _getAppCheckToken(){if(Kt(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken());return t?.error&&function(t,...e){pe.logLevel<=F.WARN&&pe.warn(`Auth (${Xt}): ${t}`,...e)}(`Error while retrieving App Check token: ${t.error}`),t?.token}}function In(t){return L(t)}class En{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new P(t,e);return n.subscribe.bind(n)}(t=>this.observer=t)}get next(){return we(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Sn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function kn(t){return Sn.loadJS(t)}class Cn{constructor(){this.enterprise=new An}ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}class An{ready(t){t()}execute(t,e){return Promise.resolve("token")}render(t,e){return""}}const Rn="NO_RECAPTCHA";class On{constructor(t){this.type="recaptcha-enterprise",this.auth=In(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise(async(e,n)=>{(async function(t,e){return De(t,"GET","/v2/recaptchaConfig",Ne(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0!==i.recaptchaKey){const n=new Be(i);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(t=>{n(t)})})}function i(e,n,i){const s=window.grecaptcha;Ve(s)?s.enterprise.ready(()=>{s.enterprise.execute(e,{action:t}).then(t=>{n(t)}).catch(()=>{n(Rn)})}):i(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new Cn).execute("siteKey",{action:"verify"})}return new Promise((t,s)=>{n(this.auth).then(n=>{if(!e&&Ve(window.grecaptcha))i(n,t,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let e=Sn.recaptchaEnterpriseScript;0!==e.length&&(e+=n),kn(e).then(()=>{i(n,t,s)}).catch(t=>{s(t)})}}).catch(t=>{s(t)})})}}async function Pn(t,e,n,i=!1,s=!1){const r=new On(t);let o;if(s)o=Rn;else try{o=await r.verify(n)}catch(t){o=await r.verify(n,!0)}const a={...e};if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const t=a.phoneEnrollmentInfo.phoneNumber,e=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const t=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Nn(t,e,n,i,s){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Pn(t,e,n,"getOobCode"===n);return i(t,s)}return i(t,e).catch(async s=>{if("auth/missing-recaptcha-token"===s.code){const s=await Pn(t,e,n,"getOobCode"===n);return i(t,s)}return Promise.reject(s)})}function Dn(t,e,n){const i=In(t);we(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const s=Ln(e),{host:r,port:o}=function(t){const e=Ln(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(i);if(s){const t=s[1];return{host:t,port:Un(i.substr(t.length+1))}}{const[t,e]=i.split(":");return{host:t,port:Un(e)}}}(e),a=null===o?"":`:${o}`,h={url:`${s}//${r}${a}/`},c=Object.freeze({host:r,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator)return we(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void we(k(h,i.config.emulator)&&k(c,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=h,i.emulatorConfig=c,i.settings.appVerificationDisabledForTesting=!0,d(r)?(p(`${s}//${r}${a}`),_("Auth",!0)):function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&console.info;"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}()}function Ln(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Un(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Mn{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return be("not implemented")}_getIdTokenResponse(t){return be("not implemented")}_linkToIdToken(t,e){return be("not implemented")}_getReauthenticationResolver(t){return be("not implemented")}}async function xn(t,e){return De(t,"POST","/v1/accounts:signUp",e)}async function jn(t,e){return Ue(t,"POST","/v1/accounts:signInWithPassword",Ne(t,e))}async function Fn(t,e){return async function(t,e){return De(t,"POST","/v1/accounts:sendOobCode",Ne(t,e))}(t,e)}class Vn extends Mn{constructor(t,e,n,i=null){super("password",n),this._email=t,this._password=e,this._tenantId=i}static _fromEmailAndPassword(t,e){return new Vn(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Vn(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if(e?.email&&e?.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Nn(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jn);case"emailLink":return async function(t,e){return Ue(t,"POST","/v1/accounts:signInWithEmailLink",Ne(t,e))}(t,{email:this._email,oobCode:this._password});default:ge(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Nn(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xn);case"emailLink":return async function(t,e){return Ue(t,"POST","/v1/accounts:signInWithEmailLink",Ne(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:ge(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}async function Bn(t,e){return Ue(t,"POST","/v1/accounts:signInWithIdp",Ne(t,e))}class Hn extends Mn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Hn(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):ge("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:i,...s}=e;if(!n||!i)return null;const r=new Hn(n,i);return r.idToken=s.idToken||void 0,r.accessToken=s.accessToken||void 0,r.secret=s.secret,r.nonce=s.nonce,r.pendingToken=s.pendingToken||null,r}_getIdTokenResponse(t){return Bn(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Bn(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Bn(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=A(e)}return t}}class zn{constructor(t){const e=R(O(t)),n=e.apiKey??null,i=e.oobCode??null,s=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(e.mode??null);we(n&&i&&s,"argument-error"),this.apiKey=n,this.operation=s,this.code=i,this.continueUrl=e.continueUrl??null,this.languageCode=e.lang??null,this.tenantId=e.tenantId??null}static parseLink(t){const e=function(t){const e=R(O(t)).link,n=e?R(O(e)).deep_link_id:null,i=R(O(t)).deep_link_id;return(i?R(O(i)).link:null)||i||n||e||t}(t);try{return new zn(e)}catch{return null}}}class $n{constructor(){this.providerId=$n.PROVIDER_ID}static credential(t,e){return Vn._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=zn.parseLink(e);return we(n,"argument-error"),Vn._fromEmailAndCode(t,n.code,n.tenantId)}}$n.PROVIDER_ID="password",$n.EMAIL_PASSWORD_SIGN_IN_METHOD="password",$n.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Wn{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}class qn extends Wn{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}class Kn extends qn{constructor(){super("facebook.com")}static credential(t){return Hn._fromParams({providerId:Kn.PROVIDER_ID,signInMethod:Kn.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Kn.credentialFromTaggedObject(t)}static credentialFromError(t){return Kn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Kn.credential(t.oauthAccessToken)}catch{return null}}}Kn.FACEBOOK_SIGN_IN_METHOD="facebook.com",Kn.PROVIDER_ID="facebook.com";class Gn extends qn{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Hn._fromParams({providerId:Gn.PROVIDER_ID,signInMethod:Gn.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Gn.credentialFromTaggedObject(t)}static credentialFromError(t){return Gn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Gn.credential(e,n)}catch{return null}}}Gn.GOOGLE_SIGN_IN_METHOD="google.com",Gn.PROVIDER_ID="google.com";class Jn extends qn{constructor(){super("github.com")}static credential(t){return Hn._fromParams({providerId:Jn.PROVIDER_ID,signInMethod:Jn.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jn.credentialFromTaggedObject(t)}static credentialFromError(t){return Jn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jn.credential(t.oauthAccessToken)}catch{return null}}}Jn.GITHUB_SIGN_IN_METHOD="github.com",Jn.PROVIDER_ID="github.com";class Xn extends qn{constructor(){super("twitter.com")}static credential(t,e){return Hn._fromParams({providerId:Xn.PROVIDER_ID,signInMethod:Xn.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Xn.credentialFromTaggedObject(t)}static credentialFromError(t){return Xn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Xn.credential(e,n)}catch{return null}}}async function Yn(t,e){return Ue(t,"POST","/v1/accounts:signUp",Ne(t,e))}Xn.TWITTER_SIGN_IN_METHOD="twitter.com",Xn.PROVIDER_ID="twitter.com";class Zn{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,i=!1){const s=await tn._fromIdTokenResponse(t,n,i),r=Qn(n);return new Zn({user:s,providerId:r,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const i=Qn(n);return new Zn({user:t,providerId:i,_tokenResponse:n,operationType:e})}}function Qn(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class ti extends I{constructor(t,e,n,i){super(e.code,e.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,ti.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,i){return new ti(t,e,n,i)}}function ei(t,e,n,i){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw ti._fromErrorAndOperation(t,n,e,i);throw n})}async function ni(t,e,n=!1){if(Kt(t.app))return Promise.reject(ye(t));const i="signIn",s=await ei(t,i,e),r=await Zn._fromIdTokenResponse(t,i,s);return n||await t._updateCurrentUser(r.user),r}async function ii(t,e){return ni(In(t),e)}async function si(t,e,n){if(Kt(t.app))return Promise.reject(ye(t));const i=In(t),s=Nn(i,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Yn),r=await s.catch(e=>{throw"auth/password-does-not-meet-requirements"===e.code&&async function(t){const e=In(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}(t),e}),o=await Zn._fromIdTokenResponse(i,"signIn",r);return await i._updateCurrentUser(o.user),o}async function ri(t,e){const n=L(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()},{email:s}=await Fn(n.auth,i);s!==t.email&&await t.reload()}async function oi(t,{displayName:e,photoURL:n}){if(void 0===e&&void 0===n)return;const i=L(t),s={idToken:await i.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},r=await Ke(i,async function(t,e){return De(t,"POST","/v1/accounts:update",e)}(i.auth,s));i.displayName=r.displayName||null,i.photoURL=r.photoUrl||null;const o=i.providerData.find(({providerId:t})=>"password"===t);o&&(o.displayName=i.displayName,o.photoURL=i.photoURL),await i._updateTokensIfNecessary(r)}function ai(t,e){const n=L(t);return Kt(n.auth.app)?Promise.reject(ye(n.auth)):ci(n,e,null)}function hi(t,e){return ci(L(t),null,e)}async function ci(t,e,n){const{auth:i}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);const r=await Ke(t,async function(t,e){return De(t,"POST","/v1/accounts:update",e)}(i,s));await t._updateTokensIfNecessary(r,!0)}function li(t,e,n,i){return L(t).onAuthStateChanged(e,n,i)}function ui(t){return L(t).signOut()}const di="__sak";class pi{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(di,"1"),this.storage.removeItem(di),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}class fi extends pi{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=yn(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),i=this.localCache[e];n!==i&&t(e,i,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys((t,e,n)=>{this.notifyListeners(t,n)});const n=t.key;e?this.detachListener():this.stopPolling();const i=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);_n()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,10):i()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}fi.type="LOCAL";const gi=fi;class mi extends pi{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,e){}_removeListener(t,e){}}mi.type="SESSION";const _i=mi;class yi{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;const n=new yi(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:i,data:s}=e.data,r=this.handlersMap[i];if(!r?.size)return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(r).map(async t=>t(e.origin,s)),a=await function(t){return Promise.all(t.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}}))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function vi(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}yi.receivers=[];class wi{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,r;return new Promise((o,a)=>{const h=vi("",20);i.port1.start();const c=setTimeout(()=>{a(new Error("unsupported_event"))},n);r={messageChannel:i,onMessage(t){const e=t;if(e.data.eventId===h)switch(e.data.status){case"ack":clearTimeout(c),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(c),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(r),i.port1.addEventListener("message",r.onMessage),this.target.postMessage({eventType:t,eventId:h,data:e},[i.port2])}).finally(()=>{r&&this.removeMessageHandler(r)})}}function bi(){return window}function Ti(){return void 0!==bi().WorkerGlobalScope&&"function"==typeof bi().importScripts}const Ii="firebaseLocalStorageDb",Ei="firebaseLocalStorage",Si="fbase_key";class ki{constructor(t){this.request=t}toPromise(){return new Promise((t,e)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{e(this.request.error)})})}}function Ci(t,e){return t.transaction([Ei],e?"readwrite":"readonly").objectStore(Ei)}function Ai(){const t=indexedDB.open(Ii,1);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const e=t.result;try{e.createObjectStore(Ei,{keyPath:Si})}catch(t){n(t)}}),t.addEventListener("success",async()=>{const n=t.result;n.objectStoreNames.contains(Ei)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Ii);return new ki(t).toPromise()}(),e(await Ai()))})})}async function Ri(t,e,n){const i=Ci(t,!0).put({[Si]:e,value:n});return new ki(i).toPromise()}function Oi(t,e){const n=Ci(t,!0).delete(e);return new ki(n).toPromise()}class Pi{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await Ai()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Ti()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=yi._getInstance(Ti()?self:null),this.receiver._subscribe("keyChanged",async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)})),this.receiver._subscribe("ping",async(t,e)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await async function(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}(),!this.activeServiceWorker)return;this.sender=new wi(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&t[0]?.fulfilled&&t[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Ai();return await Ri(t,di,"1"),await Oi(t,di),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ri(n,t,e)),this.localCache[t]=e,this.notifyServiceWorker(t)))}async _get(t){const e=await this._withRetries(e=>async function(t,e){const n=Ci(t,!1).get(e),i=await new ki(n).toPromise();return void 0===i?null:i.value}(e,t));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>Oi(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(t=>{const e=Ci(t,!1).getAll();return new ki(e).toPromise()});if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:i,value:s}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),e.push(i));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Pi.type="LOCAL";const Ni=Pi;new ke(3e4,6e4);class Di extends Mn{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Bn(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Bn(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Bn(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Li(t){return ni(t.auth,new Di(t),t.bypassAuthState)}function Ui(t){const{auth:e,user:n}=t;return we(n,e,"internal-error"),async function(t,e,n=!1){const{auth:i}=t;if(Kt(i.app))return Promise.reject(ye(i));const s="reauthenticate";try{const r=await Ke(t,ei(i,s,e,t),n);we(r.idToken,i,"internal-error");const o=We(r.idToken);we(o,i,"internal-error");const{sub:a}=o;return we(t.uid===a,i,"user-mismatch"),Zn._forOperation(t,s,r)}catch(t){throw"auth/user-not-found"===t?.code&&ge(i,"user-mismatch"),t}}(n,new Di(t),t.bypassAuthState)}async function Mi(t){const{auth:e,user:n}=t;return we(n,e,"internal-error"),async function(t,e,n=!1){const i=await Ke(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Zn._forOperation(t,"link",i)}(n,new Di(t),t.bypassAuthState)}class xi{constructor(t,e,n,i,s=!1){this.auth=t,this.resolver=n,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise(async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}})}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:i,tenantId:s,error:r,type:o}=t;if(r)return void this.reject(r);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Li;case"linkViaPopup":case"linkViaRedirect":return Mi;case"reauthViaPopup":case"reauthViaRedirect":return Ui;default:ge(this.auth,"internal-error")}}resolve(t){Te(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Te(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const ji=new ke(2e3,1e4);class Fi extends xi{constructor(t,e,n,i,s){super(t,e,i,s),this.provider=n,this.authWindow=null,this.pollId=null,Fi.currentPopupAction&&Fi.currentPopupAction.cancel(),Fi.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return we(t,this.auth,"internal-error"),t}async onExecution(){Te(1===this.filter.length,"Popup operations only handle one event");const t=vi();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(me(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(me(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Fi.currentPopupAction=null}pollUserCancellation(){const t=()=>{this.authWindow?.window?.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(me(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,ji.get())};t()}}Fi.currentPopupAction=null;const Vi="pendingRedirect",Bi=new Map;class Hi extends xi{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Bi.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return on(Vi,t.config.apiKey,t.name)}(e),i=function(t){return nn(t._redirectPersistence)}(t);if(!await i._isAvailable())return!1;const s="true"===await i._get(n);return await i._remove(n),s}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}Bi.set(this.auth._key(),t)}return this.bypassAuthState||Bi.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function zi(t,e){Bi.set(t._key(),e)}async function $i(t,e,n=!1){if(Kt(t.app))return Promise.reject(ye(t));const i=In(t),s=function(t,e){return e?nn(e):(we(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(i,e),r=new Hi(i,s,n),o=await r.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}class Wi{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ki(t);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){if(t.error&&!Ki(t)){const n=t.error.code?.split("auth/")[1]||"internal-error";e.onError(me(this.auth,n))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(qi(t))}saveEventToCache(t){this.cachedEventUids.add(qi(t)),this.lastProcessedEventTime=Date.now()}}function qi(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(t=>t).join("-")}function Ki({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===e?.code}const Gi=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ji=/^https?/;async function Xi(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return De(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Yi(t))return}catch{}ge(t,"unauthorized-domain")}function Yi(t){const e=Ie(),{protocol:n,hostname:i}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===i?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===i}if(!Ji.test(n))return!1;if(Gi.test(t))return i===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}const Zi=new ke(3e4,6e4);function Qi(){const t=bi().___jsl;if(t?.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function ts(t){return new Promise((e,n)=>{function i(){Qi(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Qi(),n(me(t,"network-request-failed"))},timeout:Zi.get()})}if(bi().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else{if(!bi().gapi?.load){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return bi()[e]=()=>{gapi.load?i():n(me(t,"network-request-failed"))},kn(`${Sn.gapiScript}?onload=${e}`).catch(t=>n(t))}i()}}).catch(t=>{throw es=null,t})}let es=null;const ns=new ke(5e3,15e3),is={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ss=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function rs(t){const e=t.config;we(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Ce(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,i={apiKey:e.apiKey,appName:t.name,v:Xt},s=ss.get(t.config.apiHost);s&&(i.eid=s);const r=t._getFrameworks();return r.length&&(i.fw=r.join(",")),`${n}?${A(i).slice(1)}`}async function os(t){const e=await function(t){return es=es||ts(t),es}(t),n=bi().gapi;return we(n,t,"internal-error"),e.open({where:document.body,url:rs(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:is,dontclear:!0},e=>new Promise(async(n,i)=>{await e.restyle({setHideOnLeave:!1});const s=me(t,"network-request-failed"),r=bi().setTimeout(()=>{i(s)},ns.get());function o(){bi().clearTimeout(r),n(e)}e.ping(o).then(o,()=>{i(s)})}))}const as={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class hs{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function cs(t,e,n,i=500,s=600){const r=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const h={...as,width:i.toString(),height:s.toString(),top:r,left:o},c=y().toLowerCase();n&&(a=un(c)?"_blank":n),cn(c)&&(e=e||"http://localhost",h.scrollbars="yes");const l=Object.entries(h).reduce((t,[e,n])=>`${t}${e}=${n},`,"");if(function(t=y()){return mn(t)&&!!window.navigator?.standalone}(c)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(e||"",a),new hs(null);const u=window.open(e||"",a,l);we(u,t,"popup-blocked");try{u.focus()}catch(t){}return new hs(u)}const ls="__/auth/handler",us="emulator/auth/handler",ds=encodeURIComponent("fac");async function ps(t,e,n,i,s,r){we(t.config.authDomain,t,"auth-domain-config-required"),we(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:i,v:Xt,eventId:s};if(e instanceof Wn){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries({}))o[t]=e}if(e instanceof qn){const t=e.getScopes().filter(t=>""!==t);t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const h=await t._getAppCheckToken(),c=h?`#${ds}=${encodeURIComponent(h)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${ls}`;return Ce(t,us)}(t)}?${A(a).slice(1)}${c}`}const fs="webStorageSupport";const gs=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=_i,this._completeRedirectFn=$i,this._overrideRedirectResult=zi}async _openPopup(t,e,n,i){Te(this.eventManagers[t._key()]?.manager,"_initialize() not called before _openPopup()");return cs(t,await ps(t,e,n,Ie(),i),vi())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){bi().location.href=t}(await ps(t,e,n,Ie(),i)),new Promise(()=>{})}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Te(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch(()=>{delete this.eventManagers[e]}),n}async initAndGetManager(t){const e=await os(t),n=new Wi(t);return e.register("authEvent",e=>{we(e?.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(fs,{type:fs},n=>{const i=n?.[0]?.[fs];void 0!==i&&e(!!i),ge(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Xi(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return yn()||ln()||mn()}};var ms="@firebase/auth",_s="1.11.0";class ys{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged(e=>{t(e?.stsTokenManager.accessToken||null)});this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){we(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const vs=l("authIdTokenMaxAge")||300;let ws=null;function bs(t=Zt()){const e=qt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=qt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(k(n.getOptions(),e??{}))return t;ge(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gs,persistence:[Ni,gi,_i]}),i=l("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(i,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>vs)return;const i=e?.token;ws!==i&&(ws=i,await fetch(s,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){L(t).beforeAuthStateChanged(e,n)}(n,e,()=>e(n.currentUser)),function(t,e,n,i){L(t).onIdTokenChanged(e,n,i)}(n,t=>e(t))}}var s;const r=a("auth");return r&&Dn(n,`http://${r}`),n}var Ts;Sn={loadJS:t=>new Promise((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=me("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(i)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},Ts="Browser",Wt(new U("auth",(t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:r,authDomain:o}=n.options;we(r&&!r.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:r,authDomain:o,clientPlatform:Ts,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:vn(Ts)},h=new Tn(n,i,s,a);return function(t,e){const n=e?.persistence||[],i=(Array.isArray(n)?n:[n]).map(nn);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,e?.popupRedirectResolver)}(h,e),h},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider("auth-internal").initialize()})),Wt(new U("auth-internal",t=>(t=>new ys(t))(In(t.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Qt(ms,_s,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Ts)),Qt(ms,_s,"esm2020");var Is,Es="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t;function e(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(t,e,n){n||(n=0);const i=Array(16);if("string"==typeof e)for(var s=0;s<16;++s)i[s]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(s=0;s<16;++s)i[s]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],s=t.g[2];let r,o=t.g[3];r=e+(o^n&(s^o))+i[0]+3614090360&4294967295,r=o+(s^(e=n+(r<<7&4294967295|r>>>25))&(n^s))+i[1]+3905402710&4294967295,o=e+(r<<12&4294967295|r>>>20),r=s+(n^o&(e^n))+i[2]+606105819&4294967295,r=n+(e^(s=o+(r<<17&4294967295|r>>>15))&(o^e))+i[3]+3250441966&4294967295,r=e+(o^(n=s+(r<<22&4294967295|r>>>10))&(s^o))+i[4]+4118548399&4294967295,r=o+(s^(e=n+(r<<7&4294967295|r>>>25))&(n^s))+i[5]+1200080426&4294967295,o=e+(r<<12&4294967295|r>>>20),r=s+(n^o&(e^n))+i[6]+2821735955&4294967295,r=n+(e^(s=o+(r<<17&4294967295|r>>>15))&(o^e))+i[7]+4249261313&4294967295,r=e+(o^(n=s+(r<<22&4294967295|r>>>10))&(s^o))+i[8]+1770035416&4294967295,r=o+(s^(e=n+(r<<7&4294967295|r>>>25))&(n^s))+i[9]+2336552879&4294967295,o=e+(r<<12&4294967295|r>>>20),r=s+(n^o&(e^n))+i[10]+4294925233&4294967295,r=n+(e^(s=o+(r<<17&4294967295|r>>>15))&(o^e))+i[11]+2304563134&4294967295,r=e+(o^(n=s+(r<<22&4294967295|r>>>10))&(s^o))+i[12]+1804603682&4294967295,r=o+(s^(e=n+(r<<7&4294967295|r>>>25))&(n^s))+i[13]+4254626195&4294967295,o=e+(r<<12&4294967295|r>>>20),r=s+(n^o&(e^n))+i[14]+2792965006&4294967295,r=n+(e^(s=o+(r<<17&4294967295|r>>>15))&(o^e))+i[15]+1236535329&4294967295,r=e+(s^o&((n=s+(r<<22&4294967295|r>>>10))^s))+i[1]+4129170786&4294967295,r=o+(n^s&((e=n+(r<<5&4294967295|r>>>27))^n))+i[6]+3225465664&4294967295,o=e+(r<<9&4294967295|r>>>23),r=s+(e^n&(o^e))+i[11]+643717713&4294967295,r=n+(o^e&((s=o+(r<<14&4294967295|r>>>18))^o))+i[0]+3921069994&4294967295,r=e+(s^o&((n=s+(r<<20&4294967295|r>>>12))^s))+i[5]+3593408605&4294967295,r=o+(n^s&((e=n+(r<<5&4294967295|r>>>27))^n))+i[10]+38016083&4294967295,o=e+(r<<9&4294967295|r>>>23),r=s+(e^n&(o^e))+i[15]+3634488961&4294967295,r=n+(o^e&((s=o+(r<<14&4294967295|r>>>18))^o))+i[4]+3889429448&4294967295,r=e+(s^o&((n=s+(r<<20&4294967295|r>>>12))^s))+i[9]+568446438&4294967295,r=o+(n^s&((e=n+(r<<5&4294967295|r>>>27))^n))+i[14]+3275163606&4294967295,o=e+(r<<9&4294967295|r>>>23),r=s+(e^n&(o^e))+i[3]+4107603335&4294967295,r=n+(o^e&((s=o+(r<<14&4294967295|r>>>18))^o))+i[8]+1163531501&4294967295,r=e+(s^o&((n=s+(r<<20&4294967295|r>>>12))^s))+i[13]+2850285829&4294967295,r=o+(n^s&((e=n+(r<<5&4294967295|r>>>27))^n))+i[2]+4243563512&4294967295,o=e+(r<<9&4294967295|r>>>23),r=s+(e^n&(o^e))+i[7]+1735328473&4294967295,r=n+(o^e&((s=o+(r<<14&4294967295|r>>>18))^o))+i[12]+2368359562&4294967295,r=e+((n=s+(r<<20&4294967295|r>>>12))^s^o)+i[5]+4294588738&4294967295,r=o+((e=n+(r<<4&4294967295|r>>>28))^n^s)+i[8]+2272392833&4294967295,o=e+(r<<11&4294967295|r>>>21),r=s+(o^e^n)+i[11]+1839030562&4294967295,r=n+((s=o+(r<<16&4294967295|r>>>16))^o^e)+i[14]+4259657740&4294967295,r=e+((n=s+(r<<23&4294967295|r>>>9))^s^o)+i[1]+2763975236&4294967295,r=o+((e=n+(r<<4&4294967295|r>>>28))^n^s)+i[4]+1272893353&4294967295,o=e+(r<<11&4294967295|r>>>21),r=s+(o^e^n)+i[7]+4139469664&4294967295,r=n+((s=o+(r<<16&4294967295|r>>>16))^o^e)+i[10]+3200236656&4294967295,r=e+((n=s+(r<<23&4294967295|r>>>9))^s^o)+i[13]+681279174&4294967295,r=o+((e=n+(r<<4&4294967295|r>>>28))^n^s)+i[0]+3936430074&4294967295,o=e+(r<<11&4294967295|r>>>21),r=s+(o^e^n)+i[3]+3572445317&4294967295,r=n+((s=o+(r<<16&4294967295|r>>>16))^o^e)+i[6]+76029189&4294967295,r=e+((n=s+(r<<23&4294967295|r>>>9))^s^o)+i[9]+3654602809&4294967295,r=o+((e=n+(r<<4&4294967295|r>>>28))^n^s)+i[12]+3873151461&4294967295,o=e+(r<<11&4294967295|r>>>21),r=s+(o^e^n)+i[15]+530742520&4294967295,r=n+((s=o+(r<<16&4294967295|r>>>16))^o^e)+i[2]+3299628645&4294967295,r=e+(s^((n=s+(r<<23&4294967295|r>>>9))|~o))+i[0]+4096336452&4294967295,r=o+(n^((e=n+(r<<6&4294967295|r>>>26))|~s))+i[7]+1126891415&4294967295,o=e+(r<<10&4294967295|r>>>22),r=s+(e^(o|~n))+i[14]+2878612391&4294967295,r=n+(o^((s=o+(r<<15&4294967295|r>>>17))|~e))+i[5]+4237533241&4294967295,r=e+(s^((n=s+(r<<21&4294967295|r>>>11))|~o))+i[12]+1700485571&4294967295,r=o+(n^((e=n+(r<<6&4294967295|r>>>26))|~s))+i[3]+2399980690&4294967295,o=e+(r<<10&4294967295|r>>>22),r=s+(e^(o|~n))+i[10]+4293915773&4294967295,r=n+(o^((s=o+(r<<15&4294967295|r>>>17))|~e))+i[1]+2240044497&4294967295,r=e+(s^((n=s+(r<<21&4294967295|r>>>11))|~o))+i[8]+1873313359&4294967295,r=o+(n^((e=n+(r<<6&4294967295|r>>>26))|~s))+i[15]+4264355552&4294967295,o=e+(r<<10&4294967295|r>>>22),r=s+(e^(o|~n))+i[6]+2734768916&4294967295,r=n+(o^((s=o+(r<<15&4294967295|r>>>17))|~e))+i[13]+1309151649&4294967295,r=e+(s^((n=s+(r<<21&4294967295|r>>>11))|~o))+i[4]+4149444226&4294967295,r=o+(n^((e=n+(r<<6&4294967295|r>>>26))|~s))+i[11]+3174756917&4294967295,o=e+(r<<10&4294967295|r>>>22),r=s+(e^(o|~n))+i[2]+718787259&4294967295,r=n+(o^((s=o+(r<<15&4294967295|r>>>17))|~e))+i[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(s+(r<<21&4294967295|r>>>11))&4294967295,t.g[2]=t.g[2]+s&4294967295,t.g[3]=t.g[3]+o&4294967295}function i(t,e){this.h=e;const n=[];let i=!0;for(let s=t.length-1;s>=0;s--){const r=0|t[s];i&&r==e||(n[s]=r,i=!1)}this.g=n}!function(t,e){function n(){}n.prototype=e.prototype,t.F=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.D=function(t,n,i){for(var s=Array(arguments.length-2),r=2;r<arguments.length;r++)s[r-2]=arguments[r];return e.prototype[n].apply(t,s)}}(e,function(){this.blockSize=-1}),e.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},e.prototype.v=function(t,e){void 0===e&&(e=t.length);const i=e-this.blockSize,s=this.C;let r=this.h,o=0;for(;o<e;){if(0==r)for(;o<=i;)n(this,t,o),o+=this.blockSize;if("string"==typeof t){for(;o<e;)if(s[r++]=t.charCodeAt(o++),r==this.blockSize){n(this,s),r=0;break}}else for(;o<e;)if(s[r++]=t[o++],r==this.blockSize){n(this,s),r=0;break}}this.h=r,this.o+=e},e.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;e=8*this.o;for(var n=t.length-8;n<t.length;++n)t[n]=255&e,e/=256;for(this.v(t),t=Array(16),e=0,n=0;n<4;++n)for(let i=0;i<32;i+=8)t[e++]=this.g[n]>>>i&255;return t};var s={};function r(t){return-128<=t&&t<128?function(t,e){var n=s;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(t){return new i([0|t],t<0?-1:0)}):new i([0|t],t<0?-1:0)}function o(t){if(isNaN(t)||!isFinite(t))return a;if(t<0)return d(o(-t));const e=[];let n=1;for(let i=0;t>=n;i++)e[i]=t/n|0,n*=4294967296;return new i(e,0)}var a=r(0),h=r(1),c=r(16777216);function l(t){if(0!=t.h)return!1;for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return!1;return!0}function u(t){return-1==t.h}function d(t){const e=t.g.length,n=[];for(let i=0;i<e;i++)n[i]=~t.g[i];return new i(n,~t.h).add(h)}function p(t,e){return t.add(d(e))}function f(t,e){for(;(65535&t[e])!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function g(t,e){this.g=t,this.h=e}function m(t,e){if(l(e))throw Error("division by zero");if(l(t))return new g(a,a);if(u(t))return e=m(d(t),e),new g(d(e.g),d(e.h));if(u(e))return e=m(t,d(e)),new g(d(e.g),e.h);if(t.g.length>30){if(u(t)||u(e))throw Error("slowDivide_ only works with positive integers.");for(var n=h,i=e;i.l(t)<=0;)n=_(n),i=_(i);var s=y(n,1),r=y(i,1);for(i=y(i,2),n=y(n,2);!l(i);){var c=r.add(i);c.l(t)<=0&&(s=s.add(n),r=c),i=y(i,1),n=y(n,1)}return e=p(t,s.j(e)),new g(s,e)}for(s=a;t.l(e)>=0;){for(n=Math.max(1,Math.floor(t.m()/e.m())),i=(i=Math.ceil(Math.log(n)/Math.LN2))<=48?1:Math.pow(2,i-48),c=(r=o(n)).j(e);u(c)||c.l(t)>0;)c=(r=o(n-=i)).j(e);l(r)&&(r=h),s=s.add(r),t=p(t,c)}return new g(s,t)}function _(t){const e=t.g.length+1,n=[];for(let i=0;i<e;i++)n[i]=t.i(i)<<1|t.i(i-1)>>>31;return new i(n,t.h)}function y(t,e){const n=e>>5;e%=32;const s=t.g.length-n,r=[];for(let i=0;i<s;i++)r[i]=e>0?t.i(i+n)>>>e|t.i(i+n+1)<<32-e:t.i(i+n);return new i(r,t.h)}(t=i.prototype).m=function(){if(u(this))return-d(this).m();let t=0,e=1;for(let n=0;n<this.g.length;n++){const i=this.i(n);t+=(i>=0?i:4294967296+i)*e,e*=4294967296}return t},t.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(l(this))return"0";if(u(this))return"-"+d(this).toString(t);const e=o(Math.pow(t,6));var n=this;let i="";for(;;){const s=m(n,e).g;let r=(((n=p(n,s.j(e))).g.length>0?n.g[0]:n.h)>>>0).toString(t);if(l(n=s))return r+i;for(;r.length<6;)r="0"+r;i=r+i}},t.i=function(t){return t<0?0:t<this.g.length?this.g[t]:this.h},t.l=function(t){return u(t=p(this,t))?-1:l(t)?0:1},t.abs=function(){return u(this)?d(this):this},t.add=function(t){const e=Math.max(this.g.length,t.g.length),n=[];let s=0;for(let i=0;i<=e;i++){let e=s+(65535&this.i(i))+(65535&t.i(i)),r=(e>>>16)+(this.i(i)>>>16)+(t.i(i)>>>16);s=r>>>16,e&=65535,r&=65535,n[i]=r<<16|e}return new i(n,-2147483648&n[n.length-1]?-1:0)},t.j=function(t){if(l(this)||l(t))return a;if(u(this))return u(t)?d(this).j(d(t)):d(d(this).j(t));if(u(t))return d(this.j(d(t)));if(this.l(c)<0&&t.l(c)<0)return o(this.m()*t.m());const e=this.g.length+t.g.length,n=[];for(var s=0;s<2*e;s++)n[s]=0;for(s=0;s<this.g.length;s++)for(let e=0;e<t.g.length;e++){const i=this.i(s)>>>16,r=65535&this.i(s),o=t.i(e)>>>16,a=65535&t.i(e);n[2*s+2*e]+=r*a,f(n,2*s+2*e),n[2*s+2*e+1]+=i*a,f(n,2*s+2*e+1),n[2*s+2*e+1]+=r*o,f(n,2*s+2*e+1),n[2*s+2*e+2]+=i*o,f(n,2*s+2*e+2)}for(t=0;t<e;t++)n[t]=n[2*t+1]<<16|n[2*t];for(t=e;t<2*e;t++)n[t]=0;return new i(n,0)},t.B=function(t){return m(this,t).h},t.and=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let i=0;i<e;i++)n[i]=this.i(i)&t.i(i);return new i(n,this.h&t.h)},t.or=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let i=0;i<e;i++)n[i]=this.i(i)|t.i(i);return new i(n,this.h|t.h)},t.xor=function(t){const e=Math.max(this.g.length,t.g.length),n=[];for(let i=0;i<e;i++)n[i]=this.i(i)^t.i(i);return new i(n,this.h^t.h)},e.prototype.digest=e.prototype.A,e.prototype.reset=e.prototype.u,e.prototype.update=e.prototype.v,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.B,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=o,i.fromString=function t(e,n){if(0==e.length)throw Error("number format error: empty string");if((n=n||10)<2||36<n)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return d(t(e.substring(1),n));if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character');const i=o(Math.pow(n,8));let s=a;for(let t=0;t<e.length;t+=8){var r=Math.min(8,e.length-t);const a=parseInt(e.substring(t,t+r),n);r<8?(r=o(Math.pow(n,r)),s=s.j(r).add(o(a))):(s=s.j(i),s=s.add(o(a)))}return s},Is=i}).apply(void 0!==Es?Es:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ss="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(){var t,e=Object.defineProperty;var n=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof Ss&&Ss];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,i){if(i)t:{var s=n;t=t.split(".");for(var r=0;r<t.length-1;r++){var o=t[r];if(!(o in s))break t;s=s[o]}(i=i(r=s[t=t[t.length-1]]))!=r&&null!=i&&e(s,t,{configurable:!0,writable:!0,value:i})}}i("Symbol.dispose",function(t){return t||Symbol("Symbol.dispose")}),i("Array.prototype.values",function(t){return t||function(){return this[Symbol.iterator]()}}),i("Object.entries",function(t){return t||function(t){var e,n=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push([e,t[e]]);return n}});var s=s||{},r=this||self;function o(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function a(t,e,n){return t.call.apply(t.bind,arguments)}function h(t,e,n){return(h=a).apply(null,arguments)}function c(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function l(t,e){function n(){}n.prototype=e.prototype,t.Z=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Ob=function(t,n,i){for(var s=Array(arguments.length-2),r=2;r<arguments.length;r++)s[r-2]=arguments[r];return e.prototype[n].apply(t,s)}}var u="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?t=>t&&AsyncContext.Snapshot.wrap(t):t=>t;function d(t){const e=t.length;if(e>0){const n=Array(e);for(let i=0;i<e;i++)n[i]=t[i];return n}return[]}function p(t,e){for(let e=1;e<arguments.length;e++){const i=arguments[e];var n=typeof i;if("array"==(n="object"!=n?n:i?Array.isArray(i)?"array":n:"null")||"object"==n&&"number"==typeof i.length){n=t.length||0;const e=i.length||0;t.length=n+e;for(let s=0;s<e;s++)t[n+s]=i[s]}else t.push(i)}}function f(t){r.setTimeout(()=>{throw t},0)}function g(){var t=w;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var m=new class{constructor(t,e){this.i=t,this.j=e,this.h=0,this.g=null}get(){let t;return this.h>0?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t}}(()=>new _,t=>t.reset());class _{constructor(){this.next=this.g=this.h=null}set(t,e){this.h=t,this.g=e,this.next=null}reset(){this.next=this.g=this.h=null}}let y,v=!1,w=new class{constructor(){this.h=this.g=null}add(t,e){const n=m.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n}},b=()=>{const t=Promise.resolve(void 0);y=()=>{t.then(T)}};function T(){for(var t;t=g();){try{t.h.call(t.g)}catch(t){f(t)}var e=m;e.j(t),e.h<100&&(e.h++,t.next=e.g,e.g=t)}v=!1}function I(){this.u=this.u,this.C=this.C}function E(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}I.prototype.u=!1,I.prototype.dispose=function(){this.u||(this.u=!0,this.N())},I.prototype[Symbol.dispose]=function(){this.dispose()},I.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},E.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!r.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const t=()=>{};r.addEventListener("test",t,e),r.removeEventListener("test",t,e)}catch(t){}return t}();function k(t){return/^[\s\xa0]*$/.test(t)}function C(t,e){E.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t&&this.init(t,e)}l(C,E),C.prototype.init=function(t,e){const n=this.type=t.type,i=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;this.target=t.target||t.srcElement,this.g=e,(e=t.relatedTarget)||("mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement)),this.relatedTarget=e,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=t.pointerType,this.state=t.state,this.i=t,t.defaultPrevented&&C.Z.h.call(this)},C.prototype.h=function(){C.Z.h.call(this);const t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var A="closure_listenable_"+(1e6*Math.random()|0),R=0;function O(t,e,n,i,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!i,this.ha=s,this.key=++R,this.da=this.fa=!1}function P(t){t.da=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function N(t,e,n){for(const i in t)e.call(n,t[i],i,t)}function D(t){const e={};for(const n in t)e[n]=t[n];return e}const L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function U(t,e){let n,i;for(let e=1;e<arguments.length;e++){for(n in i=arguments[e],i)t[n]=i[n];for(let e=0;e<L.length;e++)n=L[e],Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}}function M(t){this.src=t,this.g={},this.h=0}function x(t,e){const n=e.type;if(n in t.g){var i,s=t.g[n],r=Array.prototype.indexOf.call(s,e,void 0);(i=r>=0)&&Array.prototype.splice.call(s,r,1),i&&(P(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function j(t,e,n,i){for(let s=0;s<t.length;++s){const r=t[s];if(!r.da&&r.listener==e&&r.capture==!!n&&r.ha==i)return s}return-1}M.prototype.add=function(t,e,n,i,s){const r=t.toString();(t=this.g[r])||(t=this.g[r]=[],this.h++);const o=j(t,e,i,s);return o>-1?(e=t[o],n||(e.fa=!1)):((e=new O(e,this.src,r,!!i,s)).fa=n,t.push(e)),e};var F="closure_lm_"+(1e6*Math.random()|0),V={};function B(t,e,n,i,s){if(Array.isArray(e)){for(let r=0;r<e.length;r++)B(t,e[r],n,i,s);return null}return n=G(n),t&&t[A]?t.J(e,n,!!o(i)&&!!i.capture,s):function(t,e,n,i,s,r){if(!e)throw Error("Invalid event type");const a=o(s)?!!s.capture:!!s;let h=q(t);if(h||(t[F]=h=new M(t)),n=h.add(e,n,i,a,r),n.proxy)return n;if(i=function(){function t(n){return e.call(t.src,t.listener,n)}const e=W;return t}(),n.proxy=i,i.src=t,i.listener=n,t.addEventListener)S||(s=a),void 0===s&&(s=!1),t.addEventListener(e.toString(),i,s);else if(t.attachEvent)t.attachEvent($(e.toString()),i);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(i)}return n}(t,e,n,!1,i,s)}function H(t,e,n,i,s){if(Array.isArray(e))for(var r=0;r<e.length;r++)H(t,e[r],n,i,s);else i=o(i)?!!i.capture:!!i,n=G(n),t&&t[A]?(t=t.i,(r=String(e).toString())in t.g&&((n=j(e=t.g[r],n,i,s))>-1&&(P(e[n]),Array.prototype.splice.call(e,n,1),0==e.length&&(delete t.g[r],t.h--)))):t&&(t=q(t))&&(e=t.g[e.toString()],t=-1,e&&(t=j(e,n,i,s)),(n=t>-1?e[t]:null)&&z(n))}function z(t){if("number"!=typeof t&&t&&!t.da){var e=t.src;if(e&&e[A])x(e.i,t);else{var n=t.type,i=t.proxy;e.removeEventListener?e.removeEventListener(n,i,t.capture):e.detachEvent?e.detachEvent($(n),i):e.addListener&&e.removeListener&&e.removeListener(i),(n=q(e))?(x(n,t),0==n.h&&(n.src=null,e[F]=null)):P(t)}}}function $(t){return t in V?V[t]:V[t]="on"+t}function W(t,e){if(t.da)t=!0;else{e=new C(e,this);const n=t.listener,i=t.ha||t.src;t.fa&&z(t),t=n.call(i,e)}return t}function q(t){return(t=t[F])instanceof M?t:null}var K="__closure_events_fn_"+(1e9*Math.random()>>>0);function G(t){return"function"==typeof t?t:(t[K]||(t[K]=function(e){return t.handleEvent(e)}),t[K])}function J(){I.call(this),this.i=new M(this),this.M=this,this.G=null}function X(t,e){var n,i=t.G;if(i)for(n=[];i;i=i.G)n.push(i);if(t=t.M,i=e.type||e,"string"==typeof e)e=new E(e,t);else if(e instanceof E)e.target=e.target||t;else{var s=e;U(e=new E(i,t),s)}let r,o;if(s=!0,n)for(o=n.length-1;o>=0;o--)r=e.g=n[o],s=Y(r,i,!0,e)&&s;if(r=e.g=t,s=Y(r,i,!0,e)&&s,s=Y(r,i,!1,e)&&s,n)for(o=0;o<n.length;o++)r=e.g=n[o],s=Y(r,i,!1,e)&&s}function Y(t,e,n,i){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();let s=!0;for(let r=0;r<e.length;++r){const o=e[r];if(o&&!o.da&&o.capture==n){const e=o.listener,n=o.ha||o.src;o.fa&&x(t.i,o),s=!1!==e.call(n,i)&&s}}return s&&!i.defaultPrevented}function Z(t){t.g=function(t,e){if("function"!=typeof t){if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=h(t.handleEvent,t)}return Number(e)>2147483647?-1:r.setTimeout(t,e||0)}(()=>{t.g=null,t.i&&(t.i=!1,Z(t))},t.l);const e=t.h;t.h=null,t.m.apply(null,e)}l(J,I),J.prototype[A]=!0,J.prototype.removeEventListener=function(t,e,n,i){H(this,t,e,n,i)},J.prototype.N=function(){if(J.Z.N.call(this),this.i){var t=this.i;for(const e in t.g){const n=t.g[e];for(let t=0;t<n.length;t++)P(n[t]);delete t.g[e],t.h--}}this.G=null},J.prototype.J=function(t,e,n,i){return this.i.add(String(t),e,!1,n,i)},J.prototype.K=function(t,e,n,i){return this.i.add(String(t),e,!0,n,i)};class Q extends I{constructor(t,e){super(),this.m=t,this.l=e,this.h=null,this.i=!1,this.g=null}j(t){this.h=arguments,this.g?this.i=!0:Z(this)}N(){super.N(),this.g&&(r.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function tt(t){I.call(this),this.h=t,this.g={}}l(tt,I);var et=[];function nt(t){N(t.g,function(t,e){this.g.hasOwnProperty(e)&&z(t)},t),t.g={}}tt.prototype.N=function(){tt.Z.N.call(this),nt(this)},tt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var it=r.JSON.stringify,st=r.JSON.parse,rt=class{stringify(t){return r.JSON.stringify(t,void 0)}parse(t){return r.JSON.parse(t,void 0)}};function ot(){}var at={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ht(){E.call(this,"d")}function ct(){E.call(this,"c")}l(ht,E),l(ct,E);var lt={},ut=null;function dt(){return ut=ut||new J}function pt(t){E.call(this,lt.Ia,t)}function ft(t){const e=dt();X(e,new pt(e))}function gt(t,e){E.call(this,lt.STAT_EVENT,t),this.stat=e}function mt(t){const e=dt();X(e,new gt(e,t))}function _t(t,e){E.call(this,lt.Ja,t),this.size=e}function yt(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return r.setTimeout(function(){t()},e)}function vt(){this.g=!0}function wt(t,e,n,i){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{const r=JSON.parse(e);if(r)for(t=0;t<r.length;t++)if(Array.isArray(r[t])){var n=r[t];if(!(n.length<2)){var i=n[1];if(Array.isArray(i)&&!(i.length<1)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(let t=1;t<i.length;t++)i[t]=""}}}return it(r)}catch(t){return e}}(t,n)+(i?" "+i:"")})}lt.Ia="serverreachability",l(pt,E),lt.STAT_EVENT="statevent",l(gt,E),lt.Ja="timingevent",l(_t,E),vt.prototype.ua=function(){this.g=!1},vt.prototype.info=function(){};var bt,Tt={NO_ERROR:0,TIMEOUT:8};function It(){}function Et(t){return encodeURIComponent(String(t))}function St(t){var e=1;t=t.split(":");const n=[];for(;e>0&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function kt(t,e,n,i){this.j=t,this.i=e,this.l=n,this.S=i||1,this.V=new tt(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ct}function Ct(){this.i=null,this.g="",this.h=!1}l(It,ot),It.prototype.g=function(){return new XMLHttpRequest},bt=new It;var At={},Rt={};function Ot(t,e,n){t.M=1,t.A=ee(Xt(e)),t.u=n,t.R=!0,Pt(t,null)}function Pt(t,e){t.F=Date.now(),Lt(t),t.B=Xt(t.A);var n=t.B,i=t.S;Array.isArray(i)||(i=[String(i)]),ge(n.i,"t",i),t.C=0,n=t.j.L,t.h=new Ct,t.g=en(t.j,n?e:null,!t.u),t.P>0&&(t.O=new Q(h(t.Y,t,t.g),t.P)),e=t.V,n=t.g,i=t.ba;var s="readystatechange";Array.isArray(s)||(s&&(et[0]=s.toString()),s=et);for(let t=0;t<s.length;t++){const r=B(n,s[t],i||e.handleEvent,!1,e.h||e);if(!r)break;e.g[r.key]=r}e=t.J?D(t.J):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.B,t.v,t.u,e)):(t.v="GET",t.g.ea(t.B,t.v,null,e)),ft(),function(t,e,n,i,s,r){t.info(function(){if(t.g)if(r){var o="",a=r.split("&");for(let t=0;t<a.length;t++){var h=a[t].split("=");if(h.length>1){const t=h[0];h=h[1];const e=t.split("_");o=e.length>=2&&"type"==e[1]?o+(t+"=")+h+"&":o+(t+"=redacted&")}}}else o=null;else o=r;return"XMLHTTP REQ ("+i+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o})}(t.i,t.v,t.B,t.l,t.S,t.u)}function Nt(t){return!!t.g&&("GET"==t.v&&2!=t.M&&t.j.Aa)}function Dt(t,e){var n=t.C,i=e.indexOf("\n",n);return-1==i?Rt:(n=Number(e.substring(n,i)),isNaN(n)?At:(i+=1)+n>e.length?Rt:(e=e.slice(i,i+n),t.C=i+n,e))}function Lt(t){t.T=Date.now()+t.H,Ut(t,t.H)}function Ut(t,e){if(null!=t.D)throw Error("WatchDog timer not null");t.D=yt(h(t.aa,t),e)}function Mt(t){t.D&&(r.clearTimeout(t.D),t.D=null)}function xt(t){0==t.j.I||t.K||Xe(t.j,t)}function jt(t){Mt(t);var e=t.O;e&&"function"==typeof e.dispose&&e.dispose(),t.O=null,nt(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.dispose())}function Ft(t,e){try{var n=t.j;if(0!=n.I&&(n.g==t||$t(n.h,t)))if(!t.L&&$t(n.h,t)&&3==n.I){try{var i=n.Ba.g.parse(e)}catch(t){i=null}if(Array.isArray(i)&&3==i.length){var s=i;if(0==s[0]){t:if(!n.v){if(n.g){if(!(n.g.F+3e3<t.F))break t;Je(n),Fe(n)}qe(n),mt(18)}}else n.xa=s[1],0<n.xa-n.K&&s[2]<37500&&n.F&&0==n.A&&!n.C&&(n.C=yt(h(n.Va,n),6e3));zt(n.h)<=1&&n.ta&&(n.ta=void 0)}else Ze(n,11)}else if((t.L||n.g==t)&&Je(n),!k(e))for(s=n.Ba.g.parse(e),e=0;e<s.length;e++){let h=s[e];const l=h[0];if(!(l<=n.K))if(n.K=l,h=h[1],2==n.I)if("c"==h[0]){n.M=h[1],n.ba=h[2];const e=h[3];null!=e&&(n.ka=e,n.j.info("VER="+n.ka));const s=h[4];null!=s&&(n.za=s,n.j.info("SVER="+n.za));const l=h[5];null!=l&&"number"==typeof l&&l>0&&(i=1.5*l,n.O=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const u=t.g;if(u){const t=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(t){var r=i.h;r.g||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(r.j=r.l,r.g=new Set,r.h&&(Wt(r,r.h),r.h=null))}if(i.G){const t=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;t&&(i.wa=t,te(i.J,i.G,t))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-t.F,n.j.info("Handshake RTT: "+n.T+"ms"));var o=t;if((i=n).na=tn(i,i.L?i.ba:null,i.W),o.L){qt(i.h,o);var a=o,c=i.O;c&&(a.H=c),a.D&&(Mt(a),Lt(a)),i.g=o}else We(i);n.i.length>0&&Be(n)}else"stop"!=h[0]&&"close"!=h[0]||Ze(n,7);else 3==n.I&&("stop"==h[0]||"close"==h[0]?"stop"==h[0]?Ze(n,7):je(n):"noop"!=h[0]&&n.l&&n.l.qa(h),n.A=0)}ft()}catch(t){}}kt.prototype.ba=function(t){t=t.target;const e=this.O;e&&3==Le(t)?e.j():this.Y(t)},kt.prototype.Y=function(t){try{if(t==this.g)t:{const h=Le(this.g),c=this.g.ya();this.g.ca();if(!(h<3)&&(3!=h||this.g&&(this.h.h||this.g.la()||Ue(this.g)))){this.K||4!=h||7==c||ft(),Mt(this);var e=this.g.ca();this.X=e;var n=function(t){if(!Nt(t))return t.g.la();const e=Ue(t.g);if(""===e)return"";let n="";const i=e.length,s=4==Le(t.g);if(!t.h.i){if("undefined"==typeof TextDecoder)return jt(t),xt(t),"";t.h.i=new r.TextDecoder}for(let r=0;r<i;r++)t.h.h=!0,n+=t.h.i.decode(e[r],{stream:!(s&&r==i-1)});return e.length=0,t.h.g+=n,t.C=0,t.h.g}(this);if(this.o=200==e,function(t,e,n,i,s,r,o){t.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+r+" "+o})}(this.i,this.v,this.B,this.l,this.S,h,e),this.o){if(this.U&&!this.L){e:{if(this.g){var i,s=this.g;if((i=s.g?s.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!k(i)){var o=i;break e}}o=null}if(!(t=o)){this.o=!1,this.m=3,mt(12),jt(this),xt(this);break t}wt(this.i,this.l,t,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ft(this,t)}if(this.R){let e;for(t=!0;!this.K&&this.C<n.length;){if(e=Dt(this,n),e==Rt){4==h&&(this.m=4,mt(14),t=!1),wt(this.i,this.l,null,"[Incomplete Response]");break}if(e==At){this.m=4,mt(15),wt(this.i,this.l,n,"[Invalid Chunk]"),t=!1;break}wt(this.i,this.l,e,null),Ft(this,e)}if(Nt(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=h||0!=n.length||this.h.h||(this.m=1,mt(16),t=!1),this.o=this.o&&t,t){if(n.length>0&&!this.W){this.W=!0;var a=this.j;a.g==this&&a.aa&&!a.P&&(a.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Ke(a),a.P=!0,mt(11))}}else wt(this.i,this.l,n,"[Invalid Chunked Response]"),jt(this),xt(this)}else wt(this.i,this.l,n,null),Ft(this,n);4==h&&jt(this),this.o&&!this.K&&(4==h?Xe(this.j,this):(this.o=!1,Lt(this)))}else(function(t){const e={};t=(t.g&&Le(t)>=2&&t.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<t.length;i++){if(k(t[i]))continue;var n=St(t[i]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const r=e[s]||[];e[s]=r,r.push(n)}!function(t,e){for(const n in t)e.call(void 0,t[n],n,t)}(e,function(t){return t.join(", ")})})(this.g),400==e&&n.indexOf("Unknown SID")>0?(this.m=3,mt(12)):(this.m=0,mt(13)),jt(this),xt(this)}}}catch(t){}},kt.prototype.cancel=function(){this.K=!0,jt(this)},kt.prototype.aa=function(){this.D=null;const t=Date.now();t-this.T>=0?(function(t,e){t.info(function(){return"TIMEOUT: "+e})}(this.i,this.B),2!=this.M&&(ft(),mt(17)),jt(this),this.m=2,xt(this)):Ut(this,this.T-t)};var Vt=class{constructor(t,e){this.g=t,this.map=e}};function Bt(t){this.l=t||10,r.PerformanceNavigationTiming?t=(t=r.performance.getEntriesByType("navigation")).length>0&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(r.chrome&&r.chrome.loadTimes&&r.chrome.loadTimes()&&r.chrome.loadTimes().wasFetchedViaSpdy),this.j=t?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Ht(t){return!!t.h||!!t.g&&t.g.size>=t.j}function zt(t){return t.h?1:t.g?t.g.size:0}function $t(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Wt(t,e){t.g?t.g.add(e):t.h=e}function qt(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Kt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null!=t.g&&0!==t.g.size){let e=t.i;for(const n of t.g.values())e=e.concat(n.G);return e}return d(t.i)}Bt.prototype.cancel=function(){if(this.i=Kt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const t of this.g.values())t.cancel();this.g.clear()}};var Gt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Jt(t){let e;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,t instanceof Jt?(this.l=t.l,Yt(this,t.j),this.o=t.o,this.g=t.g,Zt(this,t.u),this.h=t.h,Qt(this,me(t.i)),this.m=t.m):t&&(e=String(t).match(Gt))?(this.l=!1,Yt(this,e[1]||"",!0),this.o=ne(e[2]||""),this.g=ne(e[3]||"",!0),Zt(this,e[4]),this.h=ne(e[5]||"",!0),Qt(this,e[6]||"",!0),this.m=ne(e[7]||"")):(this.l=!1,this.i=new le(null,this.l))}function Xt(t){return new Jt(t)}function Yt(t,e,n){t.j=n?ne(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Zt(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.u=e}else t.u=null}function Qt(t,e,n){e instanceof le?(t.i=e,function(t,e){e&&!t.j&&(ue(t),t.i=null,t.g.forEach(function(t,e){const n=e.toLowerCase();e!=n&&(de(this,e),ge(this,n,t))},t)),t.j=e}(t.i,t.l)):(n||(e=ie(e,he)),t.i=new le(e,t.l))}function te(t,e,n){t.i.set(e,n)}function ee(t){return te(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function ne(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ie(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,se),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function se(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Jt.prototype.toString=function(){const t=[];var e=this.j;e&&t.push(ie(e,re,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.o)&&t.push(ie(e,re,!0),"@"),t.push(Et(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.u)&&t.push(":",String(n))),(n=this.h)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(ie(n,"/"==n.charAt(0)?ae:oe,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.m)&&t.push("#",ie(n,ce)),t.join("")},Jt.prototype.resolve=function(t){const e=Xt(this);let n=!!t.j;n?Yt(e,t.j):n=!!t.o,n?e.o=t.o:n=!!t.g,n?e.g=t.g:n=null!=t.u;var i=t.h;if(n)Zt(e,t.u);else if(n=!!t.h){if("/"!=i.charAt(0))if(this.g&&!this.h)i="/"+i;else{var s=e.h.lastIndexOf("/");-1!=s&&(i=e.h.slice(0,s+1)+i)}if(".."==(s=i)||"."==s)i="";else if(-1!=s.indexOf("./")||-1!=s.indexOf("/.")){i=0==s.lastIndexOf("/",0),s=s.split("/");const t=[];for(let e=0;e<s.length;){const n=s[e++];"."==n?i&&e==s.length&&t.push(""):".."==n?((t.length>1||1==t.length&&""!=t[0])&&t.pop(),i&&e==s.length&&t.push("")):(t.push(n),i=!0)}i=t.join("/")}else i=s}return n?e.h=i:n=""!==t.i.toString(),n?Qt(e,me(t.i)):n=!!t.m,n&&(e.m=t.m),e};var re=/[#\/\?@]/g,oe=/[#\?:]/g,ae=/[#\?]/g,he=/[#\?@]/g,ce=/#/g;function le(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ue(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(let n=0;n<t.length;n++){const i=t[n].indexOf("=");let s,r=null;i>=0?(s=t[n].substring(0,i),r=t[n].substring(i+1)):s=t[n],e(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function de(t,e){ue(t),e=_e(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function pe(t,e){return ue(t),e=_e(t,e),t.g.has(e)}function fe(t,e){ue(t);let n=[];if("string"==typeof e)pe(t,e)&&(n=n.concat(t.g.get(_e(t,e))));else for(t=Array.from(t.g.values()),e=0;e<t.length;e++)n=n.concat(t[e]);return n}function ge(t,e,n){de(t,e),n.length>0&&(t.i=null,t.g.set(_e(t,e),d(n)),t.h+=n.length)}function me(t){const e=new le;return e.i=t.i,t.g&&(e.g=new Map(t.g),e.h=t.h),e}function _e(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function ye(t,e,n,i,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),i(n)}catch(t){}}function ve(){this.g=new rt}function we(t){this.i=t.Sb||null,this.h=t.ab||!1}function be(t,e){J.call(this),this.H=t,this.o=e,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function Te(t){t.j.read().then(t.Ma.bind(t)).catch(t.ga.bind(t))}function Ie(t){t.readyState=4,t.l=null,t.j=null,t.B=null,Ee(t)}function Ee(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Se(t){let e="";return N(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}function ke(t,e,n){t:{for(i in n){var i=!1;break t}i=!0}i||(n=Se(n),"string"==typeof t?null!=n&&Et(n):te(t,e,n))}function Ce(t){J.call(this),this.headers=new Map,this.L=t||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(t=le.prototype).add=function(t,e){ue(this),this.i=null,t=_e(this,t);let n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},t.forEach=function(t,e){ue(this),this.g.forEach(function(n,i){n.forEach(function(n){t.call(e,n,i,this)},this)},this)},t.set=function(t,e){return ue(this),this.i=null,pe(this,t=_e(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},t.get=function(t,e){return t&&(t=fe(this,t)).length>0?String(t[0]):e},t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(let i=0;i<e.length;i++){var n=e[i];const s=Et(n);n=fe(this,n);for(let e=0;e<n.length;e++){let i=s;""!==n[e]&&(i+="="+Et(n[e])),t.push(i)}}return this.i=t.join("&")},l(we,ot),we.prototype.g=function(){return new be(this.i,this.h)},l(be,J),(t=be.prototype).open=function(t,e){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=t,this.D=e,this.readyState=1,Ee(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const e={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};t&&(e.body=t),(this.H||r).fetch(new Request(this.D,e)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,Ie(this)),this.readyState=0},t.Pa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ee(this)),this.g&&(this.readyState=3,Ee(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==r.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Te(this)}else t.text().then(this.Oa.bind(this),this.ga.bind(this))},t.Ma=function(t){if(this.g){if(this.o&&t.value)this.response.push(t.value);else if(!this.o){var e=t.value?t.value:new Uint8Array(0);(e=this.B.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Ie(this):Ee(this),3==this.readyState&&Te(this)}},t.Oa=function(t){this.g&&(this.response=this.responseText=t,Ie(this))},t.Na=function(t){this.g&&(this.response=t,Ie(this))},t.ga=function(){this.g&&Ie(this)},t.setRequestHeader=function(t,e){this.A.append(t,e)},t.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(be.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}}),l(Ce,J);var Ae=/^https?$/i,Re=["POST","PUT"];function Oe(t,e){t.h=!1,t.g&&(t.j=!0,t.g.abort(),t.j=!1),t.l=e,t.o=5,Pe(t),De(t)}function Pe(t){t.A||(t.A=!0,X(t,"complete"),X(t,"error"))}function Ne(t){if(t.h&&void 0!==s)if(t.v&&4==Le(t))setTimeout(t.Ca.bind(t),0);else if(X(t,"readystatechange"),4==Le(t)){t.h=!1;try{const s=t.ca();t:switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}var n;if(!(n=e)){var i;if(i=0===s){let e=String(t.D).match(Gt)[1]||null;!e&&r.self&&r.self.location&&(e=r.self.location.protocol.slice(0,-1)),i=!Ae.test(e?e.toLowerCase():"")}n=i}if(n)X(t,"complete"),X(t,"success");else{t.o=6;try{var o=Le(t)>2?t.g.statusText:""}catch(t){o=""}t.l=o+" ["+t.ca()+"]",Pe(t)}}finally{De(t)}}}function De(t,e){if(t.g){t.m&&(clearTimeout(t.m),t.m=null);const n=t.g;t.g=null,e||X(t,"ready");try{n.onreadystatechange=null}catch(t){}}}function Le(t){return t.g?t.g.readyState:0}function Ue(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.F){case"":case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Me(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function xe(t){this.za=0,this.i=[],this.j=new vt,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Me("failFast",!1,t),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Me("baseRetryDelayMs",5e3,t),this.Za=Me("retryDelaySeedMs",1e4,t),this.Ta=Me("forwardChannelMaxRetries",2,t),this.va=Me("forwardChannelRequestTimeoutMs",2e4,t),this.ma=t&&t.xmlHttpFactory||void 0,this.Ua=t&&t.Rb||void 0,this.Aa=t&&t.useFetchStreams||!1,this.O=void 0,this.L=t&&t.supportsCrossDomainXhr||!1,this.M="",this.h=new Bt(t&&t.concurrentRequestLimit),this.Ba=new ve,this.S=t&&t.fastHandshake||!1,this.R=t&&t.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=t&&t.Pb||!1,t&&t.ua&&this.j.ua(),t&&t.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&t&&t.detectBufferingProxy||!1,this.ia=void 0,t&&t.longPollingTimeout&&t.longPollingTimeout>0&&(this.ia=t.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function je(t){if(Ve(t),3==t.I){var e=t.V++,n=Xt(t.J);if(te(n,"SID",t.M),te(n,"RID",e),te(n,"TYPE","terminate"),ze(t,n),(e=new kt(t,t.j,e)).M=2,e.A=ee(Xt(n)),n=!1,r.navigator&&r.navigator.sendBeacon)try{n=r.navigator.sendBeacon(e.A.toString(),"")}catch(t){}!n&&r.Image&&((new Image).src=e.A,n=!0),n||(e.g=en(e.j,null),e.g.ea(e.A)),e.F=Date.now(),Lt(e)}Qe(t)}function Fe(t){t.g&&(Ke(t),t.g.cancel(),t.g=null)}function Ve(t){Fe(t),t.v&&(r.clearTimeout(t.v),t.v=null),Je(t),t.h.cancel(),t.m&&("number"==typeof t.m&&r.clearTimeout(t.m),t.m=null)}function Be(t){if(!Ht(t.h)&&!t.m){t.m=!0;var e=t.Ea;y||b(),v||(y(),v=!0),w.add(e,t),t.D=0}}function He(t,e){var n;n=e?e.l:t.V++;const i=Xt(t.J);te(i,"SID",t.M),te(i,"RID",n),te(i,"AID",t.K),ze(t,i),t.u&&t.o&&ke(i,t.u,t.o),n=new kt(t,t.j,n,t.D+1),null===t.u&&(n.J=t.o),e&&(t.i=e.G.concat(t.i)),e=$e(t,n,1e3),n.H=Math.round(.5*t.va)+Math.round(.5*t.va*Math.random()),Wt(t.h,n),Ot(n,i,e)}function ze(t,e){t.H&&N(t.H,function(t,n){te(e,n,t)}),t.l&&N({},function(t,n){te(e,n,t)})}function $e(t,e,n){n=Math.min(t.i.length,n);const i=t.l?h(t.l.Ka,t.l,t):null;t:{var s=t.i;let e=-1;for(;;){const t=["count="+n];-1==e?n>0?(e=s[0].g,t.push("ofs="+e)):e=0:t.push("ofs="+e);let h=!0;for(let c=0;c<n;c++){var r=s[c].g;const n=s[c].map;if((r-=e)<0)e=Math.max(0,s[c].g-100),h=!1;else try{r="req"+r+"_"||"";try{var a=n instanceof Map?n:Object.entries(n);for(const[e,n]of a){let i=n;o(n)&&(i=it(n)),t.push(r+e+"="+encodeURIComponent(i))}}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}catch(t){i&&i(n)}}if(h){a=t.join("&");break t}}a=void 0}return t=t.i.splice(0,n),e.G=t,a}function We(t){if(!t.g&&!t.v){t.Y=1;var e=t.Da;y||b(),v||(y(),v=!0),w.add(e,t),t.A=0}}function qe(t){return!(t.g||t.v||t.A>=3)&&(t.Y++,t.v=yt(h(t.Da,t),Ye(t,t.A)),t.A++,!0)}function Ke(t){null!=t.B&&(r.clearTimeout(t.B),t.B=null)}function Ge(t){t.g=new kt(t,t.j,"rpc",t.Y),null===t.u&&(t.g.J=t.o),t.g.P=0;var e=Xt(t.na);te(e,"RID","rpc"),te(e,"SID",t.M),te(e,"AID",t.K),te(e,"CI",t.F?"0":"1"),!t.F&&t.ia&&te(e,"TO",t.ia),te(e,"TYPE","xmlhttp"),ze(t,e),t.u&&t.o&&ke(e,t.u,t.o),t.O&&(t.g.H=t.O);var n=t.g;t=t.ba,n.M=1,n.A=ee(Xt(e)),n.u=null,n.R=!0,Pt(n,t)}function Je(t){null!=t.C&&(r.clearTimeout(t.C),t.C=null)}function Xe(t,e){var n=null;if(t.g==e){Je(t),Ke(t),t.g=null;var i=2}else{if(!$t(t.h,e))return;n=e.G,qt(t.h,e),i=1}if(0!=t.I)if(e.o)if(1==i){n=e.u?e.u.length:0,e=Date.now()-e.F;var s=t.D;X(i=dt(),new _t(i,n)),Be(t)}else We(t);else if(3==(s=e.m)||0==s&&e.X>0||!(1==i&&function(t,e){return!(zt(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.G.concat(t.i),0):1==t.I||2==t.I||t.D>=(t.Sa?0:t.Ta)||(t.m=yt(h(t.Ea,t,e),Ye(t,t.D)),t.D++,0)))}(t,e)||2==i&&qe(t)))switch(n&&n.length>0&&(e=t.h,e.i=e.i.concat(n)),s){case 1:Ze(t,5);break;case 4:Ze(t,10);break;case 3:Ze(t,6);break;default:Ze(t,2)}}function Ye(t,e){let n=t.Qa+Math.floor(Math.random()*t.Za);return t.isActive()||(n*=2),n*e}function Ze(t,e){if(t.j.info("Error code "+e),2==e){var n=h(t.bb,t),i=t.Ua;const e=!i;i=new Jt(i||"//www.google.com/images/cleardot.gif"),r.location&&"http"==r.location.protocol||Yt(i,"https"),ee(i),e?function(t,e){const n=new vt;if(r.Image){const i=new Image;i.onload=c(ye,n,"TestLoadImage: loaded",!0,e,i),i.onerror=c(ye,n,"TestLoadImage: error",!1,e,i),i.onabort=c(ye,n,"TestLoadImage: abort",!1,e,i),i.ontimeout=c(ye,n,"TestLoadImage: timeout",!1,e,i),r.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=t}else e(!1)}(i.toString(),n):function(t,e){new vt;const n=new AbortController,i=setTimeout(()=>{n.abort(),ye(0,0,!1,e)},1e4);fetch(t,{signal:n.signal}).then(t=>{clearTimeout(i),t.ok?ye(0,0,!0,e):ye(0,0,!1,e)}).catch(()=>{clearTimeout(i),ye(0,0,!1,e)})}(i.toString(),n)}else mt(2);t.I=0,t.l&&t.l.pa(e),Qe(t),Ve(t)}function Qe(t){if(t.I=0,t.ja=[],t.l){const e=Kt(t.h);0==e.length&&0==t.i.length||(p(t.ja,e),p(t.ja,t.i),t.h.i.length=0,d(t.i),t.i.length=0),t.l.oa()}}function tn(t,e,n){var i=n instanceof Jt?Xt(n):new Jt(n);if(""!=i.g)e&&(i.g=e+"."+i.g),Zt(i,i.u);else{var s=r.location;i=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;const t=new Jt(null);i&&Yt(t,i),e&&(t.g=e),s&&Zt(t,s),n&&(t.h=n),i=t}return n=t.G,e=t.wa,n&&e&&te(i,n,e),te(i,"VER",t.ka),ze(t,i),i}function en(t,e,n){if(e&&!t.L)throw Error("Can't create secondary domain capable XhrIo object.");return(e=t.Aa&&!t.ma?new Ce(new we({ab:n})):new Ce(t.ma)).Fa(t.L),e}function nn(){}function sn(t,e){J.call(this),this.g=new xe(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.o=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.sa&&(t?t["X-WebChannel-Client-Profile"]=e.sa:t={"X-WebChannel-Client-Profile":e.sa}),this.g.U=t,(t=e&&e.Qb)&&!k(t)&&(this.g.u=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!k(e)&&(this.g.G=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new an(this)}function rn(t){ht.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){t:{for(const n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function on(){ct.call(this),this.status=1}function an(t){this.g=t}(t=Ce.prototype).Fa=function(t){this.H=t},t.ea=function(t,e,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():bt.g(),this.g.onreadystatechange=u(h(this.Ca,this));try{this.B=!0,this.g.open(e,String(t),!0),this.B=!1}catch(t){return void Oe(this,t)}if(t=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const t of i.keys())n.set(t,i.get(t))}i=Array.from(n.keys()).find(t=>"content-type"==t.toLowerCase()),s=r.FormData&&t instanceof r.FormData,!(Array.prototype.indexOf.call(Re,e,void 0)>=0)||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[t,e]of n)this.g.setRequestHeader(t,e);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(t),this.v=!1}catch(t){Oe(this,t)}},t.abort=function(t){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=t||7,X(this,"complete"),X(this,"abort"),De(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),De(this,!0)),Ce.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?Ne(this):this.Xa())},t.Xa=function(){Ne(this)},t.isActive=function(){return!!this.g},t.ca=function(){try{return Le(this)>2?this.g.status:-1}catch(t){return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},t.La=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),st(e)}},t.ya=function(){return this.o},t.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(t=xe.prototype).ka=8,t.I=1,t.connect=function(t,e,n,i){mt(0),this.W=t,this.H=e||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.J=tn(this,null,this.W),Be(this)},t.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;const s=new kt(this,this.j,t);let r=this.o;if(this.U&&(r?(r=D(r),U(r,this.U)):r=this.U),null!==this.u||this.R||(s.J=r,r=null),this.S)t:{for(var e=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"==typeof(i=i.map.__data__)?i.length:void 0))break;if((e+=i)>4096){e=n;break t}if(4096===e||n===this.i.length-1){e=n+1;break t}}e=1e3}else e=1e3;e=$e(this,s,e),te(n=Xt(this.J),"RID",t),te(n,"CVER",22),this.G&&te(n,"X-HTTP-Session-Id",this.G),ze(this,n),r&&(this.R?e="headers="+Et(Se(r))+"&"+e:this.u&&ke(n,this.u,r)),Wt(this.h,s),this.Ra&&te(n,"TYPE","init"),this.S?(te(n,"$req",e),te(n,"SID","null"),s.U=!0,Ot(s,n,null)):Ot(s,n,e),this.I=2}}else 3==this.I&&(t?He(this,t):0==this.i.length||Ht(this.h)||He(this))},t.Da=function(){if(this.v=null,Ge(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var t=4*this.T;this.j.info("BP detection timer enabled: "+t),this.B=yt(h(this.Wa,this),t)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,mt(10),Fe(this),Ge(this))},t.Va=function(){null!=this.C&&(this.C=null,Fe(this),qe(this),mt(19))},t.bb=function(t){t?(this.j.info("Successfully pinged google.com"),mt(2)):(this.j.info("Failed to ping google.com"),mt(1))},t.isActive=function(){return!!this.l&&this.l.isActive(this)},(t=nn.prototype).ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){},l(sn,J),sn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},sn.prototype.close=function(){je(this.g)},sn.prototype.o=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=it(t),t=n);e.i.push(new Vt(e.Ya++,t)),3==e.I&&Be(e)},sn.prototype.N=function(){this.g.l=null,delete this.j,je(this.g),delete this.g,sn.Z.N.call(this)},l(rn,ht),l(on,ct),l(an,nn),an.prototype.ra=function(){X(this.g,"a")},an.prototype.qa=function(t){X(this.g,new rn(t))},an.prototype.pa=function(t){X(this.g,new on)},an.prototype.oa=function(){X(this.g,"b")},sn.prototype.send=sn.prototype.o,sn.prototype.open=sn.prototype.m,sn.prototype.close=sn.prototype.close,Tt.NO_ERROR=0,Tt.TIMEOUT=8,Tt.HTTP_ERROR=6,at.OPEN="a",at.CLOSE="b",at.ERROR="c",at.MESSAGE="d",J.prototype.listen=J.prototype.J,Ce.prototype.listenOnce=Ce.prototype.K,Ce.prototype.getLastError=Ce.prototype.Ha,Ce.prototype.getLastErrorCode=Ce.prototype.ya,Ce.prototype.getStatus=Ce.prototype.ca,Ce.prototype.getResponseJson=Ce.prototype.La,Ce.prototype.getResponseText=Ce.prototype.la,Ce.prototype.send=Ce.prototype.ea,Ce.prototype.setWithCredentials=Ce.prototype.Fa}).apply(void 0!==Ss?Ss:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const ks="@firebase/firestore",Cs="4.9.2";class As{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}As.UNAUTHENTICATED=new As(null),As.GOOGLE_CREDENTIALS=new As("google-credentials-uid"),As.FIRST_PARTY=new As("first-party-uid"),As.MOCK_USER=new As("mock-user");let Rs="12.3.0";const Os=new $("@firebase/firestore");function Ps(t,...e){if(Os.logLevel<=F.DEBUG){const n=e.map(Ds);Os.debug(`Firestore (${Rs}): ${t}`,...n)}}function Ns(t,...e){if(Os.logLevel<=F.ERROR){const n=e.map(Ds);Os.error(`Firestore (${Rs}): ${t}`,...n)}}function Ds(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function Ls(t,e,n){let i="Unexpected state";"string"==typeof e?i=e:n=e,Us(t,i,n)}function Us(t,e,n){let i=`FIRESTORE (${Rs}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(void 0!==n)try{i+=" CONTEXT: "+JSON.stringify(n)}catch(t){i+=" CONTEXT: "+n}throw Ns(i),new Error(i)}function Ms(t,e,n,i){let s="Unexpected state";"string"==typeof n?s=n:i=n,t||Us(e,s,i)}const xs="cancelled",js="invalid-argument",Fs="failed-precondition";class Vs extends I{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class Bs{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}class Hs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e(As.UNAUTHENTICATED))}shutdown(){}}class $s{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}}class Ws{constructor(t){this.t=t,this.currentUser=As.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){Ms(void 0===this.o,42304);let n=this.i;const i=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new Bs;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Bs,t.enqueueRetryable(()=>i(this.currentUser))};const r=()=>{const e=s;t.enqueueRetryable(async()=>{await e.promise,await i(this.currentUser)})},o=t=>{Ps("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.o&&(this.auth.addAuthTokenListener(this.o),r())};this.t.onInit(t=>o(t)),setTimeout(()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Ps("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Bs)}},0),r()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.i!==t?(Ps("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ms("string"==typeof e.accessToken,31837,{l:e}),new Hs(e.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const t=this.auth&&this.auth.getUid();return Ms(null===t||"string"==typeof t,2055,{h:t}),new As(t)}}class qs{constructor(t,e,n){this.P=t,this.T=e,this.I=n,this.type="FirstParty",this.user=As.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const t=this.R();return t&&this.A.set("Authorization",t),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ks{constructor(t,e,n){this.P=t,this.T=e,this.I=n}getToken(){return Promise.resolve(new qs(this.P,this.T,this.I))}start(t,e){t.enqueueRetryable(()=>e(As.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Gs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Js{constructor(t,e){this.V=e,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Kt(t)&&t.settings.appCheckToken&&(this.p=t.settings.appCheckToken)}start(t,e){Ms(void 0===this.o,3512);const n=t=>{null!=t.error&&Ps("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.m;return this.m=t.token,Ps("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable(()=>n(e))};const i=t=>{Ps("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(t=>i(t)),setTimeout(()=>{if(!this.appCheck){const t=this.V.getImmediate({optional:!0});t?i(t):Ps("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Gs(this.p));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(t=>t?(Ms("string"==typeof t.token,44558,{tokenResult:t}),this.m=t.token,new Gs(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function Xs(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}class Ys{static newId(){const t=62*Math.floor(256/62);let e="";for(;e.length<20;){const n=Xs(40);for(let i=0;i<n.length;++i)e.length<20&&n[i]<t&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[i]%62))}return e}}function Zs(t,e){return t<e?-1:t>e?1:0}const Qs=55296,tr=57343;function er(t){const e=t.charCodeAt(0);return e>=Qs&&e<=tr}const nr="__name__";class ir{constructor(t,e,n){void 0===e?e=0:e>t.length&&Ls(637,{offset:e,range:t.length}),void 0===n?n=t.length-e:n>t.length-e&&Ls(1746,{length:n,range:t.length-e}),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ir.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ir?t.forEach(t=>{e.push(t)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++){const n=ir.compareSegments(t.get(i),e.get(i));if(0!==n)return n}return Zs(t.length,e.length)}static compareSegments(t,e){const n=ir.isNumericId(t),i=ir.isNumericId(e);return n&&!i?-1:!n&&i?1:n&&i?ir.extractNumericId(t).compare(ir.extractNumericId(e)):function(t,e){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++){const n=t.charAt(i),s=e.charAt(i);if(n!==s)return er(n)===er(s)?Zs(n,s):er(n)?1:-1}return Zs(t.length,e.length)}(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return Is.fromString(t.substring(4,t.length-2))}}class sr extends ir{construct(t,e,n){return new sr(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Vs(js,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter(t=>t.length>0))}return new sr(e)}static emptyPath(){return new sr([])}}const rr=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class or extends ir{construct(t,e,n){return new or(t,e,n)}static isValidIdentifier(t){return rr.test(t)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),or.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===nr}static keyField(){return new or([nr])}static fromServerFormat(t){const e=[];let n="",i=0;const s=()=>{if(0===n.length)throw new Vs(js,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let r=!1;for(;i<t.length;){const e=t[i];if("\\"===e){if(i+1===t.length)throw new Vs(js,"Path has trailing escape character: "+t);const e=t[i+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Vs(js,"Path has invalid escape sequence: "+t);n+=e,i+=2}else"`"===e?(r=!r,i++):"."!==e||r?(n+=e,i++):(s(),i++)}if(s(),r)throw new Vs(js,"Unterminated ` in path: "+t);return new or(e)}static emptyPath(){return new or([])}}class ar{constructor(t){this.path=t}static fromPath(t){return new ar(sr.fromString(t))}static fromName(t){return new ar(sr.fromString(t).popFirst(5))}static empty(){return new ar(sr.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===sr.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return sr.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new ar(new sr(t.slice()))}}function hr(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Vs(js,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=function(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Ls(12329,{type:typeof t})}(t);throw new Vs(js,`Expected type '${e.name}', but it was: ${n}`)}}return t}function cr(t,e){const n={typeString:t};return e&&(n.value=e),n}function lr(t,e){if(!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(t))throw new Vs(js,"JSON must be an object");let n;for(const i in e)if(e[i]){const s=e[i].typeString,r="value"in e[i]?{value:e[i].value}:void 0;if(!(i in t)){n=`JSON missing required field: '${i}'`;break}const o=t[i];if(s&&typeof o!==s){n=`JSON field '${i}' must be a ${s}.`;break}if(void 0!==r&&o!==r.value){n=`Expected '${i}' field to equal '${r.value}'`;break}}if(n)throw new Vs(js,n);return!0}const ur=-62135596800,dr=1e6;class pr{static now(){return pr.fromMillis(Date.now())}static fromDate(t){return pr.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor((t-1e3*e)*dr);return new pr(e,n)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Vs(js,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Vs(js,"Timestamp nanoseconds out of range: "+e);if(t<ur)throw new Vs(js,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Vs(js,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/dr}_compareTo(t){return this.seconds===t.seconds?Zs(this.nanoseconds,t.nanoseconds):Zs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:pr._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(lr(t,pr._jsonSchema))return new pr(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-ur;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}pr._jsonSchemaVersion="firestore/timestamp/1.0",pr._jsonSchema={type:cr("string",pr._jsonSchemaVersion),seconds:cr("number"),nanoseconds:cr("number")};class fr extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class gr{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new fr("Invalid base64 string: "+t):t}}(t);return new gr(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new gr(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Zs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}gr.EMPTY_BYTE_STRING=new gr("");const mr="(default)";class _r{constructor(t,e){this.projectId=t,this.database=e||mr}static empty(){return new _r("","")}get isDefaultDatabase(){return this.database===mr}isEqual(t){return t instanceof _r&&t.projectId===this.projectId&&t.database===this.database}}class yr{constructor(t,e=null,n=[],i=[],s=null,r="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=i,this.limit=s,this.limitType=r,this.startAt=o,this.endAt=a,this.Ie=null,this.Ee=null,this.de=null,this.startAt,this.endAt}}var vr,wr;(wr=vr||(vr={}))[wr.OK=0]="OK",wr[wr.CANCELLED=1]="CANCELLED",wr[wr.UNKNOWN=2]="UNKNOWN",wr[wr.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",wr[wr.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",wr[wr.NOT_FOUND=5]="NOT_FOUND",wr[wr.ALREADY_EXISTS=6]="ALREADY_EXISTS",wr[wr.PERMISSION_DENIED=7]="PERMISSION_DENIED",wr[wr.UNAUTHENTICATED=16]="UNAUTHENTICATED",wr[wr.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",wr[wr.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",wr[wr.ABORTED=10]="ABORTED",wr[wr.OUT_OF_RANGE=11]="OUT_OF_RANGE",wr[wr.UNIMPLEMENTED=12]="UNIMPLEMENTED",wr[wr.INTERNAL=13]="INTERNAL",wr[wr.UNAVAILABLE=14]="UNAVAILABLE",wr[wr.DATA_LOSS=15]="DATA_LOSS",new Is([4294967295,4294967295],0);function br(){return"undefined"!=typeof document?document:null}class Tr{constructor(t,e,n=1e3,i=1.5,s=6e4){this.Mi=t,this.timerId=e,this.d_=n,this.A_=i,this.R_=s,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(t){this.cancel();const e=Math.floor(this.V_+this.y_()),n=Math.max(0,Date.now()-this.f_),i=Math.max(0,e-n);i>0&&Ps("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.V_} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),t())),this.V_*=this.A_,this.V_<this.d_&&(this.V_=this.d_),this.V_>this.R_&&(this.V_=this.R_)}w_(){null!==this.m_&&(this.m_.skipDelay(),this.m_=null)}cancel(){null!==this.m_&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}class Ir{constructor(t,e,n,i,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=i,this.removalCallback=s,this.deferred=new Bs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(t=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,e,n,i,s){const r=Date.now()+n,o=new Ir(t,e,r,i,s);return o.start(n),o}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Vs(xs,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}var Er,Sr;(Sr=Er||(Er={})).Ma="default",Sr.Cache="cache";const kr=new Map,Cr="firestore.googleapis.com",Ar=!0;class Rr{constructor(t){if(void 0===t.host){if(void 0!==t.ssl)throw new Vs(js,"Can't provide ssl option if host option is not set");this.host=Cr,this.ssl=Ar}else this.host=t.host,this.ssl=t.ssl??Ar;if(this.isUsingEmulator=void 0!==t.emulatorOptions,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Vs(js,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}(function(t,e,n,i){if(!0===e&&!0===i)throw new Vs(js,`${t} and ${n} cannot be used together.`)})("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=function(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}(t.experimentalLongPollingOptions??{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new Vs(js,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new Vs(js,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new Vs(js,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class Or{constructor(t,e,n,i){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Rr({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Vs(Fs,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Vs(Fs,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Rr(t),this._emulatorOptions=t.emulatorOptions||{},void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zs;switch(t.type){case"firstParty":return new Ks(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Vs(js,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=kr.get(t);e&&(Ps("ComponentProvider","Removing Datastore"),kr.delete(t),e.terminate())}(this),Promise.resolve()}}function Pr(t,e,n,i={}){t=hr(t,Or);const s=d(e),r=t._getSettings(),o={...r,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;s&&(p(`https://${a}`),_("Firestore",!0)),r.host!==Cr&&r.host!==a&&function(t,...e){if(Os.logLevel<=F.WARN){const n=e.map(Ds);Os.warn(`Firestore (${Rs}): ${t}`,...n)}}("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const h={...r,host:a,ssl:s,emulatorOptions:i};if(!k(h,o)&&(t._setSettings(h),i.mockUserToken)){let e,n;if("string"==typeof i.mockUserToken)e=i.mockUserToken,n=As.MOCK_USER;else{e=f(i.mockUserToken,t._app?.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new Vs(js,"mockUserToken must contain 'sub' or 'user_id' field!");n=new As(s)}t._authCredentials=new $s(new Hs(e,n))}}class Nr{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Nr(this.firestore,t,this._query)}}class Dr{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Lr(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Dr(this.firestore,t,this._key)}toJSON(){return{type:Dr._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,n){if(lr(e,Dr._jsonSchema))return new Dr(t,n||null,new ar(sr.fromString(e.referencePath)))}}Dr._jsonSchemaVersion="firestore/documentReference/1.0",Dr._jsonSchema={type:cr("string",Dr._jsonSchemaVersion),referencePath:cr("string")};class Lr extends Nr{constructor(t,e,n){super(t,e,function(t){return new yr(t)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Dr(this.firestore,null,new ar(t))}withConverter(t){return new Lr(this.firestore,t,this._path)}}const Ur="AsyncQueue";class Mr{constructor(t=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new Tr(this,"async_queue_retry"),this._c=()=>{const t=br();t&&Ps(Ur,"Visibility state changed to "+t.visibilityState),this.M_.w_()},this.ac=t;const e=br();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.uc(),this.cc(t)}enterRestrictedMode(t){if(!this.ec){this.ec=!0,this.sc=t||!1;const e=br();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this._c)}}enqueue(t){if(this.uc(),this.ec)return new Promise(()=>{});const e=new Bs;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise)).then(()=>e.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.Xu.push(t),this.lc()))}async lc(){if(0!==this.Xu.length){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(t){if(!function(t){return"IndexedDbTransactionError"===t.name}(t))throw t;Ps(Ur,"Operation failed with retryable error: "+t)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(t){const e=this.ac.then(()=>(this.rc=!0,t().catch(t=>{throw this.nc=t,this.rc=!1,Ns("INTERNAL UNHANDLED ERROR: ",xr(t)),t}).then(t=>(this.rc=!1,t))));return this.ac=e,e}enqueueAfterDelay(t,e,n){this.uc(),this.oc.indexOf(t)>-1&&(e=0);const i=Ir.createAndSchedule(this,t,e,n,t=>this.hc(t));return this.tc.push(i),i}uc(){this.nc&&Ls(47125,{Pc:xr(this.nc)})}verifyOperationInProgress(){}async Tc(){let t;do{t=this.ac,await t}while(t!==this.ac)}Ic(t){for(const e of this.tc)if(e.timerId===t)return!0;return!1}Ec(t){return this.Tc().then(()=>{this.tc.sort((t,e)=>t.targetTimeMs-e.targetTimeMs);for(const e of this.tc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Tc()})}dc(t){this.oc.push(t)}hc(t){const e=this.tc.indexOf(t);this.tc.splice(e,1)}}function xr(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}class jr extends Or{constructor(t,e,n,i){super(t,e,n,i),this.type="firestore",this._queue=new Mr,this._persistenceKey=i?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new Mr(t),this._firestoreClient=void 0,await t}}}class Fr{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Fr(gr.fromBase64String(t))}catch(t){throw new Vs(js,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Fr(gr.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}toJSON(){return{type:Fr._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(lr(t,Fr._jsonSchema))return Fr.fromBase64String(t.bytes)}}Fr._jsonSchemaVersion="firestore/bytes/1.0",Fr._jsonSchema={type:cr("string",Fr._jsonSchemaVersion),bytes:cr("string")};class Vr{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Vs(js,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new or(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}class Br{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Vs(js,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Vs(js,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return Zs(this._lat,t._lat)||Zs(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Br._jsonSchemaVersion}}static fromJSON(t){if(lr(t,Br._jsonSchema))return new Br(t.latitude,t.longitude)}}Br._jsonSchemaVersion="firestore/geoPoint/1.0",Br._jsonSchema={type:cr("string",Br._jsonSchemaVersion),latitude:cr("number"),longitude:cr("number")};class Hr{constructor(t){this._values=(t||[]).map(t=>t)}toArray(){return this._values.map(t=>t)}isEqual(t){return function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(this._values,t._values)}toJSON(){return{type:Hr._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(lr(t,Hr._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every(t=>"number"==typeof t))return new Hr(t.vectorValues);throw new Vs(js,"Expected 'vectorValues' field to be a number array")}}}Hr._jsonSchemaVersion="firestore/vectorValue/1.0",Hr._jsonSchema={type:cr("string",Hr._jsonSchemaVersion),vectorValues:cr("object")};const zr=new RegExp("[~\\*/\\[\\]]");function $r(t,e,n,i,s){let r=`Function ${e}() called with invalid data`;r+=". ";return new Vs(js,r+t+"")}class Wr{constructor(t,e,n,i,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Dr(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new qr(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(Kr("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class qr extends Wr{data(){return super.data()}}function Kr(t,e){return"string"==typeof e?function(t,e){if(e.search(zr)>=0)throw $r(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t);try{return new Vr(...e.split("."))._internalPath}catch(n){throw $r(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t)}}(t,e):e instanceof Vr?e._internalPath:e._delegate._internalPath}class Gr{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Jr extends Wr{constructor(t,e,n,i,s,r){super(t,e,n,i,r),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Xr(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Kr("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Vs(Fs,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,e={};return e.type=Jr._jsonSchemaVersion,e.bundle="",e.bundleSource="DocumentSnapshot",e.bundleName=this._key.toString(),t&&t.isValidDocument()&&t.isFoundDocument()?(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),e.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),e):e}}Jr._jsonSchemaVersion="firestore/documentSnapshot/1.0",Jr._jsonSchema={type:cr("string",Jr._jsonSchemaVersion),bundleSource:cr("string","DocumentSnapshot"),bundleName:cr("string"),bundle:cr("string")};class Xr extends Jr{data(t={}){return super.data(t)}}class Yr{constructor(t,e,n,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new Gr(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const t=[];return this.forEach(e=>t.push(e)),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach(n=>{t.call(e,new Xr(this._firestore,this._userDataWriter,n.key,n,new Gr(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Vs(js,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map(n=>{const i=new Xr(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Gr(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:e++}})}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter(t=>e||3!==t.type).map(e=>{const i=new Xr(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Gr(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,r=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),r=n.indexOf(e.doc.key)),{type:Zr(e.type),doc:i,oldIndex:s,newIndex:r}})}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Vs(Fs,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=Yr._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=Ys.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const e=[],n=[],i=[];return this.docs.forEach(t=>{null!==t._document&&(e.push(t._document),n.push(this._userDataWriter.convertObjectMap(t._document.data.value.mapValue.fields,"previous")),i.push(t.ref.path))}),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}}function Zr(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ls(61501,{type:t})}}Yr._jsonSchemaVersion="firestore/querySnapshot/1.0",Yr._jsonSchema={type:cr("string",Yr._jsonSchemaVersion),bundleSource:cr("string","QuerySnapshot"),bundleName:cr("string"),bundle:cr("string")},function(t,e=!0){!function(t){Rs=t}(Xt),Wt(new U("firestore",(t,{instanceIdentifier:n,options:i})=>{const s=t.getProvider("app").getImmediate(),r=new jr(new Ws(t.getProvider("auth-internal")),new Js(s,t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Vs(js,'"projectId" not provided in firebase.initializeApp.');return new _r(t.options.projectId,e)}(s,n),s);return i={useFetchStreams:e,...i},r._setSettings(i),r},"PUBLIC").setMultipleInstances(!0)),Qt(ks,Cs,t),Qt(ks,Cs,"esm2020")}();Qt("firebase","12.3.0","app");const Qr="firebasestorage.googleapis.com",to="storageBucket";class eo extends I{constructor(t,e,n=0){super(so(t),`Firebase Storage: ${e} (${so(t)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,eo.prototype)}get status(){return this.status_}set status(t){this.status_=t}_codeEquals(t){return so(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}var no,io;function so(t){return"storage/"+t}function ro(){return new eo(no.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function oo(){return new eo(no.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function ao(){return new eo(no.CANCELED,"User canceled the upload/download.")}function ho(){return new eo(no.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function co(t){return new eo(no.INVALID_ARGUMENT,t)}function lo(){return new eo(no.APP_DELETED,"The Firebase app was deleted.")}function uo(t,e){return new eo(no.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function po(t){throw new eo(no.INTERNAL_ERROR,"Internal error: "+t)}!function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(no||(no={}));class fo{constructor(t,e){this.bucket=t,this.path_=e}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let n;try{n=fo.makeFromUrl(t,e)}catch(e){return new fo(t,"")}if(""===n.path)return n;throw i=t,new eo(no.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+i+"'.");var i}static makeFromUrl(t,e){let n=null;const i="([A-Za-z0-9.\\-_]+)";const s=new RegExp("^gs://"+i+"(/(.*))?$","i");function r(t){t.path_=decodeURIComponent(t.path)}const o=e.replace(/[.]/g,"\\."),a=[{regex:s,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:r},{regex:new RegExp(`^https?://${e===Qr?"(?:storage.googleapis.com|storage.cloud.google.com)":e}/${i}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:r}];for(let e=0;e<a.length;e++){const i=a[e],s=i.regex.exec(t);if(s){const t=s[i.indices.bucket];let e=s[i.indices.path];e||(e=""),n=new fo(t,e),i.postModify(n);break}}if(null==n)throw function(t){return new eo(no.INVALID_URL,"Invalid URL '"+t+"'.")}(t);return n}}class go{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}}function mo(t){return"string"==typeof t||t instanceof String}function _o(t){return yo()&&t instanceof Blob}function yo(){return"undefined"!=typeof Blob}function vo(t,e,n,i){if(i<e)throw co(`Invalid value for '${t}'. Expected ${e} or greater.`);if(i>n)throw co(`Invalid value for '${t}'. Expected ${n} or less.`)}function wo(t,e,n){let i=e;return null==n&&(i=`https://${e}`),`${n}://${i}/v0${t}`}function bo(t){const e=encodeURIComponent;let n="?";for(const i in t)if(t.hasOwnProperty(i)){n=n+(e(i)+"="+e(t[i]))+"&"}return n=n.slice(0,-1),n}function To(t,e){const n=t>=500&&t<600,i=-1!==[408,429].indexOf(t),s=-1!==e.indexOf(t);return n||i||s}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(io||(io={}));class Io{constructor(t,e,n,i,s,r,o,a,h,c,l,u=!0,d=!1){this.url_=t,this.method_=e,this.headers_=n,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=r,this.callback_=o,this.errorCallback_=a,this.timeout_=h,this.progressCallback_=c,this.connectionFactory_=l,this.retry=u,this.isUsingEmulator=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((t,e)=>{this.resolve_=t,this.reject_=e,this.start_()})}start_(){const t=(t,e)=>{if(e)return void t(!1,new Eo(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const i=t=>{const e=t.loaded,n=t.lengthComputable?t.total:-1;null!==this.progressCallback_&&this.progressCallback_(e,n)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;const e=n.getErrorCode()===io.NO_ERROR,s=n.getStatus();if(!e||To(s,this.additionalRetryCodes_)&&this.retry){const e=n.getErrorCode()===io.ABORT;return void t(!1,new Eo(!1,null,e))}const r=-1!==this.successCodes_.indexOf(s);t(!0,new Eo(r,n))})},e=(t,e)=>{const n=this.resolve_,i=this.reject_,s=e.connection;if(e.wasSuccessCode)try{const t=this.callback_(s,s.getResponse());!function(t){return void 0!==t}(t)?n():n(t)}catch(t){i(t)}else if(null!==s){const t=ro();t.serverResponse=s.getErrorText(),this.errorCallback_?i(this.errorCallback_(s,t)):i(t)}else if(e.canceled){i(this.appDelete_?lo():ao())}else{i(oo())}};this.canceled_?e(0,new Eo(!1,null,!0)):this.backoffId_=function(t,e,n){let i=1,s=null,r=null,o=!1,a=0;function h(){return 2===a}let c=!1;function l(...t){c||(c=!0,e.apply(null,t))}function u(e){s=setTimeout(()=>{s=null,t(p,h())},e)}function d(){r&&clearTimeout(r)}function p(t,...e){if(c)return void d();if(t)return d(),void l.call(null,t,...e);if(h()||o)return d(),void l.call(null,t,...e);let n;i<64&&(i*=2),1===a?(a=2,n=0):n=1e3*(i+Math.random()),u(n)}let f=!1;function g(t){f||(f=!0,d(),c||(null!==s?(t||(a=2),clearTimeout(s),u(0)):t||(a=1)))}return u(0),r=setTimeout(()=>{o=!0,g(!0)},n),g}(t,e,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class Eo{constructor(t,e,n){this.wasSuccessCode=t,this.connection=e,this.canceled=!!n}}function So(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function ko(...t){const e=So();if(void 0!==e){const n=new e;for(let e=0;e<t.length;e++)n.append(t[e]);return n.getBlob()}if(yo())return new Blob(t);throw new eo(no.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}function Co(t){if("undefined"==typeof atob)throw e="base-64",new eo(no.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);var e;return atob(t)}const Ao="raw",Ro="base64",Oo="base64url",Po="data_url";class No{constructor(t,e){this.data=t,this.contentType=e||null}}function Do(t,e){switch(t){case Ao:return new No(Lo(e));case Ro:case Oo:return new No(Uo(t,e));case Po:return new No(function(t){const e=new Mo(t);return e.base64?Uo(Ro,e.rest):function(t){let e;try{e=decodeURIComponent(t)}catch(t){throw uo(Po,"Malformed data URL.")}return Lo(e)}(e.rest)}(e),new Mo(e).contentType)}throw ro()}function Lo(t){const e=[];for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);if(i<=127)e.push(i);else if(i<=2047)e.push(192|i>>6,128|63&i);else if(55296==(64512&i)){if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1))){i=65536|(1023&i)<<10|1023&t.charCodeAt(++n),e.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i)}else e.push(239,191,189)}else 56320==(64512&i)?e.push(239,191,189):e.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(e)}function Uo(t,e){switch(t){case Ro:{const n=-1!==e.indexOf("-"),i=-1!==e.indexOf("_");if(n||i){throw uo(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case Oo:{const n=-1!==e.indexOf("+"),i=-1!==e.indexOf("/");if(n||i){throw uo(t,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Co(e)}catch(e){if(e.message.includes("polyfill"))throw e;throw uo(t,"Invalid character found")}const i=new Uint8Array(n.length);for(let t=0;t<n.length;t++)i[t]=n.charCodeAt(t);return i}class Mo{constructor(t){this.base64=!1,this.contentType=null;const e=t.match(/^data:([^,]+)?,/);if(null===e)throw uo(Po,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=e[1]||null;null!=n&&(this.base64=function(t,e){if(!(t.length>=e.length))return!1;return t.substring(t.length-e.length)===e}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=t.substring(t.indexOf(",")+1)}}class xo{constructor(t,e){let n=0,i="";_o(t)?(this.data_=t,n=t.size,i=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=i}size(){return this.size_}type(){return this.type_}slice(t,e){if(_o(this.data_)){const n=function(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}(this.data_,t,e);return null===n?null:new xo(n)}{const n=new Uint8Array(this.data_.buffer,t,e-t);return new xo(n,!0)}}static getBlob(...t){if(yo()){const e=t.map(t=>t instanceof xo?t.data_:t);return new xo(ko.apply(null,e))}{const e=t.map(t=>mo(t)?Do(Ao,t).data:t.data_);let n=0;e.forEach(t=>{n+=t.byteLength});const i=new Uint8Array(n);let s=0;return e.forEach(t=>{for(let e=0;e<t.length;e++)i[s++]=t[e]}),new xo(i,!0)}}uploadData(){return this.data_}}function jo(t){let e;try{e=JSON.parse(t)}catch(t){return null}return function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?e:null}function Fo(t){const e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function Vo(t,e){return e}class Bo{constructor(t,e,n,i){this.server=t,this.local=e||t,this.writable=!!n,this.xform=i||Vo}}let Ho=null;function zo(){if(Ho)return Ho;const t=[];t.push(new Bo("bucket")),t.push(new Bo("generation")),t.push(new Bo("metageneration")),t.push(new Bo("name","fullPath",!0));const e=new Bo("name");e.xform=function(t,e){return function(t){return!mo(t)||t.length<2?t:Fo(t)}(e)},t.push(e);const n=new Bo("size");return n.xform=function(t,e){return void 0!==e?Number(e):e},t.push(n),t.push(new Bo("timeCreated")),t.push(new Bo("updated")),t.push(new Bo("md5Hash",null,!0)),t.push(new Bo("cacheControl",null,!0)),t.push(new Bo("contentDisposition",null,!0)),t.push(new Bo("contentEncoding",null,!0)),t.push(new Bo("contentLanguage",null,!0)),t.push(new Bo("contentType",null,!0)),t.push(new Bo("metadata","customMetadata",!0)),Ho=t,Ho}function $o(t,e,n){const i={type:"file"},s=n.length;for(let t=0;t<s;t++){const s=n[t];i[s.local]=s.xform(i,e[s.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){const n=t.bucket,i=t.fullPath,s=new fo(n,i);return e._makeStorageReference(s)}})}(i,t),i}function Wo(t,e,n){const i=jo(e);if(null===i)return null;return $o(t,i,n)}function qo(t,e){const n={},i=e.length;for(let s=0;s<i;s++){const i=e[s];i.writable&&(n[i.server]=t[i.local])}return JSON.stringify(n)}class Ko{constructor(t,e,n,i){this.url=t,this.method=e,this.handler=n,this.timeout=i,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function Go(t){if(!t)throw ro()}function Jo(t,e){return function(n,i){const s=Wo(t,i,e);return Go(null!==s),s}}function Xo(t,e){return function(n,i){const s=Wo(t,i,e);return Go(null!==s),function(t,e,n,i){const s=jo(e);if(null===s)return null;if(!mo(s.downloadTokens))return null;const r=s.downloadTokens;if(0===r.length)return null;const o=encodeURIComponent;return r.split(",").map(e=>{const s=t.bucket,r=t.fullPath;return wo("/b/"+o(s)+"/o/"+o(r),n,i)+bo({alt:"media",token:e})})[0]}(s,i,t.host,t._protocol)}}function Yo(t){return function(e,n){let i;var s,r;return 401===e.getStatus()?i=e.getErrorText().includes("Firebase App Check token is invalid")?new eo(no.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new eo(no.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(r=t.bucket,i=new eo(no.QUOTA_EXCEEDED,"Quota for bucket '"+r+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(s=t.path,i=new eo(no.UNAUTHORIZED,"User does not have permission to access '"+s+"'.")):i=n,i.status=e.getStatus(),i.serverResponse=n.serverResponse,i}}function Zo(t){const e=Yo(t);return function(n,i){let s=e(n,i);var r;return 404===n.getStatus()&&(r=t.path,s=new eo(no.OBJECT_NOT_FOUND,"Object '"+r+"' does not exist.")),s.serverResponse=i.serverResponse,s}}function Qo(t,e,n){const i=Object.assign({},n);return i.fullPath=t.path,i.size=e.size(),i.contentType||(i.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),i}class ta{constructor(t,e,n,i){this.current=t,this.total=e,this.finalized=!!n,this.metadata=i||null}}function ea(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){Go(!1)}return Go(!!n&&-1!==(e||["active"]).indexOf(n)),n}const na=262144;function ia(t,e,n,i,s,r,o,a){const h=new ta(0,0);if(o?(h.current=o.current,h.total=o.total):(h.current=0,h.total=i.size()),i.size()!==h.total)throw new eo(no.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=h.total-h.current;let l=c;s>0&&(l=Math.min(l,s));const u=h.current,d=u+l;let p="";p=0===l?"finalize":c===l?"upload, finalize":"upload";const f={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":`${h.current}`},g=i.slice(u,d);if(null===g)throw ho();const m=e.maxUploadRetryTime,_=new Ko(n,"POST",function(t,n){const s=ea(t,["active","final"]),o=h.current+l,a=i.size();let c;return c="final"===s?Jo(e,r)(t,n):null,new ta(o,a,"final"===s,c)},m);return _.headers=f,_.body=g.uploadData(),_.progressCallback=a||null,_.errorHandler=Yo(t),_}const sa="running",ra="paused",oa="success",aa="canceled",ha="error";function ca(t){switch(t){case"running":case"pausing":case"canceling":return sa;case"paused":return ra;case"success":return oa;case"canceled":return aa;default:return ha}}class la{constructor(t,e,n){const i=function(t){return"function"==typeof t}(t)||null!=e||null!=n;if(i)this.next=t,this.error=e??void 0,this.complete=n??void 0;else{const e=t;this.next=e.next,this.error=e.error,this.complete=e.complete}}}function ua(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class da{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=io.NO_ERROR,this.sendPromise_=new Promise(t=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=io.ABORT,t()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=io.NETWORK_ERROR,t()}),this.xhr_.addEventListener("load",()=>{t()})})}send(t,e,n,i,s){if(this.sent_)throw po("cannot .send() more than once");if(d(t)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==s)for(const t in s)s.hasOwnProperty(t)&&this.xhr_.setRequestHeader(t,s[t].toString());return void 0!==i?this.xhr_.send(i):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw po("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw po("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}}getResponse(){if(!this.sent_)throw po("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw po("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)}removeUploadProgressListener(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)}}class pa extends da{initXhr(){this.xhr_.responseType="text"}}function fa(){return new pa}class ga{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(t,e,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=zo(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=t=>{if(this._request=void 0,this._chunkMultiplier=1,t._codeEquals(no.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const e=this.isExponentialBackoffExpired();if(To(t.status,[])){if(!e)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();t=oo()}this._error=t,this._transition("error")}},this._metadataErrorHandler=t=>{this._request=void 0,t._codeEquals(no.CANCELED)?this.completeTransitions_():(this._error=t,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((t,e)=>{this._resolve=t,this._reject=e,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(t){return t.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(t){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,n])=>{switch(this._state){case"running":t(e,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((t,e)=>{const n=function(t,e,n,i,s){const r=e.bucketOnlyServerUrl(),o=Qo(e,i,s),a={name:o.fullPath},h=wo(r,t.host,t._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${i.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},l=qo(o,n),u=t.maxUploadRetryTime,d=new Ko(h,"POST",function(t){let e;ea(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){Go(!1)}return Go(mo(e)),e},u);return d.urlParams=a,d.headers=c,d.body=l,d.errorHandler=Yo(e),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,fa,t,e);this._request=i,i.getPromise().then(t=>{this._request=void 0,this._uploadUrl=t,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const t=this._uploadUrl;this._resolveToken((e,n)=>{const i=function(t,e,n,i){const s=t.maxUploadRetryTime,r=new Ko(n,"POST",function(t){const e=ea(t,["active","final"]);let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){Go(!1)}n||Go(!1);const s=Number(n);return Go(!isNaN(s)),new ta(s,i.size(),"final"===e)},s);return r.headers={"X-Goog-Upload-Command":"query"},r.errorHandler=Yo(e),r}(this._ref.storage,this._ref._location,t,this._blob),s=this._ref.storage._makeRequest(i,fa,e,n);this._request=s,s.getPromise().then(t=>{this._request=void 0,this._updateProgress(t.current),this._needToFetchStatus=!1,t.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const t=na*this._chunkMultiplier,e=new ta(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((i,s)=>{let r;try{r=ia(this._ref._location,this._ref.storage,n,this._blob,t,this._mappings,e,this._makeProgressCallback())}catch(t){return this._error=t,void this._transition("error")}const o=this._ref.storage._makeRequest(r,fa,i,s,!1);this._request=o,o.getPromise().then(t=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(t.current),t.finalized?(this._metadata=t.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(na*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,e)=>{const n=function(t,e,n){const i=wo(e.fullServerUrl(),t.host,t._protocol),s=t.maxOperationRetryTime,r=new Ko(i,"GET",Jo(t,n),s);return r.errorHandler=Zo(e),r}(this._ref.storage,this._ref._location,this._mappings),i=this._ref.storage._makeRequest(n,fa,t,e);this._request=i,i.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((t,e)=>{const n=function(t,e,n,i,s){const r=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"},a=function(){let t="";for(let e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();o["Content-Type"]="multipart/related; boundary="+a;const h=Qo(e,i,s),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+qo(h,n)+"\r\n--"+a+"\r\nContent-Type: "+h.contentType+"\r\n\r\n",l="\r\n--"+a+"--",u=xo.getBlob(c,i,l);if(null===u)throw ho();const d={name:h.fullPath},p=wo(r,t.host,t._protocol),f=t.maxUploadRetryTime,g=new Ko(p,"POST",Jo(t,n),f);return g.urlParams=d,g.headers=o,g.body=u.uploadData(),g.errorHandler=Yo(e),g}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,fa,t,e);this._request=i,i.getPromise().then(t=>{this._request=void 0,this._metadata=t,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(t){const e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()}_transition(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=t,this._notifyObservers();break;case"canceled":this._error=ao(),this._state=t,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const t=ca(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}}on(t,e,n,i){const s=new la(e||void 0,n||void 0,i||void 0);return this._addObserver(s),()=>{this._removeObserver(s)}}then(t,e){return this._promise.then(t,e)}catch(t){return this.then(null,t)}_addObserver(t){this._observers.push(t),this._notifyObserver(t)}_removeObserver(t){const e=this._observers.indexOf(t);-1!==e&&this._observers.splice(e,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(void 0!==this._resolve){let t=!0;switch(ca(this._state)){case oa:ua(this._resolve.bind(null,this.snapshot))();break;case aa:case ha:ua(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(ca(this._state)){case sa:case ra:t.next&&ua(t.next.bind(t,this.snapshot))();break;case oa:t.complete&&ua(t.complete.bind(t))();break;default:t.error&&ua(t.error.bind(t,this._error))()}}resume(){const t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t}pause(){const t="running"===this._state;return t&&this._transition("pausing"),t}cancel(){const t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t}}class ma{constructor(t,e){this._service=t,this._location=e instanceof fo?e:fo.makeFromUrl(e,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,e){return new ma(t,e)}get root(){const t=new fo(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Fo(this._location.path)}get storage(){return this._service}get parent(){const t=function(t){if(0===t.length)return null;const e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this._location.path);if(null===t)return null;const e=new fo(this._location.bucket,t);return new ma(this._service,e)}_throwIfRoot(t){if(""===this._location.path)throw function(t){return new eo(no.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)}}function _a(t,e){t._throwIfRoot("updateMetadata");const n=function(t,e,n,i){const s=wo(e.fullServerUrl(),t.host,t._protocol),r=qo(n,i),o=t.maxOperationRetryTime,a=new Ko(s,"PATCH",Jo(t,i),o);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=r,a.errorHandler=Zo(e),a}(t.storage,t._location,e,zo());return t.storage.makeRequestWithTokens(n,fa)}function ya(t){t._throwIfRoot("getDownloadURL");const e=function(t,e,n){const i=wo(e.fullServerUrl(),t.host,t._protocol),s=t.maxOperationRetryTime,r=new Ko(i,"GET",Xo(t,n),s);return r.errorHandler=Zo(e),r}(t.storage,t._location,zo());return t.storage.makeRequestWithTokens(e,fa).then(t=>{if(null===t)throw new eo(no.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})}function va(t,e){if(t instanceof Ta){const n=t;if(null==n._bucket)throw new eo(no.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+to+"' property when initializing the app?");const i=new ma(n,n._bucket);return null!=e?va(i,e):i}return void 0!==e?function(t,e){const n=function(t,e){const n=e.split("/").filter(t=>t.length>0).join("/");return 0===t.length?n:t+"/"+n}(t._location.path,e),i=new fo(t._location.bucket,n);return new ma(t.storage,i)}(t,e):t}function wa(t,e){if(e&&/^[A-Za-z]+:\/\//.test(e)){if(t instanceof Ta)return new ma(t,e);throw co("To use ref(service, url), the first argument must be a Storage instance.")}return va(t,e)}function ba(t,e){const n=e?.[to];return null==n?null:fo.makeFromBucketSpec(n,t)}class Ta{constructor(t,e,n,i,s,r=!1){this.app=t,this._authProvider=e,this._appCheckProvider=n,this._url=i,this._firebaseVersion=s,this._isUsingEmulator=r,this._bucket=null,this._host=Qr,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=i?fo.makeFromBucketSpec(i,this._host):ba(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,null!=this._url?this._bucket=fo.makeFromBucketSpec(this._url,t):this._bucket=ba(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){vo("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){vo("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const t=this._authProvider.getImmediate({optional:!0});if(t){const e=await t.getToken();if(null!==e)return e.accessToken}return null}async _getAppCheckToken(){if(Kt(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=this._appCheckProvider.getImmediate({optional:!0});if(t){return(await t.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new ma(this,t)}_makeRequest(t,e,n,i,s=!0){if(this._deleted)return new go(lo());{const r=function(t,e,n,i,s,r,o=!0,a=!1){const h=bo(t.urlParams),c=t.url+h,l=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(l,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(l,n),function(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}(l,r),function(t,e){null!==e&&(t["X-Firebase-AppCheck"]=e)}(l,i),new Io(c,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o,a)}(t,this._appId,n,i,e,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(r),r.getPromise().then(()=>this._requests.delete(r),()=>this._requests.delete(r)),r}}async makeRequestWithTokens(t,e){const[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,e,n,i).getPromise()}}const Ia="@firebase/storage",Ea="0.14.0",Sa="storage";function ka(t,e,n){return function(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new ga(t,new xo(e),n)}(t=L(t),e,n)}function Ca(t,e){return _a(t=L(t),e)}function Aa(t){return ya(t=L(t))}function Ra(t,e){return wa(t=L(t),e)}function Oa(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),i=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new Ta(n,i,s,e,Xt)}Wt(new U(Sa,Oa,"PUBLIC").setMultipleInstances(!0)),Qt(Ia,Ea,""),Qt(Ia,Ea,"esm2020");const Pa=JSON.parse(process.env.FIREBASE_CONFIG||"{}"),Na=Yt(Pa),Da=function(t){const e="object"==typeof t?t:Zt(),n="string"==typeof t?t:mr,i=qt(e,"firestore").getImmediate({identifier:n});if(!i._initialized){const t=h("firestore");t&&Pr(i,...t)}return i}(Na),La=function(t=Zt(),e){const n=qt(t=L(t),Sa).getImmediate({identifier:e}),i=h("storage");return i&&function(t,e,n,i={}){!function(t,e,n,i={}){t.host=`${e}:${n}`;const s=d(e);s&&(p(`https://${t.host}/b`),_("Storage",!0)),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:r}=i;r&&(t._overrideAuthToken="string"==typeof r?r:f(r,t.app.options.projectId))}(t,e,n,i)}(n,...i),n}(Na),Ua=bs(Na),Ma=Ua.currentUser;export{Ca as A,Ma as B,U as C,ai as D,E,I as F,hi as G,Pa as H,Da as I,$ as L,Wt as _,qt as a,w as b,D as c,Zt as d,k as e,T as f,L as g,st as h,v as i,bs as j,li as k,Na as l,ri as m,Ua as n,it as o,$n as p,ii as q,Qt as r,ui as s,si as t,oi as u,b as v,Ra as w,La as x,ka as y,Aa as z};
8
+ //# sourceMappingURL=pwa-helpers-BN4uXXdl.js.map