UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

37 lines (33 loc) 75.7 kB
"use strict";const $=require("react/jsx-runtime"),Ce=require("next-intl"),ft=require("react"),Le=require("./Button-CoJ-cT_W.js"),se=require("./index-DwV9MiDB.js"),ae=require("./SeparatorText-BdEeh2d8.js");require("./Toaster-fGwFcL9d.js");const s=require("./FormError-CBI4ORIY.js"),ie=require("./Input-kwEpp-yJ.js"),ht=()=>{};const Re=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},pt=function(e){const t=[];let r=0,n=0;for(;r<e.length;){const o=e[r++];if(o<128)t[n++]=String.fromCharCode(o);else if(o>191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((o&31)<<6|i&63)}else if(o>239&&o<365){const i=e[r++],a=e[r++],c=e[r++],u=((o&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;t[n++]=String.fromCharCode(55296+(u>>10)),t[n++]=String.fromCharCode(56320+(u&1023))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((o&15)<<12|(i&63)<<6|a&63)}}return t.join("")},Ne={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let o=0;o<e.length;o+=3){const i=e[o],a=o+1<e.length,c=a?e[o+1]:0,u=o+2<e.length,l=u?e[o+2]:0,d=i>>2,p=(i&3)<<4|c>>4;let h=(c&15)<<2|l>>6,f=l&63;u||(f=64,a||(h=64)),n.push(r[d],r[p],r[h],r[f])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Re(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):pt(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let o=0;o<e.length;){const i=r[e.charAt(o++)],c=o<e.length?r[e.charAt(o)]:0;++o;const l=o<e.length?r[e.charAt(o)]:64;++o;const p=o<e.length?r[e.charAt(o)]:64;if(++o,i==null||c==null||l==null||p==null)throw new mt;const h=i<<2|c>>4;if(n.push(h),l!==64){const f=c<<4&240|l>>2;if(n.push(f),p!==64){const v=l<<6&192|p;n.push(v)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class mt extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const gt=function(e){const t=Re(e);return Ne.encodeByteArray(t,!0)},je=function(e){return gt(e).replace(/\./g,"")},Be=function(e){try{return Ne.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function _t(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const bt=()=>_t().__FIREBASE_DEFAULTS__,vt=()=>{if(typeof process>"u"||typeof process.env>"u")return;const e=process.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},yt=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Be(e[1]);return t&&JSON.parse(t)},$t=()=>{try{return ht()||bt()||vt()||yt()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},wt=e=>$t()?.[`_${e}`];function zt(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}function xe(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function St(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(xe())}function Et(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function kt(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function It(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Zt(){try{return typeof indexedDB=="object"}catch{return!1}}function Ot(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{t(o.error?.message||"")}}catch(r){t(r)}})}const Pt="FirebaseError";class O extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=Pt,Object.setPrototypeOf(this,O.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,te.prototype.create)}}class te{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},o=`${this.service}/${t}`,i=this.errors[t],a=i?At(i,n):"Error",c=`${this.serviceName}: ${a} (${o}).`;return new O(o,c,n)}}function At(e,t){return e.replace(Dt,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const Dt=/\{\$([^}]+)}/g;function Tt(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(o=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function Ct(e,t){const r=new Lt(e,t);return r.subscribe.bind(r)}class Lt{constructor(t,r){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=r,this.task.then(()=>{t(this)}).catch(n=>{this.error(n)})}next(t){this.forEachObserver(r=>{r.next(t)})}error(t){this.forEachObserver(r=>{r.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,r,n){let o;if(t===void 0&&r===void 0&&n===void 0)throw new Error("Missing Observer.");Rt(t,["next","error","complete"])?o=t:o={next:t,error:r,complete:n},o.next===void 0&&(o.next=H),o.error===void 0&&(o.error=H),o.complete===void 0&&(o.complete=H);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?o.error(this.finalError):o.complete()}catch{}}),this.observers.push(o),i}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let r=0;r<this.observers.length;r++)this.sendOne(r,t)}sendOne(t,r){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{r(this.observers[t])}catch(n){typeof console<"u"&&console.error&&console.error(n)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Rt(e,t){if(typeof e!="object"||e===null)return!1;for(const r of t)if(r in e&&typeof e[r]=="function")return!0;return!1}function H(){}function Nt(e){return e&&e._delegate?e._delegate:e}class B{constructor(t,r,n){this.name=t,this.instanceFactory=r,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}exports.LogLevel=void 0;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(exports.LogLevel||(exports.LogLevel={}));const jt={debug:exports.LogLevel.DEBUG,verbose:exports.LogLevel.VERBOSE,info:exports.LogLevel.INFO,warn:exports.LogLevel.WARN,error:exports.LogLevel.ERROR,silent:exports.LogLevel.SILENT},Bt=exports.LogLevel.INFO,xt={[exports.LogLevel.DEBUG]:"log",[exports.LogLevel.VERBOSE]:"log",[exports.LogLevel.INFO]:"info",[exports.LogLevel.WARN]:"warn",[exports.LogLevel.ERROR]:"error"},Ft=(e,t,...r)=>{if(t<e.logLevel)return;const n=new Date().toISOString(),o=xt[t];if(o)console[o](`[${n}] ${e.name}:`,...r);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class Fe{constructor(t){this.name=t,this._logLevel=Bt,this._logHandler=Ft,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in exports.LogLevel))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?jt[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,exports.LogLevel.DEBUG,...t),this._logHandler(this,exports.LogLevel.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,exports.LogLevel.VERBOSE,...t),this._logHandler(this,exports.LogLevel.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,exports.LogLevel.INFO,...t),this._logHandler(this,exports.LogLevel.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,exports.LogLevel.WARN,...t),this._logHandler(this,exports.LogLevel.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,exports.LogLevel.ERROR,...t),this._logHandler(this,exports.LogLevel.ERROR,...t)}}const Ut=(e,t)=>t.some(r=>e instanceof r);let ce,ue;function Mt(){return ce||(ce=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Vt(){return ue||(ue=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ue=new WeakMap,G=new WeakMap,Me=new WeakMap,J=new WeakMap,re=new WeakMap;function Ht(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{r(A(e.result)),o()},a=()=>{n(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",a)});return t.then(r=>{r instanceof IDBCursor&&Ue.set(r,e)}).catch(()=>{}),re.set(t,e),t}function Jt(e){if(G.has(e))return;const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{r(),o()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});G.set(e,t)}let X={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return G.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Me.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return A(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Wt(e){X=e(X)}function Kt(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(W(this),t,...r);return Me.set(n,t.sort?t.sort():[t]),A(n)}:Vt().includes(e)?function(...t){return e.apply(W(this),t),A(Ue.get(this))}:function(...t){return A(e.apply(W(this),t))}}function qt(e){return typeof e=="function"?Kt(e):(e instanceof IDBTransaction&&Jt(e),Ut(e,Mt())?new Proxy(e,X):e)}function A(e){if(e instanceof IDBRequest)return Ht(e);if(J.has(e))return J.get(e);const t=qt(e);return t!==e&&(J.set(e,t),re.set(t,e)),t}const W=e=>re.get(e);function Gt(e,t,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){const a=indexedDB.open(e,t),c=A(a);return n&&a.addEventListener("upgradeneeded",u=>{n(A(a.result),u.oldVersion,u.newVersion,A(a.transaction),u)}),r&&a.addEventListener("blocked",u=>r(u.oldVersion,u.newVersion,u)),c.then(u=>{i&&u.addEventListener("close",()=>i()),o&&u.addEventListener("versionchange",l=>o(l.oldVersion,l.newVersion,l))}).catch(()=>{}),c}const Xt=["get","getKey","getAll","getAllKeys","count"],Yt=["put","add","delete","clear"],K=new Map;function le(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(K.get(t))return K.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=Yt.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||Xt.includes(r)))return;const i=async function(a,...c){const u=this.transaction(a,o?"readwrite":"readonly");let l=u.store;return n&&(l=l.index(c.shift())),(await Promise.all([l[r](...c),o&&u.done]))[0]};return K.set(t,i),i}Wt(e=>({...e,get:(t,r,n)=>le(t,r)||e.get(t,r,n),has:(t,r)=>!!le(t,r)||e.has(t,r)}));class Qt{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(er(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function er(e){return e.getComponent()?.type==="VERSION"}const Y="@firebase/app",de="0.14.9";const P=new Fe("@firebase/app"),tr="@firebase/app-compat",rr="@firebase/analytics-compat",nr="@firebase/analytics",or="@firebase/app-check-compat",sr="@firebase/app-check",ar="@firebase/auth",ir="@firebase/auth-compat",cr="@firebase/database",ur="@firebase/data-connect",lr="@firebase/database-compat",dr="@firebase/functions",fr="@firebase/functions-compat",hr="@firebase/installations",pr="@firebase/installations-compat",mr="@firebase/messaging",gr="@firebase/messaging-compat",_r="@firebase/performance",br="@firebase/performance-compat",vr="@firebase/remote-config",yr="@firebase/remote-config-compat",$r="@firebase/storage",wr="@firebase/storage-compat",zr="@firebase/firestore",Sr="@firebase/ai",Er="@firebase/firestore-compat",kr="firebase",Ir="12.10.0",Zr={[Y]:"fire-core",[tr]:"fire-core-compat",[nr]:"fire-analytics",[rr]:"fire-analytics-compat",[sr]:"fire-app-check",[or]:"fire-app-check-compat",[ar]:"fire-auth",[ir]:"fire-auth-compat",[cr]:"fire-rtdb",[ur]:"fire-data-connect",[lr]:"fire-rtdb-compat",[dr]:"fire-fn",[fr]:"fire-fn-compat",[hr]:"fire-iid",[pr]:"fire-iid-compat",[mr]:"fire-fcm",[gr]:"fire-fcm-compat",[_r]:"fire-perf",[br]:"fire-perf-compat",[vr]:"fire-rc",[yr]:"fire-rc-compat",[$r]:"fire-gcs",[wr]:"fire-gcs-compat",[zr]:"fire-fst",[Er]:"fire-fst-compat",[Sr]:"fire-vertex","fire-js":"fire-js",[kr]:"fire-js-all"};const Or=new Map,Pr=new Map,fe=new Map;function he(e,t){try{e.container.addComponent(t)}catch(r){P.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function x(e){const t=e.name;if(fe.has(t))return P.debug(`There were multiple attempts to register component ${t}.`),!1;fe.set(t,e);for(const r of Or.values())he(r,e);for(const r of Pr.values())he(r,e);return!0}function Ar(e){return e==null?!1:e.settings!==void 0}const Dr={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ne=new te("app","Firebase",Dr);const Tr=Ir;function j(e,t,r){let n=Zr[e]??e;r&&(n+=`-${r}`);const o=n.match(/\s|\//),i=t.match(/\s|\//);if(o||i){const a=[`Unable to register library "${n}" with version "${t}":`];o&&a.push(`library name "${n}" contains illegal characters (whitespace or "/")`),o&&i&&a.push("and"),i&&a.push(`version name "${t}" contains illegal characters (whitespace or "/")`),P.warn(a.join(" "));return}x(new B(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}const Cr="firebase-heartbeat-database",Lr=1,C="firebase-heartbeat-store";let q=null;function Ve(){return q||(q=Gt(Cr,Lr,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(C)}catch(r){console.warn(r)}}}}).catch(e=>{throw ne.create("idb-open",{originalErrorMessage:e.message})})),q}async function Rr(e){try{const r=(await Ve()).transaction(C),n=await r.objectStore(C).get(He(e));return await r.done,n}catch(t){if(t instanceof O)P.warn(t.message);else{const r=ne.create("idb-get",{originalErrorMessage:t?.message});P.warn(r.message)}}}async function pe(e,t){try{const n=(await Ve()).transaction(C,"readwrite");await n.objectStore(C).put(t,He(e)),await n.done}catch(r){if(r instanceof O)P.warn(r.message);else{const n=ne.create("idb-set",{originalErrorMessage:r?.message});P.warn(n.message)}}}function He(e){return`${e.name}!${e.options.appId}`}const Nr=1024,jr=30;class Br{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new Fr(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=me();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(o=>o.date===n))return;if(this._heartbeatsCache.heartbeats.push({date:n,agent:r}),this._heartbeatsCache.heartbeats.length>jr){const o=Ur(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(t){P.warn(t)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=me(),{heartbeatsToSend:r,unsentEntries:n}=xr(this._heartbeatsCache.heartbeats),o=je(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(t){return P.warn(t),""}}}function me(){return new Date().toISOString().substring(0,10)}function xr(e,t=Nr){const r=[];let n=e.slice();for(const o of e){const i=r.find(a=>a.agent===o.agent);if(i){if(i.dates.push(o.date),ge(r)>t){i.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),ge(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class Fr{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Zt()?Ot().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await Rr(this.app);return r?.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const n=await this.read();return pe(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const n=await this.read();return pe(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}else return}}function ge(e){return je(JSON.stringify({version:2,heartbeats:e})).length}function Ur(e){if(e.length===0)return-1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}function Mr(e){x(new B("platform-logger",t=>new Qt(t),"PRIVATE")),x(new B("heartbeat",t=>new Br(t),"PRIVATE")),j(Y,de,e),j(Y,de,"esm2020"),j("fire-js","")}Mr("");const Vr=/^[cC][^\s-]{8,}$/,Hr=/^[0-9a-z]+$/,Jr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wr=/^[0-9a-vA-V]{20}$/,Kr=/^[A-Za-z0-9]{27}$/,qr=/^[a-zA-Z0-9_-]{21}$/,Gr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,_e=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function en(){return new RegExp(Qr,"u")}const tn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Je=/^[A-Za-z0-9_-]*$/,an=/^\+[1-9]\d{6,14}$/,We="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",cn=new RegExp(`^${We}$`);function Ke(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function un(e){return new RegExp(`^${Ke(e)}$`)}function ln(e){const t=Ke({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${We}T(?:${n})$`)}const dn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},fn=/^[^A-Z]*$/,hn=/^[^a-z]*$/,Z=s.$constructor("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pn=s.$constructor("$ZodCheckMaxLength",(e,t)=>{var r;Z.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!s.nullish(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=s.getLengthableOrigin(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mn=s.$constructor("$ZodCheckMinLength",(e,t)=>{var r;Z.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!s.nullish(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=s.getLengthableOrigin(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gn=s.$constructor("$ZodCheckLengthEquals",(e,t)=>{var r;Z.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!s.nullish(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=s.getLengthableOrigin(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),V=s.$constructor("$ZodCheckStringFormat",(e,t)=>{var r,n;Z.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),_n=s.$constructor("$ZodCheckRegex",(e,t)=>{V.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bn=s.$constructor("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fn),V.init(e,t)}),vn=s.$constructor("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hn),V.init(e,t)}),yn=s.$constructor("$ZodCheckIncludes",(e,t)=>{Z.init(e,t);const r=s.escapeRegex(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),$n=s.$constructor("$ZodCheckStartsWith",(e,t)=>{Z.init(e,t);const r=new RegExp(`^${s.escapeRegex(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wn=s.$constructor("$ZodCheckEndsWith",(e,t)=>{Z.init(e,t);const r=new RegExp(`.*${s.escapeRegex(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),zn=s.$constructor("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Sn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(` `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(` `))}}const En={major:4,minor:3,patch:6},_=s.$constructor("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=En;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,c,u)=>{let l=s.aborted(a),d;for(const p of c){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(l)continue;const h=a.issues.length,f=p._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new s.$ZodAsyncError;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==h&&(l||(l=s.aborted(a,h)))});else{if(a.issues.length===h)continue;l||(l=s.aborted(a,h))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(s.aborted(a))return a.aborted=!0,a;const l=o(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new s.$ZodAsyncError;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}const u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new s.$ZodAsyncError;return u.then(l=>o(l,n,c))}return o(u,n,c)}}s.defineLazy(e,"~standard",()=>({validate:o=>{try{const i=s.safeParse(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return s.safeParseAsync(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),oe=s.$constructor("$ZodString",(e,t)=>{_.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),m=s.$constructor("$ZodStringFormat",(e,t)=>{V.init(e,t),oe.init(e,t)}),kn=s.$constructor("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xr),m.init(e,t)}),In=s.$constructor("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_e(n))}else t.pattern??(t.pattern=_e());m.init(e,t)}),Zn=s.$constructor("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Yr),m.init(e,t)}),On=s.$constructor("$ZodURL",(e,t)=>{m.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Pn=s.$constructor("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=en()),m.init(e,t)}),An=s.$constructor("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=qr),m.init(e,t)}),Dn=s.$constructor("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Vr),m.init(e,t)}),Tn=s.$constructor("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Hr),m.init(e,t)}),Cn=s.$constructor("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Jr),m.init(e,t)}),Ln=s.$constructor("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wr),m.init(e,t)}),Rn=s.$constructor("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Kr),m.init(e,t)}),Nn=s.$constructor("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ln(t)),m.init(e,t)}),jn=s.$constructor("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=cn),m.init(e,t)}),Bn=s.$constructor("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=un(t)),m.init(e,t)}),xn=s.$constructor("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gr),m.init(e,t)}),Fn=s.$constructor("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tn),m.init(e,t),e._zod.bag.format="ipv4"}),Un=s.$constructor("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rn),m.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Mn=s.$constructor("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nn),m.init(e,t)}),Vn=s.$constructor("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=on),m.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function qe(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Hn=s.$constructor("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=sn),m.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{qe(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Jn(e){if(!Je.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qe(r)}const Wn=s.$constructor("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Je),m.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Jn(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Kn=s.$constructor("$ZodE164",(e,t)=>{t.pattern??(t.pattern=an),m.init(e,t)});function qn(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Gn=s.$constructor("$ZodJWT",(e,t)=>{m.init(e,t),e._zod.check=r=>{qn(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Xn=s.$constructor("$ZodUnknown",(e,t)=>{_.init(e,t),e._zod.parse=r=>r}),Yn=s.$constructor("$ZodNever",(e,t)=>{_.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function be(e,t,r){e.issues.length&&t.issues.push(...s.prefixIssues(r,e.issues)),t.value[r]=e.value}const Qn=s.$constructor("$ZodArray",(e,t)=>{_.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const c=o[a],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?i.push(u.then(l=>be(l,r,a))):be(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function F(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...s.prefixIssues(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ge(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=s.optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Xe(e,t,r,n,o,i){const a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optout==="optional";for(const p in t){if(c.has(p))continue;if(l==="never"){a.push(p);continue}const h=u.run({value:t[p],issues:[]},n);h instanceof Promise?e.push(h.then(f=>F(f,r,p,t,d))):F(h,r,p,t,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const eo=s.$constructor("$ZodObject",(e,t)=>{if(_.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=s.cached(()=>Ge(t));s.defineLazy(e._zod,"propValues",()=>{const c=t.shape,u={};for(const l in c){const d=c[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(const p of d.values)u[l].add(p)}}return u});const o=s.isObject,i=t.catchall;let a;e._zod.parse=(c,u)=>{a??(a=n.value);const l=c.value;if(!o(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};const d=[],p=a.shape;for(const h of a.keys){const f=p[h],v=f._zod.optout==="optional",y=f._zod.run({value:l[h],issues:[]},u);y instanceof Promise?d.push(y.then(L=>F(L,c,h,l,v))):F(y,c,h,l,v)}return i?Xe(d,l,c,u,n.value,e):d.length?Promise.all(d).then(()=>c):c}}),to=s.$constructor("$ZodObjectJIT",(e,t)=>{eo.init(e,t);const r=e._zod.parse,n=s.cached(()=>Ge(t)),o=h=>{const f=new Sn(["shape","payload","ctx"]),v=n.value,y=I=>{const S=s.esc(I);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const L=Object.create(null);let ut=0;for(const I of v.keys)L[I]=`key_${ut++}`;f.write("const newResult = {};");for(const I of v.keys){const S=L[I],k=s.esc(I),dt=h[I]?._zod?.optout==="optional";f.write(`const ${S} = ${y(I)};`),dt?f.write(` if (${S}.issues.length) { if (${k} in input) { payload.issues = payload.issues.concat(${S}.issues.map(iss => ({ ...iss, path: iss.path ? [${k}, ...iss.path] : [${k}] }))); } } if (${S}.value === undefined) { if (${k} in input) { newResult[${k}] = undefined; } } else { newResult[${k}] = ${S}.value; } `):f.write(` if (${S}.issues.length) { payload.issues = payload.issues.concat(${S}.issues.map(iss => ({ ...iss, path: iss.path ? [${k}, ...iss.path] : [${k}] }))); } if (${S}.value === undefined) { if (${k} in input) { newResult[${k}] = undefined; } } else { newResult[${k}] = ${S}.value; } `)}f.write("payload.value = newResult;"),f.write("return payload;");const lt=f.compile();return(I,S)=>lt(h,I,S)};let i;const a=s.isObject,c=!s.globalConfig.jitless,u=s.allowsEval,l=c&&u.value,d=t.catchall;let p;e._zod.parse=(h,f)=>{p??(p=n.value);const v=h.value;return a(v)?c&&l&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),h=i(h,f),d?Xe([],v,h,f,p,e):h):r(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function ve(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!s.aborted(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>s.finalizeIssue(a,n,s.config())))}),t)}const ro=s.$constructor("$ZodUnion",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),s.defineLazy(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),s.defineLazy(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),s.defineLazy(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>s.cleanRegex(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1;const c=[];for(const u of t.options){const l=u._zod.run({value:o.value,issues:[]},i);if(l instanceof Promise)c.push(l),a=!0;else{if(l.issues.length===0)return l;c.push(l)}}return a?Promise.all(c).then(u=>ve(u,o,e,i)):ve(c,o,e,i)}}),no=s.$constructor("$ZodIntersection",(e,t)=>{_.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>ye(r,u,l)):ye(r,i,a)}});function Q(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(s.isPlainObject(e)&&s.isPlainObject(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const a=Q(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],i=t[n],a=Q(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ye(e,t,r){const n=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const u of c.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(c);for(const c of r.issues)if(c.code==="unrecognized_keys")for(const u of c.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(c);const i=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&o&&e.issues.push({...o,keys:i}),s.aborted(e))return e;const a=Q(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const oo=s.$constructor("$ZodEnum",(e,t)=>{_.init(e,t);const r=s.getEnumValues(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>s.propertyKeyTypes.has(typeof o)).map(o=>typeof o=="string"?s.escapeRegex(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),so=s.$constructor("$ZodTransform",(e,t)=>{_.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new s.$ZodEncodeError(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new s.$ZodAsyncError;return r.value=o,r}});function $e(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ye=s.$constructor("$ZodOptional",(e,t)=>{_.init(e,t),e._zod.optin="optional",e._zod.optout="optional",s.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),s.defineLazy(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${s.cleanRegex(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>$e(i,r.value)):$e(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ao=s.$constructor("$ZodExactOptional",(e,t)=>{Ye.init(e,t),s.defineLazy(e._zod,"values",()=>t.innerType._zod.values),s.defineLazy(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),io=s.$constructor("$ZodNullable",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"optin",()=>t.innerType._zod.optin),s.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),s.defineLazy(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${s.cleanRegex(r.source)}|null)$`):void 0}),s.defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),co=s.$constructor("$ZodDefault",(e,t)=>{_.init(e,t),e._zod.optin="optional",s.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>we(i,t)):we(o,t)}});function we(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const uo=s.$constructor("$ZodPrefault",(e,t)=>{_.init(e,t),e._zod.optin="optional",s.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),lo=s.$constructor("$ZodNonOptional",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ze(i,e)):ze(o,e)}});function ze(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const fo=s.$constructor("$ZodCatch",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"optin",()=>t.innerType._zod.optin),s.defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),s.defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>s.finalizeIssue(a,n,s.config()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>s.finalizeIssue(i,n,s.config()))},input:r.value}),r.issues=[]),r)}}),ho=s.$constructor("$ZodPipe",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"values",()=>t.in._zod.values),s.defineLazy(e._zod,"optin",()=>t.in._zod.optin),s.defineLazy(e._zod,"optout",()=>t.out._zod.optout),s.defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>R(a,t.in,n)):R(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>R(i,t.out,n)):R(o,t.out,n)}});function R(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const po=s.$constructor("$ZodReadonly",(e,t)=>{_.init(e,t),s.defineLazy(e._zod,"propValues",()=>t.innerType._zod.propValues),s.defineLazy(e._zod,"values",()=>t.innerType._zod.values),s.defineLazy(e._zod,"optin",()=>t.innerType?._zod?.optin),s.defineLazy(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Se):Se(o)}});function Se(e){return e.value=Object.freeze(e.value),e}const mo=s.$constructor("$ZodCustom",(e,t)=>{Z.init(e,t),_.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Ee(i,r,n,e));Ee(o,r,n,e)}});function Ee(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(s.issue(o))}}var ke;class go{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function _o(){return new go}(ke=globalThis).__zod_globalRegistry??(ke.__zod_globalRegistry=_o());const T=globalThis.__zod_globalRegistry;function bo(e,t){return new e({type:"string",...s.normalizeParams(t)})}function vo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Ie(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function yo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function $o(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...s.normalizeParams(t)})}function wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...s.normalizeParams(t)})}function zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...s.normalizeParams(t)})}function So(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Eo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...s.normalizeParams(t)})}function ko(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Io(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Zo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Oo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Po(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Ao(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Do(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...s.normalizeParams(t)})}function To(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Co(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Lo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Ro(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...s.normalizeParams(t)})}function No(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...s.normalizeParams(t)})}function jo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...s.normalizeParams(t)})}function Bo(e,t){