@tern-secure/auth 1.1.0-canary.v20251205181217 → 1.1.0-canary.v20251206165958

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 (25) hide show
  1. package/dist/signin_ternsecure_e38554_1.1.0-canary.v20251206165958.css +2 -0
  2. package/dist/signup_ternsecure_e38554_1.1.0-canary.v20251206165958.css +2 -0
  3. package/dist/ternsecure.browser.js +16 -16
  4. package/dist/ternsecure.css +1 -1
  5. package/dist/ternsecure.js +23 -4
  6. package/dist/ternsecure.mjs +23 -4
  7. package/dist/types/instance/ternsecure.d.ts +2 -1
  8. package/dist/types/ui/elements/index.d.ts +1 -0
  9. package/dist/types/ui/elements/input-otp.d.ts +11 -0
  10. package/dist/ui-common_ternsecure_e38554_1.1.0-canary.v20251206165958.js +1 -0
  11. package/dist/userbutton_ternsecure_e38554_1.1.0-canary.v20251206165958.css +2 -0
  12. package/dist/vendors_ternsecure_e38554_1.1.0-canary.v20251206165958.js +20 -0
  13. package/package.json +4 -3
  14. package/dist/signin_ternsecure_2d24ae_1.1.0-canary.v20251205181217.css +0 -2
  15. package/dist/signup_ternsecure_2d24ae_1.1.0-canary.v20251205181217.css +0 -2
  16. package/dist/ui-common_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js +0 -1
  17. package/dist/userbutton_ternsecure_2d24ae_1.1.0-canary.v20251205181217.css +0 -2
  18. package/dist/vendors_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js +0 -1
  19. /package/dist/{492_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → 492_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  20. /package/dist/{687_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → 687_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  21. /package/dist/{68_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → 68_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  22. /package/dist/{framework_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → framework_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  23. /package/dist/{signin_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → signin_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  24. /package/dist/{signup_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → signup_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
  25. /package/dist/{userbutton_ternsecure_2d24ae_1.1.0-canary.v20251205181217.js → userbutton_ternsecure_e38554_1.1.0-canary.v20251206165958.js} +0 -0
@@ -1,19 +1,6 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(globalThis,()=>(()=>{var e,t,r,n,i,s,a={7738:function(e,t,r){"use strict";r.d(t,{kZ:()=>u,vU:()=>y,yY:()=>w,kU:()=>p,Kj:()=>d,FV:()=>h,tL:()=>m,yR:()=>g});var n=r(2782),i=r(3392),s=new Set;let a=RegExp("/{1,}","g");var o=r(5327);let c="http://ternsecure-dummy",l=["javascript:"];function u(e,t={}){let{base:r,hashPath:i,hashSearch:s,searchParams:l,hashSearchParams:h,...d}=e,p=new URL(r||"","undefined"!=typeof window&&window.location?window.location.href:"http://react-native-fake-base-url");if(l instanceof URLSearchParams&&l.forEach((e,t)=>{null!=e&&p.searchParams.set((0,n.C8)(t),e)}),Object.assign(p,d),i||s||h){var f;let e=new URL(c+p.hash.substring(1));for(let[t,r]of(f=e.pathname,e.pathname=[f,i||""].filter(e=>e).join("/").replace(a,"/"),Object.entries((0,o.v)(s||""))))e.searchParams.append(t,r);if(h)for(let t of Array.isArray(h)?h:[h])(t instanceof URLSearchParams||"object"==typeof t)&&new URLSearchParams(t).forEach((t,r)=>{null!=t&&e.searchParams.set((0,n.C8)(r),t)});let t=e.href.replace(c,"");"/"!==t&&(p.hash=t)}let{stringify:m,skipOrigin:g}=t;return m?g?p.href.replace(p.origin,""):p.href:p}function h(e){return(e=new URL(e.toString(),window.location.origin)).href.replace(e.origin,"")}let d=e=>(e||"").replace(/\/+$/,"");function p(e,t){try{return new URL(e)}catch{return new URL(e,t)}}let f=[/\0/,/^\/\//,/[\x00-\x1F]/],m=e=>new URL(e,c).hash.startsWith("#/"),g=e=>{let t=new URL(e);if(!m(t))return t;let r=new URL(t.hash.replace("#/","/"),t.href),n=new URL([t.pathname,r.pathname].map(e=>e.split("/")).flat().filter(Boolean).join("/"),t.origin);return t.searchParams.forEach((e,t)=>{n.searchParams.set(t,e)}),r.searchParams.forEach((e,t)=>{n.searchParams.set(t,e)}),n},w=e=>e.replace(/TERN-ROUTER\/(.*?)\//,""),y=(e,t)=>r=>{var n;let a=r;if("string"==typeof a&&(a=p(a,t)),!e)return!0;let o=t===a.origin,c=!function(e){if(function(e){if(!function(e){if(!e)return!1;try{return new URL(e),!0}catch{return!1}}(e))return!1;let t=new URL(e).protocol;return l.some(e=>e===t)}(e))return!0;for(let t of f)if(t.test(e.pathname))return!0;return!1}(a)&&(o||e.map(e=>"string"==typeof e?(e=>{try{return i(e)}catch(t){throw Error(`Invalid pattern: ${e}.
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(globalThis,()=>(()=>{var e,t,r,n,i,s,a={7738:function(e,t,r){"use strict";r.d(t,{kZ:()=>u,vU:()=>w,yY:()=>y,kU:()=>p,Kj:()=>d,FV:()=>h,tL:()=>m,yR:()=>g});var n=r(2782),i=r(3392),s=new Set;let a=RegExp("/{1,}","g");var o=r(5327);let c="http://ternsecure-dummy",l=["javascript:"];function u(e,t={}){let{base:r,hashPath:i,hashSearch:s,searchParams:l,hashSearchParams:h,...d}=e,p=new URL(r||"","undefined"!=typeof window&&window.location?window.location.href:"http://react-native-fake-base-url");if(l instanceof URLSearchParams&&l.forEach((e,t)=>{null!=e&&p.searchParams.set((0,n.C8)(t),e)}),Object.assign(p,d),i||s||h){var f;let e=new URL(c+p.hash.substring(1));for(let[t,r]of(f=e.pathname,e.pathname=[f,i||""].filter(e=>e).join("/").replace(a,"/"),Object.entries((0,o.v)(s||""))))e.searchParams.append(t,r);if(h)for(let t of Array.isArray(h)?h:[h])(t instanceof URLSearchParams||"object"==typeof t)&&new URLSearchParams(t).forEach((t,r)=>{null!=t&&e.searchParams.set((0,n.C8)(r),t)});let t=e.href.replace(c,"");"/"!==t&&(p.hash=t)}let{stringify:m,skipOrigin:g}=t;return m?g?p.href.replace(p.origin,""):p.href:p}function h(e){return(e=new URL(e.toString(),window.location.origin)).href.replace(e.origin,"")}let d=e=>(e||"").replace(/\/+$/,"");function p(e,t){try{return new URL(e)}catch{return new URL(e,t)}}let f=[/\0/,/^\/\//,/[\x00-\x1F]/],m=e=>new URL(e,c).hash.startsWith("#/"),g=e=>{let t=new URL(e);if(!m(t))return t;let r=new URL(t.hash.replace("#/","/"),t.href),n=new URL([t.pathname,r.pathname].map(e=>e.split("/")).flat().filter(Boolean).join("/"),t.origin);return t.searchParams.forEach((e,t)=>{n.searchParams.set(t,e)}),r.searchParams.forEach((e,t)=>{n.searchParams.set(t,e)}),n},y=e=>e.replace(/TERN-ROUTER\/(.*?)\//,""),w=(e,t)=>r=>{var n;let a=r;if("string"==typeof a&&(a=p(a,t)),!e)return!0;let o=t===a.origin,c=!function(e){if(function(e){if(!function(e){if(!e)return!1;try{return new URL(e),!0}catch{return!1}}(e))return!1;let t=new URL(e).protocol;return l.some(e=>e===t)}(e))return!0;for(let t of f)if(t.test(e.pathname))return!0;return!1}(a)&&(o||e.map(e=>"string"==typeof e?(e=>{try{return i(e)}catch(t){throw Error(`Invalid pattern: ${e}.
2
2
  Consult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.
3
- ${t.message}`)}})(d(e)):e).some(e=>e.test(d(a.origin))));return c||(n=`TernSecure: Redirect URL ${a} is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.`,s.has(n)||(s.add(n),console.warn(n))),c}},2117:function(e,t,r){"use strict";r.d(t,{VY:()=>a,kZ:()=>n.kZ,vA:()=>i.v,yY:()=>n.yY,Ws:()=>i.W,nQ:()=>s.n,Kj:()=>n.Kj,FV:()=>n.FV,tL:()=>n.tL,y7:()=>o,yR:()=>n.yR});var n=r(7738),i=r(5327),s=r(8177);let a=["http:","https:","wails:","chrome-extension:"];function o(e){let t=new URL(e,window.location.href);window.dispatchEvent(new CustomEvent("ternsecure:beforeunload")),window.location.href=t.href}},5327:function(e,t,r){"use strict";r.d(t,{W:()=>i,v:()=>n});let n=e=>{let t={};return new URLSearchParams(e).forEach((e,r)=>{if(r in t){let n=t[r];Array.isArray(n)?n.push(e):t[r]=[n,e]}else t[r]=e}),t},i=(e,t={})=>{if(null==e||!e||"object"!=typeof e)return"";let r=new URLSearchParams;return Object.keys(e).forEach(n=>{let i=t.keyEncoder?t.keyEncoder(n):n,s=e[n];if(Array.isArray(s))s.forEach(e=>void 0!==e&&r.append(i,e||""));else{if(void 0===s)return;"object"==typeof s&&null!==s?r.append(i,JSON.stringify(s)):r.append(i,String(s??""))}}),r.toString()}},8177:function(e,t,r){"use strict";r.d(t,{n:()=>o});var n=r(2782),i=(e,t)=>{let r={};for(let n in e)r[n]=t(e[n],n);return r},s=(e,t)=>{let r={};for(let n in e)e[n]&&t(e[n])&&(r[n]=e[n]);return r},a=r(7738);class o{static keys=["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","afterSignInUrl","afterSignUpUrl","redirectUrl"];static preserved=["redirectUrl"];options;fromOptions;fromProps;fromSearchParams;mode;constructor(e,t={},r={},n){this.options=e,this.fromOptions=this.#e(e||{}),this.fromProps=this.#e(t||{}),this.fromSearchParams=this.#t(r||{}),this.mode=n}getAfterSignInUrl(){return this.#r("signIn")}getAfterSignUpUrl(){return this.#r("signUp")}getPreservedSearchParams(){return this.#n(this.#i())}toSearchParams(){return this.#n(this.#s())}#n(e){return new URLSearchParams(Object.entries(Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,n.C8)(e),t]))).reduce((e,[t,r])=>(null!=r&&(e[t]=r),e),{}))}#i(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter(([e])=>o.preserved.includes(e)))}#s(){let e=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,t=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,r=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,n=this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,i=this.fromSearchParams.afterSignInUrl||this.fromProps.afterSignInUrl||this.fromOptions.afterSignInUrl,s={signUpForceRedirectUrl:e,signUpFallbackRedirectUrl:t,signInForceRedirectUrl:r,signInFallbackRedirectUrl:n,afterSignInUrl:i,afterSignUpUrl:this.fromSearchParams.afterSignUpUrl||this.fromProps.afterSignUpUrl||this.fromOptions.afterSignUpUrl,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl||this.fromOptions.redirectUrl};return e&&delete s.signUpFallbackRedirectUrl,r&&delete s.signInFallbackRedirectUrl,s}#r(e){let t,r=`${e}ForceRedirectUrl`,n=`${e}FallbackRedirectUrl`;return(t=this.fromSearchParams[r]||this.fromProps[r]||this.fromOptions[r],t||=this.fromSearchParams.redirectUrl,(t||=this.fromSearchParams[n]||this.fromProps[n]||this.fromOptions[n])||"modal"!==this.mode)?t||"/":window.location.href}#e(e){let t={};return o.keys.forEach(r=>{t[r]=e[r]}),i(this.#a(this.#o(s(t,Boolean))),e=>e.toString())}#t(e){let t={};return o.keys.forEach(r=>{e instanceof URLSearchParams?t[r]=e.get((0,n.C8)(r)):t[r]=e[(0,n.C8)(r)]}),i(this.#a(this.#o(s(t,Boolean))),e=>e.toString())}#o(e){return i(e,e=>(0,a.kU)(e,window.location.origin))}#a=e=>s(e,(0,a.vU)(this.options?.allowedRedirectOrigins,window.location.origin))}},3392:function(e){e.exports=function(e,t){if("string"!=typeof e)throw TypeError("Expected a string");for(var r,n=String(e),i="",s=!!t&&!!t.extended,a=!!t&&!!t.globstar,o=!1,c=t&&"string"==typeof t.flags?t.flags:"",l=0,u=n.length;l<u;l++)switch(r=n[l]){case"/":case"$":case"^":case"+":case".":case"(":case")":case"=":case"!":case"|":i+="\\"+r;break;case"?":if(s){i+=".";break}case"[":case"]":if(s){i+=r;break}case"{":if(s){o=!0,i+="(";break}case"}":if(s){o=!1,i+=")";break}case",":if(o){i+="|";break}i+="\\"+r;break;case"*":for(var h=n[l-1],d=1;"*"===n[l+1];)d++,l++;var p=n[l+1];a?d>1&&("/"===h||void 0===h)&&("/"===p||void 0===p)?(i+="((?:[^/]*(?:/|$))*)",l++):i+="([^/]*)":i+=".*";break;default:i+=r}return c&&~c.indexOf("g")||(i="^"+i+"$"),new RegExp(i,c)}},2493:function(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var s in n={},t)"key"!==s&&(n[s]=t[s]);else n=t;return{$$typeof:r,type:e,key:i,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},1230:function(e,t){"use strict";var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),f=Symbol.iterator,m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,w={};function y(e,t,r){this.props=e,this.context=t,this.refs=w,this.updater=r||m}function v(){}function _(e,t,r){this.props=e,this.context=t,this.refs=w,this.updater=r||m}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=y.prototype;var I=_.prototype=new v;I.constructor=_,g(I,y.prototype),I.isPureReactComponent=!0;var b=Array.isArray;function E(){}var S={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function T(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var R=/\/+/g;function P(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function A(e,t,i){if(null==e)return e;var s=[],a=0;return!function e(t,i,s,a,o){var c,l,u,h=typeof t;("undefined"===h||"boolean"===h)&&(t=null);var p=!1;if(null===t)p=!0;else switch(h){case"bigint":case"string":case"number":p=!0;break;case"object":switch(t.$$typeof){case r:case n:p=!0;break;case d:return e((p=t._init)(t._payload),i,s,a,o)}}if(p)return o=o(t),p=""===a?"."+P(t,0):a,b(o)?(s="",null!=p&&(s=p.replace(R,"$&/")+"/"),e(o,i,s,"",function(e){return e})):null!=o&&(C(o)&&(c=o,l=s+(null==o.key||t&&t.key===o.key?"":(""+o.key).replace(R,"$&/")+"/")+p,o=T(c.type,l,c.props)),i.push(o)),1;p=0;var m=""===a?".":a+":";if(b(t))for(var g=0;g<t.length;g++)h=m+P(a=t[g],g),p+=e(a,i,s,h,o);else if("function"==typeof(g=null===(u=t)||"object"!=typeof u?null:"function"==typeof(u=f&&u[f]||u["@@iterator"])?u:null))for(t=g.call(t),g=0;!(a=t.next()).done;)h=m+P(a=a.value,g++),p+=e(a,i,s,h,o);else if("object"===h){if("function"==typeof t.then)return e(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(t),i,s,a,o);throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(i=String(t))?"object with keys {"+Object.keys(t).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.")}return p}(e,s,"","",function(e){return t.call(i,e,a++)}),s}function O(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var N="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};t.Activity=p,t.Children={map:A,forEach:function(e,t,r){A(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=y,t.Fragment=i,t.Profiler=a,t.PureComponent=_,t.StrictMode=s,t.Suspense=u,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=g({},e.props),i=e.key;if(null!=t)for(s in void 0!==t.key&&(i=""+t.key),t)k.call(t,s)&&"key"!==s&&"__self"!==s&&"__source"!==s&&("ref"!==s||void 0!==t.ref)&&(n[s]=t[s]);var s=arguments.length-2;if(1===s)n.children=r;else if(1<s){for(var a=Array(s),o=0;o<s;o++)a[o]=arguments[o+2];n.children=a}return T(e.type,i,n)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:o,_context:e},e},t.createElement=function(e,t,r){var n,i={},s=null;if(null!=t)for(n in void 0!==t.key&&(s=""+t.key),t)k.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var a=arguments.length-2;if(1===a)i.children=r;else if(1<a){for(var o=Array(a),c=0;c<a;c++)o[c]=arguments[c+2];i.children=o}if(e&&e.defaultProps)for(n in a=e.defaultProps)void 0===i[n]&&(i[n]=a[n]);return T(e,s,i)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=S.T,r={};S.T=r;try{var n=e(),i=S.S;null!==i&&i(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(E,N)}catch(e){N(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),S.T=t}},t.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},t.use=function(e){return S.H.use(e)},t.useActionState=function(e,t,r){return S.H.useActionState(e,t,r)},t.useCallback=function(e,t){return S.H.useCallback(e,t)},t.useContext=function(e){return S.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return S.H.useEffect(e,t)},t.useEffectEvent=function(e){return S.H.useEffectEvent(e)},t.useId=function(){return S.H.useId()},t.useImperativeHandle=function(e,t,r){return S.H.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return S.H.useMemo(e,t)},t.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},t.useReducer=function(e,t,r){return S.H.useReducer(e,t,r)},t.useRef=function(e){return S.H.useRef(e)},t.useState=function(e){return S.H.useState(e)},t.useSyncExternalStore=function(e,t,r){return S.H.useSyncExternalStore(e,t,r)},t.useTransition=function(){return S.H.useTransition()},t.version="19.2.0"},4105:function(e,t,r){"use strict";e.exports=r(1230)},4557:function(e,t,r){"use strict";e.exports=r(2493)},2782:function(e,t,r){"use strict";function n(e){return e?e.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace(/-|_/,"")):""}function i(e){return e?e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`):""}r.d(t,{$x:()=>a,C8:()=>i,sF:()=>n});var s=e=>{let t=r=>{if(!r)return r;if(Array.isArray(r))return r.map(e=>"object"==typeof e||Array.isArray(e)?t(e):e);let n={...r};for(let r of Object.keys(n)){let i=e(r.toString());i!==r&&(n[i]=n[r],delete n[r]),"object"==typeof n[i]&&(n[i]=t(n[i]))}return n};return t};function a(e){return e*Math.random()}s(i),s(n)},5305:function(e,t,r){"use strict";function n(e){return{code:e.code,message:e.message}}r.d(t,{R6:()=>s,yS:()=>i});var i=class e extends Error{constructor(t,{data:r,status:i,retryAfter:s}){super(t),this.toString=()=>`[${this.name}]
4
- Message:${this.message}
5
- Status:${this.status}
6
- Serialized errors: ${this.errors.map(e=>JSON.stringify(e))}`,Object.setPrototypeOf(this,e.prototype),this.status=i,this.message=t,this.retryAfter=s,this.ternSecureError=!0,this.errors=function(e=[]){return e.length>0?e.map(n):[]}(r)}},s=class e extends Error{constructor(t,{code:r}){const n="\uD83D\uDD12 TernSecure:",i=RegExp(n.replace(" ","\\s*"),"i"),s=t.replace(i,""),a=`${n} ${s.trim()}
7
-
8
- (code="${r}")
9
- `;super(a),this.toString=()=>`[${this.name}]
10
- Message:${this.message}`,Object.setPrototypeOf(this,e.prototype),this.code=r,this.message=a,this.ternSecureRuntimeError=!0,this.name="TernSecureRuntimeError"}}},802:function(e,t,r){"use strict";r.d(t,{sQ:()=>a,e3:()=>s,UQ:()=>w,qn:()=>g,xq:()=>o,_x:()=>i});var n=r(4105);function i(e,t){if(!e)throw"string"==typeof t?Error(t):Error(`${t.displayName} not found`)}Object.prototype.hasOwnProperty;var s=(e,t)=>{let{assertCtxFn:r=i}=t||{},s=n.createContext(void 0);return s.displayName=e,[s,()=>{let t=n.useContext(s);return r(t,`${e} not found`),t.value},()=>{let e=n.useContext(s);return e?e.value:{}}]},[a,o]=s("TernSecureAuthCtx"),[c,l]=s("TernSecureInstanceContext"),[u,h]=s("TernSecureAuthContext"),[d,p]=s("SessionContext"),[f,m]=s("UserContext"),g=()=>(!function(e){if(!(0,n.useContext)(a)){if("function"==typeof e)return e();throw Error(`${e} can only be used within the <TernSecureProvider /> component.
11
-
12
- Possible fixes:
13
- 1. Ensure that the <TernSecureProvider /> is correctly wrapping your application
14
- 2. Check for multiple versions of @tern-secure packages in your project`)}}("useTernSecure"),o()),w="undefined"!=typeof window?n.useLayoutEffect:n.useEffect},8978:function(e,t,r){"use strict";function n(e=""){return(e||"").replace(/^.+:\/\//,"")}r.d(t,{W:()=>n,v:()=>s});var i=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,s=e=>i.test(e)}},o={};function c(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,c),r.exports}c.m=a,u=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);c.r(r);var n={};l=l||[null,u({}),u([]),u(u)];for(var i=2&t&&e;("object"==typeof i||"function"==typeof i)&&!~l.indexOf(i);i=u(i))Object.getOwnPropertyNames(i).forEach(t=>{n[t]=()=>e[t]});return n.default=()=>e,c.d(r,n),r},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,r)=>(c.f[r](e,t),t),[])),c.k=e=>""+({10:"signin",472:"signup",99:"userbutton"})[e]+"_ternsecure_"+c.h().slice(0,6)+"_1.1.0-canary.v20251205181217.css",c.u=e=>""+(({10:"signin",26:"framework",472:"signup",545:"vendors",666:"ui-common",99:"userbutton"})[e]||e)+"_ternsecure_"+c.h().slice(0,6)+"_1.1.0-canary.v20251205181217.js",c.h=()=>"2d24aef273177a64",c.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h={},c.l=function(e,t,r,n){if(h[e])return void h[e].push(t);if(void 0!==r)for(var i,s,a=document.getElementsByTagName("script"),o=0;o<a.length;o++){var l=a[o];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tern-secure/auth:"+r){i=l;break}}i||(s=!0,(i=document.createElement("script")).timeout=120,c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack","@tern-secure/auth:"+r),i.src=e),h[e]=[t];var u=function(t,r){i.onerror=i.onload=null,clearTimeout(d);var n=h[e];if(delete h[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(function(e){return e(r)}),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),s&&document.head.appendChild(i)},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(d=c.g.location+"");var l,u,h,d,p=c.g.document;if(!d&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(d=p.currentScript.src),!d)){var f=p.getElementsByTagName("script");if(f.length)for(var m=f.length-1;m>-1&&(!d||!/^http(s?):/.test(d));)d=f[m--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");return c.p=d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e={},t="@tern-secure/auth",r="data-webpack-loading",c.f.css=(n,i,s)=>{var a=c.o(e,n)?e[n]:void 0;if(0!==a)if(a)i.push(a[2]);else if(/^(10|472|99)$/.test(n)){var o=new Promise(function(t,r){a=e[n]=[t,r]});i.push(a[2]=o);var l=c.p+c.k(n),u=Error(),h=function(t){if(c.o(e,n)&&(0!==(a=e[n])&&(e[n]=void 0),a))if("load"!==t.type){var r=t&&t.type,i=t&&t.target&&t.target.src;u.message="Loading css chunk "+n+" failed.\n("+r+": "+i+")",u.name="ChunkLoadError",u.type=r,u.request=i,a[1](u)}else c.m,e[n]=0,a[0]()};"undefined"!=typeof document?((e,n,i,s,a)=>{var o,l,u="chunk-"+e;if(!s){for(var h=document.getElementsByTagName("link"),d=0;d<h.length;d++){var p=h[d],f=p.getAttribute("href")||p.href;if(f&&!f.startsWith(c.p)&&(f=c.p+(f.startsWith("/")?f.slice(1):f)),"stylesheet"==p.rel&&(f&&f.startsWith(n)||p.getAttribute("data-webpack")==t+":"+u)){o=p;break}}if(!i)return}o||(l=!0,o=document.createElement("link"),c.nc&&o.setAttribute("nonce",c.nc),o.setAttribute("data-webpack",t+":"+u),o.setAttribute(r,1),o.rel="stylesheet",o.href=n);var m=(e,t)=>{if(o.onerror=o.onload=null,o.removeAttribute(r),clearTimeout(g),t&&"load"!=t.type&&o.parentNode.removeChild(o),i(t),e)return e(t)};if(o.getAttribute(r)){var g=setTimeout(m.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=m.bind(null,o.onerror),o.onload=m.bind(null,o.onload)}else m(void 0,{type:"load",target:o});return s&&s.getAttribute("fetchpriority")&&o.setAttribute("fetchpriority",s.getAttribute("fetchpriority")),s?document.head.insertBefore(o,s):l&&document.head.appendChild(o)})(n,l,h,void 0,0):h({type:"load"})}else e[n]=0},n={0:0},c.f.j=function(e,t){var r=c.o(n,e)?n[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var i=new Promise((t,i)=>r=n[e]=[t,i]);t.push(r[2]=i);var s=c.p+c.u(e),a=Error();c.l(s,function(t){if(c.o(n,e)&&(0!==(r=n[e])&&(n[e]=void 0),r)){var i=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",a.name="ChunkLoadError",a.type=i,a.request=s,r[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var r,i,s=t[0],a=t[1],o=t[2],l=0;if(s.some(e=>0!==n[e])){for(r in a)c.o(a,r)&&(c.m[r]=a[r]);o&&o(c)}for(e&&e(t);l<s.length;l++)i=s[l],c.o(n,i)&&n[i]&&n[i][0](),n[i]=0},(s=globalThis.webpackChunk_tern_secure_auth=globalThis.webpackChunk_tern_secure_auth||[]).forEach(i.bind(null,0)),s.push=i.bind(null,s.push.bind(s)),(()=>{"use strict";let e,t,r;function n(e){let t={"argument-error":{message:"Method called with incorrect arguments",code:"INCORRECT_ARGUMENT"},"invalid-email":{message:"Invalid email format",code:"INVALID_EMAIL"},"invalid-tenant-id":{message:"Invalid tenant ID",code:"INVALID_ARGUMENT"},"invalid-credential":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"invalid-login-credentials":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"wrong-password":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"user-not-found":{message:"User not found",code:"USER_NOT_FOUND"},"user-disabled":{message:"This account has been disabled",code:"USER_DISABLED"},"too-many-requests":{message:"Too many attempts. Please try again later",code:"TOO_MANY_ATTEMPTS"},"network-request-failed":{message:"Network error. Please check your connection",code:"NETWORK_ERROR"},"email-already-in-use":{message:"This email is already in use",code:"EMAIL_EXISTS"},"weak-password":{message:"Password is too weak",code:"WEAK_PASSWORD"},"operation-not-allowed":{message:"This login method is not enabled",code:"OPERATION_NOT_ALLOWED"},"popup-blocked":{message:"Login popup was blocked. Please enable popups",code:"POPUP_BLOCKED"},"expired-action-code":{message:"Your session has expired. Please login again",code:"EXPIRED_TOKEN"},"user-token-expired":{message:"Your session has expired. Please login again",code:"EXPIRED_TOKEN"},"tenant-not-found":{message:"There is no tenant corresponding to the provided identifier.",code:"INVALID_ARGUMENT"}};try{let r=function(e){if("string"==typeof e){let t=e.match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(t)return{code:t[1],message:e}}if(e&&"object"==typeof e){if(e.message){let t=e.message.match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(t)return{code:t[1],message:e.message}}if(e.code)return{code:e.code.replace("auth/",""),message:e.message||""}}return null}(e);if(r){let e=t[r.code];if(e)return{success:!1,message:e.message,code:e.code}}let n=String(e).match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(n&&t[n[1]])return{success:!1,...t[n[1]]}}catch(e){}return{success:!1,message:"An unexpected error occurred. Please try again later",code:"INTERNAL_ERROR"}}var i,s,a,o=(e,t,r)=>(e.get(t)||[]).map(e=>e(r)),l=()=>{let e=new Map,t=new Map,r=new Map;return{on:(...r)=>((e,t,r,n,i)=>{let{notify:s}=i||{},a=e.get(r);a||(a=[],e.set(r,a)),a.push(n),s&&t.has(r)&&n(t.get(r))})(e,t,...r),emit:(n,i)=>{t.set(n,i),o(r,n,i),o(e,n,i)},off:(...t)=>((e,t,r)=>{let n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))})(e,...t),getListeners:t=>e.get(t)||[]}},u="status",h=c(8978);let d=function(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},p=function(e){let t=[],r=0,n=0;for(;r<e.length;){let i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){let s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{let s=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return t.join("")},f={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,l=i>>2,u=(3&i)<<4|a>>4,h=(15&a)<<2|c>>6,d=63&c;!o&&(d=64,s||(h=64)),n.push(r[l],r[u],r[h],r[d])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(d(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):p(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){let i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0,a=++t<e.length?r[e.charAt(t)]:64,o=++t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==a||null==o)throw new m;let c=i<<2|s>>4;if(n.push(c),64!==a){let e=s<<4&240|a>>2;if(n.push(e),64!==o){let e=a<<6&192|o;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class m extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let g=function(e){let t=d(e);return f.encodeByteArray(t,!0)},w=function(e){return g(e).replace(/\./g,"")},y=function(e){try{return f.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function v(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==c.g)return c.g;throw Error("Unable to locate global object.")}let _=()=>{try{return v().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process||void 0===process.env)return;let e=process.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("undefined"==typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&y(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},I=()=>_()?.config;class b{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}function E(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function S(e){return(await fetch(e,{credentials:"include"})).ok}let k={},T=!1;function C(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function R(){try{return"object"==typeof indexedDB}catch(e){return!1}}class P extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,P.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,A.prototype.create)}}class A{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var r,n;let i=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],o=a?(r=a,n=i,r.replace(O,(e,t)=>{let r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",c=`${this.serviceName}: ${o} (${s}).`;return new P(s,c,i)}}let O=/\{\$([^}]+)}/g;function N(e,t){if(e===t)return!0;let r=Object.keys(e),n=Object.keys(t);for(let i of r){if(!n.includes(i))return!1;let r=e[i],s=t[i];if(U(r)&&U(s)){if(!N(r,s))return!1}else if(r!==s)return!1}for(let e of n)if(!r.includes(e))return!1;return!0}function U(e){return null!==e&&"object"==typeof e}function D(e){let t=[];for(let[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function L(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}}),t}function M(e){let t=e.indexOf("?");if(!t)return"";let r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}class x{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw Error("Missing Observer.");void 0===(n=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:r}:e).next&&(n.next=F),void 0===n.error&&(n.error=F),void 0===n.complete&&(n.complete=F);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function F(){}function j(e){return e&&e._delegate?e._delegate:e}class V{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let H="[DEFAULT]";class ${constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new b;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}if(r)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:H})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=H){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=H){return this.instances.has(e)}getOptions(e=H){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(n);return n}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),n=this.onInitCallbacks.get(r)??new Set;n.add(e),this.onInitCallbacks.set(r,n);let i=this.instances.get(r);return i&&e(i,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let n of r)try{n(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var r;let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e)===H?void 0:r,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=H){return this.component?this.component.multipleInstances?e:H:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class B{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new $(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}let W=[];(s=i||(i={}))[s.DEBUG=0]="DEBUG",s[s.VERBOSE=1]="VERBOSE",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.SILENT=5]="SILENT";let z={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},q=i.INFO,K={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},G=(e,t,...r)=>{if(t<e.logLevel)return;let n=new Date().toISOString(),i=K[t];if(i)console[i](`[${n}] ${e.name}:`,...r);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class J{constructor(e){this.name=e,this._logLevel=q,this._logHandler=G,this._userLogHandler=null,W.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?z[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}let Y=new WeakMap,X=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,et={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return X.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Z.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return er(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function er(r){if(r instanceof IDBRequest){let e;return(e=new Promise((e,t)=>{let n=()=>{r.removeEventListener("success",i),r.removeEventListener("error",s)},i=()=>{e(er(r.result)),n()},s=()=>{t(r.error),n()};r.addEventListener("success",i),r.addEventListener("error",s)})).then(e=>{e instanceof IDBCursor&&Y.set(e,r)}).catch(()=>{}),ee.set(e,r),e}if(Q.has(r))return Q.get(r);let n=function(r){if("function"==typeof r)return r!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(t||(t=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(r)?function(...e){return r.apply(en(this),e),er(Y.get(this))}:function(...e){return er(r.apply(en(this),e))}:function(e,...t){let n=r.call(en(this),e,...t);return Z.set(n,e.sort?e.sort():[e]),er(n)};return r instanceof IDBTransaction&&function(e){if(X.has(e))return;let t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});X.set(e,t)}(r),(e||(e=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>r instanceof e)?new Proxy(r,et):r}(r);return n!==r&&(Q.set(r,n),ee.set(n,r)),n}let en=e=>ee.get(e);function ei(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){let a=indexedDB.open(e,t),o=er(a);return n&&a.addEventListener("upgradeneeded",e=>{n(er(a.result),e.oldVersion,e.newVersion,er(a.transaction),e)}),r&&a.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}let es=["get","getKey","getAll","getAllKeys","count"],ea=["put","add","delete","clear"],eo=new Map;function ec(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(eo.get(t))return eo.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,i=ea.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||es.includes(r)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),a=s.store;return n&&(a=a.index(t.shift())),(await Promise.all([a[r](...t),i&&s.done]))[0]};return eo.set(t,s),s}et={...r=et,get:(e,t,n)=>ec(e,t)||r.get(e,t,n),has:(e,t)=>!!ec(e,t)||r.has(e,t)};class el{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if(t=e.getComponent(),t?.type!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let eu="@firebase/app",eh="0.14.6",ed=new J("@firebase/app"),ep="[DEFAULT]",ef={[eu]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},em=new Map,eg=new Map,ew=new Map;function ey(e,t){try{e.container.addComponent(t)}catch(r){ed.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function ev(e){let t=e.name;if(ew.has(t))return ed.debug(`There were multiple attempts to register component ${t}.`),!1;for(let r of(ew.set(t,e),em.values()))ey(r,e);for(let t of eg.values())ey(t,e);return!0}function e_(e,t){let r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function eI(e){return null!=e&&void 0!==e.settings}let eb=new A("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 eE{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new V("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw eb.create("app-deleted",{appName:this._name})}}let eS="12.6.0";function ek(e,t={}){let r=e;"object"!=typeof t&&(t={name:t});let n={name:ep,automaticDataCollectionEnabled:!0,...t},i=n.name;if("string"!=typeof i||!i)throw eb.create("bad-app-name",{appName:String(i)});if(r||(r=I()),!r)throw eb.create("no-options");let s=em.get(i);if(s)if(N(r,s.options)&&N(n,s.config))return s;else throw eb.create("duplicate-app",{appName:i});let a=new B(i);for(let e of ew.values())a.addComponent(e);let o=new eE(r,n,a);return em.set(i,o),o}function eT(e=ep){let t=em.get(e);if(!t&&e===ep&&I())return ek();if(!t)throw eb.create("no-app",{appName:e});return t}function eC(){return Array.from(em.values())}function eR(e,t,r){let n=ef[e]??e;r&&(n+=`-${r}`);let i=n.match(/\s|\//),s=t.match(/\s|\//);if(i||s){let e=[`Unable to register library "${n}" with version "${t}":`];i&&e.push(`library name "${n}" contains illegal characters (whitespace or "/")`),i&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),ed.warn(e.join(" "));return}ev(new V(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}let eP="firebase-heartbeat-store",eA=null;function eO(){return eA||(eA=ei("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(eP)}catch(e){console.warn(e)}}}).catch(e=>{throw eb.create("idb-open",{originalErrorMessage:e.message})})),eA}async function eN(e){try{let t=(await eO()).transaction(eP),r=await t.objectStore(eP).get(eD(e));return await t.done,r}catch(e){if(e instanceof P)ed.warn(e.message);else{let t=eb.create("idb-get",{originalErrorMessage:e?.message});ed.warn(t.message)}}}async function eU(e,t){try{let r=(await eO()).transaction(eP,"readwrite"),n=r.objectStore(eP);await n.put(t,eD(e)),await r.done}catch(e){if(e instanceof P)ed.warn(e.message);else{let t=eb.create("idb-set",{originalErrorMessage:e?.message});ed.warn(t.message)}}}function eD(e){return`${e.name}!${e.options.appId}`}class eL{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ex(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{let e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=eM();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ed.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||0===this._heartbeatsCache.heartbeats.length)return"";let e=eM(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){let r=[],n=e.slice();for(let i of e){let e=r.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),eF(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),eF(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=w(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return ed.warn(e),""}}}function eM(){return new Date().toISOString().substring(0,10)}class ex{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!R()&&new Promise((e,t)=>{try{let r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{t(i.error?.message||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await eN(this.app);return e?.heartbeats?e:{heartbeats:[]}}}async overwrite(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return eU(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return eU(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function eF(e){return w(JSON.stringify({version:2,heartbeats:e})).length}ev(new V("platform-logger",e=>new el(e),"PRIVATE")),ev(new V("heartbeat",e=>new eL(e),"PRIVATE")),eR(eu,eh,""),eR(eu,eh,"esm2020"),eR("fire-js",""),eR("firebase","12.6.0","app");let ej=new Map,eV={activated:!1,tokenObservers:[]},eH={initialized:!1,enabled:!1};function e$(e){return ej.get(e)||{...eV}}let eB="https://content-firebaseappcheck.googleapis.com/v1";class eW{constructor(e,t,r,n,i){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=n,this.upperBound=i,this.pending=null,this.nextErrorWaitInterval=n,n>i)throw Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{var t;this.pending=new b,this.pending.promise.catch(e=>{}),await (t=this.getNextRun(e),new Promise(e=>{setTimeout(e,t)})),this.pending.resolve(),await this.pending.promise,this.pending=new b,this.pending.promise.catch(e=>{}),await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}}let ez=new A("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"});function eq(e=!1){return e?self.grecaptcha?.enterprise:self.grecaptcha}function eK(e){if(!e$(e).activated)throw ez.create("use-before-activation",{appName:e.name})}function eG(e){let t=Math.round(e/1e3),r=Math.floor(t/86400),n=Math.floor((t-3600*r*24)/3600),i=Math.floor((t-3600*r*24-3600*n)/60),s="";return r&&(s+=eJ(r)+"d:"),n&&(s+=eJ(n)+"h:"),s+=eJ(i)+"m:"+eJ(t-3600*r*24-3600*n-60*i)+"s"}function eJ(e){return 0===e?"00":e>=10?e.toString():"0"+e}async function eY({url:e,body:t},r){let n,i,s={"Content-Type":"application/json"},a=r.getImmediate({optional:!0});if(a){let e=await a.getHeartbeatsHeader();e&&(s["X-Firebase-Client"]=e)}let o={method:"POST",body:JSON.stringify(t),headers:s};try{n=await fetch(e,o)}catch(e){throw ez.create("fetch-network-error",{originalErrorMessage:e?.message})}if(200!==n.status)throw ez.create("fetch-status-error",{httpStatus:n.status});try{i=await n.json()}catch(e){throw ez.create("fetch-parse-error",{originalErrorMessage:e?.message})}let c=i.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw ez.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${i.ttl}`});let l=1e3*Number(c[1]),u=Date.now();return{token:i.token,expireTimeMillis:u+l,issuedAtTimeMillis:u}}function eX(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${eB}/projects/${r}/apps/${n}:exchangeDebugToken?key=${i}`,body:{debug_token:t}}}let eZ="firebase-app-check-store",eQ="debug-token",e1=null;function e0(){return e1||(e1=new Promise((e,t)=>{try{let r=indexedDB.open("firebase-app-check-database",1);r.onsuccess=t=>{e(t.target.result)},r.onerror=e=>{t(ez.create("storage-open",{originalErrorMessage:e.target.error?.message}))},r.onupgradeneeded=e=>{let t=e.target.result;0===e.oldVersion&&t.createObjectStore(eZ,{keyPath:"compositeKey"})}}catch(e){t(ez.create("storage-open",{originalErrorMessage:e?.message}))}}))}async function e6(e,t){let r=(await e0()).transaction(eZ,"readwrite"),n=r.objectStore(eZ).put({compositeKey:e,value:t});return new Promise((e,t)=>{n.onsuccess=t=>{e()},r.onerror=e=>{t(ez.create("storage-set",{originalErrorMessage:e.target.error?.message}))}})}async function e2(e){let t=(await e0()).transaction(eZ,"readonly"),r=t.objectStore(eZ).get(e);return new Promise((e,n)=>{r.onsuccess=t=>{let r=t.target.result;r?e(r.value):e(void 0)},t.onerror=e=>{n(ez.create("storage-get",{originalErrorMessage:e.target.error?.message}))}})}function e3(e){return`${e.options.appId}-${e.name}`}let e4=new J("@firebase/app-check");async function e5(e){if(R()){let t;try{t=await e2(e3(e))}catch(e){e4.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return t}}function e8(e,t){if(R())return e6(e3(e),t).catch(e=>{e4.warn(`Failed to write token to IndexedDB. Error: ${e}`)});return Promise.resolve()}async function e7(){let e;try{e=await e2(eQ)}catch(e){}if(e)return e;{let e=crypto.randomUUID();return e6(eQ,e).catch(e=>e4.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),e}}function e9(){return eH.enabled}async function te(){if(eH.enabled&&eH.token)return eH.token.promise;throw Error(`
15
- Can't get debug token in production mode.
16
- `)}let tt={error:"UNKNOWN_ERROR"};async function tr(e,t=!1,r=!1){let n,i,s=e.app;eK(s);let a=e$(s),o=a.token;if(o&&!tc(o)&&(a.token=void 0,o=void 0),!o){let e=await a.cachedTokenPromise;e&&(tc(e)?o=e:await e8(s,void 0))}if(!t&&o&&tc(o))return{token:o.token};let c=!1;if(e9())try{a.exchangeTokenPromise||(a.exchangeTokenPromise=eY(eX(s,await te()),e.heartbeatServiceProvider).finally(()=>{a.exchangeTokenPromise=void 0}),c=!0);let t=await a.exchangeTokenPromise;return await e8(s,t),a.token=t,{token:t.token}}catch(e){return"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?e4.warn(e.message):r&&e4.error(e),tl(e)}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().finally(()=>{a.exchangeTokenPromise=void 0}),c=!0),o=await e$(s).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?e4.warn(e.message):r&&e4.error(e),i=e}return o?i?n=tc(o)?{token:o.token,internalError:i}:tl(i):(n={token:o.token},a.token=o,await e8(s,o)):n=tl(i),c&&to(s,n),n}async function tn(e){let t=e.app;eK(t);let{provider:r}=e$(t);if(e9()){let r=await te(),{token:n}=await eY(eX(t,r),e.heartbeatServiceProvider);return{token:n}}{let{token:e}=await r.getToken();return{token:e}}}function ti(e,t,r,n){let{app:i}=e,s=e$(i);if(s.tokenObservers=[...s.tokenObservers,{next:r,error:n,type:t}],s.token&&tc(s.token)){let t=s.token;Promise.resolve().then(()=>{r({token:t.token}),ta(e)}).catch(()=>{})}s.cachedTokenPromise.then(()=>ta(e))}function ts(e,t){let r=e$(e),n=r.tokenObservers.filter(e=>e.next!==t);0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function ta(e){let{app:t}=e,r=e$(t),n=r.tokenRefresher;n||(r.tokenRefresher=n=function(e){let{app:t}=e;return new eW(async()=>{let r;if((r=e$(t).token?await tr(e,!0):await tr(e)).error)throw r.error;if(r.internalError)throw r.internalError},()=>!0,()=>{let e=e$(t);if(!e.token)return 0;{let t=e.token.issuedAtTimeMillis+(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)*.5+3e5;return Math.max(0,(t=Math.min(t,e.token.expireTimeMillis-3e5))-Date.now())}},3e4,96e4)}(e)),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}function to(e,t){for(let r of e$(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function tc(e){return e.expireTimeMillis-Date.now()>0}function tl(e){return{token:f.encodeString(JSON.stringify(tt),!1),error:e}}class tu{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:e}=e$(this.app);for(let t of e)ts(this.app,t.next);return Promise.resolve()}}function th(e,t,r,n,i){r.ready(()=>{var s,a,o,c;let l,u;s=e,a=t,o=r,c=n,l=o.render(c,{sitekey:a,size:"invisible",callback:()=>{e$(s).reCAPTCHAState.succeeded=!0},"error-callback":()=>{e$(s).reCAPTCHAState.succeeded=!1}}),(u=e$(s)).reCAPTCHAState={...u.reCAPTCHAState,widgetId:l},i.resolve(r)})}function td(e){let t=`fire_app_check_${e.name}`,r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function tp(e){eK(e);let t=e$(e).reCAPTCHAState,r=await t.initialized.promise;return new Promise((t,n)=>{let i=e$(e).reCAPTCHAState;r.ready(()=>{t(r.execute(i.widgetId,{action:"fire_app_check"}))})})}class tf{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){let e;tw(this._throttleData);let t=await tp(this._app).catch(e=>{throw ez.create("recaptcha-error")});if(!e$(this._app).reCAPTCHAState?.succeeded)throw ez.create("recaptcha-error");try{e=await eY(function(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${eB}/projects/${r}/apps/${n}:exchangeRecaptchaV3Token?key=${i}`,body:{recaptcha_v3_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){if(e.code?.includes("fetch-status-error"))throw this._throttleData=tg(Number(e.customData?.httpStatus),this._throttleData),ez.create("initial-throttle",{time:eG(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});throw e}return this._throttleData=null,e}initialize(e){var t,r;let n,i,s,a;this._app=e,this._heartbeatServiceProvider=e_(e,"heartbeat");(t=this._siteKey,n=new b,e$(e).reCAPTCHAState={initialized:n},i=td(e),(s=eq(!1))?th(e,t,s,i,n):(r=()=>{let r=eq(!1);if(!r)throw Error("no recaptcha");th(e,t,r,i,n)},(a=document.createElement("script")).src="https://www.google.com/recaptcha/api.js",a.onload=r,document.head.appendChild(a)),n.promise).catch(()=>{})}isEqual(e){return e instanceof tf&&this._siteKey===e._siteKey}}class tm{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){let e;tw(this._throttleData);let t=await tp(this._app).catch(e=>{throw ez.create("recaptcha-error")});if(!e$(this._app).reCAPTCHAState?.succeeded)throw ez.create("recaptcha-error");try{e=await eY(function(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${eB}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${i}`,body:{recaptcha_enterprise_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){if(e.code?.includes("fetch-status-error"))throw this._throttleData=tg(Number(e.customData?.httpStatus),this._throttleData),ez.create("initial-throttle",{time:eG(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});throw e}return this._throttleData=null,e}initialize(e){var t,r;let n,i,s,a;this._app=e,this._heartbeatServiceProvider=e_(e,"heartbeat");(t=this._siteKey,n=new b,e$(e).reCAPTCHAState={initialized:n},i=td(e),(s=eq(!0))?th(e,t,s,i,n):(r=()=>{let r=eq(!0);if(!r)throw Error("no recaptcha");th(e,t,r,i,n)},(a=document.createElement("script")).src="https://www.google.com/recaptcha/enterprise.js",a.onload=r,document.head.appendChild(a)),n.promise).catch(()=>{})}isEqual(e){return e instanceof tm&&this._siteKey===e._siteKey}}function tg(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};{let r=t?t.backoffCount:0,n=function(e,t=1e3,r=2){let n=t*Math.pow(r,e),i=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+i)}(r,1e3,2);return{backoffCount:r+1,allowRequestsAfter:Date.now()+n,httpStatus:e}}}function tw(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw ez.create("throttled",{time:eG(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}async function ty(e,t){let r=await tr(e,t);if(r.error)throw r.error;if(r.internalError)throw r.internalError;return{token:r.token}}let tv="app-check-internal";function t_(){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."}}ev(new V("app-check",e=>new tu(e.getProvider("app").getImmediate(),e.getProvider("heartbeat")),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(tv).initialize()})),ev(new V(tv,e=>{var t;return t=e.getProvider("app-check").getImmediate(),{getToken:e=>tr(t,e),getLimitedUseToken:()=>tn(t),addTokenListener:e=>ti(t,"INTERNAL",e),removeTokenListener:e=>ts(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),eR("@firebase/app-check","0.11.0");let tI=new A("auth","Firebase",t_()),tb=new J("@firebase/auth");function tE(e,...t){tb.logLevel<=i.ERROR&&tb.error(`Auth (${eS}): ${e}`,...t)}function tS(e,...t){throw tP(e,...t)}function tk(e,...t){return tP(e,...t)}function tT(e,t,r){return new A("auth","Firebase",{...t_(),[t]:r}).create(t,{appName:e.name})}function tC(e){return tT(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function tR(e,t,r){if(!(t instanceof r))throw r.name!==t.constructor.name&&tS(e,"argument-error"),tT(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function tP(e,...t){if("string"!=typeof e){let r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return tI.create(e,...t)}function tA(e,t,...r){if(!e)throw tP(t,...r)}function tO(e){let t="INTERNAL ASSERTION FAILED: "+e;throw tE(t),Error(t)}function tN(){return"undefined"!=typeof self&&self.location?.href||""}function tU(){return"http:"===tD()||"https:"===tD()}function tD(){return"undefined"!=typeof self&&self.location?.protocol||null}class tL{constructor(e,t){var r;this.shortDelay=e,this.longDelay=t,r="Short delay should be less than long delay!",t>e||tO(r),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(C())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){let e;return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(tU()||"object"==typeof(e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==e.id||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function tM(e,t){var r,n;r=e.emulator,n="Emulator should always be set here",r||tO(n);let{url:i}=e.emulator;return t?`${i}${t.startsWith("/")?t.slice(1):t}`:i}class tx{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}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 tO("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 tO("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 tO("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let tF={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"},tj=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],tV=new tL(3e4,6e4);function tH(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function t$(e,t,r,n,i={}){return tB(e,i,async()=>{let i={},s={};n&&("GET"===t?s=n:i={body:JSON.stringify(n)});let a=D({key:e.config.apiKey,...s}).slice(1),o=await e._getAdditionalHeaders();o["Content-Type"]="application/json",e.languageCode&&(o["X-Firebase-Locale"]=e.languageCode);let c={method:t,headers:o,...i};return("undefined"==typeof navigator||"Cloudflare-Workers"!==navigator.userAgent)&&(c.referrerPolicy="no-referrer"),e.emulatorConfig&&E(e.emulatorConfig.host)&&(c.credentials="include"),tx.fetch()(await tz(e,e.config.apiHost,r,a),c)})}async function tB(e,t,r){e._canInitEmulator=!1;let n={...tF,...t};try{let t=new tq(e),i=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();let s=await i.json();if("needConfirmation"in s)throw tK(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{let[t,r]=(i.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw tK(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw tK(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw tK(e,"user-disabled",s);let a=n[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(r)throw tT(e,a,r);tS(e,a)}}catch(t){if(t instanceof P)throw t;tS(e,"network-request-failed",{message:String(t)})}}async function tW(e,t,r,n,i={}){let s=await t$(e,t,r,n,i);return"mfaPendingCredential"in s&&tS(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function tz(e,t,r,n){let i=`${t}${r}?${n}`,s=e.config.emulator?tM(e.config,i):`${e.config.apiScheme}://${i}`;return tj.includes(r)&&(await e._persistenceManagerAvailable,"COOKIE"===e._getPersistenceType())?e._getPersistence()._getFinalTarget(s).toString():s}class tq{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(tk(this.auth,"network-request-failed")),tV.get())})}}function tK(e,t,r){let n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);let i=tk(e,t,n);return i.customData._tokenResponse=r,i}function tG(e){return void 0!==e&&void 0!==e.getResponse}function tJ(e){return void 0!==e&&void 0!==e.enterprise}class tY{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)switch(t.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function tX(e){return(await t$(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function tZ(e,t){return t$(e,"GET","/v2/recaptchaConfig",tH(e,t))}async function tQ(e,t){return t$(e,"POST","/v1/accounts:delete",t)}async function t1(e,t){return t$(e,"POST","/v1/accounts:lookup",t)}function t0(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function t6(e,t=!1){let r=j(e),n=await r.getIdToken(t),i=t3(n);tA(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");let s="object"==typeof i.firebase?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:n,authTime:t0(t2(i.auth_time)),issuedAtTime:t0(t2(i.iat)),expirationTime:t0(t2(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function t2(e){return 1e3*Number(e)}function t3(e){let[t,r,n]=e.split(".");if(void 0===t||void 0===r||void 0===n)return tE("JWT malformed, contained fewer than 3 sections"),null;try{let e=y(r);if(!e)return tE("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return tE("Caught error parsing JWT payload as JSON",e?.toString()),null}}function t4(e){let t=t3(e);return tA(t,"internal-error"),tA(void 0!==t.exp,"internal-error"),tA(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function t5(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof P&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class t8{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(!e)return this.errorBackoff=3e4,Math.max(0,(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class t7{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=t0(this.lastLoginAt),this.creationTime=t0(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function t9(e){var t,r;let n=e.auth,i=await e.getIdToken(),s=await t5(e,t1(n,{idToken:i}));tA(s?.users.length,n,"internal-error");let a=s.users[0];e._notifyReloadListener(a);let o=a.providerUserInfo?.length?rt(a.providerUserInfo):[],c=(t=e.providerData,r=o,[...t.filter(e=>!r.some(t=>t.providerId===e.providerId)),...r]),l=e.isAnonymous,u=!(e.email&&a.passwordHash)&&!c?.length;Object.assign(e,{uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:c,metadata:new t7(a.createdAt,a.lastLoginAt),isAnonymous:!!l&&u})}async function re(e){let t=j(e);await t9(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function rt(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function rr(e,t){let r=await tB(e,{},async()=>{let r=D({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:i}=e.config,s=await tz(e,n,"/v1/token",`key=${i}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let o={method:"POST",headers:a,body:r};return e.emulatorConfig&&E(e.emulatorConfig.host)&&(o.credentials="include"),tx.fetch()(s,o)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function rn(e,t){return t$(e,"POST","/v2/accounts:revokeToken",tH(e,t))}class ri{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){tA(e.idToken,"internal-error"),tA(void 0!==e.idToken,"internal-error"),tA(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):t4(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){tA(0!==e.length,"internal-error");let t=t4(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(tA(this.refreshToken,e,"user-token-expired"),this.refreshToken)?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:r,refreshToken:n,expiresIn:i}=await rr(e,t);this.updateTokensAndExpiration(r,n,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){let{refreshToken:r,accessToken:n,expirationTime:i}=t,s=new ri;return r&&(tA("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),n&&(tA("string"==typeof n,"internal-error",{appName:e}),s.accessToken=n),i&&(tA("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ri,this.toJSON())}_performRefresh(){return tO("not implemented")}}function rs(e,t){tA("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ra{constructor({uid:e,auth:t,stsTokenManager:r,...n}){this.providerId="firebase",this.proactiveRefresh=new t8(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=n.displayName||null,this.email=n.email||null,this.emailVerified=n.emailVerified||!1,this.phoneNumber=n.phoneNumber||null,this.photoURL=n.photoURL||null,this.isAnonymous=n.isAnonymous||!1,this.tenantId=n.tenantId||null,this.providerData=n.providerData?[...n.providerData]:[],this.metadata=new t7(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let t=await t5(this,this.stsTokenManager.getToken(this.auth,e));return tA(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return t6(this,e)}reload(){return re(this)}_assign(e){this!==e&&(tA(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new ra({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){tA(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await t9(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(eI(this.auth.app))return Promise.reject(tC(this.auth));let e=await this.getIdToken();return await t5(this,tQ(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){let r=t.displayName??void 0,n=t.email??void 0,i=t.phoneNumber??void 0,s=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,c=t.createdAt??void 0,l=t.lastLoginAt??void 0,{uid:u,emailVerified:h,isAnonymous:d,providerData:p,stsTokenManager:f}=t;tA(u&&f,e,"internal-error");let m=ri.fromJSON(this.name,f);tA("string"==typeof u,e,"internal-error"),rs(r,e.name),rs(n,e.name),tA("boolean"==typeof h,e,"internal-error"),tA("boolean"==typeof d,e,"internal-error"),rs(i,e.name),rs(s,e.name),rs(a,e.name),rs(o,e.name),rs(c,e.name),rs(l,e.name);let g=new ra({uid:u,auth:e,email:n,emailVerified:h,displayName:r,isAnonymous:d,photoURL:s,phoneNumber:i,tenantId:a,stsTokenManager:m,createdAt:c,lastLoginAt:l});return p&&Array.isArray(p)&&(g.providerData=p.map(e=>({...e}))),o&&(g._redirectEventId=o),g}static async _fromIdTokenResponse(e,t,r=!1){let n=new ri;n.updateFromServerResponse(t);let i=new ra({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await t9(i),i}static async _fromGetAccountInfoResponse(e,t,r){let n=t.users[0];tA(void 0!==n.localId,"internal-error");let i=void 0!==n.providerUserInfo?rt(n.providerUserInfo):[],s=!(n.email&&n.passwordHash)&&!i?.length,a=new ri;a.updateFromIdToken(r);let o=new ra({uid:n.localId,auth:e,stsTokenManager:a,isAnonymous:s});return Object.assign(o,{uid:n.localId,displayName:n.displayName||null,photoURL:n.photoUrl||null,email:n.email||null,emailVerified:n.emailVerified||!1,phoneNumber:n.phoneNumber||null,tenantId:n.tenantId||null,providerData:i,metadata:new t7(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash)&&!i?.length}),o}}let ro=new Map;function rc(e){var t,r;t="Expected a class definition",e instanceof Function||tO(t);let n=ro.get(e);return n?(r="Instance stored in cache mismatched with class",n instanceof e||tO(r)):(n=new e,ro.set(e,n)),n}class rl{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}function ru(e,t,r){return`firebase:${e}:${t}:${r}`}rl.type="NONE";class rh{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:i}=this.auth;this.fullUserKey=ru(this.userKey,n.apiKey,i),this.fullPersistenceKey=ru("persistence",n.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){let t=await t1(this.auth,{idToken:e}).catch(()=>void 0);return t?ra._fromGetAccountInfoResponse(this.auth,t,e):null}return ra._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new rh(rc(rl),e,r);let n=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),i=n[0]||rc(rl),s=ru(r,e.config.apiKey,e.name),a=null;for(let r of t)try{let t=await r._get(s);if(t){let n;if("string"==typeof t){let r=await t1(e,{idToken:t}).catch(()=>void 0);if(!r)break;n=await ra._fromGetAccountInfoResponse(e,r,t)}else n=ra._fromJSON(e,t);r!==i&&(a=n),i=r;break}}catch{}let o=n.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&o.length&&(i=o[0],a&&await i._set(s,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch{}}))),new rh(i,e,r)}}function rd(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";{if(rg(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(rp(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ry(t))return"Blackberry";if(rv(t))return"Webos";if(rf(t))return"Safari";if((t.includes("chrome/")||rm(t))&&!t.includes("edge/"))return"Chrome";if(rw(t))return"Android";let r=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if(r?.length===2)return r[1]}return"Other"}function rp(e=C()){return/firefox\//i.test(e)}function rf(e=C()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function rm(e=C()){return/crios\//i.test(e)}function rg(e=C()){return/iemobile/i.test(e)}function rw(e=C()){return/android/i.test(e)}function ry(e=C()){return/blackberry/i.test(e)}function rv(e=C()){return/webos/i.test(e)}function r_(e=C()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function rI(e=C()){return r_(e)||rw(e)||rv(e)||ry(e)||/windows phone/i.test(e)||rg(e)}function rb(e,t=[]){let r;switch(e){case"Browser":r=rd(C());break;case"Worker":r=`${rd(C())}-${e}`;break;default:r=e}let n=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${eS}/${n}`}class rE{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let r=t=>new Promise((r,n)=>{try{let n=e(t);r(n)}catch(e){n(e)}});r.onAbort=t,this.queue.push(r);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}async function rS(e,t={}){return t$(e,"GET","/v2/passwordPolicy",tH(e,t))}class rk{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let r=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),n&&(t.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,t){let r;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let n=0;n<e.length;n++)r=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,n,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class rT{constructor(e,t,r,n){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new rC(this),this.idTokenSubscription=new rC(this),this.beforeStateQueue=new rE(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=tI,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=rc(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){if(this.persistenceManager=await rh.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await t1(this,{idToken:e}),r=await ra._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(eI(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),r=t,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let t=this.redirectUser?._redirectEventId,i=r?._redirectEventId,s=await this.tryRedirectSignIn(e);(!t||t===i)&&s?.user&&(r=s.user,n=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return(tA(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId)?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await t9(e)}catch(e){if(e?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(eI(this.app))return Promise.reject(tC(this));let t=e?j(e):null;return t&&tA(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&tA(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return eI(this.app)?Promise.reject(tC(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return eI(this.app)?Promise.reject(tC(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(rc(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new rk(await rS(this));null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new A("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await rn(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&rc(e)||this._popupRedirectResolver;tA(t,this,"argument-error"),this.redirectPersistenceManager=await rh.create(this,[rc(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return(this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e)?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};let i="function"==typeof t?t:t.next.bind(t),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(tA(a,this,"internal-error"),a.then(()=>{s||i(this.currentUser)}),"function"==typeof t){let i=e.addObserver(t,r,n);return()=>{s=!0,i()}}{let r=e.addObserver(t);return()=>{s=!0,r()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return tA(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=rb(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(eI(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&function(e,...t){tb.logLevel<=i.WARN&&tb.warn(`Auth (${eS}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}class rC{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){let r=new x(e,void 0);return r.subscribe.bind(r)}(e=>this.observer=e)}get next(){return tA(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let rR={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function rP(e){return rR.loadJS(e)}function rA(e){return`__${e}${Math.floor(1e6*Math.random())}`}class rO{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){let r=this.counter;return this._widgets.set(r,new rD(e,this.auth.name,t||{})),this.counter++,r}reset(e){let t=e||1e12;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){return this._widgets.get(e||1e12)?.getResponse()||""}async execute(e){return this._widgets.get(e||1e12)?.execute(),""}}class rN{constructor(){this.enterprise=new rU}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class rU{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class rD{constructor(e,t,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const n="string"==typeof e?document.getElementById(e):e;tA(n,"argument-error",{appName:t}),this.container=n,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout(()=>{this.responseToken=function(e){let t=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<50;e++)t.push(r.charAt(Math.floor(Math.random()*r.length)));return t.join("")}(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw Error("reCAPTCHA mock was already deleted!")}}let rL="NO_RECAPTCHA";class rM{constructor(e){this.type="recaptcha-enterprise",this.auth=j(e)}async verify(e="verify",t=!1){async function r(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,r)=>{tZ(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(n=>{if(void 0===n.recaptchaKey)r(Error("recaptcha Enterprise site key undefined"));else{let r=new tY(n);return null==e.tenantId?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,t(r.siteKey)}}).catch(e=>{r(e)})})}function n(t,r,n){let i=window.grecaptcha;tJ(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{r(e)}).catch(()=>{r(rL)})}):n(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new rN().execute("siteKey",{action:"verify"}):new Promise((e,i)=>{r(this.auth).then(r=>{if(!t&&tJ(window.grecaptcha))n(r,e,i);else{if("undefined"==typeof window)return void i(Error("RecaptchaVerifier is only supported in browser"));let t=rR.recaptchaEnterpriseScript;0!==t.length&&(t+=r),rP(t).then(()=>{n(r,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function rx(e,t,r,n=!1,i=!1){let s,a=new rM(e);if(i)s=rL;else try{s=await a.verify(r)}catch(e){s=await a.verify(r,!0)}let o={...t};if("mfaSmsEnrollment"===r||"mfaSmsSignIn"===r){if("phoneEnrollmentInfo"in o){let e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){let e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return n?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function rF(e,t,r,n,i){if("EMAIL_PASSWORD_PROVIDER"===i)if(!e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))return n(e,t).catch(async i=>{if("auth/missing-recaptcha-token"!==i.code)return Promise.reject(i);{console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let i=await rx(e,t,r,"getOobCode"===r);return n(e,i)}});else{let i=await rx(e,t,r,"getOobCode"===r);return n(e,i)}if("PHONE_PROVIDER"!==i)return Promise.reject(i+" provider is not supported.");if(e._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let i=await rx(e,t,r);return n(e,i).catch(async i=>{if(e._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&("auth/missing-recaptcha-token"===i.code||"auth/invalid-app-credential"===i.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${r} flow.`);let i=await rx(e,t,r,!1,!0);return n(e,i)}return Promise.reject(i)})}{let i=await rx(e,t,r,!1,!0);return n(e,i)}}async function rj(e){let t=j(e),r=new tY(await tZ(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==t.tenantId?t._agentRecaptchaConfig=r:t._tenantRecaptchaConfigs[t.tenantId]=r,r.isAnyProviderEnabled()&&new rM(t).verify()}function rV(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function rH(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class r${constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return tO("not implemented")}_getIdTokenResponse(e){return tO("not implemented")}_linkToIdToken(e,t){return tO("not implemented")}_getReauthenticationResolver(e){return tO("not implemented")}}async function rB(e,t){return t$(e,"POST","/v1/accounts:signUp",t)}async function rW(e,t){return tW(e,"POST","/v1/accounts:signInWithPassword",tH(e,t))}async function rz(e,t){return t$(e,"POST","/v1/accounts:sendOobCode",tH(e,t))}async function rq(e,t){return rz(e,t)}async function rK(e,t){return tW(e,"POST","/v1/accounts:signInWithEmailLink",tH(e,t))}async function rG(e,t){return tW(e,"POST","/v1/accounts:signInWithEmailLink",tH(e,t))}class rJ extends r${constructor(e,t,r,n=null){super("password",r),this._email=e,this._password=t,this._tenantId=n}static _fromEmailAndPassword(e,t){return new rJ(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new rJ(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if(t?.email&&t?.password){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);else if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return rF(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",rW,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return rK(e,{email:this._email,oobCode:this._password});default:tS(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return rF(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",rB,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return rG(e,{idToken:t,email:this._email,oobCode:this._password});default:tS(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function rY(e,t){return tW(e,"POST","/v1/accounts:signInWithIdp",tH(e,t))}class rX extends r${constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new rX(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):tS("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let{providerId:t,signInMethod:r,...n}="string"==typeof e?JSON.parse(e):e;if(!t||!r)return null;let i=new rX(t,r);return i.idToken=n.idToken||void 0,i.accessToken=n.accessToken||void 0,i.secret=n.secret,i.nonce=n.nonce,i.pendingToken=n.pendingToken||null,i}_getIdTokenResponse(e){return rY(e,this.buildRequest())}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,rY(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,rY(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=D(t)}return e}}async function rZ(e,t){return t$(e,"POST","/v1/accounts:sendVerificationCode",tH(e,t))}async function rQ(e,t){return tW(e,"POST","/v1/accounts:signInWithPhoneNumber",tH(e,t))}async function r1(e,t){let r=await tW(e,"POST","/v1/accounts:signInWithPhoneNumber",tH(e,t));if(r.temporaryProof)throw tK(e,"account-exists-with-different-credential",r);return r}let r0={USER_NOT_FOUND:"user-not-found"};async function r6(e,t){return tW(e,"POST","/v1/accounts:signInWithPhoneNumber",tH(e,{...t,operation:"REAUTH"}),r0)}class r2 extends r${constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new r2({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new r2({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return rQ(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return r1(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return r6(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:n}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:n}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}=e;return r||t||n||i?new r2({verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}):null}}class r3{constructor(e){const t=L(M(e)),r=t.apiKey??null,n=t.oobCode??null,i=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(t.mode??null);tA(r&&n&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=n,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t,r,n,i=(r=(t=L(M(e)).link)?L(M(t)).deep_link_id:null,((n=L(M(e)).deep_link_id)?L(M(n)).link:null)||n||r||t||e);try{return new r3(i)}catch{return null}}}class r4{constructor(){this.providerId=r4.PROVIDER_ID}static credential(e,t){return rJ._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let r=r3.parseLink(t);return tA(r,"argument-error"),rJ._fromEmailAndCode(e,r.code,r.tenantId)}}r4.PROVIDER_ID="password",r4.EMAIL_PASSWORD_SIGN_IN_METHOD="password",r4.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class r5{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class r8 extends r5{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class r7 extends r8{static credentialFromJSON(e){let t="string"==typeof e?JSON.parse(e):e;return tA("providerId"in t&&"signInMethod"in t,"argument-error"),rX._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return tA(e.idToken||e.accessToken,"argument-error"),rX._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return r7.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return r7.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:n,pendingToken:i,nonce:s,providerId:a}=e;if(!r&&!n&&!t&&!i||!a)return null;try{return new r7(a)._credential({idToken:t,accessToken:r,nonce:s,pendingToken:i})}catch(e){return null}}}class r9 extends r8{constructor(){super("facebook.com")}static credential(e){return rX._fromParams({providerId:r9.PROVIDER_ID,signInMethod:r9.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return r9.credentialFromTaggedObject(e)}static credentialFromError(e){return r9.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return r9.credential(e.oauthAccessToken)}catch{return null}}}r9.FACEBOOK_SIGN_IN_METHOD="facebook.com",r9.PROVIDER_ID="facebook.com";class ne extends r8{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return rX._fromParams({providerId:ne.PROVIDER_ID,signInMethod:ne.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ne.credentialFromTaggedObject(e)}static credentialFromError(e){return ne.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return ne.credential(t,r)}catch{return null}}}ne.GOOGLE_SIGN_IN_METHOD="google.com",ne.PROVIDER_ID="google.com";class nt extends r8{constructor(){super("github.com")}static credential(e){return rX._fromParams({providerId:nt.PROVIDER_ID,signInMethod:nt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return nt.credentialFromTaggedObject(e)}static credentialFromError(e){return nt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return nt.credential(e.oauthAccessToken)}catch{return null}}}nt.GITHUB_SIGN_IN_METHOD="github.com",nt.PROVIDER_ID="github.com";class nr extends r8{constructor(){super("twitter.com")}static credential(e,t){return rX._fromParams({providerId:nr.PROVIDER_ID,signInMethod:nr.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return nr.credentialFromTaggedObject(e)}static credentialFromError(e){return nr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return nr.credential(t,r)}catch{return null}}}async function nn(e,t){return tW(e,"POST","/v1/accounts:signUp",tH(e,t))}nr.TWITTER_SIGN_IN_METHOD="twitter.com",nr.PROVIDER_ID="twitter.com";class ni{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,n=!1){return new ni({user:await ra._fromIdTokenResponse(e,r,n),providerId:ns(r),_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){return await e._updateTokensIfNecessary(r,!0),new ni({user:e,providerId:ns(r),_tokenResponse:r,operationType:t})}}function ns(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class na extends P{constructor(e,t,r,n){super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,na.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new na(e,t,r,n)}}function no(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch(r=>{if("auth/multi-factor-auth-required"===r.code)throw na._fromErrorAndOperation(e,r,t,n);throw r})}async function nc(e,t,r=!1){let n=await t5(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return ni._forOperation(e,"link",n)}async function nl(e,t,r=!1){let{auth:n}=e;if(eI(n.app))return Promise.reject(tC(n));let i="reauthenticate";try{let s=await t5(e,no(n,i,t,e),r);tA(s.idToken,n,"internal-error");let a=t3(s.idToken);tA(a,n,"internal-error");let{sub:o}=a;return tA(e.uid===o,n,"user-mismatch"),ni._forOperation(e,i,s)}catch(e){throw e?.code==="auth/user-not-found"&&tS(n,"user-mismatch"),e}}async function nu(e,t,r=!1){if(eI(e.app))return Promise.reject(tC(e));let n="signIn",i=await no(e,n,t),s=await ni._fromIdTokenResponse(e,n,i);return r||await e._updateCurrentUser(s.user),s}async function nh(e,t){return nu(j(e),t)}class nd{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?np._fromServerResponse(e,t):"totpInfo"in t?nf._fromServerResponse(e,t):tS(e,"internal-error")}}class np extends nd{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new np(t)}}class nf extends nd{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new nf(t)}}async function nm(e){let t=j(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function ng(e,t,r){if(eI(e.app))return Promise.reject(tC(e));let n=j(e),i=rF(n,{returnSecureToken:!0,email:t,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",nn,"EMAIL_PASSWORD_PROVIDER"),s=await i.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&nm(e),t}),a=await ni._fromIdTokenResponse(n,"signIn",s);return await n._updateCurrentUser(a.user),a}function nw(e,t,r){return eI(e.app)?Promise.reject(tC(e)):nh(j(e),r4.credential(t,r)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&nm(e),t})}async function ny(e,t){var r;let n=j(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&(r=n.auth,tA(t.url?.length>0,r,"invalid-continue-uri"),tA(void 0===t.dynamicLinkDomain||t.dynamicLinkDomain.length>0,r,"invalid-dynamic-link-domain"),tA(void 0===t.linkDomain||t.linkDomain.length>0,r,"invalid-hosting-link-domain"),i.continueUrl=t.url,i.dynamicLinkDomain=t.dynamicLinkDomain,i.linkDomain=t.linkDomain,i.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(tA(t.iOS.bundleId.length>0,r,"missing-ios-bundle-id"),i.iOSBundleId=t.iOS.bundleId),t.android&&(tA(t.android.packageName.length>0,r,"missing-android-pkg-name"),i.androidInstallApp=t.android.installApp,i.androidMinimumVersionCode=t.android.minimumVersion,i.androidPackageName=t.android.packageName));let{email:s}=await rq(n.auth,i);s!==e.email&&await e.reload()}function nv(e,t,r,n){return j(e).onIdTokenChanged(t,r,n)}function n_(e,t,r,n){return j(e).onAuthStateChanged(t,r,n)}function nI(e,t){return t$(e,"POST","/v2/accounts/mfaEnrollment:start",tH(e,t))}new WeakMap;let nb="__sak";class nE{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(nb,"1"),this.storage.removeItem(nb),Promise.resolve(!0)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class nS extends nE{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=rI(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){let r;if(!e.key)return void this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)});let n=e.key;t?this.detachListener():this.stopPolling();let i=()=>{let e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);((r=C()).indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0)&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}nS.type="LOCAL";class nk extends nE{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}nk.type="SESSION";class nT{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let r=new nT(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:r,data:n}=e.data,i=this.handlersMap[r];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:r});let s=Array.from(i).map(async t=>t(e.origin,n)),a=await Promise.all(s.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function nC(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}nT.receivers=[];function nR(){return window}function nP(e,t){return t$(e,"POST","/v2/accounts/mfaSignIn:start",tH(e,t))}let nA=rA("rcb"),nO=new tL(3e4,6e4);class nN{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!nR().grecaptcha?.render}load(e,t=""){var r;return(tA((r=t).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(r),e,"argument-error"),this.shouldResolveImmediately(t)&&tG(nR().grecaptcha))?Promise.resolve(nR().grecaptcha):new Promise((r,n)=>{let i=nR().setTimeout(()=>{n(tk(e,"network-request-failed"))},nO.get());nR()[nA]=()=>{nR().clearTimeout(i),delete nR()[nA];let s=nR().grecaptcha;if(!s||!tG(s))return void n(tk(e,"internal-error"));let a=s.render;s.render=(e,t)=>{let r=a(e,t);return this.counter++,r},this.hostLanguage=t,r(s)},rP(`${rR.recaptchaV2Script}?${D({onload:nA,render:"explicit",hl:t})}`).catch(()=>{clearTimeout(i),n(tk(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!nR().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}class nU{async load(e){return new rO(e)}clearedOneInstance(){}}let nD="recaptcha",nL={theme:"light",type:"image"};class nM{constructor(e,t,r={...nL}){this.parameters=r,this.type=nD,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=j(e),this.isInvisible="invisible"===this.parameters.size,tA("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");const n="string"==typeof t?document.getElementById(t):t;tA(n,this.auth,"argument-error"),this.container=n,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new nU:new nN,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),r=t.getResponse(e);return r||new Promise(r=>{let n=e=>{e&&(this.tokenChangeListeners.delete(n),r(e))};this.tokenChangeListeners.add(n),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){tA(!this.parameters.sitekey,this.auth,"argument-error"),tA(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),tA("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof e)e(t);else if("string"==typeof e){let r=nR()[e];"function"==typeof r&&r(t)}}}assertNotDestroyed(){tA(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){let e;tA(tU()&&(void 0===nR().WorkerGlobalScope||"function"!=typeof nR().importScripts),this.auth,"internal-error"),await (e=null,new Promise(t=>{"complete"===document.readyState?t():(e=()=>t(),window.addEventListener("load",e))}).catch(t=>{throw e&&window.removeEventListener("load",e),t})),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let t=await tX(this.auth);tA(t,this.auth,"internal-error"),this.parameters.sitekey=t}getAssertedRecaptcha(){return tA(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class nx{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=r2._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function nF(e,t,r){if(eI(e.app))return Promise.reject(tC(e));let n=j(e);return new nx(await nj(n,t,j(r)),e=>nh(n,e))}async function nj(e,t,r){if(!e._getRecaptchaConfig())try{await rj(e)}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let n;if(n="string"==typeof t?{phoneNumber:t}:t,"session"in n){let t=n.session;if("phoneNumber"in n){tA("enroll"===t.type,e,"internal-error");let i={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===rL){tA(r?.type===nD,e,"argument-error");let n=await nV(e,t,r);return nI(e,n)}return nI(e,t)},a=rF(e,i,"mfaSmsEnrollment",s,"PHONE_PROVIDER");return(await a.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{tA("signin"===t.type,e,"internal-error");let i=n.multiFactorHint?.uid||n.multiFactorUid;tA(i,e,"missing-multi-factor-info");let s={mfaPendingCredential:t.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===rL){tA(r?.type===nD,e,"argument-error");let n=await nV(e,t,r);return nP(e,n)}return nP(e,t)},o=rF(e,s,"mfaSmsSignIn",a,"PHONE_PROVIDER");return(await o.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{let t={phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"},i=async(e,t)=>{if(t.captchaResponse===rL){tA(r?.type===nD,e,"argument-error");let n=await nV(e,t,r);return rZ(e,n)}return rZ(e,t)},s=rF(e,t,"sendVerificationCode",i,"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{r?._reset()}}async function nV(e,t,r){tA(r.type===nD,e,"argument-error");let n=await r.verify();tA("string"==typeof n,e,"argument-error");let i={...t};if("phoneEnrollmentInfo"in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,r=i.phoneEnrollmentInfo.clientType,s=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n,captchaResponse:t,clientType:r,recaptchaVersion:s}}),i}if(!("phoneSignInInfo"in i))return Object.assign(i,{recaptchaToken:n}),i;{let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,r=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:n,captchaResponse:e,clientType:t,recaptchaVersion:r}}),i}}class nH{constructor(e){this.providerId=nH.PROVIDER_ID,this.auth=j(e)}verifyPhoneNumber(e,t){return nj(this.auth,e,j(t))}static credential(e,t){return r2._fromVerification(e,t)}static credentialFromResult(e){return nH.credentialFromTaggedObject(e)}static credentialFromError(e){return nH.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:r}=e;return t&&r?r2._fromTokenResponse(t,r):null}}function n$(e,t){return t?rc(t):(tA(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}nH.PROVIDER_ID="phone",nH.PHONE_SIGN_IN_METHOD="phone";class nB extends r${constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rY(e,this._buildIdpRequest())}_linkToIdToken(e,t){return rY(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return rY(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function nW(e){return nu(e.auth,new nB(e),e.bypassAuthState)}function nz(e){let{auth:t,user:r}=e;return tA(r,t,"internal-error"),nl(r,new nB(e),e.bypassAuthState)}async function nq(e){let{auth:t,user:r}=e;return tA(r,t,"internal-error"),nc(r,new nB(e),e.bypassAuthState)}class nK{constructor(e,t,r,n,i=!1){this.auth=e,this.resolver=r,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:r,postBody:n,tenantId:i,error:s,type:a}=e;if(s)return void this.reject(s);let o={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return nW;case"linkViaPopup":case"linkViaRedirect":return nq;case"reauthViaPopup":case"reauthViaRedirect":return nz;default:tS(this.auth,"internal-error")}}resolve(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||tO(r),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||tO(r),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let nG=new tL(2e3,1e4);async function nJ(e,t,r){if(eI(e.app))return Promise.reject(tk(e,"operation-not-supported-in-this-environment"));let n=j(e);tR(e,t,r5);let i=n$(n,r);return new nY(n,"signInViaPopup",t,i).executeNotNull()}class nY extends nK{constructor(e,t,r,n,i){super(e,t,n,i),this.provider=r,this.authWindow=null,this.pollId=null,nY.currentPopupAction&&nY.currentPopupAction.cancel(),nY.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return tA(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||tO(t);let r=nC();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],r),this.authWindow.associatedEvent=r,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(tk(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(tk(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,nY.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(tk(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,nG.get())};e()}}nY.currentPopupAction=null;let nX=new Map;class nZ extends nK{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=nX.get(this.auth._key());if(!e){try{let t=await nQ(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}nX.set(this.auth._key(),e)}return this.bypassAuthState||nX.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type)return void this.resolve(null);if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function nQ(e,t){let r=n2(t),n=n6(e);if(!await n._isAvailable())return!1;let i=await n._get(r)==="true";return await n._remove(r),i}async function n1(e,t){return n6(e)._set(n2(t),"true")}function n0(e,t){nX.set(e._key(),t)}function n6(e){return rc(e._redirectPersistence)}function n2(e){return ru("pendingRedirect",e.config.apiKey,e.name)}function n3(e,t,r){return n4(e,t,r)}async function n4(e,t,r){if(eI(e.app))return Promise.reject(tC(e));let n=j(e);tR(e,t,r5),await n._initializationPromise;let i=n$(n,r);return await n1(i,n),i._openRedirect(n,t,"signInViaRedirect")}async function n5(e,t){return await j(e)._initializationPromise,n8(e,t,!1)}async function n8(e,t,r=!1){if(eI(e.app))return Promise.reject(tC(e));let n=j(e),i=n$(n,t),s=new nZ(n,i,r),a=await s.execute();return a&&!r&&(delete a.user._redirectEventId,await n._persistUserIfCurrent(a.user),await n._setRedirectUser(null,t)),a}class n7{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ie(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!ie(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(tk(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(n9(e))}saveEventToCache(e){this.cachedEventUids.add(n9(e)),this.lastProcessedEventTime=Date.now()}}function n9(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function ie({type:e,error:t}){return"unknown"===e&&t?.code==="auth/no-auth-event"}async function it(e,t={}){return t$(e,"GET","/v1/projects",t)}let ir=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ii=/^https?/;async function is(e){if(e.config.emulator)return;let{authorizedDomains:t}=await it(e);for(let e of t)try{if(function(e){let t=tN(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){let i=new URL(e);return""===i.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&i.hostname===n}if(!ii.test(r))return!1;if(ir.test(e))return n===e;let i=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}(e))return}catch{}tS(e,"unauthorized-domain")}let ia=new tL(3e4,6e4);function io(){let e=nR().___jsl;if(e?.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let ic=null,il=new tL(5e3,15e3),iu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ih=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function id(e){let t,r,n,i,s,a=await (ic=ic||new Promise((t,r)=>{function n(){io(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{io(),r(tk(e,"network-request-failed"))},timeout:ia.get()})}if(nR().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else if(nR().gapi?.load)n();else{let t=rA("iframefcb");return nR()[t]=()=>{gapi.load?n():r(tk(e,"network-request-failed"))},rP(`${rR.gapiScript}?onload=${t}`).catch(e=>r(e))}}).catch(e=>{throw ic=null,e})),o=nR().gapi;return tA(o,e,"internal-error"),a.open({where:document.body,url:(tA((t=e.config).authDomain,e,"auth-domain-config-required"),r=t.emulator?tM(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:eS},(i=ih.get(e.config.apiHost))&&(n.eid=i),(s=e._getFrameworks()).length&&(n.fw=s.join(",")),`${r}?${D(n).slice(1)}`),messageHandlersFilter:o.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:iu,dontclear:!0},t=>new Promise(async(r,n)=>{await t.restyle({setHideOnLeave:!1});let i=tk(e,"network-request-failed"),s=nR().setTimeout(()=>{n(i)},il.get());function a(){nR().clearTimeout(s),r(t)}t.ping(a).then(a,()=>{n(i)})}))}let ip={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class im{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let ig=encodeURIComponent("fac");async function iw(e,t,r,n,i,s){tA(e.config.authDomain,e,"auth-domain-config-required"),tA(e.config.apiKey,e,"invalid-api-key");let a={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:eS,eventId:i};if(t instanceof r5)for(let[r,n]of(t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",!function(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())&&(a.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(s||{})))a[r]=n;if(t instanceof r8){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(a.scopes=e.join(","))}for(let t of(e.tenantId&&(a.tid=e.tenantId),Object.keys(a)))void 0===a[t]&&delete a[t];let o=await e._getAppCheckToken(),c=o?`#${ig}=${encodeURIComponent(o)}`:"";return`${function({config:e}){return e.emulator?tM(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${D(a).slice(1)}${c}`}let iy="webStorageSupport",iv=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=nk,this._completeRedirectFn=n8,this._overrideRedirectResult=n0}async _openPopup(e,t,r,n){var i,s;i=this.eventManagers[e._key()]?.manager,s="_initialize() not called before _openPopup()",i||tO(s);let a=await iw(e,t,r,tN(),n);return function(e,t,r,n=500,i=600){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-n)/2,0).toString(),o="",c={...ip,width:n.toString(),height:i.toString(),top:s,left:a},l=C().toLowerCase();r&&(o=rm(l)?"_blank":r),rp(l)&&(t=t||"http://localhost",c.scrollbars="yes");let u=Object.entries(c).reduce((e,[t,r])=>`${e}${t}=${r},`,"");if(function(e=C()){return r_(e)&&!!window.navigator?.standalone}(l)&&"_self"!==o){var h,d;let e,r;return h=t||"",d=o,(e=document.createElement("a")).href=h,e.target=d,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),e.dispatchEvent(r),new im(null)}let p=window.open(t||"",o,u);tA(p,e,"popup-blocked");try{p.focus()}catch(e){}return new im(p)}(e,a,nC())}async _openRedirect(e,t,r,n){var i;return await this._originValidation(e),i=await iw(e,t,r,tN(),n),nR().location.href=i,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var r;let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(r="If manager is not set, promise should be",n||tO(r),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await id(e),r=new n7(e);return t.register("authEvent",t=>(tA(t?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(iy,{type:iy},r=>{let n=r?.[0]?.[iy];void 0!==n&&t(!!n),tS(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=is(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return rI()||rf()||r_()}};var i_="@firebase/auth",iI="1.11.1";class ib{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return(this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser)?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){tA(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}_()?._authIdTokenMaxAge,rR={loadJS:e=>new Promise((t,r)=>{let n=document.createElement("script");n.setAttribute("src",e),n.onload=t,n.onerror=e=>{let t=tk("internal-error");t.customData=e,r(t)},n.type="text/javascript",n.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(n)}),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="},a="Browser",ev(new V("auth",(e,{options:t})=>{let r,n,i=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:c,authDomain:l}=i.options;tA(c&&!c.includes(":"),"invalid-api-key",{appName:i.name});let u=new rT(i,s,o,{apiKey:c,authDomain:l,clientPlatform:a,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:rb(a)});return n=(Array.isArray(r=t?.persistence||[])?r:[r]).map(rc),t?.errorMap&&u._updateErrorMap(t.errorMap),u._initializeWithPersistence(n,t?.popupRedirectResolver),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),ev(new V("auth-internal",e=>new ib(j(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),eR(i_,iI,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(a)),eR(i_,iI,"esm2020");let iE="@firebase/installations",iS="0.6.19",ik=`w:${iS}`,iT="FIS_v2",iC=new A("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function iR(e){return e instanceof P&&e.code.includes("request-failed")}function iP({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function iA(e){return{token:e.token,requestStatus:2,expiresIn:Number(e.expiresIn.replace("s","000")),creationTime:Date.now()}}async function iO(e,t){let r=(await t.json()).error;return iC.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function iN({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}async function iU(e){let t=await e();return t.status>=500&&t.status<600?e():t}async function iD({appConfig:e,heartbeatServiceProvider:t},{fid:r}){let n=iP(e),i=iN(e),s=t.getImmediate({optional:!0});if(s){let e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}let a={method:"POST",headers:i,body:JSON.stringify({fid:r,authVersion:iT,appId:e.appId,sdkVersion:ik})},o=await iU(()=>fetch(n,a));if(o.ok){let e=await o.json();return{fid:e.fid||r,registrationStatus:2,refreshToken:e.refreshToken,authToken:iA(e.authToken)}}throw await iO("Create Installation",o)}function iL(e){return new Promise(t=>{setTimeout(t,e)})}let iM=/^[cdef][\w-]{21}$/;function ix(e){return`${e.appName}!${e.appId}`}let iF=new Map;function ij(e,t){var r,n;let i,s=ix(e);iV(s,t),r=s,n=t,(i=(!iH&&"BroadcastChannel"in self&&((iH=new BroadcastChannel("[Firebase] FID Change")).onmessage=e=>{iV(e.data.key,e.data.fid)}),iH))&&i.postMessage({key:r,fid:n}),0===iF.size&&iH&&(iH.close(),iH=null)}function iV(e,t){let r=iF.get(e);if(r)for(let e of r)e(t)}let iH=null,i$="firebase-installations-store",iB=null;function iW(){return iB||(iB=ei("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(i$)}})),iB}async function iz(e,t){let r=ix(e),n=(await iW()).transaction(i$,"readwrite"),i=n.objectStore(i$),s=await i.get(r);return await i.put(t,r),await n.done,s&&s.fid===t.fid||ij(e,t.fid),t}async function iq(e){let t=ix(e),r=(await iW()).transaction(i$,"readwrite");await r.objectStore(i$).delete(t),await r.done}async function iK(e,t){let r=ix(e),n=(await iW()).transaction(i$,"readwrite"),i=n.objectStore(i$),s=await i.get(r),a=t(s);return void 0===a?await i.delete(r):await i.put(a,r),await n.done,a&&(!s||s.fid!==a.fid)&&ij(e,a.fid),a}async function iG(e){let t,r=await iK(e.appConfig,r=>{let n=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(iC.create("app-offline"))};let r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=iJ(e,r);return{installationEntry:r,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:iY(e)}:{installationEntry:t}}(e,iZ(r||{fid:function(){try{var e;let t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;let r=(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22));return iM.test(r)?r:""}catch{return""}}(),registrationStatus:0}));return t=n.registrationPromise,n.installationEntry});return""===r.fid?{installationEntry:await t}:{installationEntry:r,registrationPromise:t}}async function iJ(e,t){try{let r=await iD(e,t);return iz(e.appConfig,r)}catch(r){throw iR(r)&&409===r.customData.serverCode?await iq(e.appConfig):await iz(e.appConfig,{fid:t.fid,registrationStatus:0}),r}}async function iY(e){let t=await iX(e.appConfig);for(;1===t.registrationStatus;)await iL(100),t=await iX(e.appConfig);if(0===t.registrationStatus){let{installationEntry:t,registrationPromise:r}=await iG(e);return r||t}return t}function iX(e){return iK(e,e=>{if(!e)throw iC.create("installation-not-found");return iZ(e)})}function iZ(e){var t;return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e}async function iQ({appConfig:e,heartbeatServiceProvider:t},r){let n=function(e,{fid:t}){return`${iP(e)}/${t}/authTokens:generate`}(e,r),i=function(e,{refreshToken:t}){var r;let n=iN(e);return n.append("Authorization",(r=t,`${iT} ${r}`)),n}(e,r),s=t.getImmediate({optional:!0});if(s){let e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}let a={method:"POST",headers:i,body:JSON.stringify({installation:{sdkVersion:ik,appId:e.appId}})},o=await iU(()=>fetch(n,a));if(o.ok)return iA(await o.json());throw await iO("Generate Auth Token",o)}async function i1(e,t=!1){let r,n=await iK(e.appConfig,n=>{var i,s,a;let o;if(!i3(n))throw iC.create("not-registered");let c=n.authToken;if(!t&&2===(i=c).requestStatus&&(s=i,!((o=Date.now())<s.creationTime)&&!(s.creationTime+s.expiresIn<o+36e5)))return n;if(1===c.requestStatus)return r=i0(e,t),n;{let t;if(!navigator.onLine)throw iC.create("app-offline");let i=(a=n,t={requestStatus:1,requestTime:Date.now()},{...a,authToken:t});return r=i2(e,i),i}});return r?await r:n.authToken}async function i0(e,t){let r=await i6(e.appConfig);for(;1===r.authToken.requestStatus;)await iL(100),r=await i6(e.appConfig);let n=r.authToken;return 0===n.requestStatus?i1(e,t):n}function i6(e){return iK(e,e=>{var t;if(!i3(e))throw iC.create("not-registered");return 1===(t=e.authToken).requestStatus&&t.requestTime+1e4<Date.now()?{...e,authToken:{requestStatus:0}}:e})}async function i2(e,t){try{let r=await iQ(e,t),n={...t,authToken:r};return await iz(e.appConfig,n),r}catch(r){if(iR(r)&&(401===r.customData.serverCode||404===r.customData.serverCode))await iq(e.appConfig);else{let r={...t,authToken:{requestStatus:0}};await iz(e.appConfig,r)}throw r}}function i3(e){return void 0!==e&&2===e.registrationStatus}async function i4(e){let{installationEntry:t,registrationPromise:r}=await iG(e);return r?r.catch(console.error):i1(e).catch(console.error),t.fid}async function i5(e,t=!1){return await i8(e),(await i1(e,t)).token}async function i8(e){let{registrationPromise:t}=await iG(e);t&&await t}function i7(e){return iC.create("missing-app-config-values",{valueName:e})}let i9="installations";ev(new V(i9,e=>{let t=e.getProvider("app").getImmediate(),r=function(e){if(!e||!e.options)throw i7("App Configuration");if(!e.name)throw i7("App Name");for(let t of["projectId","apiKey","appId"])if(!e.options[t])throw i7(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),n=e_(t,"heartbeat");return{app:t,appConfig:r,heartbeatServiceProvider:n,_delete:()=>Promise.resolve()}},"PUBLIC")),ev(new V("installations-internal",e=>{let t=e_(e.getProvider("app").getImmediate(),i9).getImmediate();return{getId:()=>i4(t),getToken:e=>i5(t,e)}},"PRIVATE")),eR(iE,iS),eR(iE,iS,"esm2020");let se="session:sessionChanged",st=l();function sr(){return"undefined"!=typeof window}var sn=RegExp("bot|spider|crawl|APIs-Google|AdsBot|Googlebot|mediapartners|Google Favicon|FeedFetcher|Google-Read-Aloud|DuplexWeb-Google|googleweblight|bing|yandex|baidu|duckduck|yahoo|ecosia|ia_archiver|facebook|instagram|pinterest|reddit|slack|twitter|whatsapp|youtube|semrush","i");class si{static instance;constructor(){}static getInstance(){return si.instance||(si.instance=new si),si.instance}async execute(e,t){let r;if(e.appCheck)try{r=(await ty(e.appCheck,!1)).token}catch(e){console.warn("Failed to get App Check token:",e)}return t(r)}}var ss=c(5305);class sa{static ternsecure;id;pathRoot="";static get apiClient(){return sa.ternsecure.getApiClient()}static get authCookieManager(){return this.ternsecure.authCookieManager()}get authCookieManager(){return sa.authCookieManager}isNew(){return!this.id}static async _fetch(e){return si.getInstance().execute(this.ternsecure,t=>{let r={...e};return t&&(r.headers=new Headers(r.headers),r.headers.set("x-ternsecure-appcheck",t)),this._baseFetch(r)})}static async _baseFetch(e){let t;try{t=await sa.apiClient.request(e,{timeoutMs:1e4})}catch(t){var r;let e;if(this.shouldRethrowofflineNetworkError())throw new ss.R6(t?.message||String(t),{code:"OFFLINE_NETWORK_ERROR"});if(!(function(){var e,t;let r=sr()?null==window?void 0:window.navigator:null;if(!r)return!1;let n=null==r?void 0:r.onLine;return(null==(e=null==r?void 0:r.connection)?void 0:e.rtt)!==0&&(null==(t=null==r?void 0:r.connection)?void 0:t.downlink)!==0&&n}()&&(e=sr()?null==window?void 0:window.navigator:null)&&!((r=null==e?void 0:e.userAgent)&&sn.test(r))&&!(null==e?void 0:e.webdriver)))return console.warn(t),null;throw t}let{payload:n,status:i,statusText:s,headers:a}=t;if(a){let e=a.get("x-country");this.ternsecure.__internal_setCountry(e?e.toLowerCase():null)}if(i>=200&&i<=299)return n;if(i>=400){let e=n?.errors,t=e?.[0]?.message,r={data:e,status:i};if(429===i&&a){let e=a.get("retry-After");if(e){let t=parseInt(e,10);isNaN(t)||(r.retryAfter=t)}}throw new ss.yS(t||s,r)}return null}path(e){let t=this.pathRoot;if(this.isNew())return t;let r=t.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return e?r.replace(/[^/]$/,"$&/")+encodeURIComponent(e):r}static async basePost(e){return this._fetch({...e,method:"POST"})}async _fetch(e){return sa._fetch(e)}async basePost(e){return sa.basePost(e)}async _baseMutate(e={}){let{action:t,body:r,method:n,path:i}=e,s=await sa._fetch({method:n,path:i||this.path(t),body:r});return this.fromJSON(s?.response||s)}async baseGet(e){return this._fetch({...e,method:"GET"})}async _post(e){return this.basePost({path:e.path,body:e.body})}async _basePost(e={}){return this._baseMutate({...e,method:"POST"})}static async makeApiRequest(e){return this._fetch(e)}async makeApiRequest(e){return this._fetch(e)}static shouldRethrowofflineNetworkError(){let e=sa.ternsecure?._internal_getOption?.("experimental");return e?.rethrowOfflineNetworkErrors||!1}}class so extends sa{pathRoot="/sessions/createsession";status;token;claims;authTime;expirationTime;issuedAtTime;signInProvider;signInSecondFactor;user;constructor(e){super(),this.initializeFromSessionData(e),this.fromJSON(e)}initializeFromSessionData(e){this.status=e.status||"pending",this.token=e.token||"",this.claims=e.claims||{},this.authTime=e.authTime||"",this.expirationTime=e.expirationTime||"",this.issuedAtTime=e.issuedAtTime||"",this.signInProvider=e.signInProvider||null,this.signInSecondFactor=e.signInSecondFactor||null,this.user=e.user}createSession=(e,t)=>this._basePost({path:this.pathRoot,body:{idToken:e,csrfToken:t}});getIdAndRefreshToken=async(e,t)=>{await this.createSession(e,t)};create=async e=>{await this.createSession(this.token,e),st.emit(se,null)};toJSON(){return{status:this.status,token:this.token,claims:this.claims,authTime:this.authTime,expirationTime:this.expirationTime,issuedAtTime:this.issuedAtTime,signInProvider:this.signInProvider,signInSecondFactor:this.signInSecondFactor,user:this.user}}fromJSON(e){return e&&this.initializeFromSessionData(e),this}}class sc extends sa{status=null;user=null;unverifiedFields;message;error;auth;constructor(e=null,t){super(),this.auth=t,this.fromJSON(e)}withEmailAndPassword=async e=>{try{let{email:t,password:r}=e,{user:n}=await ng(this.auth,t,r);return this.user=n,n.emailVerified||(this.status="missing_requirements",this.unverifiedFields=["email_address"],this.message="User created successfully. Email verification required."),this}catch(t){let e=n(t);return this.status="error",this.message=e.message,this.error=e.code,this}};withSocialProvider(){throw Error("Method not implemented.")}attemptEmailVerification=async e=>{try{if(!this.user)return this.status="error",this.message="No user found to send verification email",this.error="NO_USER",this;return await ny(this.user,{url:e?.url||window.location.origin,handleCodeInApp:e?.handleCodeInApp??!0}),this.message="Verification email sent successfully",this}catch(t){let e=n(t);return this.status="error",this.message=e.message,this.error=e.code,this}};fromJSON(e){return e&&(this.id=e.id,this.status=e.status),this}}class sl extends sa{pathRoot="/sign_ins/create";pathSessionRoot="/sessions/createsession";id;status=null;supportedFirstFactors=[];identifier=null;auth;csrfToken;_currentUser=null;_confirmationResult=null;constructor(e=null,t,r){super(),this.auth=t,this.csrfToken=r,this.fromJSON(e)}get user(){return this._currentUser}create=e=>this._basePost({path:this.pathRoot,body:e});attemptFirstFactor=async e=>{let t={...e};return this._basePost({body:{config:t,strategy:e.strategy},action:"attempt_first_factor"})};attemptPhoneNumberVerification=async e=>{if(!this._confirmationResult)return{status:"error",message:"No confirmation result found",error:"UNKNOWN_ERROR"};try{let t=await this._confirmationResult.confirm(e.code);return this._currentUser=t.user,this.status="success",this._confirmationResult=null,{status:"success",user:this._currentUser,message:"Phone number verified"}}catch(t){let e=n(t);return this.status="error",{status:"error",message:e.message,error:e.code}}};signInWithCredential=async e=>{let t={idToken:await e.user.getIdToken(),csrfToken:this.csrfToken};return this._post({path:this.pathSessionRoot,body:t})};authenticateWithPassword=async e=>{try{let{email:t,password:r}=e,{user:n,providerId:i,operationType:s}=await nw(this.auth,t,r);return this._currentUser=n,{status:"success",user:n,providerId:i,operationType:s,message:"Authentication successful"}}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}};createRecaptchaVerifier=(e,t)=>new nM(this.auth,e,t);authenticateWithPhoneNumber=async e=>{try{let{phoneNumber:t,appVerifier:r}=e;return this._confirmationResult=await nF(this.auth,t,r),this.status="needs_first_factor",{status:"needs_first_factor",message:"Verification code sent"}}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}};withCredential=async e=>{try{let{email:t,password:r}=e,n=await nw(this.auth,t,r);await this.signInWithCredential(n)}catch(e){console.error(n(e))}};authenticateWithSocialProvider=async(e,t={})=>{try{let{mode:r="popup"}=t;if("redirect"!==r)return await this._signInWithPopUp(e,t);{let r=await this.authRedirectResult();if(r)return r;return await this._signInWithRedirect(e,t)}}catch(t){return{status:"error",message:t.message||`Sign in with ${e} failed`,error:t}}};completeMfaSignIn=async(e,t)=>{throw Error("Method not implemented.")};sendPasswordResetEmail=async e=>this._basePost({path:"/sign_ins/resetPasswordEmail",body:{email:e}});resendEmailVerification=async e=>{let t=this._currentUser;if(!t)throw Error("No user is currently signed in");if(t.emailVerified)return{isVerified:!0};let r=e?.url||"/";"undefined"==typeof window||r.startsWith("http://")||r.startsWith("https://")||(r=new URL(r,window.location.origin).href);let n={url:r,handleCodeInApp:e?.handleCodeInApp??!0};return await ny(t,n),{isVerified:!1}};attemptEmailVerification=async e=>{try{if(!(await this.resendEmailVerification(e)).isVerified)return{status:"needs_email_verification",message:"Verification email sent"};return{status:"success",message:"Email is already verified"}}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}};getProviderConfig(e){switch(e.toLowerCase()){case"google":return{provider:new ne};case"apple":return{provider:new r7("apple.com")};case"microsoft":return{provider:new r7("microsoft.com")};case"github":return{provider:new r7("github.com")};case"twitter":return{provider:new r7("twitter.com")};case"facebook":return{provider:new r7("facebook.com")};default:throw Error(`Unsupported provider: ${e}`)}}async authRedirectResult(){try{let e=await n5(this.auth);if(e){let{user:t,providerId:r,operationType:n}=e;return{status:"success",user:t,providerId:r,operationType:n}}return null}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}}setProviderCustomParameters(e,t){t&&0!==Object.keys(t).length&&e.setCustomParameters(t)}setProviderScopes(e,t){t&&0!==t.length&&(e instanceof ne?t.forEach(t=>{e.addScope(t)}):e instanceof r7&&e.addScope(t.join(" ")))}configureProvider(e,t){this.setProviderCustomParameters(e,t.customParameters),this.setProviderScopes(e,t.scopes)}executeAuthMethod=async(e,t,r={})=>{try{let n=this.getProviderConfig(t);this.configureProvider(n.provider,r);let{user:i,providerId:s,operationType:a}=await e(this.auth,n.provider);return{status:"success",message:"Authentication successful",user:i,providerId:s,operationType:a}}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}};async _signInWithRedirect(e,t={}){return this.executeAuthMethod(n3,e,t)}async _signInWithPopUp(e,t={}){return this.executeAuthMethod(nJ,e,t)}async checkRedirectResult(){return this.authRedirectResult()}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.supportedFirstFactors=e.supportedFirstFactors,this.identifier=e.identifier),this}}function su(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var sh=function e(t,r){function n(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=su({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var s=r[i].split("="),a=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(n[o]=t.read(a,o),e===o)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){n(e,"",su({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,su({},this.attributes,t))},withConverter:function(t){return e(su({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function sd(e){return{set(t,r={}){sh.set(e,t,r)},get:()=>sh.get(e),remove(t){sh.remove(e,t)}}}function sp(e,t){let r=function(e){try{return new Date(e||new Date)}catch{return new Date}}(e);return r.setFullYear(r.getFullYear()+t),r}let sf={secure:!0,sameSite:"strict",expires:1/24};class sm{csrfCookieHandler=sd("__terncf");ternAutCookie=(()=>{let e=sd("tern_aut"),t=()=>{let t=e.get();return t?parseInt(t,10):0};return{get:t,set:r=>{let n=sp(Date.now(),1);if(!Number.isInteger(r)||r<0)return void console.warn("[tern_aut] Invalid auth_time value provided:",r);let i=t();0===r&&i>0||e.set(r.toString(),{secure:!0,expires:n})},initialize:()=>{if(null==e.get()){let t=sp(Date.now(),1);e.set("0",{secure:!0,expires:t})}}}})();constructor(){this.ensureCSRFToken(),this.ensureAuthTimeCookie()}generateCSRFToken(){let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}ensureCSRFToken(){let e=this.getCSRFToken();return e||(e=this.generateCSRFToken(),this.setCSRFToken({token:e})),e}ensureAuthTimeCookie(){this.ternAutCookie.initialize()}getAuthTime(){return this.ternAutCookie.get()}setAuthTime(e){this.ternAutCookie.set(e)}setCSRFToken(e){try{e.token&&this.csrfCookieHandler.set(e.token,sf)}catch(e){throw console.error("Failed to set CSRF token:",e),Error("Unable to store CSRF token")}}getCSRFToken(){try{return this.csrfCookieHandler.get()}catch(e){console.error("Failed to get CSRF token:",e);return}}clearAuth(){try{this.csrfCookieHandler.remove()}catch(e){console.error("Failed to clear auth cookies:",e)}}}var sg=c(2117),sw=c(8177),sy=c(2782);class sv extends Error{url;original;constructor(e,t){super(`Network error for ${e}: ${t.message}`),this.url=e,this.original=t,this.name="NetworkError"}}class s_ extends Error{constructor(){super("Request timed out"),this.name="TimeoutError"}}class sI extends Error{constructor(){super("Circuit breaker is open"),this.name="CircuitOpenError"}}async function sb(e){for(let t of e.beforeRequestHooks)if(!1===await t())return!1;return!0}async function sE(e,t){for(let r of e.afterResponseHooks)await r(t)}function sS(e,t){let{failureThreshold:r=5}=t;e.circuitBreaker.failures++,e.circuitBreaker.lastFailureTime=Date.now(),e.circuitBreaker.failures>=r&&(e.circuitBreaker.state="open")}async function sk(e,t,r,n){let i,{initialDelay:s=700,factor:a=2,maxDelay:o=5e3,maxTries:c="undefined"!=typeof navigator&&navigator.onLine?4:11}=t;for(let l=1;l<=c;l++)try{let t=await r();return e.circuitBreaker.failures=0,e.circuitBreaker.state="closed",t}catch(r){if(i=r,!n(r,l))throw r;if(sS(e,t),l<c){let e=Math.min(s*Math.pow(a,l-1),o);await new Promise(t=>setTimeout(t,(0,sy.$x)(e)))}}throw i}function sT(){return"undefined"!=typeof window}class sC{static version="1.1.0-canary.v20251205181217";static sdkMetadata={name:"@tern-secure/auth",version:"1.1.0-canary.v20251205181217",environment:"production"};static mountComponentRenderer;#c;static instance=null;_currentUser=null;signedInSession=null;firebaseClientApp;appCheckApp;authStateUnsubscribe=null;auth;csrfToken;isLoading=!1;error=null;user=null;__internal_country;customDomain;isVisible=!1;currentView=null;#l;#u;#h;#d;#p="loading";#f=[];#m={};#g;#w=l();signIn;signUp;session;get isReady(){return"ready"===this.status}get status(){return this.#p}get version(){return sC.version}set sdkMetadata(e){sC.sdkMetadata=e}get sdkMetadata(){return sC.sdkMetadata}get requiresVerification(){return this.#m.requiresVerification??!0}load=async e=>{if(!this.isReady){this.#m=this.#y(e),console.debug("[TernSecureAuth] Loading with options:",this.#m),this.#m.sdkMetadata&&(sC.sdkMetadata=this.#m.sdkMetadata);try{await Promise.resolve(this.#v()),sC.mountComponentRenderer&&!this.#c&&(this.#c=sC.mountComponentRenderer(this,this.#m)),this.#_("ready"),this.#w.emit(u,"ready")}catch(e){throw this.error=e,console.error("[TernSecureAuth] Load failed:",e),this.#_("error"),this.#w.emit(u,"error"),e}}};__unstable__updateProps=e=>{let t={...e,options:this.#y({...this.#m,...e.options})};return this.#c?.ensureMounted().then(e=>e.updateProps(t))};#v=()=>{if(!this.#m.ternSecureConfig)throw Error("TernSecureConfig is required to initialize TernSecureAuth");if(!this.#m.apiUrl)throw Error("apiUrl is required to initialize TernSecureAuth");this.initializeFirebaseApp(this.#m.ternSecureConfig,{appName:this.#m.appName,tenantId:this.#m.tenantId}),"browserCookie"!==this.#m.persistence&&(this.authStateUnsubscribe=this.initAuthStateListener()),this.#g=new sm,this.csrfToken=this.#g.getCSRFToken(),this.signIn=new sl(null,this.auth,this.csrfToken),this.signUp=new sc(null,this.auth),st.on(se,()=>{this.#I(this.user||null),this.#b()})};assertComponentControlsReady(e){if(!sC.mountComponentRenderer)throw Error("TernSecure instance was loaded without UI components");if(!e)throw Error("TernSecure UI components are not ready yet.")}showSignIn(e,t){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"SignIn"}).then(r=>r.mountComponent({name:"SignIn",appearanceKey:"default",node:e,props:t})),this.currentView="signIn",this.isVisible=!0}hideSignIn(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}showSignUp(e,t){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"SignUp"}).then(r=>r.mountComponent({name:"SignUp",appearanceKey:"default",node:e,props:t})),this.currentView="signUp",this.isVisible=!0}hideSignUp(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}showUserButton(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"UserButton"}).then(t=>t.mountComponent({name:"UserButton",appearanceKey:"default",node:e,props:{}}))}hideUserButton(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}get apiUrl(){return this.#h}get authDomain(){if(sT()){var e,t;let r=(0,h.W)((e=this.#l,t=new URL(window.location.href),"function"==typeof e?e(t):void 0!==e?e:void 0));return this.#d,r}return""}get instanceType(){return this.#d}constructor(e,t){this.#l=t?.domain,this.#h=e||"",this.#d="production",this.#u=function(e){async function t(r,n,i={}){let s={...n},{method:a="GET",body:o}=s,c={...i};if(s.url=function(t){let r,n=e.apiUrl?.includes("localhost")||e.apiUrl?.includes("127.0.0.1"),{path:i}=t,{instanceType:s,authDomain:a,apiUrl:o,apiBasePath:c="/api/auth"}=e;r=n?o?.startsWith("http")?o:`http://${o}`:`https://${("production"===s?a:"")||o}`;let l=`${c}/${i}`.replace(/\/+/g,"/");return(0,sg.kZ)({base:r,pathname:l,searchParams:t.search?new URLSearchParams(t.search):void 0},{stringify:!1})}({...s}),!function(e,t){let{recoveryTimeoutMs:r=6e4}=t,n=Date.now();if("open"===e.circuitBreaker.state)if(n-e.circuitBreaker.lastFailureTime>=r)e.circuitBreaker.state="half-open";else throw new sI}(r,c),!await sb(r)){let e=new Response("{}",{status:200});return e.payload={response:{}},await sE(r,e),e}let{timeoutMs:l}=c,u="GET"===a?"GET":"POST",h=s.url.toString();s.headers=new Headers(s.headers),"GET"===a||o instanceof FormData||s.headers.has("content-type")||s.headers.set("content-type","application/json"),"application/x-www-form-urlencoded"===s.headers.get("content-type")?s.body=o?(0,sg.Ws)(o,{keyEncoder:sy.C8}):o:"application/json"===s.headers.get("content-type")&&o&&(s.body="string"==typeof o?o:JSON.stringify(o));let d=async()=>{let e,t=new AbortController,n=l?setTimeout(()=>{t.abort()},l):null,i={...s,credentials:"include",method:u};try{e=await fetch(h,i),n&&clearTimeout(n);let t=null;if(204===e.status)t=null;else try{t=await e.json()}catch{t={response:{}}}return e.payload=t,await sE(r,e),e}catch(e){if(n&&clearTimeout(n),"AbortError"===e.name)throw new s_;throw new sv(h,e)}};return sk(r,c,d,(e,t)=>{var n;let i;return n=c.maxTries||("undefined"!=typeof navigator&&navigator.onLine?4:11),(i=e instanceof sv&&"GET"===u.toUpperCase()&&t<n)||sS(r,c),i})}let r=function(e={}){return{circuitBreaker:{failures:0,lastFailureTime:0,state:"closed"},beforeRequestHooks:[],afterResponseHooks:[],clientOptions:e}}(e);return{onBeforeRequest:e=>{r.beforeRequestHooks.push(e)},onAfterResponse:e=>{r.afterResponseHooks.push(e)},request:(e,n={})=>t(r,e,n)}}({authDomain:this.authDomain,apiUrl:this.#h,instanceType:this.instanceType}),this.#w.emit(u,"loading"),sa.ternsecure=this}getApiClient=()=>this.#u;setLoading(e){this.isLoading=e}authCookieManager(){return this.#g}_internal_getOption(e){return this.#m[e]}_internal_getAllOptions(){return Object.freeze({...this.#m})}static getOrCreateInstance(e,t){return this.instance||(this.instance=new sC(e,t)),this.instance}static clearInstance(){sC.instance&&(sC.instance.authStateUnsubscribe&&(sC.instance.authStateUnsubscribe(),sC.instance.authStateUnsubscribe=null),sC.instance=null)}static initialize(e){return this.getOrCreateInstance(e?.apiUrl||"")}initialize=async e=>{this.#E(e||{})};static create(e){let t=this.getOrCreateInstance(e?.apiUrl||"");return t.initialize(e),t}#E=e=>{this.#m=this.#y(e);try{if(!this.#m.ternSecureConfig)throw Error("TernSecureConfig is required to initialize TernSecureAuth");if(!this.#m.apiUrl)throw Error("apiUrl is required to initialize TernSecureAuth");this.initializeFirebaseApp(this.#m.ternSecureConfig,{appName:this.#m.appName,tenantId:this.#m.tenantId}),"browserCookie"!==this.#m.persistence&&(this.authStateUnsubscribe=this.initAuthStateListener()),this.#g=new sm,this.csrfToken=this.#g.getCSRFToken(),this.signIn=new sl(null,this.auth,this.csrfToken),this.signUp=new sc(null,this.auth),st.on(se,()=>{this.#I(this.user||null),this.#b()}),this.#_("ready"),this.#w.emit(u,"ready")}catch(e){throw this.error=e,this.#_("error"),this.#w.emit(u,"error"),e}};initializeFirebaseApp(e,t){let r=t?.appName||"[DEFAULT]";this.firebaseClientApp=0===eC().length?ek(e,r):eC()[0];let n=this.#S(),i=function(e,t){let r=e_(e,"auth");if(r.isInitialized()){let e=r.getImmediate();if(N(r.getOptions(),t??{}))return e;tS(e,"already-initialized")}return r.initialize({options:t})}(this.firebaseClientApp,{persistence:n,popupRedirectResolver:iv});if(this.auth=i,t?.tenantId&&(this.auth.tenantId=t.tenantId),this.#k(),this.#m.appCheck){let{provider:e,siteKey:t,isTokenAutoRefreshEnabled:r,debugToken:n}=this.#m.appCheck;n&&sT()&&(window.FIREBASE_APPCHECK_DEBUG_TOKEN=n);let i="reCaptchaEnterprise"===e?new tm(t):new tf(t);this.appCheckApp=function(e=eT(),t){let r=e_(e=j(e),"app-check");if(eH.initialized||function(){let e=v();if(eH.initialized=!0,"string"!=typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==e.FIREBASE_APPCHECK_DEBUG_TOKEN)return;eH.enabled=!0;let t=new b;eH.token=t,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?t.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):t.resolve(e7())}(),e9()&&te().then(e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),r.isInitialized()){let n=r.getImmediate(),i=r.getOptions();if(i.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&i.provider.isEqual(t.provider))return n;throw ez.create("already-initialized",{appName:e.name})}let n=r.initialize({options:t});return function(e,t,r=!1){var n;let i=(n={...eV},ej.set(e,n),ej.get(e));i.activated=!0,i.provider=t,i.cachedTokenPromise=e5(e).then(t=>(t&&tc(t)&&(i.token=t,to(e,{token:t.token})),t)),i.isTokenAutoRefreshEnabled=r&&e.automaticDataCollectionEnabled,!e.automaticDataCollectionEnabled&&r&&e4.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."),i.provider.initialize(e)}(e,t.provider,t.isTokenAutoRefreshEnabled),e$(e).isTokenAutoRefreshEnabled&&ti(n,"INTERNAL",()=>{}),n}(this.firebaseClientApp,{provider:i,isTokenAutoRefreshEnabled:r??!0})}!function(e=eT()){e_(e,"installations").getImmediate()}(this.firebaseClientApp)}signOut=async e=>{let t=e?.redirectUrl||this.constructAfterSignOutUrl();e?.onBeforeSignOut&&await e.onBeforeSignOut(),await this.auth.signOut(),e?.onAfterSignOut&&await e.onAfterSignOut(),await this.navigate(t),st.emit("user:userSignOut",null),st.emit("token:tokenUpdate",{token:null}),this.#b()};get currentSession(){return this.signedInSession}get firebaseApp(){return this.firebaseClientApp}get appCheck(){return this.appCheckApp}initAuthListener(){return(async()=>{await this.auth.authStateReady();let e=this.auth.currentUser;this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#b()})(),()=>{}}initAuthStateListener(){return n_(this.auth,async e=>{await this.auth.authStateReady(),this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#b()})}_onIdTokenChanged(){return nv(this.auth,async e=>{await this.auth.authStateReady(),this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#b()})}async getIdToken(){return(await this.auth.authStateReady(),this.auth.currentUser)?function(e,t=!1){return j(e).getIdToken(t)}(this.auth.currentUser):null}onAuthStateChanged(e){return n_(this.auth,e)}onIdTokenChanged(e){return nv(this.auth,e)}async updateCurrentSession(){if(!this._currentUser){this.signedInSession=null;return}try{let e=await this._currentUser.getIdTokenResult();this.signedInSession={status:"active",token:e.token,claims:e.claims,issuedAtTime:e.issuedAtTime,expirationTime:e.expirationTime,authTime:e.authTime,signInProvider:e.signInProvider||"unknown",signInSecondFactor:e.signInSecondFactor}}catch(e){console.error("[TernSecureAuth] Error updating session:",e),this.signedInSession=null}}checkRedirectResult=async()=>{try{let e=await n5(this.auth);if(e)return{status:"success",user:e.user};return null}catch(t){let e=n(t);return{status:"error",message:e.message,error:e.code}}};getRedirectResult=async()=>this.checkRedirectResult();addListener=e=>(this.#f.push(e),this._currentUser&&e({user:this._currentUser,session:this.signedInSession}),()=>{this.#f=this.#f.filter(t=>t!==e)});on=(...e)=>{this.#w.on(...e)};off=(...e)=>{this.#w.off(...e)};createActiveSession=async({session:e,redirectUrl:t})=>{try{if(!e)throw Error("No session provided to createActiveSession");let r=await e.getIdTokenResult(),n=new so(r);await n.create(this.csrfToken||""),t&&await this.navigate(this.constructUrlWithAuthRedirect(t)),this.#I(e),this.#b()}catch(e){console.error("[TernSecureAuth] Error creating active session:",e)}};navigate=async(e,t)=>{if(!e||!sT())return;let r=new URL(e,window.location.href);this.#T.includes(r.protocol)||(console.warn(`TernSecureAuth: "${r.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`),r=new URL("/",window.location.href));let n=t?.replace&&this.#m.routerReplace?this.#m.routerReplace:this.#m.routerPush;if("null"!==r.origin&&r.origin!==window.location.origin||!n)return void(0,sg.y7)(r);let i={...t?.metadata?{__internal_metadata:t?.metadata}:{},windowNavigate:sg.y7};return await n((0,sg.FV)(r),i)};constructUrlWithAuthRedirect=e=>{if("production"===this.#d)return e;let t=new URL(e,window.location.origin);return t.origin===window.location.origin?t.href:t.toString()};#C=(e,t)=>{if(!e||!this.isReady)return"";let r="signInUrl"===e?this.#m.signInUrl:this.#m.signUpUrl,n=new sw.n(this.#m,t).toSearchParams(),i=(0,sg.kZ)({base:r||("signInUrl"===e?"/sign-in":"/sign-up"),hashSearchParams:[n]},{stringify:!0,skipOrigin:!1});return this.constructUrlWithAuthRedirect(i)};#R=()=>this.constructUrlWithAuthRedirect(new sw.n(this.#m).getAfterSignInUrl());constructAfterSignOutUrl=()=>this.#m.afterSignOutUrl?this.constructUrlWithAuthRedirect(this.#m.afterSignOutUrl):"/";redirectToSignIn=async e=>{if(sT())return this.navigate(this.constructSignInUrl(e))};redirectToSignUp=async e=>{if(sT())return this.navigate(this.constructSignUpUrl(e))};redirectAfterSignIn=async()=>{if(sT())return this.navigate(this.#R())};redirectAfterSignUp=()=>{throw Error("redirectAfterSignUp is not implemented yet")};constructSignInUrl=e=>this.#C("signInUrl",{...e,signInForceRedirectUrl:e?.signInForceRedirectUrl||window.location.href});constructSignUpUrl=e=>this.#C("signUpUrl",{...e,signUpForceRedirectUrl:e?.signUpForceRedirectUrl||window.location.href});get #T(){let e=sg.VY;return this.#m.allowedRedirectProtocols&&(e=e.concat(this.#m.allowedRedirectProtocols)),e}__internal_setCountry=e=>{this.__internal_country||(this.__internal_country=e)};#y=e=>({...e});#b=()=>{for(let e of this.#f)e({user:this.user,session:this.signedInSession})};#_(e){this.#p!==e&&(this.#p=e,this.#w.emit(u,this.#p),"ready"===e&&this.#w.emit(u,"ready"))}#I=e=>{this.user=e,this._currentUser=e};#S=()=>{switch(this.#m.persistence){case"browserCookie":case"none":default:return rl;case"session":return nk;case"local":return nS}};#P=()=>{if("undefined"!=typeof process)return process.env.FIREBASE_AUTH_EMULATOR_HOST};#k=()=>{let e=this.#P();if(!("development"===this.#d&&e)||!e)return;let t=e.startsWith("http")?e:`http://${e}`;try{!function(e,t,r){let n=j(e);tA(/^https?:\/\//.test(t),n,"invalid-emulator-scheme");let i=!!r?.disableWarnings,s=rV(t),{host:a,port:o}=function(e){let t=rV(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};let n=r[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(n);if(i){let e=i[1];return{host:e,port:rH(n.substr(e.length+1))}}{let[e,t]=n.split(":");return{host:e,port:rH(t)}}}(t),c=null===o?"":`:${o}`,l={url:`${s}//${a}${c}/`},u=Object.freeze({host:a,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!n._canInitEmulator){tA(n.config.emulator&&n.emulatorConfig,n,"emulator-config-failed"),tA(N(l,n.config.emulator)&&N(u,n.emulatorConfig),n,"emulator-config-failed");return}n.config.emulator=l,n.emulatorConfig=u,n.settings.appVerificationDisabledForTesting=!0,E(a)?(S(`${s}//${a}${c}`),function(e,t){if("undefined"==typeof window||"undefined"==typeof document||!E(window.location.host)||k[e]===t||k[e]||T)return;function r(e){return`__firebase__banner__${e}`}k[e]=t;let n="__firebase__banner",i=function(){let e={prod:[],emulator:[]};for(let t of Object.keys(k))k[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){let e,t,s=(e=document.getElementById(n),t=!1,e||((e=document.createElement("div")).setAttribute("id",n),t=!0),{created:t,element:e}),a=r("text"),o=document.getElementById(a)||document.createElement("span"),c=r("learnmore"),l=document.getElementById(c)||document.createElement("a"),u=r("preprendIcon"),h=document.getElementById(u)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.created){let e,t=s.element;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",l.setAttribute("id",c),l.innerText="Learn more",l.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",l.setAttribute("target","__blank"),l.style.paddingLeft="5px",l.style.textDecoration="underline";let r=((e=document.createElement("span")).style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{let e;T=!0,(e=document.getElementById(n))&&e.remove()},e);h.setAttribute("width","24"),h.setAttribute("id",u),h.setAttribute("height","24"),h.setAttribute("viewBox","0 0 24 24"),h.setAttribute("fill","none"),h.style.marginLeft="-6px",t.append(h,o,l,r),document.body.appendChild(t)}i?(o.innerText="Preview backend disconnected.",h.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
3
+ ${t.message}`)}})(d(e)):e).some(e=>e.test(d(a.origin))));return c||(n=`TernSecure: Redirect URL ${a} is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.`,s.has(n)||(s.add(n),console.warn(n))),c}},2117:function(e,t,r){"use strict";r.d(t,{VY:()=>a,kZ:()=>n.kZ,vA:()=>i.v,yY:()=>n.yY,Ws:()=>i.W,nQ:()=>s.n,Kj:()=>n.Kj,FV:()=>n.FV,tL:()=>n.tL,y7:()=>o,yR:()=>n.yR});var n=r(7738),i=r(5327),s=r(8177);let a=["http:","https:","wails:","chrome-extension:"];function o(e){let t=new URL(e,window.location.href);window.dispatchEvent(new CustomEvent("ternsecure:beforeunload")),window.location.href=t.href}},5327:function(e,t,r){"use strict";r.d(t,{W:()=>i,v:()=>n});let n=e=>{let t={};return new URLSearchParams(e).forEach((e,r)=>{if(r in t){let n=t[r];Array.isArray(n)?n.push(e):t[r]=[n,e]}else t[r]=e}),t},i=(e,t={})=>{if(null==e||!e||"object"!=typeof e)return"";let r=new URLSearchParams;return Object.keys(e).forEach(n=>{let i=t.keyEncoder?t.keyEncoder(n):n,s=e[n];if(Array.isArray(s))s.forEach(e=>void 0!==e&&r.append(i,e||""));else{if(void 0===s)return;"object"==typeof s&&null!==s?r.append(i,JSON.stringify(s)):r.append(i,String(s??""))}}),r.toString()}},8177:function(e,t,r){"use strict";r.d(t,{n:()=>o});var n=r(2782),i=(e,t)=>{let r={};for(let n in e)r[n]=t(e[n],n);return r},s=(e,t)=>{let r={};for(let n in e)e[n]&&t(e[n])&&(r[n]=e[n]);return r},a=r(7738);class o{static keys=["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","afterSignInUrl","afterSignUpUrl","redirectUrl"];static preserved=["redirectUrl"];options;fromOptions;fromProps;fromSearchParams;mode;constructor(e,t={},r={},n){this.options=e,this.fromOptions=this.#e(e||{}),this.fromProps=this.#e(t||{}),this.fromSearchParams=this.#t(r||{}),this.mode=n}getAfterSignInUrl(){return this.#r("signIn")}getAfterSignUpUrl(){return this.#r("signUp")}getPreservedSearchParams(){return this.#n(this.#i())}toSearchParams(){return this.#n(this.#s())}#n(e){return new URLSearchParams(Object.entries(Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,n.C8)(e),t]))).reduce((e,[t,r])=>(null!=r&&(e[t]=r),e),{}))}#i(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter(([e])=>o.preserved.includes(e)))}#s(){let e=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,t=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,r=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,n=this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,i=this.fromSearchParams.afterSignInUrl||this.fromProps.afterSignInUrl||this.fromOptions.afterSignInUrl,s={signUpForceRedirectUrl:e,signUpFallbackRedirectUrl:t,signInForceRedirectUrl:r,signInFallbackRedirectUrl:n,afterSignInUrl:i,afterSignUpUrl:this.fromSearchParams.afterSignUpUrl||this.fromProps.afterSignUpUrl||this.fromOptions.afterSignUpUrl,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl||this.fromOptions.redirectUrl};return e&&delete s.signUpFallbackRedirectUrl,r&&delete s.signInFallbackRedirectUrl,s}#r(e){let t,r=`${e}ForceRedirectUrl`,n=`${e}FallbackRedirectUrl`;return(t=this.fromSearchParams[r]||this.fromProps[r]||this.fromOptions[r],t||=this.fromSearchParams.redirectUrl,(t||=this.fromSearchParams[n]||this.fromProps[n]||this.fromOptions[n])||"modal"!==this.mode)?t||"/":window.location.href}#e(e){let t={};return o.keys.forEach(r=>{t[r]=e[r]}),i(this.#a(this.#o(s(t,Boolean))),e=>e.toString())}#t(e){let t={};return o.keys.forEach(r=>{e instanceof URLSearchParams?t[r]=e.get((0,n.C8)(r)):t[r]=e[(0,n.C8)(r)]}),i(this.#a(this.#o(s(t,Boolean))),e=>e.toString())}#o(e){return i(e,e=>(0,a.kU)(e,window.location.origin))}#a=e=>s(e,(0,a.vU)(this.options?.allowedRedirectOrigins,window.location.origin))}},8725:function(e,t,r){"use strict";r.d(t,{bD:()=>function e(t,r){if(t===r)return!0;let n=Object.keys(t),i=Object.keys(r);for(let s of n){if(!i.includes(s))return!1;let n=t[s],a=r[s];if(U(n)&&U(a)){if(!e(n,a))return!1}else if(n!==a)return!1}for(let e of i)if(!n.includes(e))return!1;return!0},p9:()=>V,u:()=>l,K3:()=>s,gE:()=>y,g:()=>A,sr:()=>S,T9:()=>p,I9:()=>L,Tj:()=>d,zW:()=>C,hp:()=>M,Ku:()=>H,tD:()=>x,P1:()=>_,FA:()=>P,mS:()=>u,cY:()=>m,lV:()=>k,c1:()=>E,ZQ:()=>b,zJ:()=>g,lT:()=>T,Am:()=>D,jZ:()=>I,Uj:()=>c,eX:()=>R,XA:()=>f,Im:()=>N});let n=function(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},i=function(e){let t=[],r=0,n=0;for(;r<e.length;){let i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){let s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{let s=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return t.join("")},s={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,l=i>>2,u=(3&i)<<4|a>>4,h=(15&a)<<2|c>>6,d=63&c;!o&&(d=64,s||(h=64)),n.push(r[l],r[u],r[h],r[d])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):i(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){let i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0,o=++t<e.length?r[e.charAt(t)]:64,c=++t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==c)throw new a;let l=i<<2|s>>4;if(n.push(l),64!==o){let e=s<<4&240|o>>2;if(n.push(e),64!==c){let e=o<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class a extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let o=function(e){let t=n(e);return s.encodeByteArray(t,!0)},c=function(e){return o(e).replace(/\./g,"")},l=function(e){try{return s.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function u(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("Unable to locate global object.")}let h=()=>{try{return u().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process||void 0===process.env)return;let e=process.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("undefined"==typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},d=e=>h()?.emulatorHosts?.[e],p=()=>h()?.config,f=e=>h()?.[`_${e}`];class m{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}function g(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function y(e){return(await fetch(e,{credentials:"include"})).ok}let w={},v=!1;function _(e,t){if("undefined"==typeof window||"undefined"==typeof document||!g(window.location.host)||w[e]===t||w[e]||v)return;function r(e){return`__firebase__banner__${e}`}w[e]=t;let n="__firebase__banner",i=function(){let e={prod:[],emulator:[]};for(let t of Object.keys(w))w[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){let e,t,s=(e=document.getElementById(n),t=!1,e||((e=document.createElement("div")).setAttribute("id",n),t=!0),{created:t,element:e}),a=r("text"),o=document.getElementById(a)||document.createElement("span"),c=r("learnmore"),l=document.getElementById(c)||document.createElement("a"),u=r("preprendIcon"),h=document.getElementById(u)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.created){let e,t=s.element;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",l.setAttribute("id",c),l.innerText="Learn more",l.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",l.setAttribute("target","__blank"),l.style.paddingLeft="5px",l.style.textDecoration="underline";let r=((e=document.createElement("span")).style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{let e;v=!0,(e=document.getElementById(n))&&e.remove()},e);h.setAttribute("width","24"),h.setAttribute("id",u),h.setAttribute("height","24"),h.setAttribute("viewBox","0 0 24 24"),h.setAttribute("fill","none"),h.style.marginLeft="-6px",t.append(h,o,l,r),document.body.appendChild(t)}i?(o.innerText="Preview backend disconnected.",h.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
17
4
  <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"/>
18
5
  </g>
19
6
  <defs>
@@ -27,4 +14,17 @@ Possible fixes:
27
14
  <clipPath id="clip0_6083_34804">
28
15
  <rect width="24" height="24" fill="white"/>
29
16
  </clipPath>
30
- </defs>`,o.innerText="Preview backend running in this workspace."),o.setAttribute("id",a)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",s):s()}("Auth",!0)):i||function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}(this.auth,t,{disableWarnings:!1}),console.warn(`[TernSecure] Firebase Auth Emulator connected at ${t}`)}catch(e){console.error("[TernSecure] Error connecting to Firebase Auth Emulator:",e)}}}var sR=c(4557),sP=c(802),sA=c(4105);let sO={SignIn:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("10")]).then(c.bind(c,1687)),SignUp:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("472")]).then(c.bind(c,8102)),UserButton:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("99")]).then(c.bind(c,7947))},sN=(0,sA.lazy)(()=>sO.SignIn().then(e=>({default:e.SignIn})));(0,sA.lazy)(()=>sO.SignIn().then(e=>({default:e.SignInModal})));let sU=(0,sA.lazy)(()=>sO.SignUp().then(e=>({default:e.SignUp}))),sD=(0,sA.lazy)(()=>sO.UserButton().then(e=>({default:e.UserButton}))),sL=async e=>sO[e]?.(),sM={SignIn:sN,SignUp:sU,UserButton:sD},sx=(0,sA.lazy)(()=>Promise.all([c.e("666"),c.e("687")]).then(c.bind(c,5977)).then(e=>({default:e.TernSecureContextWrapper}))),sF=(0,sA.lazy)(()=>Promise.all([c.e("666"),c.e("687")]).then(c.bind(c,5977)).then(e=>({default:e.TernSecureOptionsProvider}))),sj=(0,sA.lazy)(()=>Promise.all([c.e("26"),c.e("666"),c.e("492")]).then(c.bind(c,5530)).then(e=>({default:e.Portal}))),sV=e=>(0,sR.jsx)(sx,{ternsecure:e.ternsecure,children:(0,sR.jsx)(sF,{value:e.options,children:e.children})}),sH=e=>(0,sR.jsx)(sj,{node:e.node,component:sM[e.componentName],props:e.componentProps,componentName:e.componentName},e.componentKey),s$="data-ternsecure-component",sB=0,sW={},sz=e=>{let[t,r]=sA.useState({options:e.options,nodes:new Map}),{nodes:n}=t;return(0,sP.UQ)(()=>{sW.mountComponent=e=>{let{name:t,node:i,props:s,appearanceKey:a}=e;if(!i)throw Error("Element is not a valid DOM element");r(e=>(e.nodes.set(i,{key:`p${++sB}`,name:t,props:s,appearanceKey:a}),{...e,nodes:n}))},sW.unmountComponent=e=>{let{node:t}=e;r(e=>(e.nodes.delete(t),{...e,nodes:n}))},sW.updateProps=({node:e,props:n,...i})=>{if(e&&n&&"object"==typeof n){let i=t.nodes.get(e);if(i){i.props={...n},r(e=>({...e}));return}}r(e=>({...e,...i,options:{...e.options,...i.options}}))},e.onComponentsMounted()},[]),(0,sR.jsx)(sA.Suspense,{fallback:"",children:(0,sR.jsx)(sV,{ternsecure:e.ternsecure,options:t.options,children:[...n].map(([e,t])=>(0,sR.jsx)(sH,{node:e,componentName:t.name,componentProps:t.props,componentKey:t.key},t.key))})})};sC.mountComponentRenderer=(e,t)=>{let r,n=document.getElementById(s$);return n||((n=document.createElement("div")).setAttribute("id",s$),document.body.appendChild(n)),{ensureMounted:async i=>{let{preloadHint:s}=i||{};if(!r){let i,a,o=(i=()=>{},a=()=>{},{promise:new Promise((e,t)=>{i=e,a=t}),resolve:i,reject:a});s&&sL(s),r=Promise.all([c.e("26"),c.e("666"),c.e("68")]).then(c.bind(c,8869)).then(({createRoot:r})=>(r(n).render((0,sR.jsx)(sz,{ternsecure:e,options:t,onComponentsMounted:o.resolve})),o.promise.then(()=>sW)))}return r.then(e=>e)}}},document.querySelector("[data-api-key]")?.getAttribute("data-api-key")||window.apiKey;let sq=document.querySelector("script[data-api-url]")?.getAttribute("data-api-url")||window.apiUrl||"",sK=document.querySelector("script[data-auth-domain]")?.getAttribute("data-auth-domain")||window.authDomain||"",sG=document.querySelector("[data-proxy-url]")?.getAttribute("data-proxy-url")||window.proxyUrl||"";window.TernSecure||(window.TernSecure=new sC(sq,{proxyUrl:sG,authDomain:sK}))})(),{}})());
17
+ </defs>`,o.innerText="Preview backend running in this workspace."),o.setAttribute("id",a)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",s):s()}function b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function I(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(b())}function E(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent}function S(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function k(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function T(){let e=b();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function C(){try{return"object"==typeof indexedDB}catch(e){return!1}}function R(){return new Promise((e,t)=>{try{let r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{t(i.error?.message||"")}}catch(e){t(e)}})}class A extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,A.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,P.prototype.create)}}class P{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var r,n;let i=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],o=a?(r=a,n=i,r.replace(O,(e,t)=>{let r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",c=`${this.serviceName}: ${o} (${s}).`;return new A(s,c,i)}}let O=/\{\$([^}]+)}/g;function N(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function U(e){return null!==e&&"object"==typeof e}function D(e){let t=[];for(let[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function L(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}}),t}function M(e){let t=e.indexOf("?");if(!t)return"";let r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}function x(e,t){let r=new F(e,t);return r.subscribe.bind(r)}class F{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw Error("Missing Observer.");void 0===(n=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:r}:e).next&&(n.next=j),void 0===n.error&&(n.error=j),void 0===n.complete&&(n.complete=j);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function j(){}function V(e,t=1e3,r=2){let n=t*Math.pow(r,e),i=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+i)}function H(e){return e&&e._delegate?e._delegate:e}},3392:function(e){e.exports=function(e,t){if("string"!=typeof e)throw TypeError("Expected a string");for(var r,n=String(e),i="",s=!!t&&!!t.extended,a=!!t&&!!t.globstar,o=!1,c=t&&"string"==typeof t.flags?t.flags:"",l=0,u=n.length;l<u;l++)switch(r=n[l]){case"/":case"$":case"^":case"+":case".":case"(":case")":case"=":case"!":case"|":i+="\\"+r;break;case"?":if(s){i+=".";break}case"[":case"]":if(s){i+=r;break}case"{":if(s){o=!0,i+="(";break}case"}":if(s){o=!1,i+=")";break}case",":if(o){i+="|";break}i+="\\"+r;break;case"*":for(var h=n[l-1],d=1;"*"===n[l+1];)d++,l++;var p=n[l+1];a?d>1&&("/"===h||void 0===h)&&("/"===p||void 0===p)?(i+="((?:[^/]*(?:/|$))*)",l++):i+="([^/]*)":i+=".*";break;default:i+=r}return c&&~c.indexOf("g")||(i="^"+i+"$"),new RegExp(i,c)}},2493:function(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var s in n={},t)"key"!==s&&(n[s]=t[s]);else n=t;return{$$typeof:r,type:e,key:i,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},1230:function(e,t){"use strict";var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),f=Symbol.iterator,m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function w(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||m}function v(){}function _(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||m}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=w.prototype;var b=_.prototype=new v;b.constructor=_,g(b,w.prototype),b.isPureReactComponent=!0;var I=Array.isArray;function E(){}var S={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function T(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var R=/\/+/g;function A(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function P(e,t,i){if(null==e)return e;var s=[],a=0;return!function e(t,i,s,a,o){var c,l,u,h=typeof t;("undefined"===h||"boolean"===h)&&(t=null);var p=!1;if(null===t)p=!0;else switch(h){case"bigint":case"string":case"number":p=!0;break;case"object":switch(t.$$typeof){case r:case n:p=!0;break;case d:return e((p=t._init)(t._payload),i,s,a,o)}}if(p)return o=o(t),p=""===a?"."+A(t,0):a,I(o)?(s="",null!=p&&(s=p.replace(R,"$&/")+"/"),e(o,i,s,"",function(e){return e})):null!=o&&(C(o)&&(c=o,l=s+(null==o.key||t&&t.key===o.key?"":(""+o.key).replace(R,"$&/")+"/")+p,o=T(c.type,l,c.props)),i.push(o)),1;p=0;var m=""===a?".":a+":";if(I(t))for(var g=0;g<t.length;g++)h=m+A(a=t[g],g),p+=e(a,i,s,h,o);else if("function"==typeof(g=null===(u=t)||"object"!=typeof u?null:"function"==typeof(u=f&&u[f]||u["@@iterator"])?u:null))for(t=g.call(t),g=0;!(a=t.next()).done;)h=m+A(a=a.value,g++),p+=e(a,i,s,h,o);else if("object"===h){if("function"==typeof t.then)return e(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(t),i,s,a,o);throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(i=String(t))?"object with keys {"+Object.keys(t).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.")}return p}(e,s,"","",function(e){return t.call(i,e,a++)}),s}function O(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var N="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};t.Activity=p,t.Children={map:P,forEach:function(e,t,r){P(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=w,t.Fragment=i,t.Profiler=a,t.PureComponent=_,t.StrictMode=s,t.Suspense=u,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=g({},e.props),i=e.key;if(null!=t)for(s in void 0!==t.key&&(i=""+t.key),t)k.call(t,s)&&"key"!==s&&"__self"!==s&&"__source"!==s&&("ref"!==s||void 0!==t.ref)&&(n[s]=t[s]);var s=arguments.length-2;if(1===s)n.children=r;else if(1<s){for(var a=Array(s),o=0;o<s;o++)a[o]=arguments[o+2];n.children=a}return T(e.type,i,n)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:o,_context:e},e},t.createElement=function(e,t,r){var n,i={},s=null;if(null!=t)for(n in void 0!==t.key&&(s=""+t.key),t)k.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var a=arguments.length-2;if(1===a)i.children=r;else if(1<a){for(var o=Array(a),c=0;c<a;c++)o[c]=arguments[c+2];i.children=o}if(e&&e.defaultProps)for(n in a=e.defaultProps)void 0===i[n]&&(i[n]=a[n]);return T(e,s,i)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=S.T,r={};S.T=r;try{var n=e(),i=S.S;null!==i&&i(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(E,N)}catch(e){N(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),S.T=t}},t.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},t.use=function(e){return S.H.use(e)},t.useActionState=function(e,t,r){return S.H.useActionState(e,t,r)},t.useCallback=function(e,t){return S.H.useCallback(e,t)},t.useContext=function(e){return S.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return S.H.useEffect(e,t)},t.useEffectEvent=function(e){return S.H.useEffectEvent(e)},t.useId=function(){return S.H.useId()},t.useImperativeHandle=function(e,t,r){return S.H.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return S.H.useMemo(e,t)},t.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},t.useReducer=function(e,t,r){return S.H.useReducer(e,t,r)},t.useRef=function(e){return S.H.useRef(e)},t.useState=function(e){return S.H.useState(e)},t.useSyncExternalStore=function(e,t,r){return S.H.useSyncExternalStore(e,t,r)},t.useTransition=function(){return S.H.useTransition()},t.version="19.2.0"},4105:function(e,t,r){"use strict";e.exports=r(1230)},4557:function(e,t,r){"use strict";e.exports=r(2493)},8531:function(e,t,r){"use strict";r.d(t,{Dk:()=>k,KO:()=>T,MF:()=>I,Sx:()=>S,Wp:()=>E,j6:()=>w,om:()=>y,xZ:()=>v});var n=r(9247),i=r(4409),s=r(8725),a=r(7165);class o{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if(t=e.getComponent(),t?.type!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let c="@firebase/app",l="0.14.6",u=new i.Vy("@firebase/app"),h="[DEFAULT]",d={[c]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},p=new Map,f=new Map,m=new Map;function g(e,t){try{e.container.addComponent(t)}catch(r){u.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function y(e){let t=e.name;if(m.has(t))return u.debug(`There were multiple attempts to register component ${t}.`),!1;for(let r of(m.set(t,e),p.values()))g(r,e);for(let t of f.values())g(t,e);return!0}function w(e,t){let r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function v(e){return null!=e&&void 0!==e.settings}let _=new s.FA("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 b{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new n.uA("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw _.create("app-deleted",{appName:this._name})}}let I="12.6.0";function E(e,t={}){let r=e;"object"!=typeof t&&(t={name:t});let i={name:h,automaticDataCollectionEnabled:!0,...t},a=i.name;if("string"!=typeof a||!a)throw _.create("bad-app-name",{appName:String(a)});if(r||(r=(0,s.T9)()),!r)throw _.create("no-options");let o=p.get(a);if(o)if((0,s.bD)(r,o.options)&&(0,s.bD)(i,o.config))return o;else throw _.create("duplicate-app",{appName:a});let c=new n.h1(a);for(let e of m.values())c.addComponent(e);let l=new b(r,i,c);return p.set(a,l),l}function S(e=h){let t=p.get(e);if(!t&&e===h&&(0,s.T9)())return E();if(!t)throw _.create("no-app",{appName:e});return t}function k(){return Array.from(p.values())}function T(e,t,r){let i=d[e]??e;r&&(i+=`-${r}`);let s=i.match(/\s|\//),a=t.match(/\s|\//);if(s||a){let e=[`Unable to register library "${i}" with version "${t}":`];s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),u.warn(e.join(" "));return}y(new n.uA(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}let C="firebase-heartbeat-store",R=null;function A(){return R||(R=(0,a.P2)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(C)}catch(e){console.warn(e)}}}).catch(e=>{throw _.create("idb-open",{originalErrorMessage:e.message})})),R}async function P(e){try{let t=(await A()).transaction(C),r=await t.objectStore(C).get(N(e));return await t.done,r}catch(e){if(e instanceof s.g)u.warn(e.message);else{let t=_.create("idb-get",{originalErrorMessage:e?.message});u.warn(t.message)}}}async function O(e,t){try{let r=(await A()).transaction(C,"readwrite"),n=r.objectStore(C);await n.put(t,N(e)),await r.done}catch(e){if(e instanceof s.g)u.warn(e.message);else{let t=_.create("idb-set",{originalErrorMessage:e?.message});u.warn(t.message)}}}function N(e){return`${e.name}!${e.options.appId}`}class U{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new L(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{let e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=D();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){u.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||0===this._heartbeatsCache.heartbeats.length)return"";let e=D(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){let r=[],n=e.slice();for(let i of e){let e=r.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),M(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),M(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=(0,s.Uj)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return u.warn(e),""}}}function D(){return new Date().toISOString().substring(0,10)}class L{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,s.zW)()&&(0,s.eX)().then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await P(this.app);return e?.heartbeats?e:{heartbeats:[]}}}async overwrite(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return O(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return O(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function M(e){return(0,s.Uj)(JSON.stringify({version:2,heartbeats:e})).length}y(new n.uA("platform-logger",e=>new o(e),"PRIVATE")),y(new n.uA("heartbeat",e=>new U(e),"PRIVATE")),T(c,l,""),T(c,l,"esm2020"),T("fire-js","")},9247:function(e,t,r){"use strict";r.d(t,{h1:()=>o,uA:()=>i});var n=r(8725);class i{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let s="[DEFAULT]";class a{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new n.cY;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}if(r)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:s})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=s){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=s){return this.instances.has(e)}getOptions(e=s){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(n);return n}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),n=this.onInitCallbacks.get(r)??new Set;n.add(e),this.onInitCallbacks.set(r,n);let i=this.instances.get(r);return i&&e(i,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let n of r)try{n(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var r;let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e)===s?void 0:r,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},4409:function(e,t,r){"use strict";var n,i;r.d(t,{$b:()=>n,Vy:()=>u});let s=[];(i=n||(n={}))[i.DEBUG=0]="DEBUG",i[i.VERBOSE=1]="VERBOSE",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.ERROR=4]="ERROR",i[i.SILENT=5]="SILENT";let a={debug:n.DEBUG,verbose:n.VERBOSE,info:n.INFO,warn:n.WARN,error:n.ERROR,silent:n.SILENT},o=n.INFO,c={[n.DEBUG]:"log",[n.VERBOSE]:"log",[n.INFO]:"info",[n.WARN]:"warn",[n.ERROR]:"error"},l=(e,t,...r)=>{if(t<e.logLevel)return;let n=new Date().toISOString(),i=c[t];if(i)console[i](`[${n}] ${e.name}:`,...r);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class u{constructor(e){this.name=e,this._logLevel=o,this._logHandler=l,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?a[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.DEBUG,...e),this._logHandler(this,n.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.VERBOSE,...e),this._logHandler(this,n.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.INFO,...e),this._logHandler(this,n.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.WARN,...e),this._logHandler(this,n.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.ERROR,...e),this._logHandler(this,n.ERROR,...e)}}},4186:function(e,t,r){"use strict";r.d(t,{LD:()=>tt,xI:()=>rH,p9:()=>W,iM:()=>tP,ik:()=>t6,kT:()=>t0,x9:()=>t_,F0:()=>tR,gz:()=>el,HF:()=>tn,iZ:()=>tI,hg:()=>tE,Q4:()=>rf,eJ:()=>tv,Nu:()=>eH,df:()=>rn,$2:()=>rd,hk:()=>rL,Wq:()=>e$,gA:()=>tb});var n,i=r(8531),s=r(8725),a=r(4409),o=r(9247);function c(){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."}}let l=new s.FA("auth","Firebase",c()),u=new a.Vy("@firebase/auth");function h(e,...t){u.logLevel<=a.$b.ERROR&&u.error(`Auth (${i.MF}): ${e}`,...t)}function d(e,...t){throw y(e,...t)}function p(e,...t){return y(e,...t)}function f(e,t,r){let n={...c(),[t]:r};return new s.FA("auth","Firebase",n).create(t,{appName:e.name})}function m(e){return f(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function g(e,t,r){if(!(t instanceof r))throw r.name!==t.constructor.name&&d(e,"argument-error"),f(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function y(e,...t){if("string"!=typeof e){let r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return l.create(e,...t)}function w(e,t,...r){if(!e)throw y(t,...r)}function v(e){let t="INTERNAL ASSERTION FAILED: "+e;throw h(t),Error(t)}function _(){return"undefined"!=typeof self&&self.location?.href||""}function b(){return"http:"===I()||"https:"===I()}function I(){return"undefined"!=typeof self&&self.location?.protocol||null}class E{constructor(e,t){var r;this.shortDelay=e,this.longDelay=t,r="Short delay should be less than long delay!",t>e||v(r),this.isMobile=(0,s.jZ)()||(0,s.lV)()}get(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(b()||(0,s.sr)()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function S(e,t){var r,n;r=e.emulator,n="Emulator should always be set here",r||v(n);let{url:i}=e.emulator;return t?`${i}${t.startsWith("/")?t.slice(1):t}`:i}class k{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}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 v("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 v("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 v("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let T={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"},C=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],R=new E(3e4,6e4);function A(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function P(e,t,r,n,i={}){return O(e,i,async()=>{let i={},a={};n&&("GET"===t?a=n:i={body:JSON.stringify(n)});let o=(0,s.Am)({key:e.config.apiKey,...a}).slice(1),c=await e._getAdditionalHeaders();c["Content-Type"]="application/json",e.languageCode&&(c["X-Firebase-Locale"]=e.languageCode);let l={method:t,headers:c,...i};return(0,s.c1)()||(l.referrerPolicy="no-referrer"),e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(l.credentials="include"),k.fetch()(await U(e,e.config.apiHost,r,o),l)})}async function O(e,t,r){e._canInitEmulator=!1;let n={...T,...t};try{let t=new D(e),i=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();let s=await i.json();if("needConfirmation"in s)throw L(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{let[t,r]=(i.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw L(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw L(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw L(e,"user-disabled",s);let a=n[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(r)throw f(e,a,r);d(e,a)}}catch(t){if(t instanceof s.g)throw t;d(e,"network-request-failed",{message:String(t)})}}async function N(e,t,r,n,i={}){let s=await P(e,t,r,n,i);return"mfaPendingCredential"in s&&d(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function U(e,t,r,n){let i=`${t}${r}?${n}`,s=e.config.emulator?S(e.config,i):`${e.config.apiScheme}://${i}`;return C.includes(r)&&(await e._persistenceManagerAvailable,"COOKIE"===e._getPersistenceType())?e._getPersistence()._getFinalTarget(s).toString():s}class D{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(p(this.auth,"network-request-failed")),R.get())})}}function L(e,t,r){let n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);let i=p(e,t,n);return i.customData._tokenResponse=r,i}function M(e){return void 0!==e&&void 0!==e.getResponse}function x(e){return void 0!==e&&void 0!==e.enterprise}class F{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)switch(t.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function j(e){return(await P(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function V(e,t){return P(e,"GET","/v2/recaptchaConfig",A(e,t))}async function H(e,t){return P(e,"POST","/v1/accounts:delete",t)}async function $(e,t){return P(e,"POST","/v1/accounts:lookup",t)}function B(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function W(e,t=!1){return(0,s.Ku)(e).getIdToken(t)}async function z(e,t=!1){let r=(0,s.Ku)(e),n=await r.getIdToken(t),i=q(n);w(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");let a="object"==typeof i.firebase?i.firebase:void 0,o=a?.sign_in_provider;return{claims:i,token:n,authTime:B(K(i.auth_time)),issuedAtTime:B(K(i.iat)),expirationTime:B(K(i.exp)),signInProvider:o||null,signInSecondFactor:a?.sign_in_second_factor||null}}function K(e){return 1e3*Number(e)}function q(e){let[t,r,n]=e.split(".");if(void 0===t||void 0===r||void 0===n)return h("JWT malformed, contained fewer than 3 sections"),null;try{let e=(0,s.u)(r);if(!e)return h("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return h("Caught error parsing JWT payload as JSON",e?.toString()),null}}function G(e){let t=q(e);return w(t,"internal-error"),w(void 0!==t.exp,"internal-error"),w(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function J(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof s.g&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class Z{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(!e)return this.errorBackoff=3e4,Math.max(0,(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class Y{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=B(this.lastLoginAt),this.creationTime=B(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function X(e){var t,r;let n=e.auth,i=await e.getIdToken(),s=await J(e,$(n,{idToken:i}));w(s?.users.length,n,"internal-error");let a=s.users[0];e._notifyReloadListener(a);let o=a.providerUserInfo?.length?ee(a.providerUserInfo):[],c=(t=e.providerData,r=o,[...t.filter(e=>!r.some(t=>t.providerId===e.providerId)),...r]),l=e.isAnonymous,u=!(e.email&&a.passwordHash)&&!c?.length;Object.assign(e,{uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:c,metadata:new Y(a.createdAt,a.lastLoginAt),isAnonymous:!!l&&u})}async function Q(e){let t=(0,s.Ku)(e);await X(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function ee(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function et(e,t){let r=await O(e,{},async()=>{let r=(0,s.Am)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:i}=e.config,a=await U(e,n,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";let c={method:"POST",headers:o,body:r};return e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(c.credentials="include"),k.fetch()(a,c)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function er(e,t){return P(e,"POST","/v2/accounts:revokeToken",A(e,t))}class en{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){w(e.idToken,"internal-error"),w(void 0!==e.idToken,"internal-error"),w(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):G(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){w(0!==e.length,"internal-error");let t=G(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(w(this.refreshToken,e,"user-token-expired"),this.refreshToken)?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:r,refreshToken:n,expiresIn:i}=await et(e,t);this.updateTokensAndExpiration(r,n,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){let{refreshToken:r,accessToken:n,expirationTime:i}=t,s=new en;return r&&(w("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),n&&(w("string"==typeof n,"internal-error",{appName:e}),s.accessToken=n),i&&(w("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new en,this.toJSON())}_performRefresh(){return v("not implemented")}}function ei(e,t){w("string"==typeof e||void 0===e,"internal-error",{appName:t})}class es{constructor({uid:e,auth:t,stsTokenManager:r,...n}){this.providerId="firebase",this.proactiveRefresh=new Z(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=n.displayName||null,this.email=n.email||null,this.emailVerified=n.emailVerified||!1,this.phoneNumber=n.phoneNumber||null,this.photoURL=n.photoURL||null,this.isAnonymous=n.isAnonymous||!1,this.tenantId=n.tenantId||null,this.providerData=n.providerData?[...n.providerData]:[],this.metadata=new Y(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let t=await J(this,this.stsTokenManager.getToken(this.auth,e));return w(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return z(this,e)}reload(){return Q(this)}_assign(e){this!==e&&(w(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new es({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){w(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await X(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if((0,i.xZ)(this.auth.app))return Promise.reject(m(this.auth));let e=await this.getIdToken();return await J(this,H(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){let r=t.displayName??void 0,n=t.email??void 0,i=t.phoneNumber??void 0,s=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,c=t.createdAt??void 0,l=t.lastLoginAt??void 0,{uid:u,emailVerified:h,isAnonymous:d,providerData:p,stsTokenManager:f}=t;w(u&&f,e,"internal-error");let m=en.fromJSON(this.name,f);w("string"==typeof u,e,"internal-error"),ei(r,e.name),ei(n,e.name),w("boolean"==typeof h,e,"internal-error"),w("boolean"==typeof d,e,"internal-error"),ei(i,e.name),ei(s,e.name),ei(a,e.name),ei(o,e.name),ei(c,e.name),ei(l,e.name);let g=new es({uid:u,auth:e,email:n,emailVerified:h,displayName:r,isAnonymous:d,photoURL:s,phoneNumber:i,tenantId:a,stsTokenManager:m,createdAt:c,lastLoginAt:l});return p&&Array.isArray(p)&&(g.providerData=p.map(e=>({...e}))),o&&(g._redirectEventId=o),g}static async _fromIdTokenResponse(e,t,r=!1){let n=new en;n.updateFromServerResponse(t);let i=new es({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await X(i),i}static async _fromGetAccountInfoResponse(e,t,r){let n=t.users[0];w(void 0!==n.localId,"internal-error");let i=void 0!==n.providerUserInfo?ee(n.providerUserInfo):[],s=!(n.email&&n.passwordHash)&&!i?.length,a=new en;a.updateFromIdToken(r);let o=new es({uid:n.localId,auth:e,stsTokenManager:a,isAnonymous:s});return Object.assign(o,{uid:n.localId,displayName:n.displayName||null,photoURL:n.photoUrl||null,email:n.email||null,emailVerified:n.emailVerified||!1,phoneNumber:n.phoneNumber||null,tenantId:n.tenantId||null,providerData:i,metadata:new Y(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash)&&!i?.length}),o}}let ea=new Map;function eo(e){var t,r;t="Expected a class definition",e instanceof Function||v(t);let n=ea.get(e);return n?(r="Instance stored in cache mismatched with class",n instanceof e||v(r)):(n=new e,ea.set(e,n)),n}class ec{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}ec.type="NONE";let el=ec;function eu(e,t,r){return`firebase:${e}:${t}:${r}`}class eh{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:i}=this.auth;this.fullUserKey=eu(this.userKey,n.apiKey,i),this.fullPersistenceKey=eu("persistence",n.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){let t=await $(this.auth,{idToken:e}).catch(()=>void 0);return t?es._fromGetAccountInfoResponse(this.auth,t,e):null}return es._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new eh(eo(el),e,r);let n=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),i=n[0]||eo(el),s=eu(r,e.config.apiKey,e.name),a=null;for(let r of t)try{let t=await r._get(s);if(t){let n;if("string"==typeof t){let r=await $(e,{idToken:t}).catch(()=>void 0);if(!r)break;n=await es._fromGetAccountInfoResponse(e,r,t)}else n=es._fromJSON(e,t);r!==i&&(a=n),i=r;break}}catch{}let o=n.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&o.length&&(i=o[0],a&&await i._set(s,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch{}}))),new eh(i,e,r)}}function ed(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";{if(eg(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(ep(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ew(t))return"Blackberry";if(ev(t))return"Webos";if(ef(t))return"Safari";if((t.includes("chrome/")||em(t))&&!t.includes("edge/"))return"Chrome";if(ey(t))return"Android";let r=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if(r?.length===2)return r[1]}return"Other"}function ep(e=(0,s.ZQ)()){return/firefox\//i.test(e)}function ef(e=(0,s.ZQ)()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function em(e=(0,s.ZQ)()){return/crios\//i.test(e)}function eg(e=(0,s.ZQ)()){return/iemobile/i.test(e)}function ey(e=(0,s.ZQ)()){return/android/i.test(e)}function ew(e=(0,s.ZQ)()){return/blackberry/i.test(e)}function ev(e=(0,s.ZQ)()){return/webos/i.test(e)}function e_(e=(0,s.ZQ)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function eb(e=(0,s.ZQ)()){return e_(e)||ey(e)||ev(e)||ew(e)||/windows phone/i.test(e)||eg(e)}function eI(e,t=[]){let r;switch(e){case"Browser":r=ed((0,s.ZQ)());break;case"Worker":r=`${ed((0,s.ZQ)())}-${e}`;break;default:r=e}let n=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${i.MF}/${n}`}class eE{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let r=t=>new Promise((r,n)=>{try{let n=e(t);r(n)}catch(e){n(e)}});r.onAbort=t,this.queue.push(r);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}async function eS(e,t={}){return P(e,"GET","/v2/passwordPolicy",A(e,t))}class ek{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let r=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),n&&(t.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,t){let r;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let n=0;n<e.length;n++)r=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,n,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class eT{constructor(e,t,r,n){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new eR(this),this.idTokenSubscription=new eR(this),this.beforeStateQueue=new eE(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=l,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=eo(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){if(this.persistenceManager=await eh.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await $(this,{idToken:e}),r=await es._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if((0,i.xZ)(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),r=t,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let t=this.redirectUser?._redirectEventId,i=r?._redirectEventId,s=await this.tryRedirectSignIn(e);(!t||t===i)&&s?.user&&(r=s.user,n=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return(w(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId)?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await X(e)}catch(e){if(e?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if((0,i.xZ)(this.app))return Promise.reject(m(this));let t=e?(0,s.Ku)(e):null;return t&&w(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&w(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return(0,i.xZ)(this.app)?Promise.reject(m(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return(0,i.xZ)(this.app)?Promise.reject(m(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(eo(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new ek(await eS(this));null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new s.FA("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await er(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&eo(e)||this._popupRedirectResolver;w(t,this,"argument-error"),this.redirectPersistenceManager=await eh.create(this,[eo(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return(this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e)?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};let i="function"==typeof t?t:t.next.bind(t),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(w(a,this,"internal-error"),a.then(()=>{s||i(this.currentUser)}),"function"==typeof t){let i=e.addObserver(t,r,n);return()=>{s=!0,i()}}{let r=e.addObserver(t);return()=>{s=!0,r()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return w(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=eI(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if((0,i.xZ)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&function(e,...t){u.logLevel<=a.$b.WARN&&u.warn(`Auth (${i.MF}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function eC(e){return(0,s.Ku)(e)}class eR{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,s.tD)(e=>this.observer=e)}get next(){return w(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let eA={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function eP(e){return eA.loadJS(e)}function eO(e){return`__${e}${Math.floor(1e6*Math.random())}`}class eN{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){let r=this.counter;return this._widgets.set(r,new eL(e,this.auth.name,t||{})),this.counter++,r}reset(e){let t=e||1e12;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){return this._widgets.get(e||1e12)?.getResponse()||""}async execute(e){return this._widgets.get(e||1e12)?.execute(),""}}class eU{constructor(){this.enterprise=new eD}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class eD{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class eL{constructor(e,t,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const n="string"==typeof e?document.getElementById(e):e;w(n,"argument-error",{appName:t}),this.container=n,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout(()=>{this.responseToken=function(e){let t=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<50;e++)t.push(r.charAt(Math.floor(Math.random()*r.length)));return t.join("")}(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw Error("reCAPTCHA mock was already deleted!")}}let eM="NO_RECAPTCHA";class ex{constructor(e){this.type="recaptcha-enterprise",this.auth=eC(e)}async verify(e="verify",t=!1){async function r(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,r)=>{V(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(n=>{if(void 0===n.recaptchaKey)r(Error("recaptcha Enterprise site key undefined"));else{let r=new F(n);return null==e.tenantId?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,t(r.siteKey)}}).catch(e=>{r(e)})})}function n(t,r,n){let i=window.grecaptcha;x(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{r(e)}).catch(()=>{r(eM)})}):n(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new eU().execute("siteKey",{action:"verify"}):new Promise((e,i)=>{r(this.auth).then(r=>{if(!t&&x(window.grecaptcha))n(r,e,i);else{if("undefined"==typeof window)return void i(Error("RecaptchaVerifier is only supported in browser"));let t=eA.recaptchaEnterpriseScript;0!==t.length&&(t+=r),eP(t).then(()=>{n(r,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function eF(e,t,r,n=!1,i=!1){let s,a=new ex(e);if(i)s=eM;else try{s=await a.verify(r)}catch(e){s=await a.verify(r,!0)}let o={...t};if("mfaSmsEnrollment"===r||"mfaSmsSignIn"===r){if("phoneEnrollmentInfo"in o){let e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){let e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return n?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function ej(e,t,r,n,i){if("EMAIL_PASSWORD_PROVIDER"===i)if(!e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))return n(e,t).catch(async i=>{if("auth/missing-recaptcha-token"!==i.code)return Promise.reject(i);{console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let i=await eF(e,t,r,"getOobCode"===r);return n(e,i)}});else{let i=await eF(e,t,r,"getOobCode"===r);return n(e,i)}if("PHONE_PROVIDER"!==i)return Promise.reject(i+" provider is not supported.");if(e._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let i=await eF(e,t,r);return n(e,i).catch(async i=>{if(e._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&("auth/missing-recaptcha-token"===i.code||"auth/invalid-app-credential"===i.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${r} flow.`);let i=await eF(e,t,r,!1,!0);return n(e,i)}return Promise.reject(i)})}{let i=await eF(e,t,r,!1,!0);return n(e,i)}}async function eV(e){let t=eC(e),r=new F(await V(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==t.tenantId?t._agentRecaptchaConfig=r:t._tenantRecaptchaConfigs[t.tenantId]=r,r.isAnyProviderEnabled()&&new ex(t).verify()}function eH(e,t){let r=(0,i.j6)(e,"auth");if(r.isInitialized()){let e=r.getImmediate(),n=r.getOptions();if((0,s.bD)(n,t??{}))return e;d(e,"already-initialized")}return r.initialize({options:t})}function e$(e,t,r){let n=eC(e);w(/^https?:\/\//.test(t),n,"invalid-emulator-scheme");let i=!!r?.disableWarnings,a=eB(t),{host:o,port:c}=function(e){let t=eB(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};let n=r[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(n);if(i){let e=i[1];return{host:e,port:eW(n.substr(e.length+1))}}{let[e,t]=n.split(":");return{host:e,port:eW(t)}}}(t),l=null===c?"":`:${c}`,u={url:`${a}//${o}${l}/`},h=Object.freeze({host:o,port:c,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!n._canInitEmulator){w(n.config.emulator&&n.emulatorConfig,n,"emulator-config-failed"),w((0,s.bD)(u,n.config.emulator)&&(0,s.bD)(h,n.emulatorConfig),n,"emulator-config-failed");return}n.config.emulator=u,n.emulatorConfig=h,n.settings.appVerificationDisabledForTesting=!0,(0,s.zJ)(o)?((0,s.gE)(`${a}//${o}${l}`),(0,s.P1)("Auth",!0)):i||function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function eB(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function eW(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class ez{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return v("not implemented")}_getIdTokenResponse(e){return v("not implemented")}_linkToIdToken(e,t){return v("not implemented")}_getReauthenticationResolver(e){return v("not implemented")}}async function eK(e,t){return P(e,"POST","/v1/accounts:signUp",t)}async function eq(e,t){return N(e,"POST","/v1/accounts:signInWithPassword",A(e,t))}async function eG(e,t){return P(e,"POST","/v1/accounts:sendOobCode",A(e,t))}async function eJ(e,t){return eG(e,t)}async function eZ(e,t){return N(e,"POST","/v1/accounts:signInWithEmailLink",A(e,t))}async function eY(e,t){return N(e,"POST","/v1/accounts:signInWithEmailLink",A(e,t))}class eX extends ez{constructor(e,t,r,n=null){super("password",r),this._email=e,this._password=t,this._tenantId=n}static _fromEmailAndPassword(e,t){return new eX(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new eX(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if(t?.email&&t?.password){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);else if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return ej(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",eq,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return eZ(e,{email:this._email,oobCode:this._password});default:d(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return ej(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",eK,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return eY(e,{idToken:t,email:this._email,oobCode:this._password});default:d(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function eQ(e,t){return N(e,"POST","/v1/accounts:signInWithIdp",A(e,t))}class e0 extends ez{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new e0(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):d("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let{providerId:t,signInMethod:r,...n}="string"==typeof e?JSON.parse(e):e;if(!t||!r)return null;let i=new e0(t,r);return i.idToken=n.idToken||void 0,i.accessToken=n.accessToken||void 0,i.secret=n.secret,i.nonce=n.nonce,i.pendingToken=n.pendingToken||null,i}_getIdTokenResponse(e){return eQ(e,this.buildRequest())}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,eQ(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,eQ(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=(0,s.Am)(t)}return e}}async function e1(e,t){return P(e,"POST","/v1/accounts:sendVerificationCode",A(e,t))}async function e6(e,t){return N(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,t))}async function e2(e,t){let r=await N(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,t));if(r.temporaryProof)throw L(e,"account-exists-with-different-credential",r);return r}let e3={USER_NOT_FOUND:"user-not-found"};async function e4(e,t){return N(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,{...t,operation:"REAUTH"}),e3)}class e5 extends ez{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new e5({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new e5({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return e6(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return e2(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return e4(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:n}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:n}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}=e;return r||t||n||i?new e5({verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}):null}}class e8{constructor(e){const t=(0,s.I9)((0,s.hp)(e)),r=t.apiKey??null,n=t.oobCode??null,i=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(t.mode??null);w(r&&n&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=n,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t,r,n,i=(r=(t=(0,s.I9)((0,s.hp)(e)).link)?(0,s.I9)((0,s.hp)(t)).deep_link_id:null,((n=(0,s.I9)((0,s.hp)(e)).deep_link_id)?(0,s.I9)((0,s.hp)(n)).link:null)||n||r||t||e);try{return new e8(i)}catch{return null}}}class e7{constructor(){this.providerId=e7.PROVIDER_ID}static credential(e,t){return eX._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let r=e8.parseLink(t);return w(r,"argument-error"),eX._fromEmailAndCode(e,r.code,r.tenantId)}}e7.PROVIDER_ID="password",e7.EMAIL_PASSWORD_SIGN_IN_METHOD="password",e7.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class e9{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class te extends e9{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class tt extends te{static credentialFromJSON(e){let t="string"==typeof e?JSON.parse(e):e;return w("providerId"in t&&"signInMethod"in t,"argument-error"),e0._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return w(e.idToken||e.accessToken,"argument-error"),e0._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return tt.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return tt.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:n,pendingToken:i,nonce:s,providerId:a}=e;if(!r&&!n&&!t&&!i||!a)return null;try{return new tt(a)._credential({idToken:t,accessToken:r,nonce:s,pendingToken:i})}catch(e){return null}}}class tr extends te{constructor(){super("facebook.com")}static credential(e){return e0._fromParams({providerId:tr.PROVIDER_ID,signInMethod:tr.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return tr.credentialFromTaggedObject(e)}static credentialFromError(e){return tr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return tr.credential(e.oauthAccessToken)}catch{return null}}}tr.FACEBOOK_SIGN_IN_METHOD="facebook.com",tr.PROVIDER_ID="facebook.com";class tn extends te{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return e0._fromParams({providerId:tn.PROVIDER_ID,signInMethod:tn.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return tn.credentialFromTaggedObject(e)}static credentialFromError(e){return tn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return tn.credential(t,r)}catch{return null}}}tn.GOOGLE_SIGN_IN_METHOD="google.com",tn.PROVIDER_ID="google.com";class ti extends te{constructor(){super("github.com")}static credential(e){return e0._fromParams({providerId:ti.PROVIDER_ID,signInMethod:ti.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ti.credentialFromTaggedObject(e)}static credentialFromError(e){return ti.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ti.credential(e.oauthAccessToken)}catch{return null}}}ti.GITHUB_SIGN_IN_METHOD="github.com",ti.PROVIDER_ID="github.com";class ts extends te{constructor(){super("twitter.com")}static credential(e,t){return e0._fromParams({providerId:ts.PROVIDER_ID,signInMethod:ts.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return ts.credentialFromTaggedObject(e)}static credentialFromError(e){return ts.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return ts.credential(t,r)}catch{return null}}}async function ta(e,t){return N(e,"POST","/v1/accounts:signUp",A(e,t))}ts.TWITTER_SIGN_IN_METHOD="twitter.com",ts.PROVIDER_ID="twitter.com";class to{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,n=!1){return new to({user:await es._fromIdTokenResponse(e,r,n),providerId:tc(r),_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){return await e._updateTokensIfNecessary(r,!0),new to({user:e,providerId:tc(r),_tokenResponse:r,operationType:t})}}function tc(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class tl extends s.g{constructor(e,t,r,n){super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,tl.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new tl(e,t,r,n)}}function tu(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch(r=>{if("auth/multi-factor-auth-required"===r.code)throw tl._fromErrorAndOperation(e,r,t,n);throw r})}async function th(e,t,r=!1){let n=await J(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return to._forOperation(e,"link",n)}async function td(e,t,r=!1){let{auth:n}=e;if((0,i.xZ)(n.app))return Promise.reject(m(n));let s="reauthenticate";try{let i=await J(e,tu(n,s,t,e),r);w(i.idToken,n,"internal-error");let a=q(i.idToken);w(a,n,"internal-error");let{sub:o}=a;return w(e.uid===o,n,"user-mismatch"),to._forOperation(e,s,i)}catch(e){throw e?.code==="auth/user-not-found"&&d(n,"user-mismatch"),e}}async function tp(e,t,r=!1){if((0,i.xZ)(e.app))return Promise.reject(m(e));let n="signIn",s=await tu(e,n,t),a=await to._fromIdTokenResponse(e,n,s);return r||await e._updateCurrentUser(a.user),a}async function tf(e,t){return tp(eC(e),t)}class tm{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?tg._fromServerResponse(e,t):"totpInfo"in t?ty._fromServerResponse(e,t):d(e,"internal-error")}}class tg extends tm{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new tg(t)}}class ty extends tm{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new ty(t)}}async function tw(e){let t=eC(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function tv(e,t,r){if((0,i.xZ)(e.app))return Promise.reject(m(e));let n=eC(e),s=ej(n,{returnSecureToken:!0,email:t,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ta,"EMAIL_PASSWORD_PROVIDER"),a=await s.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&tw(e),t}),o=await to._fromIdTokenResponse(n,"signIn",a);return await n._updateCurrentUser(o.user),o}function t_(e,t,r){return(0,i.xZ)(e.app)?Promise.reject(m(e)):tf((0,s.Ku)(e),e7.credential(t,r)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&tw(e),t})}async function tb(e,t){var r;let n=(0,s.Ku)(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&(r=n.auth,w(t.url?.length>0,r,"invalid-continue-uri"),w(void 0===t.dynamicLinkDomain||t.dynamicLinkDomain.length>0,r,"invalid-dynamic-link-domain"),w(void 0===t.linkDomain||t.linkDomain.length>0,r,"invalid-hosting-link-domain"),i.continueUrl=t.url,i.dynamicLinkDomain=t.dynamicLinkDomain,i.linkDomain=t.linkDomain,i.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(w(t.iOS.bundleId.length>0,r,"missing-ios-bundle-id"),i.iOSBundleId=t.iOS.bundleId),t.android&&(w(t.android.packageName.length>0,r,"missing-android-pkg-name"),i.androidInstallApp=t.android.installApp,i.androidMinimumVersionCode=t.android.minimumVersion,i.androidPackageName=t.android.packageName));let{email:a}=await eJ(n.auth,i);a!==e.email&&await e.reload()}function tI(e,t,r,n){return(0,s.Ku)(e).onIdTokenChanged(t,r,n)}function tE(e,t,r,n){return(0,s.Ku)(e).onAuthStateChanged(t,r,n)}function tS(e,t){return P(e,"POST","/v2/accounts/mfaEnrollment:start",A(e,t))}new WeakMap;let tk="__sak";class tT{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(tk,"1"),this.storage.removeItem(tk),Promise.resolve(!0)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class tC extends tT{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=eb(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)});let r=e.key;t?this.detachListener():this.stopPolling();let n=()=>{let e=this.storage.getItem(r);(t||this.localCache[r]!==e)&&this.notifyListeners(r,e)},i=this.storage.getItem(r);(0,s.lT)()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}tC.type="LOCAL";let tR=tC;class tA extends tT{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}tA.type="SESSION";let tP=tA;class tO{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let r=new tO(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:r,data:n}=e.data,i=this.handlersMap[r];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:r});let s=Array.from(i).map(async t=>t(e.origin,n)),a=await Promise.all(s.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function tN(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}tO.receivers=[];class tU{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){let n,i,s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((a,o)=>{let c=tN("",20);s.port1.start();let l=setTimeout(()=>{o(Error("unsupported_event"))},r);i={messageChannel:s,onMessage(e){if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),n=setTimeout(()=>{o(Error("timeout"))},3e3);break;case"done":clearTimeout(n),a(e.data.response);break;default:clearTimeout(l),clearTimeout(n),o(Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function tD(){return window}function tL(){return void 0!==tD().WorkerGlobalScope&&"function"==typeof tD().importScripts}async function tM(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}let tx="firebaseLocalStorageDb",tF="firebaseLocalStorage",tj="fbase_key";class tV{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function tH(e,t){return e.transaction([tF],t?"readwrite":"readonly").objectStore(tF)}function t$(){let e=indexedDB.open(tx,1);return new Promise((t,r)=>{e.addEventListener("error",()=>{r(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(tF,{keyPath:tj})}catch(e){r(e)}}),e.addEventListener("success",async()=>{let r=e.result;r.objectStoreNames.contains(tF)?t(r):(r.close(),await new tV(indexedDB.deleteDatabase(tx)).toPromise(),t(await t$()))})})}async function tB(e,t,r){return new tV(tH(e,!0).put({[tj]:t,value:r})).toPromise()}async function tW(e,t){let r=tH(e,!1).get(t),n=await new tV(r).toPromise();return void 0===n?null:n.value}function tz(e,t){return new tV(tH(e,!0).delete(t)).toPromise()}class tK{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 t$()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return tL()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=tO._getInstance(tL()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await tM(),!this.activeServiceWorker)return;this.sender=new tU(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await t$();return await tB(e,tk,"1"),await tz(e,tk),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>tB(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>tW(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>tz(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new tV(tH(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],r=new Set;if(0!==e.length)for(let{fbase_key:n,value:i}of e)r.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),t.push(n));for(let e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}function tq(e,t){return P(e,"POST","/v2/accounts/mfaSignIn:start",A(e,t))}tK.type="LOCAL";let tG=eO("rcb"),tJ=new E(3e4,6e4);class tZ{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!tD().grecaptcha?.render}load(e,t=""){var r;return(w((r=t).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(r),e,"argument-error"),this.shouldResolveImmediately(t)&&M(tD().grecaptcha))?Promise.resolve(tD().grecaptcha):new Promise((r,n)=>{let i=tD().setTimeout(()=>{n(p(e,"network-request-failed"))},tJ.get());tD()[tG]=()=>{tD().clearTimeout(i),delete tD()[tG];let s=tD().grecaptcha;if(!s||!M(s))return void n(p(e,"internal-error"));let a=s.render;s.render=(e,t)=>{let r=a(e,t);return this.counter++,r},this.hostLanguage=t,r(s)},eP(`${eA.recaptchaV2Script}?${(0,s.Am)({onload:tG,render:"explicit",hl:t})}`).catch(()=>{clearTimeout(i),n(p(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!tD().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}class tY{async load(e){return new eN(e)}clearedOneInstance(){}}let tX="recaptcha",tQ={theme:"light",type:"image"};class t0{constructor(e,t,r={...tQ}){this.parameters=r,this.type=tX,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=eC(e),this.isInvisible="invisible"===this.parameters.size,w("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");const n="string"==typeof t?document.getElementById(t):t;w(n,this.auth,"argument-error"),this.container=n,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new tY:new tZ,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),r=t.getResponse(e);return r||new Promise(r=>{let n=e=>{e&&(this.tokenChangeListeners.delete(n),r(e))};this.tokenChangeListeners.add(n),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){w(!this.parameters.sitekey,this.auth,"argument-error"),w(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),w("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof e)e(t);else if("string"==typeof e){let r=tD()[e];"function"==typeof r&&r(t)}}}assertNotDestroyed(){w(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){let e;w(b()&&!tL(),this.auth,"internal-error"),await (e=null,new Promise(t=>{"complete"===document.readyState?t():(e=()=>t(),window.addEventListener("load",e))}).catch(t=>{throw e&&window.removeEventListener("load",e),t})),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let t=await j(this.auth);w(t,this.auth,"internal-error"),this.parameters.sitekey=t}getAssertedRecaptcha(){return w(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class t1{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=e5._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function t6(e,t,r){if((0,i.xZ)(e.app))return Promise.reject(m(e));let n=eC(e);return new t1(await t2(n,t,(0,s.Ku)(r)),e=>tf(n,e))}async function t2(e,t,r){if(!e._getRecaptchaConfig())try{await eV(e)}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let n;if(n="string"==typeof t?{phoneNumber:t}:t,"session"in n){let t=n.session;if("phoneNumber"in n){w("enroll"===t.type,e,"internal-error");let i={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===eM){w(r?.type===tX,e,"argument-error");let n=await t3(e,t,r);return tS(e,n)}return tS(e,t)},a=ej(e,i,"mfaSmsEnrollment",s,"PHONE_PROVIDER");return(await a.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{w("signin"===t.type,e,"internal-error");let i=n.multiFactorHint?.uid||n.multiFactorUid;w(i,e,"missing-multi-factor-info");let s={mfaPendingCredential:t.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===eM){w(r?.type===tX,e,"argument-error");let n=await t3(e,t,r);return tq(e,n)}return tq(e,t)},o=ej(e,s,"mfaSmsSignIn",a,"PHONE_PROVIDER");return(await o.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{let t={phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"},i=async(e,t)=>{if(t.captchaResponse===eM){w(r?.type===tX,e,"argument-error");let n=await t3(e,t,r);return e1(e,n)}return e1(e,t)},s=ej(e,t,"sendVerificationCode",i,"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{r?._reset()}}async function t3(e,t,r){w(r.type===tX,e,"argument-error");let n=await r.verify();w("string"==typeof n,e,"argument-error");let i={...t};if("phoneEnrollmentInfo"in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,r=i.phoneEnrollmentInfo.clientType,s=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n,captchaResponse:t,clientType:r,recaptchaVersion:s}}),i}if(!("phoneSignInInfo"in i))return Object.assign(i,{recaptchaToken:n}),i;{let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,r=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:n,captchaResponse:e,clientType:t,recaptchaVersion:r}}),i}}class t4{constructor(e){this.providerId=t4.PROVIDER_ID,this.auth=eC(e)}verifyPhoneNumber(e,t){return t2(this.auth,e,(0,s.Ku)(t))}static credential(e,t){return e5._fromVerification(e,t)}static credentialFromResult(e){return t4.credentialFromTaggedObject(e)}static credentialFromError(e){return t4.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:r}=e;return t&&r?e5._fromTokenResponse(t,r):null}}function t5(e,t){return t?eo(t):(w(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}t4.PROVIDER_ID="phone",t4.PHONE_SIGN_IN_METHOD="phone";class t8 extends ez{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return eQ(e,this._buildIdpRequest())}_linkToIdToken(e,t){return eQ(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return eQ(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function t7(e){return tp(e.auth,new t8(e),e.bypassAuthState)}function t9(e){let{auth:t,user:r}=e;return w(r,t,"internal-error"),td(r,new t8(e),e.bypassAuthState)}async function re(e){let{auth:t,user:r}=e;return w(r,t,"internal-error"),th(r,new t8(e),e.bypassAuthState)}class rt{constructor(e,t,r,n,i=!1){this.auth=e,this.resolver=r,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:r,postBody:n,tenantId:i,error:s,type:a}=e;if(s)return void this.reject(s);let o={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return t7;case"linkViaPopup":case"linkViaRedirect":return re;case"reauthViaPopup":case"reauthViaRedirect":return t9;default:d(this.auth,"internal-error")}}resolve(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||v(r),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||v(r),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let rr=new E(2e3,1e4);async function rn(e,t,r){if((0,i.xZ)(e.app))return Promise.reject(p(e,"operation-not-supported-in-this-environment"));let n=eC(e);g(e,t,e9);let s=t5(n,r);return new ri(n,"signInViaPopup",t,s).executeNotNull()}class ri extends rt{constructor(e,t,r,n,i){super(e,t,n,i),this.provider=r,this.authWindow=null,this.pollId=null,ri.currentPopupAction&&ri.currentPopupAction.cancel(),ri.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return w(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||v(t);let r=tN();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],r),this.authWindow.associatedEvent=r,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(p(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(p(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ri.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(p(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,rr.get())};e()}}ri.currentPopupAction=null;let rs=new Map;class ra extends rt{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=rs.get(this.auth._key());if(!e){try{let t=await ro(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}rs.set(this.auth._key(),e)}return this.bypassAuthState||rs.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type)return void this.resolve(null);if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function ro(e,t){let r=rh(t),n=ru(e);if(!await n._isAvailable())return!1;let i=await n._get(r)==="true";return await n._remove(r),i}async function rc(e,t){return ru(e)._set(rh(t),"true")}function rl(e,t){rs.set(e._key(),t)}function ru(e){return eo(e._redirectPersistence)}function rh(e){return eu("pendingRedirect",e.config.apiKey,e.name)}function rd(e,t,r){return rp(e,t,r)}async function rp(e,t,r){if((0,i.xZ)(e.app))return Promise.reject(m(e));let n=eC(e);g(e,t,e9),await n._initializationPromise;let s=t5(n,r);return await rc(s,n),s._openRedirect(n,t,"signInViaRedirect")}async function rf(e,t){return await eC(e)._initializationPromise,rm(e,t,!1)}async function rm(e,t,r=!1){if((0,i.xZ)(e.app))return Promise.reject(m(e));let n=eC(e),s=t5(n,t),a=new ra(n,s,r),o=await a.execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}class rg{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return rw(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!rw(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(p(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(ry(e))}saveEventToCache(e){this.cachedEventUids.add(ry(e)),this.lastProcessedEventTime=Date.now()}}function ry(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function rw({type:e,error:t}){return"unknown"===e&&t?.code==="auth/no-auth-event"}async function rv(e,t={}){return P(e,"GET","/v1/projects",t)}let r_=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,rb=/^https?/;async function rI(e){if(e.config.emulator)return;let{authorizedDomains:t}=await rv(e);for(let e of t)try{if(function(e){let t=_(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){let i=new URL(e);return""===i.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&i.hostname===n}if(!rb.test(r))return!1;if(r_.test(e))return n===e;let i=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}(e))return}catch{}d(e,"unauthorized-domain")}let rE=new E(3e4,6e4);function rS(){let e=tD().___jsl;if(e?.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let rk=null,rT=new E(5e3,15e3),rC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},rR=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function rA(e){let t,r,n,a,o,c=await (rk=rk||new Promise((t,r)=>{function n(){rS(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{rS(),r(p(e,"network-request-failed"))},timeout:rE.get()})}if(tD().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else if(tD().gapi?.load)n();else{let t=eO("iframefcb");return tD()[t]=()=>{gapi.load?n():r(p(e,"network-request-failed"))},eP(`${eA.gapiScript}?onload=${t}`).catch(e=>r(e))}}).catch(e=>{throw rk=null,e})),l=tD().gapi;return w(l,e,"internal-error"),c.open({where:document.body,url:(w((t=e.config).authDomain,e,"auth-domain-config-required"),r=t.emulator?S(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:i.MF},(a=rR.get(e.config.apiHost))&&(n.eid=a),(o=e._getFrameworks()).length&&(n.fw=o.join(",")),`${r}?${(0,s.Am)(n).slice(1)}`),messageHandlersFilter:l.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rC,dontclear:!0},t=>new Promise(async(r,n)=>{await t.restyle({setHideOnLeave:!1});let i=p(e,"network-request-failed"),s=tD().setTimeout(()=>{n(i)},rT.get());function a(){tD().clearTimeout(s),r(t)}t.ping(a).then(a,()=>{n(i)})}))}let rP={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class rO{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let rN=encodeURIComponent("fac");async function rU(e,t,r,n,a,o){w(e.config.authDomain,e,"auth-domain-config-required"),w(e.config.apiKey,e,"invalid-api-key");let c={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:i.MF,eventId:a};if(t instanceof e9)for(let[r,n]of(t.setDefaultLanguage(e.languageCode),c.providerId=t.providerId||"",(0,s.Im)(t.getCustomParameters())||(c.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(o||{})))c[r]=n;if(t instanceof te){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(c.scopes=e.join(","))}for(let t of(e.tenantId&&(c.tid=e.tenantId),Object.keys(c)))void 0===c[t]&&delete c[t];let l=await e._getAppCheckToken(),u=l?`#${rN}=${encodeURIComponent(l)}`:"";return`${function({config:e}){return e.emulator?S(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${(0,s.Am)(c).slice(1)}${u}`}let rD="webStorageSupport",rL=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=tP,this._completeRedirectFn=rm,this._overrideRedirectResult=rl}async _openPopup(e,t,r,n){var i,a;i=this.eventManagers[e._key()]?.manager,a="_initialize() not called before _openPopup()",i||v(a);let o=await rU(e,t,r,_(),n);return function(e,t,r,n=500,i=600){let a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-n)/2,0).toString(),c="",l={...rP,width:n.toString(),height:i.toString(),top:a,left:o},u=(0,s.ZQ)().toLowerCase();r&&(c=em(u)?"_blank":r),ep(u)&&(t=t||"http://localhost",l.scrollbars="yes");let h=Object.entries(l).reduce((e,[t,r])=>`${e}${t}=${r},`,"");if(function(e=(0,s.ZQ)()){return e_(e)&&!!window.navigator?.standalone}(u)&&"_self"!==c){var d,p;let e,r;return d=t||"",p=c,(e=document.createElement("a")).href=d,e.target=p,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),e.dispatchEvent(r),new rO(null)}let f=window.open(t||"",c,h);w(f,e,"popup-blocked");try{f.focus()}catch(e){}return new rO(f)}(e,o,tN())}async _openRedirect(e,t,r,n){var i;return await this._originValidation(e),i=await rU(e,t,r,_(),n),tD().location.href=i,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var r;let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(r="If manager is not set, promise should be",n||v(r),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await rA(e),r=new rg(e);return t.register("authEvent",t=>(w(t?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(rD,{type:rD},r=>{let n=r?.[0]?.[rD];void 0!==n&&t(!!n),d(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=rI(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return eb()||ef()||e_()}};var rM="@firebase/auth",rx="1.11.1";class rF{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return(this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser)?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){w(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let rj=(0,s.XA)("authIdTokenMaxAge")||300,rV=null;function rH(e=(0,i.Sx)()){let t=(0,i.j6)(e,"auth");if(t.isInitialized())return t.getImmediate();let r=eH(e,{popupRedirectResolver:rL,persistence:[tK,tR,tP]}),n=(0,s.XA)("authTokenSyncURL");if(n&&"boolean"==typeof isSecureContext&&isSecureContext){let e=new URL(n,location.origin);if(location.origin===e.origin){let t,n=(t=e.toString(),async e=>{let r=e&&await e.getIdTokenResult(),n=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(n&&n>rj)return;let i=r?.token;rV!==i&&(rV=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});(0,s.Ku)(r).beforeAuthStateChanged(n,()=>n(r.currentUser)),tI(r,e=>n(e))}}let a=(0,s.Tj)("auth");return a&&e$(r,`http://${a}`),r}eA={loadJS:e=>new Promise((t,r)=>{let n=document.createElement("script");n.setAttribute("src",e),n.onload=t,n.onerror=e=>{let t=p("internal-error");t.customData=e,r(t)},n.type="text/javascript",n.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(n)}),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="},n="Browser",(0,i.om)(new o.uA("auth",(e,{options:t})=>{let r,i,s=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:c,authDomain:l}=s.options;w(c&&!c.includes(":"),"invalid-api-key",{appName:s.name});let u=new eT(s,a,o,{apiKey:c,authDomain:l,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:eI(n)});return i=(Array.isArray(r=t?.persistence||[])?r:[r]).map(eo),t?.errorMap&&u._updateErrorMap(t.errorMap),u._initializeWithPersistence(i,t?.popupRedirectResolver),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),(0,i.om)(new o.uA("auth-internal",e=>new rF(eC(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,i.KO)(rM,rx,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(n)),(0,i.KO)(rM,rx,"esm2020")},7165:function(e,t,r){"use strict";let n,i,s;r.d(t,{P2:()=>f});let a=new WeakMap,o=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,h={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return o.get(e);if("objectStoreNames"===t)return e.objectStoreNames||c.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return d(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function d(e){if(e instanceof IDBRequest){let t;return(t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(d(e.result)),n()},s=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",s)})).then(t=>{t instanceof IDBCursor&&a.set(t,e)}).catch(()=>{}),u.set(t,e),t}if(l.has(e))return l.get(e);let t=function(e){if("function"==typeof e)return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(p(this),t),d(a.get(this))}:function(...t){return d(e.apply(p(this),t))}:function(t,...r){let n=e.call(p(this),t,...r);return c.set(n,t.sort?t.sort():[t]),d(n)};return e instanceof IDBTransaction&&function(e){if(o.has(e))return;let t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});o.set(e,t)}(e),(n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,h):e}(e);return t!==e&&(l.set(e,t),u.set(t,e)),t}let p=e=>u.get(e);function f(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){let a=indexedDB.open(e,t),o=d(a);return n&&a.addEventListener("upgradeneeded",e=>{n(d(a.result),e.oldVersion,e.newVersion,d(a.transaction),e)}),r&&a.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}let m=["get","getKey","getAll","getAllKeys","count"],g=["put","add","delete","clear"],y=new Map;function w(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(y.get(t))return y.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,i=g.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||m.includes(r)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),a=s.store;return n&&(a=a.index(t.shift())),(await Promise.all([a[r](...t),i&&s.done]))[0]};return y.set(t,s),s}h={...s=h,get:(e,t,r)=>w(e,t)||s.get(e,t,r),has:(e,t)=>!!w(e,t)||s.has(e,t)}},2782:function(e,t,r){"use strict";function n(e){return e?e.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace(/-|_/,"")):""}function i(e){return e?e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`):""}r.d(t,{$x:()=>a,C8:()=>i,sF:()=>n});var s=e=>{let t=r=>{if(!r)return r;if(Array.isArray(r))return r.map(e=>"object"==typeof e||Array.isArray(e)?t(e):e);let n={...r};for(let r of Object.keys(n)){let i=e(r.toString());i!==r&&(n[i]=n[r],delete n[r]),"object"==typeof n[i]&&(n[i]=t(n[i]))}return n};return t};function a(e){return e*Math.random()}s(i),s(n)},5305:function(e,t,r){"use strict";function n(e){return{code:e.code,message:e.message}}r.d(t,{R6:()=>s,yS:()=>i});var i=class e extends Error{constructor(t,{data:r,status:i,retryAfter:s}){super(t),this.toString=()=>`[${this.name}]
18
+ Message:${this.message}
19
+ Status:${this.status}
20
+ Serialized errors: ${this.errors.map(e=>JSON.stringify(e))}`,Object.setPrototypeOf(this,e.prototype),this.status=i,this.message=t,this.retryAfter=s,this.ternSecureError=!0,this.errors=function(e=[]){return e.length>0?e.map(n):[]}(r)}},s=class e extends Error{constructor(t,{code:r}){const n="\uD83D\uDD12 TernSecure:",i=RegExp(n.replace(" ","\\s*"),"i"),s=t.replace(i,""),a=`${n} ${s.trim()}
21
+
22
+ (code="${r}")
23
+ `;super(a),this.toString=()=>`[${this.name}]
24
+ Message:${this.message}`,Object.setPrototypeOf(this,e.prototype),this.code=r,this.message=a,this.ternSecureRuntimeError=!0,this.name="TernSecureRuntimeError"}}},802:function(e,t,r){"use strict";r.d(t,{sQ:()=>a,e3:()=>s,UQ:()=>y,qn:()=>g,xq:()=>o,_x:()=>i});var n=r(4105);function i(e,t){if(!e)throw"string"==typeof t?Error(t):Error(`${t.displayName} not found`)}Object.prototype.hasOwnProperty;var s=(e,t)=>{let{assertCtxFn:r=i}=t||{},s=n.createContext(void 0);return s.displayName=e,[s,()=>{let t=n.useContext(s);return r(t,`${e} not found`),t.value},()=>{let e=n.useContext(s);return e?e.value:{}}]},[a,o]=s("TernSecureAuthCtx"),[c,l]=s("TernSecureInstanceContext"),[u,h]=s("TernSecureAuthContext"),[d,p]=s("SessionContext"),[f,m]=s("UserContext"),g=()=>(!function(e){if(!(0,n.useContext)(a)){if("function"==typeof e)return e();throw Error(`${e} can only be used within the <TernSecureProvider /> component.
25
+
26
+ Possible fixes:
27
+ 1. Ensure that the <TernSecureProvider /> is correctly wrapping your application
28
+ 2. Check for multiple versions of @tern-secure packages in your project`)}}("useTernSecure"),o()),y="undefined"!=typeof window?n.useLayoutEffect:n.useEffect},8978:function(e,t,r){"use strict";function n(e=""){return(e||"").replace(/^.+:\/\//,"")}r.d(t,{W:()=>n,v:()=>s});var i=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,s=e=>i.test(e)}},o={};function c(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,c),r.exports}c.m=a,u=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);c.r(r);var n={};l=l||[null,u({}),u([]),u(u)];for(var i=2&t&&e;("object"==typeof i||"function"==typeof i)&&!~l.indexOf(i);i=u(i))Object.getOwnPropertyNames(i).forEach(t=>{n[t]=()=>e[t]});return n.default=()=>e,c.d(r,n),r},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,r)=>(c.f[r](e,t),t),[])),c.k=e=>""+({10:"signin",472:"signup",99:"userbutton"})[e]+"_ternsecure_"+c.h().slice(0,6)+"_1.1.0-canary.v20251206165958.css",c.u=e=>""+(({10:"signin",26:"framework",472:"signup",545:"vendors",666:"ui-common",99:"userbutton"})[e]||e)+"_ternsecure_"+c.h().slice(0,6)+"_1.1.0-canary.v20251206165958.js",c.h=()=>"e3855438fbb3bf08",c.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h={},c.l=function(e,t,r,n){if(h[e])return void h[e].push(t);if(void 0!==r)for(var i,s,a=document.getElementsByTagName("script"),o=0;o<a.length;o++){var l=a[o];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tern-secure/auth:"+r){i=l;break}}i||(s=!0,(i=document.createElement("script")).timeout=120,c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack","@tern-secure/auth:"+r),i.src=e),h[e]=[t];var u=function(t,r){i.onerror=i.onload=null,clearTimeout(d);var n=h[e];if(delete h[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(function(e){return e(r)}),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),s&&document.head.appendChild(i)},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(d=c.g.location+"");var l,u,h,d,p=c.g.document;if(!d&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(d=p.currentScript.src),!d)){var f=p.getElementsByTagName("script");if(f.length)for(var m=f.length-1;m>-1&&(!d||!/^http(s?):/.test(d));)d=f[m--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");return c.p=d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e={},t="@tern-secure/auth",r="data-webpack-loading",c.f.css=(n,i,s)=>{var a=c.o(e,n)?e[n]:void 0;if(0!==a)if(a)i.push(a[2]);else if(/^(10|472|99)$/.test(n)){var o=new Promise(function(t,r){a=e[n]=[t,r]});i.push(a[2]=o);var l=c.p+c.k(n),u=Error(),h=function(t){if(c.o(e,n)&&(0!==(a=e[n])&&(e[n]=void 0),a))if("load"!==t.type){var r=t&&t.type,i=t&&t.target&&t.target.src;u.message="Loading css chunk "+n+" failed.\n("+r+": "+i+")",u.name="ChunkLoadError",u.type=r,u.request=i,a[1](u)}else c.m,e[n]=0,a[0]()};"undefined"!=typeof document?((e,n,i,s,a)=>{var o,l,u="chunk-"+e;if(!s){for(var h=document.getElementsByTagName("link"),d=0;d<h.length;d++){var p=h[d],f=p.getAttribute("href")||p.href;if(f&&!f.startsWith(c.p)&&(f=c.p+(f.startsWith("/")?f.slice(1):f)),"stylesheet"==p.rel&&(f&&f.startsWith(n)||p.getAttribute("data-webpack")==t+":"+u)){o=p;break}}if(!i)return}o||(l=!0,o=document.createElement("link"),c.nc&&o.setAttribute("nonce",c.nc),o.setAttribute("data-webpack",t+":"+u),o.setAttribute(r,1),o.rel="stylesheet",o.href=n);var m=(e,t)=>{if(o.onerror=o.onload=null,o.removeAttribute(r),clearTimeout(g),t&&"load"!=t.type&&o.parentNode.removeChild(o),i(t),e)return e(t)};if(o.getAttribute(r)){var g=setTimeout(m.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=m.bind(null,o.onerror),o.onload=m.bind(null,o.onload)}else m(void 0,{type:"load",target:o});return s&&s.getAttribute("fetchpriority")&&o.setAttribute("fetchpriority",s.getAttribute("fetchpriority")),s?document.head.insertBefore(o,s):l&&document.head.appendChild(o)})(n,l,h,void 0,0):h({type:"load"})}else e[n]=0},n={0:0},c.f.j=function(e,t){var r=c.o(n,e)?n[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var i=new Promise((t,i)=>r=n[e]=[t,i]);t.push(r[2]=i);var s=c.p+c.u(e),a=Error();c.l(s,function(t){if(c.o(n,e)&&(0!==(r=n[e])&&(n[e]=void 0),r)){var i=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",a.name="ChunkLoadError",a.type=i,a.request=s,r[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var r,i,s=t[0],a=t[1],o=t[2],l=0;if(s.some(e=>0!==n[e])){for(r in a)c.o(a,r)&&(c.m[r]=a[r]);o&&o(c)}for(e&&e(t);l<s.length;l++)i=s[l],c.o(n,i)&&n[i]&&n[i][0](),n[i]=0},(s=globalThis.webpackChunk_tern_secure_auth=globalThis.webpackChunk_tern_secure_auth||[]).forEach(i.bind(null,0)),s.push=i.bind(null,s.push.bind(s)),(()=>{"use strict";function e(e){let t={"argument-error":{message:"Method called with incorrect arguments",code:"INCORRECT_ARGUMENT"},"invalid-email":{message:"Invalid email format",code:"INVALID_EMAIL"},"invalid-tenant-id":{message:"Invalid tenant ID",code:"INVALID_ARGUMENT"},"invalid-credential":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"invalid-login-credentials":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"wrong-password":{message:"Invalid email or password",code:"INVALID_CREDENTIALS"},"user-not-found":{message:"User not found",code:"USER_NOT_FOUND"},"user-disabled":{message:"This account has been disabled",code:"USER_DISABLED"},"too-many-requests":{message:"Too many attempts. Please try again later",code:"TOO_MANY_ATTEMPTS"},"network-request-failed":{message:"Network error. Please check your connection",code:"NETWORK_ERROR"},"email-already-in-use":{message:"This email is already in use",code:"EMAIL_EXISTS"},"weak-password":{message:"Password is too weak",code:"WEAK_PASSWORD"},"operation-not-allowed":{message:"This login method is not enabled",code:"OPERATION_NOT_ALLOWED"},"popup-blocked":{message:"Login popup was blocked. Please enable popups",code:"POPUP_BLOCKED"},"expired-action-code":{message:"Your session has expired. Please login again",code:"EXPIRED_TOKEN"},"user-token-expired":{message:"Your session has expired. Please login again",code:"EXPIRED_TOKEN"},"tenant-not-found":{message:"There is no tenant corresponding to the provided identifier.",code:"INVALID_ARGUMENT"}};try{let r=function(e){if("string"==typeof e){let t=e.match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(t)return{code:t[1],message:e}}if(e&&"object"==typeof e){if(e.message){let t=e.message.match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(t)return{code:t[1],message:e.message}}if(e.code)return{code:e.code.replace("auth/",""),message:e.message||""}}return null}(e);if(r){let e=t[r.code];if(e)return{success:!1,message:e.message,code:e.code}}let n=String(e).match(/Firebase:\s*Error\s*\(auth\/([^)]+)\)/);if(n&&t[n[1]])return{success:!1,...t[n[1]]}}catch(e){}return{success:!1,message:"An unexpected error occurred. Please try again later",code:"INTERNAL_ERROR"}}var t=(e,t,r)=>(e.get(t)||[]).map(e=>e(r)),r=()=>{let e=new Map,r=new Map,n=new Map;return{on:(...t)=>((e,t,r,n,i)=>{let{notify:s}=i||{},a=e.get(r);a||(a=[],e.set(r,a)),a.push(n),s&&t.has(r)&&n(t.get(r))})(e,r,...t),emit:(i,s)=>{r.set(i,s),t(n,i,s),t(e,i,s)},off:(...t)=>((e,t,r)=>{let n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))})(e,...t),getListeners:t=>e.get(t)||[]}},n="status",i=c(8978),s=c(8531);(0,s.KO)("firebase","12.6.0","app");var a=c(9247),o=c(8725),l=c(4409);let u=new Map,h={activated:!1,tokenObservers:[]},d={initialized:!1,enabled:!1};function p(e){return u.get(e)||{...h}}let f="https://content-firebaseappcheck.googleapis.com/v1";class m{constructor(e,t,r,n,i){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=n,this.upperBound=i,this.pending=null,this.nextErrorWaitInterval=n,n>i)throw Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{var t;this.pending=new o.cY,this.pending.promise.catch(e=>{}),await (t=this.getNextRun(e),new Promise(e=>{setTimeout(e,t)})),this.pending.resolve(),await this.pending.promise,this.pending=new o.cY,this.pending.promise.catch(e=>{}),await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}}let g=new o.FA("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"});function y(e=!1){return e?self.grecaptcha?.enterprise:self.grecaptcha}function w(e){if(!p(e).activated)throw g.create("use-before-activation",{appName:e.name})}function v(e){let t=Math.round(e/1e3),r=Math.floor(t/86400),n=Math.floor((t-3600*r*24)/3600),i=Math.floor((t-3600*r*24-3600*n)/60),s="";return r&&(s+=_(r)+"d:"),n&&(s+=_(n)+"h:"),s+=_(i)+"m:"+_(t-3600*r*24-3600*n-60*i)+"s"}function _(e){return 0===e?"00":e>=10?e.toString():"0"+e}async function b({url:e,body:t},r){let n,i,s={"Content-Type":"application/json"},a=r.getImmediate({optional:!0});if(a){let e=await a.getHeartbeatsHeader();e&&(s["X-Firebase-Client"]=e)}let o={method:"POST",body:JSON.stringify(t),headers:s};try{n=await fetch(e,o)}catch(e){throw g.create("fetch-network-error",{originalErrorMessage:e?.message})}if(200!==n.status)throw g.create("fetch-status-error",{httpStatus:n.status});try{i=await n.json()}catch(e){throw g.create("fetch-parse-error",{originalErrorMessage:e?.message})}let c=i.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw g.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${i.ttl}`});let l=1e3*Number(c[1]),u=Date.now();return{token:i.token,expireTimeMillis:u+l,issuedAtTimeMillis:u}}function I(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${f}/projects/${r}/apps/${n}:exchangeDebugToken?key=${i}`,body:{debug_token:t}}}let E="firebase-app-check-store",S="debug-token",k=null;function T(){return k||(k=new Promise((e,t)=>{try{let r=indexedDB.open("firebase-app-check-database",1);r.onsuccess=t=>{e(t.target.result)},r.onerror=e=>{t(g.create("storage-open",{originalErrorMessage:e.target.error?.message}))},r.onupgradeneeded=e=>{let t=e.target.result;0===e.oldVersion&&t.createObjectStore(E,{keyPath:"compositeKey"})}}catch(e){t(g.create("storage-open",{originalErrorMessage:e?.message}))}}))}async function C(e,t){let r=(await T()).transaction(E,"readwrite"),n=r.objectStore(E).put({compositeKey:e,value:t});return new Promise((e,t)=>{n.onsuccess=t=>{e()},r.onerror=e=>{t(g.create("storage-set",{originalErrorMessage:e.target.error?.message}))}})}async function R(e){let t=(await T()).transaction(E,"readonly"),r=t.objectStore(E).get(e);return new Promise((e,n)=>{r.onsuccess=t=>{let r=t.target.result;r?e(r.value):e(void 0)},t.onerror=e=>{n(g.create("storage-get",{originalErrorMessage:e.target.error?.message}))}})}function A(e){return`${e.options.appId}-${e.name}`}let P=new l.Vy("@firebase/app-check");async function O(e){if((0,o.zW)()){let t;try{t=await R(A(e))}catch(e){P.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return t}}function N(e,t){if((0,o.zW)())return C(A(e),t).catch(e=>{P.warn(`Failed to write token to IndexedDB. Error: ${e}`)});return Promise.resolve()}async function U(){let e;try{e=await R(S)}catch(e){}if(e)return e;{let e=crypto.randomUUID();return C(S,e).catch(e=>P.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),e}}function D(){return d.enabled}async function L(){if(d.enabled&&d.token)return d.token.promise;throw Error(`
29
+ Can't get debug token in production mode.
30
+ `)}let M={error:"UNKNOWN_ERROR"};async function x(e,t=!1,r=!1){let n,i,s=e.app;w(s);let a=p(s),o=a.token;if(o&&!B(o)&&(a.token=void 0,o=void 0),!o){let e=await a.cachedTokenPromise;e&&(B(e)?o=e:await N(s,void 0))}if(!t&&o&&B(o))return{token:o.token};let c=!1;if(D())try{a.exchangeTokenPromise||(a.exchangeTokenPromise=b(I(s,await L()),e.heartbeatServiceProvider).finally(()=>{a.exchangeTokenPromise=void 0}),c=!0);let t=await a.exchangeTokenPromise;return await N(s,t),a.token=t,{token:t.token}}catch(e){return"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?P.warn(e.message):r&&P.error(e),W(e)}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().finally(()=>{a.exchangeTokenPromise=void 0}),c=!0),o=await p(s).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?P.warn(e.message):r&&P.error(e),i=e}return o?i?n=B(o)?{token:o.token,internalError:i}:W(i):(n={token:o.token},a.token=o,await N(s,o)):n=W(i),c&&$(s,n),n}async function F(e){let t=e.app;w(t);let{provider:r}=p(t);if(D()){let r=await L(),{token:n}=await b(I(t,r),e.heartbeatServiceProvider);return{token:n}}{let{token:e}=await r.getToken();return{token:e}}}function j(e,t,r,n){let{app:i}=e,s=p(i);if(s.tokenObservers=[...s.tokenObservers,{next:r,error:n,type:t}],s.token&&B(s.token)){let t=s.token;Promise.resolve().then(()=>{r({token:t.token}),H(e)}).catch(()=>{})}s.cachedTokenPromise.then(()=>H(e))}function V(e,t){let r=p(e),n=r.tokenObservers.filter(e=>e.next!==t);0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function H(e){let{app:t}=e,r=p(t),n=r.tokenRefresher;n||(r.tokenRefresher=n=function(e){let{app:t}=e;return new m(async()=>{let r;if((r=p(t).token?await x(e,!0):await x(e)).error)throw r.error;if(r.internalError)throw r.internalError},()=>!0,()=>{let e=p(t);if(!e.token)return 0;{let t=e.token.issuedAtTimeMillis+(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)*.5+3e5;return Math.max(0,(t=Math.min(t,e.token.expireTimeMillis-3e5))-Date.now())}},3e4,96e4)}(e)),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}function $(e,t){for(let r of p(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function B(e){return e.expireTimeMillis-Date.now()>0}function W(e){return{token:o.K3.encodeString(JSON.stringify(M),!1),error:e}}class z{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:e}=p(this.app);for(let t of e)V(this.app,t.next);return Promise.resolve()}}function K(e,t,r,n,i){r.ready(()=>{var s,a,o,c;let l,u;s=e,a=t,o=r,c=n,l=o.render(c,{sitekey:a,size:"invisible",callback:()=>{p(s).reCAPTCHAState.succeeded=!0},"error-callback":()=>{p(s).reCAPTCHAState.succeeded=!1}}),(u=p(s)).reCAPTCHAState={...u.reCAPTCHAState,widgetId:l},i.resolve(r)})}function q(e){let t=`fire_app_check_${e.name}`,r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function G(e){w(e);let t=p(e).reCAPTCHAState,r=await t.initialized.promise;return new Promise((t,n)=>{let i=p(e).reCAPTCHAState;r.ready(()=>{t(r.execute(i.widgetId,{action:"fire_app_check"}))})})}class J{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){let e;X(this._throttleData);let t=await G(this._app).catch(e=>{throw g.create("recaptcha-error")});if(!p(this._app).reCAPTCHAState?.succeeded)throw g.create("recaptcha-error");try{e=await b(function(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${f}/projects/${r}/apps/${n}:exchangeRecaptchaV3Token?key=${i}`,body:{recaptcha_v3_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){if(e.code?.includes("fetch-status-error"))throw this._throttleData=Y(Number(e.customData?.httpStatus),this._throttleData),g.create("initial-throttle",{time:v(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});throw e}return this._throttleData=null,e}initialize(e){var t,r;let n,i,a,c;this._app=e,this._heartbeatServiceProvider=(0,s.j6)(e,"heartbeat");(t=this._siteKey,n=new o.cY,p(e).reCAPTCHAState={initialized:n},i=q(e),(a=y(!1))?K(e,t,a,i,n):(r=()=>{let r=y(!1);if(!r)throw Error("no recaptcha");K(e,t,r,i,n)},(c=document.createElement("script")).src="https://www.google.com/recaptcha/api.js",c.onload=r,document.head.appendChild(c)),n.promise).catch(()=>{})}isEqual(e){return e instanceof J&&this._siteKey===e._siteKey}}class Z{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){let e;X(this._throttleData);let t=await G(this._app).catch(e=>{throw g.create("recaptcha-error")});if(!p(this._app).reCAPTCHAState?.succeeded)throw g.create("recaptcha-error");try{e=await b(function(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${f}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${i}`,body:{recaptcha_enterprise_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){if(e.code?.includes("fetch-status-error"))throw this._throttleData=Y(Number(e.customData?.httpStatus),this._throttleData),g.create("initial-throttle",{time:v(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});throw e}return this._throttleData=null,e}initialize(e){var t,r;let n,i,a,c;this._app=e,this._heartbeatServiceProvider=(0,s.j6)(e,"heartbeat");(t=this._siteKey,n=new o.cY,p(e).reCAPTCHAState={initialized:n},i=q(e),(a=y(!0))?K(e,t,a,i,n):(r=()=>{let r=y(!0);if(!r)throw Error("no recaptcha");K(e,t,r,i,n)},(c=document.createElement("script")).src="https://www.google.com/recaptcha/enterprise.js",c.onload=r,document.head.appendChild(c)),n.promise).catch(()=>{})}isEqual(e){return e instanceof Z&&this._siteKey===e._siteKey}}function Y(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};{let r=t?t.backoffCount:0,n=(0,o.p9)(r,1e3,2);return{backoffCount:r+1,allowRequestsAfter:Date.now()+n,httpStatus:e}}}function X(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw g.create("throttled",{time:v(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}async function Q(e,t){let r=await x(e,t);if(r.error)throw r.error;if(r.internalError)throw r.internalError;return{token:r.token}}let ee="app-check-internal";(0,s.om)(new a.uA("app-check",e=>new z(e.getProvider("app").getImmediate(),e.getProvider("heartbeat")),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(ee).initialize()})),(0,s.om)(new a.uA(ee,e=>{var t;return t=e.getProvider("app-check").getImmediate(),{getToken:e=>x(t,e),getLimitedUseToken:()=>F(t),addTokenListener:e=>j(t,"INTERNAL",e),removeTokenListener:e=>V(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),(0,s.KO)("@firebase/app-check","0.11.0");var et=c(4186),er=c(7165);let en="@firebase/installations",ei="0.6.19",es=`w:${ei}`,ea="FIS_v2",eo=new o.FA("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function ec(e){return e instanceof o.g&&e.code.includes("request-failed")}function el({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function eu(e){return{token:e.token,requestStatus:2,expiresIn:Number(e.expiresIn.replace("s","000")),creationTime:Date.now()}}async function eh(e,t){let r=(await t.json()).error;return eo.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function ed({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}async function ep(e){let t=await e();return t.status>=500&&t.status<600?e():t}async function ef({appConfig:e,heartbeatServiceProvider:t},{fid:r}){let n=el(e),i=ed(e),s=t.getImmediate({optional:!0});if(s){let e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}let a={method:"POST",headers:i,body:JSON.stringify({fid:r,authVersion:ea,appId:e.appId,sdkVersion:es})},o=await ep(()=>fetch(n,a));if(o.ok){let e=await o.json();return{fid:e.fid||r,registrationStatus:2,refreshToken:e.refreshToken,authToken:eu(e.authToken)}}throw await eh("Create Installation",o)}function em(e){return new Promise(t=>{setTimeout(t,e)})}let eg=/^[cdef][\w-]{21}$/;function ey(e){return`${e.appName}!${e.appId}`}let ew=new Map;function ev(e,t){var r,n;let i,s=ey(e);e_(s,t),r=s,n=t,(i=(!eb&&"BroadcastChannel"in self&&((eb=new BroadcastChannel("[Firebase] FID Change")).onmessage=e=>{e_(e.data.key,e.data.fid)}),eb))&&i.postMessage({key:r,fid:n}),0===ew.size&&eb&&(eb.close(),eb=null)}function e_(e,t){let r=ew.get(e);if(r)for(let e of r)e(t)}let eb=null,eI="firebase-installations-store",eE=null;function eS(){return eE||(eE=(0,er.P2)("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(eI)}})),eE}async function ek(e,t){let r=ey(e),n=(await eS()).transaction(eI,"readwrite"),i=n.objectStore(eI),s=await i.get(r);return await i.put(t,r),await n.done,s&&s.fid===t.fid||ev(e,t.fid),t}async function eT(e){let t=ey(e),r=(await eS()).transaction(eI,"readwrite");await r.objectStore(eI).delete(t),await r.done}async function eC(e,t){let r=ey(e),n=(await eS()).transaction(eI,"readwrite"),i=n.objectStore(eI),s=await i.get(r),a=t(s);return void 0===a?await i.delete(r):await i.put(a,r),await n.done,a&&(!s||s.fid!==a.fid)&&ev(e,a.fid),a}async function eR(e){let t,r=await eC(e.appConfig,r=>{let n=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(eo.create("app-offline"))};let r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=eA(e,r);return{installationEntry:r,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:eP(e)}:{installationEntry:t}}(e,eN(r||{fid:function(){try{var e;let t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;let r=(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22));return eg.test(r)?r:""}catch{return""}}(),registrationStatus:0}));return t=n.registrationPromise,n.installationEntry});return""===r.fid?{installationEntry:await t}:{installationEntry:r,registrationPromise:t}}async function eA(e,t){try{let r=await ef(e,t);return ek(e.appConfig,r)}catch(r){throw ec(r)&&409===r.customData.serverCode?await eT(e.appConfig):await ek(e.appConfig,{fid:t.fid,registrationStatus:0}),r}}async function eP(e){let t=await eO(e.appConfig);for(;1===t.registrationStatus;)await em(100),t=await eO(e.appConfig);if(0===t.registrationStatus){let{installationEntry:t,registrationPromise:r}=await eR(e);return r||t}return t}function eO(e){return eC(e,e=>{if(!e)throw eo.create("installation-not-found");return eN(e)})}function eN(e){var t;return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e}async function eU({appConfig:e,heartbeatServiceProvider:t},r){let n=function(e,{fid:t}){return`${el(e)}/${t}/authTokens:generate`}(e,r),i=function(e,{refreshToken:t}){var r;let n=ed(e);return n.append("Authorization",(r=t,`${ea} ${r}`)),n}(e,r),s=t.getImmediate({optional:!0});if(s){let e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}let a={method:"POST",headers:i,body:JSON.stringify({installation:{sdkVersion:es,appId:e.appId}})},o=await ep(()=>fetch(n,a));if(o.ok)return eu(await o.json());throw await eh("Generate Auth Token",o)}async function eD(e,t=!1){let r,n=await eC(e.appConfig,n=>{var i,s,a;let o;if(!eF(n))throw eo.create("not-registered");let c=n.authToken;if(!t&&2===(i=c).requestStatus&&(s=i,!((o=Date.now())<s.creationTime)&&!(s.creationTime+s.expiresIn<o+36e5)))return n;if(1===c.requestStatus)return r=eL(e,t),n;{let t;if(!navigator.onLine)throw eo.create("app-offline");let i=(a=n,t={requestStatus:1,requestTime:Date.now()},{...a,authToken:t});return r=ex(e,i),i}});return r?await r:n.authToken}async function eL(e,t){let r=await eM(e.appConfig);for(;1===r.authToken.requestStatus;)await em(100),r=await eM(e.appConfig);let n=r.authToken;return 0===n.requestStatus?eD(e,t):n}function eM(e){return eC(e,e=>{var t;if(!eF(e))throw eo.create("not-registered");return 1===(t=e.authToken).requestStatus&&t.requestTime+1e4<Date.now()?{...e,authToken:{requestStatus:0}}:e})}async function ex(e,t){try{let r=await eU(e,t),n={...t,authToken:r};return await ek(e.appConfig,n),r}catch(r){if(ec(r)&&(401===r.customData.serverCode||404===r.customData.serverCode))await eT(e.appConfig);else{let r={...t,authToken:{requestStatus:0}};await ek(e.appConfig,r)}throw r}}function eF(e){return void 0!==e&&2===e.registrationStatus}async function ej(e){let{installationEntry:t,registrationPromise:r}=await eR(e);return r?r.catch(console.error):eD(e).catch(console.error),t.fid}async function eV(e,t=!1){return await eH(e),(await eD(e,t)).token}async function eH(e){let{registrationPromise:t}=await eR(e);t&&await t}function e$(e){return eo.create("missing-app-config-values",{valueName:e})}let eB="installations";(0,s.om)(new a.uA(eB,e=>{let t=e.getProvider("app").getImmediate(),r=function(e){if(!e||!e.options)throw e$("App Configuration");if(!e.name)throw e$("App Name");for(let t of["projectId","apiKey","appId"])if(!e.options[t])throw e$(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),n=(0,s.j6)(t,"heartbeat");return{app:t,appConfig:r,heartbeatServiceProvider:n,_delete:()=>Promise.resolve()}},"PUBLIC")),(0,s.om)(new a.uA("installations-internal",e=>{let t=e.getProvider("app").getImmediate(),r=(0,s.j6)(t,eB).getImmediate();return{getId:()=>ej(r),getToken:e=>eV(r,e)}},"PRIVATE")),(0,s.KO)(en,ei),(0,s.KO)(en,ei,"esm2020");let eW="session:sessionChanged",ez=r();function eK(){return"undefined"!=typeof window}var eq=RegExp("bot|spider|crawl|APIs-Google|AdsBot|Googlebot|mediapartners|Google Favicon|FeedFetcher|Google-Read-Aloud|DuplexWeb-Google|googleweblight|bing|yandex|baidu|duckduck|yahoo|ecosia|ia_archiver|facebook|instagram|pinterest|reddit|slack|twitter|whatsapp|youtube|semrush","i");class eG{static instance;constructor(){}static getInstance(){return eG.instance||(eG.instance=new eG),eG.instance}async execute(e,t){let r;if(e.appCheck)try{r=(await Q(e.appCheck,!1)).token}catch(e){console.warn("Failed to get App Check token:",e)}return t(r)}}var eJ=c(5305);class eZ{static ternsecure;id;pathRoot="";static get apiClient(){return eZ.ternsecure.getApiClient()}static get authCookieManager(){return this.ternsecure.authCookieManager()}get authCookieManager(){return eZ.authCookieManager}isNew(){return!this.id}static async _fetch(e){return eG.getInstance().execute(this.ternsecure,t=>{let r={...e};return t&&(r.headers=new Headers(r.headers),r.headers.set("x-ternsecure-appcheck",t)),this._baseFetch(r)})}static async _baseFetch(e){let t;try{t=await eZ.apiClient.request(e,{timeoutMs:1e4})}catch(t){var r;let e;if(this.shouldRethrowofflineNetworkError())throw new eJ.R6(t?.message||String(t),{code:"OFFLINE_NETWORK_ERROR"});if(!(function(){var e,t;let r=eK()?null==window?void 0:window.navigator:null;if(!r)return!1;let n=null==r?void 0:r.onLine;return(null==(e=null==r?void 0:r.connection)?void 0:e.rtt)!==0&&(null==(t=null==r?void 0:r.connection)?void 0:t.downlink)!==0&&n}()&&(e=eK()?null==window?void 0:window.navigator:null)&&!((r=null==e?void 0:e.userAgent)&&eq.test(r))&&!(null==e?void 0:e.webdriver)))return console.warn(t),null;throw t}let{payload:n,status:i,statusText:s,headers:a}=t;if(a){let e=a.get("x-country");this.ternsecure.__internal_setCountry(e?e.toLowerCase():null)}if(i>=200&&i<=299)return n;if(i>=400){let e=n?.errors,t=e?.[0]?.message,r={data:e,status:i};if(429===i&&a){let e=a.get("retry-After");if(e){let t=parseInt(e,10);isNaN(t)||(r.retryAfter=t)}}throw new eJ.yS(t||s,r)}return null}path(e){let t=this.pathRoot;if(this.isNew())return t;let r=t.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return e?r.replace(/[^/]$/,"$&/")+encodeURIComponent(e):r}static async basePost(e){return this._fetch({...e,method:"POST"})}async _fetch(e){return eZ._fetch(e)}async basePost(e){return eZ.basePost(e)}async _baseMutate(e={}){let{action:t,body:r,method:n,path:i}=e,s=await eZ._fetch({method:n,path:i||this.path(t),body:r});return this.fromJSON(s?.response||s)}async baseGet(e){return this._fetch({...e,method:"GET"})}async _post(e){return this.basePost({path:e.path,body:e.body})}async _basePost(e={}){return this._baseMutate({...e,method:"POST"})}static async makeApiRequest(e){return this._fetch(e)}async makeApiRequest(e){return this._fetch(e)}static shouldRethrowofflineNetworkError(){let e=eZ.ternsecure?._internal_getOption?.("experimental");return e?.rethrowOfflineNetworkErrors||!1}}class eY extends eZ{pathRoot="/sessions/createsession";status;token;claims;authTime;expirationTime;issuedAtTime;signInProvider;signInSecondFactor;user;constructor(e){super(),this.initializeFromSessionData(e),this.fromJSON(e)}initializeFromSessionData(e){this.status=e.status||"pending",this.token=e.token||"",this.claims=e.claims||{},this.authTime=e.authTime||"",this.expirationTime=e.expirationTime||"",this.issuedAtTime=e.issuedAtTime||"",this.signInProvider=e.signInProvider||null,this.signInSecondFactor=e.signInSecondFactor||null,this.user=e.user}createSession=(e,t)=>this._basePost({path:this.pathRoot,body:{idToken:e,csrfToken:t}});getIdAndRefreshToken=async(e,t)=>{await this.createSession(e,t)};create=async e=>{await this.createSession(this.token,e),ez.emit(eW,null)};toJSON(){return{status:this.status,token:this.token,claims:this.claims,authTime:this.authTime,expirationTime:this.expirationTime,issuedAtTime:this.issuedAtTime,signInProvider:this.signInProvider,signInSecondFactor:this.signInSecondFactor,user:this.user}}fromJSON(e){return e&&this.initializeFromSessionData(e),this}}class eX extends eZ{status=null;user=null;unverifiedFields;message;error;auth;constructor(e=null,t){super(),this.auth=t,this.fromJSON(e)}withEmailAndPassword=async t=>{try{let{email:e,password:r}=t,{user:n}=await (0,et.eJ)(this.auth,e,r);return this.user=n,n.emailVerified||(this.status="missing_requirements",this.unverifiedFields=["email_address"],this.message="User created successfully. Email verification required."),this}catch(r){let t=e(r);return this.status="error",this.message=t.message,this.error=t.code,this}};withSocialProvider(){throw Error("Method not implemented.")}attemptEmailVerification=async t=>{try{if(!this.user)return this.status="error",this.message="No user found to send verification email",this.error="NO_USER",this;return await (0,et.gA)(this.user,{url:t?.url||window.location.origin,handleCodeInApp:t?.handleCodeInApp??!0}),this.message="Verification email sent successfully",this}catch(r){let t=e(r);return this.status="error",this.message=t.message,this.error=t.code,this}};fromJSON(e){return e&&(this.id=e.id,this.status=e.status),this}}class eQ extends eZ{pathRoot="/sign_ins/create";pathSessionRoot="/sessions/createsession";id;status=null;supportedFirstFactors=[];identifier=null;auth;csrfToken;_currentUser=null;_confirmationResult=null;constructor(e=null,t,r){super(),this.auth=t,this.csrfToken=r,this.fromJSON(e)}get user(){return this._currentUser}create=e=>this._basePost({path:this.pathRoot,body:e});attemptFirstFactor=async e=>{let t={...e};return this._basePost({body:{config:t,strategy:e.strategy},action:"attempt_first_factor"})};attemptPhoneNumberVerification=async t=>{if(!this._confirmationResult)return{status:"error",message:"No confirmation result found",error:"UNKNOWN_ERROR"};try{let e=await this._confirmationResult.confirm(t.code);return this._currentUser=e.user,this.status="success",this._confirmationResult=null,{status:"success",user:this._currentUser,message:"Phone number verified"}}catch(r){let t=e(r);return this.status="error",{status:"error",message:t.message,error:t.code}}};signInWithCredential=async e=>{let t={idToken:await e.user.getIdToken(),csrfToken:this.csrfToken};return this._post({path:this.pathSessionRoot,body:t})};authenticateWithPassword=async t=>{try{let{email:e,password:r}=t,{user:n,providerId:i,operationType:s}=await (0,et.x9)(this.auth,e,r);return this._currentUser=n,{status:"success",user:n,providerId:i,operationType:s,message:"Authentication successful"}}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}};createRecaptchaVerifier=(e,t)=>(window.recaptchaVerifier=new et.kT(this.auth,e,t),window.recaptchaVerifier);authenticateWithPhoneNumber=async t=>{try{let{phoneNumber:e,appVerifier:r}=t;return this._confirmationResult=await (0,et.ik)(this.auth,e,r),this.status="needs_first_factor",{status:"needs_first_factor",message:"Verification code sent"}}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}};withCredential=async t=>{try{let{email:e,password:r}=t,n=await (0,et.x9)(this.auth,e,r);await this.signInWithCredential(n)}catch(t){console.error(e(t))}};authenticateWithSocialProvider=async(e,t={})=>{try{let{mode:r="popup"}=t;if("redirect"!==r)return await this._signInWithPopUp(e,t);{let r=await this.authRedirectResult();if(r)return r;return await this._signInWithRedirect(e,t)}}catch(t){return{status:"error",message:t.message||`Sign in with ${e} failed`,error:t}}};completeMfaSignIn=async(e,t)=>{throw Error("Method not implemented.")};sendPasswordResetEmail=async e=>this._basePost({path:"/sign_ins/resetPasswordEmail",body:{email:e}});resendEmailVerification=async e=>{let t=this._currentUser;if(!t)throw Error("No user is currently signed in");if(t.emailVerified)return{isVerified:!0};let r=e?.url||"/";"undefined"==typeof window||r.startsWith("http://")||r.startsWith("https://")||(r=new URL(r,window.location.origin).href);let n={url:r,handleCodeInApp:e?.handleCodeInApp??!0};return await (0,et.gA)(t,n),{isVerified:!1}};attemptEmailVerification=async t=>{try{if(!(await this.resendEmailVerification(t)).isVerified)return{status:"needs_email_verification",message:"Verification email sent"};return{status:"success",message:"Email is already verified"}}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}};getProviderConfig(e){switch(e.toLowerCase()){case"google":return{provider:new et.HF};case"apple":return{provider:new et.LD("apple.com")};case"microsoft":return{provider:new et.LD("microsoft.com")};case"github":return{provider:new et.LD("github.com")};case"twitter":return{provider:new et.LD("twitter.com")};case"facebook":return{provider:new et.LD("facebook.com")};default:throw Error(`Unsupported provider: ${e}`)}}async authRedirectResult(){try{let e=await (0,et.Q4)(this.auth);if(e){let{user:t,providerId:r,operationType:n}=e;return{status:"success",user:t,providerId:r,operationType:n}}return null}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}}setProviderCustomParameters(e,t){t&&0!==Object.keys(t).length&&e.setCustomParameters(t)}setProviderScopes(e,t){t&&0!==t.length&&(e instanceof et.HF?t.forEach(t=>{e.addScope(t)}):e instanceof et.LD&&e.addScope(t.join(" ")))}configureProvider(e,t){this.setProviderCustomParameters(e,t.customParameters),this.setProviderScopes(e,t.scopes)}executeAuthMethod=async(t,r,n={})=>{try{let e=this.getProviderConfig(r);this.configureProvider(e.provider,n);let{user:i,providerId:s,operationType:a}=await t(this.auth,e.provider);return{status:"success",message:"Authentication successful",user:i,providerId:s,operationType:a}}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}};async _signInWithRedirect(e,t={}){return this.executeAuthMethod(et.$2,e,t)}async _signInWithPopUp(e,t={}){return this.executeAuthMethod(et.df,e,t)}async checkRedirectResult(){return this.authRedirectResult()}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.supportedFirstFactors=e.supportedFirstFactors,this.identifier=e.identifier),this}}function e0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var e1=function e(t,r){function n(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=e0({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var s=r[i].split("="),a=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(n[o]=t.read(a,o),e===o)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){n(e,"",e0({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,e0({},this.attributes,t))},withConverter:function(t){return e(e0({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function e6(e){return{set(t,r={}){e1.set(e,t,r)},get:()=>e1.get(e),remove(t){e1.remove(e,t)}}}function e2(e,t){let r=function(e){try{return new Date(e||new Date)}catch{return new Date}}(e);return r.setFullYear(r.getFullYear()+t),r}let e3={secure:!0,sameSite:"strict",expires:1/24};class e4{csrfCookieHandler=e6("__terncf");ternAutCookie=(()=>{let e=e6("tern_aut"),t=()=>{let t=e.get();return t?parseInt(t,10):0};return{get:t,set:r=>{let n=e2(Date.now(),1);if(!Number.isInteger(r)||r<0)return void console.warn("[tern_aut] Invalid auth_time value provided:",r);let i=t();0===r&&i>0||e.set(r.toString(),{secure:!0,expires:n})},initialize:()=>{if(null==e.get()){let t=e2(Date.now(),1);e.set("0",{secure:!0,expires:t})}}}})();constructor(){this.ensureCSRFToken(),this.ensureAuthTimeCookie()}generateCSRFToken(){let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}ensureCSRFToken(){let e=this.getCSRFToken();return e||(e=this.generateCSRFToken(),this.setCSRFToken({token:e})),e}ensureAuthTimeCookie(){this.ternAutCookie.initialize()}getAuthTime(){return this.ternAutCookie.get()}setAuthTime(e){this.ternAutCookie.set(e)}setCSRFToken(e){try{e.token&&this.csrfCookieHandler.set(e.token,e3)}catch(e){throw console.error("Failed to set CSRF token:",e),Error("Unable to store CSRF token")}}getCSRFToken(){try{return this.csrfCookieHandler.get()}catch(e){console.error("Failed to get CSRF token:",e);return}}clearAuth(){try{this.csrfCookieHandler.remove()}catch(e){console.error("Failed to clear auth cookies:",e)}}}var e5=c(2117),e8=c(8177),e7=c(2782);class e9 extends Error{url;original;constructor(e,t){super(`Network error for ${e}: ${t.message}`),this.url=e,this.original=t,this.name="NetworkError"}}class te extends Error{constructor(){super("Request timed out"),this.name="TimeoutError"}}class tt extends Error{constructor(){super("Circuit breaker is open"),this.name="CircuitOpenError"}}async function tr(e){for(let t of e.beforeRequestHooks)if(!1===await t())return!1;return!0}async function tn(e,t){for(let r of e.afterResponseHooks)await r(t)}function ti(e,t){let{failureThreshold:r=5}=t;e.circuitBreaker.failures++,e.circuitBreaker.lastFailureTime=Date.now(),e.circuitBreaker.failures>=r&&(e.circuitBreaker.state="open")}async function ts(e,t,r,n){let i,{initialDelay:s=700,factor:a=2,maxDelay:o=5e3,maxTries:c="undefined"!=typeof navigator&&navigator.onLine?4:11}=t;for(let l=1;l<=c;l++)try{let t=await r();return e.circuitBreaker.failures=0,e.circuitBreaker.state="closed",t}catch(r){if(i=r,!n(r,l))throw r;if(ti(e,t),l<c){let e=Math.min(s*Math.pow(a,l-1),o);await new Promise(t=>setTimeout(t,(0,e7.$x)(e)))}}throw i}function ta(){return"undefined"!=typeof window}class to{static version="1.1.0-canary.v20251206165958";static sdkMetadata={name:"@tern-secure/auth",version:"1.1.0-canary.v20251206165958",environment:"production"};static mountComponentRenderer;#c;static instance=null;_currentUser=null;signedInSession=null;firebaseClientApp;appCheckApp;authStateUnsubscribe=null;auth;csrfToken;isLoading=!1;error=null;user=null;__internal_country;customDomain;isVisible=!1;currentView=null;#l;#u;#h;#d;#p="loading";#f=[];#m={};#g;#y=r();signIn;signUp;session;get isReady(){return"ready"===this.status}get status(){return this.#p}get version(){return to.version}set sdkMetadata(e){to.sdkMetadata=e}get sdkMetadata(){return to.sdkMetadata}get requiresVerification(){return this.#m.requiresVerification??!0}load=async e=>{if(!this.isReady){this.#m=this.#w(e),console.debug("[TernSecureAuth] Loading with options:",this.#m),this.#m.sdkMetadata&&(to.sdkMetadata=this.#m.sdkMetadata);try{await Promise.resolve(this.#v()),to.mountComponentRenderer&&!this.#c&&(this.#c=to.mountComponentRenderer(this,this.#m)),this.#_("ready"),this.#y.emit(n,"ready")}catch(e){throw this.error=e,console.error("[TernSecureAuth] Load failed:",e),this.#_("error"),this.#y.emit(n,"error"),e}}};__unstable__updateProps=e=>{let t={...e,options:this.#w({...this.#m,...e.options})};return this.#c?.ensureMounted().then(e=>e.updateProps(t))};#v=()=>{if(!this.#m.ternSecureConfig)throw Error("TernSecureConfig is required to initialize TernSecureAuth");if(!this.#m.apiUrl)throw Error("apiUrl is required to initialize TernSecureAuth");this.initializeFirebaseApp(this.#m.ternSecureConfig,{appName:this.#m.appName,tenantId:this.#m.tenantId}),"browserCookie"!==this.#m.persistence&&(this.authStateUnsubscribe=this.initAuthStateListener()),this.#g=new e4,this.csrfToken=this.#g.getCSRFToken(),this.signIn=new eQ(null,this.auth,this.csrfToken),this.signUp=new eX(null,this.auth),ez.on(eW,()=>{this.#b(this.user||null),this.#I()})};assertComponentControlsReady(e){if(!to.mountComponentRenderer)throw Error("TernSecure instance was loaded without UI components");if(!e)throw Error("TernSecure UI components are not ready yet.")}showSignIn(e,t){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"SignIn"}).then(r=>r.mountComponent({name:"SignIn",appearanceKey:"default",node:e,props:t})),this.currentView="signIn",this.isVisible=!0}hideSignIn(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}showSignUp(e,t){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"SignUp"}).then(r=>r.mountComponent({name:"SignUp",appearanceKey:"default",node:e,props:t})),this.currentView="signUp",this.isVisible=!0}hideSignUp(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}showUserButton(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted({preloadHint:"UserButton"}).then(t=>t.mountComponent({name:"UserButton",appearanceKey:"default",node:e,props:{}}))}hideUserButton(e){this.assertComponentControlsReady(this.#c),this.#c.ensureMounted().then(t=>t.unmountComponent({node:e}))}get apiUrl(){return this.#h}get authDomain(){if(ta()){var e,t;let r=(0,i.W)((e=this.#l,t=new URL(window.location.href),"function"==typeof e?e(t):void 0!==e?e:void 0));return this.#d,r}return""}get instanceType(){return this.#d}constructor(e,t){this.#l=t?.domain,this.#h=e||"",this.#d="production",this.#u=function(e){async function t(r,n,i={}){let s={...n},{method:a="GET",body:o}=s,c={...i};if(s.url=function(t){let r,n=e.apiUrl?.includes("localhost")||e.apiUrl?.includes("127.0.0.1"),{path:i}=t,{instanceType:s,authDomain:a,apiUrl:o,apiBasePath:c="/api/auth"}=e;r=n?o?.startsWith("http")?o:`http://${o}`:`https://${("production"===s?a:"")||o}`;let l=`${c}/${i}`.replace(/\/+/g,"/");return(0,e5.kZ)({base:r,pathname:l,searchParams:t.search?new URLSearchParams(t.search):void 0},{stringify:!1})}({...s}),!function(e,t){let{recoveryTimeoutMs:r=6e4}=t,n=Date.now();if("open"===e.circuitBreaker.state)if(n-e.circuitBreaker.lastFailureTime>=r)e.circuitBreaker.state="half-open";else throw new tt}(r,c),!await tr(r)){let e=new Response("{}",{status:200});return e.payload={response:{}},await tn(r,e),e}let{timeoutMs:l}=c,u="GET"===a?"GET":"POST",h=s.url.toString();s.headers=new Headers(s.headers),"GET"===a||o instanceof FormData||s.headers.has("content-type")||s.headers.set("content-type","application/json"),"application/x-www-form-urlencoded"===s.headers.get("content-type")?s.body=o?(0,e5.Ws)(o,{keyEncoder:e7.C8}):o:"application/json"===s.headers.get("content-type")&&o&&(s.body="string"==typeof o?o:JSON.stringify(o));let d=async()=>{let e,t=new AbortController,n=l?setTimeout(()=>{t.abort()},l):null,i={...s,credentials:"include",method:u};try{e=await fetch(h,i),n&&clearTimeout(n);let t=null;if(204===e.status)t=null;else try{t=await e.json()}catch{t={response:{}}}return e.payload=t,await tn(r,e),e}catch(e){if(n&&clearTimeout(n),"AbortError"===e.name)throw new te;throw new e9(h,e)}};return ts(r,c,d,(e,t)=>{var n;let i;return n=c.maxTries||("undefined"!=typeof navigator&&navigator.onLine?4:11),(i=e instanceof e9&&"GET"===u.toUpperCase()&&t<n)||ti(r,c),i})}let r=function(e={}){return{circuitBreaker:{failures:0,lastFailureTime:0,state:"closed"},beforeRequestHooks:[],afterResponseHooks:[],clientOptions:e}}(e);return{onBeforeRequest:e=>{r.beforeRequestHooks.push(e)},onAfterResponse:e=>{r.afterResponseHooks.push(e)},request:(e,n={})=>t(r,e,n)}}({authDomain:this.authDomain,apiUrl:this.#h,instanceType:this.instanceType}),this.#y.emit(n,"loading"),eZ.ternsecure=this}getApiClient=()=>this.#u;setLoading(e){this.isLoading=e}authCookieManager(){return this.#g}_internal_getOption(e){return this.#m[e]}_internal_getAllOptions(){return Object.freeze({...this.#m})}static getOrCreateInstance(e,t){return this.instance||(this.instance=new to(e,t)),this.instance}static clearInstance(){to.instance&&(to.instance.authStateUnsubscribe&&(to.instance.authStateUnsubscribe(),to.instance.authStateUnsubscribe=null),to.instance=null)}static initialize(e){return this.getOrCreateInstance(e?.apiUrl||"")}initialize=async e=>{this.#E(e||{})};static create(e){let t=this.getOrCreateInstance(e?.apiUrl||"");return t.initialize(e),t}#E=e=>{this.#m=this.#w(e);try{if(!this.#m.ternSecureConfig)throw Error("TernSecureConfig is required to initialize TernSecureAuth");if(!this.#m.apiUrl)throw Error("apiUrl is required to initialize TernSecureAuth");this.initializeFirebaseApp(this.#m.ternSecureConfig,{appName:this.#m.appName,tenantId:this.#m.tenantId}),"browserCookie"!==this.#m.persistence&&(this.authStateUnsubscribe=this.initAuthStateListener()),this.#g=new e4,this.csrfToken=this.#g.getCSRFToken(),this.signIn=new eQ(null,this.auth,this.csrfToken),this.signUp=new eX(null,this.auth),ez.on(eW,()=>{this.#b(this.user||null),this.#I()}),this.#_("ready"),this.#y.emit(n,"ready")}catch(e){throw this.error=e,this.#_("error"),this.#y.emit(n,"error"),e}};initializeFirebaseApp(e,t){let r=t?.appName||"[DEFAULT]";this.firebaseClientApp=0===(0,s.Dk)().length?(0,s.Wp)(e,r):(0,s.Dk)()[0];let n=this.#S(),i=(0,et.Nu)(this.firebaseClientApp,{persistence:n,popupRedirectResolver:et.hk});if(this.auth=i,t?.tenantId&&(this.auth.tenantId=t.tenantId),this.#k(),this.#m.appCheck){let{provider:e,siteKey:t,isTokenAutoRefreshEnabled:r,debugToken:n}=this.#m.appCheck;n&&ta()&&(window.FIREBASE_APPCHECK_DEBUG_TOKEN=n);let i="reCaptchaEnterprise"===e?new Z(t):new J(t);this.appCheckApp=function(e=(0,s.Sx)(),t){e=(0,o.Ku)(e);let r=(0,s.j6)(e,"app-check");if(d.initialized||function(){let e=(0,o.mS)();if(d.initialized=!0,"string"!=typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==e.FIREBASE_APPCHECK_DEBUG_TOKEN)return;d.enabled=!0;let t=new o.cY;d.token=t,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?t.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):t.resolve(U())}(),D()&&L().then(e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),r.isInitialized()){let n=r.getImmediate(),i=r.getOptions();if(i.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&i.provider.isEqual(t.provider))return n;throw g.create("already-initialized",{appName:e.name})}let n=r.initialize({options:t});return function(e,t,r=!1){var n;let i=(n={...h},u.set(e,n),u.get(e));i.activated=!0,i.provider=t,i.cachedTokenPromise=O(e).then(t=>(t&&B(t)&&(i.token=t,$(e,{token:t.token})),t)),i.isTokenAutoRefreshEnabled=r&&e.automaticDataCollectionEnabled,!e.automaticDataCollectionEnabled&&r&&P.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."),i.provider.initialize(e)}(e,t.provider,t.isTokenAutoRefreshEnabled),p(e).isTokenAutoRefreshEnabled&&j(n,"INTERNAL",()=>{}),n}(this.firebaseClientApp,{provider:i,isTokenAutoRefreshEnabled:r??!0})}!function(e=(0,s.Sx)()){(0,s.j6)(e,"installations").getImmediate()}(this.firebaseClientApp)}signOut=async e=>{let t=e?.redirectUrl||this.constructAfterSignOutUrl();e?.onBeforeSignOut&&await e.onBeforeSignOut(),await this.auth.signOut(),e?.onAfterSignOut&&await e.onAfterSignOut(),await this.navigate(t),ez.emit("user:userSignOut",null),ez.emit("token:tokenUpdate",{token:null}),this.#I()};get currentSession(){return this.signedInSession}get firebaseApp(){return this.firebaseClientApp}get appCheck(){return this.appCheckApp}initAuthListener(){return(async()=>{await this.auth.authStateReady();let e=this.auth.currentUser;this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#I()})(),()=>{}}initAuthStateListener(){return(0,et.hg)(this.auth,async e=>{await this.auth.authStateReady(),this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#I()})}_onIdTokenChanged(){return(0,et.iZ)(this.auth,async e=>{await this.auth.authStateReady(),this._currentUser=e,this.user=e,await this.updateCurrentSession(),this.#I()})}async getIdToken(){return(await this.auth.authStateReady(),this.auth.currentUser)?(0,et.p9)(this.auth.currentUser):null}onAuthStateChanged(e){return(0,et.hg)(this.auth,e)}onIdTokenChanged(e){return(0,et.iZ)(this.auth,e)}async updateCurrentSession(){if(!this._currentUser){this.signedInSession=null;return}try{let e=await this._currentUser.getIdTokenResult();this.signedInSession={status:"active",token:e.token,claims:e.claims,issuedAtTime:e.issuedAtTime,expirationTime:e.expirationTime,authTime:e.authTime,signInProvider:e.signInProvider||"unknown",signInSecondFactor:e.signInSecondFactor}}catch(e){console.error("[TernSecureAuth] Error updating session:",e),this.signedInSession=null}}checkRedirectResult=async()=>{try{let e=await (0,et.Q4)(this.auth);if(e)return{status:"success",user:e.user};return null}catch(r){let t=e(r);return{status:"error",message:t.message,error:t.code}}};getRedirectResult=async()=>this.checkRedirectResult();addListener=e=>(this.#f.push(e),this._currentUser&&e({user:this._currentUser,session:this.signedInSession}),()=>{this.#f=this.#f.filter(t=>t!==e)});on=(...e)=>{this.#y.on(...e)};off=(...e)=>{this.#y.off(...e)};createActiveSession=async({session:e,redirectUrl:t})=>{try{if(!e)throw Error("No session provided to createActiveSession");let r=await e.getIdTokenResult(),n=new eY(r);await n.create(this.csrfToken||""),t&&await this.navigate(this.constructUrlWithAuthRedirect(t)),this.#b(e),this.#I()}catch(e){console.error("[TernSecureAuth] Error creating active session:",e)}};navigate=async(e,t)=>{if(!e||!ta())return;let r=new URL(e,window.location.href);this.#T.includes(r.protocol)||(console.warn(`TernSecureAuth: "${r.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`),r=new URL("/",window.location.href));let n=t?.replace&&this.#m.routerReplace?this.#m.routerReplace:this.#m.routerPush;if("null"!==r.origin&&r.origin!==window.location.origin||!n)return void(0,e5.y7)(r);let i={...t?.metadata?{__internal_metadata:t?.metadata}:{},windowNavigate:e5.y7};return await n((0,e5.FV)(r),i)};constructUrlWithAuthRedirect=e=>{if("production"===this.#d)return e;let t=new URL(e,window.location.origin);return t.origin===window.location.origin?t.href:t.toString()};#C=(e,t)=>{if(!e||!this.isReady)return"";let r="signInUrl"===e?this.#m.signInUrl:this.#m.signUpUrl,n=new e8.n(this.#m,t).toSearchParams(),i=(0,e5.kZ)({base:r||("signInUrl"===e?"/sign-in":"/sign-up"),hashSearchParams:[n]},{stringify:!0,skipOrigin:!1});return this.constructUrlWithAuthRedirect(i)};#R=()=>this.constructUrlWithAuthRedirect(new e8.n(this.#m).getAfterSignInUrl());constructAfterSignOutUrl=()=>this.#m.afterSignOutUrl?this.constructUrlWithAuthRedirect(this.#m.afterSignOutUrl):"/";redirectToSignIn=async e=>{if(ta())return this.navigate(this.constructSignInUrl(e))};redirectToSignUp=async e=>{if(ta())return this.navigate(this.constructSignUpUrl(e))};redirectAfterSignIn=async()=>{if(ta())return this.navigate(this.#R())};redirectAfterSignUp=()=>{throw Error("redirectAfterSignUp is not implemented yet")};constructSignInUrl=e=>this.#C("signInUrl",{...e,signInForceRedirectUrl:e?.signInForceRedirectUrl||window.location.href});constructSignUpUrl=e=>this.#C("signUpUrl",{...e,signUpForceRedirectUrl:e?.signUpForceRedirectUrl||window.location.href});get #T(){let e=e5.VY;return this.#m.allowedRedirectProtocols&&(e=e.concat(this.#m.allowedRedirectProtocols)),e}__internal_setCountry=e=>{this.__internal_country||(this.__internal_country=e)};#w=e=>({...e});#I=()=>{for(let e of this.#f)e({user:this.user,session:this.signedInSession})};#_(e){this.#p!==e&&(this.#p=e,this.#y.emit(n,this.#p),"ready"===e&&this.#y.emit(n,"ready"))}#b=e=>{this.user=e,this._currentUser=e};#S=()=>{switch(this.#m.persistence){case"browserCookie":case"none":default:return et.gz;case"session":return et.iM;case"local":return et.F0}};#A=()=>{if("undefined"!=typeof process)return process.env.FIREBASE_AUTH_EMULATOR_HOST};#k=()=>{let e=this.#A();if(!("development"===this.#d&&e)||!e)return;let t=e.startsWith("http")?e:`http://${e}`;try{(0,et.Wq)(this.auth,t,{disableWarnings:!1}),console.warn(`[TernSecure] Firebase Auth Emulator connected at ${t}`)}catch(e){console.error("[TernSecure] Error connecting to Firebase Auth Emulator:",e)}}}var tc=c(4557),tl=c(802),tu=c(4105);let th={SignIn:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("10")]).then(c.bind(c,1687)),SignUp:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("472")]).then(c.bind(c,8102)),UserButton:()=>Promise.all([c.e("26"),c.e("545"),c.e("666"),c.e("99")]).then(c.bind(c,7947))},td=(0,tu.lazy)(()=>th.SignIn().then(e=>({default:e.SignIn})));(0,tu.lazy)(()=>th.SignIn().then(e=>({default:e.SignInModal})));let tp=(0,tu.lazy)(()=>th.SignUp().then(e=>({default:e.SignUp}))),tf=(0,tu.lazy)(()=>th.UserButton().then(e=>({default:e.UserButton}))),tm=async e=>th[e]?.(),tg={SignIn:td,SignUp:tp,UserButton:tf},ty=(0,tu.lazy)(()=>Promise.all([c.e("666"),c.e("687")]).then(c.bind(c,5977)).then(e=>({default:e.TernSecureContextWrapper}))),tw=(0,tu.lazy)(()=>Promise.all([c.e("666"),c.e("687")]).then(c.bind(c,5977)).then(e=>({default:e.TernSecureOptionsProvider}))),tv=(0,tu.lazy)(()=>Promise.all([c.e("26"),c.e("666"),c.e("492")]).then(c.bind(c,5530)).then(e=>({default:e.Portal}))),t_=e=>(0,tc.jsx)(ty,{ternsecure:e.ternsecure,children:(0,tc.jsx)(tw,{value:e.options,children:e.children})}),tb=e=>(0,tc.jsx)(tv,{node:e.node,component:tg[e.componentName],props:e.componentProps,componentName:e.componentName},e.componentKey),tI="data-ternsecure-component",tE=0,tS={},tk=e=>{let[t,r]=tu.useState({options:e.options,nodes:new Map}),{nodes:n}=t;return(0,tl.UQ)(()=>{tS.mountComponent=e=>{let{name:t,node:i,props:s,appearanceKey:a}=e;if(!i)throw Error("Element is not a valid DOM element");r(e=>(e.nodes.set(i,{key:`p${++tE}`,name:t,props:s,appearanceKey:a}),{...e,nodes:n}))},tS.unmountComponent=e=>{let{node:t}=e;r(e=>(e.nodes.delete(t),{...e,nodes:n}))},tS.updateProps=({node:e,props:n,...i})=>{if(e&&n&&"object"==typeof n){let i=t.nodes.get(e);if(i){i.props={...n},r(e=>({...e}));return}}r(e=>({...e,...i,options:{...e.options,...i.options}}))},e.onComponentsMounted()},[]),(0,tc.jsx)(tu.Suspense,{fallback:"",children:(0,tc.jsx)(t_,{ternsecure:e.ternsecure,options:t.options,children:[...n].map(([e,t])=>(0,tc.jsx)(tb,{node:e,componentName:t.name,componentProps:t.props,componentKey:t.key},t.key))})})};to.mountComponentRenderer=(e,t)=>{let r,n=document.getElementById(tI);return n||((n=document.createElement("div")).setAttribute("id",tI),document.body.appendChild(n)),{ensureMounted:async i=>{let{preloadHint:s}=i||{};if(!r){let i,a,o=(i=()=>{},a=()=>{},{promise:new Promise((e,t)=>{i=e,a=t}),resolve:i,reject:a});s&&tm(s),r=Promise.all([c.e("26"),c.e("666"),c.e("68")]).then(c.bind(c,8869)).then(({createRoot:r})=>(r(n).render((0,tc.jsx)(tk,{ternsecure:e,options:t,onComponentsMounted:o.resolve})),o.promise.then(()=>tS)))}return r.then(e=>e)}}},document.querySelector("[data-api-key]")?.getAttribute("data-api-key")||window.apiKey;let tT=document.querySelector("script[data-api-url]")?.getAttribute("data-api-url")||window.apiUrl||"",tC=document.querySelector("script[data-auth-domain]")?.getAttribute("data-auth-domain")||window.authDomain||"",tR=document.querySelector("[data-proxy-url]")?.getAttribute("data-proxy-url")||window.proxyUrl||"";window.TernSecure||(window.TernSecure=new to(tT,{proxyUrl:tR,authDomain:tC}))})(),{}})());