@tern-secure/auth 1.1.0-canary.v20251206170928 → 1.1.0-canary.v20251207162402

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 (16) hide show
  1. package/dist/ternsecure.browser.js +2 -2
  2. package/dist/ternsecure.js +2 -2
  3. package/dist/ternsecure.mjs +2 -2
  4. package/package.json +3 -3
  5. /package/dist/{492_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → 492_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  6. /package/dist/{687_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → 687_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  7. /package/dist/{68_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → 68_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  8. /package/dist/{framework_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → framework_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  9. /package/dist/{signin_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.css → signin_ternsecure_139cdd_1.1.0-canary.v20251207162402.css} +0 -0
  10. /package/dist/{signin_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → signin_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  11. /package/dist/{signup_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.css → signup_ternsecure_139cdd_1.1.0-canary.v20251207162402.css} +0 -0
  12. /package/dist/{signup_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → signup_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  13. /package/dist/{ui-common_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → ui-common_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  14. /package/dist/{userbutton_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.css → userbutton_ternsecure_139cdd_1.1.0-canary.v20251207162402.css} +0 -0
  15. /package/dist/{userbutton_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → userbutton_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
  16. /package/dist/{vendors_ternsecure_2ab3a6_1.1.0-canary.v20251206170928.js → vendors_ternsecure_139cdd_1.1.0-canary.v20251207162402.js} +0 -0
@@ -25,6 +25,6 @@ Message:${this.message}`,Object.setPrototypeOf(this,e.prototype),this.code=r,thi
25
25
 
26
26
  Possible fixes:
27
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.v20251206170928.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.v20251206170928.js",c.h=()=>"2ab3a696e775012b",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(`
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.v20251207162402.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.v20251207162402.js",c.h=()=>"139cdd40bf32df5e",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
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.v20251206170928";static sdkMetadata={name:"@tern-secure/auth",version:"1.1.0-canary.v20251206170928",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}))})(),{}})());
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.v20251207162402";static sdkMetadata={name:"@tern-secure/auth",version:"1.1.0-canary.v20251207162402",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}))})(),{}})());