@dbx-tools/tunnel 0.9.189 → 0.9.193
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LOGIN_CLIENT_SOURCE = "(()=>{var sl=Object.defineProperty;var al=(e)=>e;function cl(e,t){this[e]=al.bind(null,t)}var Gn=(e,t)=>{for(var r in t)sl(e,r,{get:t[r],enumerable:!0,configurable:!0,set:cl.bind(t,r)})};var ul=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var S=((e)=>typeof require<\"u\"?require:typeof Proxy<\"u\"?new Proxy(e,{get:(t,r)=>(typeof require<\"u\"?require:t)[r]}):e)(function(e){if(typeof require<\"u\")return require.apply(this,arguments);throw Error('Dynamic require of \"'+e+'\" is not supported')});var zo={};Gn(zo,{TextDecoder:()=>Ro,TextEncoder:()=>Po,_extend:()=>vr,callbackify:()=>Oo,callbackifyOnRejected:()=>Sr,debuglog:()=>yl,default:()=>zl,deprecate:()=>gl,format:()=>br,inherits:()=>Eo,inspect:()=>ge,isArray:()=>So,isBoolean:()=>xr,isBuffer:()=>Ol,isDate:()=>yr,isError:()=>St,isFunction:()=>wt,isNull:()=>Et,isNullOrUndefined:()=>El,isNumber:()=>wo,isObject:()=>Le,isPrimitive:()=>Al,isRegExp:()=>vt,isString:()=>kt,isSymbol:()=>kl,isUndefined:()=>Ie,log:()=>To,promisify:()=>Ao,types:()=>Tl});function br(e,...t){if(!kt(e)){var r=[e];for(var n=0;n<t.length;n++)r.push(ge(t[n]));return r.join(\" \")}var n=0,o=t.length,i=String(e).replace(hl,function(a){if(a===\"%%\")return\"%\";if(n>=o)return a;switch(a){case\"%s\":return String(t[n++]);case\"%d\":return Number(t[n++]);case\"%j\":try{return JSON.stringify(t[n++])}catch(c){return\"[Circular]\"}default:return a}});for(var s=t[n];n<o;s=t[++n])if(Et(s)||!Le(s))i+=\" \"+s;else i+=\" \"+ge(s);return i}function gl(e,t){if(typeof process>\"u\"||process?.noDeprecation===!0)return e;var r=!1;function n(...o){if(!r){if(process.throwDeprecation)throw Error(t);else if(process.traceDeprecation)console.trace(t);else console.error(t);r=!0}return e.apply(this,...o)}return n}function bl(e,t){var r=ge.styles[t];if(r)return\"\\x1B[\"+ge.colors[r][0]+\"m\"+e+\"\\x1B[\"+ge.colors[r][1]+\"m\";else return e}function xl(e,t){return e}function _l(e){var t={};return e.forEach(function(r,n){t[r]=!0}),t}function Tt(e,t,r){if(e.customInspect&&t&&wt(t.inspect)&&t.inspect!==ge&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(r,e);if(!kt(n))n=Tt(e,n,r);return n}var o=vl(e,t);if(o)return o;var i=Object.keys(t),s=_l(i);if(e.showHidden)i=Object.getOwnPropertyNames(t);if(St(t)&&(i.indexOf(\"message\")>=0||i.indexOf(\"description\")>=0))return mr(t);if(i.length===0){if(wt(t)){var a=t.name?\": \"+t.name:\"\";return e.stylize(\"[Function\"+a+\"]\",\"special\")}if(vt(t))return e.stylize(RegExp.prototype.toString.call(t),\"regexp\");if(yr(t))return e.stylize(Date.prototype.toString.call(t),\"date\");if(St(t))return mr(t)}var c=\"\",u=!1,l=[\"{\",\"}\"];if(So(t))u=!0,l=[\"[\",\"]\"];if(wt(t)){var p=t.name?\": \"+t.name:\"\";c=\" [Function\"+p+\"]\"}if(vt(t))c=\" \"+RegExp.prototype.toString.call(t);if(yr(t))c=\" \"+Date.prototype.toUTCString.call(t);if(St(t))c=\" \"+mr(t);if(i.length===0&&(!u||t.length==0))return l[0]+c+l[1];if(r<0)if(vt(t))return e.stylize(RegExp.prototype.toString.call(t),\"regexp\");else return e.stylize(\"[Object]\",\"special\");e.seen.push(t);var d;if(u)d=Sl(e,t,r,s,i);else d=i.map(function(m){return gr(e,t,r,s,m,u)});return e.seen.pop(),wl(d,c,l)}function vl(e,t){if(Ie(t))return e.stylize(\"undefined\",\"undefined\");if(kt(t)){var r=\"'\"+JSON.stringify(t).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return e.stylize(r,\"string\")}if(wo(t))return e.stylize(\"\"+t,\"number\");if(xr(t))return e.stylize(\"\"+t,\"boolean\");if(Et(t))return e.stylize(\"null\",\"null\")}function mr(e){return\"[\"+Error.prototype.toString.call(e)+\"]\"}function Sl(e,t,r,n,o){var i=[];for(var s=0,a=t.length;s<a;++s)if(ko(t,String(s)))i.push(gr(e,t,r,n,String(s),!0));else i.push(\"\");return o.forEach(function(c){if(!c.match(/^\\d+$/))i.push(gr(e,t,r,n,c,!0))}),i}function gr(e,t,r,n,o,i){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},c.get)if(c.set)a=e.stylize(\"[Getter/Setter]\",\"special\");else a=e.stylize(\"[Getter]\",\"special\");else if(c.set)a=e.stylize(\"[Setter]\",\"special\");if(!ko(n,o))s=\"[\"+o+\"]\";if(!a)if(e.seen.indexOf(c.value)<0){if(Et(r))a=Tt(e,c.value,null);else a=Tt(e,c.value,r-1);if(a.indexOf(`\n`)>-1)if(i)a=a.split(`\n`).map(function(u){return\" \"+u}).join(`\n`).slice(2);else a=`\n`+a.split(`\n`).map(function(u){return\" \"+u}).join(`\n`)}else a=e.stylize(\"[Circular]\",\"special\");if(Ie(s)){if(i&&o.match(/^\\d+$/))return a;if(s=JSON.stringify(\"\"+o),s.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))s=s.slice(1,-1),s=e.stylize(s,\"name\");else s=s.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),s=e.stylize(s,\"string\")}return s+\": \"+a}function wl(e,t,r){var n=0,o=e.reduce(function(i,s){if(n++,s.indexOf(`\n`)>=0)n++;return i+s.replace(/\\u001b\\[\\d\\d?m/g,\"\").length+1},0);if(o>60)return r[0]+(t===\"\"?\"\":t+`\n `)+\" \"+e.join(`,\n `)+\" \"+r[1];return r[0]+t+\" \"+e.join(\", \")+\" \"+r[1]}function So(e){return Array.isArray(e)}function xr(e){return typeof e===\"boolean\"}function Et(e){return e===null}function El(e){return e==null}function wo(e){return typeof e===\"number\"}function kt(e){return typeof e===\"string\"}function kl(e){return typeof e===\"symbol\"}function Ie(e){return e===void 0}function vt(e){return Le(e)&&_r(e)===\"[object RegExp]\"}function Le(e){return typeof e===\"object\"&&e!==null}function yr(e){return Le(e)&&_r(e)===\"[object Date]\"}function St(e){return Le(e)&&(_r(e)===\"[object Error]\"||e instanceof Error)}function wt(e){return typeof e===\"function\"}function Al(e){return e===null||typeof e===\"boolean\"||typeof e===\"number\"||typeof e===\"string\"||typeof e===\"symbol\"||typeof e>\"u\"}function Ol(e){return e instanceof Buffer}function _r(e){return Object.prototype.toString.call(e)}function hr(e){return e<10?\"0\"+e.toString(10):e.toString(10)}function Rl(){var e=new Date,t=[hr(e.getHours()),hr(e.getMinutes()),hr(e.getSeconds())].join(\":\");return[e.getDate(),Pl[e.getMonth()],t].join(\" \")}function To(...e){console.log(\"%s - %s\",Rl(),br.apply(null,e))}function Eo(e,t){if(t)e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function vr(e,t){if(!t||!Le(t))return e;var r=Object.keys(t),n=r.length;while(n--)e[r[n]]=t[r[n]];return e}function ko(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sr(e,t){if(!e){var r=Error(\"Promise was rejected with a falsy value\");r.reason=e,e=r}return t(e)}function Oo(e){if(typeof e!==\"function\")throw TypeError('The \"original\" argument must be of type Function');function t(...r){var n=r.pop();if(typeof n!==\"function\")throw TypeError(\"The last argument must be of type Function\");var o=this,i=function(...s){return n.apply(o,...s)};e.apply(this,r).then(function(s){process.nextTick(i.bind(null,null,s))},function(s){process.nextTick(Sr.bind(null,s,i))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),t}var hl,yl,ge,Tl=()=>{},Pl,Ao,Po,Ro,zl;var $o=ul(()=>{hl=/%[sdj%]/g;yl=((e={},t={},r)=>((r=typeof process<\"u\"&&!1)&&(r=r.replace(/[|\\\\{}()[\\]^$+?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase()),t=new RegExp(\"^\"+r+\"$\",\"i\"),(n)=>{if(n=n.toUpperCase(),!e[n])if(t.test(n))e[n]=function(...o){console.error(\"%s: %s\",n,pid,br.apply(null,...o))};else e[n]=function(){};return e[n]}))(),ge=((e)=>(e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"},e.custom=Symbol.for(\"nodejs.util.inspect.custom\"),e))(function(e,t,...r){var n={seen:[],stylize:xl};if(r.length>=1)n.depth=r[0];if(r.length>=2)n.colors=r[1];if(xr(t))n.showHidden=t;else if(t)vr(n,t);if(Ie(n.showHidden))n.showHidden=!1;if(Ie(n.depth))n.depth=2;if(Ie(n.colors))n.colors=!1;if(n.colors)n.stylize=bl;return Tt(n,e,n.depth)});Pl=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];Ao=((e)=>(e.custom=Symbol.for(\"nodejs.util.promisify.custom\"),e))(function(e){if(typeof e!==\"function\")throw TypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&e[kCustomPromisifiedSymbol]){var t=e[kCustomPromisifiedSymbol];if(typeof t!==\"function\")throw TypeError('The \"nodejs.util.promisify.custom\" argument must be of type Function');return Object.defineProperty(t,kCustomPromisifiedSymbol,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(...r){var n,o,i=new Promise(function(s,a){n=s,o=a});r.push(function(s,a){if(s)o(s);else n(a)});try{e.apply(this,r)}catch(s){o(s)}return i}if(Object.setPrototypeOf(t,Object.getPrototypeOf(e)),kCustomPromisifiedSymbol)Object.defineProperty(t,kCustomPromisifiedSymbol,{value:t,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))});({TextEncoder:Po,TextDecoder:Ro}=globalThis),zl={TextEncoder:Po,TextDecoder:Ro,promisify:Ao,log:To,inherits:Eo,_extend:vr,callbackifyOnRejected:Sr,callbackify:Oo}});function Wn(e){return Array.isArray(e)||e instanceof Set||e instanceof Map}function Yn(e,t){function r(n,o){if(n==null)return!0;else if(typeof n===\"object\"){if(o?.has(n))return!0;if(o?.add(n),Array.isArray(n))return n.length===0||(o?n.every((s)=>r(s,o)):!1);if(n instanceof Set)return n.size===0||(o?[...n].every((s)=>r(s,o)):!1);if(n instanceof Map)return n.size===0||(o?[...n.values()].every((s)=>r(s,o)):!1);let i=Object.keys(n);if(i.length===0)return!0;else if(o)return i.every((s)=>r(n[s],o));else return!1}else return!1}return r(e,t?.recursive?new Set:void 0)}function Xn(e){return e instanceof Map?e.values():e}function Qn(e){return e!=null&&typeof e!==\"string\"&&!(e instanceof String)&&!(e instanceof RegExp)&&typeof e!==\"function\"&&typeof e[Symbol.iterator]===\"function\"}function eo(...e){let t=[];for(let r of e){if(r==null||Wn(r)&&Yn(r))continue;t.push(Qn(r)?Xn(r):[r])}return t}function to(e,t){if(t>0&&Array.isArray(e)){let r=Number.isFinite(t)?t-1:t;return{*[Symbol.iterator](){for(let n of e)yield*to(n,r)}}}return[e]}function fr(e,t){return R({*[Symbol.iterator](){let r=0;for(let n of e)yield*t(n,r++)}})}function ll(e,t){return R({*[Symbol.iterator](){let r=0;for(let n of e)yield t(n,r++)}})}function ro(e,t){return ll(R(e),t)}function pr(e,t){return fr(R(e),function*(r,n){if(t(r,n))yield r})}function no(...e){return pr(R(...e),(t)=>t!=null)}function oo(e,t){return fr(R(e),function*(r,n){let o=t(r,n);if(Array.isArray(o))yield*o;else yield o})}function io(e,...t){let r=R(...t);if(e<1)return r;return fr(r,(n)=>to(n,e))}function so(...e){let t=R(...e);return R({*[Symbol.iterator](){let r=new Set;for(let n of t){if(r.has(n))continue;r.add(n),yield n}}})}function ao(e,...t){let r=R(e);if(t.length===0)return r;return R({*[Symbol.iterator](){yield*r;for(let n of t)if(Array.isArray(n))yield*n;else yield n}})}function co(e,...t){if(e<=0)return xo;let r=R(...t);return R({*[Symbol.iterator](){let n=0;for(let o of r)if(yield o,++n>=e)return}})}function uo(e,...t){let r=Object.keys(e),n=new Map(r.map((s)=>[s,[]])),o=0;for(let s of R(...t)){let a=o++;for(let c of r)if(e[c](s,a)){n.get(c).push(s);break}}let i={};for(let s of r)i[s]=n.get(s);return i}function lo(e,t){let r=0;for(let n of R(e))if(t(n,r++))return n;return}function fo(e,t){let r=0,n;for(let o of R(e))if(t(o,r++))n=o;return n}function po(e,t){let r=0;for(let n of R(e)){if(t(n,r))return r;r++}return-1}function mo(e,t){let r=0,n=-1;for(let o of R(e)){if(t(o,r))n=r;r++}return n}function ho(e,t){let r=0;for(let n of R(e))if(t(n,r++))return!0;return!1}function go(e,t){let r=0;for(let n of R(e))if(!t(n,r++))return!1;return!0}function yo(e,t){let r=0;for(let n of R(e))t(n,r++)}function bo(e,...t){let r=R(...t);if(e<0)return dr(r).at(e);let n=0;for(let o of r)if(n++===e)return o;return}function dr(...e){return[...R(...e)]}class $e{source;buffer;iterator;exhausted;constructor(e,t,r={}){this.source=e;this.buffer=t;this.exhausted=r.exhausted??!1}get caching(){return this.buffer!==void 0}pull(){return this.iterator??=this.source[Symbol.iterator](),this.iterator.next()}*[Symbol.iterator](){if(!this.caching){if(this.exhausted)return;for(let e=this.pull();!e.done;e=this.pull())yield e.value;this.exhausted=!0}else{let e=this.buffer,t=0;for(;;){if(t<e.length){yield e[t++];continue}if(this.exhausted)return;let r=this.pull();if(r.done){this.exhausted=!0;return}e.push(r.value),yield r.value,t++}}}map(e){return ro(this,e)}filter(e){return pr(this,e)}nonNull(){return no(this)}flatMap(e){return oo(this,e)}flat(e=1){return io(e,this)}distinct(){return so(this)}concat(...e){return ao(this,...e)}join(...e){let t=eo(this,...e);return t.length===1?this:R(...t)}take(e){return co(e,this)}group(e){return uo(e,this)}cache(){return this.caching?this:new $e(this,[])}find(e){return lo(this,e)}findLast(e){return fo(this,e)}findIndex(e){return po(this,e)}findLastIndex(e){return mo(this,e)}some(e){return ho(this,e)}every(e){return go(this,e)}forEach(e){yo(this,e)}at(e){return bo(e,this)}toArray(){if(this.caching&&this.exhausted)return[...this.buffer];return dr(this)}}var xo=new $e([],void 0,{exhausted:!0});function R(...e){let t=eo(...e);if(t.length===0)return xo;if(t.length===1){let r=t[0];return r instanceof $e?r:new $e(r,void 0)}return new $e({*[Symbol.iterator](){for(let r of t)yield*r}},void 0)}function Ge(e){if(typeof e===\"boolean\")return e;else if(typeof e===\"string\"){if(e=e.trim().toLowerCase(),e===\"true\"||e==\"t\"||e===\"on\"||e===\"1\"||e===\"yes\"||e===\"y\")return!0;else if(e===\"false\"||e==\"f\"||e===\"off\"||e===\"0\"||e===\"no\"||e===\"n\")return!1}else if(typeof e===\"number\"){if(e===1)return!0;else if(e===0)return!1}return}var fl=[[1,[\"ms\",\"msec\",\"millisecond\",\"milli\"]],[1000,[\"s\",\"sec\",\"second\"]],[60000,[\"m\",\"min\",\"minute\"]],[3600000,[\"h\",\"hr\",\"hour\"]],[86400000,[\"d\",\"day\"]],[604800000,[\"w\",\"wk\",\"week\"]],[2592000000,[\"mo\",\"mon\",\"month\"]],[31536000000,[\"y\",\"yr\",\"year\"]]],mh=new Map(fl.flatMap(([e,t])=>t.map((r)=>[r,e])));function _t(e,t){let r=t?.ttlMs??0,n;return()=>{if(n===void 0||r>0&&Date.now()>=n.expiresAt){let o=e();if(dl(o)){let i=Promise.resolve(o),s={value:i,expiresAt:1/0};n=s,i.then(()=>{s.expiresAt=Date.now()+r},()=>{if(n===s)n=void 0})}else n={value:o,expiresAt:Date.now()+r}}return n.value}}function dl(e){if(e!==null){if(e instanceof Promise)return!0;else if(typeof e===\"object\"&&\"then\"in e&&typeof e.then===\"function\")return!0}return!1}var{process:oe,Bun:wr}=globalThis,Io=oe&&typeof oe.stderr?.write===\"function\"?oe.stderr:void 0,Lo=oe&&typeof oe.stdout?.write===\"function\"?oe.stdout:void 0,Ot=[\"debug\",\"info\",\"warn\",\"error\"],Tr=Object.fromEntries(Ot.map((e,t)=>[e,t])),$l=Object.fromEntries(Ot.map((e)=>{let t=\"\\x1B[90m\";switch(e){case\"info\":t=\"\\x1B[34m\";break;case\"warn\":t=\"\\x1B[33m\";break;case\"error\":t=\"\\x1B[31m\";break}return[e,t]})),Co=\"\\x1B[0m\",Il=\"info\";async function Ll(e,t){let n=e===void 0&&t===void 0?void 0:await Promise.resolve().then(() => ($o(),zo)).catch(()=>{return});return No(e,t,n)}function No(e,t,r){let n=wr!==void 0&&!Ge(wr.env?.LOG_BUN_CONSOLE_DISABLED)?wr.inspect:void 0,o=n!==void 0,i=(c,u)=>{if(Array.isArray(c)||typeof c===\"object\"&&c!==null)if(n!==void 0)return n(c,{colors:u,depth:r?.inspect?.defaultOptions?.depth??void 0});else if(r!==void 0)return r.inspect(c,{...r?.inspect?.defaultOptions,colors:!1});else{let l=new WeakSet;return JSON.stringify(c,(p,d)=>{if(typeof d===\"object\"&&d!==null){if(l.has(d))return\"[Circular]\";l.add(d)}if(d instanceof Error){let m=d;return{...Object.fromEntries(Object.entries(m)),name:m.name,message:m.message,stack:m.stack,...m.cause===void 0?{}:{cause:m.cause},...m.errors===void 0?{}:{errors:m.errors}}}return d})}else return String(c)},s=(c)=>{let u=Object.fromEntries(Ot.map((l)=>{let d=(l===\"warn\"||l===\"error\"?t:e)??t??e,m=Zl(c,d,o),{prefix:g,colors:h,resetColors:v}=m(l);return[l,(...A)=>{if(!Ul(l,!0))return;if(d!==void 0){let b=g?[g]:[];if(b.push(...A.map((E)=>i(E,h))),v)b.push(Co);d.write(b.join(\" \")+`\n`)}else{let b=console[l];if(typeof b!==\"function\")b=console.log;if(g)b=b.bind(console,g);b(...A)}}]}));return u.success=u.info,u.start=u.info,u},a=_t(s);return(c)=>c?s(c):a()}var Cl=_t(async()=>Ll(Lo,Io)),At=No(Lo,Io);Cl().then((e)=>{At=e},()=>{});function Nl(e){let t,r=()=>{if(t?.factory!==At)t={factory:At,logger:At(e)};return t.logger};return Object.fromEntries([...Ot,\"success\",\"start\"].map((n)=>[n,(...o)=>r()[n](...o)]))}function Zl(e,t,r){let n=globalThis,o=n.window!==void 0&&n.document!==void 0,i=!o?Dl(t):!1,s=e?\"[\"+e+\"]\":void 0;return(a)=>{let c=i&&a!==void 0?$l[a]:void 0,u=[!o&&a?a.toUpperCase():void 0,s].filter(Boolean).join(\" \"),l=!1;if(c){let p=r||a===\"info\";if(!p)l=!0;u=p?c+u+Co:c+u}return{prefix:u,colors:c?!0:!1,resetColors:l}}}function Dl(e){if(oe===void 0||typeof e!==\"object\"||e===null)return!1;let{isTTY:t}=e;if(t!==!0)return!1;if(oe.env?.TERM?.toLowerCase()==\"dumb\")return!1;return!0}function Zo(e){if(e===void 0||e===null)return;let t=typeof e===\"string\"?e:String(e);for(let r=0;r<2;r++){if(r>0){let n=t.trim().toLowerCase();if(t===n)break;t=n}if(!t)break;else if(t in Tr)return t}return}function Er(){return Zo(oe?.env?.LOG_LEVEL)??Il}function Ul(e,t){let r=Zo(e);if(r===void 0)return t??!1;return Tr[r]>=Tr[Er()]}var jl=/^(?:[a-z][a-z0-9+.-]*:\\/\\/)?.*\\/([^/.]+)(?:\\.[^/]+)?$/i;function Do(e){if(!e)return;if(typeof e===\"string\")return e.match(jl)?.[1]??e;return Do(e.name)}function We(e){let t=Do(e);return Nl(t)}var xh=Object.freeze({status:\"aborted\"});function f(e,t,r){function n(a,c){if(!a._zod)Object.defineProperty(a,\"_zod\",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];if(!(d in a))a[d]=u[d].bind(a)}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,\"name\",{value:e});function s(a){var c;let u=r?.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,\"init\",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,\"name\",{value:e}),s}var _h=Symbol(\"zod_brand\");class ie extends Error{constructor(){super(\"Encountered Promise during synchronous parse. Use .parseAsync() instead.\")}}class Ye extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name=\"ZodEncodeError\"}}var Pt={};function J(e){if(e)Object.assign(Pt,e);return Pt}function zt(e){let t=Object.values(e).filter((n)=>typeof n===\"number\");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ar(e,t=\"|\"){return e.map((r)=>zr(r)).join(t)}function Xe(e,t){if(typeof t===\"bigint\")return t.toString();return t}function Qe(e){return{get value(){{let r=e();return Object.defineProperty(this,\"value\",{value:r}),r}throw Error(\"cached value already set\")}}}function $t(e){return e===null||e===void 0}function It(e){let t=e.startsWith(\"^\")?1:0,r=e.endsWith(\"$\")?e.length-1:e.length;return e.slice(t,r)}function Mo(e,t){let r=(e.toString().split(\".\")[1]||\"\").length,n=t.toString(),o=(n.split(\".\")[1]||\"\").length;if(o===0&&/\\d?e-\\d?/.test(n)){let c=n.match(/\\d?e-(\\d?)/);if(c?.[1])o=Number.parseInt(c[1])}let i=r>o?r:o,s=Number.parseInt(e.toFixed(i).replace(\".\",\"\")),a=Number.parseInt(t.toFixed(i).replace(\".\",\"\"));return s%a/10**i}var jo=Symbol(\"evaluating\");function w(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===jo)return;if(n===void 0)n=jo,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ye(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Or(e){return JSON.stringify(e)}function Fo(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,\"\").replace(/[\\s_-]+/g,\"-\").replace(/^-+|-+$/g,\"\")}var Pr=\"captureStackTrace\"in Error?Error.captureStackTrace:(...e)=>{};function Ce(e){return typeof e===\"object\"&&e!==null&&!Array.isArray(e)}var Bo=Qe(()=>{if(typeof navigator<\"u\"&&navigator?.userAgent?.includes(\"Cloudflare\"))return!1;try{return new Function(\"\"),!0}catch(e){return!1}});function be(e){if(Ce(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!==\"function\")return!0;let r=t.prototype;if(Ce(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,\"isPrototypeOf\")===!1)return!1;return!0}function Rr(e){if(be(e))return{...e};if(Array.isArray(e))return[...e];return e}var Vo=new Set([\"string\",\"number\",\"symbol\"]);function ue(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function te(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function y(e){let t=e;if(!t)return{};if(typeof t===\"string\")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}if(delete t.message,typeof t.error===\"string\")return{...t,error:()=>t.error};return t}function zr(e){if(typeof e===\"bigint\")return e.toString()+\"n\";if(typeof e===\"string\")return`\"${e}\"`;return`${e}`}function qo(e){return Object.keys(e).filter((t)=>e[t]._zod.optin===\"optional\"&&e[t]._zod.optout===\"optional\")}var Ko={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Bl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".pick() cannot be used on object schemas containing refinements\");let i=ce(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: \"${a}\"`);if(!t[a])continue;s[a]=r.shape[a]}return ye(this,\"shape\",s),s},checks:[]});return te(e,i)}function Vl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".omit() cannot be used on object schemas containing refinements\");let i=ce(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: \"${a}\"`);if(!t[a])continue;delete s[a]}return ye(this,\"shape\",s),s},checks:[]});return te(e,i)}function ql(e,t){if(!be(t))throw Error(\"Invalid input to extend: expected a plain object\");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\")}let o=ce(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ye(this,\"shape\",i),i}});return te(e,o)}function Kl(e,t){if(!be(t))throw Error(\"Invalid input to safeExtend: expected a plain object\");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ye(this,\"shape\",n),n}});return te(e,r)}function Hl(e,t){let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ye(this,\"shape\",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return te(e,r)}function Jl(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(\".partial() cannot be used on object schemas containing refinements\");let s=ce(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: \"${u}\"`);if(!r[u])continue;c[u]=e?new e({type:\"optional\",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:\"optional\",innerType:a[u]}):a[u];return ye(this,\"shape\",c),c},checks:[]});return te(t,s)}function Gl(e,t,r){let n=ce(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: \"${s}\"`);if(!r[s])continue;i[s]=new e({type:\"nonoptional\",innerType:o[s]})}else for(let s in o)i[s]=new e({type:\"nonoptional\",innerType:o[s]});return ye(this,\"shape\",i),i}});return te(t,n)}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function le(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Rt(e){return typeof e===\"string\"?e:e?.message}function re(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Rt(e.inst?._zod.def?.error?.(e))??Rt(t?.error?.(e))??Rt(r.customError?.(e))??Rt(r.localeError?.(e))??\"Invalid input\";n.message=o}if(delete n.inst,delete n.continue,!t?.reportInput)delete n.input;return n}function Lt(e){if(Array.isArray(e))return\"array\";if(typeof e===\"string\")return\"string\";return\"unknown\"}function Ho(e){let t=typeof e;switch(t){case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"object\":{if(e===null)return\"null\";if(Array.isArray(e))return\"array\";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&\"constructor\"in r&&r.constructor)return r.constructor.name}}return t}function _e(...e){let[t,r,n]=e;if(typeof t===\"string\")return{message:t,code:\"custom\",input:r,inst:n};return{...t}}var Jo=(e,t)=>{e.name=\"$ZodError\",Object.defineProperty(e,\"_zod\",{value:e._zod,enumerable:!1}),Object.defineProperty(e,\"issues\",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Xe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},Ct=f(\"$ZodError\",Jo),$r=f(\"$ZodError\",Jo,{Parent:Error});function Go(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Wo(e,t=(r)=>r.message){let r={_errors:[]},n=(o)=>{for(let i of o.issues)if(i.code===\"invalid_union\"&&i.errors.length)i.errors.map((s)=>n({issues:s}));else if(i.code===\"invalid_key\")n({issues:i.issues});else if(i.code===\"invalid_element\")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let c=i.path[a];if(a!==i.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i));s=s[c],a++}}};return n(e),r}var Nt=(e)=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new ie;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map((c)=>re(c,i,J())));throw Pr(a,o?.callee),a}return s.value};var Zt=(e)=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map((c)=>re(c,i,J())));throw Pr(a,o?.callee),a}return s.value};var et=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ie;return i.issues.length?{success:!1,error:new(e??Ct)(i.issues.map((s)=>re(s,o,J())))}:{success:!0,data:i.value}},Yo=et($r),tt=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>re(s,o,J())))}:{success:!0,data:i.value}},Xo=tt($r),Qo=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return Nt(e)(t,r,o)};var ei=(e)=>(t,r,n)=>Nt(e)(t,r,n);var ti=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return Zt(e)(t,r,o)};var ri=(e)=>async(t,r,n)=>Zt(e)(t,r,n);var ni=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return et(e)(t,r,o)};var oi=(e)=>(t,r,n)=>et(e)(t,r,n);var ii=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return tt(e)(t,r,o)};var si=(e)=>async(t,r,n)=>tt(e)(t,r,n);var ai=/^[cC][^\\s-]{8,}$/,ci=/^[0-9a-z]+$/,ui=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,li=/^[0-9a-vA-V]{20}$/,fi=/^[A-Za-z0-9]{27}$/,pi=/^[a-zA-Z0-9_-]{21}$/,di=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;var mi=/^([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})$/,Ir=(e)=>{if(!e)return/^([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)$/;return 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})$`)};var hi=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;var Yl=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\";function gi(){return new RegExp(Yl,\"u\")}var yi=/^(?:(?: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])$/,bi=/^(([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}|:))$/;var xi=/^((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])$/,_i=/^(([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])$/,vi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lr=/^[A-Za-z0-9_-]*$/;var Si=/^\\+[1-9]\\d{6,14}$/,wi=\"(?:(?:\\\\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])))\",Ti=new RegExp(`^${wi}$`);function Ei(e){return typeof e.precision===\"number\"?e.precision===-1?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d\":e.precision===0?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\":`(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?\"}function ki(e){return new RegExp(`^${Ei(e)}$`)}function Ai(e){let t=Ei({precision:e.precision}),r=[\"Z\"];if(e.local)r.push(\"\");if(e.offset)r.push(\"([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)\");let n=`${t}(?:${r.join(\"|\")})`;return new RegExp(`^${wi}T(?:${n})$`)}var Oi=(e)=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??\"\"}}`:\"[\\\\s\\\\S]*\";return new RegExp(`^${t}$`)},Pi=/^-?\\d+n?$/,Ri=/^-?\\d+$/,Cr=/^-?\\d+(?:\\.\\d+)?$/,zi=/^(?:true|false)$/i;var $i=/^[^A-Z]*$/,Ii=/^[^a-z]*$/;var U=f(\"$ZodCheck\",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Li={number:\"number\",bigint:\"bigint\",object:\"date\"},Nr=f(\"$ZodCheckLessThan\",(e,t)=>{U.init(e,t);let r=Li[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:\"too_big\",maximum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zr=f(\"$ZodCheckGreaterThan\",(e,t)=>{U.init(e,t);let r=Li[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:\"too_small\",minimum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ci=f(\"$ZodCheckMultipleOf\",(e,t)=>{U.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error(\"Cannot mix number and bigint in multiple_of check.\");if(typeof r.value===\"bigint\"?r.value%t.value===BigInt(0):Mo(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:\"not_multiple_of\",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ni=f(\"$ZodCheckNumberFormat\",(e,t)=>{U.init(e,t),t.format=t.format||\"float64\";let r=t.format?.includes(\"int\"),n=r?\"int\":\"number\",[o,i]=Ko[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=o,a.maximum=i,r)a.pattern=Ri}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:\"invalid_type\",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:\"too_big\",maximum:Number.MAX_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:\"too_small\",minimum:Number.MIN_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<o)s.issues.push({origin:\"number\",input:a,code:\"too_small\",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:\"number\",input:a,code:\"too_big\",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Zi=f(\"$ZodCheckMaxLength\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let s=Lt(o);n.issues.push({origin:s,code:\"too_big\",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Di=f(\"$ZodCheckMinLength\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let s=Lt(o);n.issues.push({origin:s,code:\"too_small\",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ui=f(\"$ZodCheckLengthEquals\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,i=o.length;if(i===t.length)return;let s=Lt(o),a=i>t.length;n.issues.push({origin:s,...a?{code:\"too_big\",maximum:t.length}:{code:\"too_small\",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),rt=f(\"$ZodCheckStringFormat\",(e,t)=>{var r,n;if(U.init(e,t),e._zod.onattach.push((o)=>{let i=o._zod.bag;if(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)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;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})});else(n=e._zod).check??(n.check=()=>{})}),ji=f(\"$ZodCheckRegex\",(e,t)=>{rt.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:\"string\",code:\"invalid_format\",format:\"regex\",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mi=f(\"$ZodCheckLowerCase\",(e,t)=>{t.pattern??(t.pattern=$i),rt.init(e,t)}),Fi=f(\"$ZodCheckUpperCase\",(e,t)=>{t.pattern??(t.pattern=Ii),rt.init(e,t)}),Bi=f(\"$ZodCheckIncludes\",(e,t)=>{U.init(e,t);let r=ue(t.includes),n=new RegExp(typeof t.position===\"number\"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:\"includes\",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Vi=f(\"$ZodCheckStartsWith\",(e,t)=>{U.init(e,t);let r=new RegExp(`^${ue(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"starts_with\",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),qi=f(\"$ZodCheckEndsWith\",(e,t)=>{U.init(e,t);let r=new RegExp(`.*${ue(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"ends_with\",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Ki=f(\"$ZodCheckOverwrite\",(e,t)=>{U.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Dr{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e===\"function\"){e(this,{execution:\"sync\"}),e(this,{execution:\"async\"});return}let r=e.split(`\n`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>\" \".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[\"\"]).map((o)=>` ${o}`)];return new e(...t,n.join(`\n`))}}var Ji={major:4,minor:3,patch:6};var O=f(\"$ZodType\",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ji;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has(\"$ZodCheck\"))n.unshift(e);for(let o of n)for(let 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{let o=(s,a,c)=>{let u=xe(s),l;for(let p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(u)continue;let d=s.issues.length,m=p._zod.check(s);if(m instanceof Promise&&c?.async===!1)throw new ie;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await m,s.issues.length===d)return;if(!u)u=xe(s,d)});else{if(s.issues.length===d)continue;if(!u)u=xe(s,d)}}if(l)return l.then(()=>s);return s},i=(s,a,c)=>{if(xe(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new ie;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction===\"backward\"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>i(l,s,a));return i(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new ie;return c.then((u)=>o(u,n,a))}return o(c,n,a)}}w(e,\"~standard\",()=>({validate:(o)=>{try{let i=Yo(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Xo(e,o).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:\"zod\",version:1}))}),Mt=f(\"$ZodString\",(e,t)=>{O.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Oi(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value===\"string\")return r;return r.issues.push({expected:\"string\",code:\"invalid_type\",input:r.value,inst:e}),r}}),z=f(\"$ZodStringFormat\",(e,t)=>{rt.init(e,t),Mt.init(e,t)}),ns=f(\"$ZodGUID\",(e,t)=>{t.pattern??(t.pattern=mi),z.init(e,t)}),os=f(\"$ZodUUID\",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: \"${t.version}\"`);t.pattern??(t.pattern=Ir(n))}else t.pattern??(t.pattern=Ir());z.init(e,t)}),is=f(\"$ZodEmail\",(e,t)=>{t.pattern??(t.pattern=hi),z.init(e,t)}),ss=f(\"$ZodURL\",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=new URL(n);if(t.hostname){if(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})}if(t.protocol){if(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})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort})}}}),as=f(\"$ZodEmoji\",(e,t)=>{t.pattern??(t.pattern=gi()),z.init(e,t)}),cs=f(\"$ZodNanoID\",(e,t)=>{t.pattern??(t.pattern=pi),z.init(e,t)}),us=f(\"$ZodCUID\",(e,t)=>{t.pattern??(t.pattern=ai),z.init(e,t)}),ls=f(\"$ZodCUID2\",(e,t)=>{t.pattern??(t.pattern=ci),z.init(e,t)}),fs=f(\"$ZodULID\",(e,t)=>{t.pattern??(t.pattern=ui),z.init(e,t)}),ps=f(\"$ZodXID\",(e,t)=>{t.pattern??(t.pattern=li),z.init(e,t)}),ds=f(\"$ZodKSUID\",(e,t)=>{t.pattern??(t.pattern=fi),z.init(e,t)}),ms=f(\"$ZodISODateTime\",(e,t)=>{t.pattern??(t.pattern=Ai(t)),z.init(e,t)}),hs=f(\"$ZodISODate\",(e,t)=>{t.pattern??(t.pattern=Ti),z.init(e,t)}),gs=f(\"$ZodISOTime\",(e,t)=>{t.pattern??(t.pattern=ki(t)),z.init(e,t)}),ys=f(\"$ZodISODuration\",(e,t)=>{t.pattern??(t.pattern=di),z.init(e,t)}),bs=f(\"$ZodIPv4\",(e,t)=>{t.pattern??(t.pattern=yi),z.init(e,t),e._zod.bag.format=\"ipv4\"}),xs=f(\"$ZodIPv6\",(e,t)=>{t.pattern??(t.pattern=bi),z.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})}}});var _s=f(\"$ZodCIDRv4\",(e,t)=>{t.pattern??(t.pattern=xi),z.init(e,t)}),vs=f(\"$ZodCIDRv6\",(e,t)=>{t.pattern??(t.pattern=_i),z.init(e,t),e._zod.check=(r)=>{let n=r.value.split(\"/\");try{if(n.length!==2)throw Error();let[o,i]=n;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:\"invalid_format\",format:\"cidrv6\",input:r.value,inst:e,continue:!t.abort})}}});function Ss(e){if(e===\"\")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ws=f(\"$ZodBase64\",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t),e._zod.bag.contentEncoding=\"base64\",e._zod.check=(r)=>{if(Ss(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64\",input:r.value,inst:e,continue:!t.abort})}});function Xl(e){if(!Lr.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n===\"-\"?\"+\":\"/\"),r=t.padEnd(Math.ceil(t.length/4)*4,\"=\");return Ss(r)}var Ts=f(\"$ZodBase64URL\",(e,t)=>{t.pattern??(t.pattern=Lr),z.init(e,t),e._zod.bag.contentEncoding=\"base64url\",e._zod.check=(r)=>{if(Xl(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64url\",input:r.value,inst:e,continue:!t.abort})}}),Es=f(\"$ZodE164\",(e,t)=>{t.pattern??(t.pattern=Si),z.init(e,t)});function Ql(e,t=null){try{let r=e.split(\".\");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if(\"typ\"in o&&o?.typ!==\"JWT\")return!1;if(!o.alg)return!1;if(t&&(!(\"alg\"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var ks=f(\"$ZodJWT\",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{if(Ql(r.value,t.alg))return;r.issues.push({code:\"invalid_format\",format:\"jwt\",input:r.value,inst:e,continue:!t.abort})}});var jr=f(\"$ZodNumber\",(e,t)=>{O.init(e,t),e._zod.pattern=e._zod.bag.pattern??Cr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o===\"number\"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o===\"number\"?Number.isNaN(o)?\"NaN\":!Number.isFinite(o)?\"Infinity\":void 0:void 0;return r.issues.push({expected:\"number\",code:\"invalid_type\",input:o,inst:e,...i?{received:i}:{}}),r}}),As=f(\"$ZodNumberFormat\",(e,t)=>{Ni.init(e,t),jr.init(e,t)}),Os=f(\"$ZodBoolean\",(e,t)=>{O.init(e,t),e._zod.pattern=zi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o===\"boolean\")return r;return r.issues.push({expected:\"boolean\",code:\"invalid_type\",input:o,inst:e}),r}}),Ps=f(\"$ZodBigInt\",(e,t)=>{O.init(e,t),e._zod.pattern=Pi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(o){}if(typeof r.value===\"bigint\")return r;return r.issues.push({expected:\"bigint\",code:\"invalid_type\",input:r.value,inst:e}),r}});var Rs=f(\"$ZodUnknown\",(e,t)=>{O.init(e,t),e._zod.parse=(r)=>r}),zs=f(\"$ZodNever\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:\"never\",code:\"invalid_type\",input:r.value,inst:e}),r)});var $s=f(\"$ZodDate\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:\"date\",code:\"invalid_type\",input:o,...i?{received:\"Invalid Date\"}:{},inst:e}),r}});function Gi(e,t,r){if(e.issues.length)t.issues.push(...le(r,e.issues));t.value[r]=e.value}var Is=f(\"$ZodArray\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let 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);let i=[];for(let s=0;s<o.length;s++){let a=o[s],c=t.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)i.push(c.then((u)=>Gi(u,r,s)));else Gi(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});function jt(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...le(r,e.issues))}if(e.value===void 0){if(r in n)t.value[r]=void 0}else t.value[r]=e.value}function Ls(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(\"$ZodType\"))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let r=qo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Cs(e,t,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout===\"optional\";for(let p in t){if(a.has(p))continue;if(u===\"never\"){s.push(p);continue}let d=c.run({value:t[p],issues:[]},n);if(d instanceof Promise)e.push(d.then((m)=>jt(m,r,p,t,l)));else jt(d,r,p,t,l)}if(s.length)r.issues.push({code:\"unrecognized_keys\",keys:s,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ef=f(\"$ZodObject\",(e,t)=>{if(O.init(e,t),!Object.getOwnPropertyDescriptor(t,\"shape\")?.get){let a=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let c={...a};return Object.defineProperty(t,\"shape\",{value:c}),c}})}let n=Qe(()=>Ls(t));w(e._zod,\"propValues\",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let o=Ce,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:\"object\",code:\"invalid_type\",input:u,inst:e}),a;a.value={};let l=[],p=s.shape;for(let d of s.keys){let m=p[d],g=m._zod.optout===\"optional\",h=m._zod.run({value:u[d],issues:[]},c);if(h instanceof Promise)l.push(h.then((v)=>jt(v,a,d,u,g)));else jt(h,a,d,u,g)}if(!i)return l.length?Promise.all(l).then(()=>a):a;return Cs(l,u,a,c,n.value,e)}}),Ns=f(\"$ZodObjectJIT\",(e,t)=>{ef.init(e,t);let r=e._zod.parse,n=Qe(()=>Ls(t)),o=(d)=>{let m=new Dr([\"shape\",\"payload\",\"ctx\"]),g=n.value,h=(b)=>{let E=Or(b);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};m.write(\"const input = payload.value;\");let v=Object.create(null),_=0;for(let b of g.keys)v[b]=`key_${_++}`;m.write(\"const newResult = {};\");for(let b of g.keys){let E=v[b],k=Or(b),x=d[b]?._zod?.optout===\"optional\";if(m.write(`const ${E} = ${h(b)};`),x)m.write(`\n if (${E}.issues.length) {\n if (${k} in input) {\n payload.issues = payload.issues.concat(${E}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n }\n \n if (${E}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${E}.value;\n }\n \n `);else m.write(`\n if (${E}.issues.length) {\n payload.issues = payload.issues.concat(${E}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n \n if (${E}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${E}.value;\n }\n \n `)}m.write(\"payload.value = newResult;\"),m.write(\"return payload;\");let A=m.compile();return(b,E)=>A(d,b,E)},i,s=Ce,a=!Pt.jitless,u=a&&Bo.value,l=t.catchall,p;e._zod.parse=(d,m)=>{p??(p=n.value);let g=d.value;if(!s(g))return d.issues.push({expected:\"object\",code:\"invalid_type\",input:g,inst:e}),d;if(a&&u&&m?.async===!1&&m.jitless!==!0){if(!i)i=o(t.shape);if(d=i(d,m),!l)return d;return Cs([],g,d,m,p,e)}return r(d,m)}});function Wi(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!xe(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:\"invalid_union\",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>re(s,n,J())))}),t}var Mr=f(\"$ZodUnion\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.options.some((o)=>o._zod.optin===\"optional\")?\"optional\":void 0),w(e._zod,\"optout\",()=>t.options.some((o)=>o._zod.optout===\"optional\")?\"optional\":void 0),w(e._zod,\"values\",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),w(e._zod,\"pattern\",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>It(i.source)).join(\"|\")})$`)}return});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!s)return Wi(a,o,e,i);return Promise.all(a).then((c)=>Wi(c,o,e,i))}});var Zs=f(\"$ZodDiscriminatedUnion\",(e,t)=>{t.inclusive=!1,Mr.init(e,t);let r=e._zod.parse;w(e._zod,\"propValues\",()=>{let o={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index \"${t.options.indexOf(i)}\"`);for(let[a,c]of Object.entries(s)){if(!o[a])o[a]=new Set;for(let u of c)o[a].add(u)}}return o});let n=Qe(()=>{let o=t.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index \"${t.options.indexOf(s)}\"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value \"${String(c)}\"`);i.set(c,s)}}return i});e._zod.parse=(o,i)=>{let s=o.value;if(!Ce(s))return o.issues.push({code:\"invalid_type\",expected:\"object\",input:s,inst:e}),o;let a=n.value.get(s?.[t.discriminator]);if(a)return a._zod.run(o,i);if(t.unionFallback)return r(o,i);return o.issues.push({code:\"invalid_union\",errors:[],note:\"No matching discriminator\",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o}}),Ds=f(\"$ZodIntersection\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>Yi(r,c,u));return Yi(r,i,s)}});function Ur(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(be(e)&&be(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let s=Ur(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Ur(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yi(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code===\"unrecognized_keys\"){o??(o=a);for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code===\"unrecognized_keys\")for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(a);let i=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o)e.issues.push({...o,keys:i});if(xe(e))return e;let s=Ur(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Us=f(\"$ZodRecord\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!be(o))return r.issues.push({expected:\"record\",code:\"invalid_type\",input:o,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u===\"string\"||typeof u===\"number\"||typeof u===\"symbol\"){a.add(typeof u===\"number\"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>{if(p.issues.length)r.issues.push(...le(u,p.issues));r.value[u]=p.value}));else{if(l.issues.length)r.issues.push(...le(u,l.issues));r.value[u]=l.value}}let c;for(let u in o)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:\"unrecognized_keys\",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a===\"__proto__\")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw Error(\"Async schemas not supported in object keys currently\");if(typeof a===\"string\"&&Cr.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},n);if(p instanceof Promise)throw Error(\"Async schemas not supported in object keys currently\");if(p.issues.length===0)c=p}if(c.issues.length){if(t.mode===\"loose\")r.value[a]=o[a];else r.issues.push({code:\"invalid_key\",origin:\"record\",issues:c.issues.map((p)=>re(p,n,J())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>{if(p.issues.length)r.issues.push(...le(a,p.issues));r.value[c.value]=p.value}));else{if(l.issues.length)r.issues.push(...le(a,l.issues));r.value[c.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}});var js=f(\"$ZodEnum\",(e,t)=>{O.init(e,t);let r=zt(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>Vo.has(typeof o)).map((o)=>typeof o===\"string\"?ue(o):o.toString()).join(\"|\")})$`),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:\"invalid_value\",values:r,input:s,inst:e}),o}}),Ms=f(\"$ZodLiteral\",(e,t)=>{if(O.init(e,t),t.values.length===0)throw Error(\"Cannot create literal schema with no valid values\");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n===\"string\"?ue(n):n?ue(n.toString()):String(n)).join(\"|\")})$`),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:\"invalid_value\",values:t.values,input:i,inst:e}),n}});var Fs=f(\"$ZodTransform\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Ye(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new ie;return r.value=o,r}});function Xi(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Fr=f(\"$ZodOptional\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",e._zod.optout=\"optional\",w(e._zod,\"values\",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),w(e._zod,\"pattern\",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${It(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin===\"optional\"){let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Xi(i,r.value));return Xi(o,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Bs=f(\"$ZodExactOptional\",(e,t)=>{Fr.init(e,t),w(e._zod,\"values\",()=>t.innerType._zod.values),w(e._zod,\"pattern\",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Vs=f(\"$ZodNullable\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.innerType._zod.optin),w(e._zod,\"optout\",()=>t.innerType._zod.optout),w(e._zod,\"pattern\",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${It(r.source)}|null)$`):void 0}),w(e._zod,\"values\",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),qs=f(\"$ZodDefault\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",w(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;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Qi(i,t));return Qi(o,t)}});function Qi(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ks=f(\"$ZodPrefault\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",w(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)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Hs=f(\"$ZodNonOptional\",(e,t)=>{O.init(e,t),w(e._zod,\"values\",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>es(i,e));return es(o,e)}});function es(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:e.value,inst:t});return e}var Js=f(\"$ZodCatch\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.innerType._zod.optin),w(e._zod,\"optout\",()=>t.innerType._zod.optout),w(e._zod,\"values\",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>re(s,n,J()))},input:r.value}),r.issues=[];return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((i)=>re(i,n,J()))},input:r.value}),r.issues=[];return r}});var Gs=f(\"$ZodPipe\",(e,t)=>{O.init(e,t),w(e._zod,\"values\",()=>t.in._zod.values),w(e._zod,\"optin\",()=>t.in._zod.optin),w(e._zod,\"optout\",()=>t.out._zod.optout),w(e._zod,\"propValues\",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction===\"backward\"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Ut(s,t.in,n));return Ut(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ut(i,t.out,n));return Ut(o,t.out,n)}});function Ut(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Ws=f(\"$ZodReadonly\",(e,t)=>{O.init(e,t),w(e._zod,\"propValues\",()=>t.innerType._zod.propValues),w(e._zod,\"values\",()=>t.innerType._zod.values),w(e._zod,\"optin\",()=>t.innerType?._zod?.optin),w(e._zod,\"optout\",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(ts);return ts(o)}});function ts(e){return e.value=Object.freeze(e.value),e}var Ys=f(\"$ZodCustom\",(e,t)=>{U.init(e,t),O.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>rs(i,r,n,e));rs(o,r,n,e);return}});function rs(e,t,r,n){if(!e){let o={code:\"custom\",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(_e(o))}}var tf=()=>{let e={string:{unit:\"characters\",verb:\"to have\"},file:{unit:\"bytes\",verb:\"to have\"},array:{unit:\"items\",verb:\"to have\"},set:{unit:\"items\",verb:\"to have\"},map:{unit:\"entries\",verb:\"to have\"}};function t(o){return e[o]??null}let r={regex:\"input\",email:\"email address\",url:\"URL\",emoji:\"emoji\",uuid:\"UUID\",uuidv4:\"UUIDv4\",uuidv6:\"UUIDv6\",nanoid:\"nanoid\",guid:\"GUID\",cuid:\"cuid\",cuid2:\"cuid2\",ulid:\"ULID\",xid:\"XID\",ksuid:\"KSUID\",datetime:\"ISO datetime\",date:\"ISO date\",time:\"ISO time\",duration:\"ISO duration\",ipv4:\"IPv4 address\",ipv6:\"IPv6 address\",mac:\"MAC address\",cidrv4:\"IPv4 range\",cidrv6:\"IPv6 range\",base64:\"base64-encoded string\",base64url:\"base64url-encoded string\",json_string:\"JSON string\",e164:\"E.164 number\",jwt:\"JWT\",template_literal:\"input\"},n={nan:\"NaN\"};return(o)=>{switch(o.code){case\"invalid_type\":{let i=n[o.expected]??o.expected,s=Ho(o.input),a=n[s]??s;return`Invalid input: expected ${i}, received ${a}`}case\"invalid_value\":if(o.values.length===1)return`Invalid input: expected ${zr(o.values[0])}`;return`Invalid option: expected one of ${Ar(o.values,\"|\")}`;case\"too_big\":{let i=o.inclusive?\"<=\":\"<\",s=t(o.origin);if(s)return`Too big: expected ${o.origin??\"value\"} to have ${i}${o.maximum.toString()} ${s.unit??\"elements\"}`;return`Too big: expected ${o.origin??\"value\"} to be ${i}${o.maximum.toString()}`}case\"too_small\":{let i=o.inclusive?\">=\":\">\",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case\"invalid_format\":{let i=o;if(i.format===\"starts_with\")return`Invalid string: must start with \"${i.prefix}\"`;if(i.format===\"ends_with\")return`Invalid string: must end with \"${i.suffix}\"`;if(i.format===\"includes\")return`Invalid string: must include \"${i.includes}\"`;if(i.format===\"regex\")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??o.format}`}case\"not_multiple_of\":return`Invalid number: must be a multiple of ${o.divisor}`;case\"unrecognized_keys\":return`Unrecognized key${o.keys.length>1?\"s\":\"\"}: ${Ar(o.keys,\", \")}`;case\"invalid_key\":return`Invalid key in ${o.origin}`;case\"invalid_union\":return\"Invalid input\";case\"invalid_element\":return`Invalid value in ${o.origin}`;default:return\"Invalid input\"}}};function Br(){return{localeError:tf()}}var Xs,jh=Symbol(\"ZodOutput\"),Mh=Symbol(\"ZodInput\");class Qs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r===\"object\"&&\"id\"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t===\"object\"&&\"id\"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function rf(){return new Qs}(Xs=globalThis).__zod_globalRegistry??(Xs.__zod_globalRegistry=rf());var ve=globalThis.__zod_globalRegistry;function ea(e,t){return new e({type:\"string\",...y(t)})}function ta(e,t){return new e({type:\"string\",coerce:!0,...y(t)})}function ra(e,t){return new e({type:\"string\",format:\"email\",check:\"string_format\",abort:!1,...y(t)})}function Vr(e,t){return new e({type:\"string\",format:\"guid\",check:\"string_format\",abort:!1,...y(t)})}function na(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,...y(t)})}function oa(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v4\",...y(t)})}function ia(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v6\",...y(t)})}function sa(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v7\",...y(t)})}function aa(e,t){return new e({type:\"string\",format:\"url\",check:\"string_format\",abort:!1,...y(t)})}function ca(e,t){return new e({type:\"string\",format:\"emoji\",check:\"string_format\",abort:!1,...y(t)})}function ua(e,t){return new e({type:\"string\",format:\"nanoid\",check:\"string_format\",abort:!1,...y(t)})}function la(e,t){return new e({type:\"string\",format:\"cuid\",check:\"string_format\",abort:!1,...y(t)})}function fa(e,t){return new e({type:\"string\",format:\"cuid2\",check:\"string_format\",abort:!1,...y(t)})}function pa(e,t){return new e({type:\"string\",format:\"ulid\",check:\"string_format\",abort:!1,...y(t)})}function da(e,t){return new e({type:\"string\",format:\"xid\",check:\"string_format\",abort:!1,...y(t)})}function ma(e,t){return new e({type:\"string\",format:\"ksuid\",check:\"string_format\",abort:!1,...y(t)})}function ha(e,t){return new e({type:\"string\",format:\"ipv4\",check:\"string_format\",abort:!1,...y(t)})}function ga(e,t){return new e({type:\"string\",format:\"ipv6\",check:\"string_format\",abort:!1,...y(t)})}function ya(e,t){return new e({type:\"string\",format:\"cidrv4\",check:\"string_format\",abort:!1,...y(t)})}function ba(e,t){return new e({type:\"string\",format:\"cidrv6\",check:\"string_format\",abort:!1,...y(t)})}function xa(e,t){return new e({type:\"string\",format:\"base64\",check:\"string_format\",abort:!1,...y(t)})}function _a(e,t){return new e({type:\"string\",format:\"base64url\",check:\"string_format\",abort:!1,...y(t)})}function va(e,t){return new e({type:\"string\",format:\"e164\",check:\"string_format\",abort:!1,...y(t)})}function Sa(e,t){return new e({type:\"string\",format:\"jwt\",check:\"string_format\",abort:!1,...y(t)})}function wa(e,t){return new e({type:\"string\",format:\"datetime\",check:\"string_format\",offset:!1,local:!1,precision:null,...y(t)})}function Ta(e,t){return new e({type:\"string\",format:\"date\",check:\"string_format\",...y(t)})}function Ea(e,t){return new e({type:\"string\",format:\"time\",check:\"string_format\",precision:null,...y(t)})}function ka(e,t){return new e({type:\"string\",format:\"duration\",check:\"string_format\",...y(t)})}function Aa(e,t){return new e({type:\"number\",checks:[],...y(t)})}function Oa(e,t){return new e({type:\"number\",coerce:!0,checks:[],...y(t)})}function Pa(e,t){return new e({type:\"number\",check:\"number_format\",abort:!1,format:\"safeint\",...y(t)})}function Ra(e,t){return new e({type:\"boolean\",...y(t)})}function za(e,t){return new e({type:\"boolean\",coerce:!0,...y(t)})}function $a(e,t){return new e({type:\"bigint\",coerce:!0,...y(t)})}function Ia(e){return new e({type:\"unknown\"})}function La(e,t){return new e({type:\"never\",...y(t)})}function Ca(e,t){return new e({type:\"date\",coerce:!0,...y(t)})}function Ne(e,t){return new Nr({check:\"less_than\",...y(t),value:e,inclusive:!1})}function ae(e,t){return new Nr({check:\"less_than\",...y(t),value:e,inclusive:!0})}function Ze(e,t){return new Zr({check:\"greater_than\",...y(t),value:e,inclusive:!1})}function Y(e,t){return new Zr({check:\"greater_than\",...y(t),value:e,inclusive:!0})}function nt(e,t){return new Ci({check:\"multiple_of\",...y(t),value:e})}function Ft(e,t){return new Zi({check:\"max_length\",...y(t),maximum:e})}function De(e,t){return new Di({check:\"min_length\",...y(t),minimum:e})}function Bt(e,t){return new Ui({check:\"length_equals\",...y(t),length:e})}function qr(e,t){return new ji({check:\"string_format\",format:\"regex\",...y(t),pattern:e})}function Kr(e){return new Mi({check:\"string_format\",format:\"lowercase\",...y(e)})}function Hr(e){return new Fi({check:\"string_format\",format:\"uppercase\",...y(e)})}function Jr(e,t){return new Bi({check:\"string_format\",format:\"includes\",...y(t),includes:e})}function Gr(e,t){return new Vi({check:\"string_format\",format:\"starts_with\",...y(t),prefix:e})}function Wr(e,t){return new qi({check:\"string_format\",format:\"ends_with\",...y(t),suffix:e})}function fe(e){return new Ki({check:\"overwrite\",tx:e})}function Yr(e){return fe((t)=>t.normalize(e))}function Xr(){return fe((e)=>e.trim())}function Qr(){return fe((e)=>e.toLowerCase())}function en(){return fe((e)=>e.toUpperCase())}function tn(){return fe((e)=>Fo(e))}function Na(e,t,r){return new e({type:\"array\",element:t,...y(r)})}function Za(e,t,r){return new e({type:\"custom\",check:\"custom\",fn:t,...y(r)})}function Da(e){let t=nf((r)=>(r.addIssue=(n)=>{if(typeof n===\"string\")r.issues.push(_e(n,r.value,t._zod.def));else{let o=n;if(o.fatal)o.continue=!1;o.code??(o.code=\"custom\"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(_e(o))}},e(r.value,r)));return t}function nf(e,t){let r=new U({check:\"custom\",...y(t)});return r._zod.check=e,r}function rn(e){let t=e?.target??\"draft-2020-12\";if(t===\"draft-4\")t=\"draft-04\";if(t===\"draft-7\")t=\"draft-07\";return{processors:e.processors??{},metadataRegistry:e?.metadata??ve,target:t,unrepresentable:e?.unrepresentable??\"throw\",override:e?.override??(()=>{}),io:e?.io??\"output\",counter:0,seen:new Map,cycles:e?.cycles??\"ref\",reused:e?.reused??\"inline\",external:e?.external??void 0}}function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,l),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(s.schema,c);if(t.io===\"input\"&&F(e))delete s.schema.examples,delete s.schema.default;if(t.io===\"input\"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function nn(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id \"${a}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=(s)=>{let a=e.target===\"draft-2020-12\"?\"$defs\":\"definitions\";if(e.external){let p=e.external.registry.get(s[0])?.id,d=e.external.uri??((g)=>g);if(p)return{ref:d(p)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d(\"__shared\")}#/${a}/${m}`}}if(s[1]===r)return{ref:\"#\"};let u=`${\"#\"}/${a}/`,l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles===\"throw\")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join(\"/\")}/<root>\n\nSet the \\`cycles\\` parameter to \\`\"ref\"\\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused===\"ref\"){i(s);continue}}}}function on(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=(s)=>{let a=e.seen.get(s);if(a.ref===null)return;let c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);let d=e.seen.get(l),m=d.schema;if(m.$ref&&(e.target===\"draft-07\"||e.target===\"draft-04\"||e.target===\"openapi-3.0\"))c.allOf=c.allOf??[],c.allOf.push(m);else Object.assign(c,m);if(Object.assign(c,u),s._zod.parent===l)for(let h in c){if(h===\"$ref\"||h===\"allOf\")continue;if(!(h in u))delete c[h]}if(m.$ref&&d.def)for(let h in c){if(h===\"$ref\"||h===\"allOf\")continue;if(h in d.def&&JSON.stringify(c[h])===JSON.stringify(d.def[h]))delete c[h]}}let p=s._zod.parent;if(p&&p!==l){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(c.$ref=d.schema.$ref,d.def)for(let m in c){if(m===\"$ref\"||m===\"allOf\")continue;if(m in d.def&&JSON.stringify(c[m])===JSON.stringify(d.def[m]))delete c[m]}}}e.override({zodSchema:s,jsonSchema:c,path:a.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let o={};if(e.target===\"draft-2020-12\")o.$schema=\"https://json-schema.org/draft/2020-12/schema\";else if(e.target===\"draft-07\")o.$schema=\"http://json-schema.org/draft-07/schema#\";else if(e.target===\"draft-04\")o.$schema=\"http://json-schema.org/draft-04/schema#\";else if(e.target===\"openapi-3.0\");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error(\"Schema is missing an `id` property\");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let s of e.seen.entries()){let a=s[1];if(a.def&&a.defId)i[a.defId]=a.def}if(e.external);else if(Object.keys(i).length>0)if(e.target===\"draft-2020-12\")o.$defs=i;else o.definitions=i;try{let s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,\"~standard\",{value:{...t[\"~standard\"],jsonSchema:{input:ot(t,\"input\",e.processors),output:ot(t,\"output\",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error(\"Error converting schema to JSON.\")}}function F(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type===\"transform\")return!0;if(n.type===\"array\")return F(n.element,r);if(n.type===\"set\")return F(n.valueType,r);if(n.type===\"lazy\")return F(n.getter(),r);if(n.type===\"promise\"||n.type===\"optional\"||n.type===\"nonoptional\"||n.type===\"nullable\"||n.type===\"readonly\"||n.type===\"default\"||n.type===\"prefault\")return F(n.innerType,r);if(n.type===\"intersection\")return F(n.left,r)||F(n.right,r);if(n.type===\"record\"||n.type===\"map\")return F(n.keyType,r)||F(n.valueType,r);if(n.type===\"pipe\")return F(n.in,r)||F(n.out,r);if(n.type===\"object\"){for(let o in n.shape)if(F(n.shape[o],r))return!0;return!1}if(n.type===\"union\"){for(let o of n.options)if(F(o,r))return!0;return!1}if(n.type===\"tuple\"){for(let o of n.items)if(F(o,r))return!0;if(n.rest&&F(n.rest,r))return!0;return!1}return!1}var Ua=(e,t={})=>(r)=>{let n=rn({...r,processors:t});return D(e,n),nn(n,e),on(n,e)},ot=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=rn({...o??{},target:i,io:t,processors:r});return D(e,s),nn(s,e),on(s,e)};var of={guid:\"uuid\",url:\"uri\",datetime:\"date-time\",json_string:\"json-string\",regex:\"\"},ja=(e,t,r,n)=>{let o=r;o.type=\"string\";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i===\"number\")o.minLength=i;if(typeof s===\"number\")o.maxLength=s;if(a){if(o.format=of[a]??a,o.format===\"\")delete o.format;if(a===\"time\")delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)o.pattern=l[0].source;else if(l.length>1)o.allOf=[...l.map((p)=>({...t.target===\"draft-07\"||t.target===\"draft-04\"||t.target===\"openapi-3.0\"?{type:\"string\"}:{},pattern:p.source}))]}},Ma=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a===\"string\"&&a.includes(\"int\"))o.type=\"integer\";else o.type=\"number\";if(typeof l===\"number\")if(t.target===\"draft-04\"||t.target===\"openapi-3.0\")o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;if(typeof i===\"number\"){if(o.minimum=i,typeof l===\"number\"&&t.target!==\"draft-04\")if(l>=i)delete o.minimum;else delete o.exclusiveMinimum}if(typeof u===\"number\")if(t.target===\"draft-04\"||t.target===\"openapi-3.0\")o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;if(typeof s===\"number\"){if(o.maximum=s,typeof u===\"number\"&&t.target!==\"draft-04\")if(u<=s)delete o.maximum;else delete o.exclusiveMaximum}if(typeof c===\"number\")o.multipleOf=c},Fa=(e,t,r,n)=>{r.type=\"boolean\"},Ba=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"BigInt cannot be represented in JSON Schema\")};var Va=(e,t,r,n)=>{r.not={}};var qa=(e,t,r,n)=>{},Ka=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Date cannot be represented in JSON Schema\")},Ha=(e,t,r,n)=>{let o=e._zod.def,i=zt(o.entries);if(i.every((s)=>typeof s===\"number\"))r.type=\"number\";if(i.every((s)=>typeof s===\"string\"))r.type=\"string\";r.enum=i},Ja=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let s of o.values)if(s===void 0){if(t.unrepresentable===\"throw\")throw Error(\"Literal `undefined` cannot be represented in JSON Schema\")}else if(typeof s===\"bigint\")if(t.unrepresentable===\"throw\")throw Error(\"BigInt literals cannot be represented in JSON Schema\");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?\"null\":typeof s,t.target===\"draft-04\"||t.target===\"openapi-3.0\")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s===\"number\"))r.type=\"number\";if(i.every((s)=>typeof s===\"string\"))r.type=\"string\";if(i.every((s)=>typeof s===\"boolean\"))r.type=\"boolean\";if(i.every((s)=>s===null))r.type=\"null\";r.enum=i}};var Ga=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Custom types cannot be represented in JSON Schema\")};var Wa=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Transforms cannot be represented in JSON Schema\")};var Ya=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s===\"number\")o.minItems=s;if(typeof a===\"number\")o.maxItems=a;o.type=\"array\",o.items=D(i.element,t,{...n,path:[...n.path,\"items\"]})},Xa=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type=\"object\",o.properties={};let s=i.shape;for(let u in s)o.properties[u]=D(s[u],t,{...n,path:[...n.path,\"properties\",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter((u)=>{let l=i.shape[u]._zod;if(t.io===\"input\")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(i.catchall?._zod.def.type===\"never\")o.additionalProperties=!1;else if(!i.catchall){if(t.io===\"output\")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,\"additionalProperties\"]})},Qa=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...n,path:[...n.path,i?\"oneOf\":\"anyOf\",c]}));if(i)r.oneOf=s;else r.anyOf=s},ec=(e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,\"allOf\",0]}),s=D(o.right,t,{...n,path:[...n.path,\"allOf\",1]}),a=(u)=>(\"allOf\"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c};var tc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type=\"object\";let s=i.keyType,c=s._zod.bag?.patterns;if(i.mode===\"loose\"&&c&&c.size>0){let l=D(i.valueType,t,{...n,path:[...n.path,\"patternProperties\",\"*\"]});o.patternProperties={};for(let p of c)o.patternProperties[p.source]=l}else{if(t.target===\"draft-07\"||t.target===\"draft-2020-12\")o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,\"propertyNames\"]});o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,\"additionalProperties\"]})}let u=s._zod.values;if(u){let l=[...u].filter((p)=>typeof p===\"string\"||typeof p===\"number\");if(l.length>0)o.required=l}},rc=(e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),s=t.seen.get(e);if(t.target===\"openapi-3.0\")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:\"null\"}]},nc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},oc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ic=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io===\"input\")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},sc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw Error(\"Dynamic catch values are not supported in JSON Schema\")}r.default=s},ac=(e,t,r,n)=>{let o=e._zod.def,i=t.io===\"input\"?o.in._zod.def.type===\"transform\"?o.out:o.in:o.out;D(i,t,n);let s=t.seen.get(e);s.ref=i},cc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var sn=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var df=f(\"ZodISODateTime\",(e,t)=>{ms.init(e,t),L.init(e,t)});function uc(e){return wa(df,e)}var mf=f(\"ZodISODate\",(e,t)=>{hs.init(e,t),L.init(e,t)});function lc(e){return Ta(mf,e)}var hf=f(\"ZodISOTime\",(e,t)=>{gs.init(e,t),L.init(e,t)});function fc(e){return Ea(hf,e)}var gf=f(\"ZodISODuration\",(e,t)=>{ys.init(e,t),L.init(e,t)});function pc(e){return ka(gf,e)}var hc=(e,t)=>{Ct.init(e,t),e.name=\"ZodError\",Object.defineProperties(e,{format:{value:(r)=>Wo(e,r)},flatten:{value:(r)=>Go(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Xe,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Xe,2)}},isEmpty:{get(){return e.issues.length===0}}})},yg=f(\"ZodError\",hc),K=f(\"ZodError\",hc,{Parent:Error});var gc=Nt(K),yc=Zt(K),bc=et(K),xc=tt(K),_c=Qo(K),vc=ei(K),Sc=ti(K),wc=ri(K),Tc=ni(K),Ec=oi(K),kc=ii(K),Ac=si(K);var I=f(\"ZodType\",(e,t)=>(O.init(e,t),Object.assign(e[\"~standard\"],{jsonSchema:{input:ot(e,\"input\"),output:ot(e,\"output\")}}),e.toJSONSchema=Ua(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,\"_def\",{value:t}),e.check=(...r)=>e.clone(ce(t,{checks:[...t.checks??[],...r.map((n)=>typeof n===\"function\"?{_zod:{check:n,def:{check:\"custom\"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>te(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>gc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>bc(e,r,n),e.parseAsync=async(r,n)=>yc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>xc(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_c(e,r,n),e.decode=(r,n)=>vc(e,r,n),e.encodeAsync=async(r,n)=>Sc(e,r,n),e.decodeAsync=async(r,n)=>wc(e,r,n),e.safeEncode=(r,n)=>Tc(e,r,n),e.safeDecode=(r,n)=>Ec(e,r,n),e.safeEncodeAsync=async(r,n)=>kc(e,r,n),e.safeDecodeAsync=async(r,n)=>Ac(e,r,n),e.refine=(r,n)=>e.check(fp(r,n)),e.superRefine=(r)=>e.check(pp(r)),e.overwrite=(r)=>e.check(fe(r)),e.optional=()=>Rc(e),e.exactOptional=()=>Xf(e),e.nullable=()=>zc(e),e.nullish=()=>Rc(zc(e)),e.nonoptional=(r)=>op(e,r),e.array=()=>je(e),e.or=(r)=>Mf([e,r]),e.and=(r)=>qf(e,r),e.transform=(r)=>$c(e,Wf(r)),e.default=(r)=>tp(e,r),e.prefault=(r)=>np(e,r),e.catch=(r)=>sp(e,r),e.pipe=(r)=>$c(e,r),e.readonly=()=>up(e),e.describe=(r)=>{let n=e.clone();return ve.add(n,{description:r}),n},Object.defineProperty(e,\"description\",{get(){return ve.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ve.get(e);let n=e.clone();return ve.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),Ic=f(\"_ZodString\",(e,t)=>{Mt.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ja(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(qr(...n)),e.includes=(...n)=>e.check(Jr(...n)),e.startsWith=(...n)=>e.check(Gr(...n)),e.endsWith=(...n)=>e.check(Wr(...n)),e.min=(...n)=>e.check(De(...n)),e.max=(...n)=>e.check(Ft(...n)),e.length=(...n)=>e.check(Bt(...n)),e.nonempty=(...n)=>e.check(De(1,...n)),e.lowercase=(n)=>e.check(Kr(n)),e.uppercase=(n)=>e.check(Hr(n)),e.trim=()=>e.check(Xr()),e.normalize=(...n)=>e.check(Yr(...n)),e.toLowerCase=()=>e.check(Qr()),e.toUpperCase=()=>e.check(en()),e.slugify=()=>e.check(tn())}),un=f(\"ZodString\",(e,t)=>{Mt.init(e,t),Ic.init(e,t),e.email=(r)=>e.check(ra(bf,r)),e.url=(r)=>e.check(aa(xf,r)),e.jwt=(r)=>e.check(Sa(Lf,r)),e.emoji=(r)=>e.check(ca(_f,r)),e.guid=(r)=>e.check(Vr(Oc,r)),e.uuid=(r)=>e.check(na(Vt,r)),e.uuidv4=(r)=>e.check(oa(Vt,r)),e.uuidv6=(r)=>e.check(ia(Vt,r)),e.uuidv7=(r)=>e.check(sa(Vt,r)),e.nanoid=(r)=>e.check(ua(vf,r)),e.guid=(r)=>e.check(Vr(Oc,r)),e.cuid=(r)=>e.check(la(Sf,r)),e.cuid2=(r)=>e.check(fa(wf,r)),e.ulid=(r)=>e.check(pa(Tf,r)),e.base64=(r)=>e.check(xa(zf,r)),e.base64url=(r)=>e.check(_a($f,r)),e.xid=(r)=>e.check(da(Ef,r)),e.ksuid=(r)=>e.check(ma(kf,r)),e.ipv4=(r)=>e.check(ha(Af,r)),e.ipv6=(r)=>e.check(ga(Of,r)),e.cidrv4=(r)=>e.check(ya(Pf,r)),e.cidrv6=(r)=>e.check(ba(Rf,r)),e.e164=(r)=>e.check(va(If,r)),e.datetime=(r)=>e.check(uc(r)),e.date=(r)=>e.check(lc(r)),e.time=(r)=>e.check(fc(r)),e.duration=(r)=>e.check(pc(r))});function P(e){return ea(un,e)}var L=f(\"ZodStringFormat\",(e,t)=>{z.init(e,t),Ic.init(e,t)}),bf=f(\"ZodEmail\",(e,t)=>{is.init(e,t),L.init(e,t)});var Oc=f(\"ZodGUID\",(e,t)=>{ns.init(e,t),L.init(e,t)});var Vt=f(\"ZodUUID\",(e,t)=>{os.init(e,t),L.init(e,t)});var xf=f(\"ZodURL\",(e,t)=>{ss.init(e,t),L.init(e,t)});var _f=f(\"ZodEmoji\",(e,t)=>{as.init(e,t),L.init(e,t)});var vf=f(\"ZodNanoID\",(e,t)=>{cs.init(e,t),L.init(e,t)});var Sf=f(\"ZodCUID\",(e,t)=>{us.init(e,t),L.init(e,t)});var wf=f(\"ZodCUID2\",(e,t)=>{ls.init(e,t),L.init(e,t)});var Tf=f(\"ZodULID\",(e,t)=>{fs.init(e,t),L.init(e,t)});var Ef=f(\"ZodXID\",(e,t)=>{ps.init(e,t),L.init(e,t)});var kf=f(\"ZodKSUID\",(e,t)=>{ds.init(e,t),L.init(e,t)});var Af=f(\"ZodIPv4\",(e,t)=>{bs.init(e,t),L.init(e,t)});var Of=f(\"ZodIPv6\",(e,t)=>{xs.init(e,t),L.init(e,t)});var Pf=f(\"ZodCIDRv4\",(e,t)=>{_s.init(e,t),L.init(e,t)});var Rf=f(\"ZodCIDRv6\",(e,t)=>{vs.init(e,t),L.init(e,t)});var zf=f(\"ZodBase64\",(e,t)=>{ws.init(e,t),L.init(e,t)});var $f=f(\"ZodBase64URL\",(e,t)=>{Ts.init(e,t),L.init(e,t)});var If=f(\"ZodE164\",(e,t)=>{Es.init(e,t),L.init(e,t)});var Lf=f(\"ZodJWT\",(e,t)=>{ks.init(e,t),L.init(e,t)});var qt=f(\"ZodNumber\",(e,t)=>{jr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ma(e,n,o,i),e.gt=(n,o)=>e.check(Ze(n,o)),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.lt=(n,o)=>e.check(Ne(n,o)),e.lte=(n,o)=>e.check(ae(n,o)),e.max=(n,o)=>e.check(ae(n,o)),e.int=(n)=>e.check(Pc(n)),e.safe=(n)=>e.check(Pc(n)),e.positive=(n)=>e.check(Ze(0,n)),e.nonnegative=(n)=>e.check(Y(0,n)),e.negative=(n)=>e.check(Ne(0,n)),e.nonpositive=(n)=>e.check(ae(0,n)),e.multipleOf=(n,o)=>e.check(nt(n,o)),e.step=(n,o)=>e.check(nt(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??\"\").includes(\"int\")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function Lc(e){return Aa(qt,e)}var Cf=f(\"ZodNumberFormat\",(e,t)=>{As.init(e,t),qt.init(e,t)});function Pc(e){return Pa(Cf,e)}var ln=f(\"ZodBoolean\",(e,t)=>{Os.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fa(e,r,n,o)});function it(e){return Ra(ln,e)}var Cc=f(\"ZodBigInt\",(e,t)=>{Ps.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ba(e,n,o,i),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.gt=(n,o)=>e.check(Ze(n,o)),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.lt=(n,o)=>e.check(Ne(n,o)),e.lte=(n,o)=>e.check(ae(n,o)),e.max=(n,o)=>e.check(ae(n,o)),e.positive=(n)=>e.check(Ze(BigInt(0),n)),e.negative=(n)=>e.check(Ne(BigInt(0),n)),e.nonpositive=(n)=>e.check(ae(BigInt(0),n)),e.nonnegative=(n)=>e.check(Y(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(nt(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Nf=f(\"ZodUnknown\",(e,t)=>{Rs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qa(e,r,n,o)});function an(){return Ia(Nf)}var Zf=f(\"ZodNever\",(e,t)=>{zs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Va(e,r,n,o)});function Df(e){return La(Zf,e)}var Nc=f(\"ZodDate\",(e,t)=>{$s.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ka(e,n,o,i),e.min=(n,o)=>e.check(Y(n,o)),e.max=(n,o)=>e.check(ae(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Uf=f(\"ZodArray\",(e,t)=>{Is.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ya(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(De(r,n)),e.nonempty=(r)=>e.check(De(1,r)),e.max=(r,n)=>e.check(Ft(r,n)),e.length=(r,n)=>e.check(Bt(r,n)),e.unwrap=()=>e.element});function je(e,t){return Na(Uf,e,t)}var jf=f(\"ZodObject\",(e,t)=>{Ns.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xa(e,r,n,o),w(e,\"shape\",()=>t.shape),e.keyof=()=>fn(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:an()}),e.loose=()=>e.clone({...e._zod.def,catchall:an()}),e.strict=()=>e.clone({...e._zod.def,catchall:Df()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>ql(e,r),e.safeExtend=(r)=>Kl(e,r),e.merge=(r)=>Hl(e,r),e.pick=(r)=>Bl(e,r),e.omit=(r)=>Vl(e,r),e.partial=(...r)=>Jl(Dc,e,r[0]),e.required=(...r)=>Gl(Uc,e,r[0])});function C(e,t){let r={type:\"object\",shape:e??{},...y(t)};return new jf(r)}var Zc=f(\"ZodUnion\",(e,t)=>{Mr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qa(e,r,n,o),e.options=t.options});function Mf(e,t){return new Zc({type:\"union\",options:e,...y(t)})}var Ff=f(\"ZodDiscriminatedUnion\",(e,t)=>{Zc.init(e,t),Zs.init(e,t)});function Bf(e,t,r){return new Ff({type:\"union\",options:t,discriminator:e,...y(r)})}var Vf=f(\"ZodIntersection\",(e,t)=>{Ds.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ec(e,r,n,o)});function qf(e,t){return new Vf({type:\"intersection\",left:e,right:t})}var Kf=f(\"ZodRecord\",(e,t)=>{Us.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Hf(e,t,r){return new Kf({type:\"record\",keyType:e,valueType:t,...y(r)})}var cn=f(\"ZodEnum\",(e,t)=>{js.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ha(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new cn({...t,checks:[],...y(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new cn({...t,checks:[],...y(o),entries:i})}});function fn(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new cn({type:\"enum\",entries:r,...y(t)})}var Jf=f(\"ZodLiteral\",(e,t)=>{Ms.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ja(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,\"value\",{get(){if(t.values.length>1)throw Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");return t.values[0]}})});function pe(e,t){return new Jf({type:\"literal\",values:Array.isArray(e)?e:[e],...y(t)})}var Gf=f(\"ZodTransform\",(e,t)=>{Fs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Ye(e.constructor.name);r.addIssue=(i)=>{if(typeof i===\"string\")r.issues.push(_e(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code=\"custom\"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(_e(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Wf(e){return new Gf({type:\"transform\",transform:e})}var Dc=f(\"ZodOptional\",(e,t)=>{Fr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rc(e){return new Dc({type:\"optional\",innerType:e})}var Yf=f(\"ZodExactOptional\",(e,t)=>{Bs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xf(e){return new Yf({type:\"optional\",innerType:e})}var Qf=f(\"ZodNullable\",(e,t)=>{Vs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zc(e){return new Qf({type:\"nullable\",innerType:e})}var ep=f(\"ZodDefault\",(e,t)=>{qs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tp(e,t){return new ep({type:\"default\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():Rr(t)}})}var rp=f(\"ZodPrefault\",(e,t)=>{Ks.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ic(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function np(e,t){return new rp({type:\"prefault\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():Rr(t)}})}var Uc=f(\"ZodNonOptional\",(e,t)=>{Hs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function op(e,t){return new Uc({type:\"nonoptional\",innerType:e,...y(t)})}var ip=f(\"ZodCatch\",(e,t)=>{Js.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sp(e,t){return new ip({type:\"catch\",innerType:e,catchValue:typeof t===\"function\"?t:()=>t})}var ap=f(\"ZodPipe\",(e,t)=>{Gs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ac(e,r,n,o),e.in=t.in,e.out=t.out});function $c(e,t){return new ap({type:\"pipe\",in:e,out:t})}var cp=f(\"ZodReadonly\",(e,t)=>{Ws.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function up(e){return new cp({type:\"readonly\",innerType:e})}var lp=f(\"ZodCustom\",(e,t)=>{Ys.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ga(e,r,n,o)});function fp(e,t={}){return Za(lp,e,t)}function pp(e){return Da(e)}var Kt={};Gn(Kt,{bigint:()=>gp,boolean:()=>hp,date:()=>yp,number:()=>mp,string:()=>dp});function dp(e){return ta(un,e)}function mp(e){return Oa(qt,e)}function hp(e){return za(ln,e)}function gp(e){return $a(Cc,e)}function yp(e){return Ca(Nc,e)}J(Br());var B=P().trim().min(1),de=P().regex(/^#(?:[\\da-f]{3}|[\\da-f]{6}|[\\da-f]{8})$/i,\"Expected a hex color.\"),st={icon:{light:\"@dbx-tools/ui/branding/assets/icon-light.svg\",dark:\"@dbx-tools/ui/branding/assets/icon-dark.svg\"},logo:{light:\"@dbx-tools/ui/branding/assets/logo-light.svg\",dark:\"@dbx-tools/ui/branding/assets/logo-dark.svg\"},favicon:\"@dbx-tools/ui/branding/assets/icon-light.svg\"},pn=C({light:B.describe(\"Asset for light surfaces.\"),dark:B.optional().describe(\"Asset for dark surfaces; light is the fallback.\")}).strict().describe(\"Theme-aware references to one visual asset.\"),jc=C({primary:de.default(\"#1B3139\").describe(\"Primary action and identity color.\"),primaryHover:de.default(\"#0E538B\").describe(\"Primary hover or pressed color.\"),accent:de.default(\"#00A972\").describe(\"Secondary accent color.\"),foreground:de.default(\"#1B3139\").describe(\"Default text and mark color.\"),background:de.default(\"#FFFFFF\").describe(\"Default page background.\"),surface:de.default(\"#F9F7F4\").describe(\"Secondary surface background.\"),muted:de.default(\"#618794\").describe(\"Muted text color.\"),border:de.default(\"#E4E2DD\").describe(\"Default border color.\")}).strict().prefault({}),Mc=C({audience:je(B).default([\"Databricks developers\",\"application engineers\",\"AI agents\"]),tone:je(B).default([\"direct\",\"practical\",\"technical\",\"approachable\"]),principles:je(B).default([\"Lead with the useful outcome.\",\"Prefer concrete examples and accurate technical language.\",\"Keep product claims specific and defensible.\"]),avoid:je(B).default([\"unsupported superlatives\",\"vague AI claims\",\"unnecessary jargon\"])}).strict().prefault({}),Fc=C({schemaVersion:pe(\"1\").default(\"1\"),name:B.default(\"dbx tools\").describe(\"Canonical display name.\"),shortName:B.default(\"dbx\").describe(\"Compact name for constrained UI.\"),tagline:B.optional().describe(\"Optional product line suitable for a header or metadata.\"),description:B.default(\"Companion packages for Databricks developers building apps, agents, data workflows, and reusable UI.\").describe(\"Plain-language product description.\"),assets:C({icon:pn.default(st.icon),logo:pn.default(st.logo),favicon:B.default(st.favicon)}).strict().default(st),colors:jc,typography:C({sans:B.default(\"'DM Sans', ui-sans-serif, system-ui, sans-serif\"),mono:B.default(\"'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace\")}).strict().prefault({}),voice:Mc,links:C({website:P().url().default(\"https://dbx.tools\"),repository:P().url().optional(),documentation:P().url().default(\"https://docs.dbx.tools/\")}).strict().prefault({}),extensions:Hf(B,an()).default({}).describe(\"Namespaced consumer-specific values that do not belong in the portable core.\")}).strict().describe(\"Portable identity, visual, and voice context for UI, libraries, and LLMs.\");function Bc(e={}){return Fc.parse(e)}var bp=Bc({tagline:\"Practical tools for Databricks builders.\"});var _p=new URL(\"http://localhost\");var vp=/^([A-Za-z][A-Za-z0-9+.-]*:\\/\\/)/,Sp=/^\\/+|\\/+$/g;var at=65535;class Ht extends URL{constructor(e){super(e)}get scheme(){return this.protocol.slice(0,-1)}set scheme(e){this.protocol=e+\":\"}with(e,t){let r=new Ht(this);return r[e]=t,new Ht(r)}withPathAppend(...e){return this.withPathReplace(this.pathname,...e)}withPathReplace(...e){let r=[...e].flatMap((n)=>Array.isArray(n)?n:[n]).map((n)=>n.replace(Sp,\"\")).filter(Boolean).join(\"/\");return this.with(\"pathname\",\"/\"+r)}pathMatches(e){let t=this.pathname;if(t==e)return!0;if(!e.startsWith(\"/\"))e=\"/\"+e;if(t==e)return!0;return t.startsWith(e+\"/\")}}function we(e){if(e instanceof URL)return new Ht(e);if(e!==null&&typeof e===\"object\"&&\"url\"in e)e=e.url;if(typeof e===\"string\")e=e.trim();if(e)if(e.startsWith(\"/\")||e.startsWith(\"?\")||e.startsWith(\"#\")){let r=dn().toString().slice(0,-1)+e;return we(r)}else if(e.startsWith(\"://\"))e=`https${e}`;else{let n=e.match(vp)?.[1];if(n){let o=e.slice(n.length);e=`${n}${o||dn().hostname}`}else e=`https://${e}`}else return we(dn());let t=Vc(e);return t?we(t):void 0}function dn(){let e=globalThis.window?.location?.origin;if(e&&e!==\"null\"){let t=Vc(e);if(t)return t}return new URL(_p)}function Vc(e){if(e&&e.includes(\"://\"))try{return new URL(e)}catch{}return null}var Ap=/[vV][0-9]+|[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g,Op=/[a-zA-Z0-9]+/g,Pp=[(e,t)=>{if(!t.capitalize)return e;let r=e.toLowerCase();if(r===\"ai\")return\"AI\";if(r===\"fs\")return\"FS\";return e},(e,t)=>{if(t.capitalize&&/^v[0-9]+$/.test(e))return`V${e.slice(1)}`;return e}],Rp=/^([a-zA-Z][a-zA-Z0-9+.-]*)?:\\/\\/([^\\s/?#][^\\s]*)?$/,zp=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)@([a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)+)$/,qc={distinct:!1,lowerCase:!1,capitalize:!1,omitUriScheme:!1,omitEmailDomain:!1,camelCase:!0},Zy={...qc,lowerCase:!0,maxLength:1/0,truncateStrategy:\"hash\",truncateHashLength:6,delimiter:\"-\"};function*mn(e,...t){let r={...qc,...e},n=r.distinct?new Set:void 0,o=r.camelCase?Ap:Op;for(let i of t){if(i==null)continue;let s=typeof i===\"string\"?i:String(i);if(!s)continue;if(r.omitUriScheme){let a=s.match(Rp);if(a)s=a[2]??\"\"}if(r.omitEmailDomain){let a=s.match(zp);if(a)s=a[1]??\"\"}if(!s)continue;for(let a of s.matchAll(o)){let c=a[0];if(r.lowerCase)c=c.toLowerCase();if(r.capitalize)c=Kc(c);if(!c)continue;for(let u of Pp)if(c=u(c,r),!c)break;if(!c||n?.has(c))continue;n?.add(c),yield c}}}function Jt(e){if(typeof e!==\"string\")return null;let t=e.trim();return t?t:null}function hn(e,t){let r=[...mn({lowerCase:!0,capitalize:!0,...t},e)];return r.length>0?r.join(\" \"):e}function Kc(e){return e?e.charAt(0).toUpperCase()+e.slice(1):e}var V=(e,t)=>pe(e).default(e).describe(t),Gc=C({profile:V(\"DATABRICKS_CONFIG_PROFILE\",\"Databricks CLI profile environment.\"),host:V(\"DATABRICKS_HOST\",\"Databricks host environment.\"),accountId:V(\"DATABRICKS_ACCOUNT_ID\",\"Databricks account ID environment.\"),workspaceId:V(\"DATABRICKS_WORKSPACE_ID\",\"Databricks workspace ID environment.\"),configFile:V(\"DATABRICKS_CONFIG_FILE\",\"Databricks CLI config file environment.\"),clientId:V(\"DATABRICKS_CLIENT_ID\",\"Databricks OAuth client ID environment.\"),clientSecret:V(\"DATABRICKS_CLIENT_SECRET\",\"Databricks OAuth client secret environment.\"),accessToken:V(\"DATABRICKS_TOKEN\",\"Databricks access token environment.\"),groupId:V(\"DATABRICKS_GROUP_ID\",\"Databricks group ID environment.\"),authType:V(\"DATABRICKS_AUTH_TYPE\",\"Databricks auth type environment.\"),appName:V(\"DATABRICKS_APP_NAME\",\"Databricks App name environment.\"),appPort:V(\"DATABRICKS_APP_PORT\",\"Databricks App port environment.\"),lakebaseEndpoint:V(\"LAKEBASE_ENDPOINT\",\"Lakebase endpoint environment.\")}).strict().describe(\"Canonical Databricks CLI, SDK, Apps, and Lakebase environment names.\"),j=Object.freeze(Gc.parse({})),Wc=C({postgresRole:V(\"DBX_TOOLS_POSTGRES_ROLE\",\"PostgreSQL assumed-role environment.\")}).strict().describe(\"Canonical dbx-tools PostgreSQL environment names.\"),Yc=Object.freeze(Wc.parse({})),Xc=P().trim().min(1).regex(/^[A-Za-z0-9._@+-]{1,255}$/,\"PostgreSQL role must contain only letters, numbers, dot, underscore, at, plus, or hyphen.\").describe(\"PostgreSQL role assumed after authentication.\"),bn=C({postgresRole:Xc.optional().describe(\"PostgreSQL role assumed after authentication.\").meta({env:Yc.postgresRole})}).strict().describe(\"Shared PostgreSQL session options.\"),jp=bn.safeExtend({postgresRole:bn.shape.postgresRole.meta({env:\"POSTGRES_ROLE\"})}).describe(\"PostgreSQL options resolved through scoped configuration.\"),Qc=Kt.number().int().min(1).max(at).describe(\"TCP port from 1 through 65535.\"),eu=Kt.number().int().min(0).max(at).describe(\"TCP port from 0 through 65535, where zero requests automatic allocation.\"),Me=P().trim().min(1).refine((e)=>we(e)!==void 0,{message:\"Expected a valid URL or host.\"}).overwrite(Kp).describe(\"URL normalized through the shared URL builder.\"),X=(e)=>P().trim().min(1).optional().describe(e),H=(e,t=!0)=>({env:e,flag:t,helpDefault:!1}),Mp=C({profile:X(\"Databricks CLI profile.\").meta(H(j.profile)),host:Me.optional().describe(\"Databricks host.\").meta(H(j.host,!1)),accountId:X(\"Databricks account ID.\").meta(H(j.accountId,!1)),workspaceId:X(\"Databricks workspace ID.\").meta(H(j.workspaceId,!1)),configFile:X(\"Databricks CLI config file.\").meta(H(j.configFile,!1)),clientId:X(\"Databricks OAuth client ID.\").meta(H(j.clientId,!1)),clientSecret:X(\"Databricks OAuth client secret.\").meta(H(j.clientSecret,!1)),accessToken:X(\"Databricks access token.\").meta(H(j.accessToken,!1)),groupId:X(\"Databricks group ID.\").meta(H(j.groupId,!1)),authType:X(\"Databricks authentication type.\").meta(H(j.authType,!1)),appName:X(\"Databricks App name.\").meta(H(j.appName,!1)),appPort:Qc.optional().describe(\"Databricks App port.\").meta(H(j.appPort,!1)),lakebaseEndpoint:X(\"Lakebase endpoint.\").meta(H(j.lakebaseEndpoint,!1))}).strict().describe(\"Common Databricks CLI, SDK, Apps, and Lakebase options.\");var Fp=(e,t)=>P().trim().min(1).optional().describe(e).meta({env:t,flag:!1}),Bp=C({lakebaseEndpoint:Fp(\"Lakebase project, resource path, host, or URL.\",j.lakebaseEndpoint)}).strict().describe(\"Common Lakebase options.\");var Vp=C({scheme:pe(\"tcp\"),host:P().trim().toLowerCase().min(1),port:eu}).strict().describe(\"TCP listener address.\"),qp=C({scheme:pe(\"unix\"),path:P().trim().min(1)}).strict().describe(\"Unix-domain listener address.\");function Kp(e){let t=we(e);if(!t)return e;let r=t.toString();return t.pathname===\"/\"&&!t.search&&!t.hash?r.slice(0,-1):r}var Ky=We(\"shared/pattern\");var Gy=We(\"shared/token\");var Fe=\"/api/email/auth\";function ru(e,t){let r=Jt(e),n=Jt(t)?.split(\".\",1)[0],o=n?hn(n):void 0;if(!r)return o;if(!o||r.toLowerCase().endsWith(o.toLowerCase()))return r;return`${r} ${o}`}var ed=C({email:P().describe(\"Address to email a one-time code to, if it is authorized.\")}).describe(\"Validated request for an email one-time password.\"),td=C({ok:pe(!0).describe(\"Always true for an accepted one-time-password request.\"),retryAfter:Lc().optional().describe(\"Seconds to wait before requesting another code.\")}).describe(\"Accepted one-time-password request result and optional retry delay.\"),rd=C({email:P().describe(\"Address that received the one-time code.\"),code:P().describe(\"One-time password submitted to establish a session.\")}).describe(\"Email address and code submitted to establish a session.\"),nd=C({ok:it().describe(\"True when the code was accepted and a session was created.\"),retryAfter:Lc().optional().describe(\"Seconds to wait before trying another code.\")}).describe(\"Verification outcome and optional retry delay.\"),od=C({ok:it().describe(\"True when the session cookie was cleared.\"),redirectTo:P().describe(\"Validated same-origin destination after logout.\")}).describe(\"Logout outcome plus the validated same-origin destination.\"),id=C({authenticated:it().describe(\"True when the browser holds a valid session.\"),email:P().optional().describe(\"Signed-in address when a session exists.\"),enabled:it().describe(\"True when the passwordless gate is configured.\"),passkeysEnabled:it().optional().describe(\"True when WebAuthn passkeys are available.\"),passkeyNamePrefix:P().optional().describe(\"Configured prefix for humanized passkey display names.\")}).describe(\"Gate availability, session identity, and optional passkey capability.\");function Gt(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{code:t,message:r,toString:()=>t}]))}var Te=Gt({CHALLENGE_NOT_FOUND:\"Challenge not found\",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:\"You are not allowed to register this passkey\",FAILED_TO_VERIFY_REGISTRATION:\"Failed to verify registration\",PASSKEY_NOT_FOUND:\"Passkey not found\",AUTHENTICATION_FAILED:\"Authentication failed\",UNABLE_TO_CREATE_SESSION:\"Unable to create session\",USER_NOT_FOUND:\"User not found\",FAILED_TO_UPDATE_PASSKEY:\"Failed to update passkey\",PREVIOUSLY_REGISTERED:\"Previously registered\",REGISTRATION_CANCELLED:\"Registration cancelled\",AUTH_CANCELLED:\"Auth cancelled\",UNKNOWN_ERROR:\"Unknown error\",SESSION_REQUIRED:\"Passkey registration requires an authenticated session\",RESOLVE_USER_REQUIRED:\"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false\",RESOLVED_USER_INVALID:\"Resolved user is invalid\"}),nu=\"1.7.6\";function G(e){let t=new Uint8Array(e),r=\"\";for(let o of t)r+=String.fromCharCode(o);return btoa(r).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=/g,\"\")}function Ee(e){let t=e.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=(4-t.length%4)%4,n=t.padEnd(t.length+r,\"=\"),o=atob(n),i=new ArrayBuffer(o.length),s=new Uint8Array(i);for(let a=0;a<o.length;a++)s[a]=o.charCodeAt(a);return i}function ke(){return ad.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential===\"function\")}var ad={stubThis:(e)=>e};function Wt(e){let{id:t}=e;return{...e,id:Ee(t),transports:e.transports}}function Yt(e){return e===\"localhost\"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class N extends Error{constructor({message:e,code:t,cause:r,name:n}){super(e,{cause:r});Object.defineProperty(this,\"code\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n??r.name,this.code=t}}function ou({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new N({message:\"Registration ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else if(e.name===\"ConstraintError\"){if(r.authenticatorSelection?.requireResidentKey===!0)return new N({message:\"Discoverable credentials were required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT\",cause:e});else if(t.mediation===\"conditional\"&&r.authenticatorSelection?.userVerification===\"required\")return new N({message:\"User verification was required during automatic registration but it could not be performed\",code:\"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE\",cause:e});else if(r.authenticatorSelection?.userVerification===\"required\")return new N({message:\"User verification was required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT\",cause:e})}else if(e.name===\"InvalidStateError\")return new N({message:\"The authenticator was previously registered\",code:\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\",cause:e});else if(e.name===\"NotAllowedError\")return new N({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});else if(e.name===\"NotSupportedError\"){if(r.pubKeyCredParams.filter((o)=>o.type===\"public-key\").length===0)return new N({message:'No entry in pubKeyCredParams was of type \"public-key\"',code:\"ERROR_MALFORMED_PUBKEYCREDPARAMS\",cause:e});return new N({message:\"No available authenticator supported any of the specified pubKeyCredParams algorithms\",code:\"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG\",cause:e})}else if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(!Yt(n))return new N({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e});else if(r.rp.id!==n)return new N({message:`The RP ID \"${r.rp.id}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else if(e.name===\"TypeError\"){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new N({message:\"User ID was not between 1 and 64 characters\",code:\"ERROR_INVALID_USER_ID_LENGTH\",cause:e})}else if(e.name===\"UnknownError\")return new N({message:\"The authenticator was unable to process the specified options, or could not create a new credential\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e});return e}class iu{constructor(){Object.defineProperty(this,\"controller\",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=Error(\"Cancelling existing WebAuthn API call for new one\");t.name=\"AbortError\",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(\"Manually cancelling existing WebAuthn API call\");e.name=\"AbortError\",this.controller.abort(e),this.controller=void 0}}}var Be=new iu;var cd=[\"cross-platform\",\"platform\"];function Xt(e){if(!e)return;if(cd.indexOf(e)<0)return;return e}async function su(e){if(!e.optionsJSON&&e.challenge)console.warn(\"startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e};let{optionsJSON:t,useAutoRegister:r=!1}=e;if(!ke())throw Error(\"WebAuthn is not supported in this browser\");let n={...t,challenge:Ee(t.challenge),user:{...t.user,id:Ee(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Wt)},o={};if(r)o.mediation=\"conditional\";o.publicKey=n,o.signal=Be.createNewAbortSignal();let i;try{i=await navigator.credentials.create(o)}catch(g){throw ou({error:g,options:o})}if(!i)throw Error(\"Registration was not completed\");let{id:s,rawId:a,response:c,type:u}=i,l=void 0;if(typeof c.getTransports===\"function\")l=c.getTransports();let p=void 0;if(typeof c.getPublicKeyAlgorithm===\"function\")try{p=c.getPublicKeyAlgorithm()}catch(g){xn(\"getPublicKeyAlgorithm()\",g)}let d=void 0;if(typeof c.getPublicKey===\"function\")try{let g=c.getPublicKey();if(g!==null)d=G(g)}catch(g){xn(\"getPublicKey()\",g)}let m;if(typeof c.getAuthenticatorData===\"function\")try{m=G(c.getAuthenticatorData())}catch(g){xn(\"getAuthenticatorData()\",g)}return{id:s,rawId:G(a),response:{attestationObject:G(c.attestationObject),clientDataJSON:G(c.clientDataJSON),transports:l,publicKeyAlgorithm:p,publicKey:d,authenticatorData:m},type:u,clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:Xt(i.authenticatorAttachment)}}function xn(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function au(){if(!ke())return _n.stubThis(new Promise((t)=>t(!1)));let e=globalThis.PublicKeyCredential;if(e?.isConditionalMediationAvailable===void 0)return _n.stubThis(new Promise((t)=>t(!1)));return _n.stubThis(e.isConditionalMediationAvailable())}var _n={stubThis:(e)=>e};function cu({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new N({message:\"Authentication ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else if(e.name===\"NotAllowedError\")return new N({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});else if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(!Yt(n))return new N({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e});else if(r.rpId!==n)return new N({message:`The RP ID \"${r.rpId}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else if(e.name===\"UnknownError\")return new N({message:\"The authenticator was unable to process the specified options, or could not create a new assertion signature\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e});return e}async function uu(e){if(!e.optionsJSON&&e.challenge)console.warn(\"startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e};let{optionsJSON:t,useBrowserAutofill:r=!1,verifyBrowserAutofillInput:n=!0}=e;if(!ke())throw Error(\"WebAuthn is not supported in this browser\");let o;if(t.allowCredentials?.length!==0)o=t.allowCredentials?.map(Wt);let i={...t,challenge:Ee(t.challenge),allowCredentials:o},s={};if(r){if(!await au())throw Error(\"Browser does not support WebAuthn autofill\");if(document.querySelectorAll(\"input[autocomplete$='webauthn']\").length<1&&n)throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');s.mediation=\"conditional\",i.allowCredentials=[]}s.publicKey=i,s.signal=Be.createNewAbortSignal();let a;try{a=await navigator.credentials.get(s)}catch(m){throw cu({error:m,options:s})}if(!a)throw Error(\"Authentication was not completed\");let{id:c,rawId:u,response:l,type:p}=a,d=void 0;if(l.userHandle)d=G(l.userHandle);return{id:c,rawId:G(u),response:{authenticatorData:G(l.authenticatorData),clientDataJSON:G(l.clientDataJSON),signature:G(l.signature),userHandle:d},type:p,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Xt(a.authenticatorAttachment)}}var lu=\"1.7.6\";var fu=lu;var vn=Symbol.for(\"better-auth:broadcast-channel\"),ud=()=>Math.floor(Date.now()/1000),ld=class{listeners=new Set;name;constructor(e=\"better-auth.message\"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(typeof window>\"u\")return;try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:ud()}))}catch{}}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=(t)=>{if(t.key!==this.name)return;let r=JSON.parse(t.newValue??\"{}\");if(r?.event!==\"session\"||!r?.data)return;this.listeners.forEach((n)=>n(r))};return window.addEventListener(\"storage\",e),()=>{window.removeEventListener(\"storage\",e)}}};function Qt(e=\"better-auth.message\"){if(!globalThis[vn])globalThis[vn]=new ld(e);return globalThis[vn]}var ct=Symbol(\"clean\");var q=[],ut=0,Ae=null,Sn=4,fd=globalThis.nanostoresGlobal||={epoch:0},pd=()=>{let e,t;while(ut<q.length){t=ut,ut+=Sn;let r=Ae?.get(q[t]);if(r){if(!r.has(q[t+1]))continue;r.clear()}try{q[t](q[t+1].value,q[t+2],q[t+3])}catch(n){e=n}}if(q.length=ut=0,e)throw e};var Oe=(e)=>{let t=[],r={eq:Object.is,get(){if(!r.lc)r.listen(()=>{})();return r.value},init:e,lc:0,listen(n){return r.lc=t.push(n),()=>{Ae?.get(n)?.delete(r);for(let i=ut;i<q.length;)if(q[i]===n&&q[i+1]===r)q.splice(i,Sn);else i+=Sn;let o=t.indexOf(n);if(~o){if(t.splice(o,1),!--r.lc)r.off()}}},notify(n,o){fd.epoch++;let i=!q.length&&!Ae;for(let s of t){if(Ae){let a=Ae.get(s);if(!a)Ae.set(s,a=new Set);if(a.has(r))continue;a.add(r)}q.push(s,r,n,Ae?void 0:o)}if(i)pd()},off(){},set(n){let o=r.value;if(!r.eq(o,n))r.value=n,r.notify(o)},subscribe(n){let o=r.listen(n);return n(r.value),o},value:e};return r[ct]=()=>{t=[],r.lc=0,r.off()},r};var dd=2;var md=5,Ve=6,er=10,pu=(e,t,r,n)=>{if(e.events=e.events||{},!e.events[r+er])e.events[r+er]=n((o)=>{e.events[r].reduceRight((i,s)=>(s(i),i),{shared:{},...o})});return e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],i=o.indexOf(t);if(~i){if(o.splice(i,1),!o.length)e.events[r+er](),delete e.events[r+er]}}};var wn=(e,t)=>pu(e,t,dd,(r)=>{let{set:n,setKey:o}=e;if(e.setKey)e.setKey=(i,s)=>{let a;if(r({abort:()=>{a=!0},changed:i,newValue:{...e.value,[i]:s}}),!a)return o(i,s)};return e.set=(i)=>{let s;if(r({abort:()=>{s=!0},newValue:i}),!s)return n(i)},()=>{e.set=n,e.setKey=o}});var tr=1000,qe=(e,t)=>pu(e,(n)=>{let o=t(n);if(o)e.events[Ve].push(o)},md,(n)=>{let o=e.listen;e.listen=(...s)=>{if(!e.lc&&!e.active)e.active=!0,n();return o(...s)};let i=e.off;e.events[Ve]=[],e.off=()=>{i(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[Ve])s();e.events[Ve]=[]}},tr)};{let s=e[ct];e[ct]=()=>{for(let a of e.events[Ve])a();e.events[Ve]=[],e.active=!1,s()}}return()=>{e.listen=o,e.off=i}});function gu(e){if(typeof e!==\"object\"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function me(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!me(e[r],t[r]))return!1;return!0}if(gu(e)&&gu(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!(o in t)||!me(e[o],t[o]))return!1;return!0}return!1}function nr(e,t){return wn(e,({newValue:r,abort:n})=>{if(t(e.value,r))n()})}var Tn=Symbol.for(\"better-auth:focus-manager\"),xd=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach((t)=>t(e))}setup(){if(typeof window>\"u\"||typeof document>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=()=>{if(document.visibilityState===\"visible\")this.setFocused(!0)};return document.addEventListener(\"visibilitychange\",e,!1),()=>{document.removeEventListener(\"visibilitychange\",e,!1)}}};function En(){if(!globalThis[Tn])globalThis[Tn]=new xd;return globalThis[Tn]}var kn=Symbol.for(\"better-auth:online-manager\"),_d=class{listeners=new Set;isOnline=typeof navigator<\"u\"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach((t)=>t(e))}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(\"online\",e,!1),window.addEventListener(\"offline\",t,!1),()=>{window.removeEventListener(\"online\",e,!1),window.removeEventListener(\"offline\",t,!1)}}};function or(){if(!globalThis[kn])globalThis[kn]=new _d;return globalThis[kn]}var vd={proto:/\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/,constructor:/\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/,protoShort:/\"__proto__\"\\s*:/,constructorShort:/\"constructor\"\\s*:/},Sd=/^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/,yu={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,\"-infinity\":Number.NEGATIVE_INFINITY},wd=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;function Td(e){return e instanceof Date&&!isNaN(e.getTime())}function Ed(e){let t=wd.exec(e);if(!t)return null;let[,r,n,o,i,s,a,c,u,l,p]=t,d=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(s,10),parseInt(a,10),c?parseInt(c.padEnd(3,\"0\"),10):0));if(u){let m=(parseInt(l,10)*60+parseInt(p,10))*(u===\"+\"?-1:1);d.setUTCMinutes(d.getUTCMinutes()+m)}return Td(d)?d:null}function kd(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if(typeof e!==\"string\")return e;let s=e.trim(),a=s.toLowerCase();if(a.length<=9&&a in yu)return yu[a];if(!Sd.test(s)){if(r)throw SyntaxError(\"[better-json] Invalid JSON\");return e}if(Object.entries(vd).some(([c,u])=>{let l=u.test(s);if(l&&n)console.warn(`[better-json] Detected potential prototype pollution attempt using ${c} pattern`);return l})&&r)throw Error(\"[better-json] Potential prototype pollution attempt detected\");try{return JSON.parse(s,(u,l)=>{if(u===\"__proto__\"||u===\"constructor\"&&l&&typeof l===\"object\"&&\"prototype\"in l){if(n)console.warn(`[better-json] Dropping \"${u}\" key to prevent prototype pollution`);return}if(i&&typeof l===\"string\"){let p=Ed(l);if(p)return p}return o?o(u,l):l})}catch(c){if(r)throw c;return e}}function bu(e,t={strict:!0}){return kd(e,t)}var Ad=Symbol.for(\"better-auth:auth-query\");function ir(e){let t=Oe(e);return Object.defineProperty(t,Ad,{value:!0}),t}var Od=()=>typeof window>\"u\";function Pd(e,t){return me(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var An=(e,t,r,n)=>{let o=ir({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(p)=>s(p)});qe(o,()=>nr(o,Pd));let i=0,s=async(p)=>{let d=++i;return new Promise((m)=>{let g=typeof n===\"function\"?n({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):n;r(t,{...g,query:{...g?.query,...p?.query},async onSuccess(h){if(d===i){let v=o.get(),_=v.data!=null&&h.data!=null&&me(v.data,h.data)?v.data:h.data;o.set({data:_,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await g?.onSuccess?.(h)},async onError(h){let{request:v}=h,_=typeof v.retry===\"number\"?v.retry:v.retry?.attempts,A=v.retryAttempt||0;if(_&&A<_)return;if(d===i){let b=h.error.status===401;o.set({error:h.error,data:b?null:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await g?.onError?.(h)},async onRequest(h){if(d===i){let v=o.get();o.set({isPending:v.data===null,data:v.data,error:null,isRefetching:!0,refetch:o.value.refetch})}await g?.onRequest?.(h)}}).catch((h)=>{if(d!==i)return;o.set({error:h,data:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{m(void 0)})})};e=Array.isArray(e)?e:[e];let a=!1,c=!1,u=!1,l=()=>{if(a){u=!0;return}a=!0,s().finally(()=>{a=!1;let p=u&&c;if(u=!1,p)l()})};return qe(o,()=>{if(Od())return;c=!0;let p=!1,d,m=e.map((g)=>g.listen(()=>{if(p)s();else p=!0,clearTimeout(d),l()}));return d=setTimeout(()=>{p=!0,l()},0),()=>{c=!1;for(let g of m)g();clearTimeout(d)}}),o};var On=()=>Math.floor(Date.now()/1000),Rd=5;function xu(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,s=o.sessionOptions?.refetchOnWindowFocus??!0,a=o.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},u=()=>a||or().isOnline,l=(b)=>{if(!u())return;if(b?.event===\"storage\"){t();return}if(b?.event===\"poll\"){c.lastSessionRequest=On(),t();return}if(b?.event===\"visibilitychange\"){if(On()-c.lastSessionRequest<Rd)return;c.lastSessionRequest=On(),t();return}t()},p=(b)=>{Qt().post({event:\"session\",data:{trigger:b},clientId:Math.random().toString(36).substring(7)})},d=()=>{if(i&&i>0)c.pollInterval=setInterval(()=>{if(r())l({event:\"poll\"})},i*1000)},m=()=>{c.unsubscribeBroadcast=Qt().subscribe(()=>{l({event:\"storage\"})})},g=()=>{if(!s)return;c.unsubscribeFocus=En().subscribe(()=>{l({event:\"visibilitychange\"})})},h=()=>{c.unsubscribeOnline=or().subscribe((b)=>{if(b)l({event:\"visibilitychange\"})})},v=()=>{c.unsubscribeSignal=n.listen(()=>{t()})};return{init:()=>{if(c.isInitialized)return;c.isInitialized=!0,d(),m(),g(),h(),v(),c.cleanupBroadcastSetup=Qt().setup(),c.cleanupFocusSetup=En().setup(),c.cleanupOnlineSetup=or().setup()},cleanup:()=>{if(!c.isInitialized)return;if(c.pollInterval)clearInterval(c.pollInterval),c.pollInterval=void 0;if(c.unsubscribeBroadcast)c.unsubscribeBroadcast(),c.unsubscribeBroadcast=void 0;if(c.unsubscribeFocus)c.unsubscribeFocus(),c.unsubscribeFocus=void 0;if(c.unsubscribeOnline)c.unsubscribeOnline(),c.unsubscribeOnline=void 0;if(c.unsubscribeSignal)c.unsubscribeSignal(),c.unsubscribeSignal=void 0;if(c.cleanupBroadcastSetup)c.cleanupBroadcastSetup(),c.cleanupBroadcastSetup=void 0;if(c.cleanupFocusSetup)c.cleanupFocusSetup(),c.cleanupFocusSetup=void 0;if(c.cleanupOnlineSetup)c.cleanupOnlineSetup(),c.cleanupOnlineSetup=void 0;c.isInitialized=!1,c.lastSessionRequest=0},triggerRefetch:l,broadcastSessionUpdate:p}}var sr=Object.create(null),ft=(e)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?sr:globalThis),ne=new Proxy(sr,{get(e,t){return ft()[t]??sr[t]},has(e,t){return t in ft()||t in sr},set(e,t,r){let n=ft(!0);return n[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=ft(!0);return delete r[t],!0},ownKeys(){let e=ft(!0);return Object.keys(e)}});var zd=ne.NODE_ENV??\"\";function he(e,t){if(typeof process<\"u\"&&process.env)return process.env[e]??t;if(typeof Deno<\"u\")return Deno.env.get(e)??t;if(typeof Bun<\"u\")return Bun.env[e]??t;return t}var $d=Object.freeze({get BETTER_AUTH_SECRET(){return he(\"BETTER_AUTH_SECRET\")},get AUTH_SECRET(){return he(\"AUTH_SECRET\")},get BETTER_AUTH_TELEMETRY(){return he(\"BETTER_AUTH_TELEMETRY\")},get BETTER_AUTH_TELEMETRY_ID(){return he(\"BETTER_AUTH_TELEMETRY_ID\")},get NODE_ENV(){return he(\"NODE_ENV\",\"development\")},get PACKAGE_VERSION(){return he(\"PACKAGE_VERSION\",\"0.0.0\")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return he(\"BETTER_AUTH_TELEMETRY_ENDPOINT\",\"\")}});function Ld(){let e=Object.getOwnPropertyDescriptor(Error,\"stackTraceLimit\");if(e===void 0)return Object.isExtensible(Error);return Object.prototype.hasOwnProperty.call(e,\"writable\")?e.writable:e.set!==void 0}function Cd(e){let t=e.split(`\n at `);if(t.length<=1)return e;return t.splice(1,1),t.join(`\n at `)}function Nd(e,t){class r extends e{#e;constructor(...n){if(Ld()){let i=Error.stackTraceLimit;Error.stackTraceLimit=0;super(...n);Error.stackTraceLimit=i}else super(...n);let o=Error().stack;if(o)this.#e=Cd(o.replace(/^Error/,this.name))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,\"constructor\",{get(){return t},enumerable:!1,configurable:!0}),r}var Zd={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,\"I'M_A_TEAPOT\":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511},Dd=class extends Error{status;body;headers;statusCode;constructor(e=\"INTERNAL_SERVER_ERROR\",t=void 0,r={},n=typeof e===\"number\"?e:Zd[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0);this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name=\"APIError\",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};var Ud=Nd(Dd,Error);var Ke=class extends Error{constructor(e,t){super(e,t);this.name=\"BetterAuthError\",this.message=e,this.stack=\"\"}};var jd=47;function vu(e){let t=e.length;while(t>0&&e.charCodeAt(t-1)===jd)t--;return t===e.length?e:e.slice(0,t)}function Md(e){try{return(vu(new URL(e).pathname)||\"/\")!==\"/\"}catch{throw new Ke(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Fd(e){try{let t=new URL(e);if(t.protocol!==\"http:\"&&t.protocol!==\"https:\")throw new Ke(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof Ke)throw t;throw new Ke(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function dt(e,t=\"/api/auth\"){if(Fd(e),Md(e))return e;let r=vu(e);if(!t||t===\"/\")return r;return t=t.startsWith(\"/\")?t:`/${t}`,`${r}${t}`}function _u(e,t){if(!e||e.trim()===\"\")return!1;if(t===\"proto\")return e===\"http\"||e===\"https\";if(t===\"host\"){if([/\\.\\./,/\\0/,/[\\s]/,/^[.]/,/[<>'\"]/,/javascript:/i,/file:/i,/data:/i].some((r)=>r.test(e)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e)}return!1}function Su(e,t,r,n,o){if(e)return dt(e,t);if(n!==!1){let a=ne.BETTER_AUTH_URL||ne.NEXT_PUBLIC_BETTER_AUTH_URL||ne.PUBLIC_BETTER_AUTH_URL||ne.NUXT_PUBLIC_BETTER_AUTH_URL||ne.NUXT_PUBLIC_AUTH_URL||(ne.BASE_URL!==\"/\"?ne.BASE_URL:void 0);if(a)return dt(a,t)}let i=r?.headers.get(\"x-forwarded-host\"),s=r?.headers.get(\"x-forwarded-proto\");if(i&&s&&o){if(_u(s,\"proto\")&&_u(i,\"host\"))try{return dt(`${s}://${i}`,t)}catch(a){}}if(r){let a=Bd(r.url);if(!a)throw new Ke(\"Could not get origin from request. Please provide a valid base URL.\");return dt(a,t)}if(typeof window<\"u\"&&window.location)return dt(window.location.origin,t)}function Bd(e){try{let t=new URL(e);return t.origin===\"null\"?null:t.origin}catch{return null}}var Vd=[\"javascript:\",\"data:\",\"vbscript:\"];function wu(e){let t;try{t=new URL(e)}catch{return!0}return!Vd.includes(t.protocol)}var Tu={id:\"redirect\",name:\"Redirect\",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&wu(e.data.url)){if(typeof window<\"u\"&&window.location){if(window.location)try{window.location.href=e.data.url}catch{}}}}}};var qd=()=>typeof window>\"u\",Kd=tr;function ku(e,t){if(typeof window>\"u\")return;let r=e.get();if(r.data!==null||t===null)return;e.set({...r,data:t,error:null,isPending:!1})}function Eu(e){if(typeof e===\"object\"&&e!==null&&\"data\"in e&&\"error\"in e)return e;return{data:e,error:null}}function Hd(e){if(!e)return null;if(e.session===null&&e.user===null)return null;return e}function Jd(e,t){return me(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Au(e,t){let r=Oe(!1),n,o=0,i=0;r.listen(()=>{i++,o=0});let s=(m)=>l(m),a=ir({data:null,error:null,isPending:!0,isRefetching:!1,refetch:s});nr(a,Jd);let c=async(m,g)=>{let h=a.value;if(a.set({...h,isPending:h.data===null,isRefetching:!0,error:null,refetch:s}),m.aborted)return\"aborted\";try{let v=await e(\"/get-session\",{method:\"GET\",query:g?.query,signal:m});if(m.aborted)return\"aborted\";let{data:_,error:A}=Eu(v),b=\"fresh\";if(_?.needsRefresh)try{let x=await e(\"/get-session\",{method:\"POST\",signal:m});if(m.aborted)return\"aborted\";({data:_,error:A}=Eu(x))}catch{if(m.aborted)return\"aborted\";b=\"stale\"}if(A){let x=a.value,Re=A?.status===401;return a.set({data:Re?null:x.data,error:A,isPending:!1,isRefetching:!1,refetch:s}),\"failed\"}let E=Hd(_),k=a.value,W=k.data!=null&&E!=null&&me(k.data,E)?k.data:E;return a.set({data:W,error:null,isPending:!1,isRefetching:!1,refetch:s}),b}catch(v){if(m.aborted)return\"aborted\";let _=a.value;return a.set({data:_.data,error:v,isPending:!1,isRefetching:!1,refetch:s}),\"failed\"}},u=()=>{let m=a.value.data?.session?.expiresAt,g=m instanceof Date?m.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+Kd,g)},l=(m)=>{o=0,n?.cancel();let g=new AbortController,h={cancel:()=>g.abort(),promise:Promise.resolve().then(()=>{if(g.signal.aborted)return\"aborted\";return c(g.signal,m)}),revision:i};n=h;let v=(_)=>{if(n!==h)return;if(n=void 0,_===\"fresh\"&&h.revision===i)o=u()};return h.promise.then(v,()=>v(\"failed\")),h.promise.then(()=>{return})},p=()=>{if(n?.revision===i)return n.promise.then(()=>{return});if(Date.now()<o)return Promise.resolve();return l()},d=()=>{};return qe(a,()=>{let m;if(!qd())m=setTimeout(()=>{p()},0);let g=xu({fetchSession:l,shouldPollSession:()=>a.value.data!=null,sessionSignal:r,options:t});return g.init(),d=g.broadcastSessionUpdate,()=>{if(m)clearTimeout(m);g.cleanup()}}),{session:a,$sessionSignal:r,broadcastSessionUpdate:(m)=>d(m)}}function Pn(e){if(e===null||typeof e!==\"object\")return!1;let t=Object.getPrototypeOf(e);if(t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null)return!1;if(Symbol.iterator in e)return!1;if(Symbol.toStringTag in e)return Object.prototype.toString.call(e)===\"[object Module]\";return!0}function Rn(e,t,r=\".\",n){if(!Pn(t))return Rn(e,{},r,n);let o={...t};for(let i of Object.keys(e)){if(i===\"__proto__\"||i===\"constructor\")continue;let s=e[i];if(s===null||s===void 0)continue;if(n&&n(o,i,s,r))continue;if(Array.isArray(s)&&Array.isArray(o[i]))o[i]=[...s,...o[i]];else if(Pn(s)&&Pn(o[i]))o[i]=Rn(s,o[i],(r?`${r}.`:\"\")+i.toString(),n);else o[i]=s}return o}function zn(e){return(...t)=>t.reduce((r,n)=>Rn(r,n,\"\",e),{})}var Ou=zn(),Tv=zn((e,t,r)=>{if(e[t]!==void 0&&typeof r===\"function\")return e[t]=r(e[t]),!0}),Ev=zn((e,t,r)=>{if(Array.isArray(e[t])&&typeof r===\"function\")return e[t]=r(e[t]),!0});var Gd=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r});this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},Wd=async(e,t)=>{let r=t||{},n={onRequest:[t===null||t===void 0?void 0:t.onRequest],onResponse:[t===null||t===void 0?void 0:t.onResponse],onSuccess:[t===null||t===void 0?void 0:t.onSuccess],onError:[t===null||t===void 0?void 0:t.onError],onRetry:[t===null||t===void 0?void 0:t.onRetry]};if(!t||!(t===null||t===void 0?void 0:t.plugins))return{url:e,options:r,hooks:n};for(let l of(t===null||t===void 0?void 0:t.plugins)||[]){var o,i,s,a,c;if(l.init){var u;let p=await((u=l.init)===null||u===void 0?void 0:u.call(l,e.toString(),r));r=p.options||r,e=p.url}n.onRequest.push((o=l.hooks)===null||o===void 0?void 0:o.onRequest),n.onResponse.push((i=l.hooks)===null||i===void 0?void 0:i.onResponse),n.onSuccess.push((s=l.hooks)===null||s===void 0?void 0:s.onSuccess),n.onError.push((a=l.hooks)===null||a===void 0?void 0:a.onError),n.onRetry.push((c=l.hooks)===null||c===void 0?void 0:c.onRetry)}return{url:e,options:r,hooks:n}},Pu=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){if(this.options.shouldRetry)return Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t));return Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Yd=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){if(this.options.shouldRetry)return Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t));return Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Xd(e){if(typeof e===\"number\")return new Pu({type:\"linear\",attempts:e,delay:1000});switch(e.type){case\"linear\":return new Pu(e);case\"exponential\":return new Yd(e);default:throw Error(\"Invalid retry strategy\")}}var Qd=[\"get\",\"post\",\"put\",\"patch\",\"delete\"];function In(e){if(!e.startsWith(\"@\"))return{method:void 0,path:e};let t=e.indexOf(\"/\"),r=e.slice(1,t===-1?void 0:t);if(!Qd.includes(r))return{method:void 0,path:e};return{method:r,path:t===-1?e:e.slice(t+1)}}var em=(e)=>e===\".\"||e===\"..\",tm=(e)=>e.split(\":\").map((t)=>encodeURIComponent(t)).join(\":\");function rm(e,t){let r=t.get(e);if(r===void 0)return tm(e);if(em(r))throw TypeError(\"Path parameters cannot be reserved path segments\");return encodeURIComponent(r)}function nm(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:\"\"},i=e.startsWith(\"http\")?e.split(\"/\").slice(0,3).join(\"/\"):r||\"\",{path:s}=In(e);if(s!==e)e=`/${s}`;if(!i.endsWith(\"/\"))i+=\"/\";let[a,c]=e.replace(i,\"\").split(\"?\"),u=new URLSearchParams(c);for(let[d,m]of Object.entries(o||{})){if(m==null)continue;let g;if(typeof m===\"string\")g=m;else if(Array.isArray(m)){for(let h of m)u.append(d,h);continue}else g=JSON.stringify(m);u.set(d,g)}let l=new Map;if(n)if(Array.isArray(n)){let d=a.split(\"/\").filter((m)=>m.startsWith(\":\"));for(let[m,g]of d.entries()){let h=n[m];l.set(g,String(h))}}else for(let[d,m]of Object.entries(n))l.set(`:${d}`,String(m));a=a.split(\"/\").map((d)=>rm(d,l)).join(\"/\"),a=a.replace(/^\\/+/,\"\");let p=u.toString();if(p=p.length>0?`?${p}`.replace(/\\+/g,\"%20\"):\"\",!i.startsWith(\"http\"))return`${i}${a}${p}`;return new URL(`${a}${p}`,i)}var om=async(e)=>{let t={},r=async(n)=>typeof n===\"function\"?await n():n;if(e===null||e===void 0?void 0:e.auth){if(e.auth.type===\"Bearer\"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type===\"Basic\"){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(e.auth.type===\"Custom\"){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${n!==null&&n!==void 0?n:\"\"} ${o}`}}return t},im=/^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;function sm(e){let t=e.headers.get(\"content-type\"),r=new Set([\"image/svg\",\"application/xml\",\"application/xhtml\",\"application/html\"]);if(!t)return\"json\";let n=t.split(\";\").shift()||\"\";if(im.test(n))return\"json\";if(r.has(n)||n.startsWith(\"text/\"))return\"text\";return\"blob\"}function am(e){try{return JSON.parse(e),!0}catch(t){return!1}}function Iu(e){if(e===void 0)return!1;let t=typeof e;if(t===\"string\"||t===\"number\"||t===\"boolean\"||t===null)return!0;if(t!==\"object\")return!1;if(Array.isArray(e))return!0;if(e.buffer)return!1;return e.constructor&&e.constructor.name===\"Object\"||typeof e.toJSON===\"function\"}function Ru(e){try{return JSON.parse(e)}catch(t){return e}}function zu(e){return typeof e===\"function\"}function cm(e){if(e===null||e===void 0?void 0:e.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<\"u\"&&zu(globalThis.fetch))return globalThis.fetch;if(typeof window<\"u\"&&zu(window.fetch))return window.fetch;throw Error(\"No fetch implementation found\")}function Lu(...e){let t={};for(let r of e){if(!r)continue;if(r instanceof Headers)r.forEach((n,o)=>{t[o]=n});else{let n=Array.isArray(r)?r:Object.entries(r);for(let[o,i]of n)if(i!==null&&i!==void 0)t[o]=i}}return t}async function um(e){let t=new Headers(Lu(e===null||e===void 0?void 0:e.headers,await om(e)));if(!t.has(\"content-type\")){let r=lm(e===null||e===void 0?void 0:e.body);if(r)t.set(\"content-type\",r)}return t}function lm(e){if(Iu(e))return\"application/json\";return null}function fm(e){let t=e.get(\"content-type\");return t?t.split(\";\")[0].trim().toLowerCase():null}function pm(e,t){let{body:r}=e;if(!r)return null;if(!Iu(r))return r;if(typeof r===\"string\")return r;if(fm(t)===\"application/x-www-form-urlencoded\")return new URLSearchParams(r).toString();return JSON.stringify(r)}function dm(e,t){if(t===null||t===void 0?void 0:t.method)return t.method.toUpperCase();let{method:r}=In(e);if(r)return r.toUpperCase();return(t===null||t===void 0?void 0:t.body)?\"POST\":\"GET\"}function mm(e,t){let r;if(!(e===null||e===void 0?void 0:e.signal)&&(e===null||e===void 0?void 0:e.timeout))r=setTimeout(()=>t===null||t===void 0?void 0:t.abort(),e===null||e===void 0?void 0:e.timeout);return{abortTimeout:r,clearTimeout:()=>{if(r)clearTimeout(r)}}}var hm=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2));this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function mt(e,t){let r=await e[\"~standard\"].validate(t);if(r.issues)throw new hm(r.issues);return r.value}function ht(e){return ht=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},ht(e)}function gm(e,t){if(ht(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||\"default\");if(ht(n)!=\"object\")return n;throw TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function ym(e){var t=gm(e,\"string\");return ht(t)==\"symbol\"?t:t+\"\"}function bm(e,t,r){return(t=ym(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$u(Object(r),!0).forEach(function(n){bm(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$u(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var $n=async(e,t)=>{var r,n,o;let{hooks:i,url:s,options:a}=await Wd(e,t),c=cm(a),u=new AbortController,l=(r=a.signal)!==null&&r!==void 0?r:u.signal,p=nm(s,a),d=await um(a),m=pm(a,d),g=dm(s,a),h=T(T({},a),{},{url:p,headers:d,body:m,method:g,signal:l});for(let M of i.onRequest)if(M){let Z=await M(h);if(typeof Z===\"object\"&&Z!==null)Object.assign(h,Z)}if(\"pipeTo\"in h&&typeof h.pipeTo===\"function\"||typeof(t===null||t===void 0||(n=t.body)===null||n===void 0?void 0:n.pipe)===\"function\"){if(!(\"duplex\"in h))h.duplex=\"half\"}let{clearTimeout:v}=mm(a,u),_=await c(h.url,h);v();let A={response:_,request:h};for(let M of i.onResponse)if(M){var b;let Z=await M(T(T({},A),{},{response:(t===null||t===void 0||(b=t.hookOptions)===null||b===void 0?void 0:b.cloneResponse)?_.clone():_}));if(Z instanceof Response)_=Z;else if(typeof Z===\"object\"&&Z!==null)_=Z.response}if(_.ok){if(h.method===\"HEAD\")return{data:\"\",error:null};let M=sm(_),Z={data:null,response:_,request:h};if(M===\"json\"||M===\"text\"){var E;let ze=await _.text();Z.data=await((E=h.jsonParser)!==null&&E!==void 0?E:Ru)(ze)}else Z.data=await _[M]();if(h===null||h===void 0?void 0:h.output){if(h.output&&!h.disableValidation)Z.data=await mt(h.output,Z.data)}for(let ze of i.onSuccess)if(ze){var k;await ze(T(T({},Z),{},{response:(t===null||t===void 0||(k=t.hookOptions)===null||k===void 0?void 0:k.cloneResponse)?_.clone():_}))}if(t===null||t===void 0?void 0:t.throw)return Z.data;return{data:Z.data,error:null}}let W=(o=t===null||t===void 0?void 0:t.jsonParser)!==null&&o!==void 0?o:Ru,x=await _.text(),Re=am(x),cr=Re?await W(x):null,il={response:_,responseText:x,request:h,error:T(T({},cr),{},{status:_.status,statusText:_.statusText})};for(let M of i.onError)if(M){var ur;await M(T(T({},il),{},{response:(t===null||t===void 0||(ur=t.hookOptions)===null||ur===void 0?void 0:ur.cloneResponse)?_.clone():_}))}if(t===null||t===void 0?void 0:t.retry){var lr;let M=Xd(t.retry),Z=(lr=t.retryAttempt)!==null&&lr!==void 0?lr:0;if(await M.shouldAttemptRetry(Z,_)){for(let xt of i.onRetry)if(xt)await xt(A);let ze=M.getDelay(Z);return await new Promise((xt)=>setTimeout(xt,ze)),await $n(e,T(T({},t),{},{retryAttempt:Z+1}))}}if(t===null||t===void 0?void 0:t.throw)throw new Gd(_.status,_.statusText,Re?cr:x);return{data:null,error:T(T({},cr),{},{status:_.status,statusText:_.statusText})}},xm=(e)=>({id:\"apply-schema\",name:\"Apply Schema\",version:\"1.0.0\",async init(t,r){var n;let o=T(T({},r),e.query!==void 0&&{query:T(T({},e.query),r===null||r===void 0?void 0:r.query)}),i=((n=e.plugins)===null||n===void 0||(n=n.find((u)=>{var l;return((l=u.schema)===null||l===void 0?void 0:l.config)?t.startsWith(u.schema.config.baseURL||\"\")||t.startsWith(u.schema.config.prefix||\"\"):!1}))===null||n===void 0?void 0:n.schema)||e.schema;if(i){var s,a;let u=t;if((s=i.config)===null||s===void 0?void 0:s.prefix){if(u.startsWith(i.config.prefix)){if(u=u.replace(i.config.prefix,\"\"),i.config.baseURL)t=t.replace(i.config.prefix,i.config.baseURL)}}if((a=i.config)===null||a===void 0?void 0:a.baseURL){if(u.startsWith(i.config.baseURL))u=u.replace(i.config.baseURL,\"\")}if(u.startsWith(\"/\")&&u.charAt(1)===\"@\")u=u.substring(1);let l=i.schema[u];if(l){var c;let{method:p,path:d}=In(u);if(p)t=t.slice(0,t.length-u.length)+d;let m=r===null||r===void 0?void 0:r.headers;if(l.headers&&!(r===null||r===void 0?void 0:r.disableValidation)){let h={};if(r===null||r===void 0?void 0:r.headers){if(r.headers instanceof Headers)r.headers.forEach((A,b)=>{h[b.toLowerCase()]=A});else if(typeof r.headers===\"object\"){for(let[A,b]of Object.entries(r.headers))if(b!==null&&b!==void 0)h[A.toLowerCase()]=b}}let v=await mt(l.headers,h),_={};for(let[A,b]of Object.entries(v))_[A.toLowerCase()]=b;m=_}let g=(c=l.method)!==null&&c!==void 0?c:p;if(o=T(T(T(T({},o),g!==void 0&&{method:g}),l.output!==void 0&&{output:l.output}),m!==void 0&&{headers:m}),!(r===null||r===void 0?void 0:r.disableValidation)){if(l.query){if(o.query=await mt(l.query,r===null||r===void 0?void 0:r.query),o.query!==null&&typeof o.query===\"object\"){let h=T({},e.query);for(let v of Object.keys(h))if((r===null||r===void 0?void 0:r.query)&&Object.prototype.hasOwnProperty.call(r.query,v))h[v]=r.query[v];o.query=T(T({},h),o.query)}}o=T(T({},o),{},{body:l.input?await mt(l.input,r===null||r===void 0?void 0:r.body):r===null||r===void 0?void 0:r.body,params:l.params?await mt(l.params,r===null||r===void 0?void 0:r.params):r===null||r===void 0?void 0:r.params})}return{url:t,options:o}}}return T({url:t},(r!==void 0||e.query!==void 0)&&{options:o})}}),Cu=(e)=>{async function t(r,n){let o=T(T(T({},e),n),{},{headers:Lu(e===null||e===void 0?void 0:e.headers,n===null||n===void 0?void 0:n.headers),plugins:[...(e===null||e===void 0?void 0:e.plugins)||[],xm(e||{}),...(n===null||n===void 0?void 0:n.plugins)||[]]});if(e===null||e===void 0?void 0:e.catchAllError)try{return await $n(r,o)}catch(i){return{data:null,error:{status:500,statusText:\"Fetch Error\",message:\"Fetch related error. Captured by catchAllError option. See error property for more details.\",error:i}}}return await $n(r,o)}return t};var _m=(e)=>{if(typeof process>\"u\")return;let t=e??\"/api/auth\";if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>\"u\"){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let r=process.env.VERCEL_URL.startsWith(\"http\")?\"\":\"https://\";return`${new URL(`${r}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},Nu=(e,t)=>{let r=\"credentials\"in Request.prototype,n=Su(e?.baseURL,e?.basePath,void 0,t)??_m(e?.basePath)??\"/api/auth\",o=e?.plugins?.flatMap((x)=>x.fetchPlugins).filter((x)=>x!==void 0)||[],i={id:\"lifecycle-hooks\",name:\"lifecycle-hooks\",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:s,onError:a,onRequest:c,onResponse:u,...l}=e?.fetchOptions||{},p=Cu({baseURL:n,...r?{credentials:\"include\"}:{},method:\"GET\",jsonParser(x){if(!x)return null;return bu(x,{strict:!1})},customFetchImpl:fetch,...l,plugins:[i,...l.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Tu],...o]}),{$sessionSignal:d,session:m,broadcastSessionUpdate:g}=Au(p,e),h=!1,v=(x)=>{if(h||x===null)return;h=!0,ku(m,x)},_=e?.plugins||[],A={},b={$sessionSignal:d,session:m},E={\"/sign-out\":\"POST\",\"/revoke-sessions\":\"POST\",\"/revoke-other-sessions\":\"POST\",\"/delete-user\":\"POST\"},k=[{signal:\"$sessionSignal\",matcher(x){return x===\"/sign-out\"||x===\"/update-user\"||x===\"/update-session\"||x===\"/sign-up/email\"||x===\"/sign-in/email\"||x===\"/delete-user\"||x===\"/verify-email\"||x===\"/revoke-sessions\"||x===\"/revoke-session\"||x===\"/revoke-other-sessions\"||x===\"/change-email\"||x===\"/change-password\"},callback(x){if(x===\"/sign-out\")g(\"signout\");else if(x===\"/update-user\"||x===\"/update-session\")g(\"updateUser\")}}];for(let x of _){if(x.getAtoms)Object.assign(b,x.getAtoms?.(p));if(x.pathMethods)Object.assign(E,x.pathMethods);if(x.atomListeners)k.push(...x.atomListeners)}let W={notify:(x)=>{b[x].set(!b[x].get())},listen:(x,Re)=>{b[x].subscribe(Re)},atoms:b};for(let x of _)if(x.getActions)A=Ou(x.getActions?.(p,W,e)??{},A);return{get baseURL(){return n},pluginsActions:A,pluginsAtoms:b,pluginPathMethods:E,atomListeners:k,hydrateSession:v,$sessionSignal:d,$fetch:p,$store:W}};function Zu(e){return typeof e===\"object\"&&e!==null&&\"get\"in e&&typeof e.get===\"function\"&&\"lc\"in e&&typeof e.lc===\"number\"}function Du(e){return e.charAt(0).toUpperCase()+e.slice(1)}var vm=/[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+/gu,Sm=/['\\u2019]/g;function wm(e){return e.replace(Sm,\"\").match(vm)??[]}function Uu(e){return wm(e).map((t)=>t.toLowerCase()).join(\"-\")}function Tm(e,t,r){let n=t[e],{fetchOptions:o,query:i,...s}=r||{};if(n)return n;if(o?.method)return o.method;if(s&&Object.keys(s).length>0)return\"POST\";return\"GET\"}function ju(e,t,r,n,o){function i(s=[]){return new Proxy(function(){},{get(a,c){if(typeof c!==\"string\")return;if(c===\"then\"||c===\"catch\"||c===\"finally\")return;let u=[...s,c],l=e;for(let p of u)if(l&&typeof l===\"object\"&&p in l)l=l[p];else{l=void 0;break}if(typeof l===\"function\")return l;if(Zu(l))return l;return i(u)},apply:async(a,c,u)=>{let l=\"/\"+s.map(Uu).join(\"/\"),p=u[0]||{},d=u[1]||{},{query:m,fetchOptions:g,...h}=p,v={...d,...g},_=Tm(l,r,p);return await t(l,{...v,body:_===\"GET\"?void 0:{...h,...v?.body||{}},query:m||v?.query,method:_,async onSuccess(A){if(await v?.onSuccess?.(A),!o||v.disableSignal)return;let b=o.filter((k)=>k.matcher(l));if(!b.length)return;let E=new Set;for(let k of b){let W=n[k.signal];if(!W)return;if(E.has(k.signal))continue;E.add(k.signal);let x=W.get();setTimeout(()=>{W.set(!x)},10),k.callback?.(l)}}})}})}return i()}function Ln(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:n,hydrateSession:o,$fetch:i,atomListeners:s,$store:a}=Nu(e),c={};for(let[u,l]of Object.entries(n))c[`use${Du(u)}`]=l;return ju({...r,...c,hydrateSession:o,$fetch:i,$store:a},i,t,n,s)}var Em=(e,{$listPasskeys:t,$store:r})=>({signIn:{passkey:async(i,s)=>{let a=await e(\"/passkey/generate-authenticate-options\",{method:\"GET\",throw:!1});if(!a.data)return a;let c=a.data.extensions||i?.extensions?{...a.data.extensions||{},...i?.extensions||{}}:void 0,u;try{u=await uu({optionsJSON:{...a.data,extensions:c},useBrowserAutofill:i?.autoFill})}catch(l){return{data:null,error:{code:l instanceof N?l.code:\"AUTH_CANCELLED\",message:Te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}try{let{clientExtensionResults:l,...p}=u,d=await e(\"/passkey/verify-authentication\",{body:{response:p},...i?.fetchOptions,...s,method:\"POST\",throw:!1});if(t.set(Math.random()),r.notify(\"$sessionSignal\"),i?.returnWebAuthnResponse)return{...d,webauthn:{response:u,clientExtensionResults:l}};return d}catch(l){return console.error(\"[Better Auth] Error verifying passkey\",l),{data:null,error:{code:\"AUTH_CANCELLED\",message:Te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}}},passkey:{addPasskey:async(i,s)=>{let a=await e(\"/passkey/generate-register-options\",{method:\"GET\",query:{...i?.authenticatorAttachment&&{authenticatorAttachment:i.authenticatorAttachment},...i?.name&&{name:i.name},...i?.context&&{context:i.context}},throw:!1});if(!a.data)return a;try{let c=a.data.extensions||i?.extensions?{...a.data.extensions||{},...i?.extensions||{}}:void 0,u=await su({optionsJSON:{...a.data,extensions:c},useAutoRegister:i?.useAutoRegister}),{clientExtensionResults:l,...p}=u,d=await e(\"/passkey/verify-registration\",{...i?.fetchOptions,...s,body:{response:p,name:i?.name,...i?.createSession&&{createSession:!0}},method:\"POST\",throw:!1});if(!d.data)return d;if(t.set(Math.random()),d.data.session)r.notify(\"$sessionSignal\");if(i?.returnWebAuthnResponse)return{...d,webauthn:{response:u,clientExtensionResults:l}};return d}catch(c){if(c instanceof N){if(c.code===\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\")return{data:null,error:{code:c.code,message:Te.PREVIOUSLY_REGISTERED.message,status:400,statusText:\"BAD_REQUEST\"}};if(c.code===\"ERROR_CEREMONY_ABORTED\")return{data:null,error:{code:c.code,message:Te.REGISTRATION_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}};return{data:null,error:{code:c.code,message:c.message,status:400,statusText:\"BAD_REQUEST\"}}}return{data:null,error:{code:\"UNKNOWN_ERROR\",message:c instanceof Error?c.message:Te.UNKNOWN_ERROR.message,status:500,statusText:\"INTERNAL_SERVER_ERROR\"}}}}},$Infer:{}}),Mu=()=>{let e=Oe();return{id:\"passkey\",version:nu,$InferServerPlugin:{},getActions:(t,r)=>Em(t,{$listPasskeys:e,$store:r}),getAtoms(t){return{listPasskeys:An(e,\"/passkey/list-user-passkeys\",t,{method:\"GET\"}),$listPasskeys:e}},pathMethods:{\"/passkey/register\":\"POST\",\"/passkey/authenticate\":\"POST\"},atomListeners:[{matcher(t){return t===\"/passkey/verify-registration\"||t===\"/passkey/delete-passkey\"||t===\"/passkey/update-passkey\"||t===\"/sign-out\"},signal:\"$listPasskeys\"},{matcher:(t)=>t===\"/passkey/verify-authentication\",signal:\"$sessionSignal\"}],$ERROR_CODES:Te}};var Fu=Gt({OTP_EXPIRED:\"OTP expired\",INVALID_OTP:\"Invalid OTP\",TOO_MANY_ATTEMPTS:\"Too many attempts\"});var Cn=()=>({id:\"email-otp\",version:fu,$InferServerPlugin:{},atomListeners:[{matcher:(e)=>e===\"/email-otp/verify-email\"||e===\"/sign-in/email-otp\"||e===\"/email-otp/request-email-change\",signal:\"$sessionSignal\"}],$ERROR_CODES:Fu});function Bu(){return globalThis.location}function Xm(){return`${Bu()?.origin??\"http://localhost\"}${Fe}`}function Vu(e){return Ln({baseURL:Xm(),...e?{fetchOptions:{signal:e}}:{},plugins:[Cn(),Mu()]})}var qu=Vu();function Qm(e){return typeof e===\"object\"&&e!==null?e:void 0}function eh(e){let t=Qm(e);if(!t||typeof t.authenticated!==\"boolean\"||typeof t.enabled!==\"boolean\"||t.email!==void 0&&typeof t.email!==\"string\"||t.passkeysEnabled!==void 0&&typeof t.passkeysEnabled!==\"boolean\"||t.passkeyNamePrefix!==void 0&&typeof t.passkeyNamePrefix!==\"string\")throw Error(\"Auth status returned an invalid response\");return{authenticated:t.authenticated,enabled:t.enabled,...typeof t.email===\"string\"?{email:t.email}:{},...typeof t.passkeysEnabled===\"boolean\"?{passkeysEnabled:t.passkeysEnabled}:{},...typeof t.passkeyNamePrefix===\"string\"?{passkeyNamePrefix:t.passkeyNamePrefix}:{}}}var He;function th(e){return e instanceof DOMException&&e.name===\"AbortError\"}function Ku(e){He?.cancel();let t=Symbol(\"passkey-operation\"),r=new AbortController,n=!1,o=()=>{if(He?.id!==t)return;He=void 0,n=!0,r.abort(),Be.cancelCeremony()};return He={id:t,cancel:o},{result:e(Vu(r.signal)).then((s)=>!n&&s.error===null).catch((s)=>{if(n||th(s))return!1;throw s}).finally(()=>{if(He?.id===t)He=void 0}),cancel:o}}function Zn(e=!1){return Ku((t)=>t.signIn.passkey({autoFill:e}))}function Hu(e){return ru(e,Bu()?.hostname??\"\")}function Dn(){let e=globalThis;return Boolean(e.isSecureContext!==!1&&e.PublicKeyCredential&&e.navigator?.credentials&&typeof e.navigator.credentials.create===\"function\"&&typeof e.navigator.credentials.get===\"function\")}function Un(e){let t=e??Hu();return Ku((r)=>r.passkey.addPasskey(t?{name:t}:void 0))}async function jn(){let e=await fetch(`${Fe}/status`,{credentials:\"include\"});if(!e.ok)throw Error(`Auth status failed with ${e.status}`);return eh(await e.json())}async function Mn(e){return(await qu.emailOtp.sendVerificationOtp({email:e,type:\"sign-in\"})).error===null}async function Fn(e,t,r){return(await qu.signIn.emailOtp({email:e,otp:t,name:r})).error===null}var Pe={DatabricksCli:\"databricks-cli\",OAuthM2M:\"oauth-m2m\",PersonalAccessToken:\"pat\",AppOnBehalfOf:\"app_obo\",AppServicePrincipal:\"app_sp\"},gt={Workspace:\"workspace\",Account:\"account\",Unified:\"unified\"};var yt=fn([Pe.DatabricksCli,Pe.OAuthM2M,Pe.PersonalAccessToken,Pe.AppOnBehalfOf,Pe.AppServicePrincipal]).meta({env:j.authType,flag:!1}).describe(\"Databricks authentication type values.\"),bt=fn([gt.Workspace,gt.Account,gt.Unified]).describe(\"Databricks authentication target values.\");var Gu=\"runtime\",oh=C({profile:P().min(1).optional(),host:Me,accountId:P().min(1).optional(),workspaceId:P().min(1).optional(),target:bt,authType:yt.or(pe(Gu)),principal:P().min(1)});var Wu=C({name:P().min(1).describe(\"Profile name from the Databricks CLI configuration.\"),host:Me.optional().describe(\"Workspace or account host URL.\"),accountId:P().min(1).optional().describe(\"Account id when the profile targets an account.\"),workspaceId:P().min(1).optional().describe(\"Workspace id when the profile targets a workspace.\"),target:bt.describe(\"Whether this profile authenticates a workspace, account, or unified host.\"),authType:yt.describe(\"Credential kind used by this profile.\"),principal:P().min(1).describe(\"Secret-free principal label suitable for selectors.\")}).describe(\"Secret-free Databricks profile metadata.\"),sh=je(Wu).describe(\"List of secret-free Databricks profiles.\"),ah=Bf(\"kind\",[C({kind:pe(\"ambient\")}),C({kind:pe(\"profile\"),profile:P().trim().min(1).describe(\"Named Databricks CLI profile to use.\")})]).describe(\"Ambient or named-profile selector value.\");var Bn=document.querySelector(\"#email-form\"),qn=document.querySelector(\"#code-form\"),el=document.querySelector(\"#email\"),Kn=document.querySelector(\"#code\"),Yu=document.querySelector(\"#email-submit\"),Xu=document.querySelector(\"#code-submit\"),tl=document.querySelector(\"#passkey-submit\"),uh=document.querySelector(\"#create-passkey-option\"),Vn=document.querySelector(\"#create-passkey\"),lh=document.querySelector(\"#back\"),Qu=document.querySelector(\"#msg\"),Je=\"\",rl=!1,Q,nl=document.body.dataset.returnTo||\"/\",fh=document.body.dataset.passkeyNamePrefix;if(window.location.pathname!==Fe)nl=`${window.location.pathname}${window.location.search}${window.location.hash}`;function ee(e,t=!1){Qu.textContent=e,Qu.className=`msg${t?\" error\":\"\"}`}function Hn(){let e=Q;Q=void 0,e?.cancel()}function Jn(){ee(\"Signed in. Loading.\"),window.location.replace(nl)}function ol(e){Hn();let t=Zn(e);Q=t,t.result.then((r)=>{if(Q!==t)return;if(Q=void 0,r)Jn();else if(!e)ee(\"Unable to sign in with a passkey. Use email recovery instead.\",!0)}).catch(()=>{if(Q!==t)return;if(Q=void 0,!e)ee(\"Unable to sign in with a passkey. Use email recovery instead.\",!0)})}async function ph(){if(!rl||!Vn.checked)return;ee(\"Creating a passkey.\");try{let e=Un(Hu(fh));if(Q=e,await e.result,Q===e)Q=void 0}catch{Q=void 0}}jn().then(async(e)=>{if(e.authenticated){Jn();return}if(!e.passkeysEnabled||!Dn())return;if(rl=!0,tl.hidden=!1,uh.hidden=!1,typeof PublicKeyCredential.isConditionalMediationAvailable!==\"function\"||!await PublicKeyCredential.isConditionalMediationAvailable())return;ol(!0)}).catch(()=>{return});tl.addEventListener(\"click\",()=>{ee(\"\"),ol(!1)});Bn.addEventListener(\"submit\",(e)=>{if(e.preventDefault(),Je=el.value.trim(),!Je)return;Hn(),Yu.disabled=!0,ee(\"Sending.\"),Mn(Je).then((t)=>{if(!t)throw Error(\"OTP request failed\");Bn.classList.add(\"hidden\"),qn.classList.remove(\"hidden\"),Kn.focus(),ee(`If ${Je} is authorized, a verification code is on its way.`)}).catch(()=>ee(\"Could not send a code. Check the address and try again.\",!0)).finally(()=>{Yu.disabled=!1})});qn.addEventListener(\"submit\",(e)=>{e.preventDefault();let t=Kn.value.trim();if(!t)return;Xu.disabled=!0,Vn.disabled=!0,ee(\"Verifying.\"),Fn(Je,t,Je.split(\"@\")[0]||\"User\").then(async(r)=>{if(!r)throw Error(\"OTP verification failed\");await ph(),Jn()}).catch(()=>{ee(\"That code was not accepted. Try again.\",!0),Xu.disabled=!1,Vn.disabled=!1})});lh.addEventListener(\"click\",()=>{qn.classList.add(\"hidden\"),Bn.classList.remove(\"hidden\"),Kn.value=\"\",ee(\"\"),el.focus()});window.addEventListener(\"pagehide\",Hn,{once:!0});})();\n";
|
|
1
|
+
export declare const LOGIN_CLIENT_SOURCE = "(()=>{var sl=Object.defineProperty;var al=(e)=>e;function cl(e,t){this[e]=al.bind(null,t)}var Gn=(e,t)=>{for(var r in t)sl(e,r,{get:t[r],enumerable:!0,configurable:!0,set:cl.bind(t,r)})};var ul=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var S=((e)=>typeof require<\"u\"?require:typeof Proxy<\"u\"?new Proxy(e,{get:(t,r)=>(typeof require<\"u\"?require:t)[r]}):e)(function(e){if(typeof require<\"u\")return require.apply(this,arguments);throw Error('Dynamic require of \"'+e+'\" is not supported')});var zo={};Gn(zo,{TextDecoder:()=>Ro,TextEncoder:()=>Po,_extend:()=>vr,callbackify:()=>Oo,callbackifyOnRejected:()=>Sr,debuglog:()=>yl,default:()=>zl,deprecate:()=>gl,format:()=>br,inherits:()=>Eo,inspect:()=>ge,isArray:()=>So,isBoolean:()=>xr,isBuffer:()=>Ol,isDate:()=>yr,isError:()=>St,isFunction:()=>wt,isNull:()=>Et,isNullOrUndefined:()=>El,isNumber:()=>wo,isObject:()=>Le,isPrimitive:()=>Al,isRegExp:()=>vt,isString:()=>kt,isSymbol:()=>kl,isUndefined:()=>Ie,log:()=>To,promisify:()=>Ao,types:()=>Tl});function br(e,...t){if(!kt(e)){var r=[e];for(var n=0;n<t.length;n++)r.push(ge(t[n]));return r.join(\" \")}var n=0,o=t.length,i=String(e).replace(hl,function(a){if(a===\"%%\")return\"%\";if(n>=o)return a;switch(a){case\"%s\":return String(t[n++]);case\"%d\":return Number(t[n++]);case\"%j\":try{return JSON.stringify(t[n++])}catch(c){return\"[Circular]\"}default:return a}});for(var s=t[n];n<o;s=t[++n])if(Et(s)||!Le(s))i+=\" \"+s;else i+=\" \"+ge(s);return i}function gl(e,t){if(typeof process>\"u\"||process?.noDeprecation===!0)return e;var r=!1;function n(...o){if(!r){if(process.throwDeprecation)throw Error(t);else if(process.traceDeprecation)console.trace(t);else console.error(t);r=!0}return e.apply(this,...o)}return n}function bl(e,t){var r=ge.styles[t];if(r)return\"\\x1B[\"+ge.colors[r][0]+\"m\"+e+\"\\x1B[\"+ge.colors[r][1]+\"m\";else return e}function xl(e,t){return e}function _l(e){var t={};return e.forEach(function(r,n){t[r]=!0}),t}function Tt(e,t,r){if(e.customInspect&&t&&wt(t.inspect)&&t.inspect!==ge&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(r,e);if(!kt(n))n=Tt(e,n,r);return n}var o=vl(e,t);if(o)return o;var i=Object.keys(t),s=_l(i);if(e.showHidden)i=Object.getOwnPropertyNames(t);if(St(t)&&(i.indexOf(\"message\")>=0||i.indexOf(\"description\")>=0))return mr(t);if(i.length===0){if(wt(t)){var a=t.name?\": \"+t.name:\"\";return e.stylize(\"[Function\"+a+\"]\",\"special\")}if(vt(t))return e.stylize(RegExp.prototype.toString.call(t),\"regexp\");if(yr(t))return e.stylize(Date.prototype.toString.call(t),\"date\");if(St(t))return mr(t)}var c=\"\",u=!1,l=[\"{\",\"}\"];if(So(t))u=!0,l=[\"[\",\"]\"];if(wt(t)){var p=t.name?\": \"+t.name:\"\";c=\" [Function\"+p+\"]\"}if(vt(t))c=\" \"+RegExp.prototype.toString.call(t);if(yr(t))c=\" \"+Date.prototype.toUTCString.call(t);if(St(t))c=\" \"+mr(t);if(i.length===0&&(!u||t.length==0))return l[0]+c+l[1];if(r<0)if(vt(t))return e.stylize(RegExp.prototype.toString.call(t),\"regexp\");else return e.stylize(\"[Object]\",\"special\");e.seen.push(t);var d;if(u)d=Sl(e,t,r,s,i);else d=i.map(function(m){return gr(e,t,r,s,m,u)});return e.seen.pop(),wl(d,c,l)}function vl(e,t){if(Ie(t))return e.stylize(\"undefined\",\"undefined\");if(kt(t)){var r=\"'\"+JSON.stringify(t).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return e.stylize(r,\"string\")}if(wo(t))return e.stylize(\"\"+t,\"number\");if(xr(t))return e.stylize(\"\"+t,\"boolean\");if(Et(t))return e.stylize(\"null\",\"null\")}function mr(e){return\"[\"+Error.prototype.toString.call(e)+\"]\"}function Sl(e,t,r,n,o){var i=[];for(var s=0,a=t.length;s<a;++s)if(ko(t,String(s)))i.push(gr(e,t,r,n,String(s),!0));else i.push(\"\");return o.forEach(function(c){if(!c.match(/^\\d+$/))i.push(gr(e,t,r,n,c,!0))}),i}function gr(e,t,r,n,o,i){var s,a,c;if(c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},c.get)if(c.set)a=e.stylize(\"[Getter/Setter]\",\"special\");else a=e.stylize(\"[Getter]\",\"special\");else if(c.set)a=e.stylize(\"[Setter]\",\"special\");if(!ko(n,o))s=\"[\"+o+\"]\";if(!a)if(e.seen.indexOf(c.value)<0){if(Et(r))a=Tt(e,c.value,null);else a=Tt(e,c.value,r-1);if(a.indexOf(`\n`)>-1)if(i)a=a.split(`\n`).map(function(u){return\" \"+u}).join(`\n`).slice(2);else a=`\n`+a.split(`\n`).map(function(u){return\" \"+u}).join(`\n`)}else a=e.stylize(\"[Circular]\",\"special\");if(Ie(s)){if(i&&o.match(/^\\d+$/))return a;if(s=JSON.stringify(\"\"+o),s.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))s=s.slice(1,-1),s=e.stylize(s,\"name\");else s=s.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),s=e.stylize(s,\"string\")}return s+\": \"+a}function wl(e,t,r){var n=0,o=e.reduce(function(i,s){if(n++,s.indexOf(`\n`)>=0)n++;return i+s.replace(/\\u001b\\[\\d\\d?m/g,\"\").length+1},0);if(o>60)return r[0]+(t===\"\"?\"\":t+`\n `)+\" \"+e.join(`,\n `)+\" \"+r[1];return r[0]+t+\" \"+e.join(\", \")+\" \"+r[1]}function So(e){return Array.isArray(e)}function xr(e){return typeof e===\"boolean\"}function Et(e){return e===null}function El(e){return e==null}function wo(e){return typeof e===\"number\"}function kt(e){return typeof e===\"string\"}function kl(e){return typeof e===\"symbol\"}function Ie(e){return e===void 0}function vt(e){return Le(e)&&_r(e)===\"[object RegExp]\"}function Le(e){return typeof e===\"object\"&&e!==null}function yr(e){return Le(e)&&_r(e)===\"[object Date]\"}function St(e){return Le(e)&&(_r(e)===\"[object Error]\"||e instanceof Error)}function wt(e){return typeof e===\"function\"}function Al(e){return e===null||typeof e===\"boolean\"||typeof e===\"number\"||typeof e===\"string\"||typeof e===\"symbol\"||typeof e>\"u\"}function Ol(e){return e instanceof Buffer}function _r(e){return Object.prototype.toString.call(e)}function hr(e){return e<10?\"0\"+e.toString(10):e.toString(10)}function Rl(){var e=new Date,t=[hr(e.getHours()),hr(e.getMinutes()),hr(e.getSeconds())].join(\":\");return[e.getDate(),Pl[e.getMonth()],t].join(\" \")}function To(...e){console.log(\"%s - %s\",Rl(),br.apply(null,e))}function Eo(e,t){if(t)e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function vr(e,t){if(!t||!Le(t))return e;var r=Object.keys(t),n=r.length;while(n--)e[r[n]]=t[r[n]];return e}function ko(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sr(e,t){if(!e){var r=Error(\"Promise was rejected with a falsy value\");r.reason=e,e=r}return t(e)}function Oo(e){if(typeof e!==\"function\")throw TypeError('The \"original\" argument must be of type Function');function t(...r){var n=r.pop();if(typeof n!==\"function\")throw TypeError(\"The last argument must be of type Function\");var o=this,i=function(...s){return n.apply(o,...s)};e.apply(this,r).then(function(s){process.nextTick(i.bind(null,null,s))},function(s){process.nextTick(Sr.bind(null,s,i))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),t}var hl,yl,ge,Tl=()=>{},Pl,Ao,Po,Ro,zl;var $o=ul(()=>{hl=/%[sdj%]/g;yl=((e={},t={},r)=>((r=typeof process<\"u\"&&!1)&&(r=r.replace(/[|\\\\{}()[\\]^$+?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase()),t=new RegExp(\"^\"+r+\"$\",\"i\"),(n)=>{if(n=n.toUpperCase(),!e[n])if(t.test(n))e[n]=function(...o){console.error(\"%s: %s\",n,pid,br.apply(null,...o))};else e[n]=function(){};return e[n]}))(),ge=((e)=>(e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"},e.custom=Symbol.for(\"nodejs.util.inspect.custom\"),e))(function(e,t,...r){var n={seen:[],stylize:xl};if(r.length>=1)n.depth=r[0];if(r.length>=2)n.colors=r[1];if(xr(t))n.showHidden=t;else if(t)vr(n,t);if(Ie(n.showHidden))n.showHidden=!1;if(Ie(n.depth))n.depth=2;if(Ie(n.colors))n.colors=!1;if(n.colors)n.stylize=bl;return Tt(n,e,n.depth)});Pl=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];Ao=((e)=>(e.custom=Symbol.for(\"nodejs.util.promisify.custom\"),e))(function(e){if(typeof e!==\"function\")throw TypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&e[kCustomPromisifiedSymbol]){var t=e[kCustomPromisifiedSymbol];if(typeof t!==\"function\")throw TypeError('The \"nodejs.util.promisify.custom\" argument must be of type Function');return Object.defineProperty(t,kCustomPromisifiedSymbol,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(...r){var n,o,i=new Promise(function(s,a){n=s,o=a});r.push(function(s,a){if(s)o(s);else n(a)});try{e.apply(this,r)}catch(s){o(s)}return i}if(Object.setPrototypeOf(t,Object.getPrototypeOf(e)),kCustomPromisifiedSymbol)Object.defineProperty(t,kCustomPromisifiedSymbol,{value:t,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))});({TextEncoder:Po,TextDecoder:Ro}=globalThis),zl={TextEncoder:Po,TextDecoder:Ro,promisify:Ao,log:To,inherits:Eo,_extend:vr,callbackifyOnRejected:Sr,callbackify:Oo}});function Wn(e){return Array.isArray(e)||e instanceof Set||e instanceof Map}function Yn(e,t){function r(n,o){if(n==null)return!0;else if(typeof n===\"object\"){if(o?.has(n))return!0;if(o?.add(n),Array.isArray(n))return n.length===0||(o?n.every((s)=>r(s,o)):!1);if(n instanceof Set)return n.size===0||(o?[...n].every((s)=>r(s,o)):!1);if(n instanceof Map)return n.size===0||(o?[...n.values()].every((s)=>r(s,o)):!1);let i=Object.keys(n);if(i.length===0)return!0;else if(o)return i.every((s)=>r(n[s],o));else return!1}else return!1}return r(e,t?.recursive?new Set:void 0)}function Xn(e){return e instanceof Map?e.values():e}function Qn(e){return e!=null&&typeof e!==\"string\"&&!(e instanceof String)&&!(e instanceof RegExp)&&typeof e!==\"function\"&&typeof e[Symbol.iterator]===\"function\"}function eo(...e){let t=[];for(let r of e){if(r==null||Wn(r)&&Yn(r))continue;t.push(Qn(r)?Xn(r):[r])}return t}function to(e,t){if(t>0&&Array.isArray(e)){let r=Number.isFinite(t)?t-1:t;return{*[Symbol.iterator](){for(let n of e)yield*to(n,r)}}}return[e]}function fr(e,t){return R({*[Symbol.iterator](){let r=0;for(let n of e)yield*t(n,r++)}})}function ll(e,t){return R({*[Symbol.iterator](){let r=0;for(let n of e)yield t(n,r++)}})}function ro(e,t){return ll(R(e),t)}function pr(e,t){return fr(R(e),function*(r,n){if(t(r,n))yield r})}function no(...e){return pr(R(...e),(t)=>t!=null)}function oo(e,t){return fr(R(e),function*(r,n){let o=t(r,n);if(Array.isArray(o))yield*o;else yield o})}function io(e,...t){let r=R(...t);if(e<1)return r;return fr(r,(n)=>to(n,e))}function so(...e){let t=R(...e);return R({*[Symbol.iterator](){let r=new Set;for(let n of t){if(r.has(n))continue;r.add(n),yield n}}})}function ao(e,...t){let r=R(e);if(t.length===0)return r;return R({*[Symbol.iterator](){yield*r;for(let n of t)if(Array.isArray(n))yield*n;else yield n}})}function co(e,...t){if(e<=0)return xo;let r=R(...t);return R({*[Symbol.iterator](){let n=0;for(let o of r)if(yield o,++n>=e)return}})}function uo(e,...t){let r=Object.keys(e),n=new Map(r.map((s)=>[s,[]])),o=0;for(let s of R(...t)){let a=o++;for(let c of r)if(e[c](s,a)){n.get(c).push(s);break}}let i={};for(let s of r)i[s]=n.get(s);return i}function lo(e,t){let r=0;for(let n of R(e))if(t(n,r++))return n;return}function fo(e,t){let r=0,n;for(let o of R(e))if(t(o,r++))n=o;return n}function po(e,t){let r=0;for(let n of R(e)){if(t(n,r))return r;r++}return-1}function mo(e,t){let r=0,n=-1;for(let o of R(e)){if(t(o,r))n=r;r++}return n}function ho(e,t){let r=0;for(let n of R(e))if(t(n,r++))return!0;return!1}function go(e,t){let r=0;for(let n of R(e))if(!t(n,r++))return!1;return!0}function yo(e,t){let r=0;for(let n of R(e))t(n,r++)}function bo(e,...t){let r=R(...t);if(e<0)return dr(r).at(e);let n=0;for(let o of r)if(n++===e)return o;return}function dr(...e){return[...R(...e)]}class $e{source;buffer;iterator;exhausted;constructor(e,t,r={}){this.source=e;this.buffer=t;this.exhausted=r.exhausted??!1}get caching(){return this.buffer!==void 0}pull(){return this.iterator??=this.source[Symbol.iterator](),this.iterator.next()}*[Symbol.iterator](){if(!this.caching){if(this.exhausted)return;for(let e=this.pull();!e.done;e=this.pull())yield e.value;this.exhausted=!0}else{let e=this.buffer,t=0;for(;;){if(t<e.length){yield e[t++];continue}if(this.exhausted)return;let r=this.pull();if(r.done){this.exhausted=!0;return}e.push(r.value),yield r.value,t++}}}map(e){return ro(this,e)}filter(e){return pr(this,e)}nonNull(){return no(this)}flatMap(e){return oo(this,e)}flat(e=1){return io(e,this)}distinct(){return so(this)}concat(...e){return ao(this,...e)}join(...e){let t=eo(this,...e);return t.length===1?this:R(...t)}take(e){return co(e,this)}group(e){return uo(e,this)}cache(){return this.caching?this:new $e(this,[])}find(e){return lo(this,e)}findLast(e){return fo(this,e)}findIndex(e){return po(this,e)}findLastIndex(e){return mo(this,e)}some(e){return ho(this,e)}every(e){return go(this,e)}forEach(e){yo(this,e)}at(e){return bo(e,this)}toArray(){if(this.caching&&this.exhausted)return[...this.buffer];return dr(this)}}var xo=new $e([],void 0,{exhausted:!0});function R(...e){let t=eo(...e);if(t.length===0)return xo;if(t.length===1){let r=t[0];return r instanceof $e?r:new $e(r,void 0)}return new $e({*[Symbol.iterator](){for(let r of t)yield*r}},void 0)}function Ge(e){if(typeof e===\"boolean\")return e;else if(typeof e===\"string\"){if(e=e.trim().toLowerCase(),e===\"true\"||e==\"t\"||e===\"on\"||e===\"1\"||e===\"yes\"||e===\"y\")return!0;else if(e===\"false\"||e==\"f\"||e===\"off\"||e===\"0\"||e===\"no\"||e===\"n\")return!1}else if(typeof e===\"number\"){if(e===1)return!0;else if(e===0)return!1}return}var fl=[[1,[\"ms\",\"msec\",\"millisecond\",\"milli\"]],[1000,[\"s\",\"sec\",\"second\"]],[60000,[\"m\",\"min\",\"minute\"]],[3600000,[\"h\",\"hr\",\"hour\"]],[86400000,[\"d\",\"day\"]],[604800000,[\"w\",\"wk\",\"week\"]],[2592000000,[\"mo\",\"mon\",\"month\"]],[31536000000,[\"y\",\"yr\",\"year\"]]],mh=new Map(fl.flatMap(([e,t])=>t.map((r)=>[r,e])));function _t(e,t){let r=t?.ttlMs??0,n;return()=>{if(n===void 0||r>0&&Date.now()>=n.expiresAt){let o=e();if(dl(o)){let i=Promise.resolve(o),s={value:i,expiresAt:1/0};n=s,i.then(()=>{s.expiresAt=Date.now()+r},()=>{if(n===s)n=void 0})}else n={value:o,expiresAt:Date.now()+r}}return n.value}}function dl(e){if(e!==null){if(e instanceof Promise)return!0;else if(typeof e===\"object\"&&\"then\"in e&&typeof e.then===\"function\")return!0}return!1}var{process:oe,Bun:wr}=globalThis,Io=oe&&typeof oe.stderr?.write===\"function\"?oe.stderr:void 0,Lo=oe&&typeof oe.stdout?.write===\"function\"?oe.stdout:void 0,Ot=[\"debug\",\"info\",\"warn\",\"error\"],Tr=Object.fromEntries(Ot.map((e,t)=>[e,t])),$l=Object.fromEntries(Ot.map((e)=>{let t=\"\\x1B[90m\";switch(e){case\"info\":t=\"\\x1B[34m\";break;case\"warn\":t=\"\\x1B[33m\";break;case\"error\":t=\"\\x1B[31m\";break}return[e,t]})),Co=\"\\x1B[0m\",Il=\"info\";async function Ll(e,t){let n=e===void 0&&t===void 0?void 0:await Promise.resolve().then(() => ($o(),zo)).catch(()=>{return});return No(e,t,n)}function No(e,t,r){let n=wr!==void 0&&!Ge(wr.env?.LOG_BUN_CONSOLE_DISABLED)?wr.inspect:void 0,o=n!==void 0,i=(c,u)=>{if(Array.isArray(c)||typeof c===\"object\"&&c!==null)if(n!==void 0)return n(c,{colors:u,depth:r?.inspect?.defaultOptions?.depth??void 0});else if(r!==void 0)return r.inspect(c,{...r?.inspect?.defaultOptions,colors:!1});else{let l=new WeakSet;return JSON.stringify(c,(p,d)=>{if(typeof d===\"object\"&&d!==null){if(l.has(d))return\"[Circular]\";l.add(d)}if(d instanceof Error){let m=d;return{...Object.fromEntries(Object.entries(m)),name:m.name,message:m.message,stack:m.stack,...m.cause===void 0?{}:{cause:m.cause},...m.errors===void 0?{}:{errors:m.errors}}}return d})}else return String(c)},s=(c)=>{let u=Object.fromEntries(Ot.map((l)=>{let d=(l===\"warn\"||l===\"error\"?t:e)??t??e,m=Zl(c,d,o),{prefix:g,colors:h,resetColors:v}=m(l);return[l,(...A)=>{if(!Ul(l,!0))return;if(d!==void 0){let b=g?[g]:[];if(b.push(...A.map((E)=>i(E,h))),v)b.push(Co);d.write(b.join(\" \")+`\n`)}else{let b=console[l];if(typeof b!==\"function\")b=console.log;if(g)b=b.bind(console,g);b(...A)}}]}));return u.success=u.info,u.start=u.info,u},a=_t(s);return(c)=>c?s(c):a()}var Cl=_t(async()=>Ll(Lo,Io)),At=No(Lo,Io);Cl().then((e)=>{At=e},()=>{});function Nl(e){let t,r=()=>{if(t?.factory!==At)t={factory:At,logger:At(e)};return t.logger};return Object.fromEntries([...Ot,\"success\",\"start\"].map((n)=>[n,(...o)=>r()[n](...o)]))}function Zl(e,t,r){let n=globalThis,o=n.window!==void 0&&n.document!==void 0,i=!o?Dl(t):!1,s=e?\"[\"+e+\"]\":void 0;return(a)=>{let c=i&&a!==void 0?$l[a]:void 0,u=[!o&&a?a.toUpperCase():void 0,s].filter(Boolean).join(\" \"),l=!1;if(c){let p=r||a===\"info\";if(!p)l=!0;u=p?c+u+Co:c+u}return{prefix:u,colors:c?!0:!1,resetColors:l}}}function Dl(e){if(oe===void 0||typeof e!==\"object\"||e===null)return!1;let{isTTY:t}=e;if(t!==!0)return!1;if(oe.env?.TERM?.toLowerCase()==\"dumb\")return!1;return!0}function Zo(e){if(e===void 0||e===null)return;let t=typeof e===\"string\"?e:String(e);for(let r=0;r<2;r++){if(r>0){let n=t.trim().toLowerCase();if(t===n)break;t=n}if(!t)break;else if(t in Tr)return t}return}function Er(){return Zo(oe?.env?.LOG_LEVEL)??Il}function Ul(e,t){let r=Zo(e);if(r===void 0)return t??!1;return Tr[r]>=Tr[Er()]}var jl=/^(?:[a-z][a-z0-9+.-]*:\\/\\/)?.*\\/([^/.]+)(?:\\.[^/]+)?$/i;function Do(e){if(!e)return;if(typeof e===\"string\")return e.match(jl)?.[1]??e;return Do(e.name)}function We(e){let t=Do(e);return Nl(t)}var xh=Object.freeze({status:\"aborted\"});function f(e,t,r){function n(a,c){if(!a._zod)Object.defineProperty(a,\"_zod\",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];if(!(d in a))a[d]=u[d].bind(a)}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,\"name\",{value:e});function s(a){var c;let u=r?.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,\"init\",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,\"name\",{value:e}),s}var _h=Symbol(\"zod_brand\");class ie extends Error{constructor(){super(\"Encountered Promise during synchronous parse. Use .parseAsync() instead.\")}}class Ye extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name=\"ZodEncodeError\"}}var Pt={};function J(e){if(e)Object.assign(Pt,e);return Pt}function zt(e){let t=Object.values(e).filter((n)=>typeof n===\"number\");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ar(e,t=\"|\"){return e.map((r)=>zr(r)).join(t)}function Xe(e,t){if(typeof t===\"bigint\")return t.toString();return t}function Qe(e){return{get value(){{let r=e();return Object.defineProperty(this,\"value\",{value:r}),r}throw Error(\"cached value already set\")}}}function $t(e){return e===null||e===void 0}function It(e){let t=e.startsWith(\"^\")?1:0,r=e.endsWith(\"$\")?e.length-1:e.length;return e.slice(t,r)}function Mo(e,t){let r=(e.toString().split(\".\")[1]||\"\").length,n=t.toString(),o=(n.split(\".\")[1]||\"\").length;if(o===0&&/\\d?e-\\d?/.test(n)){let c=n.match(/\\d?e-(\\d?)/);if(c?.[1])o=Number.parseInt(c[1])}let i=r>o?r:o,s=Number.parseInt(e.toFixed(i).replace(\".\",\"\")),a=Number.parseInt(t.toFixed(i).replace(\".\",\"\"));return s%a/10**i}var jo=Symbol(\"evaluating\");function w(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===jo)return;if(n===void 0)n=jo,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ye(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Or(e){return JSON.stringify(e)}function Fo(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,\"\").replace(/[\\s_-]+/g,\"-\").replace(/^-+|-+$/g,\"\")}var Pr=\"captureStackTrace\"in Error?Error.captureStackTrace:(...e)=>{};function Ce(e){return typeof e===\"object\"&&e!==null&&!Array.isArray(e)}var Bo=Qe(()=>{if(typeof navigator<\"u\"&&navigator?.userAgent?.includes(\"Cloudflare\"))return!1;try{return new Function(\"\"),!0}catch(e){return!1}});function be(e){if(Ce(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!==\"function\")return!0;let r=t.prototype;if(Ce(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,\"isPrototypeOf\")===!1)return!1;return!0}function Rr(e){if(be(e))return{...e};if(Array.isArray(e))return[...e];return e}var Vo=new Set([\"string\",\"number\",\"symbol\"]);function ue(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function te(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function y(e){let t=e;if(!t)return{};if(typeof t===\"string\")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}if(delete t.message,typeof t.error===\"string\")return{...t,error:()=>t.error};return t}function zr(e){if(typeof e===\"bigint\")return e.toString()+\"n\";if(typeof e===\"string\")return`\"${e}\"`;return`${e}`}function qo(e){return Object.keys(e).filter((t)=>e[t]._zod.optin===\"optional\"&&e[t]._zod.optout===\"optional\")}var Ko={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Bl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".pick() cannot be used on object schemas containing refinements\");let i=ce(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: \"${a}\"`);if(!t[a])continue;s[a]=r.shape[a]}return ye(this,\"shape\",s),s},checks:[]});return te(e,i)}function Vl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(\".omit() cannot be used on object schemas containing refinements\");let i=ce(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: \"${a}\"`);if(!t[a])continue;delete s[a]}return ye(this,\"shape\",s),s},checks:[]});return te(e,i)}function ql(e,t){if(!be(t))throw Error(\"Invalid input to extend: expected a plain object\");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\")}let o=ce(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ye(this,\"shape\",i),i}});return te(e,o)}function Kl(e,t){if(!be(t))throw Error(\"Invalid input to safeExtend: expected a plain object\");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ye(this,\"shape\",n),n}});return te(e,r)}function Hl(e,t){let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ye(this,\"shape\",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return te(e,r)}function Jl(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(\".partial() cannot be used on object schemas containing refinements\");let s=ce(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: \"${u}\"`);if(!r[u])continue;c[u]=e?new e({type:\"optional\",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:\"optional\",innerType:a[u]}):a[u];return ye(this,\"shape\",c),c},checks:[]});return te(t,s)}function Gl(e,t,r){let n=ce(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: \"${s}\"`);if(!r[s])continue;i[s]=new e({type:\"nonoptional\",innerType:o[s]})}else for(let s in o)i[s]=new e({type:\"nonoptional\",innerType:o[s]});return ye(this,\"shape\",i),i}});return te(t,n)}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function le(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Rt(e){return typeof e===\"string\"?e:e?.message}function re(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Rt(e.inst?._zod.def?.error?.(e))??Rt(t?.error?.(e))??Rt(r.customError?.(e))??Rt(r.localeError?.(e))??\"Invalid input\";n.message=o}if(delete n.inst,delete n.continue,!t?.reportInput)delete n.input;return n}function Lt(e){if(Array.isArray(e))return\"array\";if(typeof e===\"string\")return\"string\";return\"unknown\"}function Ho(e){let t=typeof e;switch(t){case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"object\":{if(e===null)return\"null\";if(Array.isArray(e))return\"array\";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&\"constructor\"in r&&r.constructor)return r.constructor.name}}return t}function _e(...e){let[t,r,n]=e;if(typeof t===\"string\")return{message:t,code:\"custom\",input:r,inst:n};return{...t}}var Jo=(e,t)=>{e.name=\"$ZodError\",Object.defineProperty(e,\"_zod\",{value:e._zod,enumerable:!1}),Object.defineProperty(e,\"issues\",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Xe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},Ct=f(\"$ZodError\",Jo),$r=f(\"$ZodError\",Jo,{Parent:Error});function Go(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Wo(e,t=(r)=>r.message){let r={_errors:[]},n=(o)=>{for(let i of o.issues)if(i.code===\"invalid_union\"&&i.errors.length)i.errors.map((s)=>n({issues:s}));else if(i.code===\"invalid_key\")n({issues:i.issues});else if(i.code===\"invalid_element\")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let c=i.path[a];if(a!==i.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i));s=s[c],a++}}};return n(e),r}var Nt=(e)=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new ie;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map((c)=>re(c,i,J())));throw Pr(a,o?.callee),a}return s.value};var Zt=(e)=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map((c)=>re(c,i,J())));throw Pr(a,o?.callee),a}return s.value};var et=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ie;return i.issues.length?{success:!1,error:new(e??Ct)(i.issues.map((s)=>re(s,o,J())))}:{success:!0,data:i.value}},Yo=et($r),tt=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>re(s,o,J())))}:{success:!0,data:i.value}},Xo=tt($r),Qo=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return Nt(e)(t,r,o)};var ei=(e)=>(t,r,n)=>Nt(e)(t,r,n);var ti=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return Zt(e)(t,r,o)};var ri=(e)=>async(t,r,n)=>Zt(e)(t,r,n);var ni=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return et(e)(t,r,o)};var oi=(e)=>(t,r,n)=>et(e)(t,r,n);var ii=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:\"backward\"}):{direction:\"backward\"};return tt(e)(t,r,o)};var si=(e)=>async(t,r,n)=>tt(e)(t,r,n);var ai=/^[cC][^\\s-]{8,}$/,ci=/^[0-9a-z]+$/,ui=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,li=/^[0-9a-vA-V]{20}$/,fi=/^[A-Za-z0-9]{27}$/,pi=/^[a-zA-Z0-9_-]{21}$/,di=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;var mi=/^([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})$/,Ir=(e)=>{if(!e)return/^([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)$/;return 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})$`)};var hi=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;var Yl=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\";function gi(){return new RegExp(Yl,\"u\")}var yi=/^(?:(?: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])$/,bi=/^(([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}|:))$/;var xi=/^((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])$/,_i=/^(([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])$/,vi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lr=/^[A-Za-z0-9_-]*$/;var Si=/^\\+[1-9]\\d{6,14}$/,wi=\"(?:(?:\\\\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])))\",Ti=new RegExp(`^${wi}$`);function Ei(e){return typeof e.precision===\"number\"?e.precision===-1?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d\":e.precision===0?\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\":`(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?\"}function ki(e){return new RegExp(`^${Ei(e)}$`)}function Ai(e){let t=Ei({precision:e.precision}),r=[\"Z\"];if(e.local)r.push(\"\");if(e.offset)r.push(\"([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)\");let n=`${t}(?:${r.join(\"|\")})`;return new RegExp(`^${wi}T(?:${n})$`)}var Oi=(e)=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??\"\"}}`:\"[\\\\s\\\\S]*\";return new RegExp(`^${t}$`)},Pi=/^-?\\d+n?$/,Ri=/^-?\\d+$/,Cr=/^-?\\d+(?:\\.\\d+)?$/,zi=/^(?:true|false)$/i;var $i=/^[^A-Z]*$/,Ii=/^[^a-z]*$/;var U=f(\"$ZodCheck\",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Li={number:\"number\",bigint:\"bigint\",object:\"date\"},Nr=f(\"$ZodCheckLessThan\",(e,t)=>{U.init(e,t);let r=Li[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:\"too_big\",maximum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zr=f(\"$ZodCheckGreaterThan\",(e,t)=>{U.init(e,t);let r=Li[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:\"too_small\",minimum:typeof t.value===\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ci=f(\"$ZodCheckMultipleOf\",(e,t)=>{U.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error(\"Cannot mix number and bigint in multiple_of check.\");if(typeof r.value===\"bigint\"?r.value%t.value===BigInt(0):Mo(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:\"not_multiple_of\",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ni=f(\"$ZodCheckNumberFormat\",(e,t)=>{U.init(e,t),t.format=t.format||\"float64\";let r=t.format?.includes(\"int\"),n=r?\"int\":\"number\",[o,i]=Ko[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=o,a.maximum=i,r)a.pattern=Ri}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:\"invalid_type\",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:\"too_big\",maximum:Number.MAX_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:\"too_small\",minimum:Number.MIN_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<o)s.issues.push({origin:\"number\",input:a,code:\"too_small\",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:\"number\",input:a,code:\"too_big\",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Zi=f(\"$ZodCheckMaxLength\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let s=Lt(o);n.issues.push({origin:s,code:\"too_big\",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Di=f(\"$ZodCheckMinLength\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let s=Lt(o);n.issues.push({origin:s,code:\"too_small\",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ui=f(\"$ZodCheckLengthEquals\",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!$t(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,i=o.length;if(i===t.length)return;let s=Lt(o),a=i>t.length;n.issues.push({origin:s,...a?{code:\"too_big\",maximum:t.length}:{code:\"too_small\",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),rt=f(\"$ZodCheckStringFormat\",(e,t)=>{var r,n;if(U.init(e,t),e._zod.onattach.push((o)=>{let i=o._zod.bag;if(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)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;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})});else(n=e._zod).check??(n.check=()=>{})}),ji=f(\"$ZodCheckRegex\",(e,t)=>{rt.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:\"string\",code:\"invalid_format\",format:\"regex\",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mi=f(\"$ZodCheckLowerCase\",(e,t)=>{t.pattern??(t.pattern=$i),rt.init(e,t)}),Fi=f(\"$ZodCheckUpperCase\",(e,t)=>{t.pattern??(t.pattern=Ii),rt.init(e,t)}),Bi=f(\"$ZodCheckIncludes\",(e,t)=>{U.init(e,t);let r=ue(t.includes),n=new RegExp(typeof t.position===\"number\"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:\"string\",code:\"invalid_format\",format:\"includes\",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Vi=f(\"$ZodCheckStartsWith\",(e,t)=>{U.init(e,t);let r=new RegExp(`^${ue(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"starts_with\",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),qi=f(\"$ZodCheckEndsWith\",(e,t)=>{U.init(e,t);let r=new RegExp(`.*${ue(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"ends_with\",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Ki=f(\"$ZodCheckOverwrite\",(e,t)=>{U.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Dr{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e===\"function\"){e(this,{execution:\"sync\"}),e(this,{execution:\"async\"});return}let r=e.split(`\n`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>\" \".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[\"\"]).map((o)=>` ${o}`)];return new e(...t,n.join(`\n`))}}var Ji={major:4,minor:3,patch:6};var O=f(\"$ZodType\",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ji;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has(\"$ZodCheck\"))n.unshift(e);for(let o of n)for(let 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{let o=(s,a,c)=>{let u=xe(s),l;for(let p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(u)continue;let d=s.issues.length,m=p._zod.check(s);if(m instanceof Promise&&c?.async===!1)throw new ie;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await m,s.issues.length===d)return;if(!u)u=xe(s,d)});else{if(s.issues.length===d)continue;if(!u)u=xe(s,d)}}if(l)return l.then(()=>s);return s},i=(s,a,c)=>{if(xe(s))return s.aborted=!0,s;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new ie;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction===\"backward\"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>i(l,s,a));return i(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new ie;return c.then((u)=>o(u,n,a))}return o(c,n,a)}}w(e,\"~standard\",()=>({validate:(o)=>{try{let i=Yo(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Xo(e,o).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:\"zod\",version:1}))}),Mt=f(\"$ZodString\",(e,t)=>{O.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Oi(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value===\"string\")return r;return r.issues.push({expected:\"string\",code:\"invalid_type\",input:r.value,inst:e}),r}}),z=f(\"$ZodStringFormat\",(e,t)=>{rt.init(e,t),Mt.init(e,t)}),ns=f(\"$ZodGUID\",(e,t)=>{t.pattern??(t.pattern=mi),z.init(e,t)}),os=f(\"$ZodUUID\",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: \"${t.version}\"`);t.pattern??(t.pattern=Ir(n))}else t.pattern??(t.pattern=Ir());z.init(e,t)}),is=f(\"$ZodEmail\",(e,t)=>{t.pattern??(t.pattern=hi),z.init(e,t)}),ss=f(\"$ZodURL\",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=new URL(n);if(t.hostname){if(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})}if(t.protocol){if(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})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort})}}}),as=f(\"$ZodEmoji\",(e,t)=>{t.pattern??(t.pattern=gi()),z.init(e,t)}),cs=f(\"$ZodNanoID\",(e,t)=>{t.pattern??(t.pattern=pi),z.init(e,t)}),us=f(\"$ZodCUID\",(e,t)=>{t.pattern??(t.pattern=ai),z.init(e,t)}),ls=f(\"$ZodCUID2\",(e,t)=>{t.pattern??(t.pattern=ci),z.init(e,t)}),fs=f(\"$ZodULID\",(e,t)=>{t.pattern??(t.pattern=ui),z.init(e,t)}),ps=f(\"$ZodXID\",(e,t)=>{t.pattern??(t.pattern=li),z.init(e,t)}),ds=f(\"$ZodKSUID\",(e,t)=>{t.pattern??(t.pattern=fi),z.init(e,t)}),ms=f(\"$ZodISODateTime\",(e,t)=>{t.pattern??(t.pattern=Ai(t)),z.init(e,t)}),hs=f(\"$ZodISODate\",(e,t)=>{t.pattern??(t.pattern=Ti),z.init(e,t)}),gs=f(\"$ZodISOTime\",(e,t)=>{t.pattern??(t.pattern=ki(t)),z.init(e,t)}),ys=f(\"$ZodISODuration\",(e,t)=>{t.pattern??(t.pattern=di),z.init(e,t)}),bs=f(\"$ZodIPv4\",(e,t)=>{t.pattern??(t.pattern=yi),z.init(e,t),e._zod.bag.format=\"ipv4\"}),xs=f(\"$ZodIPv6\",(e,t)=>{t.pattern??(t.pattern=bi),z.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})}}});var _s=f(\"$ZodCIDRv4\",(e,t)=>{t.pattern??(t.pattern=xi),z.init(e,t)}),vs=f(\"$ZodCIDRv6\",(e,t)=>{t.pattern??(t.pattern=_i),z.init(e,t),e._zod.check=(r)=>{let n=r.value.split(\"/\");try{if(n.length!==2)throw Error();let[o,i]=n;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:\"invalid_format\",format:\"cidrv6\",input:r.value,inst:e,continue:!t.abort})}}});function Ss(e){if(e===\"\")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ws=f(\"$ZodBase64\",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t),e._zod.bag.contentEncoding=\"base64\",e._zod.check=(r)=>{if(Ss(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64\",input:r.value,inst:e,continue:!t.abort})}});function Xl(e){if(!Lr.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n===\"-\"?\"+\":\"/\"),r=t.padEnd(Math.ceil(t.length/4)*4,\"=\");return Ss(r)}var Ts=f(\"$ZodBase64URL\",(e,t)=>{t.pattern??(t.pattern=Lr),z.init(e,t),e._zod.bag.contentEncoding=\"base64url\",e._zod.check=(r)=>{if(Xl(r.value))return;r.issues.push({code:\"invalid_format\",format:\"base64url\",input:r.value,inst:e,continue:!t.abort})}}),Es=f(\"$ZodE164\",(e,t)=>{t.pattern??(t.pattern=Si),z.init(e,t)});function Ql(e,t=null){try{let r=e.split(\".\");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if(\"typ\"in o&&o?.typ!==\"JWT\")return!1;if(!o.alg)return!1;if(t&&(!(\"alg\"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var ks=f(\"$ZodJWT\",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{if(Ql(r.value,t.alg))return;r.issues.push({code:\"invalid_format\",format:\"jwt\",input:r.value,inst:e,continue:!t.abort})}});var jr=f(\"$ZodNumber\",(e,t)=>{O.init(e,t),e._zod.pattern=e._zod.bag.pattern??Cr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o===\"number\"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o===\"number\"?Number.isNaN(o)?\"NaN\":!Number.isFinite(o)?\"Infinity\":void 0:void 0;return r.issues.push({expected:\"number\",code:\"invalid_type\",input:o,inst:e,...i?{received:i}:{}}),r}}),As=f(\"$ZodNumberFormat\",(e,t)=>{Ni.init(e,t),jr.init(e,t)}),Os=f(\"$ZodBoolean\",(e,t)=>{O.init(e,t),e._zod.pattern=zi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o===\"boolean\")return r;return r.issues.push({expected:\"boolean\",code:\"invalid_type\",input:o,inst:e}),r}}),Ps=f(\"$ZodBigInt\",(e,t)=>{O.init(e,t),e._zod.pattern=Pi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(o){}if(typeof r.value===\"bigint\")return r;return r.issues.push({expected:\"bigint\",code:\"invalid_type\",input:r.value,inst:e}),r}});var Rs=f(\"$ZodUnknown\",(e,t)=>{O.init(e,t),e._zod.parse=(r)=>r}),zs=f(\"$ZodNever\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:\"never\",code:\"invalid_type\",input:r.value,inst:e}),r)});var $s=f(\"$ZodDate\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:\"date\",code:\"invalid_type\",input:o,...i?{received:\"Invalid Date\"}:{},inst:e}),r}});function Gi(e,t,r){if(e.issues.length)t.issues.push(...le(r,e.issues));t.value[r]=e.value}var Is=f(\"$ZodArray\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let 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);let i=[];for(let s=0;s<o.length;s++){let a=o[s],c=t.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)i.push(c.then((u)=>Gi(u,r,s)));else Gi(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});function jt(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...le(r,e.issues))}if(e.value===void 0){if(r in n)t.value[r]=void 0}else t.value[r]=e.value}function Ls(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(\"$ZodType\"))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let r=qo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Cs(e,t,r,n,o,i){let s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout===\"optional\";for(let p in t){if(a.has(p))continue;if(u===\"never\"){s.push(p);continue}let d=c.run({value:t[p],issues:[]},n);if(d instanceof Promise)e.push(d.then((m)=>jt(m,r,p,t,l)));else jt(d,r,p,t,l)}if(s.length)r.issues.push({code:\"unrecognized_keys\",keys:s,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ef=f(\"$ZodObject\",(e,t)=>{if(O.init(e,t),!Object.getOwnPropertyDescriptor(t,\"shape\")?.get){let a=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let c={...a};return Object.defineProperty(t,\"shape\",{value:c}),c}})}let n=Qe(()=>Ls(t));w(e._zod,\"propValues\",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let o=Ce,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:\"object\",code:\"invalid_type\",input:u,inst:e}),a;a.value={};let l=[],p=s.shape;for(let d of s.keys){let m=p[d],g=m._zod.optout===\"optional\",h=m._zod.run({value:u[d],issues:[]},c);if(h instanceof Promise)l.push(h.then((v)=>jt(v,a,d,u,g)));else jt(h,a,d,u,g)}if(!i)return l.length?Promise.all(l).then(()=>a):a;return Cs(l,u,a,c,n.value,e)}}),Ns=f(\"$ZodObjectJIT\",(e,t)=>{ef.init(e,t);let r=e._zod.parse,n=Qe(()=>Ls(t)),o=(d)=>{let m=new Dr([\"shape\",\"payload\",\"ctx\"]),g=n.value,h=(b)=>{let E=Or(b);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};m.write(\"const input = payload.value;\");let v=Object.create(null),_=0;for(let b of g.keys)v[b]=`key_${_++}`;m.write(\"const newResult = {};\");for(let b of g.keys){let E=v[b],k=Or(b),x=d[b]?._zod?.optout===\"optional\";if(m.write(`const ${E} = ${h(b)};`),x)m.write(`\n if (${E}.issues.length) {\n if (${k} in input) {\n payload.issues = payload.issues.concat(${E}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n }\n \n if (${E}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${E}.value;\n }\n \n `);else m.write(`\n if (${E}.issues.length) {\n payload.issues = payload.issues.concat(${E}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n \n if (${E}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${E}.value;\n }\n \n `)}m.write(\"payload.value = newResult;\"),m.write(\"return payload;\");let A=m.compile();return(b,E)=>A(d,b,E)},i,s=Ce,a=!Pt.jitless,u=a&&Bo.value,l=t.catchall,p;e._zod.parse=(d,m)=>{p??(p=n.value);let g=d.value;if(!s(g))return d.issues.push({expected:\"object\",code:\"invalid_type\",input:g,inst:e}),d;if(a&&u&&m?.async===!1&&m.jitless!==!0){if(!i)i=o(t.shape);if(d=i(d,m),!l)return d;return Cs([],g,d,m,p,e)}return r(d,m)}});function Wi(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!xe(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:\"invalid_union\",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>re(s,n,J())))}),t}var Mr=f(\"$ZodUnion\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.options.some((o)=>o._zod.optin===\"optional\")?\"optional\":void 0),w(e._zod,\"optout\",()=>t.options.some((o)=>o._zod.optout===\"optional\")?\"optional\":void 0),w(e._zod,\"values\",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),w(e._zod,\"pattern\",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>It(i.source)).join(\"|\")})$`)}return});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1,a=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!s)return Wi(a,o,e,i);return Promise.all(a).then((c)=>Wi(c,o,e,i))}});var Zs=f(\"$ZodDiscriminatedUnion\",(e,t)=>{t.inclusive=!1,Mr.init(e,t);let r=e._zod.parse;w(e._zod,\"propValues\",()=>{let o={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index \"${t.options.indexOf(i)}\"`);for(let[a,c]of Object.entries(s)){if(!o[a])o[a]=new Set;for(let u of c)o[a].add(u)}}return o});let n=Qe(()=>{let o=t.options,i=new Map;for(let s of o){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index \"${t.options.indexOf(s)}\"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value \"${String(c)}\"`);i.set(c,s)}}return i});e._zod.parse=(o,i)=>{let s=o.value;if(!Ce(s))return o.issues.push({code:\"invalid_type\",expected:\"object\",input:s,inst:e}),o;let a=n.value.get(s?.[t.discriminator]);if(a)return a._zod.run(o,i);if(t.unionFallback)return r(o,i);return o.issues.push({code:\"invalid_union\",errors:[],note:\"No matching discriminator\",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o}}),Ds=f(\"$ZodIntersection\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>Yi(r,c,u));return Yi(r,i,s)}});function Ur(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(be(e)&&be(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let s=Ur(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Ur(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yi(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code===\"unrecognized_keys\"){o??(o=a);for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code===\"unrecognized_keys\")for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(a);let i=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o)e.issues.push({...o,keys:i});if(xe(e))return e;let s=Ur(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Us=f(\"$ZodRecord\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!be(o))return r.issues.push({expected:\"record\",code:\"invalid_type\",input:o,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u===\"string\"||typeof u===\"number\"||typeof u===\"symbol\"){a.add(typeof u===\"number\"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>{if(p.issues.length)r.issues.push(...le(u,p.issues));r.value[u]=p.value}));else{if(l.issues.length)r.issues.push(...le(u,l.issues));r.value[u]=l.value}}let c;for(let u in o)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:\"unrecognized_keys\",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a===\"__proto__\")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw Error(\"Async schemas not supported in object keys currently\");if(typeof a===\"string\"&&Cr.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},n);if(p instanceof Promise)throw Error(\"Async schemas not supported in object keys currently\");if(p.issues.length===0)c=p}if(c.issues.length){if(t.mode===\"loose\")r.value[a]=o[a];else r.issues.push({code:\"invalid_key\",origin:\"record\",issues:c.issues.map((p)=>re(p,n,J())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>{if(p.issues.length)r.issues.push(...le(a,p.issues));r.value[c.value]=p.value}));else{if(l.issues.length)r.issues.push(...le(a,l.issues));r.value[c.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}});var js=f(\"$ZodEnum\",(e,t)=>{O.init(e,t);let r=zt(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>Vo.has(typeof o)).map((o)=>typeof o===\"string\"?ue(o):o.toString()).join(\"|\")})$`),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:\"invalid_value\",values:r,input:s,inst:e}),o}}),Ms=f(\"$ZodLiteral\",(e,t)=>{if(O.init(e,t),t.values.length===0)throw Error(\"Cannot create literal schema with no valid values\");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n===\"string\"?ue(n):n?ue(n.toString()):String(n)).join(\"|\")})$`),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:\"invalid_value\",values:t.values,input:i,inst:e}),n}});var Fs=f(\"$ZodTransform\",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Ye(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new ie;return r.value=o,r}});function Xi(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Fr=f(\"$ZodOptional\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",e._zod.optout=\"optional\",w(e._zod,\"values\",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),w(e._zod,\"pattern\",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${It(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin===\"optional\"){let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Xi(i,r.value));return Xi(o,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Bs=f(\"$ZodExactOptional\",(e,t)=>{Fr.init(e,t),w(e._zod,\"values\",()=>t.innerType._zod.values),w(e._zod,\"pattern\",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Vs=f(\"$ZodNullable\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.innerType._zod.optin),w(e._zod,\"optout\",()=>t.innerType._zod.optout),w(e._zod,\"pattern\",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${It(r.source)}|null)$`):void 0}),w(e._zod,\"values\",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),qs=f(\"$ZodDefault\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",w(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;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Qi(i,t));return Qi(o,t)}});function Qi(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ks=f(\"$ZodPrefault\",(e,t)=>{O.init(e,t),e._zod.optin=\"optional\",w(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)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Hs=f(\"$ZodNonOptional\",(e,t)=>{O.init(e,t),w(e._zod,\"values\",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>es(i,e));return es(o,e)}});function es(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:e.value,inst:t});return e}var Js=f(\"$ZodCatch\",(e,t)=>{O.init(e,t),w(e._zod,\"optin\",()=>t.innerType._zod.optin),w(e._zod,\"optout\",()=>t.innerType._zod.optout),w(e._zod,\"values\",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>re(s,n,J()))},input:r.value}),r.issues=[];return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((i)=>re(i,n,J()))},input:r.value}),r.issues=[];return r}});var Gs=f(\"$ZodPipe\",(e,t)=>{O.init(e,t),w(e._zod,\"values\",()=>t.in._zod.values),w(e._zod,\"optin\",()=>t.in._zod.optin),w(e._zod,\"optout\",()=>t.out._zod.optout),w(e._zod,\"propValues\",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction===\"backward\"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Ut(s,t.in,n));return Ut(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ut(i,t.out,n));return Ut(o,t.out,n)}});function Ut(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Ws=f(\"$ZodReadonly\",(e,t)=>{O.init(e,t),w(e._zod,\"propValues\",()=>t.innerType._zod.propValues),w(e._zod,\"values\",()=>t.innerType._zod.values),w(e._zod,\"optin\",()=>t.innerType?._zod?.optin),w(e._zod,\"optout\",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(ts);return ts(o)}});function ts(e){return e.value=Object.freeze(e.value),e}var Ys=f(\"$ZodCustom\",(e,t)=>{U.init(e,t),O.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>rs(i,r,n,e));rs(o,r,n,e);return}});function rs(e,t,r,n){if(!e){let o={code:\"custom\",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(_e(o))}}var tf=()=>{let e={string:{unit:\"characters\",verb:\"to have\"},file:{unit:\"bytes\",verb:\"to have\"},array:{unit:\"items\",verb:\"to have\"},set:{unit:\"items\",verb:\"to have\"},map:{unit:\"entries\",verb:\"to have\"}};function t(o){return e[o]??null}let r={regex:\"input\",email:\"email address\",url:\"URL\",emoji:\"emoji\",uuid:\"UUID\",uuidv4:\"UUIDv4\",uuidv6:\"UUIDv6\",nanoid:\"nanoid\",guid:\"GUID\",cuid:\"cuid\",cuid2:\"cuid2\",ulid:\"ULID\",xid:\"XID\",ksuid:\"KSUID\",datetime:\"ISO datetime\",date:\"ISO date\",time:\"ISO time\",duration:\"ISO duration\",ipv4:\"IPv4 address\",ipv6:\"IPv6 address\",mac:\"MAC address\",cidrv4:\"IPv4 range\",cidrv6:\"IPv6 range\",base64:\"base64-encoded string\",base64url:\"base64url-encoded string\",json_string:\"JSON string\",e164:\"E.164 number\",jwt:\"JWT\",template_literal:\"input\"},n={nan:\"NaN\"};return(o)=>{switch(o.code){case\"invalid_type\":{let i=n[o.expected]??o.expected,s=Ho(o.input),a=n[s]??s;return`Invalid input: expected ${i}, received ${a}`}case\"invalid_value\":if(o.values.length===1)return`Invalid input: expected ${zr(o.values[0])}`;return`Invalid option: expected one of ${Ar(o.values,\"|\")}`;case\"too_big\":{let i=o.inclusive?\"<=\":\"<\",s=t(o.origin);if(s)return`Too big: expected ${o.origin??\"value\"} to have ${i}${o.maximum.toString()} ${s.unit??\"elements\"}`;return`Too big: expected ${o.origin??\"value\"} to be ${i}${o.maximum.toString()}`}case\"too_small\":{let i=o.inclusive?\">=\":\">\",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case\"invalid_format\":{let i=o;if(i.format===\"starts_with\")return`Invalid string: must start with \"${i.prefix}\"`;if(i.format===\"ends_with\")return`Invalid string: must end with \"${i.suffix}\"`;if(i.format===\"includes\")return`Invalid string: must include \"${i.includes}\"`;if(i.format===\"regex\")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??o.format}`}case\"not_multiple_of\":return`Invalid number: must be a multiple of ${o.divisor}`;case\"unrecognized_keys\":return`Unrecognized key${o.keys.length>1?\"s\":\"\"}: ${Ar(o.keys,\", \")}`;case\"invalid_key\":return`Invalid key in ${o.origin}`;case\"invalid_union\":return\"Invalid input\";case\"invalid_element\":return`Invalid value in ${o.origin}`;default:return\"Invalid input\"}}};function Br(){return{localeError:tf()}}var Xs,jh=Symbol(\"ZodOutput\"),Mh=Symbol(\"ZodInput\");class Qs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r===\"object\"&&\"id\"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t===\"object\"&&\"id\"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function rf(){return new Qs}(Xs=globalThis).__zod_globalRegistry??(Xs.__zod_globalRegistry=rf());var ve=globalThis.__zod_globalRegistry;function ea(e,t){return new e({type:\"string\",...y(t)})}function ta(e,t){return new e({type:\"string\",coerce:!0,...y(t)})}function ra(e,t){return new e({type:\"string\",format:\"email\",check:\"string_format\",abort:!1,...y(t)})}function Vr(e,t){return new e({type:\"string\",format:\"guid\",check:\"string_format\",abort:!1,...y(t)})}function na(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,...y(t)})}function oa(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v4\",...y(t)})}function ia(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v6\",...y(t)})}function sa(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v7\",...y(t)})}function aa(e,t){return new e({type:\"string\",format:\"url\",check:\"string_format\",abort:!1,...y(t)})}function ca(e,t){return new e({type:\"string\",format:\"emoji\",check:\"string_format\",abort:!1,...y(t)})}function ua(e,t){return new e({type:\"string\",format:\"nanoid\",check:\"string_format\",abort:!1,...y(t)})}function la(e,t){return new e({type:\"string\",format:\"cuid\",check:\"string_format\",abort:!1,...y(t)})}function fa(e,t){return new e({type:\"string\",format:\"cuid2\",check:\"string_format\",abort:!1,...y(t)})}function pa(e,t){return new e({type:\"string\",format:\"ulid\",check:\"string_format\",abort:!1,...y(t)})}function da(e,t){return new e({type:\"string\",format:\"xid\",check:\"string_format\",abort:!1,...y(t)})}function ma(e,t){return new e({type:\"string\",format:\"ksuid\",check:\"string_format\",abort:!1,...y(t)})}function ha(e,t){return new e({type:\"string\",format:\"ipv4\",check:\"string_format\",abort:!1,...y(t)})}function ga(e,t){return new e({type:\"string\",format:\"ipv6\",check:\"string_format\",abort:!1,...y(t)})}function ya(e,t){return new e({type:\"string\",format:\"cidrv4\",check:\"string_format\",abort:!1,...y(t)})}function ba(e,t){return new e({type:\"string\",format:\"cidrv6\",check:\"string_format\",abort:!1,...y(t)})}function xa(e,t){return new e({type:\"string\",format:\"base64\",check:\"string_format\",abort:!1,...y(t)})}function _a(e,t){return new e({type:\"string\",format:\"base64url\",check:\"string_format\",abort:!1,...y(t)})}function va(e,t){return new e({type:\"string\",format:\"e164\",check:\"string_format\",abort:!1,...y(t)})}function Sa(e,t){return new e({type:\"string\",format:\"jwt\",check:\"string_format\",abort:!1,...y(t)})}function wa(e,t){return new e({type:\"string\",format:\"datetime\",check:\"string_format\",offset:!1,local:!1,precision:null,...y(t)})}function Ta(e,t){return new e({type:\"string\",format:\"date\",check:\"string_format\",...y(t)})}function Ea(e,t){return new e({type:\"string\",format:\"time\",check:\"string_format\",precision:null,...y(t)})}function ka(e,t){return new e({type:\"string\",format:\"duration\",check:\"string_format\",...y(t)})}function Aa(e,t){return new e({type:\"number\",checks:[],...y(t)})}function Oa(e,t){return new e({type:\"number\",coerce:!0,checks:[],...y(t)})}function Pa(e,t){return new e({type:\"number\",check:\"number_format\",abort:!1,format:\"safeint\",...y(t)})}function Ra(e,t){return new e({type:\"boolean\",...y(t)})}function za(e,t){return new e({type:\"boolean\",coerce:!0,...y(t)})}function $a(e,t){return new e({type:\"bigint\",coerce:!0,...y(t)})}function Ia(e){return new e({type:\"unknown\"})}function La(e,t){return new e({type:\"never\",...y(t)})}function Ca(e,t){return new e({type:\"date\",coerce:!0,...y(t)})}function Ne(e,t){return new Nr({check:\"less_than\",...y(t),value:e,inclusive:!1})}function ae(e,t){return new Nr({check:\"less_than\",...y(t),value:e,inclusive:!0})}function Ze(e,t){return new Zr({check:\"greater_than\",...y(t),value:e,inclusive:!1})}function Y(e,t){return new Zr({check:\"greater_than\",...y(t),value:e,inclusive:!0})}function nt(e,t){return new Ci({check:\"multiple_of\",...y(t),value:e})}function Ft(e,t){return new Zi({check:\"max_length\",...y(t),maximum:e})}function De(e,t){return new Di({check:\"min_length\",...y(t),minimum:e})}function Bt(e,t){return new Ui({check:\"length_equals\",...y(t),length:e})}function qr(e,t){return new ji({check:\"string_format\",format:\"regex\",...y(t),pattern:e})}function Kr(e){return new Mi({check:\"string_format\",format:\"lowercase\",...y(e)})}function Hr(e){return new Fi({check:\"string_format\",format:\"uppercase\",...y(e)})}function Jr(e,t){return new Bi({check:\"string_format\",format:\"includes\",...y(t),includes:e})}function Gr(e,t){return new Vi({check:\"string_format\",format:\"starts_with\",...y(t),prefix:e})}function Wr(e,t){return new qi({check:\"string_format\",format:\"ends_with\",...y(t),suffix:e})}function fe(e){return new Ki({check:\"overwrite\",tx:e})}function Yr(e){return fe((t)=>t.normalize(e))}function Xr(){return fe((e)=>e.trim())}function Qr(){return fe((e)=>e.toLowerCase())}function en(){return fe((e)=>e.toUpperCase())}function tn(){return fe((e)=>Fo(e))}function Na(e,t,r){return new e({type:\"array\",element:t,...y(r)})}function Za(e,t,r){return new e({type:\"custom\",check:\"custom\",fn:t,...y(r)})}function Da(e){let t=nf((r)=>(r.addIssue=(n)=>{if(typeof n===\"string\")r.issues.push(_e(n,r.value,t._zod.def));else{let o=n;if(o.fatal)o.continue=!1;o.code??(o.code=\"custom\"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(_e(o))}},e(r.value,r)));return t}function nf(e,t){let r=new U({check:\"custom\",...y(t)});return r._zod.check=e,r}function rn(e){let t=e?.target??\"draft-2020-12\";if(t===\"draft-4\")t=\"draft-04\";if(t===\"draft-7\")t=\"draft-07\";return{processors:e.processors??{},metadataRegistry:e?.metadata??ve,target:t,unrepresentable:e?.unrepresentable??\"throw\",override:e?.override??(()=>{}),io:e?.io??\"output\",counter:0,seen:new Map,cycles:e?.cycles??\"ref\",reused:e?.reused??\"inline\",external:e?.external??void 0}}function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,l),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(s.schema,c);if(t.io===\"input\"&&F(e))delete s.schema.examples,delete s.schema.default;if(t.io===\"input\"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function nn(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id \"${a}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=(s)=>{let a=e.target===\"draft-2020-12\"?\"$defs\":\"definitions\";if(e.external){let p=e.external.registry.get(s[0])?.id,d=e.external.uri??((g)=>g);if(p)return{ref:d(p)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d(\"__shared\")}#/${a}/${m}`}}if(s[1]===r)return{ref:\"#\"};let u=`${\"#\"}/${a}/`,l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles===\"throw\")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join(\"/\")}/<root>\n\nSet the \\`cycles\\` parameter to \\`\"ref\"\\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused===\"ref\"){i(s);continue}}}}function on(e,t){let r=e.seen.get(t);if(!r)throw Error(\"Unprocessed schema. This is a bug in Zod.\");let n=(s)=>{let a=e.seen.get(s);if(a.ref===null)return;let c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);let d=e.seen.get(l),m=d.schema;if(m.$ref&&(e.target===\"draft-07\"||e.target===\"draft-04\"||e.target===\"openapi-3.0\"))c.allOf=c.allOf??[],c.allOf.push(m);else Object.assign(c,m);if(Object.assign(c,u),s._zod.parent===l)for(let h in c){if(h===\"$ref\"||h===\"allOf\")continue;if(!(h in u))delete c[h]}if(m.$ref&&d.def)for(let h in c){if(h===\"$ref\"||h===\"allOf\")continue;if(h in d.def&&JSON.stringify(c[h])===JSON.stringify(d.def[h]))delete c[h]}}let p=s._zod.parent;if(p&&p!==l){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(c.$ref=d.schema.$ref,d.def)for(let m in c){if(m===\"$ref\"||m===\"allOf\")continue;if(m in d.def&&JSON.stringify(c[m])===JSON.stringify(d.def[m]))delete c[m]}}}e.override({zodSchema:s,jsonSchema:c,path:a.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let o={};if(e.target===\"draft-2020-12\")o.$schema=\"https://json-schema.org/draft/2020-12/schema\";else if(e.target===\"draft-07\")o.$schema=\"http://json-schema.org/draft-07/schema#\";else if(e.target===\"draft-04\")o.$schema=\"http://json-schema.org/draft-04/schema#\";else if(e.target===\"openapi-3.0\");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error(\"Schema is missing an `id` property\");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let s of e.seen.entries()){let a=s[1];if(a.def&&a.defId)i[a.defId]=a.def}if(e.external);else if(Object.keys(i).length>0)if(e.target===\"draft-2020-12\")o.$defs=i;else o.definitions=i;try{let s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,\"~standard\",{value:{...t[\"~standard\"],jsonSchema:{input:ot(t,\"input\",e.processors),output:ot(t,\"output\",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error(\"Error converting schema to JSON.\")}}function F(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type===\"transform\")return!0;if(n.type===\"array\")return F(n.element,r);if(n.type===\"set\")return F(n.valueType,r);if(n.type===\"lazy\")return F(n.getter(),r);if(n.type===\"promise\"||n.type===\"optional\"||n.type===\"nonoptional\"||n.type===\"nullable\"||n.type===\"readonly\"||n.type===\"default\"||n.type===\"prefault\")return F(n.innerType,r);if(n.type===\"intersection\")return F(n.left,r)||F(n.right,r);if(n.type===\"record\"||n.type===\"map\")return F(n.keyType,r)||F(n.valueType,r);if(n.type===\"pipe\")return F(n.in,r)||F(n.out,r);if(n.type===\"object\"){for(let o in n.shape)if(F(n.shape[o],r))return!0;return!1}if(n.type===\"union\"){for(let o of n.options)if(F(o,r))return!0;return!1}if(n.type===\"tuple\"){for(let o of n.items)if(F(o,r))return!0;if(n.rest&&F(n.rest,r))return!0;return!1}return!1}var Ua=(e,t={})=>(r)=>{let n=rn({...r,processors:t});return D(e,n),nn(n,e),on(n,e)},ot=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=rn({...o??{},target:i,io:t,processors:r});return D(e,s),nn(s,e),on(s,e)};var of={guid:\"uuid\",url:\"uri\",datetime:\"date-time\",json_string:\"json-string\",regex:\"\"},ja=(e,t,r,n)=>{let o=r;o.type=\"string\";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i===\"number\")o.minLength=i;if(typeof s===\"number\")o.maxLength=s;if(a){if(o.format=of[a]??a,o.format===\"\")delete o.format;if(a===\"time\")delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)o.pattern=l[0].source;else if(l.length>1)o.allOf=[...l.map((p)=>({...t.target===\"draft-07\"||t.target===\"draft-04\"||t.target===\"openapi-3.0\"?{type:\"string\"}:{},pattern:p.source}))]}},Ma=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a===\"string\"&&a.includes(\"int\"))o.type=\"integer\";else o.type=\"number\";if(typeof l===\"number\")if(t.target===\"draft-04\"||t.target===\"openapi-3.0\")o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;if(typeof i===\"number\"){if(o.minimum=i,typeof l===\"number\"&&t.target!==\"draft-04\")if(l>=i)delete o.minimum;else delete o.exclusiveMinimum}if(typeof u===\"number\")if(t.target===\"draft-04\"||t.target===\"openapi-3.0\")o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;if(typeof s===\"number\"){if(o.maximum=s,typeof u===\"number\"&&t.target!==\"draft-04\")if(u<=s)delete o.maximum;else delete o.exclusiveMaximum}if(typeof c===\"number\")o.multipleOf=c},Fa=(e,t,r,n)=>{r.type=\"boolean\"},Ba=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"BigInt cannot be represented in JSON Schema\")};var Va=(e,t,r,n)=>{r.not={}};var qa=(e,t,r,n)=>{},Ka=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Date cannot be represented in JSON Schema\")},Ha=(e,t,r,n)=>{let o=e._zod.def,i=zt(o.entries);if(i.every((s)=>typeof s===\"number\"))r.type=\"number\";if(i.every((s)=>typeof s===\"string\"))r.type=\"string\";r.enum=i},Ja=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let s of o.values)if(s===void 0){if(t.unrepresentable===\"throw\")throw Error(\"Literal `undefined` cannot be represented in JSON Schema\")}else if(typeof s===\"bigint\")if(t.unrepresentable===\"throw\")throw Error(\"BigInt literals cannot be represented in JSON Schema\");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?\"null\":typeof s,t.target===\"draft-04\"||t.target===\"openapi-3.0\")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s===\"number\"))r.type=\"number\";if(i.every((s)=>typeof s===\"string\"))r.type=\"string\";if(i.every((s)=>typeof s===\"boolean\"))r.type=\"boolean\";if(i.every((s)=>s===null))r.type=\"null\";r.enum=i}};var Ga=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Custom types cannot be represented in JSON Schema\")};var Wa=(e,t,r,n)=>{if(t.unrepresentable===\"throw\")throw Error(\"Transforms cannot be represented in JSON Schema\")};var Ya=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s===\"number\")o.minItems=s;if(typeof a===\"number\")o.maxItems=a;o.type=\"array\",o.items=D(i.element,t,{...n,path:[...n.path,\"items\"]})},Xa=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type=\"object\",o.properties={};let s=i.shape;for(let u in s)o.properties[u]=D(s[u],t,{...n,path:[...n.path,\"properties\",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter((u)=>{let l=i.shape[u]._zod;if(t.io===\"input\")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(i.catchall?._zod.def.type===\"never\")o.additionalProperties=!1;else if(!i.catchall){if(t.io===\"output\")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,\"additionalProperties\"]})},Qa=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...n,path:[...n.path,i?\"oneOf\":\"anyOf\",c]}));if(i)r.oneOf=s;else r.anyOf=s},ec=(e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,\"allOf\",0]}),s=D(o.right,t,{...n,path:[...n.path,\"allOf\",1]}),a=(u)=>(\"allOf\"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c};var tc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type=\"object\";let s=i.keyType,c=s._zod.bag?.patterns;if(i.mode===\"loose\"&&c&&c.size>0){let l=D(i.valueType,t,{...n,path:[...n.path,\"patternProperties\",\"*\"]});o.patternProperties={};for(let p of c)o.patternProperties[p.source]=l}else{if(t.target===\"draft-07\"||t.target===\"draft-2020-12\")o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,\"propertyNames\"]});o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,\"additionalProperties\"]})}let u=s._zod.values;if(u){let l=[...u].filter((p)=>typeof p===\"string\"||typeof p===\"number\");if(l.length>0)o.required=l}},rc=(e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),s=t.seen.get(e);if(t.target===\"openapi-3.0\")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:\"null\"}]},nc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},oc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ic=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io===\"input\")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},sc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw Error(\"Dynamic catch values are not supported in JSON Schema\")}r.default=s},ac=(e,t,r,n)=>{let o=e._zod.def,i=t.io===\"input\"?o.in._zod.def.type===\"transform\"?o.out:o.in:o.out;D(i,t,n);let s=t.seen.get(e);s.ref=i},cc=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var sn=(e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var df=f(\"ZodISODateTime\",(e,t)=>{ms.init(e,t),L.init(e,t)});function uc(e){return wa(df,e)}var mf=f(\"ZodISODate\",(e,t)=>{hs.init(e,t),L.init(e,t)});function lc(e){return Ta(mf,e)}var hf=f(\"ZodISOTime\",(e,t)=>{gs.init(e,t),L.init(e,t)});function fc(e){return Ea(hf,e)}var gf=f(\"ZodISODuration\",(e,t)=>{ys.init(e,t),L.init(e,t)});function pc(e){return ka(gf,e)}var hc=(e,t)=>{Ct.init(e,t),e.name=\"ZodError\",Object.defineProperties(e,{format:{value:(r)=>Wo(e,r)},flatten:{value:(r)=>Go(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Xe,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Xe,2)}},isEmpty:{get(){return e.issues.length===0}}})},yg=f(\"ZodError\",hc),K=f(\"ZodError\",hc,{Parent:Error});var gc=Nt(K),yc=Zt(K),bc=et(K),xc=tt(K),_c=Qo(K),vc=ei(K),Sc=ti(K),wc=ri(K),Tc=ni(K),Ec=oi(K),kc=ii(K),Ac=si(K);var I=f(\"ZodType\",(e,t)=>(O.init(e,t),Object.assign(e[\"~standard\"],{jsonSchema:{input:ot(e,\"input\"),output:ot(e,\"output\")}}),e.toJSONSchema=Ua(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,\"_def\",{value:t}),e.check=(...r)=>e.clone(ce(t,{checks:[...t.checks??[],...r.map((n)=>typeof n===\"function\"?{_zod:{check:n,def:{check:\"custom\"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>te(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>gc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>bc(e,r,n),e.parseAsync=async(r,n)=>yc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>xc(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_c(e,r,n),e.decode=(r,n)=>vc(e,r,n),e.encodeAsync=async(r,n)=>Sc(e,r,n),e.decodeAsync=async(r,n)=>wc(e,r,n),e.safeEncode=(r,n)=>Tc(e,r,n),e.safeDecode=(r,n)=>Ec(e,r,n),e.safeEncodeAsync=async(r,n)=>kc(e,r,n),e.safeDecodeAsync=async(r,n)=>Ac(e,r,n),e.refine=(r,n)=>e.check(fp(r,n)),e.superRefine=(r)=>e.check(pp(r)),e.overwrite=(r)=>e.check(fe(r)),e.optional=()=>Rc(e),e.exactOptional=()=>Xf(e),e.nullable=()=>zc(e),e.nullish=()=>Rc(zc(e)),e.nonoptional=(r)=>op(e,r),e.array=()=>je(e),e.or=(r)=>Mf([e,r]),e.and=(r)=>qf(e,r),e.transform=(r)=>$c(e,Wf(r)),e.default=(r)=>tp(e,r),e.prefault=(r)=>np(e,r),e.catch=(r)=>sp(e,r),e.pipe=(r)=>$c(e,r),e.readonly=()=>up(e),e.describe=(r)=>{let n=e.clone();return ve.add(n,{description:r}),n},Object.defineProperty(e,\"description\",{get(){return ve.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ve.get(e);let n=e.clone();return ve.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),Ic=f(\"_ZodString\",(e,t)=>{Mt.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ja(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(qr(...n)),e.includes=(...n)=>e.check(Jr(...n)),e.startsWith=(...n)=>e.check(Gr(...n)),e.endsWith=(...n)=>e.check(Wr(...n)),e.min=(...n)=>e.check(De(...n)),e.max=(...n)=>e.check(Ft(...n)),e.length=(...n)=>e.check(Bt(...n)),e.nonempty=(...n)=>e.check(De(1,...n)),e.lowercase=(n)=>e.check(Kr(n)),e.uppercase=(n)=>e.check(Hr(n)),e.trim=()=>e.check(Xr()),e.normalize=(...n)=>e.check(Yr(...n)),e.toLowerCase=()=>e.check(Qr()),e.toUpperCase=()=>e.check(en()),e.slugify=()=>e.check(tn())}),un=f(\"ZodString\",(e,t)=>{Mt.init(e,t),Ic.init(e,t),e.email=(r)=>e.check(ra(bf,r)),e.url=(r)=>e.check(aa(xf,r)),e.jwt=(r)=>e.check(Sa(Lf,r)),e.emoji=(r)=>e.check(ca(_f,r)),e.guid=(r)=>e.check(Vr(Oc,r)),e.uuid=(r)=>e.check(na(Vt,r)),e.uuidv4=(r)=>e.check(oa(Vt,r)),e.uuidv6=(r)=>e.check(ia(Vt,r)),e.uuidv7=(r)=>e.check(sa(Vt,r)),e.nanoid=(r)=>e.check(ua(vf,r)),e.guid=(r)=>e.check(Vr(Oc,r)),e.cuid=(r)=>e.check(la(Sf,r)),e.cuid2=(r)=>e.check(fa(wf,r)),e.ulid=(r)=>e.check(pa(Tf,r)),e.base64=(r)=>e.check(xa(zf,r)),e.base64url=(r)=>e.check(_a($f,r)),e.xid=(r)=>e.check(da(Ef,r)),e.ksuid=(r)=>e.check(ma(kf,r)),e.ipv4=(r)=>e.check(ha(Af,r)),e.ipv6=(r)=>e.check(ga(Of,r)),e.cidrv4=(r)=>e.check(ya(Pf,r)),e.cidrv6=(r)=>e.check(ba(Rf,r)),e.e164=(r)=>e.check(va(If,r)),e.datetime=(r)=>e.check(uc(r)),e.date=(r)=>e.check(lc(r)),e.time=(r)=>e.check(fc(r)),e.duration=(r)=>e.check(pc(r))});function P(e){return ea(un,e)}var L=f(\"ZodStringFormat\",(e,t)=>{z.init(e,t),Ic.init(e,t)}),bf=f(\"ZodEmail\",(e,t)=>{is.init(e,t),L.init(e,t)});var Oc=f(\"ZodGUID\",(e,t)=>{ns.init(e,t),L.init(e,t)});var Vt=f(\"ZodUUID\",(e,t)=>{os.init(e,t),L.init(e,t)});var xf=f(\"ZodURL\",(e,t)=>{ss.init(e,t),L.init(e,t)});var _f=f(\"ZodEmoji\",(e,t)=>{as.init(e,t),L.init(e,t)});var vf=f(\"ZodNanoID\",(e,t)=>{cs.init(e,t),L.init(e,t)});var Sf=f(\"ZodCUID\",(e,t)=>{us.init(e,t),L.init(e,t)});var wf=f(\"ZodCUID2\",(e,t)=>{ls.init(e,t),L.init(e,t)});var Tf=f(\"ZodULID\",(e,t)=>{fs.init(e,t),L.init(e,t)});var Ef=f(\"ZodXID\",(e,t)=>{ps.init(e,t),L.init(e,t)});var kf=f(\"ZodKSUID\",(e,t)=>{ds.init(e,t),L.init(e,t)});var Af=f(\"ZodIPv4\",(e,t)=>{bs.init(e,t),L.init(e,t)});var Of=f(\"ZodIPv6\",(e,t)=>{xs.init(e,t),L.init(e,t)});var Pf=f(\"ZodCIDRv4\",(e,t)=>{_s.init(e,t),L.init(e,t)});var Rf=f(\"ZodCIDRv6\",(e,t)=>{vs.init(e,t),L.init(e,t)});var zf=f(\"ZodBase64\",(e,t)=>{ws.init(e,t),L.init(e,t)});var $f=f(\"ZodBase64URL\",(e,t)=>{Ts.init(e,t),L.init(e,t)});var If=f(\"ZodE164\",(e,t)=>{Es.init(e,t),L.init(e,t)});var Lf=f(\"ZodJWT\",(e,t)=>{ks.init(e,t),L.init(e,t)});var qt=f(\"ZodNumber\",(e,t)=>{jr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ma(e,n,o,i),e.gt=(n,o)=>e.check(Ze(n,o)),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.lt=(n,o)=>e.check(Ne(n,o)),e.lte=(n,o)=>e.check(ae(n,o)),e.max=(n,o)=>e.check(ae(n,o)),e.int=(n)=>e.check(Pc(n)),e.safe=(n)=>e.check(Pc(n)),e.positive=(n)=>e.check(Ze(0,n)),e.nonnegative=(n)=>e.check(Y(0,n)),e.negative=(n)=>e.check(Ne(0,n)),e.nonpositive=(n)=>e.check(ae(0,n)),e.multipleOf=(n,o)=>e.check(nt(n,o)),e.step=(n,o)=>e.check(nt(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??\"\").includes(\"int\")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function Lc(e){return Aa(qt,e)}var Cf=f(\"ZodNumberFormat\",(e,t)=>{As.init(e,t),qt.init(e,t)});function Pc(e){return Pa(Cf,e)}var ln=f(\"ZodBoolean\",(e,t)=>{Os.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fa(e,r,n,o)});function it(e){return Ra(ln,e)}var Cc=f(\"ZodBigInt\",(e,t)=>{Ps.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ba(e,n,o,i),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.gt=(n,o)=>e.check(Ze(n,o)),e.gte=(n,o)=>e.check(Y(n,o)),e.min=(n,o)=>e.check(Y(n,o)),e.lt=(n,o)=>e.check(Ne(n,o)),e.lte=(n,o)=>e.check(ae(n,o)),e.max=(n,o)=>e.check(ae(n,o)),e.positive=(n)=>e.check(Ze(BigInt(0),n)),e.negative=(n)=>e.check(Ne(BigInt(0),n)),e.nonpositive=(n)=>e.check(ae(BigInt(0),n)),e.nonnegative=(n)=>e.check(Y(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(nt(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Nf=f(\"ZodUnknown\",(e,t)=>{Rs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qa(e,r,n,o)});function an(){return Ia(Nf)}var Zf=f(\"ZodNever\",(e,t)=>{zs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Va(e,r,n,o)});function Df(e){return La(Zf,e)}var Nc=f(\"ZodDate\",(e,t)=>{$s.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ka(e,n,o,i),e.min=(n,o)=>e.check(Y(n,o)),e.max=(n,o)=>e.check(ae(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Uf=f(\"ZodArray\",(e,t)=>{Is.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ya(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(De(r,n)),e.nonempty=(r)=>e.check(De(1,r)),e.max=(r,n)=>e.check(Ft(r,n)),e.length=(r,n)=>e.check(Bt(r,n)),e.unwrap=()=>e.element});function je(e,t){return Na(Uf,e,t)}var jf=f(\"ZodObject\",(e,t)=>{Ns.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xa(e,r,n,o),w(e,\"shape\",()=>t.shape),e.keyof=()=>fn(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:an()}),e.loose=()=>e.clone({...e._zod.def,catchall:an()}),e.strict=()=>e.clone({...e._zod.def,catchall:Df()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>ql(e,r),e.safeExtend=(r)=>Kl(e,r),e.merge=(r)=>Hl(e,r),e.pick=(r)=>Bl(e,r),e.omit=(r)=>Vl(e,r),e.partial=(...r)=>Jl(Dc,e,r[0]),e.required=(...r)=>Gl(Uc,e,r[0])});function C(e,t){let r={type:\"object\",shape:e??{},...y(t)};return new jf(r)}var Zc=f(\"ZodUnion\",(e,t)=>{Mr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qa(e,r,n,o),e.options=t.options});function Mf(e,t){return new Zc({type:\"union\",options:e,...y(t)})}var Ff=f(\"ZodDiscriminatedUnion\",(e,t)=>{Zc.init(e,t),Zs.init(e,t)});function Bf(e,t,r){return new Ff({type:\"union\",options:t,discriminator:e,...y(r)})}var Vf=f(\"ZodIntersection\",(e,t)=>{Ds.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ec(e,r,n,o)});function qf(e,t){return new Vf({type:\"intersection\",left:e,right:t})}var Kf=f(\"ZodRecord\",(e,t)=>{Us.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Hf(e,t,r){return new Kf({type:\"record\",keyType:e,valueType:t,...y(r)})}var cn=f(\"ZodEnum\",(e,t)=>{js.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ha(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new cn({...t,checks:[],...y(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new cn({...t,checks:[],...y(o),entries:i})}});function fn(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new cn({type:\"enum\",entries:r,...y(t)})}var Jf=f(\"ZodLiteral\",(e,t)=>{Ms.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ja(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,\"value\",{get(){if(t.values.length>1)throw Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");return t.values[0]}})});function pe(e,t){return new Jf({type:\"literal\",values:Array.isArray(e)?e:[e],...y(t)})}var Gf=f(\"ZodTransform\",(e,t)=>{Fs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Ye(e.constructor.name);r.addIssue=(i)=>{if(typeof i===\"string\")r.issues.push(_e(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code=\"custom\"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(_e(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Wf(e){return new Gf({type:\"transform\",transform:e})}var Dc=f(\"ZodOptional\",(e,t)=>{Fr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rc(e){return new Dc({type:\"optional\",innerType:e})}var Yf=f(\"ZodExactOptional\",(e,t)=>{Bs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xf(e){return new Yf({type:\"optional\",innerType:e})}var Qf=f(\"ZodNullable\",(e,t)=>{Vs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zc(e){return new Qf({type:\"nullable\",innerType:e})}var ep=f(\"ZodDefault\",(e,t)=>{qs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tp(e,t){return new ep({type:\"default\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():Rr(t)}})}var rp=f(\"ZodPrefault\",(e,t)=>{Ks.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ic(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function np(e,t){return new rp({type:\"prefault\",innerType:e,get defaultValue(){return typeof t===\"function\"?t():Rr(t)}})}var Uc=f(\"ZodNonOptional\",(e,t)=>{Hs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function op(e,t){return new Uc({type:\"nonoptional\",innerType:e,...y(t)})}var ip=f(\"ZodCatch\",(e,t)=>{Js.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sp(e,t){return new ip({type:\"catch\",innerType:e,catchValue:typeof t===\"function\"?t:()=>t})}var ap=f(\"ZodPipe\",(e,t)=>{Gs.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ac(e,r,n,o),e.in=t.in,e.out=t.out});function $c(e,t){return new ap({type:\"pipe\",in:e,out:t})}var cp=f(\"ZodReadonly\",(e,t)=>{Ws.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function up(e){return new cp({type:\"readonly\",innerType:e})}var lp=f(\"ZodCustom\",(e,t)=>{Ys.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ga(e,r,n,o)});function fp(e,t={}){return Za(lp,e,t)}function pp(e){return Da(e)}var Kt={};Gn(Kt,{bigint:()=>gp,boolean:()=>hp,date:()=>yp,number:()=>mp,string:()=>dp});function dp(e){return ta(un,e)}function mp(e){return Oa(qt,e)}function hp(e){return za(ln,e)}function gp(e){return $a(Cc,e)}function yp(e){return Ca(Nc,e)}J(Br());var B=P().trim().min(1),de=P().regex(/^#(?:[\\da-f]{3}|[\\da-f]{6}|[\\da-f]{8})$/i,\"Expected a hex color.\"),st={icon:{light:\"@dbx-tools/ui/branding/assets/icon-light.svg\",dark:\"@dbx-tools/ui/branding/assets/icon-dark.svg\"},logo:{light:\"@dbx-tools/ui/branding/assets/logo-light.svg\",dark:\"@dbx-tools/ui/branding/assets/logo-dark.svg\"},favicon:\"@dbx-tools/ui/branding/assets/icon-light.svg\"},pn=C({light:B.describe(\"Asset for light surfaces.\"),dark:B.optional().describe(\"Asset for dark surfaces; light is the fallback.\")}).strict().describe(\"Theme-aware references to one visual asset.\"),jc=C({primary:de.default(\"#1B3139\").describe(\"Primary action and identity color.\"),primaryHover:de.default(\"#0E538B\").describe(\"Primary hover or pressed color.\"),accent:de.default(\"#00A972\").describe(\"Secondary accent color.\"),foreground:de.default(\"#1B3139\").describe(\"Default text and mark color.\"),background:de.default(\"#FFFFFF\").describe(\"Default page background.\"),surface:de.default(\"#F9F7F4\").describe(\"Secondary surface background.\"),muted:de.default(\"#618794\").describe(\"Muted text color.\"),border:de.default(\"#E4E2DD\").describe(\"Default border color.\")}).strict().prefault({}),Mc=C({audience:je(B).default([\"Databricks developers\",\"application engineers\",\"AI agents\"]),tone:je(B).default([\"direct\",\"practical\",\"technical\",\"approachable\"]),principles:je(B).default([\"Lead with the useful outcome.\",\"Prefer concrete examples and accurate technical language.\",\"Keep product claims specific and defensible.\"]),avoid:je(B).default([\"unsupported superlatives\",\"vague AI claims\",\"unnecessary jargon\"])}).strict().prefault({}),Fc=C({schemaVersion:pe(\"1\").default(\"1\"),name:B.default(\"dbx tools\").describe(\"Canonical display name.\"),shortName:B.default(\"dbx\").describe(\"Compact name for constrained UI.\"),tagline:B.optional().describe(\"Optional product line suitable for a header or metadata.\"),description:B.default(\"Companion packages for Databricks developers building apps, agents, data workflows, and reusable UI.\").describe(\"Plain-language product description.\"),assets:C({icon:pn.default(st.icon),logo:pn.default(st.logo),favicon:B.default(st.favicon)}).strict().default(st),colors:jc,typography:C({sans:B.default(\"'DM Sans', ui-sans-serif, system-ui, sans-serif\"),mono:B.default(\"'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace\")}).strict().prefault({}),voice:Mc,links:C({website:P().url().default(\"https://dbx.tools\"),repository:P().url().optional(),documentation:P().url().default(\"https://docs.dbx.tools/\")}).strict().prefault({}),extensions:Hf(B,an()).default({}).describe(\"Namespaced consumer-specific values that do not belong in the portable core.\")}).strict().describe(\"Portable identity, visual, and voice context for UI, libraries, and LLMs.\");function Bc(e={}){return Fc.parse(e)}var bp=Bc({tagline:\"Practical tools for Databricks builders.\"});var _p=new URL(\"http://localhost\");var vp=/^([A-Za-z][A-Za-z0-9+.-]*:\\/\\/)/,Sp=/^\\/+|\\/+$/g;var at=65535;class Ht extends URL{constructor(e){super(e)}get scheme(){return this.protocol.slice(0,-1)}set scheme(e){this.protocol=e+\":\"}with(e,t){let r=new Ht(this);return r[e]=t,new Ht(r)}withPathAppend(...e){return this.withPathReplace(this.pathname,...e)}withPathReplace(...e){let r=[...e].flatMap((n)=>Array.isArray(n)?n:[n]).map((n)=>n.replace(Sp,\"\")).filter(Boolean).join(\"/\");return this.with(\"pathname\",\"/\"+r)}pathMatches(e){let t=this.pathname;if(t==e)return!0;if(!e.startsWith(\"/\"))e=\"/\"+e;if(t==e)return!0;return t.startsWith(e+\"/\")}}function we(e){if(e instanceof URL)return new Ht(e);if(e!==null&&typeof e===\"object\"&&\"url\"in e)e=e.url;if(typeof e===\"string\")e=e.trim();if(e)if(e.startsWith(\"/\")||e.startsWith(\"?\")||e.startsWith(\"#\")){let r=dn().toString().slice(0,-1)+e;return we(r)}else if(e.startsWith(\"://\"))e=`https${e}`;else{let n=e.match(vp)?.[1];if(n){let o=e.slice(n.length);e=`${n}${o||dn().hostname}`}else e=`https://${e}`}else return we(dn());let t=Vc(e);return t?we(t):void 0}function dn(){let e=globalThis.window?.location?.origin;if(e&&e!==\"null\"){let t=Vc(e);if(t)return t}return new URL(_p)}function Vc(e){if(e&&e.includes(\"://\"))try{return new URL(e)}catch{}return null}var Ap=/[vV][0-9]+|[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g,Op=/[a-zA-Z0-9]+/g,Pp=[(e,t)=>{if(!t.capitalize)return e;let r=e.toLowerCase();if(r===\"ai\")return\"AI\";if(r===\"fs\")return\"FS\";return e},(e,t)=>{if(t.capitalize&&/^v[0-9]+$/.test(e))return`V${e.slice(1)}`;return e}],Rp=/^([a-zA-Z][a-zA-Z0-9+.-]*)?:\\/\\/([^\\s/?#][^\\s]*)?$/,zp=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)@([a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)+)$/,qc={distinct:!1,lowerCase:!1,capitalize:!1,omitUriScheme:!1,omitEmailDomain:!1,camelCase:!0},Zy={...qc,lowerCase:!0,maxLength:1/0,truncateStrategy:\"hash\",truncateHashLength:6,delimiter:\"-\"};function*mn(e,...t){let r={...qc,...e},n=r.distinct?new Set:void 0,o=r.camelCase?Ap:Op;for(let i of t){if(i==null)continue;let s=typeof i===\"string\"?i:String(i);if(!s)continue;if(r.omitUriScheme){let a=s.match(Rp);if(a)s=a[2]??\"\"}if(r.omitEmailDomain){let a=s.match(zp);if(a)s=a[1]??\"\"}if(!s)continue;for(let a of s.matchAll(o)){let c=a[0];if(r.lowerCase)c=c.toLowerCase();if(r.capitalize)c=Kc(c);if(!c)continue;for(let u of Pp)if(c=u(c,r),!c)break;if(!c||n?.has(c))continue;n?.add(c),yield c}}}function Jt(e){if(typeof e!==\"string\")return null;let t=e.trim();return t?t:null}function hn(e,t){let r=[...mn({lowerCase:!0,capitalize:!0,...t},e)];return r.length>0?r.join(\" \"):e}function Kc(e){return e?e.charAt(0).toUpperCase()+e.slice(1):e}var V=(e,t)=>pe(e).default(e).describe(t);var Gc=C({profile:V(\"DATABRICKS_CONFIG_PROFILE\",\"Databricks CLI profile environment.\"),host:V(\"DATABRICKS_HOST\",\"Databricks host environment.\"),accountId:V(\"DATABRICKS_ACCOUNT_ID\",\"Databricks account ID environment.\"),workspaceId:V(\"DATABRICKS_WORKSPACE_ID\",\"Databricks workspace ID environment.\"),configFile:V(\"DATABRICKS_CONFIG_FILE\",\"Databricks CLI config file environment.\"),clientId:V(\"DATABRICKS_CLIENT_ID\",\"Databricks OAuth client ID environment.\"),clientSecret:V(\"DATABRICKS_CLIENT_SECRET\",\"Databricks OAuth client secret environment.\"),accessToken:V(\"DATABRICKS_TOKEN\",\"Databricks access token environment.\"),groupId:V(\"DATABRICKS_GROUP_ID\",\"Databricks group ID environment.\"),authType:V(\"DATABRICKS_AUTH_TYPE\",\"Databricks auth type environment.\"),appName:V(\"DATABRICKS_APP_NAME\",\"Databricks App name environment.\"),appPort:V(\"DATABRICKS_APP_PORT\",\"Databricks App port environment.\"),lakebaseEndpoint:V(\"LAKEBASE_ENDPOINT\",\"Lakebase endpoint environment.\")}).strict().describe(\"Canonical Databricks CLI, SDK, Apps, and Lakebase environment names.\"),j=Object.freeze(Gc.parse({})),Wc=C({postgresRole:V(\"DBX_TOOLS_POSTGRES_ROLE\",\"PostgreSQL assumed-role environment.\")}).strict().describe(\"Canonical dbx-tools PostgreSQL environment names.\"),Yc=Object.freeze(Wc.parse({})),Xc=P().trim().min(1).regex(/^[A-Za-z0-9._@+-]{1,255}$/,\"PostgreSQL role must contain only letters, numbers, dot, underscore, at, plus, or hyphen.\").describe(\"PostgreSQL role assumed after authentication.\"),bn=C({postgresRole:Xc.optional().describe(\"PostgreSQL role assumed after authentication.\").meta({env:Yc.postgresRole})}).strict().describe(\"Shared PostgreSQL session options.\"),jp=bn.safeExtend({postgresRole:bn.shape.postgresRole.meta({env:\"POSTGRES_ROLE\"})}).describe(\"PostgreSQL options resolved through scoped configuration.\"),Qc=Kt.number().int().min(1).max(at).describe(\"TCP port from 1 through 65535.\"),eu=Kt.number().int().min(0).max(at).describe(\"TCP port from 0 through 65535, where zero requests automatic allocation.\"),Me=P().trim().min(1).refine((e)=>we(e)!==void 0,{message:\"Expected a valid URL or host.\"}).overwrite(Kp).describe(\"URL normalized through the shared URL builder.\"),X=(e)=>P().trim().min(1).optional().describe(e),H=(e,t=!0)=>({env:e,flag:t,helpDefault:!1}),Mp=C({profile:X(\"Databricks CLI profile.\").meta(H(j.profile)),host:Me.optional().describe(\"Databricks host.\").meta(H(j.host,!1)),accountId:X(\"Databricks account ID.\").meta(H(j.accountId,!1)),workspaceId:X(\"Databricks workspace ID.\").meta(H(j.workspaceId,!1)),configFile:X(\"Databricks CLI config file.\").meta(H(j.configFile,!1)),clientId:X(\"Databricks OAuth client ID.\").meta(H(j.clientId,!1)),clientSecret:X(\"Databricks OAuth client secret.\").meta(H(j.clientSecret,!1)),accessToken:X(\"Databricks access token.\").meta(H(j.accessToken,!1)),groupId:X(\"Databricks group ID.\").meta(H(j.groupId,!1)),authType:X(\"Databricks authentication type.\").meta(H(j.authType,!1)),appName:X(\"Databricks App name.\").meta(H(j.appName,!1)),appPort:Qc.optional().describe(\"Databricks App port.\").meta(H(j.appPort,!1)),lakebaseEndpoint:X(\"Lakebase endpoint.\").meta(H(j.lakebaseEndpoint,!1))}).strict().describe(\"Common Databricks CLI, SDK, Apps, and Lakebase options.\");var Fp=(e,t)=>P().trim().min(1).optional().describe(e).meta({env:t,flag:!1}),Bp=C({lakebaseEndpoint:Fp(\"Lakebase project, resource path, host, or URL.\",j.lakebaseEndpoint)}).strict().describe(\"Common Lakebase options.\");var Vp=C({scheme:pe(\"tcp\"),host:P().trim().toLowerCase().min(1),port:eu}).strict().describe(\"TCP listener address.\"),qp=C({scheme:pe(\"unix\"),path:P().trim().min(1)}).strict().describe(\"Unix-domain listener address.\");function Kp(e){let t=we(e);if(!t)return e;let r=t.toString();return t.pathname===\"/\"&&!t.search&&!t.hash?r.slice(0,-1):r}var Ky=We(\"shared/pattern\");var Gy=We(\"shared/token\");var Fe=\"/api/email/auth\";function ru(e,t){let r=Jt(e),n=Jt(t)?.split(\".\",1)[0],o=n?hn(n):void 0;if(!r)return o;if(!o||r.toLowerCase().endsWith(o.toLowerCase()))return r;return`${r} ${o}`}var ed=C({email:P().describe(\"Address to email a one-time code to, if it is authorized.\")}).describe(\"Validated request for an email one-time password.\"),td=C({ok:pe(!0).describe(\"Always true for an accepted one-time-password request.\"),retryAfter:Lc().optional().describe(\"Seconds to wait before requesting another code.\")}).describe(\"Accepted one-time-password request result and optional retry delay.\"),rd=C({email:P().describe(\"Address that received the one-time code.\"),code:P().describe(\"One-time password submitted to establish a session.\")}).describe(\"Email address and code submitted to establish a session.\"),nd=C({ok:it().describe(\"True when the code was accepted and a session was created.\"),retryAfter:Lc().optional().describe(\"Seconds to wait before trying another code.\")}).describe(\"Verification outcome and optional retry delay.\"),od=C({ok:it().describe(\"True when the session cookie was cleared.\"),redirectTo:P().describe(\"Validated same-origin destination after logout.\")}).describe(\"Logout outcome plus the validated same-origin destination.\"),id=C({authenticated:it().describe(\"True when the browser holds a valid session.\"),email:P().optional().describe(\"Signed-in address when a session exists.\"),enabled:it().describe(\"True when the passwordless gate is configured.\"),passkeysEnabled:it().optional().describe(\"True when WebAuthn passkeys are available.\"),passkeyNamePrefix:P().optional().describe(\"Configured prefix for humanized passkey display names.\")}).describe(\"Gate availability, session identity, and optional passkey capability.\");function Gt(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{code:t,message:r,toString:()=>t}]))}var Te=Gt({CHALLENGE_NOT_FOUND:\"Challenge not found\",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:\"You are not allowed to register this passkey\",FAILED_TO_VERIFY_REGISTRATION:\"Failed to verify registration\",PASSKEY_NOT_FOUND:\"Passkey not found\",AUTHENTICATION_FAILED:\"Authentication failed\",UNABLE_TO_CREATE_SESSION:\"Unable to create session\",USER_NOT_FOUND:\"User not found\",FAILED_TO_UPDATE_PASSKEY:\"Failed to update passkey\",PREVIOUSLY_REGISTERED:\"Previously registered\",REGISTRATION_CANCELLED:\"Registration cancelled\",AUTH_CANCELLED:\"Auth cancelled\",UNKNOWN_ERROR:\"Unknown error\",SESSION_REQUIRED:\"Passkey registration requires an authenticated session\",RESOLVE_USER_REQUIRED:\"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false\",RESOLVED_USER_INVALID:\"Resolved user is invalid\"}),nu=\"1.7.6\";function G(e){let t=new Uint8Array(e),r=\"\";for(let o of t)r+=String.fromCharCode(o);return btoa(r).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=/g,\"\")}function Ee(e){let t=e.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=(4-t.length%4)%4,n=t.padEnd(t.length+r,\"=\"),o=atob(n),i=new ArrayBuffer(o.length),s=new Uint8Array(i);for(let a=0;a<o.length;a++)s[a]=o.charCodeAt(a);return i}function ke(){return ad.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential===\"function\")}var ad={stubThis:(e)=>e};function Wt(e){let{id:t}=e;return{...e,id:Ee(t),transports:e.transports}}function Yt(e){return e===\"localhost\"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class N extends Error{constructor({message:e,code:t,cause:r,name:n}){super(e,{cause:r});Object.defineProperty(this,\"code\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n??r.name,this.code=t}}function ou({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new N({message:\"Registration ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else if(e.name===\"ConstraintError\"){if(r.authenticatorSelection?.requireResidentKey===!0)return new N({message:\"Discoverable credentials were required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT\",cause:e});else if(t.mediation===\"conditional\"&&r.authenticatorSelection?.userVerification===\"required\")return new N({message:\"User verification was required during automatic registration but it could not be performed\",code:\"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE\",cause:e});else if(r.authenticatorSelection?.userVerification===\"required\")return new N({message:\"User verification was required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT\",cause:e})}else if(e.name===\"InvalidStateError\")return new N({message:\"The authenticator was previously registered\",code:\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\",cause:e});else if(e.name===\"NotAllowedError\")return new N({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});else if(e.name===\"NotSupportedError\"){if(r.pubKeyCredParams.filter((o)=>o.type===\"public-key\").length===0)return new N({message:'No entry in pubKeyCredParams was of type \"public-key\"',code:\"ERROR_MALFORMED_PUBKEYCREDPARAMS\",cause:e});return new N({message:\"No available authenticator supported any of the specified pubKeyCredParams algorithms\",code:\"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG\",cause:e})}else if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(!Yt(n))return new N({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e});else if(r.rp.id!==n)return new N({message:`The RP ID \"${r.rp.id}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else if(e.name===\"TypeError\"){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new N({message:\"User ID was not between 1 and 64 characters\",code:\"ERROR_INVALID_USER_ID_LENGTH\",cause:e})}else if(e.name===\"UnknownError\")return new N({message:\"The authenticator was unable to process the specified options, or could not create a new credential\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e});return e}class iu{constructor(){Object.defineProperty(this,\"controller\",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=Error(\"Cancelling existing WebAuthn API call for new one\");t.name=\"AbortError\",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(\"Manually cancelling existing WebAuthn API call\");e.name=\"AbortError\",this.controller.abort(e),this.controller=void 0}}}var Be=new iu;var cd=[\"cross-platform\",\"platform\"];function Xt(e){if(!e)return;if(cd.indexOf(e)<0)return;return e}async function su(e){if(!e.optionsJSON&&e.challenge)console.warn(\"startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e};let{optionsJSON:t,useAutoRegister:r=!1}=e;if(!ke())throw Error(\"WebAuthn is not supported in this browser\");let n={...t,challenge:Ee(t.challenge),user:{...t.user,id:Ee(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Wt)},o={};if(r)o.mediation=\"conditional\";o.publicKey=n,o.signal=Be.createNewAbortSignal();let i;try{i=await navigator.credentials.create(o)}catch(g){throw ou({error:g,options:o})}if(!i)throw Error(\"Registration was not completed\");let{id:s,rawId:a,response:c,type:u}=i,l=void 0;if(typeof c.getTransports===\"function\")l=c.getTransports();let p=void 0;if(typeof c.getPublicKeyAlgorithm===\"function\")try{p=c.getPublicKeyAlgorithm()}catch(g){xn(\"getPublicKeyAlgorithm()\",g)}let d=void 0;if(typeof c.getPublicKey===\"function\")try{let g=c.getPublicKey();if(g!==null)d=G(g)}catch(g){xn(\"getPublicKey()\",g)}let m;if(typeof c.getAuthenticatorData===\"function\")try{m=G(c.getAuthenticatorData())}catch(g){xn(\"getAuthenticatorData()\",g)}return{id:s,rawId:G(a),response:{attestationObject:G(c.attestationObject),clientDataJSON:G(c.clientDataJSON),transports:l,publicKeyAlgorithm:p,publicKey:d,authenticatorData:m},type:u,clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:Xt(i.authenticatorAttachment)}}function xn(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function au(){if(!ke())return _n.stubThis(new Promise((t)=>t(!1)));let e=globalThis.PublicKeyCredential;if(e?.isConditionalMediationAvailable===void 0)return _n.stubThis(new Promise((t)=>t(!1)));return _n.stubThis(e.isConditionalMediationAvailable())}var _n={stubThis:(e)=>e};function cu({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new N({message:\"Authentication ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else if(e.name===\"NotAllowedError\")return new N({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});else if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(!Yt(n))return new N({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e});else if(r.rpId!==n)return new N({message:`The RP ID \"${r.rpId}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else if(e.name===\"UnknownError\")return new N({message:\"The authenticator was unable to process the specified options, or could not create a new assertion signature\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e});return e}async function uu(e){if(!e.optionsJSON&&e.challenge)console.warn(\"startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e};let{optionsJSON:t,useBrowserAutofill:r=!1,verifyBrowserAutofillInput:n=!0}=e;if(!ke())throw Error(\"WebAuthn is not supported in this browser\");let o;if(t.allowCredentials?.length!==0)o=t.allowCredentials?.map(Wt);let i={...t,challenge:Ee(t.challenge),allowCredentials:o},s={};if(r){if(!await au())throw Error(\"Browser does not support WebAuthn autofill\");if(document.querySelectorAll(\"input[autocomplete$='webauthn']\").length<1&&n)throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');s.mediation=\"conditional\",i.allowCredentials=[]}s.publicKey=i,s.signal=Be.createNewAbortSignal();let a;try{a=await navigator.credentials.get(s)}catch(m){throw cu({error:m,options:s})}if(!a)throw Error(\"Authentication was not completed\");let{id:c,rawId:u,response:l,type:p}=a,d=void 0;if(l.userHandle)d=G(l.userHandle);return{id:c,rawId:G(u),response:{authenticatorData:G(l.authenticatorData),clientDataJSON:G(l.clientDataJSON),signature:G(l.signature),userHandle:d},type:p,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Xt(a.authenticatorAttachment)}}var lu=\"1.7.6\";var fu=lu;var vn=Symbol.for(\"better-auth:broadcast-channel\"),ud=()=>Math.floor(Date.now()/1000),ld=class{listeners=new Set;name;constructor(e=\"better-auth.message\"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(typeof window>\"u\")return;try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:ud()}))}catch{}}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=(t)=>{if(t.key!==this.name)return;let r=JSON.parse(t.newValue??\"{}\");if(r?.event!==\"session\"||!r?.data)return;this.listeners.forEach((n)=>n(r))};return window.addEventListener(\"storage\",e),()=>{window.removeEventListener(\"storage\",e)}}};function Qt(e=\"better-auth.message\"){if(!globalThis[vn])globalThis[vn]=new ld(e);return globalThis[vn]}var ct=Symbol(\"clean\");var q=[],ut=0,Ae=null,Sn=4,fd=globalThis.nanostoresGlobal||={epoch:0},pd=()=>{let e,t;while(ut<q.length){t=ut,ut+=Sn;let r=Ae?.get(q[t]);if(r){if(!r.has(q[t+1]))continue;r.clear()}try{q[t](q[t+1].value,q[t+2],q[t+3])}catch(n){e=n}}if(q.length=ut=0,e)throw e};var Oe=(e)=>{let t=[],r={eq:Object.is,get(){if(!r.lc)r.listen(()=>{})();return r.value},init:e,lc:0,listen(n){return r.lc=t.push(n),()=>{Ae?.get(n)?.delete(r);for(let i=ut;i<q.length;)if(q[i]===n&&q[i+1]===r)q.splice(i,Sn);else i+=Sn;let o=t.indexOf(n);if(~o){if(t.splice(o,1),!--r.lc)r.off()}}},notify(n,o){fd.epoch++;let i=!q.length&&!Ae;for(let s of t){if(Ae){let a=Ae.get(s);if(!a)Ae.set(s,a=new Set);if(a.has(r))continue;a.add(r)}q.push(s,r,n,Ae?void 0:o)}if(i)pd()},off(){},set(n){let o=r.value;if(!r.eq(o,n))r.value=n,r.notify(o)},subscribe(n){let o=r.listen(n);return n(r.value),o},value:e};return r[ct]=()=>{t=[],r.lc=0,r.off()},r};var dd=2;var md=5,Ve=6,er=10,pu=(e,t,r,n)=>{if(e.events=e.events||{},!e.events[r+er])e.events[r+er]=n((o)=>{e.events[r].reduceRight((i,s)=>(s(i),i),{shared:{},...o})});return e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],i=o.indexOf(t);if(~i){if(o.splice(i,1),!o.length)e.events[r+er](),delete e.events[r+er]}}};var wn=(e,t)=>pu(e,t,dd,(r)=>{let{set:n,setKey:o}=e;if(e.setKey)e.setKey=(i,s)=>{let a;if(r({abort:()=>{a=!0},changed:i,newValue:{...e.value,[i]:s}}),!a)return o(i,s)};return e.set=(i)=>{let s;if(r({abort:()=>{s=!0},newValue:i}),!s)return n(i)},()=>{e.set=n,e.setKey=o}});var tr=1000,qe=(e,t)=>pu(e,(n)=>{let o=t(n);if(o)e.events[Ve].push(o)},md,(n)=>{let o=e.listen;e.listen=(...s)=>{if(!e.lc&&!e.active)e.active=!0,n();return o(...s)};let i=e.off;e.events[Ve]=[],e.off=()=>{i(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[Ve])s();e.events[Ve]=[]}},tr)};{let s=e[ct];e[ct]=()=>{for(let a of e.events[Ve])a();e.events[Ve]=[],e.active=!1,s()}}return()=>{e.listen=o,e.off=i}});function gu(e){if(typeof e!==\"object\"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function me(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!me(e[r],t[r]))return!1;return!0}if(gu(e)&&gu(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!(o in t)||!me(e[o],t[o]))return!1;return!0}return!1}function nr(e,t){return wn(e,({newValue:r,abort:n})=>{if(t(e.value,r))n()})}var Tn=Symbol.for(\"better-auth:focus-manager\"),xd=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach((t)=>t(e))}setup(){if(typeof window>\"u\"||typeof document>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=()=>{if(document.visibilityState===\"visible\")this.setFocused(!0)};return document.addEventListener(\"visibilitychange\",e,!1),()=>{document.removeEventListener(\"visibilitychange\",e,!1)}}};function En(){if(!globalThis[Tn])globalThis[Tn]=new xd;return globalThis[Tn]}var kn=Symbol.for(\"better-auth:online-manager\"),_d=class{listeners=new Set;isOnline=typeof navigator<\"u\"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach((t)=>t(e))}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(\"online\",e,!1),window.addEventListener(\"offline\",t,!1),()=>{window.removeEventListener(\"online\",e,!1),window.removeEventListener(\"offline\",t,!1)}}};function or(){if(!globalThis[kn])globalThis[kn]=new _d;return globalThis[kn]}var vd={proto:/\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/,constructor:/\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/,protoShort:/\"__proto__\"\\s*:/,constructorShort:/\"constructor\"\\s*:/},Sd=/^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/,yu={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,\"-infinity\":Number.NEGATIVE_INFINITY},wd=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;function Td(e){return e instanceof Date&&!isNaN(e.getTime())}function Ed(e){let t=wd.exec(e);if(!t)return null;let[,r,n,o,i,s,a,c,u,l,p]=t,d=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(s,10),parseInt(a,10),c?parseInt(c.padEnd(3,\"0\"),10):0));if(u){let m=(parseInt(l,10)*60+parseInt(p,10))*(u===\"+\"?-1:1);d.setUTCMinutes(d.getUTCMinutes()+m)}return Td(d)?d:null}function kd(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if(typeof e!==\"string\")return e;let s=e.trim(),a=s.toLowerCase();if(a.length<=9&&a in yu)return yu[a];if(!Sd.test(s)){if(r)throw SyntaxError(\"[better-json] Invalid JSON\");return e}if(Object.entries(vd).some(([c,u])=>{let l=u.test(s);if(l&&n)console.warn(`[better-json] Detected potential prototype pollution attempt using ${c} pattern`);return l})&&r)throw Error(\"[better-json] Potential prototype pollution attempt detected\");try{return JSON.parse(s,(u,l)=>{if(u===\"__proto__\"||u===\"constructor\"&&l&&typeof l===\"object\"&&\"prototype\"in l){if(n)console.warn(`[better-json] Dropping \"${u}\" key to prevent prototype pollution`);return}if(i&&typeof l===\"string\"){let p=Ed(l);if(p)return p}return o?o(u,l):l})}catch(c){if(r)throw c;return e}}function bu(e,t={strict:!0}){return kd(e,t)}var Ad=Symbol.for(\"better-auth:auth-query\");function ir(e){let t=Oe(e);return Object.defineProperty(t,Ad,{value:!0}),t}var Od=()=>typeof window>\"u\";function Pd(e,t){return me(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var An=(e,t,r,n)=>{let o=ir({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(p)=>s(p)});qe(o,()=>nr(o,Pd));let i=0,s=async(p)=>{let d=++i;return new Promise((m)=>{let g=typeof n===\"function\"?n({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):n;r(t,{...g,query:{...g?.query,...p?.query},async onSuccess(h){if(d===i){let v=o.get(),_=v.data!=null&&h.data!=null&&me(v.data,h.data)?v.data:h.data;o.set({data:_,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await g?.onSuccess?.(h)},async onError(h){let{request:v}=h,_=typeof v.retry===\"number\"?v.retry:v.retry?.attempts,A=v.retryAttempt||0;if(_&&A<_)return;if(d===i){let b=h.error.status===401;o.set({error:h.error,data:b?null:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await g?.onError?.(h)},async onRequest(h){if(d===i){let v=o.get();o.set({isPending:v.data===null,data:v.data,error:null,isRefetching:!0,refetch:o.value.refetch})}await g?.onRequest?.(h)}}).catch((h)=>{if(d!==i)return;o.set({error:h,data:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{m(void 0)})})};e=Array.isArray(e)?e:[e];let a=!1,c=!1,u=!1,l=()=>{if(a){u=!0;return}a=!0,s().finally(()=>{a=!1;let p=u&&c;if(u=!1,p)l()})};return qe(o,()=>{if(Od())return;c=!0;let p=!1,d,m=e.map((g)=>g.listen(()=>{if(p)s();else p=!0,clearTimeout(d),l()}));return d=setTimeout(()=>{p=!0,l()},0),()=>{c=!1;for(let g of m)g();clearTimeout(d)}}),o};var On=()=>Math.floor(Date.now()/1000),Rd=5;function xu(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,s=o.sessionOptions?.refetchOnWindowFocus??!0,a=o.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},u=()=>a||or().isOnline,l=(b)=>{if(!u())return;if(b?.event===\"storage\"){t();return}if(b?.event===\"poll\"){c.lastSessionRequest=On(),t();return}if(b?.event===\"visibilitychange\"){if(On()-c.lastSessionRequest<Rd)return;c.lastSessionRequest=On(),t();return}t()},p=(b)=>{Qt().post({event:\"session\",data:{trigger:b},clientId:Math.random().toString(36).substring(7)})},d=()=>{if(i&&i>0)c.pollInterval=setInterval(()=>{if(r())l({event:\"poll\"})},i*1000)},m=()=>{c.unsubscribeBroadcast=Qt().subscribe(()=>{l({event:\"storage\"})})},g=()=>{if(!s)return;c.unsubscribeFocus=En().subscribe(()=>{l({event:\"visibilitychange\"})})},h=()=>{c.unsubscribeOnline=or().subscribe((b)=>{if(b)l({event:\"visibilitychange\"})})},v=()=>{c.unsubscribeSignal=n.listen(()=>{t()})};return{init:()=>{if(c.isInitialized)return;c.isInitialized=!0,d(),m(),g(),h(),v(),c.cleanupBroadcastSetup=Qt().setup(),c.cleanupFocusSetup=En().setup(),c.cleanupOnlineSetup=or().setup()},cleanup:()=>{if(!c.isInitialized)return;if(c.pollInterval)clearInterval(c.pollInterval),c.pollInterval=void 0;if(c.unsubscribeBroadcast)c.unsubscribeBroadcast(),c.unsubscribeBroadcast=void 0;if(c.unsubscribeFocus)c.unsubscribeFocus(),c.unsubscribeFocus=void 0;if(c.unsubscribeOnline)c.unsubscribeOnline(),c.unsubscribeOnline=void 0;if(c.unsubscribeSignal)c.unsubscribeSignal(),c.unsubscribeSignal=void 0;if(c.cleanupBroadcastSetup)c.cleanupBroadcastSetup(),c.cleanupBroadcastSetup=void 0;if(c.cleanupFocusSetup)c.cleanupFocusSetup(),c.cleanupFocusSetup=void 0;if(c.cleanupOnlineSetup)c.cleanupOnlineSetup(),c.cleanupOnlineSetup=void 0;c.isInitialized=!1,c.lastSessionRequest=0},triggerRefetch:l,broadcastSessionUpdate:p}}var sr=Object.create(null),ft=(e)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?sr:globalThis),ne=new Proxy(sr,{get(e,t){return ft()[t]??sr[t]},has(e,t){return t in ft()||t in sr},set(e,t,r){let n=ft(!0);return n[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=ft(!0);return delete r[t],!0},ownKeys(){let e=ft(!0);return Object.keys(e)}});var zd=ne.NODE_ENV??\"\";function he(e,t){if(typeof process<\"u\"&&process.env)return process.env[e]??t;if(typeof Deno<\"u\")return Deno.env.get(e)??t;if(typeof Bun<\"u\")return Bun.env[e]??t;return t}var $d=Object.freeze({get BETTER_AUTH_SECRET(){return he(\"BETTER_AUTH_SECRET\")},get AUTH_SECRET(){return he(\"AUTH_SECRET\")},get BETTER_AUTH_TELEMETRY(){return he(\"BETTER_AUTH_TELEMETRY\")},get BETTER_AUTH_TELEMETRY_ID(){return he(\"BETTER_AUTH_TELEMETRY_ID\")},get NODE_ENV(){return he(\"NODE_ENV\",\"development\")},get PACKAGE_VERSION(){return he(\"PACKAGE_VERSION\",\"0.0.0\")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return he(\"BETTER_AUTH_TELEMETRY_ENDPOINT\",\"\")}});function Ld(){let e=Object.getOwnPropertyDescriptor(Error,\"stackTraceLimit\");if(e===void 0)return Object.isExtensible(Error);return Object.prototype.hasOwnProperty.call(e,\"writable\")?e.writable:e.set!==void 0}function Cd(e){let t=e.split(`\n at `);if(t.length<=1)return e;return t.splice(1,1),t.join(`\n at `)}function Nd(e,t){class r extends e{#e;constructor(...n){if(Ld()){let i=Error.stackTraceLimit;Error.stackTraceLimit=0;super(...n);Error.stackTraceLimit=i}else super(...n);let o=Error().stack;if(o)this.#e=Cd(o.replace(/^Error/,this.name))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,\"constructor\",{get(){return t},enumerable:!1,configurable:!0}),r}var Zd={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,\"I'M_A_TEAPOT\":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511},Dd=class extends Error{status;body;headers;statusCode;constructor(e=\"INTERNAL_SERVER_ERROR\",t=void 0,r={},n=typeof e===\"number\"?e:Zd[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0);this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name=\"APIError\",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};var Ud=Nd(Dd,Error);var Ke=class extends Error{constructor(e,t){super(e,t);this.name=\"BetterAuthError\",this.message=e,this.stack=\"\"}};var jd=47;function vu(e){let t=e.length;while(t>0&&e.charCodeAt(t-1)===jd)t--;return t===e.length?e:e.slice(0,t)}function Md(e){try{return(vu(new URL(e).pathname)||\"/\")!==\"/\"}catch{throw new Ke(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Fd(e){try{let t=new URL(e);if(t.protocol!==\"http:\"&&t.protocol!==\"https:\")throw new Ke(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof Ke)throw t;throw new Ke(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function dt(e,t=\"/api/auth\"){if(Fd(e),Md(e))return e;let r=vu(e);if(!t||t===\"/\")return r;return t=t.startsWith(\"/\")?t:`/${t}`,`${r}${t}`}function _u(e,t){if(!e||e.trim()===\"\")return!1;if(t===\"proto\")return e===\"http\"||e===\"https\";if(t===\"host\"){if([/\\.\\./,/\\0/,/[\\s]/,/^[.]/,/[<>'\"]/,/javascript:/i,/file:/i,/data:/i].some((r)=>r.test(e)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e)}return!1}function Su(e,t,r,n,o){if(e)return dt(e,t);if(n!==!1){let a=ne.BETTER_AUTH_URL||ne.NEXT_PUBLIC_BETTER_AUTH_URL||ne.PUBLIC_BETTER_AUTH_URL||ne.NUXT_PUBLIC_BETTER_AUTH_URL||ne.NUXT_PUBLIC_AUTH_URL||(ne.BASE_URL!==\"/\"?ne.BASE_URL:void 0);if(a)return dt(a,t)}let i=r?.headers.get(\"x-forwarded-host\"),s=r?.headers.get(\"x-forwarded-proto\");if(i&&s&&o){if(_u(s,\"proto\")&&_u(i,\"host\"))try{return dt(`${s}://${i}`,t)}catch(a){}}if(r){let a=Bd(r.url);if(!a)throw new Ke(\"Could not get origin from request. Please provide a valid base URL.\");return dt(a,t)}if(typeof window<\"u\"&&window.location)return dt(window.location.origin,t)}function Bd(e){try{let t=new URL(e);return t.origin===\"null\"?null:t.origin}catch{return null}}var Vd=[\"javascript:\",\"data:\",\"vbscript:\"];function wu(e){let t;try{t=new URL(e)}catch{return!0}return!Vd.includes(t.protocol)}var Tu={id:\"redirect\",name:\"Redirect\",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&wu(e.data.url)){if(typeof window<\"u\"&&window.location){if(window.location)try{window.location.href=e.data.url}catch{}}}}}};var qd=()=>typeof window>\"u\",Kd=tr;function ku(e,t){if(typeof window>\"u\")return;let r=e.get();if(r.data!==null||t===null)return;e.set({...r,data:t,error:null,isPending:!1})}function Eu(e){if(typeof e===\"object\"&&e!==null&&\"data\"in e&&\"error\"in e)return e;return{data:e,error:null}}function Hd(e){if(!e)return null;if(e.session===null&&e.user===null)return null;return e}function Jd(e,t){return me(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Au(e,t){let r=Oe(!1),n,o=0,i=0;r.listen(()=>{i++,o=0});let s=(m)=>l(m),a=ir({data:null,error:null,isPending:!0,isRefetching:!1,refetch:s});nr(a,Jd);let c=async(m,g)=>{let h=a.value;if(a.set({...h,isPending:h.data===null,isRefetching:!0,error:null,refetch:s}),m.aborted)return\"aborted\";try{let v=await e(\"/get-session\",{method:\"GET\",query:g?.query,signal:m});if(m.aborted)return\"aborted\";let{data:_,error:A}=Eu(v),b=\"fresh\";if(_?.needsRefresh)try{let x=await e(\"/get-session\",{method:\"POST\",signal:m});if(m.aborted)return\"aborted\";({data:_,error:A}=Eu(x))}catch{if(m.aborted)return\"aborted\";b=\"stale\"}if(A){let x=a.value,Re=A?.status===401;return a.set({data:Re?null:x.data,error:A,isPending:!1,isRefetching:!1,refetch:s}),\"failed\"}let E=Hd(_),k=a.value,W=k.data!=null&&E!=null&&me(k.data,E)?k.data:E;return a.set({data:W,error:null,isPending:!1,isRefetching:!1,refetch:s}),b}catch(v){if(m.aborted)return\"aborted\";let _=a.value;return a.set({data:_.data,error:v,isPending:!1,isRefetching:!1,refetch:s}),\"failed\"}},u=()=>{let m=a.value.data?.session?.expiresAt,g=m instanceof Date?m.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+Kd,g)},l=(m)=>{o=0,n?.cancel();let g=new AbortController,h={cancel:()=>g.abort(),promise:Promise.resolve().then(()=>{if(g.signal.aborted)return\"aborted\";return c(g.signal,m)}),revision:i};n=h;let v=(_)=>{if(n!==h)return;if(n=void 0,_===\"fresh\"&&h.revision===i)o=u()};return h.promise.then(v,()=>v(\"failed\")),h.promise.then(()=>{return})},p=()=>{if(n?.revision===i)return n.promise.then(()=>{return});if(Date.now()<o)return Promise.resolve();return l()},d=()=>{};return qe(a,()=>{let m;if(!qd())m=setTimeout(()=>{p()},0);let g=xu({fetchSession:l,shouldPollSession:()=>a.value.data!=null,sessionSignal:r,options:t});return g.init(),d=g.broadcastSessionUpdate,()=>{if(m)clearTimeout(m);g.cleanup()}}),{session:a,$sessionSignal:r,broadcastSessionUpdate:(m)=>d(m)}}function Pn(e){if(e===null||typeof e!==\"object\")return!1;let t=Object.getPrototypeOf(e);if(t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null)return!1;if(Symbol.iterator in e)return!1;if(Symbol.toStringTag in e)return Object.prototype.toString.call(e)===\"[object Module]\";return!0}function Rn(e,t,r=\".\",n){if(!Pn(t))return Rn(e,{},r,n);let o={...t};for(let i of Object.keys(e)){if(i===\"__proto__\"||i===\"constructor\")continue;let s=e[i];if(s===null||s===void 0)continue;if(n&&n(o,i,s,r))continue;if(Array.isArray(s)&&Array.isArray(o[i]))o[i]=[...s,...o[i]];else if(Pn(s)&&Pn(o[i]))o[i]=Rn(s,o[i],(r?`${r}.`:\"\")+i.toString(),n);else o[i]=s}return o}function zn(e){return(...t)=>t.reduce((r,n)=>Rn(r,n,\"\",e),{})}var Ou=zn(),Ev=zn((e,t,r)=>{if(e[t]!==void 0&&typeof r===\"function\")return e[t]=r(e[t]),!0}),kv=zn((e,t,r)=>{if(Array.isArray(e[t])&&typeof r===\"function\")return e[t]=r(e[t]),!0});var Gd=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r});this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},Wd=async(e,t)=>{let r=t||{},n={onRequest:[t===null||t===void 0?void 0:t.onRequest],onResponse:[t===null||t===void 0?void 0:t.onResponse],onSuccess:[t===null||t===void 0?void 0:t.onSuccess],onError:[t===null||t===void 0?void 0:t.onError],onRetry:[t===null||t===void 0?void 0:t.onRetry]};if(!t||!(t===null||t===void 0?void 0:t.plugins))return{url:e,options:r,hooks:n};for(let l of(t===null||t===void 0?void 0:t.plugins)||[]){var o,i,s,a,c;if(l.init){var u;let p=await((u=l.init)===null||u===void 0?void 0:u.call(l,e.toString(),r));r=p.options||r,e=p.url}n.onRequest.push((o=l.hooks)===null||o===void 0?void 0:o.onRequest),n.onResponse.push((i=l.hooks)===null||i===void 0?void 0:i.onResponse),n.onSuccess.push((s=l.hooks)===null||s===void 0?void 0:s.onSuccess),n.onError.push((a=l.hooks)===null||a===void 0?void 0:a.onError),n.onRetry.push((c=l.hooks)===null||c===void 0?void 0:c.onRetry)}return{url:e,options:r,hooks:n}},Pu=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){if(this.options.shouldRetry)return Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t));return Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Yd=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){if(this.options.shouldRetry)return Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t));return Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Xd(e){if(typeof e===\"number\")return new Pu({type:\"linear\",attempts:e,delay:1000});switch(e.type){case\"linear\":return new Pu(e);case\"exponential\":return new Yd(e);default:throw Error(\"Invalid retry strategy\")}}var Qd=[\"get\",\"post\",\"put\",\"patch\",\"delete\"];function In(e){if(!e.startsWith(\"@\"))return{method:void 0,path:e};let t=e.indexOf(\"/\"),r=e.slice(1,t===-1?void 0:t);if(!Qd.includes(r))return{method:void 0,path:e};return{method:r,path:t===-1?e:e.slice(t+1)}}var em=(e)=>e===\".\"||e===\"..\",tm=(e)=>e.split(\":\").map((t)=>encodeURIComponent(t)).join(\":\");function rm(e,t){let r=t.get(e);if(r===void 0)return tm(e);if(em(r))throw TypeError(\"Path parameters cannot be reserved path segments\");return encodeURIComponent(r)}function nm(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:\"\"},i=e.startsWith(\"http\")?e.split(\"/\").slice(0,3).join(\"/\"):r||\"\",{path:s}=In(e);if(s!==e)e=`/${s}`;if(!i.endsWith(\"/\"))i+=\"/\";let[a,c]=e.replace(i,\"\").split(\"?\"),u=new URLSearchParams(c);for(let[d,m]of Object.entries(o||{})){if(m==null)continue;let g;if(typeof m===\"string\")g=m;else if(Array.isArray(m)){for(let h of m)u.append(d,h);continue}else g=JSON.stringify(m);u.set(d,g)}let l=new Map;if(n)if(Array.isArray(n)){let d=a.split(\"/\").filter((m)=>m.startsWith(\":\"));for(let[m,g]of d.entries()){let h=n[m];l.set(g,String(h))}}else for(let[d,m]of Object.entries(n))l.set(`:${d}`,String(m));a=a.split(\"/\").map((d)=>rm(d,l)).join(\"/\"),a=a.replace(/^\\/+/,\"\");let p=u.toString();if(p=p.length>0?`?${p}`.replace(/\\+/g,\"%20\"):\"\",!i.startsWith(\"http\"))return`${i}${a}${p}`;return new URL(`${a}${p}`,i)}var om=async(e)=>{let t={},r=async(n)=>typeof n===\"function\"?await n():n;if(e===null||e===void 0?void 0:e.auth){if(e.auth.type===\"Bearer\"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type===\"Basic\"){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(e.auth.type===\"Custom\"){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${n!==null&&n!==void 0?n:\"\"} ${o}`}}return t},im=/^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;function sm(e){let t=e.headers.get(\"content-type\"),r=new Set([\"image/svg\",\"application/xml\",\"application/xhtml\",\"application/html\"]);if(!t)return\"json\";let n=t.split(\";\").shift()||\"\";if(im.test(n))return\"json\";if(r.has(n)||n.startsWith(\"text/\"))return\"text\";return\"blob\"}function am(e){try{return JSON.parse(e),!0}catch(t){return!1}}function Iu(e){if(e===void 0)return!1;let t=typeof e;if(t===\"string\"||t===\"number\"||t===\"boolean\"||t===null)return!0;if(t!==\"object\")return!1;if(Array.isArray(e))return!0;if(e.buffer)return!1;return e.constructor&&e.constructor.name===\"Object\"||typeof e.toJSON===\"function\"}function Ru(e){try{return JSON.parse(e)}catch(t){return e}}function zu(e){return typeof e===\"function\"}function cm(e){if(e===null||e===void 0?void 0:e.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<\"u\"&&zu(globalThis.fetch))return globalThis.fetch;if(typeof window<\"u\"&&zu(window.fetch))return window.fetch;throw Error(\"No fetch implementation found\")}function Lu(...e){let t={};for(let r of e){if(!r)continue;if(r instanceof Headers)r.forEach((n,o)=>{t[o]=n});else{let n=Array.isArray(r)?r:Object.entries(r);for(let[o,i]of n)if(i!==null&&i!==void 0)t[o]=i}}return t}async function um(e){let t=new Headers(Lu(e===null||e===void 0?void 0:e.headers,await om(e)));if(!t.has(\"content-type\")){let r=lm(e===null||e===void 0?void 0:e.body);if(r)t.set(\"content-type\",r)}return t}function lm(e){if(Iu(e))return\"application/json\";return null}function fm(e){let t=e.get(\"content-type\");return t?t.split(\";\")[0].trim().toLowerCase():null}function pm(e,t){let{body:r}=e;if(!r)return null;if(!Iu(r))return r;if(typeof r===\"string\")return r;if(fm(t)===\"application/x-www-form-urlencoded\")return new URLSearchParams(r).toString();return JSON.stringify(r)}function dm(e,t){if(t===null||t===void 0?void 0:t.method)return t.method.toUpperCase();let{method:r}=In(e);if(r)return r.toUpperCase();return(t===null||t===void 0?void 0:t.body)?\"POST\":\"GET\"}function mm(e,t){let r;if(!(e===null||e===void 0?void 0:e.signal)&&(e===null||e===void 0?void 0:e.timeout))r=setTimeout(()=>t===null||t===void 0?void 0:t.abort(),e===null||e===void 0?void 0:e.timeout);return{abortTimeout:r,clearTimeout:()=>{if(r)clearTimeout(r)}}}var hm=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2));this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function mt(e,t){let r=await e[\"~standard\"].validate(t);if(r.issues)throw new hm(r.issues);return r.value}function ht(e){return ht=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},ht(e)}function gm(e,t){if(ht(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||\"default\");if(ht(n)!=\"object\")return n;throw TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function ym(e){var t=gm(e,\"string\");return ht(t)==\"symbol\"?t:t+\"\"}function bm(e,t,r){return(t=ym(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$u(Object(r),!0).forEach(function(n){bm(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$u(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var $n=async(e,t)=>{var r,n,o;let{hooks:i,url:s,options:a}=await Wd(e,t),c=cm(a),u=new AbortController,l=(r=a.signal)!==null&&r!==void 0?r:u.signal,p=nm(s,a),d=await um(a),m=pm(a,d),g=dm(s,a),h=T(T({},a),{},{url:p,headers:d,body:m,method:g,signal:l});for(let M of i.onRequest)if(M){let Z=await M(h);if(typeof Z===\"object\"&&Z!==null)Object.assign(h,Z)}if(\"pipeTo\"in h&&typeof h.pipeTo===\"function\"||typeof(t===null||t===void 0||(n=t.body)===null||n===void 0?void 0:n.pipe)===\"function\"){if(!(\"duplex\"in h))h.duplex=\"half\"}let{clearTimeout:v}=mm(a,u),_=await c(h.url,h);v();let A={response:_,request:h};for(let M of i.onResponse)if(M){var b;let Z=await M(T(T({},A),{},{response:(t===null||t===void 0||(b=t.hookOptions)===null||b===void 0?void 0:b.cloneResponse)?_.clone():_}));if(Z instanceof Response)_=Z;else if(typeof Z===\"object\"&&Z!==null)_=Z.response}if(_.ok){if(h.method===\"HEAD\")return{data:\"\",error:null};let M=sm(_),Z={data:null,response:_,request:h};if(M===\"json\"||M===\"text\"){var E;let ze=await _.text();Z.data=await((E=h.jsonParser)!==null&&E!==void 0?E:Ru)(ze)}else Z.data=await _[M]();if(h===null||h===void 0?void 0:h.output){if(h.output&&!h.disableValidation)Z.data=await mt(h.output,Z.data)}for(let ze of i.onSuccess)if(ze){var k;await ze(T(T({},Z),{},{response:(t===null||t===void 0||(k=t.hookOptions)===null||k===void 0?void 0:k.cloneResponse)?_.clone():_}))}if(t===null||t===void 0?void 0:t.throw)return Z.data;return{data:Z.data,error:null}}let W=(o=t===null||t===void 0?void 0:t.jsonParser)!==null&&o!==void 0?o:Ru,x=await _.text(),Re=am(x),cr=Re?await W(x):null,il={response:_,responseText:x,request:h,error:T(T({},cr),{},{status:_.status,statusText:_.statusText})};for(let M of i.onError)if(M){var ur;await M(T(T({},il),{},{response:(t===null||t===void 0||(ur=t.hookOptions)===null||ur===void 0?void 0:ur.cloneResponse)?_.clone():_}))}if(t===null||t===void 0?void 0:t.retry){var lr;let M=Xd(t.retry),Z=(lr=t.retryAttempt)!==null&&lr!==void 0?lr:0;if(await M.shouldAttemptRetry(Z,_)){for(let xt of i.onRetry)if(xt)await xt(A);let ze=M.getDelay(Z);return await new Promise((xt)=>setTimeout(xt,ze)),await $n(e,T(T({},t),{},{retryAttempt:Z+1}))}}if(t===null||t===void 0?void 0:t.throw)throw new Gd(_.status,_.statusText,Re?cr:x);return{data:null,error:T(T({},cr),{},{status:_.status,statusText:_.statusText})}},xm=(e)=>({id:\"apply-schema\",name:\"Apply Schema\",version:\"1.0.0\",async init(t,r){var n;let o=T(T({},r),e.query!==void 0&&{query:T(T({},e.query),r===null||r===void 0?void 0:r.query)}),i=((n=e.plugins)===null||n===void 0||(n=n.find((u)=>{var l;return((l=u.schema)===null||l===void 0?void 0:l.config)?t.startsWith(u.schema.config.baseURL||\"\")||t.startsWith(u.schema.config.prefix||\"\"):!1}))===null||n===void 0?void 0:n.schema)||e.schema;if(i){var s,a;let u=t;if((s=i.config)===null||s===void 0?void 0:s.prefix){if(u.startsWith(i.config.prefix)){if(u=u.replace(i.config.prefix,\"\"),i.config.baseURL)t=t.replace(i.config.prefix,i.config.baseURL)}}if((a=i.config)===null||a===void 0?void 0:a.baseURL){if(u.startsWith(i.config.baseURL))u=u.replace(i.config.baseURL,\"\")}if(u.startsWith(\"/\")&&u.charAt(1)===\"@\")u=u.substring(1);let l=i.schema[u];if(l){var c;let{method:p,path:d}=In(u);if(p)t=t.slice(0,t.length-u.length)+d;let m=r===null||r===void 0?void 0:r.headers;if(l.headers&&!(r===null||r===void 0?void 0:r.disableValidation)){let h={};if(r===null||r===void 0?void 0:r.headers){if(r.headers instanceof Headers)r.headers.forEach((A,b)=>{h[b.toLowerCase()]=A});else if(typeof r.headers===\"object\"){for(let[A,b]of Object.entries(r.headers))if(b!==null&&b!==void 0)h[A.toLowerCase()]=b}}let v=await mt(l.headers,h),_={};for(let[A,b]of Object.entries(v))_[A.toLowerCase()]=b;m=_}let g=(c=l.method)!==null&&c!==void 0?c:p;if(o=T(T(T(T({},o),g!==void 0&&{method:g}),l.output!==void 0&&{output:l.output}),m!==void 0&&{headers:m}),!(r===null||r===void 0?void 0:r.disableValidation)){if(l.query){if(o.query=await mt(l.query,r===null||r===void 0?void 0:r.query),o.query!==null&&typeof o.query===\"object\"){let h=T({},e.query);for(let v of Object.keys(h))if((r===null||r===void 0?void 0:r.query)&&Object.prototype.hasOwnProperty.call(r.query,v))h[v]=r.query[v];o.query=T(T({},h),o.query)}}o=T(T({},o),{},{body:l.input?await mt(l.input,r===null||r===void 0?void 0:r.body):r===null||r===void 0?void 0:r.body,params:l.params?await mt(l.params,r===null||r===void 0?void 0:r.params):r===null||r===void 0?void 0:r.params})}return{url:t,options:o}}}return T({url:t},(r!==void 0||e.query!==void 0)&&{options:o})}}),Cu=(e)=>{async function t(r,n){let o=T(T(T({},e),n),{},{headers:Lu(e===null||e===void 0?void 0:e.headers,n===null||n===void 0?void 0:n.headers),plugins:[...(e===null||e===void 0?void 0:e.plugins)||[],xm(e||{}),...(n===null||n===void 0?void 0:n.plugins)||[]]});if(e===null||e===void 0?void 0:e.catchAllError)try{return await $n(r,o)}catch(i){return{data:null,error:{status:500,statusText:\"Fetch Error\",message:\"Fetch related error. Captured by catchAllError option. See error property for more details.\",error:i}}}return await $n(r,o)}return t};var _m=(e)=>{if(typeof process>\"u\")return;let t=e??\"/api/auth\";if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>\"u\"){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let r=process.env.VERCEL_URL.startsWith(\"http\")?\"\":\"https://\";return`${new URL(`${r}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},Nu=(e,t)=>{let r=\"credentials\"in Request.prototype,n=Su(e?.baseURL,e?.basePath,void 0,t)??_m(e?.basePath)??\"/api/auth\",o=e?.plugins?.flatMap((x)=>x.fetchPlugins).filter((x)=>x!==void 0)||[],i={id:\"lifecycle-hooks\",name:\"lifecycle-hooks\",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:s,onError:a,onRequest:c,onResponse:u,...l}=e?.fetchOptions||{},p=Cu({baseURL:n,...r?{credentials:\"include\"}:{},method:\"GET\",jsonParser(x){if(!x)return null;return bu(x,{strict:!1})},customFetchImpl:fetch,...l,plugins:[i,...l.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Tu],...o]}),{$sessionSignal:d,session:m,broadcastSessionUpdate:g}=Au(p,e),h=!1,v=(x)=>{if(h||x===null)return;h=!0,ku(m,x)},_=e?.plugins||[],A={},b={$sessionSignal:d,session:m},E={\"/sign-out\":\"POST\",\"/revoke-sessions\":\"POST\",\"/revoke-other-sessions\":\"POST\",\"/delete-user\":\"POST\"},k=[{signal:\"$sessionSignal\",matcher(x){return x===\"/sign-out\"||x===\"/update-user\"||x===\"/update-session\"||x===\"/sign-up/email\"||x===\"/sign-in/email\"||x===\"/delete-user\"||x===\"/verify-email\"||x===\"/revoke-sessions\"||x===\"/revoke-session\"||x===\"/revoke-other-sessions\"||x===\"/change-email\"||x===\"/change-password\"},callback(x){if(x===\"/sign-out\")g(\"signout\");else if(x===\"/update-user\"||x===\"/update-session\")g(\"updateUser\")}}];for(let x of _){if(x.getAtoms)Object.assign(b,x.getAtoms?.(p));if(x.pathMethods)Object.assign(E,x.pathMethods);if(x.atomListeners)k.push(...x.atomListeners)}let W={notify:(x)=>{b[x].set(!b[x].get())},listen:(x,Re)=>{b[x].subscribe(Re)},atoms:b};for(let x of _)if(x.getActions)A=Ou(x.getActions?.(p,W,e)??{},A);return{get baseURL(){return n},pluginsActions:A,pluginsAtoms:b,pluginPathMethods:E,atomListeners:k,hydrateSession:v,$sessionSignal:d,$fetch:p,$store:W}};function Zu(e){return typeof e===\"object\"&&e!==null&&\"get\"in e&&typeof e.get===\"function\"&&\"lc\"in e&&typeof e.lc===\"number\"}function Du(e){return e.charAt(0).toUpperCase()+e.slice(1)}var vm=/[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+/gu,Sm=/['\\u2019]/g;function wm(e){return e.replace(Sm,\"\").match(vm)??[]}function Uu(e){return wm(e).map((t)=>t.toLowerCase()).join(\"-\")}function Tm(e,t,r){let n=t[e],{fetchOptions:o,query:i,...s}=r||{};if(n)return n;if(o?.method)return o.method;if(s&&Object.keys(s).length>0)return\"POST\";return\"GET\"}function ju(e,t,r,n,o){function i(s=[]){return new Proxy(function(){},{get(a,c){if(typeof c!==\"string\")return;if(c===\"then\"||c===\"catch\"||c===\"finally\")return;let u=[...s,c],l=e;for(let p of u)if(l&&typeof l===\"object\"&&p in l)l=l[p];else{l=void 0;break}if(typeof l===\"function\")return l;if(Zu(l))return l;return i(u)},apply:async(a,c,u)=>{let l=\"/\"+s.map(Uu).join(\"/\"),p=u[0]||{},d=u[1]||{},{query:m,fetchOptions:g,...h}=p,v={...d,...g},_=Tm(l,r,p);return await t(l,{...v,body:_===\"GET\"?void 0:{...h,...v?.body||{}},query:m||v?.query,method:_,async onSuccess(A){if(await v?.onSuccess?.(A),!o||v.disableSignal)return;let b=o.filter((k)=>k.matcher(l));if(!b.length)return;let E=new Set;for(let k of b){let W=n[k.signal];if(!W)return;if(E.has(k.signal))continue;E.add(k.signal);let x=W.get();setTimeout(()=>{W.set(!x)},10),k.callback?.(l)}}})}})}return i()}function Ln(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:n,hydrateSession:o,$fetch:i,atomListeners:s,$store:a}=Nu(e),c={};for(let[u,l]of Object.entries(n))c[`use${Du(u)}`]=l;return ju({...r,...c,hydrateSession:o,$fetch:i,$store:a},i,t,n,s)}var Em=(e,{$listPasskeys:t,$store:r})=>({signIn:{passkey:async(i,s)=>{let a=await e(\"/passkey/generate-authenticate-options\",{method:\"GET\",throw:!1});if(!a.data)return a;let c=a.data.extensions||i?.extensions?{...a.data.extensions||{},...i?.extensions||{}}:void 0,u;try{u=await uu({optionsJSON:{...a.data,extensions:c},useBrowserAutofill:i?.autoFill})}catch(l){return{data:null,error:{code:l instanceof N?l.code:\"AUTH_CANCELLED\",message:Te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}try{let{clientExtensionResults:l,...p}=u,d=await e(\"/passkey/verify-authentication\",{body:{response:p},...i?.fetchOptions,...s,method:\"POST\",throw:!1});if(t.set(Math.random()),r.notify(\"$sessionSignal\"),i?.returnWebAuthnResponse)return{...d,webauthn:{response:u,clientExtensionResults:l}};return d}catch(l){return console.error(\"[Better Auth] Error verifying passkey\",l),{data:null,error:{code:\"AUTH_CANCELLED\",message:Te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}}},passkey:{addPasskey:async(i,s)=>{let a=await e(\"/passkey/generate-register-options\",{method:\"GET\",query:{...i?.authenticatorAttachment&&{authenticatorAttachment:i.authenticatorAttachment},...i?.name&&{name:i.name},...i?.context&&{context:i.context}},throw:!1});if(!a.data)return a;try{let c=a.data.extensions||i?.extensions?{...a.data.extensions||{},...i?.extensions||{}}:void 0,u=await su({optionsJSON:{...a.data,extensions:c},useAutoRegister:i?.useAutoRegister}),{clientExtensionResults:l,...p}=u,d=await e(\"/passkey/verify-registration\",{...i?.fetchOptions,...s,body:{response:p,name:i?.name,...i?.createSession&&{createSession:!0}},method:\"POST\",throw:!1});if(!d.data)return d;if(t.set(Math.random()),d.data.session)r.notify(\"$sessionSignal\");if(i?.returnWebAuthnResponse)return{...d,webauthn:{response:u,clientExtensionResults:l}};return d}catch(c){if(c instanceof N){if(c.code===\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\")return{data:null,error:{code:c.code,message:Te.PREVIOUSLY_REGISTERED.message,status:400,statusText:\"BAD_REQUEST\"}};if(c.code===\"ERROR_CEREMONY_ABORTED\")return{data:null,error:{code:c.code,message:Te.REGISTRATION_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}};return{data:null,error:{code:c.code,message:c.message,status:400,statusText:\"BAD_REQUEST\"}}}return{data:null,error:{code:\"UNKNOWN_ERROR\",message:c instanceof Error?c.message:Te.UNKNOWN_ERROR.message,status:500,statusText:\"INTERNAL_SERVER_ERROR\"}}}}},$Infer:{}}),Mu=()=>{let e=Oe();return{id:\"passkey\",version:nu,$InferServerPlugin:{},getActions:(t,r)=>Em(t,{$listPasskeys:e,$store:r}),getAtoms(t){return{listPasskeys:An(e,\"/passkey/list-user-passkeys\",t,{method:\"GET\"}),$listPasskeys:e}},pathMethods:{\"/passkey/register\":\"POST\",\"/passkey/authenticate\":\"POST\"},atomListeners:[{matcher(t){return t===\"/passkey/verify-registration\"||t===\"/passkey/delete-passkey\"||t===\"/passkey/update-passkey\"||t===\"/sign-out\"},signal:\"$listPasskeys\"},{matcher:(t)=>t===\"/passkey/verify-authentication\",signal:\"$sessionSignal\"}],$ERROR_CODES:Te}};var Fu=Gt({OTP_EXPIRED:\"OTP expired\",INVALID_OTP:\"Invalid OTP\",TOO_MANY_ATTEMPTS:\"Too many attempts\"});var Cn=()=>({id:\"email-otp\",version:fu,$InferServerPlugin:{},atomListeners:[{matcher:(e)=>e===\"/email-otp/verify-email\"||e===\"/sign-in/email-otp\"||e===\"/email-otp/request-email-change\",signal:\"$sessionSignal\"}],$ERROR_CODES:Fu});function Bu(){return globalThis.location}function Xm(){return`${Bu()?.origin??\"http://localhost\"}${Fe}`}function Vu(e){return Ln({baseURL:Xm(),...e?{fetchOptions:{signal:e}}:{},plugins:[Cn(),Mu()]})}var qu=Vu();function Qm(e){return typeof e===\"object\"&&e!==null?e:void 0}function eh(e){let t=Qm(e);if(!t||typeof t.authenticated!==\"boolean\"||typeof t.enabled!==\"boolean\"||t.email!==void 0&&typeof t.email!==\"string\"||t.passkeysEnabled!==void 0&&typeof t.passkeysEnabled!==\"boolean\"||t.passkeyNamePrefix!==void 0&&typeof t.passkeyNamePrefix!==\"string\")throw Error(\"Auth status returned an invalid response\");return{authenticated:t.authenticated,enabled:t.enabled,...typeof t.email===\"string\"?{email:t.email}:{},...typeof t.passkeysEnabled===\"boolean\"?{passkeysEnabled:t.passkeysEnabled}:{},...typeof t.passkeyNamePrefix===\"string\"?{passkeyNamePrefix:t.passkeyNamePrefix}:{}}}var He;function th(e){return e instanceof DOMException&&e.name===\"AbortError\"}function Ku(e){He?.cancel();let t=Symbol(\"passkey-operation\"),r=new AbortController,n=!1,o=()=>{if(He?.id!==t)return;He=void 0,n=!0,r.abort(),Be.cancelCeremony()};return He={id:t,cancel:o},{result:e(Vu(r.signal)).then((s)=>!n&&s.error===null).catch((s)=>{if(n||th(s))return!1;throw s}).finally(()=>{if(He?.id===t)He=void 0}),cancel:o}}function Zn(e=!1){return Ku((t)=>t.signIn.passkey({autoFill:e}))}function Hu(e){return ru(e,Bu()?.hostname??\"\")}function Dn(){let e=globalThis;return Boolean(e.isSecureContext!==!1&&e.PublicKeyCredential&&e.navigator?.credentials&&typeof e.navigator.credentials.create===\"function\"&&typeof e.navigator.credentials.get===\"function\")}function Un(e){let t=e??Hu();return Ku((r)=>r.passkey.addPasskey(t?{name:t}:void 0))}async function jn(){let e=await fetch(`${Fe}/status`,{credentials:\"include\"});if(!e.ok)throw Error(`Auth status failed with ${e.status}`);return eh(await e.json())}async function Mn(e){return(await qu.emailOtp.sendVerificationOtp({email:e,type:\"sign-in\"})).error===null}async function Fn(e,t,r){return(await qu.signIn.emailOtp({email:e,otp:t,name:r})).error===null}var Pe={DatabricksCli:\"databricks-cli\",OAuthM2M:\"oauth-m2m\",PersonalAccessToken:\"pat\",AppOnBehalfOf:\"app_obo\",AppServicePrincipal:\"app_sp\"},gt={Workspace:\"workspace\",Account:\"account\",Unified:\"unified\"};var yt=fn([Pe.DatabricksCli,Pe.OAuthM2M,Pe.PersonalAccessToken,Pe.AppOnBehalfOf,Pe.AppServicePrincipal]).meta({env:j.authType,flag:!1}).describe(\"Databricks authentication type values.\"),bt=fn([gt.Workspace,gt.Account,gt.Unified]).describe(\"Databricks authentication target values.\");var Gu=\"runtime\",oh=C({profile:P().min(1).optional(),host:Me,accountId:P().min(1).optional(),workspaceId:P().min(1).optional(),target:bt,authType:yt.or(pe(Gu)),principal:P().min(1)});var Wu=C({name:P().min(1).describe(\"Profile name from the Databricks CLI configuration.\"),host:Me.optional().describe(\"Workspace or account host URL.\"),accountId:P().min(1).optional().describe(\"Account id when the profile targets an account.\"),workspaceId:P().min(1).optional().describe(\"Workspace id when the profile targets a workspace.\"),target:bt.describe(\"Whether this profile authenticates a workspace, account, or unified host.\"),authType:yt.describe(\"Credential kind used by this profile.\"),principal:P().min(1).describe(\"Secret-free principal label suitable for selectors.\")}).describe(\"Secret-free Databricks profile metadata.\"),sh=je(Wu).describe(\"List of secret-free Databricks profiles.\"),ah=Bf(\"kind\",[C({kind:pe(\"ambient\")}),C({kind:pe(\"profile\"),profile:P().trim().min(1).describe(\"Named Databricks CLI profile to use.\")})]).describe(\"Ambient or named-profile selector value.\");var Bn=document.querySelector(\"#email-form\"),qn=document.querySelector(\"#code-form\"),el=document.querySelector(\"#email\"),Kn=document.querySelector(\"#code\"),Yu=document.querySelector(\"#email-submit\"),Xu=document.querySelector(\"#code-submit\"),tl=document.querySelector(\"#passkey-submit\"),uh=document.querySelector(\"#create-passkey-option\"),Vn=document.querySelector(\"#create-passkey\"),lh=document.querySelector(\"#back\"),Qu=document.querySelector(\"#msg\"),Je=\"\",rl=!1,Q,nl=document.body.dataset.returnTo||\"/\",fh=document.body.dataset.passkeyNamePrefix;if(window.location.pathname!==Fe)nl=`${window.location.pathname}${window.location.search}${window.location.hash}`;function ee(e,t=!1){Qu.textContent=e,Qu.className=`msg${t?\" error\":\"\"}`}function Hn(){let e=Q;Q=void 0,e?.cancel()}function Jn(){ee(\"Signed in. Loading.\"),window.location.replace(nl)}function ol(e){Hn();let t=Zn(e);Q=t,t.result.then((r)=>{if(Q!==t)return;if(Q=void 0,r)Jn();else if(!e)ee(\"Unable to sign in with a passkey. Use email recovery instead.\",!0)}).catch(()=>{if(Q!==t)return;if(Q=void 0,!e)ee(\"Unable to sign in with a passkey. Use email recovery instead.\",!0)})}async function ph(){if(!rl||!Vn.checked)return;ee(\"Creating a passkey.\");try{let e=Un(Hu(fh));if(Q=e,await e.result,Q===e)Q=void 0}catch{Q=void 0}}jn().then(async(e)=>{if(e.authenticated){Jn();return}if(!e.passkeysEnabled||!Dn())return;if(rl=!0,tl.hidden=!1,uh.hidden=!1,typeof PublicKeyCredential.isConditionalMediationAvailable!==\"function\"||!await PublicKeyCredential.isConditionalMediationAvailable())return;ol(!0)}).catch(()=>{return});tl.addEventListener(\"click\",()=>{ee(\"\"),ol(!1)});Bn.addEventListener(\"submit\",(e)=>{if(e.preventDefault(),Je=el.value.trim(),!Je)return;Hn(),Yu.disabled=!0,ee(\"Sending.\"),Mn(Je).then((t)=>{if(!t)throw Error(\"OTP request failed\");Bn.classList.add(\"hidden\"),qn.classList.remove(\"hidden\"),Kn.focus(),ee(`If ${Je} is authorized, a verification code is on its way.`)}).catch(()=>ee(\"Could not send a code. Check the address and try again.\",!0)).finally(()=>{Yu.disabled=!1})});qn.addEventListener(\"submit\",(e)=>{e.preventDefault();let t=Kn.value.trim();if(!t)return;Xu.disabled=!0,Vn.disabled=!0,ee(\"Verifying.\"),Fn(Je,t,Je.split(\"@\")[0]||\"User\").then(async(r)=>{if(!r)throw Error(\"OTP verification failed\");await ph(),Jn()}).catch(()=>{ee(\"That code was not accepted. Try again.\",!0),Xu.disabled=!1,Vn.disabled=!1})});lh.addEventListener(\"click\",()=>{qn.classList.add(\"hidden\"),Bn.classList.remove(\"hidden\"),Kn.value=\"\",ee(\"\"),el.focus()});window.addEventListener(\"pagehide\",Hn,{once:!0});})();\n";
|