@joinmeow/onboarding-cli 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.cjs +154 -0
  2. package/dist/cli.ts +4981 -0
  3. package/package.json +28 -0
package/dist/cli.cjs ADDED
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+ var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),__exportAll=(e,t)=>{let n={};for(var r in e)__defProp(n,r,{get:e[r],enumerable:!0});return t||__defProp(n,Symbol.toStringTag,{value:`Module`}),n},__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=__getOwnPropNames(t),a=0,o=i.length,s;a<o;a++)s=i[a],!__hasOwnProp.call(e,s)&&s!==n&&__defProp(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:__create(__getProtoOf(e)),__copyProps(t||!e||!e.__esModule?__defProp(n,`default`,{value:e,enumerable:!0}):n,e));let node_child_process=require(`node:child_process`),node_path=require(`node:path`);node_path=__toESM(node_path);let node_fs=require(`node:fs`);node_fs=__toESM(node_fs);let node_process=require(`node:process`);node_process=__toESM(node_process);let node_fs_promises=require(`node:fs/promises`);node_fs_promises=__toESM(node_fs_promises);let node_os=require(`node:os`);node_os=__toESM(node_os);let node_url=require(`node:url`),node_module=require(`node:module`),node_stream=require(`node:stream`),node_crypto=require(`node:crypto`);node_crypto=__toESM(node_crypto);let node_http=require(`node:http`);node_http=__toESM(node_http);var require_error=__commonJSMin((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),require_argument=__commonJSMin((e=>{let{InvalidArgumentError:t}=require_error();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),require_help=__commonJSMin((e=>{let{humanReadableArgName:t}=require_argument();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
3
+ `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=2,a=` `.repeat(2);if(!n)return a+e;let o=e.padEnd(t+e.length-r.displayWidth(e)),s=2,c=(this.helpWidth??80)-t-2-2,l;return l=c<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,c).replace(/\n/g,`
4
+ `+` `.repeat(t+2)),a+o+` `.repeat(2)+l.replace(/\n/g,`\n${a}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
5
+ `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),require_option=__commonJSMin((e=>{let{InvalidArgumentError:t}=require_error();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
6
+ - a short flag is a single dash and a single character
7
+ - either use a single dash and a single character (for a short flag)
8
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
9
+ - too many short flags`):i.test(t)?Error(`${n}
10
+ - too many long flags`):Error(`${n}
11
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),require_suggestSimilar=__commonJSMin((e=>{let t=3;function n(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function r(e,t){if(!t||t.length===0)return``;t=Array.from(new Set(t));let r=e.startsWith(`--`);r&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let i=[],a=3,o=.4;return t.forEach(t=>{if(t.length<=1)return;let r=n(e,t),o=Math.max(e.length,t.length);(o-r)/o>.4&&(r<a?(a=r,i=[t]):r===a&&i.push(t))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=r})),require_command=__commonJSMin((e=>{let t=require(`node:events`).EventEmitter,n=require(`node:child_process`),r=require(`node:path`),i=require(`node:fs`),a=require(`node:process`),{Argument:o,humanReadableArgName:s}=require_argument(),{CommanderError:c}=require_error(),{Help:l,stripColor:u}=require_help(),{Option:d,DualOptions:f}=require_option(),{suggestSimilar:p}=require_suggestSimilar();var m=class e extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>g()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>g()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>u(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new o(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new c(e,t,n)),a.exit(e)}action(e){return this._actionHandler=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new d(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
14
+ - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof d)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){a.versions?.electron&&(t.from=`electron`);let e=a.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=a.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:a.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
15
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(i.existsSync(e))return;let r=`'${e}' does not exist
16
+ - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
17
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
18
+ - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
19
+ `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
20
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g})),require_commander=__commonJSMin((e=>{let{Argument:t}=require_argument(),{Command:n}=require_command(),{CommanderError:r,InvalidArgumentError:i}=require_error(),{Help:a}=require_help(),{Option:o}=require_option();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),import_commander=require_commander();const ENV_DEFAULT_PATTERN=/^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-|:|-)?([^}]*)\}$/,ENV_INTERPOLATION_PATTERN=/\\?\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,ENV_DIRECT_PREFIX=`$env:`;function expandHome(e){if(!e.startsWith(`~`))return e;let t=node_os.default.homedir();return e===`~`?t:e.startsWith(`~/`)?`${t}/${e.slice(2)}`:e}function resolveEnvValue(e){if(typeof e!=`string`)return String(e);let t=ENV_DEFAULT_PATTERN.exec(e);if(t){let n=t[1],r=t[2]??``;if(!n)return e;let i=process.env[n];return i&&i!==``?i:r}return e.startsWith(`$`)?resolveEnvPlaceholders(e):e}function resolveEnvPlaceholders(e){if(e.startsWith(ENV_DIRECT_PREFIX)){let t=e.slice(ENV_DIRECT_PREFIX.length),n=process.env[t];if(n===void 0)throw Error(`Environment variable '${t}' is required for MCP header substitution.`);return n}let t=new Set,n=e.replace(ENV_INTERPOLATION_PATTERN,(e,n)=>{let r=process.env[n];return r===void 0?(t.add(n),e):r});if(t.size>0){let e=[...t].sort().join(`, `);throw Error(`Environment variable(s) ${e} must be set for MCP header substitution.`)}return n}async function withEnvOverrides(e,t){if(!e||Object.keys(e).length===0)return await t();let n=[];for(let[t,r]of Object.entries(e)){if(process.env[t])continue;let e=resolveEnvValue(r);e!==``&&(process.env[t]=e,n.push(t))}try{return await t()}finally{for(let e of n)delete process.env[e]}}async function listConfigLayerPaths$1(e={},t=process.cwd()){let n=e.configPath??process.env.MCPORTER_CONFIG;if(n)return[node_path.default.resolve(expandHome(n.trim()))];let r=[],i=homeConfigCandidates().find(e=>pathExists(e));i&&r.push(i);let a=node_path.default.resolve(t,`config`,`mcporter.json`);return pathExists(a)&&r.push(a),r}function resolveConfigPath$1(e,t){if(e)return{path:node_path.default.resolve(e),explicit:!0};let n=process.env.MCPORTER_CONFIG;if(n&&n.trim().length>0)return{path:node_path.default.resolve(expandHome(n.trim())),explicit:!0};let r=node_path.default.resolve(t,`config`,`mcporter.json`);if(pathExists(r))return{path:r,explicit:!1};let i=homeConfigCandidates().find(e=>pathExists(e));return i?{path:i,explicit:!1}:{path:r,explicit:!1}}function homeConfigCandidates(){let e=node_os.default.homedir(),t=node_path.default.join(e,`.mcporter`);return[node_path.default.join(t,`mcporter.json`),node_path.default.join(t,`mcporter.jsonc`)]}function pathExists(e){try{return node_fs.default.accessSync(e),!0}catch{return!1}}async function pathExistsAsync(e){try{return await node_fs_promises.default.access(e),!0}catch{return!1}}const NEVER$1=Object.freeze({status:`aborted`});function $constructor(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}const $brand=Symbol(`zod_brand`);var $ZodAsyncError=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$ZodEncodeError=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const globalConfig={};function config(e){return e&&Object.assign(globalConfig,e),globalConfig}var util_exports=__exportAll({BIGINT_FORMAT_RANGES:()=>BIGINT_FORMAT_RANGES,Class:()=>Class$2,NUMBER_FORMAT_RANGES:()=>NUMBER_FORMAT_RANGES,aborted:()=>aborted,allowsEval:()=>allowsEval,assert:()=>assert,assertEqual:()=>assertEqual,assertIs:()=>assertIs,assertNever:()=>assertNever,assertNotEqual:()=>assertNotEqual,assignProp:()=>assignProp,base64ToUint8Array:()=>base64ToUint8Array,base64urlToUint8Array:()=>base64urlToUint8Array,cached:()=>cached,captureStackTrace:()=>captureStackTrace,cleanEnum:()=>cleanEnum,cleanRegex:()=>cleanRegex,clone:()=>clone,cloneDef:()=>cloneDef,createTransparentProxy:()=>createTransparentProxy,defineLazy:()=>defineLazy,esc:()=>esc,escapeRegex:()=>escapeRegex,extend:()=>extend$1,finalizeIssue:()=>finalizeIssue,floatSafeRemainder:()=>floatSafeRemainder$1,getElementAtPath:()=>getElementAtPath,getEnumValues:()=>getEnumValues,getLengthableOrigin:()=>getLengthableOrigin,getParsedType:()=>getParsedType$1,getSizableOrigin:()=>getSizableOrigin,hexToUint8Array:()=>hexToUint8Array,isObject:()=>isObject,isPlainObject:()=>isPlainObject$2,issue:()=>issue,joinValues:()=>joinValues,jsonStringifyReplacer:()=>jsonStringifyReplacer,merge:()=>merge$1,mergeDefs:()=>mergeDefs,normalizeParams:()=>normalizeParams,nullish:()=>nullish$2,numKeys:()=>numKeys,objectClone:()=>objectClone,omit:()=>omit$1,optionalKeys:()=>optionalKeys,parsedType:()=>parsedType,partial:()=>partial$1,pick:()=>pick$1,prefixIssues:()=>prefixIssues,primitiveTypes:()=>primitiveTypes,promiseAllObject:()=>promiseAllObject,propertyKeyTypes:()=>propertyKeyTypes,randomString:()=>randomString,required:()=>required$1,safeExtend:()=>safeExtend$1,shallowClone:()=>shallowClone,slugify:()=>slugify,stringifyPrimitive:()=>stringifyPrimitive,uint8ArrayToBase64:()=>uint8ArrayToBase64,uint8ArrayToBase64url:()=>uint8ArrayToBase64url,uint8ArrayToHex:()=>uint8ArrayToHex,unwrapMessage:()=>unwrapMessage});function assertEqual(e){return e}function assertNotEqual(e){return e}function assertIs(e){}function assertNever(e){throw Error(`Unexpected value in exhaustive check`)}function assert(e){}function getEnumValues(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function joinValues(e,t=`|`){return e.map(e=>stringifyPrimitive(e)).join(t)}function jsonStringifyReplacer(e,t){return typeof t==`bigint`?t.toString():t}function cached(e){let t=!1;return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function nullish$2(e){return e==null}function cleanRegex(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function floatSafeRemainder$1(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const EVALUATING=Symbol(`evaluating`);function defineLazy(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==EVALUATING)return r===void 0&&(r=EVALUATING,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function objectClone(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function assignProp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function mergeDefs(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cloneDef(e){return mergeDefs(e._zod.def)}function getElementAtPath(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function promiseAllObject(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function randomString(e=10){let t=`abcdefghijklmnopqrstuvwxyz`,n=``;for(let t=0;t<e;t++)n+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return n}function esc(e){return JSON.stringify(e)}function slugify(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const captureStackTrace=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function isObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const allowsEval=cached(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function isPlainObject$2(e){if(isObject(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(isObject(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function shallowClone(e){return isPlainObject$2(e)?{...e}:Array.isArray(e)?[...e]:e}function numKeys(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const getParsedType$1=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},propertyKeyTypes=new Set([`string`,`number`,`symbol`]),primitiveTypes=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function clone(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function normalizeParams(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}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function createTransparentProxy(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function stringifyPrimitive(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function optionalKeys(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const NUMBER_FORMAT_RANGES={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},BIGINT_FORMAT_RANGES={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function pick$1(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return clone(e,mergeDefs(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return assignProp(this,`shape`,e),e},checks:[]}))}function omit$1(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return clone(e,mergeDefs(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return assignProp(this,`shape`,r),r},checks:[]}))}function extend$1(e,t){if(!isPlainObject$2(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return clone(e,mergeDefs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return assignProp(this,`shape`,n),n}}))}function safeExtend$1(e,t){if(!isPlainObject$2(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return clone(e,mergeDefs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return assignProp(this,`shape`,n),n}}))}function merge$1(e,t){return clone(e,mergeDefs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return assignProp(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function partial$1(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return clone(t,mergeDefs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return assignProp(this,`shape`,i),i},checks:[]}))}function required$1(e,t,n){return clone(t,mergeDefs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return assignProp(this,`shape`,i),i}}))}function aborted(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function prefixIssues(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function unwrapMessage(e){return typeof e==`string`?e:e?.message}function finalizeIssue(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=unwrapMessage(e.inst?._zod.def?.error?.(e))??unwrapMessage(t?.error?.(e))??unwrapMessage(n.customError?.(e))??unwrapMessage(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function getSizableOrigin(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function getLengthableOrigin(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function parsedType(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 t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function issue(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function cleanEnum(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function base64ToUint8Array(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function uint8ArrayToBase64(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function base64urlToUint8Array(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return base64ToUint8Array(t+`=`.repeat((4-t.length%4)%4))}function uint8ArrayToBase64url(e){return uint8ArrayToBase64(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function hexToUint8Array(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function uint8ArrayToHex(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Class$2=class{constructor(...e){}};const initializer$1=(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,jsonStringifyReplacer,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},$ZodError=$constructor(`$ZodError`,initializer$1),$ZodRealError=$constructor(`$ZodError`,initializer$1,{Parent:Error});function flattenError$1(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function formatError(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function treeifyError(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function toDotPath(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function prettifyError(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${toDotPath(e.path)}`);return t.join(`
21
+ `)}const _parse=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $ZodAsyncError;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw captureStackTrace(t,i?.callee),t}return o.value},parse$3=_parse($ZodRealError),_parseAsync=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw captureStackTrace(t,i?.callee),t}return o.value},parseAsync$1=_parseAsync($ZodRealError),_safeParse=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $ZodAsyncError;return a.issues.length?{success:!1,error:new(e??$ZodError)(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}},safeParse$2=_safeParse($ZodRealError),_safeParseAsync=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}},safeParseAsync$2=_safeParseAsync($ZodRealError),_encode=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _parse(e)(t,n,i)},encode$1=_encode($ZodRealError),_decode=e=>(t,n,r)=>_parse(e)(t,n,r),decode$1=_decode($ZodRealError),_encodeAsync=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _parseAsync(e)(t,n,i)},encodeAsync$1=_encodeAsync($ZodRealError),_decodeAsync=e=>async(t,n,r)=>_parseAsync(e)(t,n,r),decodeAsync$1=_decodeAsync($ZodRealError),_safeEncode=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _safeParse(e)(t,n,i)},safeEncode$1=_safeEncode($ZodRealError),_safeDecode=e=>(t,n,r)=>_safeParse(e)(t,n,r),safeDecode$1=_safeDecode($ZodRealError),_safeEncodeAsync=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _safeParseAsync(e)(t,n,i)},safeEncodeAsync$1=_safeEncodeAsync($ZodRealError),_safeDecodeAsync=e=>async(t,n,r)=>_safeParseAsync(e)(t,n,r),safeDecodeAsync$1=_safeDecodeAsync($ZodRealError);var regexes_exports=__exportAll({base64:()=>base64$2,base64url:()=>base64url$2,bigint:()=>bigint$4,boolean:()=>boolean$4,browserEmail:()=>browserEmail,cidrv4:()=>cidrv4$2,cidrv6:()=>cidrv6$2,cuid:()=>cuid$2,cuid2:()=>cuid2$2,date:()=>date$6,datetime:()=>datetime$2,domain:()=>domain,duration:()=>duration$2,e164:()=>e164$2,email:()=>email$2,emoji:()=>emoji$2,extendedDuration:()=>extendedDuration,guid:()=>guid$2,hex:()=>hex$2,hostname:()=>hostname$2,html5Email:()=>html5Email,idnEmail:()=>idnEmail,integer:()=>integer,ipv4:()=>ipv4$2,ipv6:()=>ipv6$2,ksuid:()=>ksuid$2,lowercase:()=>lowercase,mac:()=>mac$2,md5_base64:()=>md5_base64,md5_base64url:()=>md5_base64url,md5_hex:()=>md5_hex,nanoid:()=>nanoid$2,null:()=>_null$3,number:()=>number$4,rfc5322Email:()=>rfc5322Email,sha1_base64:()=>sha1_base64,sha1_base64url:()=>sha1_base64url,sha1_hex:()=>sha1_hex,sha256_base64:()=>sha256_base64,sha256_base64url:()=>sha256_base64url,sha256_hex:()=>sha256_hex,sha384_base64:()=>sha384_base64,sha384_base64url:()=>sha384_base64url,sha384_hex:()=>sha384_hex,sha512_base64:()=>sha512_base64,sha512_base64url:()=>sha512_base64url,sha512_hex:()=>sha512_hex,string:()=>string$4,time:()=>time$2,ulid:()=>ulid$2,undefined:()=>_undefined$3,unicodeEmail:()=>unicodeEmail,uppercase:()=>uppercase,uuid:()=>uuid$2,uuid4:()=>uuid4,uuid6:()=>uuid6,uuid7:()=>uuid7,xid:()=>xid$2});const cuid$2=/^[cC][^\s-]{8,}$/,cuid2$2=/^[0-9a-z]+$/,ulid$2=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xid$2=/^[0-9a-vA-V]{20}$/,ksuid$2=/^[A-Za-z0-9]{27}$/,nanoid$2=/^[a-zA-Z0-9_-]{21}$/,duration$2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,guid$2=/^([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})$/,uuid$2=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,uuid4=uuid$2(4),uuid6=uuid$2(6),uuid7=uuid$2(7),email$2=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,idnEmail=unicodeEmail,browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,_emoji$1=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function emoji$2(){return new RegExp(_emoji$1,`u`)}const ipv4$2=/^(?:(?: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])$/,ipv6$2=/^(([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}|:))$/,mac$2=e=>{let t=escapeRegex(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cidrv4$2=/^((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])$/,cidrv6$2=/^(([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])$/,base64$2=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,base64url$2=/^[A-Za-z0-9_-]*$/,hostname$2=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,e164$2=/^\+[1-9]\d{6,14}$/,dateSource=`(?:(?:\\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])))`,date$6=RegExp(`^${dateSource}$`);function timeSource(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function time$2(e){return RegExp(`^${timeSource(e)}$`)}function datetime$2(e){let t=timeSource({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${dateSource}T(?:${r})$`)}const string$4=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},bigint$4=/^-?\d+n?$/,integer=/^-?\d+$/,number$4=/^-?\d+(?:\.\d+)?$/,boolean$4=/^(?:true|false)$/i,_null$3=/^null$/i,_undefined$3=/^undefined$/i,lowercase=/^[^A-Z]*$/,uppercase=/^[^a-z]*$/,hex$2=/^[0-9a-fA-F]*$/;function fixedBase64(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function fixedBase64url(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const md5_hex=/^[0-9a-fA-F]{32}$/,md5_base64=fixedBase64(22,`==`),md5_base64url=fixedBase64url(22),sha1_hex=/^[0-9a-fA-F]{40}$/,sha1_base64=fixedBase64(27,`=`),sha1_base64url=fixedBase64url(27),sha256_hex=/^[0-9a-fA-F]{64}$/,sha256_base64=fixedBase64(43,`=`),sha256_base64url=fixedBase64url(43),sha384_hex=/^[0-9a-fA-F]{96}$/,sha384_base64=fixedBase64(64,``),sha384_base64url=fixedBase64url(64),sha512_hex=/^[0-9a-fA-F]{128}$/,sha512_base64=fixedBase64(86,`==`),sha512_base64url=fixedBase64url(86),$ZodCheck=$constructor(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),numericOriginMap={number:`number`,bigint:`bigint`,object:`date`},$ZodCheckLessThan=$constructor(`$ZodCheckLessThan`,(e,t)=>{$ZodCheck.init(e,t);let n=numericOriginMap[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$ZodCheckGreaterThan=$constructor(`$ZodCheckGreaterThan`,(e,t)=>{$ZodCheck.init(e,t);let n=numericOriginMap[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$ZodCheckMultipleOf=$constructor(`$ZodCheckMultipleOf`,(e,t)=>{$ZodCheck.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):floatSafeRemainder$1(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),$ZodCheckNumberFormat=$constructor(`$ZodCheckNumberFormat`,(e,t)=>{$ZodCheck.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=NUMBER_FORMAT_RANGES[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=integer)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),$ZodCheckBigIntFormat=$constructor(`$ZodCheckBigIntFormat`,(e,t)=>{$ZodCheck.init(e,t);let[n,r]=BIGINT_FORMAT_RANGES[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),$ZodCheckMaxSize=$constructor(`$ZodCheckMaxSize`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:getSizableOrigin(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$ZodCheckMinSize=$constructor(`$ZodCheckMinSize`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:getSizableOrigin(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$ZodCheckSizeEquals=$constructor(`$ZodCheckSizeEquals`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:getSizableOrigin(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$ZodCheckMaxLength=$constructor(`$ZodCheckMaxLength`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=getLengthableOrigin(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$ZodCheckMinLength=$constructor(`$ZodCheckMinLength`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=getLengthableOrigin(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$ZodCheckLengthEquals=$constructor(`$ZodCheckLengthEquals`,(e,t)=>{var n;$ZodCheck.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nullish$2(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=getLengthableOrigin(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$ZodCheckStringFormat=$constructor(`$ZodCheckStringFormat`,(e,t)=>{var n,r;$ZodCheck.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$ZodCheckRegex=$constructor(`$ZodCheckRegex`,(e,t)=>{$ZodCheckStringFormat.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$ZodCheckLowerCase=$constructor(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=lowercase,$ZodCheckStringFormat.init(e,t)}),$ZodCheckUpperCase=$constructor(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=uppercase,$ZodCheckStringFormat.init(e,t)}),$ZodCheckIncludes=$constructor(`$ZodCheckIncludes`,(e,t)=>{$ZodCheck.init(e,t);let n=escapeRegex(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$ZodCheckStartsWith=$constructor(`$ZodCheckStartsWith`,(e,t)=>{$ZodCheck.init(e,t);let n=RegExp(`^${escapeRegex(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),$ZodCheckEndsWith=$constructor(`$ZodCheckEndsWith`,(e,t)=>{$ZodCheck.init(e,t);let n=RegExp(`.*${escapeRegex(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function handleCheckPropertyResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues))}const $ZodCheckProperty=$constructor(`$ZodCheckProperty`,(e,t)=>{$ZodCheck.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>handleCheckPropertyResult(n,e,t.property));handleCheckPropertyResult(n,e,t.property)}}),$ZodCheckMimeType=$constructor(`$ZodCheckMimeType`,(e,t)=>{$ZodCheck.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),$ZodCheckOverwrite=$constructor(`$ZodCheckOverwrite`,(e,t)=>{$ZodCheck.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Doc=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
22
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
23
+ `))}};const version={major:4,minor:3,patch:6},$ZodType=$constructor(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=version;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=aborted(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new $ZodAsyncError;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=aborted(e,t))});else{if(e.issues.length===t)continue;r||=aborted(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(aborted(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new $ZodAsyncError;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new $ZodAsyncError;return o.then(e=>t(e,r,a))}return t(o,r,a)}}defineLazy(e,`~standard`,()=>({validate:t=>{try{let n=safeParse$2(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return safeParseAsync$2(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),$ZodString=$constructor(`$ZodString`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??string$4(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),$ZodStringFormat=$constructor(`$ZodStringFormat`,(e,t)=>{$ZodCheckStringFormat.init(e,t),$ZodString.init(e,t)}),$ZodGUID=$constructor(`$ZodGUID`,(e,t)=>{t.pattern??=guid$2,$ZodStringFormat.init(e,t)}),$ZodUUID=$constructor(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=uuid$2(e)}else t.pattern??=uuid$2();$ZodStringFormat.init(e,t)}),$ZodEmail=$constructor(`$ZodEmail`,(e,t)=>{t.pattern??=email$2,$ZodStringFormat.init(e,t)}),$ZodURL=$constructor(`$ZodURL`,(e,t)=>{$ZodStringFormat.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),$ZodEmoji=$constructor(`$ZodEmoji`,(e,t)=>{t.pattern??=emoji$2(),$ZodStringFormat.init(e,t)}),$ZodNanoID=$constructor(`$ZodNanoID`,(e,t)=>{t.pattern??=nanoid$2,$ZodStringFormat.init(e,t)}),$ZodCUID=$constructor(`$ZodCUID`,(e,t)=>{t.pattern??=cuid$2,$ZodStringFormat.init(e,t)}),$ZodCUID2=$constructor(`$ZodCUID2`,(e,t)=>{t.pattern??=cuid2$2,$ZodStringFormat.init(e,t)}),$ZodULID=$constructor(`$ZodULID`,(e,t)=>{t.pattern??=ulid$2,$ZodStringFormat.init(e,t)}),$ZodXID=$constructor(`$ZodXID`,(e,t)=>{t.pattern??=xid$2,$ZodStringFormat.init(e,t)}),$ZodKSUID=$constructor(`$ZodKSUID`,(e,t)=>{t.pattern??=ksuid$2,$ZodStringFormat.init(e,t)}),$ZodISODateTime=$constructor(`$ZodISODateTime`,(e,t)=>{t.pattern??=datetime$2(t),$ZodStringFormat.init(e,t)}),$ZodISODate=$constructor(`$ZodISODate`,(e,t)=>{t.pattern??=date$6,$ZodStringFormat.init(e,t)}),$ZodISOTime=$constructor(`$ZodISOTime`,(e,t)=>{t.pattern??=time$2(t),$ZodStringFormat.init(e,t)}),$ZodISODuration=$constructor(`$ZodISODuration`,(e,t)=>{t.pattern??=duration$2,$ZodStringFormat.init(e,t)}),$ZodIPv4=$constructor(`$ZodIPv4`,(e,t)=>{t.pattern??=ipv4$2,$ZodStringFormat.init(e,t),e._zod.bag.format=`ipv4`}),$ZodIPv6=$constructor(`$ZodIPv6`,(e,t)=>{t.pattern??=ipv6$2,$ZodStringFormat.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),$ZodMAC=$constructor(`$ZodMAC`,(e,t)=>{t.pattern??=mac$2(t.delimiter),$ZodStringFormat.init(e,t),e._zod.bag.format=`mac`}),$ZodCIDRv4=$constructor(`$ZodCIDRv4`,(e,t)=>{t.pattern??=cidrv4$2,$ZodStringFormat.init(e,t)}),$ZodCIDRv6=$constructor(`$ZodCIDRv6`,(e,t)=>{t.pattern??=cidrv6$2,$ZodStringFormat.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function isValidBase64(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const $ZodBase64=$constructor(`$ZodBase64`,(e,t)=>{t.pattern??=base64$2,$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{isValidBase64(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function isValidBase64URL(e){if(!base64url$2.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return isValidBase64(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const $ZodBase64URL=$constructor(`$ZodBase64URL`,(e,t)=>{t.pattern??=base64url$2,$ZodStringFormat.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{isValidBase64URL(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),$ZodE164=$constructor(`$ZodE164`,(e,t)=>{t.pattern??=e164$2,$ZodStringFormat.init(e,t)});function isValidJWT$1(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const $ZodJWT=$constructor(`$ZodJWT`,(e,t)=>{$ZodStringFormat.init(e,t),e._zod.check=n=>{isValidJWT$1(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),$ZodCustomStringFormat=$constructor(`$ZodCustomStringFormat`,(e,t)=>{$ZodStringFormat.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),$ZodNumber=$constructor(`$ZodNumber`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=e._zod.bag.pattern??number$4,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$ZodNumberFormat=$constructor(`$ZodNumberFormat`,(e,t)=>{$ZodCheckNumberFormat.init(e,t),$ZodNumber.init(e,t)}),$ZodBoolean=$constructor(`$ZodBoolean`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=boolean$4,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),$ZodBigInt=$constructor(`$ZodBigInt`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=bigint$4,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),$ZodBigIntFormat=$constructor(`$ZodBigIntFormat`,(e,t)=>{$ZodCheckBigIntFormat.init(e,t),$ZodBigInt.init(e,t)}),$ZodSymbol=$constructor(`$ZodSymbol`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),$ZodUndefined=$constructor(`$ZodUndefined`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=_undefined$3,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),$ZodNull=$constructor(`$ZodNull`,(e,t)=>{$ZodType.init(e,t),e._zod.pattern=_null$3,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),$ZodAny=$constructor(`$ZodAny`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=e=>e}),$ZodUnknown=$constructor(`$ZodUnknown`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=e=>e}),$ZodNever=$constructor(`$ZodNever`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),$ZodVoid=$constructor(`$ZodVoid`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),$ZodDate=$constructor(`$ZodDate`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function handleArrayResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}const $ZodArray=$constructor(`$ZodArray`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>handleArrayResult(t,n,e))):handleArrayResult(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function handlePropertyResult(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...prefixIssues(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function normalizeDef(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 n=optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function handleCatchall(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>handlePropertyResult(e,n,i,t,u))):handlePropertyResult(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const $ZodObject=$constructor(`$ZodObject`,(e,t)=>{if($ZodType.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=cached(()=>normalizeDef(t));defineLazy(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=isObject,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>handlePropertyResult(n,t,e,s,r))):handlePropertyResult(i,t,e,s,r)}return i?handleCatchall(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),$ZodObjectJIT=$constructor(`$ZodObjectJIT`,(e,t)=>{$ZodObject.init(e,t);let n=e._zod.parse,r=cached(()=>normalizeDef(t)),i=e=>{let t=new Doc([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=esc(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=esc(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
24
+ if (${n}.issues.length) {
25
+ if (${o} in input) {
26
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
27
+ ...iss,
28
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
29
+ })));
30
+ }
31
+ }
32
+
33
+ if (${n}.value === undefined) {
34
+ if (${o} in input) {
35
+ newResult[${o}] = undefined;
36
+ }
37
+ } else {
38
+ newResult[${o}] = ${n}.value;
39
+ }
40
+
41
+ `):t.write(`
42
+ if (${n}.issues.length) {
43
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
44
+ ...iss,
45
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
46
+ })));
47
+ }
48
+
49
+ if (${n}.value === undefined) {
50
+ if (${o} in input) {
51
+ newResult[${o}] = undefined;
52
+ }
53
+ } else {
54
+ newResult[${o}] = ${n}.value;
55
+ }
56
+
57
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=isObject,s=!globalConfig.jitless,c=s&&allowsEval.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?handleCatchall([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function handleUnionResults(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!aborted(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>finalizeIssue(e,r,config())))}),t)}const $ZodUnion=$constructor(`$ZodUnion`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),defineLazy(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),defineLazy(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),defineLazy(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>cleanRegex(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>handleUnionResults(t,i,e,a)):handleUnionResults(s,i,e,a)}});function handleExclusiveUnionResults(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>finalizeIssue(e,r,config())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}const $ZodXor=$constructor(`$ZodXor`,(e,t)=>{$ZodUnion.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>handleExclusiveUnionResults(t,i,e,a)):handleExclusiveUnionResults(s,i,e,a)}}),$ZodDiscriminatedUnion=$constructor(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,$ZodUnion.init(e,t);let n=e._zod.parse;defineLazy(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=cached(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!isObject(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),$ZodIntersection=$constructor(`$ZodIntersection`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>handleIntersectionResults(e,t,n)):handleIntersectionResults(e,i,a)}});function mergeValues$1(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(isPlainObject$2(e)&&isPlainObject$2(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mergeValues$1(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mergeValues$1(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function handleIntersectionResults(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),aborted(e))return e;let o=mergeValues$1(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const $ZodTuple=$constructor(`$ZodTuple`,(e,t)=>{$ZodType.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length<c-1;if(t||i)return r.issues.push({...t?{code:`too_big`,maximum:n.length,inclusive:!0}:{code:`too_small`,minimum:n.length},input:a,inst:e,origin:`array`}),r}let l=-1;for(let e of n){if(l++,l>=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>handleTupleResult(e,r,l))):handleTupleResult(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>handleTupleResult(e,r,l))):handleTupleResult(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function handleTupleResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}const $ZodRecord=$constructor(`$ZodRecord`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!isPlainObject$2(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...prefixIssues(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...prefixIssues(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&number$4.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>finalizeIssue(e,r,config())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...prefixIssues(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...prefixIssues(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),$ZodMap=$constructor(`$ZodMap`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{handleMapResult(t,a,n,o,i,e,r)})):handleMapResult(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function handleMapResult(e,t,n,r,i,a,o){e.issues.length&&(propertyKeyTypes.has(typeof r)?n.issues.push(...prefixIssues(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>finalizeIssue(e,o,config()))})),t.issues.length&&(propertyKeyTypes.has(typeof r)?n.issues.push(...prefixIssues(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>finalizeIssue(e,o,config()))})),n.value.set(e.value,t.value)}const $ZodSet=$constructor(`$ZodSet`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>handleSetResult(e,n))):handleSetResult(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function handleSetResult(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const $ZodEnum=$constructor(`$ZodEnum`,(e,t)=>{$ZodType.init(e,t);let n=getEnumValues(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>propertyKeyTypes.has(typeof e)).map(e=>typeof e==`string`?escapeRegex(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),$ZodLiteral=$constructor(`$ZodLiteral`,(e,t)=>{if($ZodType.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?escapeRegex(e):e?escapeRegex(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),$ZodFile=$constructor(`$ZodFile`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),$ZodTransform=$constructor(`$ZodTransform`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $ZodEncodeError(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new $ZodAsyncError;return n.value=i,n}});function handleOptionalResult(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const $ZodOptional=$constructor(`$ZodOptional`,(e,t)=>{$ZodType.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,defineLazy(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),defineLazy(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cleanRegex(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>handleOptionalResult(t,e.value)):handleOptionalResult(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),$ZodExactOptional=$constructor(`$ZodExactOptional`,(e,t)=>{$ZodOptional.init(e,t),defineLazy(e._zod,`values`,()=>t.innerType._zod.values),defineLazy(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$ZodNullable=$constructor(`$ZodNullable`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`optin`,()=>t.innerType._zod.optin),defineLazy(e._zod,`optout`,()=>t.innerType._zod.optout),defineLazy(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cleanRegex(e.source)}|null)$`):void 0}),defineLazy(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),$ZodDefault=$constructor(`$ZodDefault`,(e,t)=>{$ZodType.init(e,t),e._zod.optin=`optional`,defineLazy(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>handleDefaultResult(e,t)):handleDefaultResult(r,t)}});function handleDefaultResult(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const $ZodPrefault=$constructor(`$ZodPrefault`,(e,t)=>{$ZodType.init(e,t),e._zod.optin=`optional`,defineLazy(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$ZodNonOptional=$constructor(`$ZodNonOptional`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>handleNonOptionalResult(t,e)):handleNonOptionalResult(i,e)}});function handleNonOptionalResult(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const $ZodSuccess=$constructor(`$ZodSuccess`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new $ZodEncodeError(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),$ZodCatch=$constructor(`$ZodCatch`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`optin`,()=>t.innerType._zod.optin),defineLazy(e._zod,`optout`,()=>t.innerType._zod.optout),defineLazy(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>finalizeIssue(e,n,config()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>finalizeIssue(e,n,config()))},input:e.value}),e.issues=[]),e)}}),$ZodNaN=$constructor(`$ZodNaN`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),$ZodPipe=$constructor(`$ZodPipe`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`values`,()=>t.in._zod.values),defineLazy(e._zod,`optin`,()=>t.in._zod.optin),defineLazy(e._zod,`optout`,()=>t.out._zod.optout),defineLazy(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>handlePipeResult(e,t.in,n)):handlePipeResult(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>handlePipeResult(e,t.out,n)):handlePipeResult(r,t.out,n)}});function handlePipeResult(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const $ZodCodec=$constructor(`$ZodCodec`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`values`,()=>t.in._zod.values),defineLazy(e._zod,`optin`,()=>t.in._zod.optin),defineLazy(e._zod,`optout`,()=>t.out._zod.optout),defineLazy(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>handleCodecAResult(e,t,n)):handleCodecAResult(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>handleCodecAResult(e,t,n)):handleCodecAResult(r,t,n)}}});function handleCodecAResult(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>handleCodecTxResult(e,r,t.out,n)):handleCodecTxResult(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>handleCodecTxResult(e,r,t.in,n)):handleCodecTxResult(e,r,t.in,n)}}function handleCodecTxResult(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const $ZodReadonly=$constructor(`$ZodReadonly`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`propValues`,()=>t.innerType._zod.propValues),defineLazy(e._zod,`values`,()=>t.innerType._zod.values),defineLazy(e._zod,`optin`,()=>t.innerType?._zod?.optin),defineLazy(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(handleReadonlyResult):handleReadonlyResult(r)}});function handleReadonlyResult(e){return e.value=Object.freeze(e.value),e}const $ZodTemplateLiteral=$constructor(`$ZodTemplateLiteral`,(e,t)=>{$ZodType.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=t.startsWith(`^`)?1:0,i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||primitiveTypes.has(typeof e))n.push(escapeRegex(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),$ZodFunction=$constructor(`$ZodFunction`,(e,t)=>($ZodType.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?parse$3(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?parse$3(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await parseAsync$1(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await parseAsync$1(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new $ZodTuple({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),$ZodPromise=$constructor(`$ZodPromise`,(e,t)=>{$ZodType.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),$ZodLazy=$constructor(`$ZodLazy`,(e,t)=>{$ZodType.init(e,t),defineLazy(e._zod,`innerType`,()=>t.getter()),defineLazy(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),defineLazy(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),defineLazy(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),defineLazy(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),$ZodCustom=$constructor(`$ZodCustom`,(e,t)=>{$ZodCheck.init(e,t),$ZodType.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>handleRefineResult(t,n,r,e));handleRefineResult(i,n,r,e)}});function handleRefineResult(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(issue(e))}}const error$46=()=>{let e={string:{unit:`حرف`,verb:`أن يحوي`},file:{unit:`بايت`,verb:`أن يحوي`},array:{unit:`عنصر`,verb:`أن يحوي`},set:{unit:`عنصر`,verb:`أن يحوي`}};function t(t){return e[t]??null}let n={regex:`مدخل`,email:`بريد إلكتروني`,url:`رابط`,emoji:`إيموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاريخ ووقت بمعيار ISO`,date:`تاريخ بمعيار ISO`,time:`وقت بمعيار ISO`,duration:`مدة بمعيار ISO`,ipv4:`عنوان IPv4`,ipv6:`عنوان IPv6`,cidrv4:`مدى عناوين بصيغة IPv4`,cidrv6:`مدى عناوين بصيغة IPv6`,base64:`نَص بترميز base64-encoded`,base64url:`نَص بترميز base64url-encoded`,json_string:`نَص على هيئة JSON`,e164:`رقم هاتف بمعيار E.164`,jwt:`JWT`,template_literal:`مدخل`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${e.expected}، ولكن تم إدخال ${i}`:`مدخلات غير مقبولة: يفترض إدخال ${t}، ولكن تم إدخال ${i}`}case`invalid_value`:return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${stringifyPrimitive(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?` أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()} ${r.unit??`عنصر`}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()} ${r.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:t.format===`ends_with`?`نَص غير مقبول: يجب أن ينتهي بـ "${t.suffix}"`:t.format===`includes`?`نَص غير مقبول: يجب أن يتضمَّن "${t.includes}"`:t.format===`regex`?`نَص غير مقبول: يجب أن يطابق النمط ${t.pattern}`:`${n[t.format]??e.format} غير مقبول`}case`not_multiple_of`:return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case`unrecognized_keys`:return`معرف${e.keys.length>1?`ات`:``} غريب${e.keys.length>1?`ة`:``}: ${joinValues(e.keys,`، `)}`;case`invalid_key`:return`معرف غير مقبول في ${e.origin}`;case`invalid_union`:return`مدخل غير مقبول`;case`invalid_element`:return`مدخل غير مقبول في ${e.origin}`;default:return`مدخل غير مقبول`}}};function ar_default(){return{localeError:error$46()}}const error$45=()=>{let e={string:{unit:`simvol`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`element`,verb:`olmalıdır`},set:{unit:`element`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={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`,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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Yanlış dəyər: gözlənilən instanceof ${e.expected}, daxil olan ${i}`:`Yanlış dəyər: gözlənilən ${t}, daxil olan ${i}`}case`invalid_value`:return e.values.length===1?`Yanlış dəyər: gözlənilən ${stringifyPrimitive(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()} ${r.unit??`element`}`:`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Yanlış mətn: "${t.prefix}" ilə başlamalıdır`:t.format===`ends_with`?`Yanlış mətn: "${t.suffix}" ilə bitməlidir`:t.format===`includes`?`Yanlış mətn: "${t.includes}" daxil olmalıdır`:t.format===`regex`?`Yanlış mətn: ${t.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[t.format]??e.format}`}case`not_multiple_of`:return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case`unrecognized_keys`:return`Tanınmayan açar${e.keys.length>1?`lar`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} daxilində yanlış açar`;case`invalid_union`:return`Yanlış dəyər`;case`invalid_element`:return`${e.origin} daxilində yanlış dəyər`;default:return`Yanlış dəyər`}}};function az_default(){return{localeError:error$45()}}function getBelarusianPlural(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}const error$44=()=>{let e={string:{unit:{one:`сімвал`,few:`сімвалы`,many:`сімвалаў`},verb:`мець`},array:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},set:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},file:{unit:{one:`байт`,few:`байты`,many:`байтаў`},verb:`мець`}};function t(t){return e[t]??null}let n={regex:`увод`,email:`email адрас`,url:`URL`,emoji:`эмодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата і час`,date:`ISO дата`,time:`ISO час`,duration:`ISO працягласць`,ipv4:`IPv4 адрас`,ipv6:`IPv6 адрас`,cidrv4:`IPv4 дыяпазон`,cidrv6:`IPv6 дыяпазон`,base64:`радок у фармаце base64`,base64url:`радок у фармаце base64url`,json_string:`JSON радок`,e164:`нумар E.164`,jwt:`JWT`,template_literal:`увод`},r={nan:`NaN`,number:`лік`,array:`масіў`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Няправільны ўвод: чакаўся instanceof ${e.expected}, атрымана ${i}`:`Няправільны ўвод: чакаўся ${t}, атрымана ${i}`}case`invalid_value`:return e.values.length===1?`Няправільны ўвод: чакалася ${stringifyPrimitive(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=getBelarusianPlural(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна ${r.verb} ${n}${e.maximum.toString()} ${t}`}return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна быць ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=getBelarusianPlural(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${r.verb} ${n}${e.minimum.toString()} ${t}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Няправільны радок: павінен пачынацца з "${t.prefix}"`:t.format===`ends_with`?`Няправільны радок: павінен заканчвацца на "${t.suffix}"`:t.format===`includes`?`Няправільны радок: павінен змяшчаць "${t.includes}"`:t.format===`regex`?`Няправільны радок: павінен адпавядаць шаблону ${t.pattern}`:`Няправільны ${n[t.format]??e.format}`}case`not_multiple_of`:return`Няправільны лік: павінен быць кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспазнаны ${e.keys.length>1?`ключы`:`ключ`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Няправільны ключ у ${e.origin}`;case`invalid_union`:return`Няправільны ўвод`;case`invalid_element`:return`Няправільнае значэнне ў ${e.origin}`;default:return`Няправільны ўвод`}}};function be_default(){return{localeError:error$44()}}const error$43=()=>{let e={string:{unit:`символа`,verb:`да съдържа`},file:{unit:`байта`,verb:`да съдържа`},array:{unit:`елемента`,verb:`да съдържа`},set:{unit:`елемента`,verb:`да съдържа`}};function t(t){return e[t]??null}let n={regex:`вход`,email:`имейл адрес`,url:`URL`,emoji:`емоджи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO време`,date:`ISO дата`,time:`ISO време`,duration:`ISO продължителност`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`base64-кодиран низ`,base64url:`base64url-кодиран низ`,json_string:`JSON низ`,e164:`E.164 номер`,jwt:`JWT`,template_literal:`вход`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Невалиден вход: очакван instanceof ${e.expected}, получен ${i}`:`Невалиден вход: очакван ${t}, получен ${i}`}case`invalid_value`:return e.values.length===1?`Невалиден вход: очакван ${stringifyPrimitive(e.values[0])}`:`Невалидна опция: очаквано едно от ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Твърде голямо: очаква се ${e.origin??`стойност`} да съдържа ${n}${e.maximum.toString()} ${r.unit??`елемента`}`:`Твърде голямо: очаква се ${e.origin??`стойност`} да бъде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Твърде малко: очаква се ${e.origin} да съдържа ${n}${e.minimum.toString()} ${r.unit}`:`Твърде малко: очаква се ${e.origin} да бъде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;if(t.format===`starts_with`)return`Невалиден низ: трябва да започва с "${t.prefix}"`;if(t.format===`ends_with`)return`Невалиден низ: трябва да завършва с "${t.suffix}"`;if(t.format===`includes`)return`Невалиден низ: трябва да включва "${t.includes}"`;if(t.format===`regex`)return`Невалиден низ: трябва да съвпада с ${t.pattern}`;let r=`Невалиден`;return t.format===`emoji`&&(r=`Невалидно`),t.format===`datetime`&&(r=`Невалидно`),t.format===`date`&&(r=`Невалидна`),t.format===`time`&&(r=`Невалидно`),t.format===`duration`&&(r=`Невалидна`),`${r} ${n[t.format]??e.format}`}case`not_multiple_of`:return`Невалидно число: трябва да бъде кратно на ${e.divisor}`;case`unrecognized_keys`:return`Неразпознат${e.keys.length>1?`и`:``} ключ${e.keys.length>1?`ове`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Невалиден ключ в ${e.origin}`;case`invalid_union`:return`Невалиден вход`;case`invalid_element`:return`Невалидна стойност в ${e.origin}`;default:return`Невалиден вход`}}};function bg_default(){return{localeError:error$43()}}const error$42=()=>{let e={string:{unit:`caràcters`,verb:`contenir`},file:{unit:`bytes`,verb:`contenir`},array:{unit:`elements`,verb:`contenir`},set:{unit:`elements`,verb:`contenir`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`adreça electrònica`,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:`data i hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`durada ISO`,ipv4:`adreça IPv4`,ipv6:`adreça IPv6`,cidrv4:`rang IPv4`,cidrv6:`rang IPv6`,base64:`cadena codificada en base64`,base64url:`cadena codificada en base64url`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipus invàlid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invàlid: s'esperava ${t}, s'ha rebut ${i}`}case`invalid_value`:return e.values.length===1?`Valor invàlid: s'esperava ${stringifyPrimitive(e.values[0])}`:`Opció invàlida: s'esperava una de ${joinValues(e.values,` o `)}`;case`too_big`:{let n=e.inclusive?`com a màxim`:`menys de`,r=t(e.origin);return r?`Massa gran: s'esperava que ${e.origin??`el valor`} contingués ${n} ${e.maximum.toString()} ${r.unit??`elements`}`:`Massa gran: s'esperava que ${e.origin??`el valor`} fos ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`com a mínim`:`més de`,r=t(e.origin);return r?`Massa petit: s'esperava que ${e.origin} contingués ${n} ${e.minimum.toString()} ${r.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Format invàlid: ha de començar amb "${t.prefix}"`:t.format===`ends_with`?`Format invàlid: ha d'acabar amb "${t.suffix}"`:t.format===`includes`?`Format invàlid: ha d'incloure "${t.includes}"`:t.format===`regex`?`Format invàlid: ha de coincidir amb el patró ${t.pattern}`:`Format invàlid per a ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case`unrecognized_keys`:return`Clau${e.keys.length>1?`s`:``} no reconeguda${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Clau invàlida a ${e.origin}`;case`invalid_union`:return`Entrada invàlida`;case`invalid_element`:return`Element invàlid a ${e.origin}`;default:return`Entrada invàlida`}}};function ca_default(){return{localeError:error$42()}}const error$41=()=>{let e={string:{unit:`znaků`,verb:`mít`},file:{unit:`bajtů`,verb:`mít`},array:{unit:`prvků`,verb:`mít`},set:{unit:`prvků`,verb:`mít`}};function t(t){return e[t]??null}let n={regex:`regulární výraz`,email:`e-mailová adresa`,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:`datum a čas ve formátu ISO`,date:`datum ve formátu ISO`,time:`čas ve formátu ISO`,duration:`doba trvání ISO`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`rozsah IPv4`,cidrv6:`rozsah IPv6`,base64:`řetězec zakódovaný ve formátu base64`,base64url:`řetězec zakódovaný ve formátu base64url`,json_string:`řetězec ve formátu JSON`,e164:`číslo E.164`,jwt:`JWT`,template_literal:`vstup`},r={nan:`NaN`,number:`číslo`,string:`řetězec`,function:`funkce`,array:`pole`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: očekáváno instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: očekáváno ${t}, obdrženo ${i}`}case`invalid_value`:return e.values.length===1?`Neplatný vstup: očekáváno ${stringifyPrimitive(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Hodnota je příliš velká: ${e.origin??`hodnota`} musí mít ${n}${e.maximum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš velká: ${e.origin??`hodnota`} musí být ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Hodnota je příliš malá: ${e.origin??`hodnota`} musí mít ${n}${e.minimum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš malá: ${e.origin??`hodnota`} musí být ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neplatný řetězec: musí začínat na "${t.prefix}"`:t.format===`ends_with`?`Neplatný řetězec: musí končit na "${t.suffix}"`:t.format===`includes`?`Neplatný řetězec: musí obsahovat "${t.includes}"`:t.format===`regex`?`Neplatný řetězec: musí odpovídat vzoru ${t.pattern}`:`Neplatný formát ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neplatné číslo: musí být násobkem ${e.divisor}`;case`unrecognized_keys`:return`Neznámé klíče: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Neplatný klíč v ${e.origin}`;case`invalid_union`:return`Neplatný vstup`;case`invalid_element`:return`Neplatná hodnota v ${e.origin}`;default:return`Neplatný vstup`}}};function cs_default(){return{localeError:error$41()}}const error$40=()=>{let e={string:{unit:`tegn`,verb:`havde`},file:{unit:`bytes`,verb:`havde`},array:{unit:`elementer`,verb:`indeholdt`},set:{unit:`elementer`,verb:`indeholdt`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-mailadresse`,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 dato- og klokkeslæt`,date:`ISO-dato`,time:`ISO-klokkeslæt`,duration:`ISO-varighed`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodet streng`,base64url:`base64url-kodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,string:`streng`,number:`tal`,boolean:`boolean`,array:`liste`,object:`objekt`,set:`sæt`,file:`fil`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig værdi: forventede ${stringifyPrimitive(e.values[0])}`:`Ugyldigt valg: forventede en af følgende ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For stor: forventede ${a??`value`} ${i.verb} ${n} ${e.maximum.toString()} ${i.unit??`elementer`}`:`For stor: forventede ${a??`value`} havde ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For lille: forventede ${a} ${i.verb} ${n} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${a} havde ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: skal starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: skal ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: skal indeholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: skal matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldigt tal: skal være deleligt med ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukendte nøgler`:`Ukendt nøgle`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøgle i ${e.origin}`;case`invalid_union`:return`Ugyldigt input: matcher ingen af de tilladte typer`;case`invalid_element`:return`Ugyldig værdi i ${e.origin}`;default:return`Ugyldigt input`}}};function da_default(){return{localeError:error$40()}}const error$39=()=>{let e={string:{unit:`Zeichen`,verb:`zu haben`},file:{unit:`Bytes`,verb:`zu haben`},array:{unit:`Elemente`,verb:`zu haben`},set:{unit:`Elemente`,verb:`zu haben`}};function t(t){return e[t]??null}let n={regex:`Eingabe`,email:`E-Mail-Adresse`,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-Datum und -Uhrzeit`,date:`ISO-Datum`,time:`ISO-Uhrzeit`,duration:`ISO-Dauer`,ipv4:`IPv4-Adresse`,ipv6:`IPv6-Adresse`,cidrv4:`IPv4-Bereich`,cidrv6:`IPv6-Bereich`,base64:`Base64-codierter String`,base64url:`Base64-URL-codierter String`,json_string:`JSON-String`,e164:`E.164-Nummer`,jwt:`JWT`,template_literal:`Eingabe`},r={nan:`NaN`,number:`Zahl`,array:`Array`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case`invalid_value`:return e.values.length===1?`Ungültige Eingabe: erwartet ${stringifyPrimitive(e.values[0])}`:`Ungültige Option: erwartet eine von ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ${r.unit??`Elemente`} hat`:`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ist`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ${r.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ist`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ungültiger String: muss mit "${t.prefix}" beginnen`:t.format===`ends_with`?`Ungültiger String: muss mit "${t.suffix}" enden`:t.format===`includes`?`Ungültiger String: muss "${t.includes}" enthalten`:t.format===`regex`?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case`unrecognized_keys`:return`${e.keys.length>1?`Unbekannte Schlüssel`:`Unbekannter Schlüssel`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Ungültiger Schlüssel in ${e.origin}`;case`invalid_union`:return`Ungültige Eingabe`;case`invalid_element`:return`Ungültiger Wert in ${e.origin}`;default:return`Ungültige Eingabe`}}};function de_default(){return{localeError:error$39()}}const error$38=()=>{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(t){return e[t]??null}let n={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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${stringifyPrimitive(e.values[0])}`:`Invalid option: expected one of ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function en_default(){return{localeError:error$38()}}const error$37=()=>{let e={string:{unit:`karaktrojn`,verb:`havi`},file:{unit:`bajtojn`,verb:`havi`},array:{unit:`elementojn`,verb:`havi`},set:{unit:`elementojn`,verb:`havi`}};function t(t){return e[t]??null}let n={regex:`enigo`,email:`retadreso`,url:`URL`,emoji:`emoĝio`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datotempo`,date:`ISO-dato`,time:`ISO-tempo`,duration:`ISO-daŭro`,ipv4:`IPv4-adreso`,ipv6:`IPv6-adreso`,cidrv4:`IPv4-rango`,cidrv6:`IPv6-rango`,base64:`64-ume kodita karaktraro`,base64url:`URL-64-ume kodita karaktraro`,json_string:`JSON-karaktraro`,e164:`E.164-nombro`,jwt:`JWT`,template_literal:`enigo`},r={nan:`NaN`,number:`nombro`,array:`tabelo`,null:`senvalora`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiĝis instanceof ${e.expected}, riceviĝis ${i}`:`Nevalida enigo: atendiĝis ${t}, riceviĝis ${i}`}case`invalid_value`:return e.values.length===1?`Nevalida enigo: atendiĝis ${stringifyPrimitive(e.values[0])}`:`Nevalida opcio: atendiĝis unu el ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()} ${r.unit??`elementojn`}`:`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Tro malgranda: atendiĝis ke ${e.origin} havu ${n}${e.minimum.toString()} ${r.unit}`:`Tro malgranda: atendiĝis ke ${e.origin} estu ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nevalida karaktraro: devas komenciĝi per "${t.prefix}"`:t.format===`ends_with`?`Nevalida karaktraro: devas finiĝi per "${t.suffix}"`:t.format===`includes`?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:t.format===`regex`?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case`unrecognized_keys`:return`Nekonata${e.keys.length>1?`j`:``} ŝlosilo${e.keys.length>1?`j`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Nevalida ŝlosilo en ${e.origin}`;case`invalid_union`:return`Nevalida enigo`;case`invalid_element`:return`Nevalida valoro en ${e.origin}`;default:return`Nevalida enigo`}}};function eo_default(){return{localeError:error$37()}}const error$36=()=>{let e={string:{unit:`caracteres`,verb:`tener`},file:{unit:`bytes`,verb:`tener`},array:{unit:`elementos`,verb:`tener`},set:{unit:`elementos`,verb:`tener`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`dirección de correo electrónico`,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:`fecha y hora ISO`,date:`fecha ISO`,time:`hora ISO`,duration:`duración ISO`,ipv4:`dirección IPv4`,ipv6:`dirección IPv6`,cidrv4:`rango IPv4`,cidrv6:`rango IPv6`,base64:`cadena codificada en base64`,base64url:`URL codificada en base64`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,string:`texto`,number:`número`,boolean:`booleano`,array:`arreglo`,object:`objeto`,set:`conjunto`,file:`archivo`,date:`fecha`,bigint:`número grande`,symbol:`símbolo`,undefined:`indefinido`,null:`nulo`,function:`función`,map:`mapa`,record:`registro`,tuple:`tupla`,enum:`enumeración`,union:`unión`,literal:`literal`,promise:`promesa`,void:`vacío`,never:`nunca`,unknown:`desconocido`,any:`cualquiera`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrada inválida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada inválida: se esperaba ${t}, recibido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: se esperaba ${stringifyPrimitive(e.values[0])}`:`Opción inválida: se esperaba una de ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${a??`valor`} tuviera ${n}${e.maximum.toString()} ${i.unit??`elementos`}`:`Demasiado grande: se esperaba que ${a??`valor`} fuera ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado pequeño: se esperaba que ${a} tuviera ${n}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeño: se esperaba que ${a} fuera ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Cadena inválida: debe comenzar con "${t.prefix}"`:t.format===`ends_with`?`Cadena inválida: debe terminar en "${t.suffix}"`:t.format===`includes`?`Cadena inválida: debe incluir "${t.includes}"`:t.format===`regex`?`Cadena inválida: debe coincidir con el patrón ${t.pattern}`:`Inválido ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número inválido: debe ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Llave${e.keys.length>1?`s`:``} desconocida${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Llave inválida en ${r[e.origin]??e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido en ${r[e.origin]??e.origin}`;default:return`Entrada inválida`}}};function es_default(){return{localeError:error$36()}}const error$35=()=>{let e={string:{unit:`کاراکتر`,verb:`داشته باشد`},file:{unit:`بایت`,verb:`داشته باشد`},array:{unit:`آیتم`,verb:`داشته باشد`},set:{unit:`آیتم`,verb:`داشته باشد`}};function t(t){return e[t]??null}let n={regex:`ورودی`,email:`آدرس ایمیل`,url:`URL`,emoji:`ایموجی`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاریخ و زمان ایزو`,date:`تاریخ ایزو`,time:`زمان ایزو`,duration:`مدت زمان ایزو`,ipv4:`IPv4 آدرس`,ipv6:`IPv6 آدرس`,cidrv4:`IPv4 دامنه`,cidrv6:`IPv6 دامنه`,base64:`base64-encoded رشته`,base64url:`base64url-encoded رشته`,json_string:`JSON رشته`,e164:`E.164 عدد`,jwt:`JWT`,template_literal:`ورودی`},r={nan:`NaN`,number:`عدد`,array:`آرایه`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ورودی نامعتبر: می‌بایست instanceof ${e.expected} می‌بود، ${i} دریافت شد`:`ورودی نامعتبر: می‌بایست ${t} می‌بود، ${i} دریافت شد`}case`invalid_value`:return e.values.length===1?`ورودی نامعتبر: می‌بایست ${stringifyPrimitive(e.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${joinValues(e.values,`|`)} می‌بود`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصر`} باشد`:`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} باشد`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} باشد`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`رشته نامعتبر: باید با "${t.prefix}" شروع شود`:t.format===`ends_with`?`رشته نامعتبر: باید با "${t.suffix}" تمام شود`:t.format===`includes`?`رشته نامعتبر: باید شامل "${t.includes}" باشد`:t.format===`regex`?`رشته نامعتبر: باید با الگوی ${t.pattern} مطابقت داشته باشد`:`${n[t.format]??e.format} نامعتبر`}case`not_multiple_of`:return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case`unrecognized_keys`:return`کلید${e.keys.length>1?`های`:``} ناشناس: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`کلید ناشناس در ${e.origin}`;case`invalid_union`:return`ورودی نامعتبر`;case`invalid_element`:return`مقدار نامعتبر در ${e.origin}`;default:return`ورودی نامعتبر`}}};function fa_default(){return{localeError:error$35()}}const error$34=()=>{let e={string:{unit:`merkkiä`,subject:`merkkijonon`},file:{unit:`tavua`,subject:`tiedoston`},array:{unit:`alkiota`,subject:`listan`},set:{unit:`alkiota`,subject:`joukon`},number:{unit:``,subject:`luvun`},bigint:{unit:``,subject:`suuren kokonaisluvun`},int:{unit:``,subject:`kokonaisluvun`},date:{unit:``,subject:`päivämäärän`}};function t(t){return e[t]??null}let n={regex:`säännöllinen lauseke`,email:`sähköpostiosoite`,url:`URL-osoite`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-aikaleima`,date:`ISO-päivämäärä`,time:`ISO-aika`,duration:`ISO-kesto`,ipv4:`IPv4-osoite`,ipv6:`IPv6-osoite`,cidrv4:`IPv4-alue`,cidrv6:`IPv6-alue`,base64:`base64-koodattu merkkijono`,base64url:`base64url-koodattu merkkijono`,json_string:`JSON-merkkijono`,e164:`E.164-luku`,jwt:`JWT`,template_literal:`templaattimerkkijono`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case`invalid_value`:return e.values.length===1?`Virheellinen syöte: täytyy olla ${stringifyPrimitive(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Liian suuri: ${r.subject} täytyy olla ${n}${e.maximum.toString()} ${r.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Liian pieni: ${r.subject} täytyy olla ${n}${e.minimum.toString()} ${r.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Virheellinen syöte: täytyy alkaa "${t.prefix}"`:t.format===`ends_with`?`Virheellinen syöte: täytyy loppua "${t.suffix}"`:t.format===`includes`?`Virheellinen syöte: täytyy sisältää "${t.includes}"`:t.format===`regex`?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${t.pattern}`:`Virheellinen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case`unrecognized_keys`:return`${e.keys.length>1?`Tuntemattomat avaimet`:`Tuntematon avain`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Virheellinen avain tietueessa`;case`invalid_union`:return`Virheellinen unioni`;case`invalid_element`:return`Virheellinen arvo joukossa`;default:return`Virheellinen syöte`}}};function fi_default(){return{localeError:error$34()}}const error$33=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse e-mail`,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:`date et heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`,number:`nombre`,array:`tableau`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : instanceof ${e.expected} attendu, ${i} reçu`:`Entrée invalide : ${t} attendu, ${i} reçu`}case`invalid_value`:return e.values.length===1?`Entrée invalide : ${stringifyPrimitive(e.values[0])} attendu`:`Option invalide : une valeur parmi ${joinValues(e.values,`|`)} attendue`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Trop grand : ${e.origin??`valeur`} doit ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`élément(s)`}`:`Trop grand : ${e.origin??`valeur`} doit être ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Trop petit : ${e.origin} doit ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : ${e.origin} doit être ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au modèle ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function fr_default(){return{localeError:error$33()}}const error$32=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse courriel`,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:`date-heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : attendu instanceof ${e.expected}, reçu ${i}`:`Entrée invalide : attendu ${t}, reçu ${i}`}case`invalid_value`:return e.values.length===1?`Entrée invalide : attendu ${stringifyPrimitive(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`≤`:`<`,r=t(e.origin);return r?`Trop grand : attendu que ${e.origin??`la valeur`} ait ${n}${e.maximum.toString()} ${r.unit}`:`Trop grand : attendu que ${e.origin??`la valeur`} soit ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`≥`:`>`,r=t(e.origin);return r?`Trop petit : attendu que ${e.origin} ait ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : attendu que ${e.origin} soit ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au motif ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function fr_CA_default(){return{localeError:error$32()}}const error$31=()=>{let e={string:{label:`מחרוזת`,gender:`f`},number:{label:`מספר`,gender:`m`},boolean:{label:`ערך בוליאני`,gender:`m`},bigint:{label:`BigInt`,gender:`m`},date:{label:`תאריך`,gender:`m`},array:{label:`מערך`,gender:`m`},object:{label:`אובייקט`,gender:`m`},null:{label:`ערך ריק (null)`,gender:`m`},undefined:{label:`ערך לא מוגדר (undefined)`,gender:`m`},symbol:{label:`סימבול (Symbol)`,gender:`m`},function:{label:`פונקציה`,gender:`f`},map:{label:`מפה (Map)`,gender:`f`},set:{label:`קבוצה (Set)`,gender:`f`},file:{label:`קובץ`,gender:`m`},promise:{label:`Promise`,gender:`m`},NaN:{label:`NaN`,gender:`m`},unknown:{label:`ערך לא ידוע`,gender:`m`},value:{label:`ערך`,gender:`m`}},t={string:{unit:`תווים`,shortLabel:`קצר`,longLabel:`ארוך`},file:{unit:`בייטים`,shortLabel:`קטן`,longLabel:`גדול`},array:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},set:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},number:{unit:``,shortLabel:`קטן`,longLabel:`גדול`}},n=t=>t?e[t]:void 0,r=t=>{let r=n(t);return r?r.label:t??e.unknown.label},i=e=>`ה${r(e)}`,a=e=>(n(e)?.gender??`m`)===`f`?`צריכה להיות`:`צריך להיות`,o=e=>e?t[e]??null:null,s={regex:{label:`קלט`,gender:`m`},email:{label:`כתובת אימייל`,gender:`f`},url:{label:`כתובת רשת`,gender:`f`},emoji:{label:`אימוג'י`,gender:`m`},uuid:{label:`UUID`,gender:`m`},nanoid:{label:`nanoid`,gender:`m`},guid:{label:`GUID`,gender:`m`},cuid:{label:`cuid`,gender:`m`},cuid2:{label:`cuid2`,gender:`m`},ulid:{label:`ULID`,gender:`m`},xid:{label:`XID`,gender:`m`},ksuid:{label:`KSUID`,gender:`m`},datetime:{label:`תאריך וזמן ISO`,gender:`m`},date:{label:`תאריך ISO`,gender:`m`},time:{label:`זמן ISO`,gender:`m`},duration:{label:`משך זמן ISO`,gender:`m`},ipv4:{label:`כתובת IPv4`,gender:`f`},ipv6:{label:`כתובת IPv6`,gender:`f`},cidrv4:{label:`טווח IPv4`,gender:`m`},cidrv6:{label:`טווח IPv6`,gender:`m`},base64:{label:`מחרוזת בבסיס 64`,gender:`f`},base64url:{label:`מחרוזת בבסיס 64 לכתובות רשת`,gender:`f`},json_string:{label:`מחרוזת JSON`,gender:`f`},e164:{label:`מספר E.164`,gender:`m`},jwt:{label:`JWT`,gender:`m`},ends_with:{label:`קלט`,gender:`m`},includes:{label:`קלט`,gender:`m`},lowercase:{label:`קלט`,gender:`m`},starts_with:{label:`קלט`,gender:`m`},uppercase:{label:`קלט`,gender:`m`}},c={nan:`NaN`};return t=>{switch(t.code){case`invalid_type`:{let n=t.expected,i=c[n??``]??r(n),a=parsedType(t.input),o=c[a]??e[a]?.label??a;return/^[A-Z]/.test(t.expected)?`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`:`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case`invalid_value`:{if(t.values.length===1)return`ערך לא תקין: הערך חייב להיות ${stringifyPrimitive(t.values[0])}`;let e=t.values.map(e=>stringifyPrimitive(e));if(t.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let n=e[e.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${e.slice(0,-1).join(`, `)} או ${n}`}case`too_big`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.longLabel??`ארוך`} מדי: ${n} צריכה להכיל ${t.maximum.toString()} ${e?.unit??``} ${t.inclusive?`או פחות`:`לכל היותר`}`.trim();if(t.origin===`number`)return`גדול מדי: ${n} צריך להיות ${t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`}`;if(t.origin===`array`||t.origin===`set`)return`גדול מדי: ${n} ${t.origin===`set`?`צריכה`:`צריך`} להכיל ${t.inclusive?`${t.maximum} ${e?.unit??``} או פחות`:`פחות מ-${t.maximum} ${e?.unit??``}`}`.trim();let r=t.inclusive?`<=`:`<`,s=a(t.origin??`value`);return e?.unit?`${e.longLabel} מדי: ${n} ${s} ${r}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??`גדול`} מדי: ${n} ${s} ${r}${t.maximum.toString()}`}case`too_small`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.shortLabel??`קצר`} מדי: ${n} צריכה להכיל ${t.minimum.toString()} ${e?.unit??``} ${t.inclusive?`או יותר`:`לפחות`}`.trim();if(t.origin===`number`)return`קטן מדי: ${n} צריך להיות ${t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`}`;if(t.origin===`array`||t.origin===`set`){let r=t.origin===`set`?`צריכה`:`צריך`;if(t.minimum===1&&t.inclusive){let e=(t.origin,`לפחות פריט אחד`);return`קטן מדי: ${n} ${r} להכיל לפחות פריט אחד`}return`קטן מדי: ${n} ${r} להכיל ${t.inclusive?`${t.minimum} ${e?.unit??``} או יותר`:`יותר מ-${t.minimum} ${e?.unit??``}`}`.trim()}let r=t.inclusive?`>=`:`>`,s=a(t.origin??`value`);return e?.unit?`${e.shortLabel} מדי: ${n} ${s} ${r}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??`קטן`} מדי: ${n} ${s} ${r}${t.minimum.toString()}`}case`invalid_format`:{let e=t;if(e.format===`starts_with`)return`המחרוזת חייבת להתחיל ב "${e.prefix}"`;if(e.format===`ends_with`)return`המחרוזת חייבת להסתיים ב "${e.suffix}"`;if(e.format===`includes`)return`המחרוזת חייבת לכלול "${e.includes}"`;if(e.format===`regex`)return`המחרוזת חייבת להתאים לתבנית ${e.pattern}`;let n=s[e.format];return`${n?.label??e.format} לא ${(n?.gender??`m`)===`f`?`תקינה`:`תקין`}`}case`not_multiple_of`:return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case`unrecognized_keys`:return`מפתח${t.keys.length>1?`ות`:``} לא מזוה${t.keys.length>1?`ים`:`ה`}: ${joinValues(t.keys,`, `)}`;case`invalid_key`:return`שדה לא תקין באובייקט`;case`invalid_union`:return`קלט לא תקין`;case`invalid_element`:return`ערך לא תקין ב${i(t.origin??`array`)}`;default:return`קלט לא תקין`}}};function he_default(){return{localeError:error$31()}}const error$30=()=>{let e={string:{unit:`karakter`,verb:`legyen`},file:{unit:`byte`,verb:`legyen`},array:{unit:`elem`,verb:`legyen`},set:{unit:`elem`,verb:`legyen`}};function t(t){return e[t]??null}let n={regex:`bemenet`,email:`email cím`,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 időbélyeg`,date:`ISO dátum`,time:`ISO idő`,duration:`ISO időintervallum`,ipv4:`IPv4 cím`,ipv6:`IPv6 cím`,cidrv4:`IPv4 tartomány`,cidrv6:`IPv6 tartomány`,base64:`base64-kódolt string`,base64url:`base64url-kódolt string`,json_string:`JSON string`,e164:`E.164 szám`,jwt:`JWT`,template_literal:`bemenet`},r={nan:`NaN`,number:`szám`,array:`tömb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Érvénytelen bemenet: a várt érték instanceof ${e.expected}, a kapott érték ${i}`:`Érvénytelen bemenet: a várt érték ${t}, a kapott érték ${i}`}case`invalid_value`:return e.values.length===1?`Érvénytelen bemenet: a várt érték ${stringifyPrimitive(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Túl nagy: ${e.origin??`érték`} mérete túl nagy ${n}${e.maximum.toString()} ${r.unit??`elem`}`:`Túl nagy: a bemeneti érték ${e.origin??`érték`} túl nagy: ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${n}${e.minimum.toString()} ${r.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Érvénytelen string: "${t.prefix}" értékkel kell kezdődnie`:t.format===`ends_with`?`Érvénytelen string: "${t.suffix}" értékkel kell végződnie`:t.format===`includes`?`Érvénytelen string: "${t.includes}" értéket kell tartalmaznia`:t.format===`regex`?`Érvénytelen string: ${t.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case`unrecognized_keys`:return`Ismeretlen kulcs${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Érvénytelen kulcs ${e.origin}`;case`invalid_union`:return`Érvénytelen bemenet`;case`invalid_element`:return`Érvénytelen érték: ${e.origin}`;default:return`Érvénytelen bemenet`}}};function hu_default(){return{localeError:error$30()}}function getArmenianPlural(e,t,n){return Math.abs(e)===1?t:n}function withDefiniteArticle(e){if(!e)return``;let t=[`ա`,`ե`,`ը`,`ի`,`ո`,`ու`,`օ`],n=e[e.length-1];return e+(t.includes(n)?`ն`:`ը`)}const error$29=()=>{let e={string:{unit:{one:`նշան`,many:`նշաններ`},verb:`ունենալ`},file:{unit:{one:`բայթ`,many:`բայթեր`},verb:`ունենալ`},array:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`},set:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`}};function t(t){return e[t]??null}let n={regex:`մուտք`,email:`էլ. հասցե`,url:`URL`,emoji:`էմոջի`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO ամսաթիվ և ժամ`,date:`ISO ամսաթիվ`,time:`ISO ժամ`,duration:`ISO տևողություն`,ipv4:`IPv4 հասցե`,ipv6:`IPv6 հասցե`,cidrv4:`IPv4 միջակայք`,cidrv6:`IPv6 միջակայք`,base64:`base64 ձևաչափով տող`,base64url:`base64url ձևաչափով տող`,json_string:`JSON տող`,e164:`E.164 համար`,jwt:`JWT`,template_literal:`մուտք`},r={nan:`NaN`,number:`թիվ`,array:`զանգված`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${e.expected}, ստացվել է ${i}`:`Սխալ մուտքագրում․ սպասվում էր ${t}, ստացվել է ${i}`}case`invalid_value`:return e.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${stringifyPrimitive(e.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=getArmenianPlural(Number(e.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(e.origin??`արժեք`)} կունենա ${n}${e.maximum.toString()} ${t}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(e.origin??`արժեք`)} լինի ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=getArmenianPlural(Number(e.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(e.origin)} կունենա ${n}${e.minimum.toString()} ${t}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(e.origin)} լինի ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Սխալ տող․ պետք է սկսվի "${t.prefix}"-ով`:t.format===`ends_with`?`Սխալ տող․ պետք է ավարտվի "${t.suffix}"-ով`:t.format===`includes`?`Սխալ տող․ պետք է պարունակի "${t.includes}"`:t.format===`regex`?`Սխալ տող․ պետք է համապատասխանի ${t.pattern} ձևաչափին`:`Սխալ ${n[t.format]??e.format}`}case`not_multiple_of`:return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${e.divisor}-ի`;case`unrecognized_keys`:return`Չճանաչված բանալի${e.keys.length>1?`ներ`:``}. ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Սխալ բանալի ${withDefiniteArticle(e.origin)}-ում`;case`invalid_union`:return`Սխալ մուտքագրում`;case`invalid_element`:return`Սխալ արժեք ${withDefiniteArticle(e.origin)}-ում`;default:return`Սխալ մուտքագրում`}}};function hy_default(){return{localeError:error$29()}}const error$28=()=>{let e={string:{unit:`karakter`,verb:`memiliki`},file:{unit:`byte`,verb:`memiliki`},array:{unit:`item`,verb:`memiliki`},set:{unit:`item`,verb:`memiliki`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat email`,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:`tanggal dan waktu format ISO`,date:`tanggal format ISO`,time:`jam format ISO`,duration:`durasi format ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`rentang alamat IPv4`,cidrv6:`rentang alamat IPv6`,base64:`string dengan enkode base64`,base64url:`string dengan enkode base64url`,json_string:`string JSON`,e164:`angka E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak valid: diharapkan ${stringifyPrimitive(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: diharapkan ${e.origin??`value`} memiliki ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: diharapkan ${e.origin??`value`} menjadi ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: diharapkan ${e.origin} memiliki ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak valid: harus dimulai dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak valid: harus berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak valid: harus menyertakan "${t.includes}"`:t.format===`regex`?`String tidak valid: harus sesuai pola ${t.pattern}`:`${n[t.format]??e.format} tidak valid`}case`not_multiple_of`:return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali ${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak valid di ${e.origin}`;case`invalid_union`:return`Input tidak valid`;case`invalid_element`:return`Nilai tidak valid di ${e.origin}`;default:return`Input tidak valid`}}};function id_default(){return{localeError:error$28()}}const error$27=()=>{let e={string:{unit:`stafi`,verb:`að hafa`},file:{unit:`bæti`,verb:`að hafa`},array:{unit:`hluti`,verb:`að hafa`},set:{unit:`hluti`,verb:`að hafa`}};function t(t){return e[t]??null}let n={regex:`gildi`,email:`netfang`,url:`vefslóð`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dagsetning og tími`,date:`ISO dagsetning`,time:`ISO tími`,duration:`ISO tímalengd`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded strengur`,base64url:`base64url-encoded strengur`,json_string:`JSON strengur`,e164:`E.164 tölugildi`,jwt:`JWT`,template_literal:`gildi`},r={nan:`NaN`,number:`númer`,array:`fylki`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${e.expected}`:`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${t}`}case`invalid_value`:return e.values.length===1?`Rangt gildi: gert ráð fyrir ${stringifyPrimitive(e.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} hafi ${n}${e.maximum.toString()} ${r.unit??`hluti`}`:`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} sé ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Of lítið: gert er ráð fyrir að ${e.origin} hafi ${n}${e.minimum.toString()} ${r.unit}`:`Of lítið: gert er ráð fyrir að ${e.origin} sé ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ógildur strengur: verður að byrja á "${t.prefix}"`:t.format===`ends_with`?`Ógildur strengur: verður að enda á "${t.suffix}"`:t.format===`includes`?`Ógildur strengur: verður að innihalda "${t.includes}"`:t.format===`regex`?`Ógildur strengur: verður að fylgja mynstri ${t.pattern}`:`Rangt ${n[t.format]??e.format}`}case`not_multiple_of`:return`Röng tala: verður að vera margfeldi af ${e.divisor}`;case`unrecognized_keys`:return`Óþekkt ${e.keys.length>1?`ir lyklar`:`ur lykill`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Rangur lykill í ${e.origin}`;case`invalid_union`:return`Rangt gildi`;case`invalid_element`:return`Rangt gildi í ${e.origin}`;default:return`Rangt gildi`}}};function is_default(){return{localeError:error$27()}}const error$26=()=>{let e={string:{unit:`caratteri`,verb:`avere`},file:{unit:`byte`,verb:`avere`},array:{unit:`elementi`,verb:`avere`},set:{unit:`elementi`,verb:`avere`}};function t(t){return e[t]??null}let n={regex:`input`,email:`indirizzo email`,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:`data e ora ISO`,date:`data ISO`,time:`ora ISO`,duration:`durata ISO`,ipv4:`indirizzo IPv4`,ipv6:`indirizzo IPv6`,cidrv4:`intervallo IPv4`,cidrv6:`intervallo IPv6`,base64:`stringa codificata in base64`,base64url:`URL codificata in base64`,json_string:`stringa JSON`,e164:`numero E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`numero`,array:`vettore`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case`invalid_value`:return e.values.length===1?`Input non valido: atteso ${stringifyPrimitive(e.values[0])}`:`Opzione non valida: atteso uno tra ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Troppo grande: ${e.origin??`valore`} deve avere ${n}${e.maximum.toString()} ${r.unit??`elementi`}`:`Troppo grande: ${e.origin??`valore`} deve essere ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Troppo piccolo: ${e.origin} deve avere ${n}${e.minimum.toString()} ${r.unit}`:`Troppo piccolo: ${e.origin} deve essere ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Stringa non valida: deve iniziare con "${t.prefix}"`:t.format===`ends_with`?`Stringa non valida: deve terminare con "${t.suffix}"`:t.format===`includes`?`Stringa non valida: deve includere "${t.includes}"`:t.format===`regex`?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case`unrecognized_keys`:return`Chiav${e.keys.length>1?`i`:`e`} non riconosciut${e.keys.length>1?`e`:`a`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Chiave non valida in ${e.origin}`;case`invalid_union`:return`Input non valido`;case`invalid_element`:return`Valore non valido in ${e.origin}`;default:return`Input non valido`}}};function it_default(){return{localeError:error$26()}}const error$25=()=>{let e={string:{unit:`文字`,verb:`である`},file:{unit:`バイト`,verb:`である`},array:{unit:`要素`,verb:`である`},set:{unit:`要素`,verb:`である`}};function t(t){return e[t]??null}let n={regex:`入力値`,email:`メールアドレス`,url:`URL`,emoji:`絵文字`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日時`,date:`ISO日付`,time:`ISO時刻`,duration:`ISO期間`,ipv4:`IPv4アドレス`,ipv6:`IPv6アドレス`,cidrv4:`IPv4範囲`,cidrv6:`IPv6範囲`,base64:`base64エンコード文字列`,base64url:`base64urlエンコード文字列`,json_string:`JSON文字列`,e164:`E.164番号`,jwt:`JWT`,template_literal:`入力値`},r={nan:`NaN`,number:`数値`,array:`配列`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無効な入力: instanceof ${e.expected}が期待されましたが、${i}が入力されました`:`無効な入力: ${t}が期待されましたが、${i}が入力されました`}case`invalid_value`:return e.values.length===1?`無効な入力: ${stringifyPrimitive(e.values[0])}が期待されました`:`無効な選択: ${joinValues(e.values,`、`)}のいずれかである必要があります`;case`too_big`:{let n=e.inclusive?`以下である`:`より小さい`,r=t(e.origin);return r?`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${r.unit??`要素`}${n}必要があります`:`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${n}必要があります`}case`too_small`:{let n=e.inclusive?`以上である`:`より大きい`,r=t(e.origin);return r?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${r.unit}${n}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${n}必要があります`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無効な文字列: "${t.prefix}"で始まる必要があります`:t.format===`ends_with`?`無効な文字列: "${t.suffix}"で終わる必要があります`:t.format===`includes`?`無効な文字列: "${t.includes}"を含む必要があります`:t.format===`regex`?`無効な文字列: パターン${t.pattern}に一致する必要があります`:`無効な${n[t.format]??e.format}`}case`not_multiple_of`:return`無効な数値: ${e.divisor}の倍数である必要があります`;case`unrecognized_keys`:return`認識されていないキー${e.keys.length>1?`群`:``}: ${joinValues(e.keys,`、`)}`;case`invalid_key`:return`${e.origin}内の無効なキー`;case`invalid_union`:return`無効な入力`;case`invalid_element`:return`${e.origin}内の無効な値`;default:return`無効な入力`}}};function ja_default(){return{localeError:error$25()}}const error$24=()=>{let e={string:{unit:`სიმბოლო`,verb:`უნდა შეიცავდეს`},file:{unit:`ბაიტი`,verb:`უნდა შეიცავდეს`},array:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`},set:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`}};function t(t){return e[t]??null}let n={regex:`შეყვანა`,email:`ელ-ფოსტის მისამართი`,url:`URL`,emoji:`ემოჯი`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`თარიღი-დრო`,date:`თარიღი`,time:`დრო`,duration:`ხანგრძლივობა`,ipv4:`IPv4 მისამართი`,ipv6:`IPv6 მისამართი`,cidrv4:`IPv4 დიაპაზონი`,cidrv6:`IPv6 დიაპაზონი`,base64:`base64-კოდირებული სტრინგი`,base64url:`base64url-კოდირებული სტრინგი`,json_string:`JSON სტრინგი`,e164:`E.164 ნომერი`,jwt:`JWT`,template_literal:`შეყვანა`},r={nan:`NaN`,number:`რიცხვი`,string:`სტრინგი`,boolean:`ბულეანი`,function:`ფუნქცია`,array:`მასივი`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${e.expected}, მიღებული ${i}`:`არასწორი შეყვანა: მოსალოდნელი ${t}, მიღებული ${i}`}case`invalid_value`:return e.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${stringifyPrimitive(e.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${joinValues(e.values,`|`)}-დან`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} იყოს ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ზედმეტად პატარა: მოსალოდნელი ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${e.origin} იყოს ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`არასწორი სტრინგი: უნდა იწყებოდეს "${t.prefix}"-ით`:t.format===`ends_with`?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${t.suffix}"-ით`:t.format===`includes`?`არასწორი სტრინგი: უნდა შეიცავდეს "${t.includes}"-ს`:t.format===`regex`?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${t.pattern}`:`არასწორი ${n[t.format]??e.format}`}case`not_multiple_of`:return`არასწორი რიცხვი: უნდა იყოს ${e.divisor}-ის ჯერადი`;case`unrecognized_keys`:return`უცნობი გასაღებ${e.keys.length>1?`ები`:`ი`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`არასწორი გასაღები ${e.origin}-ში`;case`invalid_union`:return`არასწორი შეყვანა`;case`invalid_element`:return`არასწორი მნიშვნელობა ${e.origin}-ში`;default:return`არასწორი შეყვანა`}}};function ka_default(){return{localeError:error$24()}}const error$23=()=>{let e={string:{unit:`តួអក្សរ`,verb:`គួរមាន`},file:{unit:`បៃ`,verb:`គួរមាន`},array:{unit:`ធាតុ`,verb:`គួរមាន`},set:{unit:`ធាតុ`,verb:`គួរមាន`}};function t(t){return e[t]??null}let n={regex:`ទិន្នន័យបញ្ចូល`,email:`អាសយដ្ឋានអ៊ីមែល`,url:`URL`,emoji:`សញ្ញាអារម្មណ៍`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`កាលបរិច្ឆេទ និងម៉ោង ISO`,date:`កាលបរិច្ឆេទ ISO`,time:`ម៉ោង ISO`,duration:`រយៈពេល ISO`,ipv4:`អាសយដ្ឋាន IPv4`,ipv6:`អាសយដ្ឋាន IPv6`,cidrv4:`ដែនអាសយដ្ឋាន IPv4`,cidrv6:`ដែនអាសយដ្ឋាន IPv6`,base64:`ខ្សែអក្សរអ៊ិកូដ base64`,base64url:`ខ្សែអក្សរអ៊ិកូដ base64url`,json_string:`ខ្សែអក្សរ JSON`,e164:`លេខ E.164`,jwt:`JWT`,template_literal:`ទិន្នន័យបញ្ចូល`},r={nan:`NaN`,number:`លេខ`,array:`អារេ (Array)`,null:`គ្មានតម្លៃ (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${e.expected} ប៉ុន្តែទទួលបាន ${i}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t} ប៉ុន្តែទទួលបាន ${i}`}case`invalid_value`:return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${stringifyPrimitive(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()} ${r.unit??`ធាតុ`}`:`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()} ${r.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${t.prefix}"`:t.format===`ends_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${t.suffix}"`:t.format===`includes`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${t.includes}"`:t.format===`regex`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${t.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[t.format]??e.format}`}case`not_multiple_of`:return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case`unrecognized_keys`:return`រកឃើញសោមិនស្គាល់៖ ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case`invalid_union`:return`ទិន្នន័យមិនត្រឹមត្រូវ`;case`invalid_element`:return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return`ទិន្នន័យមិនត្រឹមត្រូវ`}}};function km_default(){return{localeError:error$23()}}function kh_default(){return km_default()}const error$22=()=>{let e={string:{unit:`문자`,verb:`to have`},file:{unit:`바이트`,verb:`to have`},array:{unit:`개`,verb:`to have`},set:{unit:`개`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`입력`,email:`이메일 주소`,url:`URL`,emoji:`이모지`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 날짜시간`,date:`ISO 날짜`,time:`ISO 시간`,duration:`ISO 기간`,ipv4:`IPv4 주소`,ipv6:`IPv6 주소`,cidrv4:`IPv4 범위`,cidrv6:`IPv6 범위`,base64:`base64 인코딩 문자열`,base64url:`base64url 인코딩 문자열`,json_string:`JSON 문자열`,e164:`E.164 번호`,jwt:`JWT`,template_literal:`입력`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`잘못된 입력: 예상 타입은 instanceof ${e.expected}, 받은 타입은 ${i}입니다`:`잘못된 입력: 예상 타입은 ${t}, 받은 타입은 ${i}입니다`}case`invalid_value`:return e.values.length===1?`잘못된 입력: 값은 ${stringifyPrimitive(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${joinValues(e.values,`또는 `)} 중 하나여야 합니다`;case`too_big`:{let n=e.inclusive?`이하`:`미만`,r=n===`미만`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()} ${n}${r}`}case`too_small`:{let n=e.inclusive?`이상`:`초과`,r=n===`이상`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()} ${n}${r}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`잘못된 문자열: "${t.prefix}"(으)로 시작해야 합니다`:t.format===`ends_with`?`잘못된 문자열: "${t.suffix}"(으)로 끝나야 합니다`:t.format===`includes`?`잘못된 문자열: "${t.includes}"을(를) 포함해야 합니다`:t.format===`regex`?`잘못된 문자열: 정규식 ${t.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[t.format]??e.format}`}case`not_multiple_of`:return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case`unrecognized_keys`:return`인식할 수 없는 키: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`잘못된 키: ${e.origin}`;case`invalid_union`:return`잘못된 입력`;case`invalid_element`:return`잘못된 값: ${e.origin}`;default:return`잘못된 입력`}}};function ko_default(){return{localeError:error$22()}}const capitalizeFirstCharacter=e=>e.charAt(0).toUpperCase()+e.slice(1);function getUnitTypeFromNumber(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?`many`:n===1?`one`:`few`}const error$21=()=>{let e={string:{unit:{one:`simbolis`,few:`simboliai`,many:`simbolių`},verb:{smaller:{inclusive:`turi būti ne ilgesnė kaip`,notInclusive:`turi būti trumpesnė kaip`},bigger:{inclusive:`turi būti ne trumpesnė kaip`,notInclusive:`turi būti ilgesnė kaip`}}},file:{unit:{one:`baitas`,few:`baitai`,many:`baitų`},verb:{smaller:{inclusive:`turi būti ne didesnis kaip`,notInclusive:`turi būti mažesnis kaip`},bigger:{inclusive:`turi būti ne mažesnis kaip`,notInclusive:`turi būti didesnis kaip`}}},array:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}},set:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}}};function t(t,n,r,i){let a=e[t]??null;return a===null?a:{unit:a.unit[n],verb:a.verb[i][r?`inclusive`:`notInclusive`]}}let n={regex:`įvestis`,email:`el. pašto adresas`,url:`URL`,emoji:`jaustukas`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO data ir laikas`,date:`ISO data`,time:`ISO laikas`,duration:`ISO trukmė`,ipv4:`IPv4 adresas`,ipv6:`IPv6 adresas`,cidrv4:`IPv4 tinklo prefiksas (CIDR)`,cidrv6:`IPv6 tinklo prefiksas (CIDR)`,base64:`base64 užkoduota eilutė`,base64url:`base64url užkoduota eilutė`,json_string:`JSON eilutė`,e164:`E.164 numeris`,jwt:`JWT`,template_literal:`įvestis`},r={nan:`NaN`,number:`skaičius`,bigint:`sveikasis skaičius`,string:`eilutė`,boolean:`loginė reikšmė`,undefined:`neapibrėžta reikšmė`,function:`funkcija`,symbol:`simbolis`,array:`masyvas`,object:`objektas`,null:`nulinė reikšmė`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikėtasi - ${t}`}case`invalid_value`:return e.values.length===1?`Privalo būti ${stringifyPrimitive(e.values[0])}`:`Privalo būti vienas iš ${joinValues(e.values,`|`)} pasirinkimų`;case`too_big`:{let n=r[e.origin]??e.origin,i=t(e.origin,getUnitTypeFromNumber(Number(e.maximum)),e.inclusive??!1,`smaller`);if(i?.verb)return`${capitalizeFirstCharacter(n??e.origin??`reikšmė`)} ${i.verb} ${e.maximum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne didesnis kaip`:`mažesnis kaip`;return`${capitalizeFirstCharacter(n??e.origin??`reikšmė`)} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case`too_small`:{let n=r[e.origin]??e.origin,i=t(e.origin,getUnitTypeFromNumber(Number(e.minimum)),e.inclusive??!1,`bigger`);if(i?.verb)return`${capitalizeFirstCharacter(n??e.origin??`reikšmė`)} ${i.verb} ${e.minimum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne mažesnis kaip`:`didesnis kaip`;return`${capitalizeFirstCharacter(n??e.origin??`reikšmė`)} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Eilutė privalo prasidėti "${t.prefix}"`:t.format===`ends_with`?`Eilutė privalo pasibaigti "${t.suffix}"`:t.format===`includes`?`Eilutė privalo įtraukti "${t.includes}"`:t.format===`regex`?`Eilutė privalo atitikti ${t.pattern}`:`Neteisingas ${n[t.format]??e.format}`}case`not_multiple_of`:return`Skaičius privalo būti ${e.divisor} kartotinis.`;case`unrecognized_keys`:return`Neatpažint${e.keys.length>1?`i`:`as`} rakt${e.keys.length>1?`ai`:`as`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Rastas klaidingas raktas`;case`invalid_union`:return`Klaidinga įvestis`;case`invalid_element`:return`${capitalizeFirstCharacter(r[e.origin]??e.origin??e.origin??`reikšmė`)} turi klaidingą įvestį`;default:return`Klaidinga įvestis`}}};function lt_default(){return{localeError:error$21()}}const error$20=()=>{let e={string:{unit:`знаци`,verb:`да имаат`},file:{unit:`бајти`,verb:`да имаат`},array:{unit:`ставки`,verb:`да имаат`},set:{unit:`ставки`,verb:`да имаат`}};function t(t){return e[t]??null}let n={regex:`внес`,email:`адреса на е-пошта`,url:`URL`,emoji:`емоџи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO датум и време`,date:`ISO датум`,time:`ISO време`,duration:`ISO времетраење`,ipv4:`IPv4 адреса`,ipv6:`IPv6 адреса`,cidrv4:`IPv4 опсег`,cidrv6:`IPv6 опсег`,base64:`base64-енкодирана низа`,base64url:`base64url-енкодирана низа`,json_string:`JSON низа`,e164:`E.164 број`,jwt:`JWT`,template_literal:`внес`},r={nan:`NaN`,number:`број`,array:`низа`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Грешен внес: се очекува instanceof ${e.expected}, примено ${i}`:`Грешен внес: се очекува ${t}, примено ${i}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${stringifyPrimitive(e.values[0])}`:`Грешана опција: се очекува една ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Премногу голем: се очекува ${e.origin??`вредноста`} да има ${n}${e.maximum.toString()} ${r.unit??`елементи`}`:`Премногу голем: се очекува ${e.origin??`вредноста`} да биде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Премногу мал: се очекува ${e.origin} да има ${n}${e.minimum.toString()} ${r.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неважечка низа: мора да започнува со "${t.prefix}"`:t.format===`ends_with`?`Неважечка низа: мора да завршува со "${t.suffix}"`:t.format===`includes`?`Неважечка низа: мора да вклучува "${t.includes}"`:t.format===`regex`?`Неважечка низа: мора да одгоара на патернот ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Грешен број: мора да биде делив со ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Непрепознаени клучеви`:`Непрепознаен клуч`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Грешен клуч во ${e.origin}`;case`invalid_union`:return`Грешен внес`;case`invalid_element`:return`Грешна вредност во ${e.origin}`;default:return`Грешен внес`}}};function mk_default(){return{localeError:error$20()}}const error$19=()=>{let e={string:{unit:`aksara`,verb:`mempunyai`},file:{unit:`bait`,verb:`mempunyai`},array:{unit:`elemen`,verb:`mempunyai`},set:{unit:`elemen`,verb:`mempunyai`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat e-mel`,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:`tarikh masa ISO`,date:`tarikh ISO`,time:`masa ISO`,duration:`tempoh ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`julat IPv4`,cidrv6:`julat IPv6`,base64:`string dikodkan base64`,base64url:`string dikodkan base64url`,json_string:`string JSON`,e164:`nombor E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`nombor`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak sah: dijangka ${stringifyPrimitive(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: dijangka ${e.origin??`nilai`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: dijangka ${e.origin??`nilai`} adalah ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: dijangka ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak sah: mesti bermula dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak sah: mesti mengandungi "${t.includes}"`:t.format===`regex`?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${n[t.format]??e.format} tidak sah`}case`not_multiple_of`:return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak sah dalam ${e.origin}`;case`invalid_union`:return`Input tidak sah`;case`invalid_element`:return`Nilai tidak sah dalam ${e.origin}`;default:return`Input tidak sah`}}};function ms_default(){return{localeError:error$19()}}const error$18=()=>{let e={string:{unit:`tekens`,verb:`heeft`},file:{unit:`bytes`,verb:`heeft`},array:{unit:`elementen`,verb:`heeft`},set:{unit:`elementen`,verb:`heeft`}};function t(t){return e[t]??null}let n={regex:`invoer`,email:`emailadres`,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 datum en tijd`,date:`ISO datum`,time:`ISO tijd`,duration:`ISO duur`,ipv4:`IPv4-adres`,ipv6:`IPv6-adres`,cidrv4:`IPv4-bereik`,cidrv6:`IPv6-bereik`,base64:`base64-gecodeerde tekst`,base64url:`base64 URL-gecodeerde tekst`,json_string:`JSON string`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`invoer`},r={nan:`NaN`,number:`getal`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case`invalid_value`:return e.values.length===1?`Ongeldige invoer: verwacht ${stringifyPrimitive(e.values[0])}`:`Ongeldige optie: verwacht één van ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin),i=e.origin===`date`?`laat`:e.origin===`string`?`lang`:`groot`;return r?`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} ${r.unit??`elementen`} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} is`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin),i=e.origin===`date`?`vroeg`:e.origin===`string`?`kort`:`klein`;return r?`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} is`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:t.format===`ends_with`?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:t.format===`includes`?`Ongeldige tekst: moet "${t.includes}" bevatten`:t.format===`regex`?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case`unrecognized_keys`:return`Onbekende key${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Ongeldige key in ${e.origin}`;case`invalid_union`:return`Ongeldige invoer`;case`invalid_element`:return`Ongeldige waarde in ${e.origin}`;default:return`Ongeldige invoer`}}};function nl_default(){return{localeError:error$18()}}const error$17=()=>{let e={string:{unit:`tegn`,verb:`å ha`},file:{unit:`bytes`,verb:`å ha`},array:{unit:`elementer`,verb:`å inneholde`},set:{unit:`elementer`,verb:`å inneholde`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-postadresse`,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 dato- og klokkeslett`,date:`ISO-dato`,time:`ISO-klokkeslett`,duration:`ISO-varighet`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spekter`,cidrv6:`IPv6-spekter`,base64:`base64-enkodet streng`,base64url:`base64url-enkodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`tall`,array:`liste`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig verdi: forventet ${stringifyPrimitive(e.values[0])}`:`Ugyldig valg: forventet en av ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()} ${r.unit??`elementer`}`:`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()} ${r.unit}`:`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: må starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: må ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: må inneholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: må matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukjente nøkler`:`Ukjent nøkkel`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøkkel i ${e.origin}`;case`invalid_union`:return`Ugyldig input`;case`invalid_element`:return`Ugyldig verdi i ${e.origin}`;default:return`Ugyldig input`}}};function no_default(){return{localeError:error$17()}}const error$16=()=>{let e={string:{unit:`harf`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`unsur`,verb:`olmalıdır`},set:{unit:`unsur`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`giren`,email:`epostagâh`,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 hengâmı`,date:`ISO tarihi`,time:`ISO zamanı`,duration:`ISO müddeti`,ipv4:`IPv4 nişânı`,ipv6:`IPv6 nişânı`,cidrv4:`IPv4 menzili`,cidrv6:`IPv6 menzili`,base64:`base64-şifreli metin`,base64url:`base64url-şifreli metin`,json_string:`JSON metin`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`giren`},r={nan:`NaN`,number:`numara`,array:`saf`,null:`gayb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Fâsit giren: umulan instanceof ${e.expected}, alınan ${i}`:`Fâsit giren: umulan ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Fâsit giren: umulan ${stringifyPrimitive(e.values[0])}`:`Fâsit tercih: mûteberler ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} ${r.unit??`elements`} sahip olmalıydı.`:`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} olmalıydı.`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} ${r.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} olmalıydı.`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Fâsit metin: "${t.prefix}" ile başlamalı.`:t.format===`ends_with`?`Fâsit metin: "${t.suffix}" ile bitmeli.`:t.format===`includes`?`Fâsit metin: "${t.includes}" ihtivâ etmeli.`:t.format===`regex`?`Fâsit metin: ${t.pattern} nakşına uymalı.`:`Fâsit ${n[t.format]??e.format}`}case`not_multiple_of`:return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case`unrecognized_keys`:return`Tanınmayan anahtar ${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} için tanınmayan anahtar var.`;case`invalid_union`:return`Giren tanınamadı.`;case`invalid_element`:return`${e.origin} için tanınmayan kıymet var.`;default:return`Kıymet tanınamadı.`}}};function ota_default(){return{localeError:error$16()}}const error$15=()=>{let e={string:{unit:`توکي`,verb:`ولري`},file:{unit:`بایټس`,verb:`ولري`},array:{unit:`توکي`,verb:`ولري`},set:{unit:`توکي`,verb:`ولري`}};function t(t){return e[t]??null}let n={regex:`ورودي`,email:`بریښنالیک`,url:`یو آر ال`,emoji:`ایموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`نیټه او وخت`,date:`نېټه`,time:`وخت`,duration:`موده`,ipv4:`د IPv4 پته`,ipv6:`د IPv6 پته`,cidrv4:`د IPv4 ساحه`,cidrv6:`د IPv6 ساحه`,base64:`base64-encoded متن`,base64url:`base64url-encoded متن`,json_string:`JSON متن`,e164:`د E.164 شمېره`,jwt:`JWT`,template_literal:`ورودي`},r={nan:`NaN`,number:`عدد`,array:`ارې`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ناسم ورودي: باید instanceof ${e.expected} وای, مګر ${i} ترلاسه شو`:`ناسم ورودي: باید ${t} وای, مګر ${i} ترلاسه شو`}case`invalid_value`:return e.values.length===1?`ناسم ورودي: باید ${stringifyPrimitive(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${joinValues(e.values,`|`)} څخه وای`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصرونه`} ولري`:`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} وي`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} وي`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ناسم متن: باید د "${t.prefix}" سره پیل شي`:t.format===`ends_with`?`ناسم متن: باید د "${t.suffix}" سره پای ته ورسيږي`:t.format===`includes`?`ناسم متن: باید "${t.includes}" ولري`:t.format===`regex`?`ناسم متن: باید د ${t.pattern} سره مطابقت ولري`:`${n[t.format]??e.format} ناسم دی`}case`not_multiple_of`:return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case`unrecognized_keys`:return`ناسم ${e.keys.length>1?`کلیډونه`:`کلیډ`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`ناسم کلیډ په ${e.origin} کې`;case`invalid_union`:return`ناسمه ورودي`;case`invalid_element`:return`ناسم عنصر په ${e.origin} کې`;default:return`ناسمه ورودي`}}};function ps_default(){return{localeError:error$15()}}const error$14=()=>{let e={string:{unit:`znaków`,verb:`mieć`},file:{unit:`bajtów`,verb:`mieć`},array:{unit:`elementów`,verb:`mieć`},set:{unit:`elementów`,verb:`mieć`}};function t(t){return e[t]??null}let n={regex:`wyrażenie`,email:`adres email`,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:`data i godzina w formacie ISO`,date:`data w formacie ISO`,time:`godzina w formacie ISO`,duration:`czas trwania ISO`,ipv4:`adres IPv4`,ipv6:`adres IPv6`,cidrv4:`zakres IPv4`,cidrv6:`zakres IPv6`,base64:`ciąg znaków zakodowany w formacie base64`,base64url:`ciąg znaków zakodowany w formacie base64url`,json_string:`ciąg znaków w formacie JSON`,e164:`liczba E.164`,jwt:`JWT`,template_literal:`wejście`},r={nan:`NaN`,number:`liczba`,array:`tablica`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`Nieprawidłowe dane wejściowe: oczekiwano ${t}, otrzymano ${i}`}case`invalid_value`:return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${stringifyPrimitive(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Za duża wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.maximum.toString()} ${r.unit??`elementów`}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Za mała wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.minimum.toString()} ${r.unit??`elementów`}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${t.prefix}"`:t.format===`ends_with`?`Nieprawidłowy ciąg znaków: musi kończyć się na "${t.suffix}"`:t.format===`includes`?`Nieprawidłowy ciąg znaków: musi zawierać "${t.includes}"`:t.format===`regex`?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${t.pattern}`:`Nieprawidłow(y/a/e) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case`unrecognized_keys`:return`Nierozpoznane klucze${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Nieprawidłowy klucz w ${e.origin}`;case`invalid_union`:return`Nieprawidłowe dane wejściowe`;case`invalid_element`:return`Nieprawidłowa wartość w ${e.origin}`;default:return`Nieprawidłowe dane wejściowe`}}};function pl_default(){return{localeError:error$14()}}const error$13=()=>{let e={string:{unit:`caracteres`,verb:`ter`},file:{unit:`bytes`,verb:`ter`},array:{unit:`itens`,verb:`ter`},set:{unit:`itens`,verb:`ter`}};function t(t){return e[t]??null}let n={regex:`padrão`,email:`endereço de e-mail`,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:`data e hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`duração ISO`,ipv4:`endereço IPv4`,ipv6:`endereço IPv6`,cidrv4:`faixa de IPv4`,cidrv6:`faixa de IPv6`,base64:`texto codificado em base64`,base64url:`URL codificada em base64`,json_string:`texto JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,number:`número`,null:`nulo`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipo inválido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo inválido: esperado ${t}, recebido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: esperado ${stringifyPrimitive(e.values[0])}`:`Opção inválida: esperada uma das ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Muito grande: esperado que ${e.origin??`valor`} tivesse ${n}${e.maximum.toString()} ${r.unit??`elementos`}`:`Muito grande: esperado que ${e.origin??`valor`} fosse ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Muito pequeno: esperado que ${e.origin} tivesse ${n}${e.minimum.toString()} ${r.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Texto inválido: deve começar com "${t.prefix}"`:t.format===`ends_with`?`Texto inválido: deve terminar com "${t.suffix}"`:t.format===`includes`?`Texto inválido: deve incluir "${t.includes}"`:t.format===`regex`?`Texto inválido: deve corresponder ao padrão ${t.pattern}`:`${n[t.format]??e.format} inválido`}case`not_multiple_of`:return`Número inválido: deve ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Chave${e.keys.length>1?`s`:``} desconhecida${e.keys.length>1?`s`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Chave inválida em ${e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido em ${e.origin}`;default:return`Campo inválido`}}};function pt_default(){return{localeError:error$13()}}function getRussianPlural(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}const error$12=()=>{let e={string:{unit:{one:`символ`,few:`символа`,many:`символов`},verb:`иметь`},file:{unit:{one:`байт`,few:`байта`,many:`байт`},verb:`иметь`},array:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`},set:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`}};function t(t){return e[t]??null}let n={regex:`ввод`,email:`email адрес`,url:`URL`,emoji:`эмодзи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата и время`,date:`ISO дата`,time:`ISO время`,duration:`ISO длительность`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`строка в формате base64`,base64url:`строка в формате base64url`,json_string:`JSON строка`,e164:`номер E.164`,jwt:`JWT`,template_literal:`ввод`},r={nan:`NaN`,number:`число`,array:`массив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неверный ввод: ожидалось instanceof ${e.expected}, получено ${i}`:`Неверный ввод: ожидалось ${t}, получено ${i}`}case`invalid_value`:return e.values.length===1?`Неверный ввод: ожидалось ${stringifyPrimitive(e.values[0])}`:`Неверный вариант: ожидалось одно из ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=getRussianPlural(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет иметь ${n}${e.maximum.toString()} ${t}`}return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=getRussianPlural(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${n}${e.minimum.toString()} ${t}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неверная строка: должна начинаться с "${t.prefix}"`:t.format===`ends_with`?`Неверная строка: должна заканчиваться на "${t.suffix}"`:t.format===`includes`?`Неверная строка: должна содержать "${t.includes}"`:t.format===`regex`?`Неверная строка: должна соответствовать шаблону ${t.pattern}`:`Неверный ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неверное число: должно быть кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспознанн${e.keys.length>1?`ые`:`ый`} ключ${e.keys.length>1?`и`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Неверный ключ в ${e.origin}`;case`invalid_union`:return`Неверные входные данные`;case`invalid_element`:return`Неверное значение в ${e.origin}`;default:return`Неверные входные данные`}}};function ru_default(){return{localeError:error$12()}}const error$11=()=>{let e={string:{unit:`znakov`,verb:`imeti`},file:{unit:`bajtov`,verb:`imeti`},array:{unit:`elementov`,verb:`imeti`},set:{unit:`elementov`,verb:`imeti`}};function t(t){return e[t]??null}let n={regex:`vnos`,email:`e-poštni naslov`,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 datum in čas`,date:`ISO datum`,time:`ISO čas`,duration:`ISO trajanje`,ipv4:`IPv4 naslov`,ipv6:`IPv6 naslov`,cidrv4:`obseg IPv4`,cidrv6:`obseg IPv6`,base64:`base64 kodiran niz`,base64url:`base64url kodiran niz`,json_string:`JSON niz`,e164:`E.164 številka`,jwt:`JWT`,template_literal:`vnos`},r={nan:`NaN`,number:`število`,array:`tabela`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: pričakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: pričakovano ${t}, prejeto ${i}`}case`invalid_value`:return e.values.length===1?`Neveljaven vnos: pričakovano ${stringifyPrimitive(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} imelo ${n}${e.maximum.toString()} ${r.unit??`elementov`}`:`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Premajhno: pričakovano, da bo ${e.origin} imelo ${n}${e.minimum.toString()} ${r.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neveljaven niz: mora se začeti z "${t.prefix}"`:t.format===`ends_with`?`Neveljaven niz: mora se končati z "${t.suffix}"`:t.format===`includes`?`Neveljaven niz: mora vsebovati "${t.includes}"`:t.format===`regex`?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznan${e.keys.length>1?`i ključi`:` ključ`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Neveljaven ključ v ${e.origin}`;case`invalid_union`:return`Neveljaven vnos`;case`invalid_element`:return`Neveljavna vrednost v ${e.origin}`;default:return`Neveljaven vnos`}}};function sl_default(){return{localeError:error$11()}}const error$10=()=>{let e={string:{unit:`tecken`,verb:`att ha`},file:{unit:`bytes`,verb:`att ha`},array:{unit:`objekt`,verb:`att innehålla`},set:{unit:`objekt`,verb:`att innehålla`}};function t(t){return e[t]??null}let n={regex:`reguljärt uttryck`,email:`e-postadress`,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-datum och tid`,date:`ISO-datum`,time:`ISO-tid`,duration:`ISO-varaktighet`,ipv4:`IPv4-intervall`,ipv6:`IPv6-intervall`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodad sträng`,base64url:`base64url-kodad sträng`,json_string:`JSON-sträng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`mall-literal`},r={nan:`NaN`,number:`antal`,array:`lista`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: förväntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: förväntat ${t}, fick ${i}`}case`invalid_value`:return e.values.length===1?`Ogiltig inmatning: förväntat ${stringifyPrimitive(e.values[0])}`:`Ogiltigt val: förväntade en av ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`För stor(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()} ${r.unit??`element`}`:`För stor(t): förväntat ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()} ${r.unit}`:`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ogiltig sträng: måste börja med "${t.prefix}"`:t.format===`ends_with`?`Ogiltig sträng: måste sluta med "${t.suffix}"`:t.format===`includes`?`Ogiltig sträng: måste innehålla "${t.includes}"`:t.format===`regex`?`Ogiltig sträng: måste matcha mönstret "${t.pattern}"`:`Ogiltig(t) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Okända nycklar`:`Okänd nyckel`}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Ogiltig nyckel i ${e.origin??`värdet`}`;case`invalid_union`:return`Ogiltig input`;case`invalid_element`:return`Ogiltigt värde i ${e.origin??`värdet`}`;default:return`Ogiltig input`}}};function sv_default(){return{localeError:error$10()}}const error$9=()=>{let e={string:{unit:`எழுத்துக்கள்`,verb:`கொண்டிருக்க வேண்டும்`},file:{unit:`பைட்டுகள்`,verb:`கொண்டிருக்க வேண்டும்`},array:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`},set:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`}};function t(t){return e[t]??null}let n={regex:`உள்ளீடு`,email:`மின்னஞ்சல் முகவரி`,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 தேதி நேரம்`,date:`ISO தேதி`,time:`ISO நேரம்`,duration:`ISO கால அளவு`,ipv4:`IPv4 முகவரி`,ipv6:`IPv6 முகவரி`,cidrv4:`IPv4 வரம்பு`,cidrv6:`IPv6 வரம்பு`,base64:`base64-encoded சரம்`,base64url:`base64url-encoded சரம்`,json_string:`JSON சரம்`,e164:`E.164 எண்`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`எண்`,array:`அணி`,null:`வெறுமை`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${e.expected}, பெறப்பட்டது ${i}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t}, பெறப்பட்டது ${i}`}case`invalid_value`:return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${stringifyPrimitive(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${joinValues(e.values,`|`)} இல் ஒன்று`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ${r.unit??`உறுப்புகள்`} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`தவறான சரம்: "${t.prefix}" இல் தொடங்க வேண்டும்`:t.format===`ends_with`?`தவறான சரம்: "${t.suffix}" இல் முடிவடைய வேண்டும்`:t.format===`includes`?`தவறான சரம்: "${t.includes}" ஐ உள்ளடக்க வேண்டும்`:t.format===`regex`?`தவறான சரம்: ${t.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[t.format]??e.format}`}case`not_multiple_of`:return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case`unrecognized_keys`:return`அடையாளம் தெரியாத விசை${e.keys.length>1?`கள்`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} இல் தவறான விசை`;case`invalid_union`:return`தவறான உள்ளீடு`;case`invalid_element`:return`${e.origin} இல் தவறான மதிப்பு`;default:return`தவறான உள்ளீடு`}}};function ta_default(){return{localeError:error$9()}}const error$8=()=>{let e={string:{unit:`ตัวอักษร`,verb:`ควรมี`},file:{unit:`ไบต์`,verb:`ควรมี`},array:{unit:`รายการ`,verb:`ควรมี`},set:{unit:`รายการ`,verb:`ควรมี`}};function t(t){return e[t]??null}let n={regex:`ข้อมูลที่ป้อน`,email:`ที่อยู่อีเมล`,url:`URL`,emoji:`อิโมจิ`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`วันที่เวลาแบบ ISO`,date:`วันที่แบบ ISO`,time:`เวลาแบบ ISO`,duration:`ช่วงเวลาแบบ ISO`,ipv4:`ที่อยู่ IPv4`,ipv6:`ที่อยู่ IPv6`,cidrv4:`ช่วง IP แบบ IPv4`,cidrv6:`ช่วง IP แบบ IPv6`,base64:`ข้อความแบบ Base64`,base64url:`ข้อความแบบ Base64 สำหรับ URL`,json_string:`ข้อความแบบ JSON`,e164:`เบอร์โทรศัพท์ระหว่างประเทศ (E.164)`,jwt:`โทเคน JWT`,template_literal:`ข้อมูลที่ป้อน`},r={nan:`NaN`,number:`ตัวเลข`,array:`อาร์เรย์ (Array)`,null:`ไม่มีค่า (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${e.expected} แต่ได้รับ ${i}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t} แต่ได้รับ ${i}`}case`invalid_value`:return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${stringifyPrimitive(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`ไม่เกิน`:`น้อยกว่า`,r=t(e.origin);return r?`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()} ${r.unit??`รายการ`}`:`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`อย่างน้อย`:`มากกว่า`,r=t(e.origin);return r?`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()} ${r.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${t.prefix}"`:t.format===`ends_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${t.suffix}"`:t.format===`includes`?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${t.includes}" อยู่ในข้อความ`:t.format===`regex`?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${t.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[t.format]??e.format}`}case`not_multiple_of`:return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case`unrecognized_keys`:return`พบคีย์ที่ไม่รู้จัก: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`คีย์ไม่ถูกต้องใน ${e.origin}`;case`invalid_union`:return`ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้`;case`invalid_element`:return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return`ข้อมูลไม่ถูกต้อง`}}};function th_default(){return{localeError:error$8()}}const error$7=()=>{let e={string:{unit:`karakter`,verb:`olmalı`},file:{unit:`bayt`,verb:`olmalı`},array:{unit:`öğe`,verb:`olmalı`},set:{unit:`öğe`,verb:`olmalı`}};function t(t){return e[t]??null}let n={regex:`girdi`,email:`e-posta adresi`,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 tarih ve saat`,date:`ISO tarih`,time:`ISO saat`,duration:`ISO süre`,ipv4:`IPv4 adresi`,ipv6:`IPv6 adresi`,cidrv4:`IPv4 aralığı`,cidrv6:`IPv6 aralığı`,base64:`base64 ile şifrelenmiş metin`,base64url:`base64url ile şifrelenmiş metin`,json_string:`JSON dizesi`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`Şablon dizesi`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Geçersiz değer: beklenen instanceof ${e.expected}, alınan ${i}`:`Geçersiz değer: beklenen ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Geçersiz değer: beklenen ${stringifyPrimitive(e.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()} ${r.unit??`öğe`}`:`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Geçersiz metin: "${t.prefix}" ile başlamalı`:t.format===`ends_with`?`Geçersiz metin: "${t.suffix}" ile bitmeli`:t.format===`includes`?`Geçersiz metin: "${t.includes}" içermeli`:t.format===`regex`?`Geçersiz metin: ${t.pattern} desenine uymalı`:`Geçersiz ${n[t.format]??e.format}`}case`not_multiple_of`:return`Geçersiz sayı: ${e.divisor} ile tam bölünebilmeli`;case`unrecognized_keys`:return`Tanınmayan anahtar${e.keys.length>1?`lar`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} içinde geçersiz anahtar`;case`invalid_union`:return`Geçersiz değer`;case`invalid_element`:return`${e.origin} içinde geçersiz değer`;default:return`Geçersiz değer`}}};function tr_default(){return{localeError:error$7()}}const error$6=()=>{let e={string:{unit:`символів`,verb:`матиме`},file:{unit:`байтів`,verb:`матиме`},array:{unit:`елементів`,verb:`матиме`},set:{unit:`елементів`,verb:`матиме`}};function t(t){return e[t]??null}let n={regex:`вхідні дані`,email:`адреса електронної пошти`,url:`URL`,emoji:`емодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`дата та час ISO`,date:`дата ISO`,time:`час ISO`,duration:`тривалість ISO`,ipv4:`адреса IPv4`,ipv6:`адреса IPv6`,cidrv4:`діапазон IPv4`,cidrv6:`діапазон IPv6`,base64:`рядок у кодуванні base64`,base64url:`рядок у кодуванні base64url`,json_string:`рядок JSON`,e164:`номер E.164`,jwt:`JWT`,template_literal:`вхідні дані`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неправильні вхідні дані: очікується instanceof ${e.expected}, отримано ${i}`:`Неправильні вхідні дані: очікується ${t}, отримано ${i}`}case`invalid_value`:return e.values.length===1?`Неправильні вхідні дані: очікується ${stringifyPrimitive(e.values[0])}`:`Неправильна опція: очікується одне з ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Занадто велике: очікується, що ${e.origin??`значення`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`елементів`}`:`Занадто велике: очікується, що ${e.origin??`значення`} буде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Занадто мале: очікується, що ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неправильний рядок: повинен починатися з "${t.prefix}"`:t.format===`ends_with`?`Неправильний рядок: повинен закінчуватися на "${t.suffix}"`:t.format===`includes`?`Неправильний рядок: повинен містити "${t.includes}"`:t.format===`regex`?`Неправильний рядок: повинен відповідати шаблону ${t.pattern}`:`Неправильний ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неправильне число: повинно бути кратним ${e.divisor}`;case`unrecognized_keys`:return`Нерозпізнаний ключ${e.keys.length>1?`і`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Неправильний ключ у ${e.origin}`;case`invalid_union`:return`Неправильні вхідні дані`;case`invalid_element`:return`Неправильне значення у ${e.origin}`;default:return`Неправильні вхідні дані`}}};function uk_default(){return{localeError:error$6()}}function ua_default(){return uk_default()}const error$5=()=>{let e={string:{unit:`حروف`,verb:`ہونا`},file:{unit:`بائٹس`,verb:`ہونا`},array:{unit:`آئٹمز`,verb:`ہونا`},set:{unit:`آئٹمز`,verb:`ہونا`}};function t(t){return e[t]??null}let n={regex:`ان پٹ`,email:`ای میل ایڈریس`,url:`یو آر ایل`,emoji:`ایموجی`,uuid:`یو یو آئی ڈی`,uuidv4:`یو یو آئی ڈی وی 4`,uuidv6:`یو یو آئی ڈی وی 6`,nanoid:`نینو آئی ڈی`,guid:`جی یو آئی ڈی`,cuid:`سی یو آئی ڈی`,cuid2:`سی یو آئی ڈی 2`,ulid:`یو ایل آئی ڈی`,xid:`ایکس آئی ڈی`,ksuid:`کے ایس یو آئی ڈی`,datetime:`آئی ایس او ڈیٹ ٹائم`,date:`آئی ایس او تاریخ`,time:`آئی ایس او وقت`,duration:`آئی ایس او مدت`,ipv4:`آئی پی وی 4 ایڈریس`,ipv6:`آئی پی وی 6 ایڈریس`,cidrv4:`آئی پی وی 4 رینج`,cidrv6:`آئی پی وی 6 رینج`,base64:`بیس 64 ان کوڈڈ سٹرنگ`,base64url:`بیس 64 یو آر ایل ان کوڈڈ سٹرنگ`,json_string:`جے ایس او این سٹرنگ`,e164:`ای 164 نمبر`,jwt:`جے ڈبلیو ٹی`,template_literal:`ان پٹ`},r={nan:`NaN`,number:`نمبر`,array:`آرے`,null:`نل`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`غلط ان پٹ: instanceof ${e.expected} متوقع تھا، ${i} موصول ہوا`:`غلط ان پٹ: ${t} متوقع تھا، ${i} موصول ہوا`}case`invalid_value`:return e.values.length===1?`غلط ان پٹ: ${stringifyPrimitive(e.values[0])} متوقع تھا`:`غلط آپشن: ${joinValues(e.values,`|`)} میں سے ایک متوقع تھا`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`بہت بڑا: ${e.origin??`ویلیو`} کے ${n}${e.maximum.toString()} ${r.unit??`عناصر`} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??`ویلیو`} کا ${n}${e.maximum.toString()} ہونا متوقع تھا`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`بہت چھوٹا: ${e.origin} کے ${n}${e.minimum.toString()} ${r.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${n}${e.minimum.toString()} ہونا متوقع تھا`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`غلط سٹرنگ: "${t.prefix}" سے شروع ہونا چاہیے`:t.format===`ends_with`?`غلط سٹرنگ: "${t.suffix}" پر ختم ہونا چاہیے`:t.format===`includes`?`غلط سٹرنگ: "${t.includes}" شامل ہونا چاہیے`:t.format===`regex`?`غلط سٹرنگ: پیٹرن ${t.pattern} سے میچ ہونا چاہیے`:`غلط ${n[t.format]??e.format}`}case`not_multiple_of`:return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case`unrecognized_keys`:return`غیر تسلیم شدہ کی${e.keys.length>1?`ز`:``}: ${joinValues(e.keys,`، `)}`;case`invalid_key`:return`${e.origin} میں غلط کی`;case`invalid_union`:return`غلط ان پٹ`;case`invalid_element`:return`${e.origin} میں غلط ویلیو`;default:return`غلط ان پٹ`}}};function ur_default(){return{localeError:error$5()}}const error$4=()=>{let e={string:{unit:`belgi`,verb:`bo‘lishi kerak`},file:{unit:`bayt`,verb:`bo‘lishi kerak`},array:{unit:`element`,verb:`bo‘lishi kerak`},set:{unit:`element`,verb:`bo‘lishi kerak`}};function t(t){return e[t]??null}let n={regex:`kirish`,email:`elektron pochta manzili`,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 sana va vaqti`,date:`ISO sana`,time:`ISO vaqt`,duration:`ISO davomiylik`,ipv4:`IPv4 manzil`,ipv6:`IPv6 manzil`,mac:`MAC manzil`,cidrv4:`IPv4 diapazon`,cidrv6:`IPv6 diapazon`,base64:`base64 kodlangan satr`,base64url:`base64url kodlangan satr`,json_string:`JSON satr`,e164:`E.164 raqam`,jwt:`JWT`,template_literal:`kirish`},r={nan:`NaN`,number:`raqam`,array:`massiv`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Noto‘g‘ri kirish: kutilgan ${t}, qabul qilingan ${i}`}case`invalid_value`:return e.values.length===1?`Noto‘g‘ri kirish: kutilgan ${stringifyPrimitive(e.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()} ${r.unit} ${r.verb}`:`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Noto‘g‘ri satr: "${t.prefix}" bilan boshlanishi kerak`:t.format===`ends_with`?`Noto‘g‘ri satr: "${t.suffix}" bilan tugashi kerak`:t.format===`includes`?`Noto‘g‘ri satr: "${t.includes}" ni o‘z ichiga olishi kerak`:t.format===`regex`?`Noto‘g‘ri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${n[t.format]??e.format}`}case`not_multiple_of`:return`Noto‘g‘ri raqam: ${e.divisor} ning karralisi bo‘lishi kerak`;case`unrecognized_keys`:return`Noma’lum kalit${e.keys.length>1?`lar`:``}: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} dagi kalit noto‘g‘ri`;case`invalid_union`:return`Noto‘g‘ri kirish`;case`invalid_element`:return`${e.origin} da noto‘g‘ri qiymat`;default:return`Noto‘g‘ri kirish`}}};function uz_default(){return{localeError:error$4()}}const error$3=()=>{let e={string:{unit:`ký tự`,verb:`có`},file:{unit:`byte`,verb:`có`},array:{unit:`phần tử`,verb:`có`},set:{unit:`phần tử`,verb:`có`}};function t(t){return e[t]??null}let n={regex:`đầu vào`,email:`địa chỉ email`,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:`ngày giờ ISO`,date:`ngày ISO`,time:`giờ ISO`,duration:`khoảng thời gian ISO`,ipv4:`địa chỉ IPv4`,ipv6:`địa chỉ IPv6`,cidrv4:`dải IPv4`,cidrv6:`dải IPv6`,base64:`chuỗi mã hóa base64`,base64url:`chuỗi mã hóa base64url`,json_string:`chuỗi JSON`,e164:`số E.164`,jwt:`JWT`,template_literal:`đầu vào`},r={nan:`NaN`,number:`số`,array:`mảng`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${e.expected}, nhận được ${i}`:`Đầu vào không hợp lệ: mong đợi ${t}, nhận được ${i}`}case`invalid_value`:return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${stringifyPrimitive(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Quá lớn: mong đợi ${e.origin??`giá trị`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`phần tử`}`:`Quá lớn: mong đợi ${e.origin??`giá trị`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Quá nhỏ: mong đợi ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chuỗi không hợp lệ: phải bắt đầu bằng "${t.prefix}"`:t.format===`ends_with`?`Chuỗi không hợp lệ: phải kết thúc bằng "${t.suffix}"`:t.format===`includes`?`Chuỗi không hợp lệ: phải bao gồm "${t.includes}"`:t.format===`regex`?`Chuỗi không hợp lệ: phải khớp với mẫu ${t.pattern}`:`${n[t.format]??e.format} không hợp lệ`}case`not_multiple_of`:return`Số không hợp lệ: phải là bội số của ${e.divisor}`;case`unrecognized_keys`:return`Khóa không được nhận dạng: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Khóa không hợp lệ trong ${e.origin}`;case`invalid_union`:return`Đầu vào không hợp lệ`;case`invalid_element`:return`Giá trị không hợp lệ trong ${e.origin}`;default:return`Đầu vào không hợp lệ`}}};function vi_default(){return{localeError:error$3()}}const error$2=()=>{let e={string:{unit:`字符`,verb:`包含`},file:{unit:`字节`,verb:`包含`},array:{unit:`项`,verb:`包含`},set:{unit:`项`,verb:`包含`}};function t(t){return e[t]??null}let n={regex:`输入`,email:`电子邮件`,url:`URL`,emoji:`表情符号`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日期时间`,date:`ISO日期`,time:`ISO时间`,duration:`ISO时长`,ipv4:`IPv4地址`,ipv6:`IPv6地址`,cidrv4:`IPv4网段`,cidrv6:`IPv6网段`,base64:`base64编码字符串`,base64url:`base64url编码字符串`,json_string:`JSON字符串`,e164:`E.164号码`,jwt:`JWT`,template_literal:`输入`},r={nan:`NaN`,number:`数字`,array:`数组`,null:`空值(null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`无效输入:期望 instanceof ${e.expected},实际接收 ${i}`:`无效输入:期望 ${t},实际接收 ${i}`}case`invalid_value`:return e.values.length===1?`无效输入:期望 ${stringifyPrimitive(e.values[0])}`:`无效选项:期望以下之一 ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()} ${r.unit??`个元素`}`:`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`无效字符串:必须以 "${t.prefix}" 开头`:t.format===`ends_with`?`无效字符串:必须以 "${t.suffix}" 结尾`:t.format===`includes`?`无效字符串:必须包含 "${t.includes}"`:t.format===`regex`?`无效字符串:必须满足正则表达式 ${t.pattern}`:`无效${n[t.format]??e.format}`}case`not_multiple_of`:return`无效数字:必须是 ${e.divisor} 的倍数`;case`unrecognized_keys`:return`出现未知的键(key): ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} 中的键(key)无效`;case`invalid_union`:return`无效输入`;case`invalid_element`:return`${e.origin} 中包含无效值(value)`;default:return`无效输入`}}};function zh_CN_default(){return{localeError:error$2()}}const error$1=()=>{let e={string:{unit:`字元`,verb:`擁有`},file:{unit:`位元組`,verb:`擁有`},array:{unit:`項目`,verb:`擁有`},set:{unit:`項目`,verb:`擁有`}};function t(t){return e[t]??null}let n={regex:`輸入`,email:`郵件地址`,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 日期時間`,date:`ISO 日期`,time:`ISO 時間`,duration:`ISO 期間`,ipv4:`IPv4 位址`,ipv6:`IPv6 位址`,cidrv4:`IPv4 範圍`,cidrv6:`IPv6 範圍`,base64:`base64 編碼字串`,base64url:`base64url 編碼字串`,json_string:`JSON 字串`,e164:`E.164 數值`,jwt:`JWT`,template_literal:`輸入`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無效的輸入值:預期為 instanceof ${e.expected},但收到 ${i}`:`無效的輸入值:預期為 ${t},但收到 ${i}`}case`invalid_value`:return e.values.length===1?`無效的輸入值:預期為 ${stringifyPrimitive(e.values[0])}`:`無效的選項:預期為以下其中之一 ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()} ${r.unit??`個元素`}`:`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()} ${r.unit}`:`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無效的字串:必須以 "${t.prefix}" 開頭`:t.format===`ends_with`?`無效的字串:必須以 "${t.suffix}" 結尾`:t.format===`includes`?`無效的字串:必須包含 "${t.includes}"`:t.format===`regex`?`無效的字串:必須符合格式 ${t.pattern}`:`無效的 ${n[t.format]??e.format}`}case`not_multiple_of`:return`無效的數字:必須為 ${e.divisor} 的倍數`;case`unrecognized_keys`:return`無法識別的鍵值${e.keys.length>1?`們`:``}:${joinValues(e.keys,`、`)}`;case`invalid_key`:return`${e.origin} 中有無效的鍵值`;case`invalid_union`:return`無效的輸入值`;case`invalid_element`:return`${e.origin} 中有無效的值`;default:return`無效的輸入值`}}};function zh_TW_default(){return{localeError:error$1()}}const error=()=>{let e={string:{unit:`àmi`,verb:`ní`},file:{unit:`bytes`,verb:`ní`},array:{unit:`nkan`,verb:`ní`},set:{unit:`nkan`,verb:`ní`}};function t(t){return e[t]??null}let n={regex:`ẹ̀rọ ìbáwọlé`,email:`àdírẹ́sì ìmẹ́lì`,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:`àkókò ISO`,date:`ọjọ́ ISO`,time:`àkókò ISO`,duration:`àkókò tó pé ISO`,ipv4:`àdírẹ́sì IPv4`,ipv6:`àdírẹ́sì IPv6`,cidrv4:`àgbègbè IPv4`,cidrv6:`àgbègbè IPv6`,base64:`ọ̀rọ̀ tí a kọ́ ní base64`,base64url:`ọ̀rọ̀ base64url`,json_string:`ọ̀rọ̀ JSON`,e164:`nọ́mbà E.164`,jwt:`JWT`,template_literal:`ẹ̀rọ ìbáwọlé`},r={nan:`NaN`,number:`nọ́mbà`,array:`akopọ`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=parsedType(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${e.expected}, àmọ̀ a rí ${i}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${t}, àmọ̀ a rí ${i}`}case`invalid_value`:return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${stringifyPrimitive(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${joinValues(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??`iye`} ${r.verb} ${n}${e.maximum} ${r.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${e.maximum}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${r.verb} ${n}${e.minimum} ${r.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${e.minimum}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${t.prefix}"`:t.format===`ends_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${t.suffix}"`:t.format===`includes`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${t.includes}"`:t.format===`regex`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${t.pattern}`:`Aṣìṣe: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case`unrecognized_keys`:return`Bọtìnì àìmọ̀: ${joinValues(e.keys,`, `)}`;case`invalid_key`:return`Bọtìnì aṣìṣe nínú ${e.origin}`;case`invalid_union`:return`Ìbáwọlé aṣìṣe`;case`invalid_element`:return`Iye aṣìṣe nínú ${e.origin}`;default:return`Ìbáwọlé aṣìṣe`}}};function yo_default(){return{localeError:error()}}var locales_exports=__exportAll({ar:()=>ar_default,az:()=>az_default,be:()=>be_default,bg:()=>bg_default,ca:()=>ca_default,cs:()=>cs_default,da:()=>da_default,de:()=>de_default,en:()=>en_default,eo:()=>eo_default,es:()=>es_default,fa:()=>fa_default,fi:()=>fi_default,fr:()=>fr_default,frCA:()=>fr_CA_default,he:()=>he_default,hu:()=>hu_default,hy:()=>hy_default,id:()=>id_default,is:()=>is_default,it:()=>it_default,ja:()=>ja_default,ka:()=>ka_default,kh:()=>kh_default,km:()=>km_default,ko:()=>ko_default,lt:()=>lt_default,mk:()=>mk_default,ms:()=>ms_default,nl:()=>nl_default,no:()=>no_default,ota:()=>ota_default,pl:()=>pl_default,ps:()=>ps_default,pt:()=>pt_default,ru:()=>ru_default,sl:()=>sl_default,sv:()=>sv_default,ta:()=>ta_default,th:()=>th_default,tr:()=>tr_default,ua:()=>ua_default,uk:()=>uk_default,ur:()=>ur_default,uz:()=>uz_default,vi:()=>vi_default,yo:()=>yo_default,zhCN:()=>zh_CN_default,zhTW:()=>zh_TW_default}),_a;const $output=Symbol(`ZodOutput`),$input=Symbol(`ZodInput`);var $ZodRegistry=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function registry(){return new $ZodRegistry}(_a=globalThis).__zod_globalRegistry??(_a.__zod_globalRegistry=registry());const globalRegistry=globalThis.__zod_globalRegistry;function _string(e,t){return new e({type:`string`,...normalizeParams(t)})}function _coercedString(e,t){return new e({type:`string`,coerce:!0,...normalizeParams(t)})}function _email(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _guid(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _uuid(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _uuidv4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...normalizeParams(t)})}function _uuidv6(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...normalizeParams(t)})}function _uuidv7(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...normalizeParams(t)})}function _url$1(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _emoji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _nanoid(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _cuid(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _cuid2(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _ulid(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _xid(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _ksuid(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _ipv4(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _ipv6(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _mac(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _cidrv4(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _cidrv6(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _base64(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _base64url(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _e164(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...normalizeParams(t)})}function _jwt(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...normalizeParams(t)})}const TimePrecision={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function _isoDateTime(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...normalizeParams(t)})}function _isoDate(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...normalizeParams(t)})}function _isoTime(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...normalizeParams(t)})}function _isoDuration(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...normalizeParams(t)})}function _number(e,t){return new e({type:`number`,checks:[],...normalizeParams(t)})}function _coercedNumber(e,t){return new e({type:`number`,coerce:!0,checks:[],...normalizeParams(t)})}function _int(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...normalizeParams(t)})}function _float32(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...normalizeParams(t)})}function _float64(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...normalizeParams(t)})}function _int32(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...normalizeParams(t)})}function _uint32(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...normalizeParams(t)})}function _boolean(e,t){return new e({type:`boolean`,...normalizeParams(t)})}function _coercedBoolean(e,t){return new e({type:`boolean`,coerce:!0,...normalizeParams(t)})}function _bigint(e,t){return new e({type:`bigint`,...normalizeParams(t)})}function _coercedBigint(e,t){return new e({type:`bigint`,coerce:!0,...normalizeParams(t)})}function _int64(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...normalizeParams(t)})}function _uint64(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...normalizeParams(t)})}function _symbol(e,t){return new e({type:`symbol`,...normalizeParams(t)})}function _undefined$2(e,t){return new e({type:`undefined`,...normalizeParams(t)})}function _null$2(e,t){return new e({type:`null`,...normalizeParams(t)})}function _any(e){return new e({type:`any`})}function _unknown(e){return new e({type:`unknown`})}function _never(e,t){return new e({type:`never`,...normalizeParams(t)})}function _void$2(e,t){return new e({type:`void`,...normalizeParams(t)})}function _date(e,t){return new e({type:`date`,...normalizeParams(t)})}function _coercedDate(e,t){return new e({type:`date`,coerce:!0,...normalizeParams(t)})}function _nan(e,t){return new e({type:`nan`,...normalizeParams(t)})}function _lt(e,t){return new $ZodCheckLessThan({check:`less_than`,...normalizeParams(t),value:e,inclusive:!1})}function _lte(e,t){return new $ZodCheckLessThan({check:`less_than`,...normalizeParams(t),value:e,inclusive:!0})}function _gt(e,t){return new $ZodCheckGreaterThan({check:`greater_than`,...normalizeParams(t),value:e,inclusive:!1})}function _gte(e,t){return new $ZodCheckGreaterThan({check:`greater_than`,...normalizeParams(t),value:e,inclusive:!0})}function _positive(e){return _gt(0,e)}function _negative(e){return _lt(0,e)}function _nonpositive(e){return _lte(0,e)}function _nonnegative(e){return _gte(0,e)}function _multipleOf(e,t){return new $ZodCheckMultipleOf({check:`multiple_of`,...normalizeParams(t),value:e})}function _maxSize(e,t){return new $ZodCheckMaxSize({check:`max_size`,...normalizeParams(t),maximum:e})}function _minSize(e,t){return new $ZodCheckMinSize({check:`min_size`,...normalizeParams(t),minimum:e})}function _size(e,t){return new $ZodCheckSizeEquals({check:`size_equals`,...normalizeParams(t),size:e})}function _maxLength(e,t){return new $ZodCheckMaxLength({check:`max_length`,...normalizeParams(t),maximum:e})}function _minLength(e,t){return new $ZodCheckMinLength({check:`min_length`,...normalizeParams(t),minimum:e})}function _length(e,t){return new $ZodCheckLengthEquals({check:`length_equals`,...normalizeParams(t),length:e})}function _regex(e,t){return new $ZodCheckRegex({check:`string_format`,format:`regex`,...normalizeParams(t),pattern:e})}function _lowercase(e){return new $ZodCheckLowerCase({check:`string_format`,format:`lowercase`,...normalizeParams(e)})}function _uppercase(e){return new $ZodCheckUpperCase({check:`string_format`,format:`uppercase`,...normalizeParams(e)})}function _includes(e,t){return new $ZodCheckIncludes({check:`string_format`,format:`includes`,...normalizeParams(t),includes:e})}function _startsWith(e,t){return new $ZodCheckStartsWith({check:`string_format`,format:`starts_with`,...normalizeParams(t),prefix:e})}function _endsWith(e,t){return new $ZodCheckEndsWith({check:`string_format`,format:`ends_with`,...normalizeParams(t),suffix:e})}function _property(e,t,n){return new $ZodCheckProperty({check:`property`,property:e,schema:t,...normalizeParams(n)})}function _mime(e,t){return new $ZodCheckMimeType({check:`mime_type`,mime:e,...normalizeParams(t)})}function _overwrite(e){return new $ZodCheckOverwrite({check:`overwrite`,tx:e})}function _normalize(e){return _overwrite(t=>t.normalize(e))}function _trim(){return _overwrite(e=>e.trim())}function _toLowerCase(){return _overwrite(e=>e.toLowerCase())}function _toUpperCase(){return _overwrite(e=>e.toUpperCase())}function _slugify(){return _overwrite(e=>slugify(e))}function _array(e,t,n){return new e({type:`array`,element:t,...normalizeParams(n)})}function _union(e,t,n){return new e({type:`union`,options:t,...normalizeParams(n)})}function _xor(e,t,n){return new e({type:`union`,options:t,inclusive:!1,...normalizeParams(n)})}function _discriminatedUnion(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,...normalizeParams(r)})}function _intersection(e,t,n){return new e({type:`intersection`,left:t,right:n})}function _tuple(e,t,n,r){let i=n instanceof $ZodType;return new e({type:`tuple`,items:t,rest:i?n:null,...normalizeParams(i?r:n)})}function _record(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,...normalizeParams(r)})}function _map(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,...normalizeParams(r)})}function _set(e,t,n){return new e({type:`set`,valueType:t,...normalizeParams(n)})}function _enum$2(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...normalizeParams(n)})}function _nativeEnum(e,t,n){return new e({type:`enum`,entries:t,...normalizeParams(n)})}function _literal(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],...normalizeParams(n)})}function _file(e,t){return new e({type:`file`,...normalizeParams(t)})}function _transform(e,t){return new e({type:`transform`,transform:t})}function _optional(e,t){return new e({type:`optional`,innerType:t})}function _nullable(e,t){return new e({type:`nullable`,innerType:t})}function _default$2(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():shallowClone(n)}})}function _nonoptional(e,t,n){return new e({type:`nonoptional`,innerType:t,...normalizeParams(n)})}function _success(e,t){return new e({type:`success`,innerType:t})}function _catch$2(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function _pipe(e,t,n){return new e({type:`pipe`,in:t,out:n})}function _readonly(e,t){return new e({type:`readonly`,innerType:t})}function _templateLiteral(e,t,n){return new e({type:`template_literal`,parts:t,...normalizeParams(n)})}function _lazy$1(e,t){return new e({type:`lazy`,getter:t})}function _promise(e,t){return new e({type:`promise`,innerType:t})}function _custom(e,t,n){let r=normalizeParams(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function _refine(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...normalizeParams(n)})}function _superRefine(e){let t=_check(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(issue(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(issue(r))}},e(n.value,n)));return t}function _check(e,t){let n=new $ZodCheck({check:`custom`,...normalizeParams(t)});return n._zod.check=e,n}function describe$2(e){let t=new $ZodCheck({check:`describe`});return t._zod.onattach=[t=>{let n=globalRegistry.get(t)??{};globalRegistry.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function meta$2(e){let t=new $ZodCheck({check:`meta`});return t._zod.onattach=[t=>{let n=globalRegistry.get(t)??{};globalRegistry.add(t,{...n,...e})}],t._zod.check=()=>{},t}function _stringbool(e,t){let n=normalizeParams(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??$ZodCodec,c=e.Boolean??$ZodBoolean,l=new s({type:`pipe`,in:new(e.String??$ZodString)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function _stringFormat(e,t,n,r={}){let i=normalizeParams(r),a={...normalizeParams(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function initializeContext(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??globalRegistry,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 process$2(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,process$2(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&isTransforming(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function extractDefs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#`,a=`#/${r}/`,o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:a+o}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
58
+
59
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function finalize(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:createStandardJSONSchemaMethod(t,`input`,e.processors),output:createStandardJSONSchemaMethod(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function isTransforming(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return isTransforming(r.element,n);if(r.type===`set`)return isTransforming(r.valueType,n);if(r.type===`lazy`)return isTransforming(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return isTransforming(r.innerType,n);if(r.type===`intersection`)return isTransforming(r.left,n)||isTransforming(r.right,n);if(r.type===`record`||r.type===`map`)return isTransforming(r.keyType,n)||isTransforming(r.valueType,n);if(r.type===`pipe`)return isTransforming(r.in,n)||isTransforming(r.out,n);if(r.type===`object`){for(let e in r.shape)if(isTransforming(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(isTransforming(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(isTransforming(e,n))return!0;return!!(r.rest&&isTransforming(r.rest,n))}return!1}const createToJSONSchemaMethod=(e,t={})=>n=>{let r=initializeContext({...n,processors:t});return process$2(e,r),extractDefs(r,e),finalize(r,e)},createStandardJSONSchemaMethod=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=initializeContext({...i??{},target:a,io:t,processors:n});return process$2(e,o),extractDefs(o,e),finalize(o,e)},formatMap={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},stringProcessor=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=formatMap[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},numberProcessor=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},booleanProcessor=(e,t,n,r)=>{n.type=`boolean`},bigintProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},symbolProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},nullProcessor=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},undefinedProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},voidProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},neverProcessor=(e,t,n,r)=>{n.not={}},anyProcessor=(e,t,n,r)=>{},unknownProcessor=(e,t,n,r)=>{},dateProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},enumProcessor=(e,t,n,r)=>{let i=e._zod.def,a=getEnumValues(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},literalProcessor=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},nanProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},templateLiteralProcessor=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},fileProcessor=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},successProcessor=(e,t,n,r)=>{n.type=`boolean`},customProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},functionProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},transformProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},mapProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},setProcessor=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},arrayProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=process$2(a.element,t,{...r,path:[...r.path,`items`]})},objectProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=process$2(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=process$2(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},unionProcessor=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>process$2(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},intersectionProcessor=(e,t,n,r)=>{let i=e._zod.def,a=process$2(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=process$2(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},tupleProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>process$2(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?process$2(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},recordProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=process$2(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=process$2(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=process$2(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},nullableProcessor=(e,t,n,r)=>{let i=e._zod.def,a=process$2(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},nonoptionalProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},defaultProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},prefaultProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},catchProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},pipeProcessor=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;process$2(a,t,r);let o=t.seen.get(e);o.ref=a},readonlyProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},promiseProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},optionalProcessor=(e,t,n,r)=>{let i=e._zod.def;process$2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lazyProcessor=(e,t,n,r)=>{let i=e._zod.innerType;process$2(i,t,r);let a=t.seen.get(e);a.ref=i},allProcessors={string:stringProcessor,number:numberProcessor,boolean:booleanProcessor,bigint:bigintProcessor,symbol:symbolProcessor,null:nullProcessor,undefined:undefinedProcessor,void:voidProcessor,never:neverProcessor,any:anyProcessor,unknown:unknownProcessor,date:dateProcessor,enum:enumProcessor,literal:literalProcessor,nan:nanProcessor,template_literal:templateLiteralProcessor,file:fileProcessor,success:successProcessor,custom:customProcessor,function:functionProcessor,transform:transformProcessor,map:mapProcessor,set:setProcessor,array:arrayProcessor,object:objectProcessor,union:unionProcessor,intersection:intersectionProcessor,tuple:tupleProcessor,record:recordProcessor,nullable:nullableProcessor,nonoptional:nonoptionalProcessor,default:defaultProcessor,prefault:prefaultProcessor,catch:catchProcessor,pipe:pipeProcessor,readonly:readonlyProcessor,promise:promiseProcessor,optional:optionalProcessor,lazy:lazyProcessor};function toJSONSchema(e,t){if(`_idmap`in e){let n=e,r=initializeContext({...t,processors:allProcessors}),i={};for(let e of n._idmap.entries()){let[t,n]=e;process$2(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;extractDefs(r,n),a[t]=finalize(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=initializeContext({...t,processors:allProcessors});return process$2(e,n),extractDefs(n,e),finalize(n,e)}var JSONSchemaGenerator=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??`draft-2020-12`;t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),this.ctx=initializeContext({processors:allProcessors,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return process$2(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),extractDefs(this.ctx,e);let{"~standard":n,...r}=finalize(this.ctx,e);return r}},json_schema_exports=__exportAll({}),core_exports=__exportAll({$ZodAny:()=>$ZodAny,$ZodArray:()=>$ZodArray,$ZodAsyncError:()=>$ZodAsyncError,$ZodBase64:()=>$ZodBase64,$ZodBase64URL:()=>$ZodBase64URL,$ZodBigInt:()=>$ZodBigInt,$ZodBigIntFormat:()=>$ZodBigIntFormat,$ZodBoolean:()=>$ZodBoolean,$ZodCIDRv4:()=>$ZodCIDRv4,$ZodCIDRv6:()=>$ZodCIDRv6,$ZodCUID:()=>$ZodCUID,$ZodCUID2:()=>$ZodCUID2,$ZodCatch:()=>$ZodCatch,$ZodCheck:()=>$ZodCheck,$ZodCheckBigIntFormat:()=>$ZodCheckBigIntFormat,$ZodCheckEndsWith:()=>$ZodCheckEndsWith,$ZodCheckGreaterThan:()=>$ZodCheckGreaterThan,$ZodCheckIncludes:()=>$ZodCheckIncludes,$ZodCheckLengthEquals:()=>$ZodCheckLengthEquals,$ZodCheckLessThan:()=>$ZodCheckLessThan,$ZodCheckLowerCase:()=>$ZodCheckLowerCase,$ZodCheckMaxLength:()=>$ZodCheckMaxLength,$ZodCheckMaxSize:()=>$ZodCheckMaxSize,$ZodCheckMimeType:()=>$ZodCheckMimeType,$ZodCheckMinLength:()=>$ZodCheckMinLength,$ZodCheckMinSize:()=>$ZodCheckMinSize,$ZodCheckMultipleOf:()=>$ZodCheckMultipleOf,$ZodCheckNumberFormat:()=>$ZodCheckNumberFormat,$ZodCheckOverwrite:()=>$ZodCheckOverwrite,$ZodCheckProperty:()=>$ZodCheckProperty,$ZodCheckRegex:()=>$ZodCheckRegex,$ZodCheckSizeEquals:()=>$ZodCheckSizeEquals,$ZodCheckStartsWith:()=>$ZodCheckStartsWith,$ZodCheckStringFormat:()=>$ZodCheckStringFormat,$ZodCheckUpperCase:()=>$ZodCheckUpperCase,$ZodCodec:()=>$ZodCodec,$ZodCustom:()=>$ZodCustom,$ZodCustomStringFormat:()=>$ZodCustomStringFormat,$ZodDate:()=>$ZodDate,$ZodDefault:()=>$ZodDefault,$ZodDiscriminatedUnion:()=>$ZodDiscriminatedUnion,$ZodE164:()=>$ZodE164,$ZodEmail:()=>$ZodEmail,$ZodEmoji:()=>$ZodEmoji,$ZodEncodeError:()=>$ZodEncodeError,$ZodEnum:()=>$ZodEnum,$ZodError:()=>$ZodError,$ZodExactOptional:()=>$ZodExactOptional,$ZodFile:()=>$ZodFile,$ZodFunction:()=>$ZodFunction,$ZodGUID:()=>$ZodGUID,$ZodIPv4:()=>$ZodIPv4,$ZodIPv6:()=>$ZodIPv6,$ZodISODate:()=>$ZodISODate,$ZodISODateTime:()=>$ZodISODateTime,$ZodISODuration:()=>$ZodISODuration,$ZodISOTime:()=>$ZodISOTime,$ZodIntersection:()=>$ZodIntersection,$ZodJWT:()=>$ZodJWT,$ZodKSUID:()=>$ZodKSUID,$ZodLazy:()=>$ZodLazy,$ZodLiteral:()=>$ZodLiteral,$ZodMAC:()=>$ZodMAC,$ZodMap:()=>$ZodMap,$ZodNaN:()=>$ZodNaN,$ZodNanoID:()=>$ZodNanoID,$ZodNever:()=>$ZodNever,$ZodNonOptional:()=>$ZodNonOptional,$ZodNull:()=>$ZodNull,$ZodNullable:()=>$ZodNullable,$ZodNumber:()=>$ZodNumber,$ZodNumberFormat:()=>$ZodNumberFormat,$ZodObject:()=>$ZodObject,$ZodObjectJIT:()=>$ZodObjectJIT,$ZodOptional:()=>$ZodOptional,$ZodPipe:()=>$ZodPipe,$ZodPrefault:()=>$ZodPrefault,$ZodPromise:()=>$ZodPromise,$ZodReadonly:()=>$ZodReadonly,$ZodRealError:()=>$ZodRealError,$ZodRecord:()=>$ZodRecord,$ZodRegistry:()=>$ZodRegistry,$ZodSet:()=>$ZodSet,$ZodString:()=>$ZodString,$ZodStringFormat:()=>$ZodStringFormat,$ZodSuccess:()=>$ZodSuccess,$ZodSymbol:()=>$ZodSymbol,$ZodTemplateLiteral:()=>$ZodTemplateLiteral,$ZodTransform:()=>$ZodTransform,$ZodTuple:()=>$ZodTuple,$ZodType:()=>$ZodType,$ZodULID:()=>$ZodULID,$ZodURL:()=>$ZodURL,$ZodUUID:()=>$ZodUUID,$ZodUndefined:()=>$ZodUndefined,$ZodUnion:()=>$ZodUnion,$ZodUnknown:()=>$ZodUnknown,$ZodVoid:()=>$ZodVoid,$ZodXID:()=>$ZodXID,$ZodXor:()=>$ZodXor,$brand:()=>$brand,$constructor:()=>$constructor,$input:()=>$input,$output:()=>$output,Doc:()=>Doc,JSONSchema:()=>json_schema_exports,JSONSchemaGenerator:()=>JSONSchemaGenerator,NEVER:()=>NEVER$1,TimePrecision:()=>TimePrecision,_any:()=>_any,_array:()=>_array,_base64:()=>_base64,_base64url:()=>_base64url,_bigint:()=>_bigint,_boolean:()=>_boolean,_catch:()=>_catch$2,_check:()=>_check,_cidrv4:()=>_cidrv4,_cidrv6:()=>_cidrv6,_coercedBigint:()=>_coercedBigint,_coercedBoolean:()=>_coercedBoolean,_coercedDate:()=>_coercedDate,_coercedNumber:()=>_coercedNumber,_coercedString:()=>_coercedString,_cuid:()=>_cuid,_cuid2:()=>_cuid2,_custom:()=>_custom,_date:()=>_date,_decode:()=>_decode,_decodeAsync:()=>_decodeAsync,_default:()=>_default$2,_discriminatedUnion:()=>_discriminatedUnion,_e164:()=>_e164,_email:()=>_email,_emoji:()=>_emoji,_encode:()=>_encode,_encodeAsync:()=>_encodeAsync,_endsWith:()=>_endsWith,_enum:()=>_enum$2,_file:()=>_file,_float32:()=>_float32,_float64:()=>_float64,_gt:()=>_gt,_gte:()=>_gte,_guid:()=>_guid,_includes:()=>_includes,_int:()=>_int,_int32:()=>_int32,_int64:()=>_int64,_intersection:()=>_intersection,_ipv4:()=>_ipv4,_ipv6:()=>_ipv6,_isoDate:()=>_isoDate,_isoDateTime:()=>_isoDateTime,_isoDuration:()=>_isoDuration,_isoTime:()=>_isoTime,_jwt:()=>_jwt,_ksuid:()=>_ksuid,_lazy:()=>_lazy$1,_length:()=>_length,_literal:()=>_literal,_lowercase:()=>_lowercase,_lt:()=>_lt,_lte:()=>_lte,_mac:()=>_mac,_map:()=>_map,_max:()=>_lte,_maxLength:()=>_maxLength,_maxSize:()=>_maxSize,_mime:()=>_mime,_min:()=>_gte,_minLength:()=>_minLength,_minSize:()=>_minSize,_multipleOf:()=>_multipleOf,_nan:()=>_nan,_nanoid:()=>_nanoid,_nativeEnum:()=>_nativeEnum,_negative:()=>_negative,_never:()=>_never,_nonnegative:()=>_nonnegative,_nonoptional:()=>_nonoptional,_nonpositive:()=>_nonpositive,_normalize:()=>_normalize,_null:()=>_null$2,_nullable:()=>_nullable,_number:()=>_number,_optional:()=>_optional,_overwrite:()=>_overwrite,_parse:()=>_parse,_parseAsync:()=>_parseAsync,_pipe:()=>_pipe,_positive:()=>_positive,_promise:()=>_promise,_property:()=>_property,_readonly:()=>_readonly,_record:()=>_record,_refine:()=>_refine,_regex:()=>_regex,_safeDecode:()=>_safeDecode,_safeDecodeAsync:()=>_safeDecodeAsync,_safeEncode:()=>_safeEncode,_safeEncodeAsync:()=>_safeEncodeAsync,_safeParse:()=>_safeParse,_safeParseAsync:()=>_safeParseAsync,_set:()=>_set,_size:()=>_size,_slugify:()=>_slugify,_startsWith:()=>_startsWith,_string:()=>_string,_stringFormat:()=>_stringFormat,_stringbool:()=>_stringbool,_success:()=>_success,_superRefine:()=>_superRefine,_symbol:()=>_symbol,_templateLiteral:()=>_templateLiteral,_toLowerCase:()=>_toLowerCase,_toUpperCase:()=>_toUpperCase,_transform:()=>_transform,_trim:()=>_trim,_tuple:()=>_tuple,_uint32:()=>_uint32,_uint64:()=>_uint64,_ulid:()=>_ulid,_undefined:()=>_undefined$2,_union:()=>_union,_unknown:()=>_unknown,_uppercase:()=>_uppercase,_url:()=>_url$1,_uuid:()=>_uuid,_uuidv4:()=>_uuidv4,_uuidv6:()=>_uuidv6,_uuidv7:()=>_uuidv7,_void:()=>_void$2,_xid:()=>_xid,_xor:()=>_xor,clone:()=>clone,config:()=>config,createStandardJSONSchemaMethod:()=>createStandardJSONSchemaMethod,createToJSONSchemaMethod:()=>createToJSONSchemaMethod,decode:()=>decode$1,decodeAsync:()=>decodeAsync$1,describe:()=>describe$2,encode:()=>encode$1,encodeAsync:()=>encodeAsync$1,extractDefs:()=>extractDefs,finalize:()=>finalize,flattenError:()=>flattenError$1,formatError:()=>formatError,globalConfig:()=>globalConfig,globalRegistry:()=>globalRegistry,initializeContext:()=>initializeContext,isValidBase64:()=>isValidBase64,isValidBase64URL:()=>isValidBase64URL,isValidJWT:()=>isValidJWT$1,locales:()=>locales_exports,meta:()=>meta$2,parse:()=>parse$3,parseAsync:()=>parseAsync$1,prettifyError:()=>prettifyError,process:()=>process$2,regexes:()=>regexes_exports,registry:()=>registry,safeDecode:()=>safeDecode$1,safeDecodeAsync:()=>safeDecodeAsync$1,safeEncode:()=>safeEncode$1,safeEncodeAsync:()=>safeEncodeAsync$1,safeParse:()=>safeParse$2,safeParseAsync:()=>safeParseAsync$2,toDotPath:()=>toDotPath,toJSONSchema:()=>toJSONSchema,treeifyError:()=>treeifyError,util:()=>util_exports,version:()=>version}),checks_exports=__exportAll({endsWith:()=>_endsWith,gt:()=>_gt,gte:()=>_gte,includes:()=>_includes,length:()=>_length,lowercase:()=>_lowercase,lt:()=>_lt,lte:()=>_lte,maxLength:()=>_maxLength,maxSize:()=>_maxSize,mime:()=>_mime,minLength:()=>_minLength,minSize:()=>_minSize,multipleOf:()=>_multipleOf,negative:()=>_negative,nonnegative:()=>_nonnegative,nonpositive:()=>_nonpositive,normalize:()=>_normalize,overwrite:()=>_overwrite,positive:()=>_positive,property:()=>_property,regex:()=>_regex,size:()=>_size,slugify:()=>_slugify,startsWith:()=>_startsWith,toLowerCase:()=>_toLowerCase,toUpperCase:()=>_toUpperCase,trim:()=>_trim,uppercase:()=>_uppercase}),iso_exports$1=__exportAll({ZodISODate:()=>ZodISODate,ZodISODateTime:()=>ZodISODateTime,ZodISODuration:()=>ZodISODuration,ZodISOTime:()=>ZodISOTime,date:()=>date$5,datetime:()=>datetime$1,duration:()=>duration$1,time:()=>time$1});const ZodISODateTime=$constructor(`ZodISODateTime`,(e,t)=>{$ZodISODateTime.init(e,t),ZodStringFormat.init(e,t)});function datetime$1(e){return _isoDateTime(ZodISODateTime,e)}const ZodISODate=$constructor(`ZodISODate`,(e,t)=>{$ZodISODate.init(e,t),ZodStringFormat.init(e,t)});function date$5(e){return _isoDate(ZodISODate,e)}const ZodISOTime=$constructor(`ZodISOTime`,(e,t)=>{$ZodISOTime.init(e,t),ZodStringFormat.init(e,t)});function time$1(e){return _isoTime(ZodISOTime,e)}const ZodISODuration=$constructor(`ZodISODuration`,(e,t)=>{$ZodISODuration.init(e,t),ZodStringFormat.init(e,t)});function duration$1(e){return _isoDuration(ZodISODuration,e)}const initializer=(e,t)=>{$ZodError.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>formatError(e,t)},flatten:{value:t=>flattenError$1(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,jsonStringifyReplacer,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,jsonStringifyReplacer,2)}},isEmpty:{get(){return e.issues.length===0}}})},ZodError$1=$constructor(`ZodError`,initializer),ZodRealError=$constructor(`ZodError`,initializer,{Parent:Error}),parse$2=_parse(ZodRealError),parseAsync=_parseAsync(ZodRealError),safeParse$1=_safeParse(ZodRealError),safeParseAsync$1=_safeParseAsync(ZodRealError),encode=_encode(ZodRealError),decode=_decode(ZodRealError),encodeAsync=_encodeAsync(ZodRealError),decodeAsync=_decodeAsync(ZodRealError),safeEncode=_safeEncode(ZodRealError),safeDecode=_safeDecode(ZodRealError),safeEncodeAsync=_safeEncodeAsync(ZodRealError),safeDecodeAsync=_safeDecodeAsync(ZodRealError);var schemas_exports=__exportAll({ZodAny:()=>ZodAny$1,ZodArray:()=>ZodArray$1,ZodBase64:()=>ZodBase64,ZodBase64URL:()=>ZodBase64URL,ZodBigInt:()=>ZodBigInt$1,ZodBigIntFormat:()=>ZodBigIntFormat,ZodBoolean:()=>ZodBoolean$1,ZodCIDRv4:()=>ZodCIDRv4,ZodCIDRv6:()=>ZodCIDRv6,ZodCUID:()=>ZodCUID,ZodCUID2:()=>ZodCUID2,ZodCatch:()=>ZodCatch$1,ZodCodec:()=>ZodCodec,ZodCustom:()=>ZodCustom,ZodCustomStringFormat:()=>ZodCustomStringFormat,ZodDate:()=>ZodDate$1,ZodDefault:()=>ZodDefault$1,ZodDiscriminatedUnion:()=>ZodDiscriminatedUnion$1,ZodE164:()=>ZodE164,ZodEmail:()=>ZodEmail,ZodEmoji:()=>ZodEmoji,ZodEnum:()=>ZodEnum$1,ZodExactOptional:()=>ZodExactOptional,ZodFile:()=>ZodFile,ZodFunction:()=>ZodFunction$1,ZodGUID:()=>ZodGUID,ZodIPv4:()=>ZodIPv4,ZodIPv6:()=>ZodIPv6,ZodIntersection:()=>ZodIntersection$1,ZodJWT:()=>ZodJWT,ZodKSUID:()=>ZodKSUID,ZodLazy:()=>ZodLazy$1,ZodLiteral:()=>ZodLiteral$1,ZodMAC:()=>ZodMAC,ZodMap:()=>ZodMap$1,ZodNaN:()=>ZodNaN$1,ZodNanoID:()=>ZodNanoID,ZodNever:()=>ZodNever$1,ZodNonOptional:()=>ZodNonOptional,ZodNull:()=>ZodNull$1,ZodNullable:()=>ZodNullable$1,ZodNumber:()=>ZodNumber$1,ZodNumberFormat:()=>ZodNumberFormat,ZodObject:()=>ZodObject$1,ZodOptional:()=>ZodOptional$1,ZodPipe:()=>ZodPipe,ZodPrefault:()=>ZodPrefault,ZodPromise:()=>ZodPromise$1,ZodReadonly:()=>ZodReadonly$1,ZodRecord:()=>ZodRecord$1,ZodSet:()=>ZodSet$1,ZodString:()=>ZodString$1,ZodStringFormat:()=>ZodStringFormat,ZodSuccess:()=>ZodSuccess,ZodSymbol:()=>ZodSymbol$1,ZodTemplateLiteral:()=>ZodTemplateLiteral,ZodTransform:()=>ZodTransform,ZodTuple:()=>ZodTuple$1,ZodType:()=>ZodType$1,ZodULID:()=>ZodULID,ZodURL:()=>ZodURL,ZodUUID:()=>ZodUUID,ZodUndefined:()=>ZodUndefined$1,ZodUnion:()=>ZodUnion$1,ZodUnknown:()=>ZodUnknown$1,ZodVoid:()=>ZodVoid$1,ZodXID:()=>ZodXID,ZodXor:()=>ZodXor,_ZodString:()=>_ZodString,_default:()=>_default$1,_function:()=>_function$1,any:()=>any$1,array:()=>array$1,base64:()=>base64$1,base64url:()=>base64url$1,bigint:()=>bigint$3,boolean:()=>boolean$3,catch:()=>_catch$1,check:()=>check$1,cidrv4:()=>cidrv4$1,cidrv6:()=>cidrv6$1,codec:()=>codec$1,cuid:()=>cuid$1,cuid2:()=>cuid2$1,custom:()=>custom$2,date:()=>date$4,describe:()=>describe$1,discriminatedUnion:()=>discriminatedUnion$1,e164:()=>e164$1,email:()=>email$1,emoji:()=>emoji$1,enum:()=>_enum$1,exactOptional:()=>exactOptional$1,file:()=>file$1,float32:()=>float32$1,float64:()=>float64$1,function:()=>_function$1,guid:()=>guid$1,hash:()=>hash$1,hex:()=>hex$1,hostname:()=>hostname$1,httpUrl:()=>httpUrl$1,instanceof:()=>_instanceof$1,int:()=>int$1,int32:()=>int32$1,int64:()=>int64$1,intersection:()=>intersection$1,ipv4:()=>ipv4$1,ipv6:()=>ipv6$1,json:()=>json$1,jwt:()=>jwt$1,keyof:()=>keyof$1,ksuid:()=>ksuid$1,lazy:()=>lazy,literal:()=>literal$1,looseObject:()=>looseObject$1,looseRecord:()=>looseRecord$1,mac:()=>mac$1,map:()=>map$1,meta:()=>meta$1,nan:()=>nan$1,nanoid:()=>nanoid$1,nativeEnum:()=>nativeEnum$1,never:()=>never$1,nonoptional:()=>nonoptional$1,null:()=>_null$1,nullable:()=>nullable$1,nullish:()=>nullish$1,number:()=>number$3,object:()=>object$1,optional:()=>optional$1,partialRecord:()=>partialRecord$1,pipe:()=>pipe$1,prefault:()=>prefault$1,preprocess:()=>preprocess,promise:()=>promise$1,readonly:()=>readonly$1,record:()=>record$1,refine:()=>refine$1,set:()=>set$1,strictObject:()=>strictObject$1,string:()=>string$3,stringFormat:()=>stringFormat$1,stringbool:()=>stringbool$1,success:()=>success$1,superRefine:()=>superRefine$1,symbol:()=>symbol$1,templateLiteral:()=>templateLiteral$1,transform:()=>transform$1,tuple:()=>tuple$1,uint32:()=>uint32$1,uint64:()=>uint64$1,ulid:()=>ulid$1,undefined:()=>_undefined$1,union:()=>union$1,unknown:()=>unknown$1,url:()=>url$1,uuid:()=>uuid$1,uuidv4:()=>uuidv4$1,uuidv6:()=>uuidv6$1,uuidv7:()=>uuidv7$1,void:()=>_void$1,xid:()=>xid$1,xor:()=>xor$1});const ZodType$1=$constructor(`ZodType`,(e,t)=>($ZodType.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:createStandardJSONSchemaMethod(e,`input`),output:createStandardJSONSchemaMethod(e,`output`)}}),e.toJSONSchema=createToJSONSchemaMethod(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(mergeDefs(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>clone(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>parse$2(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>safeParse$1(e,t,n),e.parseAsync=async(t,n)=>parseAsync(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>safeParseAsync$1(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>encode(e,t,n),e.decode=(t,n)=>decode(e,t,n),e.encodeAsync=async(t,n)=>encodeAsync(e,t,n),e.decodeAsync=async(t,n)=>decodeAsync(e,t,n),e.safeEncode=(t,n)=>safeEncode(e,t,n),e.safeDecode=(t,n)=>safeDecode(e,t,n),e.safeEncodeAsync=async(t,n)=>safeEncodeAsync(e,t,n),e.safeDecodeAsync=async(t,n)=>safeDecodeAsync(e,t,n),e.refine=(t,n)=>e.check(refine$1(t,n)),e.superRefine=t=>e.check(superRefine$1(t)),e.overwrite=t=>e.check(_overwrite(t)),e.optional=()=>optional$1(e),e.exactOptional=()=>exactOptional$1(e),e.nullable=()=>nullable$1(e),e.nullish=()=>optional$1(nullable$1(e)),e.nonoptional=t=>nonoptional$1(e,t),e.array=()=>array$1(e),e.or=t=>union$1([e,t]),e.and=t=>intersection$1(e,t),e.transform=t=>pipe$1(e,transform$1(t)),e.default=t=>_default$1(e,t),e.prefault=t=>prefault$1(e,t),e.catch=t=>_catch$1(e,t),e.pipe=t=>pipe$1(e,t),e.readonly=()=>readonly$1(e),e.describe=t=>{let n=e.clone();return globalRegistry.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return globalRegistry.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return globalRegistry.get(e);let n=e.clone();return globalRegistry.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),_ZodString=$constructor(`_ZodString`,(e,t)=>{$ZodString.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>stringProcessor(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_regex(...t)),e.includes=(...t)=>e.check(_includes(...t)),e.startsWith=(...t)=>e.check(_startsWith(...t)),e.endsWith=(...t)=>e.check(_endsWith(...t)),e.min=(...t)=>e.check(_minLength(...t)),e.max=(...t)=>e.check(_maxLength(...t)),e.length=(...t)=>e.check(_length(...t)),e.nonempty=(...t)=>e.check(_minLength(1,...t)),e.lowercase=t=>e.check(_lowercase(t)),e.uppercase=t=>e.check(_uppercase(t)),e.trim=()=>e.check(_trim()),e.normalize=(...t)=>e.check(_normalize(...t)),e.toLowerCase=()=>e.check(_toLowerCase()),e.toUpperCase=()=>e.check(_toUpperCase()),e.slugify=()=>e.check(_slugify())}),ZodString$1=$constructor(`ZodString`,(e,t)=>{$ZodString.init(e,t),_ZodString.init(e,t),e.email=t=>e.check(_email(ZodEmail,t)),e.url=t=>e.check(_url$1(ZodURL,t)),e.jwt=t=>e.check(_jwt(ZodJWT,t)),e.emoji=t=>e.check(_emoji(ZodEmoji,t)),e.guid=t=>e.check(_guid(ZodGUID,t)),e.uuid=t=>e.check(_uuid(ZodUUID,t)),e.uuidv4=t=>e.check(_uuidv4(ZodUUID,t)),e.uuidv6=t=>e.check(_uuidv6(ZodUUID,t)),e.uuidv7=t=>e.check(_uuidv7(ZodUUID,t)),e.nanoid=t=>e.check(_nanoid(ZodNanoID,t)),e.guid=t=>e.check(_guid(ZodGUID,t)),e.cuid=t=>e.check(_cuid(ZodCUID,t)),e.cuid2=t=>e.check(_cuid2(ZodCUID2,t)),e.ulid=t=>e.check(_ulid(ZodULID,t)),e.base64=t=>e.check(_base64(ZodBase64,t)),e.base64url=t=>e.check(_base64url(ZodBase64URL,t)),e.xid=t=>e.check(_xid(ZodXID,t)),e.ksuid=t=>e.check(_ksuid(ZodKSUID,t)),e.ipv4=t=>e.check(_ipv4(ZodIPv4,t)),e.ipv6=t=>e.check(_ipv6(ZodIPv6,t)),e.cidrv4=t=>e.check(_cidrv4(ZodCIDRv4,t)),e.cidrv6=t=>e.check(_cidrv6(ZodCIDRv6,t)),e.e164=t=>e.check(_e164(ZodE164,t)),e.datetime=t=>e.check(datetime$1(t)),e.date=t=>e.check(date$5(t)),e.time=t=>e.check(time$1(t)),e.duration=t=>e.check(duration$1(t))});function string$3(e){return _string(ZodString$1,e)}const ZodStringFormat=$constructor(`ZodStringFormat`,(e,t)=>{$ZodStringFormat.init(e,t),_ZodString.init(e,t)}),ZodEmail=$constructor(`ZodEmail`,(e,t)=>{$ZodEmail.init(e,t),ZodStringFormat.init(e,t)});function email$1(e){return _email(ZodEmail,e)}const ZodGUID=$constructor(`ZodGUID`,(e,t)=>{$ZodGUID.init(e,t),ZodStringFormat.init(e,t)});function guid$1(e){return _guid(ZodGUID,e)}const ZodUUID=$constructor(`ZodUUID`,(e,t)=>{$ZodUUID.init(e,t),ZodStringFormat.init(e,t)});function uuid$1(e){return _uuid(ZodUUID,e)}function uuidv4$1(e){return _uuidv4(ZodUUID,e)}function uuidv6$1(e){return _uuidv6(ZodUUID,e)}function uuidv7$1(e){return _uuidv7(ZodUUID,e)}const ZodURL=$constructor(`ZodURL`,(e,t)=>{$ZodURL.init(e,t),ZodStringFormat.init(e,t)});function url$1(e){return _url$1(ZodURL,e)}function httpUrl$1(e){return _url$1(ZodURL,{protocol:/^https?$/,hostname:domain,...normalizeParams(e)})}const ZodEmoji=$constructor(`ZodEmoji`,(e,t)=>{$ZodEmoji.init(e,t),ZodStringFormat.init(e,t)});function emoji$1(e){return _emoji(ZodEmoji,e)}const ZodNanoID=$constructor(`ZodNanoID`,(e,t)=>{$ZodNanoID.init(e,t),ZodStringFormat.init(e,t)});function nanoid$1(e){return _nanoid(ZodNanoID,e)}const ZodCUID=$constructor(`ZodCUID`,(e,t)=>{$ZodCUID.init(e,t),ZodStringFormat.init(e,t)});function cuid$1(e){return _cuid(ZodCUID,e)}const ZodCUID2=$constructor(`ZodCUID2`,(e,t)=>{$ZodCUID2.init(e,t),ZodStringFormat.init(e,t)});function cuid2$1(e){return _cuid2(ZodCUID2,e)}const ZodULID=$constructor(`ZodULID`,(e,t)=>{$ZodULID.init(e,t),ZodStringFormat.init(e,t)});function ulid$1(e){return _ulid(ZodULID,e)}const ZodXID=$constructor(`ZodXID`,(e,t)=>{$ZodXID.init(e,t),ZodStringFormat.init(e,t)});function xid$1(e){return _xid(ZodXID,e)}const ZodKSUID=$constructor(`ZodKSUID`,(e,t)=>{$ZodKSUID.init(e,t),ZodStringFormat.init(e,t)});function ksuid$1(e){return _ksuid(ZodKSUID,e)}const ZodIPv4=$constructor(`ZodIPv4`,(e,t)=>{$ZodIPv4.init(e,t),ZodStringFormat.init(e,t)});function ipv4$1(e){return _ipv4(ZodIPv4,e)}const ZodMAC=$constructor(`ZodMAC`,(e,t)=>{$ZodMAC.init(e,t),ZodStringFormat.init(e,t)});function mac$1(e){return _mac(ZodMAC,e)}const ZodIPv6=$constructor(`ZodIPv6`,(e,t)=>{$ZodIPv6.init(e,t),ZodStringFormat.init(e,t)});function ipv6$1(e){return _ipv6(ZodIPv6,e)}const ZodCIDRv4=$constructor(`ZodCIDRv4`,(e,t)=>{$ZodCIDRv4.init(e,t),ZodStringFormat.init(e,t)});function cidrv4$1(e){return _cidrv4(ZodCIDRv4,e)}const ZodCIDRv6=$constructor(`ZodCIDRv6`,(e,t)=>{$ZodCIDRv6.init(e,t),ZodStringFormat.init(e,t)});function cidrv6$1(e){return _cidrv6(ZodCIDRv6,e)}const ZodBase64=$constructor(`ZodBase64`,(e,t)=>{$ZodBase64.init(e,t),ZodStringFormat.init(e,t)});function base64$1(e){return _base64(ZodBase64,e)}const ZodBase64URL=$constructor(`ZodBase64URL`,(e,t)=>{$ZodBase64URL.init(e,t),ZodStringFormat.init(e,t)});function base64url$1(e){return _base64url(ZodBase64URL,e)}const ZodE164=$constructor(`ZodE164`,(e,t)=>{$ZodE164.init(e,t),ZodStringFormat.init(e,t)});function e164$1(e){return _e164(ZodE164,e)}const ZodJWT=$constructor(`ZodJWT`,(e,t)=>{$ZodJWT.init(e,t),ZodStringFormat.init(e,t)});function jwt$1(e){return _jwt(ZodJWT,e)}const ZodCustomStringFormat=$constructor(`ZodCustomStringFormat`,(e,t)=>{$ZodCustomStringFormat.init(e,t),ZodStringFormat.init(e,t)});function stringFormat$1(e,t,n={}){return _stringFormat(ZodCustomStringFormat,e,t,n)}function hostname$1(e){return _stringFormat(ZodCustomStringFormat,`hostname`,hostname$2,e)}function hex$1(e){return _stringFormat(ZodCustomStringFormat,`hex`,hex$2,e)}function hash$1(e,t){let n=`${e}_${t?.enc??`hex`}`,r=regexes_exports[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return _stringFormat(ZodCustomStringFormat,n,r,t)}const ZodNumber$1=$constructor(`ZodNumber`,(e,t)=>{$ZodNumber.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>numberProcessor(e,t,n,r),e.gt=(t,n)=>e.check(_gt(t,n)),e.gte=(t,n)=>e.check(_gte(t,n)),e.min=(t,n)=>e.check(_gte(t,n)),e.lt=(t,n)=>e.check(_lt(t,n)),e.lte=(t,n)=>e.check(_lte(t,n)),e.max=(t,n)=>e.check(_lte(t,n)),e.int=t=>e.check(int$1(t)),e.safe=t=>e.check(int$1(t)),e.positive=t=>e.check(_gt(0,t)),e.nonnegative=t=>e.check(_gte(0,t)),e.negative=t=>e.check(_lt(0,t)),e.nonpositive=t=>e.check(_lte(0,t)),e.multipleOf=(t,n)=>e.check(_multipleOf(t,n)),e.step=(t,n)=>e.check(_multipleOf(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function number$3(e){return _number(ZodNumber$1,e)}const ZodNumberFormat=$constructor(`ZodNumberFormat`,(e,t)=>{$ZodNumberFormat.init(e,t),ZodNumber$1.init(e,t)});function int$1(e){return _int(ZodNumberFormat,e)}function float32$1(e){return _float32(ZodNumberFormat,e)}function float64$1(e){return _float64(ZodNumberFormat,e)}function int32$1(e){return _int32(ZodNumberFormat,e)}function uint32$1(e){return _uint32(ZodNumberFormat,e)}const ZodBoolean$1=$constructor(`ZodBoolean`,(e,t)=>{$ZodBoolean.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>booleanProcessor(e,t,n,r)});function boolean$3(e){return _boolean(ZodBoolean$1,e)}const ZodBigInt$1=$constructor(`ZodBigInt`,(e,t)=>{$ZodBigInt.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bigintProcessor(e,t,n,r),e.gte=(t,n)=>e.check(_gte(t,n)),e.min=(t,n)=>e.check(_gte(t,n)),e.gt=(t,n)=>e.check(_gt(t,n)),e.gte=(t,n)=>e.check(_gte(t,n)),e.min=(t,n)=>e.check(_gte(t,n)),e.lt=(t,n)=>e.check(_lt(t,n)),e.lte=(t,n)=>e.check(_lte(t,n)),e.max=(t,n)=>e.check(_lte(t,n)),e.positive=t=>e.check(_gt(BigInt(0),t)),e.negative=t=>e.check(_lt(BigInt(0),t)),e.nonpositive=t=>e.check(_lte(BigInt(0),t)),e.nonnegative=t=>e.check(_gte(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(_multipleOf(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function bigint$3(e){return _bigint(ZodBigInt$1,e)}const ZodBigIntFormat=$constructor(`ZodBigIntFormat`,(e,t)=>{$ZodBigIntFormat.init(e,t),ZodBigInt$1.init(e,t)});function int64$1(e){return _int64(ZodBigIntFormat,e)}function uint64$1(e){return _uint64(ZodBigIntFormat,e)}const ZodSymbol$1=$constructor(`ZodSymbol`,(e,t)=>{$ZodSymbol.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>symbolProcessor(e,t,n,r)});function symbol$1(e){return _symbol(ZodSymbol$1,e)}const ZodUndefined$1=$constructor(`ZodUndefined`,(e,t)=>{$ZodUndefined.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>undefinedProcessor(e,t,n,r)});function _undefined$1(e){return _undefined$2(ZodUndefined$1,e)}const ZodNull$1=$constructor(`ZodNull`,(e,t)=>{$ZodNull.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nullProcessor(e,t,n,r)});function _null$1(e){return _null$2(ZodNull$1,e)}const ZodAny$1=$constructor(`ZodAny`,(e,t)=>{$ZodAny.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function any$1(){return _any(ZodAny$1)}const ZodUnknown$1=$constructor(`ZodUnknown`,(e,t)=>{$ZodUnknown.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function unknown$1(){return _unknown(ZodUnknown$1)}const ZodNever$1=$constructor(`ZodNever`,(e,t)=>{$ZodNever.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>neverProcessor(e,t,n,r)});function never$1(e){return _never(ZodNever$1,e)}const ZodVoid$1=$constructor(`ZodVoid`,(e,t)=>{$ZodVoid.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>voidProcessor(e,t,n,r)});function _void$1(e){return _void$2(ZodVoid$1,e)}const ZodDate$1=$constructor(`ZodDate`,(e,t)=>{$ZodDate.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dateProcessor(e,t,n,r),e.min=(t,n)=>e.check(_gte(t,n)),e.max=(t,n)=>e.check(_lte(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function date$4(e){return _date(ZodDate$1,e)}const ZodArray$1=$constructor(`ZodArray`,(e,t)=>{$ZodArray.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>arrayProcessor(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(_minLength(t,n)),e.nonempty=t=>e.check(_minLength(1,t)),e.max=(t,n)=>e.check(_maxLength(t,n)),e.length=(t,n)=>e.check(_length(t,n)),e.unwrap=()=>e.element});function array$1(e,t){return _array(ZodArray$1,e,t)}function keyof$1(e){let t=e._zod.def.shape;return _enum$1(Object.keys(t))}const ZodObject$1=$constructor(`ZodObject`,(e,t)=>{$ZodObjectJIT.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>objectProcessor(e,t,n,r),defineLazy(e,`shape`,()=>t.shape),e.keyof=()=>_enum$1(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:unknown$1()}),e.loose=()=>e.clone({...e._zod.def,catchall:unknown$1()}),e.strict=()=>e.clone({...e._zod.def,catchall:never$1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>extend$1(e,t),e.safeExtend=t=>safeExtend$1(e,t),e.merge=t=>merge$1(e,t),e.pick=t=>pick$1(e,t),e.omit=t=>omit$1(e,t),e.partial=(...t)=>partial$1(ZodOptional$1,e,t[0]),e.required=(...t)=>required$1(ZodNonOptional,e,t[0])});function object$1(e,t){return new ZodObject$1({type:`object`,shape:e??{},...normalizeParams(t)})}function strictObject$1(e,t){return new ZodObject$1({type:`object`,shape:e,catchall:never$1(),...normalizeParams(t)})}function looseObject$1(e,t){return new ZodObject$1({type:`object`,shape:e,catchall:unknown$1(),...normalizeParams(t)})}const ZodUnion$1=$constructor(`ZodUnion`,(e,t)=>{$ZodUnion.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>unionProcessor(e,t,n,r),e.options=t.options});function union$1(e,t){return new ZodUnion$1({type:`union`,options:e,...normalizeParams(t)})}const ZodXor=$constructor(`ZodXor`,(e,t)=>{ZodUnion$1.init(e,t),$ZodXor.init(e,t),e._zod.processJSONSchema=(t,n,r)=>unionProcessor(e,t,n,r),e.options=t.options});function xor$1(e,t){return new ZodXor({type:`union`,options:e,inclusive:!1,...normalizeParams(t)})}const ZodDiscriminatedUnion$1=$constructor(`ZodDiscriminatedUnion`,(e,t)=>{ZodUnion$1.init(e,t),$ZodDiscriminatedUnion.init(e,t)});function discriminatedUnion$1(e,t,n){return new ZodDiscriminatedUnion$1({type:`union`,options:t,discriminator:e,...normalizeParams(n)})}const ZodIntersection$1=$constructor(`ZodIntersection`,(e,t)=>{$ZodIntersection.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>intersectionProcessor(e,t,n,r)});function intersection$1(e,t){return new ZodIntersection$1({type:`intersection`,left:e,right:t})}const ZodTuple$1=$constructor(`ZodTuple`,(e,t)=>{$ZodTuple.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tupleProcessor(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function tuple$1(e,t,n){let r=t instanceof $ZodType;return new ZodTuple$1({type:`tuple`,items:e,rest:r?t:null,...normalizeParams(r?n:t)})}const ZodRecord$1=$constructor(`ZodRecord`,(e,t)=>{$ZodRecord.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>recordProcessor(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function record$1(e,t,n){return new ZodRecord$1({type:`record`,keyType:e,valueType:t,...normalizeParams(n)})}function partialRecord$1(e,t,n){let r=clone(e);return r._zod.values=void 0,new ZodRecord$1({type:`record`,keyType:r,valueType:t,...normalizeParams(n)})}function looseRecord$1(e,t,n){return new ZodRecord$1({type:`record`,keyType:e,valueType:t,mode:`loose`,...normalizeParams(n)})}const ZodMap$1=$constructor(`ZodMap`,(e,t)=>{$ZodMap.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mapProcessor(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(_minSize(...t)),e.nonempty=t=>e.check(_minSize(1,t)),e.max=(...t)=>e.check(_maxSize(...t)),e.size=(...t)=>e.check(_size(...t))});function map$1(e,t,n){return new ZodMap$1({type:`map`,keyType:e,valueType:t,...normalizeParams(n)})}const ZodSet$1=$constructor(`ZodSet`,(e,t)=>{$ZodSet.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>setProcessor(e,t,n,r),e.min=(...t)=>e.check(_minSize(...t)),e.nonempty=t=>e.check(_minSize(1,t)),e.max=(...t)=>e.check(_maxSize(...t)),e.size=(...t)=>e.check(_size(...t))});function set$1(e,t){return new ZodSet$1({type:`set`,valueType:e,...normalizeParams(t)})}const ZodEnum$1=$constructor(`ZodEnum`,(e,t)=>{$ZodEnum.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>enumProcessor(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ZodEnum$1({...t,checks:[],...normalizeParams(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ZodEnum$1({...t,checks:[],...normalizeParams(r),entries:i})}});function _enum$1(e,t){return new ZodEnum$1({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...normalizeParams(t)})}function nativeEnum$1(e,t){return new ZodEnum$1({type:`enum`,entries:e,...normalizeParams(t)})}const ZodLiteral$1=$constructor(`ZodLiteral`,(e,t)=>{$ZodLiteral.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>literalProcessor(e,t,n,r),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 literal$1(e,t){return new ZodLiteral$1({type:`literal`,values:Array.isArray(e)?e:[e],...normalizeParams(t)})}const ZodFile=$constructor(`ZodFile`,(e,t)=>{$ZodFile.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fileProcessor(e,t,n,r),e.min=(t,n)=>e.check(_minSize(t,n)),e.max=(t,n)=>e.check(_maxSize(t,n)),e.mime=(t,n)=>e.check(_mime(Array.isArray(t)?t:[t],n))});function file$1(e){return _file(ZodFile,e)}const ZodTransform=$constructor(`ZodTransform`,(e,t)=>{$ZodTransform.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>transformProcessor(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $ZodEncodeError(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(issue(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(issue(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function transform$1(e){return new ZodTransform({type:`transform`,transform:e})}const ZodOptional$1=$constructor(`ZodOptional`,(e,t)=>{$ZodOptional.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>optionalProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function optional$1(e){return new ZodOptional$1({type:`optional`,innerType:e})}const ZodExactOptional=$constructor(`ZodExactOptional`,(e,t)=>{$ZodExactOptional.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>optionalProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function exactOptional$1(e){return new ZodExactOptional({type:`optional`,innerType:e})}const ZodNullable$1=$constructor(`ZodNullable`,(e,t)=>{$ZodNullable.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nullableProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nullable$1(e){return new ZodNullable$1({type:`nullable`,innerType:e})}function nullish$1(e){return optional$1(nullable$1(e))}const ZodDefault$1=$constructor(`ZodDefault`,(e,t)=>{$ZodDefault.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>defaultProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _default$1(e,t){return new ZodDefault$1({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():shallowClone(t)}})}const ZodPrefault=$constructor(`ZodPrefault`,(e,t)=>{$ZodPrefault.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>prefaultProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function prefault$1(e,t){return new ZodPrefault({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():shallowClone(t)}})}const ZodNonOptional=$constructor(`ZodNonOptional`,(e,t)=>{$ZodNonOptional.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nonoptionalProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nonoptional$1(e,t){return new ZodNonOptional({type:`nonoptional`,innerType:e,...normalizeParams(t)})}const ZodSuccess=$constructor(`ZodSuccess`,(e,t)=>{$ZodSuccess.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>successProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function success$1(e){return new ZodSuccess({type:`success`,innerType:e})}const ZodCatch$1=$constructor(`ZodCatch`,(e,t)=>{$ZodCatch.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>catchProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _catch$1(e,t){return new ZodCatch$1({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const ZodNaN$1=$constructor(`ZodNaN`,(e,t)=>{$ZodNaN.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nanProcessor(e,t,n,r)});function nan$1(e){return _nan(ZodNaN$1,e)}const ZodPipe=$constructor(`ZodPipe`,(e,t)=>{$ZodPipe.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pipeProcessor(e,t,n,r),e.in=t.in,e.out=t.out});function pipe$1(e,t){return new ZodPipe({type:`pipe`,in:e,out:t})}const ZodCodec=$constructor(`ZodCodec`,(e,t)=>{ZodPipe.init(e,t),$ZodCodec.init(e,t)});function codec$1(e,t,n){return new ZodCodec({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const ZodReadonly$1=$constructor(`ZodReadonly`,(e,t)=>{$ZodReadonly.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>readonlyProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function readonly$1(e){return new ZodReadonly$1({type:`readonly`,innerType:e})}const ZodTemplateLiteral=$constructor(`ZodTemplateLiteral`,(e,t)=>{$ZodTemplateLiteral.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>templateLiteralProcessor(e,t,n,r)});function templateLiteral$1(e,t){return new ZodTemplateLiteral({type:`template_literal`,parts:e,...normalizeParams(t)})}const ZodLazy$1=$constructor(`ZodLazy`,(e,t)=>{$ZodLazy.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lazyProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function lazy(e){return new ZodLazy$1({type:`lazy`,getter:e})}const ZodPromise$1=$constructor(`ZodPromise`,(e,t)=>{$ZodPromise.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>promiseProcessor(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function promise$1(e){return new ZodPromise$1({type:`promise`,innerType:e})}const ZodFunction$1=$constructor(`ZodFunction`,(e,t)=>{$ZodFunction.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>functionProcessor(e,t,n,r)});function _function$1(e){return new ZodFunction$1({type:`function`,input:Array.isArray(e?.input)?tuple$1(e?.input):e?.input??array$1(unknown$1()),output:e?.output??unknown$1()})}const ZodCustom=$constructor(`ZodCustom`,(e,t)=>{$ZodCustom.init(e,t),ZodType$1.init(e,t),e._zod.processJSONSchema=(t,n,r)=>customProcessor(e,t,n,r)});function check$1(e){let t=new $ZodCheck({check:`custom`});return t._zod.check=e,t}function custom$2(e,t){return _custom(ZodCustom,e??(()=>!0),t)}function refine$1(e,t={}){return _refine(ZodCustom,e,t)}function superRefine$1(e){return _superRefine(e)}const describe$1=describe$2,meta$1=meta$2;function _instanceof$1(e,t={}){let n=new ZodCustom({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const stringbool$1=(...e)=>_stringbool({Codec:ZodCodec,Boolean:ZodBoolean$1,String:ZodString$1},...e);function json$1(e){let t=lazy(()=>union$1([string$3(e),number$3(),boolean$3(),_null$1(),array$1(t),record$1(string$3(),t)]));return t}function preprocess(e,t){return pipe$1(transform$1(e),t)}const ZodIssueCode$1={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function setErrorMap$1(e){config({customError:e})}function getErrorMap$1(){return config().customError}var ZodFirstPartyTypeKind$1;(function(e){})(ZodFirstPartyTypeKind$1||={});const z={...schemas_exports,...checks_exports,iso:iso_exports$1},RECOGNIZED_KEYS=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function detectVersion(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function resolveRef(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function convertBaseSchema(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return z.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return z.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=convertSchema(resolveRef(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return z.null();if(n.length===0)return z.never();if(n.length===1)return z.literal(n[0]);if(n.every(e=>typeof e==`string`))return z.enum(n);let r=n.map(e=>z.literal(e));return r.length<2?r[0]:z.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return z.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>convertBaseSchema({...e,type:n},t));return r.length===0?z.never():r.length===1?r[0]:z.union(r)}if(!n)return z.any();let r;switch(n){case`string`:{let t=z.string();if(e.format){let n=e.format;n===`email`?t=t.check(z.email()):n===`uri`||n===`uri-reference`?t=t.check(z.url()):n===`uuid`||n===`guid`?t=t.check(z.uuid()):n===`date-time`?t=t.check(z.iso.datetime()):n===`date`?t=t.check(z.iso.date()):n===`time`?t=t.check(z.iso.time()):n===`duration`?t=t.check(z.iso.duration()):n===`ipv4`?t=t.check(z.ipv4()):n===`ipv6`?t=t.check(z.ipv6()):n===`mac`?t=t.check(z.mac()):n===`cidr`?t=t.check(z.cidrv4()):n===`cidr-v6`?t=t.check(z.cidrv6()):n===`base64`?t=t.check(z.base64()):n===`base64url`?t=t.check(z.base64url()):n===`e164`?t=t.check(z.e164()):n===`jwt`?t=t.check(z.jwt()):n===`emoji`?t=t.check(z.emoji()):n===`nanoid`?t=t.check(z.nanoid()):n===`cuid`?t=t.check(z.cuid()):n===`cuid2`?t=t.check(z.cuid2()):n===`ulid`?t=t.check(z.ulid()):n===`xid`?t=t.check(z.xid()):n===`ksuid`&&(t=t.check(z.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?z.number().int():z.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=z.boolean();break;case`null`:r=z.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=convertSchema(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=convertSchema(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?convertSchema(e.additionalProperties,t):z.any();if(Object.keys(n).length===0){r=z.record(i,a);break}let o=z.object(n).passthrough(),s=z.looseRecord(i,a);r=z.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=convertSchema(i[e],t),r=z.string().regex(new RegExp(e));o.push(z.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(z.object(n).passthrough()),s.push(...o),s.length===0)r=z.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=z.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=z.intersection(e,s[t]);r=e}break}let o=z.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(convertSchema(e.additionalProperties,t)):o.passthrough();break}case`array`:{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(e=>convertSchema(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?convertSchema(i,t):void 0;r=o?z.tuple(a).rest(o):z.tuple(a),typeof e.minItems==`number`&&(r=r.check(z.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(z.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>convertSchema(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?convertSchema(e.additionalItems,t):void 0;r=a?z.tuple(n).rest(a):z.tuple(n),typeof e.minItems==`number`&&(r=r.check(z.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(z.maxLength(e.maxItems)))}else if(i!==void 0){let n=convertSchema(i,t),a=z.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=z.array(z.any());break}default:throw Error(`Unsupported type: ${n}`)}return e.description&&(r=r.describe(e.description)),e.default!==void 0&&(r=r.default(e.default)),r}function convertSchema(e,t){if(typeof e==`boolean`)return e?z.any():z.never();let n=convertBaseSchema(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>convertSchema(e,t)),a=z.union(i);n=r?z.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>convertSchema(e,t)),a=z.xor(i);n=r?z.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:z.any();else{let i=r?n:convertSchema(e.allOf[0],t),a=r?0:1;for(let n=a;n<e.allOf.length;n++)i=z.intersection(i,convertSchema(e.allOf[n],t));n=i}e.nullable===!0&&t.version===`openapi-3.0`&&(n=z.nullable(n)),e.readOnly===!0&&(n=z.readonly(n));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))RECOGNIZED_KEYS.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),n}function fromJSONSchema(e,t){return typeof e==`boolean`?e?z.any():z.never():convertSchema(e,{version:detectVersion(e,t?.defaultTarget),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??globalRegistry})}var coerce_exports$1=__exportAll({bigint:()=>bigint$2,boolean:()=>boolean$2,date:()=>date$3,number:()=>number$2,string:()=>string$2});function string$2(e){return _coercedString(ZodString$1,e)}function number$2(e){return _coercedNumber(ZodNumber$1,e)}function boolean$2(e){return _coercedBoolean(ZodBoolean$1,e)}function bigint$2(e){return _coercedBigint(ZodBigInt$1,e)}function date$3(e){return _coercedDate(ZodDate$1,e)}var external_exports$2=__exportAll({$brand:()=>$brand,$input:()=>$input,$output:()=>$output,NEVER:()=>NEVER$1,TimePrecision:()=>TimePrecision,ZodAny:()=>ZodAny$1,ZodArray:()=>ZodArray$1,ZodBase64:()=>ZodBase64,ZodBase64URL:()=>ZodBase64URL,ZodBigInt:()=>ZodBigInt$1,ZodBigIntFormat:()=>ZodBigIntFormat,ZodBoolean:()=>ZodBoolean$1,ZodCIDRv4:()=>ZodCIDRv4,ZodCIDRv6:()=>ZodCIDRv6,ZodCUID:()=>ZodCUID,ZodCUID2:()=>ZodCUID2,ZodCatch:()=>ZodCatch$1,ZodCodec:()=>ZodCodec,ZodCustom:()=>ZodCustom,ZodCustomStringFormat:()=>ZodCustomStringFormat,ZodDate:()=>ZodDate$1,ZodDefault:()=>ZodDefault$1,ZodDiscriminatedUnion:()=>ZodDiscriminatedUnion$1,ZodE164:()=>ZodE164,ZodEmail:()=>ZodEmail,ZodEmoji:()=>ZodEmoji,ZodEnum:()=>ZodEnum$1,ZodError:()=>ZodError$1,ZodExactOptional:()=>ZodExactOptional,ZodFile:()=>ZodFile,ZodFirstPartyTypeKind:()=>ZodFirstPartyTypeKind$1,ZodFunction:()=>ZodFunction$1,ZodGUID:()=>ZodGUID,ZodIPv4:()=>ZodIPv4,ZodIPv6:()=>ZodIPv6,ZodISODate:()=>ZodISODate,ZodISODateTime:()=>ZodISODateTime,ZodISODuration:()=>ZodISODuration,ZodISOTime:()=>ZodISOTime,ZodIntersection:()=>ZodIntersection$1,ZodIssueCode:()=>ZodIssueCode$1,ZodJWT:()=>ZodJWT,ZodKSUID:()=>ZodKSUID,ZodLazy:()=>ZodLazy$1,ZodLiteral:()=>ZodLiteral$1,ZodMAC:()=>ZodMAC,ZodMap:()=>ZodMap$1,ZodNaN:()=>ZodNaN$1,ZodNanoID:()=>ZodNanoID,ZodNever:()=>ZodNever$1,ZodNonOptional:()=>ZodNonOptional,ZodNull:()=>ZodNull$1,ZodNullable:()=>ZodNullable$1,ZodNumber:()=>ZodNumber$1,ZodNumberFormat:()=>ZodNumberFormat,ZodObject:()=>ZodObject$1,ZodOptional:()=>ZodOptional$1,ZodPipe:()=>ZodPipe,ZodPrefault:()=>ZodPrefault,ZodPromise:()=>ZodPromise$1,ZodReadonly:()=>ZodReadonly$1,ZodRealError:()=>ZodRealError,ZodRecord:()=>ZodRecord$1,ZodSet:()=>ZodSet$1,ZodString:()=>ZodString$1,ZodStringFormat:()=>ZodStringFormat,ZodSuccess:()=>ZodSuccess,ZodSymbol:()=>ZodSymbol$1,ZodTemplateLiteral:()=>ZodTemplateLiteral,ZodTransform:()=>ZodTransform,ZodTuple:()=>ZodTuple$1,ZodType:()=>ZodType$1,ZodULID:()=>ZodULID,ZodURL:()=>ZodURL,ZodUUID:()=>ZodUUID,ZodUndefined:()=>ZodUndefined$1,ZodUnion:()=>ZodUnion$1,ZodUnknown:()=>ZodUnknown$1,ZodVoid:()=>ZodVoid$1,ZodXID:()=>ZodXID,ZodXor:()=>ZodXor,_ZodString:()=>_ZodString,_default:()=>_default$1,_function:()=>_function$1,any:()=>any$1,array:()=>array$1,base64:()=>base64$1,base64url:()=>base64url$1,bigint:()=>bigint$3,boolean:()=>boolean$3,catch:()=>_catch$1,check:()=>check$1,cidrv4:()=>cidrv4$1,cidrv6:()=>cidrv6$1,clone:()=>clone,codec:()=>codec$1,coerce:()=>coerce_exports$1,config:()=>config,core:()=>core_exports,cuid:()=>cuid$1,cuid2:()=>cuid2$1,custom:()=>custom$2,date:()=>date$4,decode:()=>decode,decodeAsync:()=>decodeAsync,describe:()=>describe$1,discriminatedUnion:()=>discriminatedUnion$1,e164:()=>e164$1,email:()=>email$1,emoji:()=>emoji$1,encode:()=>encode,encodeAsync:()=>encodeAsync,endsWith:()=>_endsWith,enum:()=>_enum$1,exactOptional:()=>exactOptional$1,file:()=>file$1,flattenError:()=>flattenError$1,float32:()=>float32$1,float64:()=>float64$1,formatError:()=>formatError,fromJSONSchema:()=>fromJSONSchema,function:()=>_function$1,getErrorMap:()=>getErrorMap$1,globalRegistry:()=>globalRegistry,gt:()=>_gt,gte:()=>_gte,guid:()=>guid$1,hash:()=>hash$1,hex:()=>hex$1,hostname:()=>hostname$1,httpUrl:()=>httpUrl$1,includes:()=>_includes,instanceof:()=>_instanceof$1,int:()=>int$1,int32:()=>int32$1,int64:()=>int64$1,intersection:()=>intersection$1,ipv4:()=>ipv4$1,ipv6:()=>ipv6$1,iso:()=>iso_exports$1,json:()=>json$1,jwt:()=>jwt$1,keyof:()=>keyof$1,ksuid:()=>ksuid$1,lazy:()=>lazy,length:()=>_length,literal:()=>literal$1,locales:()=>locales_exports,looseObject:()=>looseObject$1,looseRecord:()=>looseRecord$1,lowercase:()=>_lowercase,lt:()=>_lt,lte:()=>_lte,mac:()=>mac$1,map:()=>map$1,maxLength:()=>_maxLength,maxSize:()=>_maxSize,meta:()=>meta$1,mime:()=>_mime,minLength:()=>_minLength,minSize:()=>_minSize,multipleOf:()=>_multipleOf,nan:()=>nan$1,nanoid:()=>nanoid$1,nativeEnum:()=>nativeEnum$1,negative:()=>_negative,never:()=>never$1,nonnegative:()=>_nonnegative,nonoptional:()=>nonoptional$1,nonpositive:()=>_nonpositive,normalize:()=>_normalize,null:()=>_null$1,nullable:()=>nullable$1,nullish:()=>nullish$1,number:()=>number$3,object:()=>object$1,optional:()=>optional$1,overwrite:()=>_overwrite,parse:()=>parse$2,parseAsync:()=>parseAsync,partialRecord:()=>partialRecord$1,pipe:()=>pipe$1,positive:()=>_positive,prefault:()=>prefault$1,preprocess:()=>preprocess,prettifyError:()=>prettifyError,promise:()=>promise$1,property:()=>_property,readonly:()=>readonly$1,record:()=>record$1,refine:()=>refine$1,regex:()=>_regex,regexes:()=>regexes_exports,registry:()=>registry,safeDecode:()=>safeDecode,safeDecodeAsync:()=>safeDecodeAsync,safeEncode:()=>safeEncode,safeEncodeAsync:()=>safeEncodeAsync,safeParse:()=>safeParse$1,safeParseAsync:()=>safeParseAsync$1,set:()=>set$1,setErrorMap:()=>setErrorMap$1,size:()=>_size,slugify:()=>_slugify,startsWith:()=>_startsWith,strictObject:()=>strictObject$1,string:()=>string$3,stringFormat:()=>stringFormat$1,stringbool:()=>stringbool$1,success:()=>success$1,superRefine:()=>superRefine$1,symbol:()=>symbol$1,templateLiteral:()=>templateLiteral$1,toJSONSchema:()=>toJSONSchema,toLowerCase:()=>_toLowerCase,toUpperCase:()=>_toUpperCase,transform:()=>transform$1,treeifyError:()=>treeifyError,trim:()=>_trim,tuple:()=>tuple$1,uint32:()=>uint32$1,uint64:()=>uint64$1,ulid:()=>ulid$1,undefined:()=>_undefined$1,union:()=>union$1,unknown:()=>unknown$1,uppercase:()=>_uppercase,url:()=>url$1,util:()=>util_exports,uuid:()=>uuid$1,uuidv4:()=>uuidv4$1,uuidv6:()=>uuidv6$1,uuidv7:()=>uuidv7$1,void:()=>_void$1,xid:()=>xid$1,xor:()=>xor$1});config(en_default());var zod_default=external_exports$2;const ImportKindSchema=_enum$1([`cursor`,`claude-code`,`claude-desktop`,`codex`,`windsurf`,`opencode`,`vscode`]).describe(`Supported editor/client configurations to import MCP servers from`),DEFAULT_IMPORTS=[`cursor`,`claude-code`,`claude-desktop`,`codex`,`windsurf`,`opencode`,`vscode`],RawLifecycleSchema=union$1([literal$1(`keep-alive`).describe(`Keep the server connection alive`),literal$1(`ephemeral`).describe(`Connect only when needed`),object$1({mode:union$1([literal$1(`keep-alive`),literal$1(`ephemeral`)]).describe(`Connection lifecycle mode`),idleTimeoutMs:number$3().int().positive().optional().describe(`Idle timeout in milliseconds before disconnecting`)})]).describe(`Server connection lifecycle: keep-alive maintains persistent connections, ephemeral connects on-demand`),RawLoggingSchema=object$1({daemon:object$1({enabled:boolean$3().optional().describe(`Enable daemon logging for this server`)}).optional().describe(`Daemon-specific logging configuration`)}).optional().describe(`Logging configuration for the server`),RawEntrySchema=object$1({description:string$3().optional().describe(`Human-readable description of the server`),baseUrl:string$3().optional().describe(`Base URL for HTTP/SSE transport (camelCase)`),base_url:string$3().optional().describe(`Base URL for HTTP/SSE transport (snake_case)`),url:string$3().optional().describe(`Server URL for HTTP/SSE transport`),serverUrl:string$3().optional().describe(`Server URL for HTTP/SSE transport (camelCase)`),server_url:string$3().optional().describe(`Server URL for HTTP/SSE transport (snake_case)`),command:union$1([string$3(),array$1(string$3())]).optional().describe(`Command to spawn for stdio transport (string or array of arguments)`),executable:string$3().optional().describe(`Executable path for stdio transport`),args:array$1(string$3()).optional().describe(`Arguments to pass to the stdio command`),headers:record$1(string$3(),string$3()).optional().describe(`HTTP headers for requests. Supports $VAR and $env:VAR placeholders`),env:record$1(string$3(),string$3()).optional().describe(`Environment variables for stdio commands. Supports $VAR and fallback syntax`),auth:string$3().optional().describe(`Authentication method (e.g., "oauth")`),tokenCacheDir:string$3().optional().describe(`Directory for caching OAuth tokens (camelCase)`),token_cache_dir:string$3().optional().describe(`Directory for caching OAuth tokens (snake_case)`),clientName:string$3().optional().describe(`Client identifier for server telemetry (camelCase)`),client_name:string$3().optional().describe(`Client identifier for server telemetry (snake_case)`),oauthRedirectUrl:string$3().optional().describe(`Custom OAuth redirect URL (camelCase)`),oauth_redirect_url:string$3().optional().describe(`Custom OAuth redirect URL (snake_case)`),oauthScope:string$3().optional().describe(`OAuth scope override (camelCase)`),oauth_scope:string$3().optional().describe(`OAuth scope override (snake_case)`),oauthCommand:object$1({args:array$1(string$3()).describe(`Arguments for the OAuth command`)}).optional().describe(`Custom OAuth command configuration for stdio servers (camelCase)`),oauth_command:object$1({args:array$1(string$3()).describe(`Arguments for the OAuth command`)}).optional().describe(`Custom OAuth command configuration for stdio servers (snake_case)`),bearerToken:string$3().optional().describe(`Static bearer token for authentication (camelCase)`),bearer_token:string$3().optional().describe(`Static bearer token for authentication (snake_case)`),bearerTokenEnv:string$3().optional().describe(`Environment variable name containing the bearer token (camelCase)`),bearer_token_env:string$3().optional().describe(`Environment variable name containing the bearer token (snake_case)`),lifecycle:RawLifecycleSchema.optional(),logging:RawLoggingSchema}).describe(`MCP server definition supporting both HTTP/SSE and stdio transports`),RawConfigSchema=object$1({mcpServers:record$1(string$3(),RawEntrySchema).describe(`Map of server names to their configurations`),imports:array$1(ImportKindSchema).optional().describe(`Editor configurations to import servers from. Omit to use defaults, or set to [] to disable imports`)}).describe(`mcporter configuration file schema`);function createScanner$1(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&isDigit(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&isDigit(e.charCodeAt(r)))for(r++;r<e.length&&isDigit(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&isDigit(e.charCodeAt(r))){for(r++;r<e.length&&isDigit(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
60
+ `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(isLineBreak(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(isWhiteSpace(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(isWhiteSpace(t));return o=15}if(isLineBreak(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
61
+ `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!isLineBreak(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,isLineBreak(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!isDigit(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(isWhiteSpace(e)||isLineBreak(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function isWhiteSpace(e){return e===32||e===9}function isLineBreak(e){return e===10||e===13}function isDigit(e){return e>=48&&e<=57}var CharacterCodes;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(CharacterCodes||={});const cachedSpaces=Array(20).fill(0).map((e,t)=>` `.repeat(t)),maxCachedValues=200,cachedBreakLinesWithSpaces={" ":{"\n":Array(maxCachedValues).fill(0).map((e,t)=>`
62
+ `+` `.repeat(t)),"\r":Array(maxCachedValues).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(maxCachedValues).fill(0).map((e,t)=>`\r
63
+ `+` `.repeat(t))}," ":{"\n":Array(maxCachedValues).fill(0).map((e,t)=>`
64
+ `+` `.repeat(t)),"\r":Array(maxCachedValues).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(maxCachedValues).fill(0).map((e,t)=>`\r
65
+ `+` `.repeat(t))}},supportedEols=[`
66
+ `,`\r`,`\r
67
+ `];function format$1(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!isEOL(e,a-1);)a--;let c=s;for(;c<e.length&&!isEOL(e,c);)c++;i=e.substring(a,c),r=computeIndentLevel(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=getEOL(n,e),l=supportedEols.includes(c),u=0,d=0,f;f=n.insertSpaces?cachedSpaces[n.tabSize||4]??repeat(cachedSpaces[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=createScanner$1(i,!1),h=!1;function g(){if(u>1)return repeat(c,u)+repeat(f,r+d);let e=f.length*(r+d);return!l||e>cachedBreakLinesWithSpaces[p][c].length?c+repeat(f,r+d):e<=0?c:cachedBreakLinesWithSpaces[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(repeat(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?cachedSpaces[f.length*r]:repeat(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(cachedSpaces[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=cachedSpaces[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=cachedSpaces[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():cachedSpaces[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():cachedSpaces[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=cachedSpaces[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=cachedSpaces[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=cachedSpaces[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0;break}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function computeIndentLevel(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===cachedSpaces[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function getEOL(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
68
+ `?`\r
69
+ `:`\r`;if(n===`
70
+ `)return`
71
+ `}return e&&e.eol||`
72
+ `}function isEOL(e,t){return`\r
73
+ `.indexOf(e.charAt(t))!==-1}var ParseOptions;(function(e){e.DEFAULT={allowTrailingComma:!1}})(ParseOptions||={});function getLocation$1(e,t){let n=[],r={},i,a={value:{},offset:0,length:0,type:`object`,parent:void 0},o=!1;function s(e,t,n,r){a.value=e,a.offset=t,a.length=n,a.type=r,a.colonOffset=void 0,i=a}try{visit$1(e,{onObjectBegin:(e,a)=>{if(t<=e)throw r;i=void 0,o=t>e,n.push(``)},onObjectProperty:(e,i,a)=>{if(t<i||(s(e,i,a,`property`),n[n.length-1]=e,t<=i+a))throw r},onObjectEnd:(e,a)=>{if(t<=e)throw r;i=void 0,n.pop()},onArrayBegin:(e,a)=>{if(t<=e)throw r;i=void 0,n.push(0)},onArrayEnd:(e,a)=>{if(t<=e)throw r;i=void 0,n.pop()},onLiteralValue:(e,n,i)=>{if(t<n||(s(e,n,i,getNodeType(e)),t<=n+i))throw r},onSeparator:(e,a,s)=>{if(t<=a)throw r;if(e===`:`&&i&&i.type===`property`)i.colonOffset=a,o=!1,i=void 0;else if(e===`,`){let e=n[n.length-1];typeof e==`number`?n[n.length-1]=e+1:(o=!0,n[n.length-1]=``),i=void 0}}})}catch(e){if(e!==r)throw e}return{path:n,previousNode:i,isAtPropertyKey:o,matches:e=>{let t=0;for(let r=0;t<e.length&&r<n.length;r++)if(e[t]===n[r]||e[t]===`*`)t++;else if(e[t]!==`**`)return!1;return t===e.length}}}function parse$1(e,t=[],n=ParseOptions.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return visit$1(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function parseTree$1(e,t=[],n=ParseOptions.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}visit$1(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:getNodeType(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function findNodeAtLocation$1(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function getNodePath$1(e){if(!e.parent||!e.parent.children)return[];let t=getNodePath$1(e.parent);if(e.parent.type===`property`){let n=e.parent.children[0].value;t.push(n)}else if(e.parent.type===`array`){let n=e.parent.children.indexOf(e);n!==-1&&t.push(n)}return t}function getNodeValue$1(e){switch(e.type){case`array`:return e.children.map(getNodeValue$1);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=getNodeValue$1(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function contains(e,t,n=!1){return t>=e.offset&&t<e.offset+e.length||n&&t===e.offset+e.length}function findNodeAtOffset$1(e,t,n=!1){if(contains(e,t,n)){let r=e.children;if(Array.isArray(r))for(let e=0;e<r.length&&r[e].offset<=t;e++){let i=findNodeAtOffset$1(r[e],t,n);if(i)return i}return e}}function visit$1(e,t,n=ParseOptions.DEFAULT){let r=createScanner$1(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16);break}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}else if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),k()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,k()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function k(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):k()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function stripComments$1(e,t){let n=createScanner$1(e),r=[],i,a=0,o;do switch(o=n.getPosition(),i=n.scan(),i){case 12:case 13:case 17:a!==o&&r.push(e.substring(a,o)),t!==void 0&&r.push(n.getTokenValue().replace(/[^\r\n]/g,t)),a=n.getPosition();break}while(i!==17);return r.join(``)}function getNodeType(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function removeProperty(e,t,n){return setProperty(e,t,void 0,n)}function setProperty(e,t,n,r){let i=t.slice(),a=parseTree$1(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=findNodeAtLocation$1(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return withFormatting(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}else if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=findNodeAtLocation$1(o,[s]);if(t!==void 0)if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return withFormatting(e,{offset:i,length:a-i,content:``},r)}else return withFormatting(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return withFormatting(e,a,r)}}else if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return withFormatting(e,i,r)}else if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return withFormatting(e,i,r)}else if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return withFormatting(e,t,r)}else throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}else throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function withFormatting(e,t,n){if(!n.formattingOptions)return[t];let r=applyEdit(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!isEOL(r,i-1);)i--;for(;a<r.length&&!isEOL(r,a);)a++}let o=format$1(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=applyEdit(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function applyEdit(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}function isWS(e,t){return`\r
74
+ `.indexOf(e.charAt(t))!==-1}const createScanner=createScanner$1;var ScanError;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(ScanError||={});var SyntaxKind;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(SyntaxKind||={});const getLocation=getLocation$1,parse=parse$1,parseTree=parseTree$1,findNodeAtLocation=findNodeAtLocation$1,findNodeAtOffset=findNodeAtOffset$1,getNodePath=getNodePath$1,getNodeValue=getNodeValue$1,visit=visit$1,stripComments=stripComments$1;var ParseErrorCode;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(ParseErrorCode||={});function printParseErrorCode(e){switch(e){case 1:return`InvalidSymbol`;case 2:return`InvalidNumberFormat`;case 3:return`PropertyNameExpected`;case 4:return`ValueExpected`;case 5:return`ColonExpected`;case 6:return`CommaExpected`;case 7:return`CloseBraceExpected`;case 8:return`CloseBracketExpected`;case 9:return`EndOfFileExpected`;case 10:return`InvalidCommentToken`;case 11:return`UnexpectedEndOfComment`;case 12:return`UnexpectedEndOfString`;case 13:return`UnexpectedEndOfNumber`;case 14:return`InvalidUnicode`;case 15:return`InvalidEscapeCharacter`;case 16:return`InvalidCharacter`}return`<unknown ParseErrorCode>`}function format(e,t,n){return format$1(e,t,n)}function modify(e,t,n,r){return setProperty(e,t,n,r)}function applyEdits(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=applyEdit(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}async function fileExists(e){try{return await node_fs_promises.default.access(e),!0}catch{return!1}}function parseJsonBuffer(e){let t=[],n=parse(e,t,{allowTrailingComma:!0}),r=t[0];if(r){let e=printParseErrorCode(r.error);throw SyntaxError(`Failed to parse JSON (offset ${r.offset}): ${e}`)}return n}function isRecord(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}async function loadConfigLayers(e,t){let n=e.configPath??process.env.MCPORTER_CONFIG;if(n){let e=node_path.default.resolve(expandHome(n.trim()));return[{config:await readConfigFile(e,!0),path:e,explicit:!0}]}let r=[],i=homeConfigCandidates().find(e=>pathExists(e));i&&r.push({config:await readConfigFile(i,!1),path:i,explicit:!1});let a=node_path.default.resolve(t,`config`,`mcporter.json`);return pathExists(a)&&r.push({config:await readConfigFile(a,!1),path:a,explicit:!1}),r.length===0&&r.push({config:{mcpServers:{}},path:a,explicit:!1}),r}async function readConfigFile(e,t){if(!t&&!await pathExistsAsync(e))return{mcpServers:{}};try{let t=await node_fs_promises.default.readFile(e,`utf8`);return RawConfigSchema.parse(parseJsonBuffer(t))}catch(n){if(!t&&isMissingConfigError(n))return{mcpServers:{}};if(!t&&isSyntaxError(n))return warnConfigFallback(e,n),{mcpServers:{}};throw n}}function isErrno(e,t){return!!(e&&typeof e==`object`&&e.code===t)}function isMissingConfigError(e){return isErrno(e,`ENOENT`)||includesErrnoMessage(e,`ENOENT`)}function isSyntaxError(e){return e instanceof SyntaxError}const warnedConfigPaths=new Set;function warnConfigFallback(e,t){if(warnedConfigPaths.has(e))return;warnedConfigPaths.add(e);let n=t instanceof Error?t.message:String(t);console.warn(`[mcporter] Ignoring config at ${e}: ${n}`)}function includesErrnoMessage(e,t){if(!e||typeof e!=`object`)return!1;let n=e.message;return typeof n==`string`&&n.includes(t)}var require_parser=__commonJSMin(((e,t)=>{let n=1114112;var r=class e extends Error{constructor(t,n,r){super(`[ParserError] `+t,n,r),this.name=`ParserError`,this.code=`ParserError`,Error.captureStackTrace&&Error.captureStackTrace(this,e)}},i=class{constructor(e){this.parser=e,this.buf=``,this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},a=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf=``,this.char=null,this.ii=0,this.state=new i(this.parseStart)}parse(e){if(e.length===0||e.length==null)return;this._buf=String(e),this.ii=-1,this.char=-1;let t;for(;t===!1||this.nextChar();)t=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=n;let e;do e=this.state.parser,this.runOne();while(this.state.parser!==e);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(e){if(typeof e!=`function`)throw new r(`Tried to set state to non-existent state: `+JSON.stringify(e));this.state.parser=e}goto(e){return this.next(e),this.runOne()}call(e,t){t&&this.next(t),this.stack.push(this.state),this.state=new i(e)}callNow(e,t){return this.call(e,t),this.runOne()}return(e){if(this.stack.length===0)throw this.error(new r(`Stack underflow`));e===void 0&&(e=this.state.buf),this.state=this.stack.pop(),this.state.returned=e}returnNow(e){return this.return(e),this.runOne()}consume(){if(this.char===n)throw this.error(new r(`Unexpected end-of-buffer`));this.state.buf+=this._buf[this.ii]}error(e){return e.line=this.line,e.col=this.col,e.pos=this.pos,e}parseStart(){throw new r(`Must declare a parseStart method`)}};a.END=n,a.Error=r,t.exports=a})),require_create_datetime=__commonJSMin(((e,t)=>{t.exports=e=>{let t=new Date(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}})),require_format_num=__commonJSMin(((e,t)=>{t.exports=(e,t)=>{for(t=String(t);t.length<e;)t=`0`+t;return t}})),require_create_datetime_float=__commonJSMin(((e,t)=>{let n=require_format_num();var r=class extends Date{constructor(e){super(e+`Z`),this.isFloating=!0}toISOString(){return`${`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}T${`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}})),require_create_date=__commonJSMin(((e,t)=>{let n=require_format_num(),r=global.Date;var i=class extends r{constructor(e){super(e),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${n(2,this.getUTCMonth()+1)}-${n(2,this.getUTCDate())}`}};t.exports=e=>{let t=new i(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}})),require_create_time=__commonJSMin(((e,t)=>{let n=require_format_num();var r=class extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${n(2,this.getUTCHours())}:${n(2,this.getUTCMinutes())}:${n(2,this.getUTCSeconds())}.${n(3,this.getUTCMilliseconds())}`}};t.exports=e=>{let t=new r(e);if(isNaN(t))throw TypeError(`Invalid Datetime`);return t}})),require_toml_parser=__commonJSMin(((exports,module)=>{module.exports=makeParserClass(require_parser()),module.exports.makeParserClass=makeParserClass;var TomlError=class e extends Error{constructor(t){super(t),this.name=`TomlError`,Error.captureStackTrace&&Error.captureStackTrace(this,e),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=e=>{let t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t},module.exports.TomlError=TomlError;const createDateTime=require_create_datetime(),createDateTimeFloat=require_create_datetime_float(),createDate=require_create_date(),createTime=require_create_time(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:`\b`,[CHAR_t]:` `,[CHAR_n]:`
75
+ `,[CHAR_f]:`\f`,[CHAR_r]:`\r`,[CHAR_QUOT]:`"`,[CHAR_BSOL]:`\\`};function isDigit(e){return e>=CHAR_0&&e<=CHAR_9}function isHexit(e){return e>=CHAR_A&&e<=CHAR_F||e>=CHAR_a&&e<=CHAR_f||e>=CHAR_0&&e<=CHAR_9}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&e<=CHAR_7}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_LOWBAR||e===CHAR_HYPHEN}const _type=Symbol(`type`),_declared=Symbol(`declared`),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(e,t){return hasOwnProperty.call(e,t)?!0:(t===`__proto__`&&defineProperty(e,`__proto__`,descriptor),!1)}const INLINE_TABLE=Symbol(`inline-table`);function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_TABLE}const TABLE=Symbol(`table`);function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return typeof e!=`object`||!e?!1:e[_type]===TABLE}const _contentType=Symbol(`content-type`),INLINE_LIST=Symbol(`inline-list`);function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return typeof e!=`object`||!e?!1:e[_type]===INLINE_LIST}const LIST=Symbol(`list`);function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return typeof e!=`object`||!e?!1:e[_type]===LIST}let _custom;try{const utilInspect=eval(`require('util').inspect`);_custom=utilInspect.custom}catch{}const _inspect=_custom||`inspect`;var BoxedBigInt=class{constructor(e){try{this.value=global.BigInt.asIntN(64,e)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}};const INTEGER=Symbol(`integer`);function Integer(e){let t=Number(e);return Object.is(t,-0)&&(t=0),global.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(e):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return typeof e!=`object`||!e?!1:e[_type]===INTEGER}const FLOAT=Symbol(`float`);function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return typeof e!=`object`||!e?!1:e[_type]===FLOAT}function tomlType(e){let t=typeof e;if(t===`object`){if(e===null)return`null`;if(e instanceof Date)return`datetime`;if(_type in e)switch(e[_type]){case INLINE_TABLE:return`inline-table`;case INLINE_LIST:return`inline-list`;case TABLE:return`table`;case LIST:return`list`;case FLOAT:return`float`;case INTEGER:return`integer`}}return t}function makeParserClass(e){class t extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError(`Unexpected character, expected only whitespace or comments till end of line`))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(e){let t=this.ctx,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(e){return this.state.resultTable?this.state.resultTable.push(e):this.state.resultTable=[e],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError(`Invalid character, expected "="`))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(e){return this.returnNow({key:this.state.resultTable,value:e})}parseComment(){do if(this.char===e.END||this.char===CTRL_J)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)&&(!isTable(this.ctx[e])||this.ctx[e][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));return this.ctx=this.ctx[e]=this.ctx[e]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else throw this.error(new TomlError(`Can't redefine existing key`));return this.next(this.parseTableNext)}else throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)||(this.ctx[e]=List()),isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));if(isList(this.ctx[e])){let t=Table();this.ctx[e].push(t),this.ctx=t}else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListEnd)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isInlineList(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline array`));else if(isInlineTable(this.ctx[e]))throw this.error(new TomlError(`Can't extend an inline table`));else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else throw this.error(new TomlError(`Can't redefine an existing key`));return this.next(this.parseListNext)}else throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseListEnd(e){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError(`Unexpected character, expected whitespace, . or ]`))}parseValue(){if(this.char===e.END)throw this.error(new TomlError(`Key without value`));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError(`Unexpected character, expecting string, number, datetime, boolean, inline array or inline table`))}recordValue(e){return this.returnNow(e)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseInf2(){if(this.char===CHAR_f)return this.state.buf===`-`?this.return(-1/0):this.return(1/0);throw this.error(new TomlError(`Unexpected character, expected "inf", "+inf" or "-inf"`))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError(`Unexpected character, expected "nan"`))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError(`Key ended without value`));if(isAlphaNumHyphen(this.char))this.consume();else if(this.state.buf.length===0)throw this.error(new TomlError(`Empty bare keys are not allowed`));else return this.returnNow()}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+=`'`,this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+=`''`,this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError(`Unterminated string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError(`Unterminated multi-line string`));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let e=`\\u00`;return this.char<16&&(e+=`0`),e+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${e} instead`))}recordMultiEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+=`"`,this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+=`""`,this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError(`Can't escape whitespace`))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError(`Unknown escape character: `+this.char))}parseUnicodeReturn(e){try{let t=parseInt(e,16);if(t>=SURROGATE_FIRST&&t<=SURROGATE_LAST)throw this.error(new TomlError(`Invalid unicode, character in range 0xD800 - 0xDFFF is reserved`));return this.returnNow(String.fromCodePoint(t))}catch(e){throw this.error(TomlError.wrap(e))}}parseSmallUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=4)return this.return()}parseLargeUnicode(){if(!isHexit(this.char))throw this.error(new TomlError(`Invalid character in unicode sequence, expected hex`));if(this.consume(),this.state.buf.length>=8)return this.return()}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError(`Unexpected character, expected digit`));if(this.atEndOfWord())throw this.error(new TomlError(`Incomplete number`));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else return this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError(`Unexpected character, expected -, + or digit`))}parseNumberExponent(){if(isDigit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);else return this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);else if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);else return this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError(`Expected digit while parsing year part of a date`))}else{if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError(`Expected hyphen (-) while parsing year part of date`))}}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerOct(){if(isOctit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseIntegerBin(){if(isBit(this.char))this.consume();else if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);else{let e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError(`Invalid number`));return this.returnNow(e)}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError(`Years less than 1000 must be zero padded to four characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError(`Months less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseDateDay)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError(`Days less than 10 must be zero padded to two characters`));return this.state.result+=`-`+this.state.buf,this.state.buf=``,this.next(this.parseStartTimeHour)}else if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+`-`+this.state.buf));else if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result+=`T`+this.state.buf,this.state.buf=``,this.next(this.parseTimeMin)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeSec);else throw this.error(new TomlError(`Incomplete datetime`))}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError(`Incomplete datetime`))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError(`Hours less than 10 must be zero padded to two characters`));return this.state.result=this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeMin)}else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=`:`+this.state.buf,this.state.buf=``,this.next(this.parseOnlyTimeSec);else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError(`Incomplete time`))}parseOnlyTimeFractionMaybe(){if(this.state.result+=`:`+this.state.buf,this.char===CHAR_PERIOD)this.state.buf=``,this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError(`Expected digit in milliseconds`));return this.returnNow(createTime(this.state.result+`.`+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else if(this.state.buf.length===1)throw this.error(new TomlError(`Expected digit in milliseconds`));else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));else throw this.error(new TomlError(`Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z`))}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError(`Unexpected character in datetime, expected colon`))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError(`Unexpected character in datetime, expected digit`))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError(`Invalid boolean, expected true or false`))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(e){if(this.state.resultArr){let t=this.state.resultArr[_contentType],n=tomlType(e);if(t!==n)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${t} and ${n}`))}else this.state.resultArr=InlineList(tomlType(e));return isFloat(e)||isInteger(e)?this.state.resultArr.push(e.valueOf()):this.state.resultArr.push(e),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(e){let t=this.state.resultTable,n=e.key.pop();for(let n of e.key){if(hasKey(t,n)&&(!isTable(t[n])||t[n][_declared]))throw this.error(new TomlError(`Can't redefine existing key`));t=t[n]=t[n]||Table()}if(hasKey(t,n))throw this.error(new TomlError(`Can't redefine existing key`));return isInteger(e.value)||isFloat(e.value)?t[n]=e.value.valueOf():t[n]=e.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError(`Unterminated inline array`));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError(`Invalid character, expected whitespace, comma (,) or close bracket (])`))}}return t}})),require_parse_pretty_error=__commonJSMin(((e,t)=>{t.exports=n;function n(e,t){if(e.pos==null||e.line==null)return e;let n=e.message;if(n+=` at row ${e.line+1}, col ${e.col+1}, pos ${e.pos}:\n`,t&&t.split){let r=t.split(/\n/),i=String(Math.min(r.length,e.line+3)).length,a=` `;for(;a.length<i;)a+=` `;for(let t=Math.max(0,e.line-1);t<Math.min(r.length,e.line+2);++t){let o=String(t+1);if(o.length<i&&(o=` `+o),e.line===t){n+=o+`> `+r[t]+`
76
+ `,n+=a+` `;for(let t=0;t<e.col;++t)n+=` `;n+=`^
77
+ `}else n+=o+`: `+r[t]+`
78
+ `}}return e.message=n+`
79
+ `,e}})),require_parse_string=__commonJSMin(((e,t)=>{t.exports=i;let n=require_toml_parser(),r=require_parse_pretty_error();function i(e){global.Buffer&&global.Buffer.isBuffer(e)&&(e=e.toString(`utf8`));let t=new n;try{return t.parse(e),t.finish()}catch(t){throw r(t,e)}}})),require_parse_async=__commonJSMin(((e,t)=>{t.exports=i;let n=require_toml_parser(),r=require_parse_pretty_error();function i(e,t){t||={};let i=0,a=t.blocksize||40960,o=new n;return new Promise((e,t)=>{setImmediate(s,0,a,e,t)});function s(t,n,i,a){if(t>=e.length)try{return i(o.finish())}catch(t){return a(r(t,e))}try{o.parse(e.slice(t,t+n)),setImmediate(s,t+n,n,i,a)}catch(t){a(r(t,e))}}}})),require_parse_stream=__commonJSMin(((e,t)=>{t.exports=i;let n=require(`stream`),r=require_toml_parser();function i(e){return e?a(e):o(e)}function a(e){let t=new r;return e.setEncoding(`utf8`),new Promise((n,r)=>{let i,a=!1,o=!1;function s(){if(a=!0,!i)try{n(t.finish())}catch(e){r(e)}}function c(e){o=!0,r(e)}e.once(`end`,s),e.once(`error`,c),l();function l(){i=!0;let n;for(;(n=e.read())!==null;)try{t.parse(n)}catch(e){return c(e)}if(i=!1,a)return s();o||e.once(`readable`,l)}})}function o(){let e=new r;return new n.Transform({objectMode:!0,transform(t,n,r){try{e.parse(t.toString(n))}catch(e){this.emit(`error`,e)}r()},flush(t){try{this.push(e.finish())}catch(e){this.emit(`error`,e)}t()}})}})),require_parse$1=__commonJSMin(((e,t)=>{t.exports=require_parse_string(),t.exports.async=require_parse_async(),t.exports.stream=require_parse_stream(),t.exports.prettyError=require_parse_pretty_error()})),require_stringify=__commonJSMin(((e,t)=>{t.exports=n,t.exports.value=v;function n(e){if(e===null)throw r(`null`);if(e===void 0)throw r(`undefined`);if(typeof e!=`object`)throw r(typeof e);if(typeof e.toJSON==`function`&&(e=e.toJSON()),e==null)return null;let t=u(e);if(t!==`table`)throw r(t);return c(``,``,e)}function r(e){return Error(`Can only stringify objects, not `+e)}function i(){return Error(`Array values can't have mixed types`)}function a(e){return Object.keys(e).filter(t=>l(e[t]))}function o(e){return Object.keys(e).filter(t=>!l(e[t]))}function s(e){let t=Array.isArray(e)?[]:Object.prototype.hasOwnProperty.call(e,`__proto__`)?{["__proto__"]:void 0}:{};for(let n of Object.keys(e))e[n]&&typeof e[n].toJSON==`function`&&!(`toISOString`in e[n])?t[n]=e[n].toJSON():t[n]=e[n];return t}function c(e,t,n){n=s(n);var r=a(n),i=o(n),c=[],l=t||``;r.forEach(e=>{var t=u(n[e]);t!==`undefined`&&t!==`null`&&c.push(l+d(e)+` = `+_(n[e],!0))}),c.length>0&&c.push(``);var f=e&&r.length>0?t+` `:``;return i.forEach(t=>{c.push(O(e,f,t,n[t]))}),c.join(`
80
+ `)}function l(e){switch(u(e)){case`undefined`:case`null`:case`integer`:case`nan`:case`float`:case`boolean`:case`string`:case`datetime`:return!0;case`array`:return e.length===0||u(e[0])!==`table`;case`table`:return Object.keys(e).length===0;default:return!1}}function u(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`bigint`||Number.isInteger(e)&&!Object.is(e,-0)?`integer`:typeof e==`number`?`float`:typeof e==`boolean`?`boolean`:typeof e==`string`?`string`:`toISOString`in e?isNaN(e)?`undefined`:`datetime`:Array.isArray(e)?`array`:`table`}function d(e){var t=String(e);return/^[-A-Za-z0-9_]+$/.test(t)?t:f(t)}function f(e){return`"`+h(e).replace(/"/g,`\\"`)+`"`}function p(e){return`'`+e+`'`}function m(e,t){for(;t.length<e;)t=`0`+t;return t}function h(e){return e.replace(/\\/g,`\\\\`).replace(/[\b]/g,`\\b`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\f/g,`\\f`).replace(/\r/g,`\\r`).replace(/([\u0000-\u001f\u007f])/,e=>`\\u`+m(4,e.codePointAt(0).toString(16)))}function g(e){let t=e.split(/\n/).map(e=>h(e).replace(/"(?="")/g,`\\"`)).join(`
81
+ `);return t.slice(-1)===`"`&&(t+=`\\
82
+ `),`"""
83
+ `+t+`"""`}function _(e,t){let n=u(e);return n===`string`&&(t&&/\n/.test(e)?n=`string-multiline`:!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(n=`string-literal`)),v(e,n)}function v(e,t){switch(t||=u(e),t){case`string-multiline`:return g(e);case`string`:return f(e);case`string-literal`:return p(e);case`integer`:return y(e);case`float`:return b(e);case`boolean`:return x(e);case`datetime`:return S(e);case`array`:return E(e.filter(e=>u(e)!==`null`&&u(e)!==`undefined`&&u(e)!==`nan`));case`table`:return D(e);default:throw r(t)}}function y(e){return String(e).replace(/\B(?=(\d{3})+(?!\d))/g,`_`)}function b(e){if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Object.is(e,NaN))return`nan`;if(Object.is(e,-0))return`-0.0`;var t=String(e).split(`.`),n=t[0],r=t[1]||0;return y(n)+`.`+r}function x(e){return String(e)}function S(e){return e.toISOString()}function C(e){return e===`float`||e===`integer`}function w(e){var t=u(e[0]);return e.every(e=>u(e)===t)?t:e.every(e=>C(u(e)))?`float`:`mixed`}function T(e){let t=w(e);if(t===`mixed`)throw i();return t}function E(e){e=s(e);let t=T(e);var n=`[`,r=e.map(e=>v(e,t));return r.join(`, `).length>60||/\n/.test(r)?n+=`
84
+ `+r.join(`,
85
+ `)+`
86
+ `:n+=` `+r.join(`, `)+(r.length>0?` `:``),n+`]`}function D(e){e=s(e);var t=[];return Object.keys(e).forEach(n=>{t.push(d(n)+` = `+_(e[n],!1))}),`{ `+t.join(`, `)+(t.length>0?` `:``)+`}`}function O(e,t,n,i){var a=u(i);if(a===`array`)return k(e,t,n,i);if(a===`table`)return A(e,t,n,i);throw r(a)}function k(e,t,n,i){i=s(i),T(i);var a=u(i[0]);if(a!==`table`)throw r(a);var o=e+d(n),l=``;return i.forEach(e=>{l.length>0&&(l+=`
87
+ `),l+=t+`[[`+o+`]]
88
+ `,l+=c(o+`.`,t,e)}),l}function A(e,t,n,r){var i=e+d(n),o=``;return a(r).length>0&&(o+=t+`[`+i+`]
89
+ `),o+c(i+`.`,t,r)}})),require_toml=__commonJSMin((e=>{e.parse=require_parse$1(),e.stringify=require_stringify()})),import_toml=require_toml();function normalizeProjectPath(e){return!e||typeof e!=`string`?``:node_path.default.resolve(expandHomeShortcut(e))}function expandHomeShortcut(e){return e===`~`?node_os.default.homedir():e.startsWith(`~/`)||e.startsWith(`~\\`)?node_path.default.join(node_os.default.homedir(),e.slice(2)):e}function pathsEqual(e,t){return!e||!t?!1:process.platform===`win32`?e.toLowerCase()===t.toLowerCase():e===t}async function readExternalEntries(e,t={}){if(!await fileExists(e))return null;let n=await node_fs_promises.default.readFile(e,`utf8`);if(!n.trim())return new Map;try{return e.endsWith(`.toml`)?extractFromCodexConfig((0,import_toml.parse)(n)):extractFromMcpJson(parseJsonBuffer(n),t,e)}catch(e){if(shouldIgnoreParseError(e))return new Map;throw e}}function extractFromMcpJson(e,t,n){let r=new Map;if(!isRecord(e))return r;let{importKind:i,projectRoot:a}=t,o=resolveContainerDescriptor(i,n),s=[];o.allowMcpServers&&isRecord(e.mcpServers)&&s.push(e.mcpServers),o.allowServers&&isRecord(e.servers)&&s.push(e.servers),o.allowMcp&&isRecord(e.mcp)&&s.push(e.mcp),o.allowRootFallback&&s.length===0&&s.push(e);for(let e of s)addEntriesFromContainer(e,r);if(a){let t=extractClaudeProjectEntries(e,a);for(let[e,n]of t)r.has(e)||r.set(e,n)}return r}function extractFromCodexConfig(e){let t=new Map,n=e.mcp_servers;if(!n||typeof n!=`object`)return t;for(let[e,r]of Object.entries(n)){if(!r||typeof r!=`object`)continue;let n=convertExternalEntry(r);n&&t.set(e,n)}return t}function convertExternalEntry(e){let t={};typeof e.description==`string`&&(t.description=e.description);let n=asStringRecord(e.env);n&&(t.env=n);let r=buildExternalHeaders(e);r&&(t.headers=r);let i=asString$1(e.auth);i&&(t.auth=i);let a=asString$1(e.tokenCacheDir??e.token_cache_dir??e.token_cacheDir);a&&(t.tokenCacheDir=a);let o=asString$1(e.clientName??e.client_name);o&&(t.clientName=o);let s=asString$1(e.baseUrl??e.base_url??e.url??e.serverUrl??e.server_url);s&&(t.baseUrl=s);let c=e.command??e.executable;(Array.isArray(c)&&c.every(e=>typeof e==`string`)||typeof c==`string`)&&(t.command=c),Array.isArray(e.args)&&e.args.every(e=>typeof e==`string`)&&(t.args=e.args);let l=typeof t.baseUrl==`string`,u=typeof t.command==`string`||Array.isArray(t.command)&&t.command.length>0;if(!l&&!u)return null;let d=RawEntrySchema.safeParse(t);return d.success?d.data:null}function buildExternalHeaders(e){let t={},n=asStringRecord(e.headers);n&&Object.assign(t,n);let r=asString$1(e.bearerToken??e.bearer_token);r&&(t.Authorization=`Bearer ${r}`);let i=asString$1(e.bearerTokenEnv??e.bearer_token_env);return i&&(t.Authorization=`$env:${i}`),Object.keys(t).length>0?t:void 0}function extractClaudeProjectEntries(e,t){let n=new Map;if(!isRecord(e.projects))return n;let r=e.projects,i=normalizeProjectPath(t);for(let[e,t]of Object.entries(r))!isRecord(t)||!isRecord(t.mcpServers)||!pathsEqual(normalizeProjectPath(e),i)||addEntriesFromContainer(t.mcpServers,n);return n}function addEntriesFromContainer(e,t){for(let[n,r]of Object.entries(e)){if(!isRecord(r)||t.has(n))continue;let e=convertExternalEntry(r);e&&t.set(n,e)}}function resolveContainerDescriptor(e,t){if(e===`opencode`)return{allowMcpServers:!1,allowServers:!1,allowMcp:!0,allowRootFallback:!1};if(e===`claude-code`&&t){let e=node_path.default.normalize(t);return{allowMcpServers:!0,allowServers:!0,allowMcp:!0,allowRootFallback:e.endsWith(`.claude.json`)||e.endsWith(`${node_path.default.sep}.claude${node_path.default.sep}mcp.json`)}}return{allowMcpServers:!0,allowServers:!0,allowMcp:!0,allowRootFallback:!0}}function asString$1(e){return typeof e==`string`&&e.length>0?e:void 0}function asStringRecord(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`?t[n]=r:(typeof r==`number`||typeof r==`boolean`)&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function shouldIgnoreParseError(e){return e instanceof SyntaxError?!0:!e||typeof e!=`object`?!1:`fromTOML`in e}function pathsForImport(e,t){switch(e){case`cursor`:return dedupePaths([node_path.default.resolve(t,`.cursor`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`.cursor`,`mcp.json`),...defaultCursorUserConfigPaths()]);case`claude-code`:return dedupePaths([node_path.default.resolve(t,`.claude`,`settings.local.json`),node_path.default.resolve(t,`.claude`,`settings.json`),node_path.default.resolve(t,`.claude`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`.claude`,`settings.local.json`),node_path.default.join(node_os.default.homedir(),`.claude`,`settings.json`),node_path.default.join(node_os.default.homedir(),`.claude`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`.claude.json`)]);case`claude-desktop`:return[defaultClaudeDesktopConfigPath()];case`codex`:return[node_path.default.resolve(t,`.codex`,`config.toml`),node_path.default.join(node_os.default.homedir(),`.codex`,`config.toml`)];case`windsurf`:return defaultWindsurfConfigPaths();case`opencode`:return opencodeConfigPaths(t);case`vscode`:return dedupePaths([node_path.default.resolve(t,`.vscode`,`mcp.json`),...defaultVscodeConfigPaths()]);default:return[]}}function defaultCursorUserConfigPaths(){let e=process.env.XDG_CONFIG_HOME,t=e?[node_path.default.join(e,`Cursor`,`User`,`mcp.json`)]:[];return dedupePaths([node_path.default.join(node_os.default.homedir(),`AppData`,`Roaming`,`Cursor`,`User`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`Library`,`Application Support`,`Cursor`,`User`,`mcp.json`),...t])}function defaultWindsurfConfigPaths(){let e=node_os.default.homedir(),t=[node_path.default.join(e,`.codeium`,`windsurf`,`mcp_config.json`),node_path.default.join(e,`.codeium`,`windsurf-next`,`mcp_config.json`),node_path.default.join(e,`.windsurf`,`mcp_config.json`),node_path.default.join(e,`.config`,`.codeium`,`windsurf`,`mcp_config.json`)];if(process.platform===`win32`){let n=process.env.APPDATA??node_path.default.join(e,`AppData`,`Roaming`);t.push(node_path.default.join(n,`Codeium`,`windsurf`,`mcp_config.json`))}return dedupePaths(t)}function defaultVscodeConfigPaths(){if(process.platform===`darwin`)return[node_path.default.join(node_os.default.homedir(),`Library`,`Application Support`,`Code`,`User`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`Library`,`Application Support`,`Code - Insiders`,`User`,`mcp.json`)];if(process.platform===`win32`){let e=process.env.APPDATA??node_path.default.join(node_os.default.homedir(),`AppData`,`Roaming`);return[node_path.default.join(e,`Code`,`User`,`mcp.json`),node_path.default.join(e,`Code - Insiders`,`User`,`mcp.json`)]}return[node_path.default.join(node_os.default.homedir(),`.config`,`Code`,`User`,`mcp.json`),node_path.default.join(node_os.default.homedir(),`.config`,`Code - Insiders`,`User`,`mcp.json`)]}function opencodeConfigPaths(e){let t=process.env.OPENCODE_CONFIG,n=process.env.OPENCODE_CONFIG_DIR,r=process.env.OPENAI_WORKDIR,i=process.env.XDG_CONFIG_HOME??node_path.default.join(process.env.HOME??``,`.config`),a=[t??``,node_path.default.resolve(e,`opencode.jsonc`),node_path.default.resolve(e,`opencode.json`)];n&&n.length>0&&a.push(node_path.default.join(n,`opencode.jsonc`),node_path.default.join(n,`opencode.json`)),a.push(node_path.default.resolve(e,`.openai`,`config.json`),r?node_path.default.resolve(r,`.openai`,`config.json`):``,node_path.default.join(i,`openai`,`config.json`));for(let e of defaultOpencodeConfigDirs())a.push(node_path.default.join(e,`opencode.jsonc`),node_path.default.join(e,`opencode.json`));return dedupePaths(a)}function defaultOpencodeConfigDirs(){let e=[],t=process.env.XDG_CONFIG_HOME;if(t&&t.length>0)e.push(node_path.default.join(t,`opencode`));else if(process.platform===`win32`){let t=process.env.APPDATA??node_path.default.join(node_os.default.homedir(),`AppData`,`Roaming`);e.push(node_path.default.join(t,`opencode`))}else e.push(node_path.default.join(node_os.default.homedir(),`.config`,`opencode`));return e}function defaultClaudeDesktopConfigPath(){let e=node_os.default.homedir(),t=node_path.default.join(e,`Library`,`Application Support`,`Claude`,`settings.json`),n=node_path.default.join(e,`AppData`,`Roaming`,`Claude`,`settings.json`),r=node_path.default.join(e,`.config`,`Claude`,`settings.json`),i=process.platform;return i===`darwin`?t:i===`win32`?n:r}function dedupePaths(e){let t=new Set,n=[];for(let r of e)!r||t.has(r)||(t.add(r),n.push(r));return n}function toFileUrl(e){return(0,node_url.pathToFileURL)(e)}const DEFAULT_KEEP_ALIVE=new Set([`chrome-devtools`,`mobile-mcp`,`playwright`]),includeOverride=parseList(process.env.MCPORTER_KEEPALIVE),excludeOverride=parseList(process.env.MCPORTER_DISABLE_KEEPALIVE??process.env.MCPORTER_NO_KEEPALIVE),KEEP_ALIVE_COMMANDS=[{label:`chrome-devtools`,fragments:[`chrome-devtools-mcp`]},{label:`mobile-mcp`,fragments:[`@mobilenext/mobile-mcp`,`mobile-mcp`]},{label:`playwright`,fragments:[`@playwright/mcp`,`playwright/mcp`]}],CHROME_DEVTOOLS_URL_PLACEHOLDERS=[String.raw`\${CHROME_DEVTOOLS_URL}`,`$env:CHROME_DEVTOOLS_URL`];function resolveLifecycle(e,t,n){let r=e.toLowerCase(),i=canonicalKeepAliveName(n),a=new Set([r]);i&&a.add(i);let o=excludeOverride.all||matchesOverride(excludeOverride.names,a);if(includeOverride.all||matchesOverride(includeOverride.names,a))return{mode:`keep-alive`};if(o)return;let s=t?coerceLifecycle(t):void 0;if(s)return s;if(commandRequiresDynamicChromePort(n))return{mode:`ephemeral`};if(Array.from(a).some(e=>DEFAULT_KEEP_ALIVE.has(e)))return{mode:`keep-alive`}}function canonicalKeepAliveName(e){if(e.kind!==`stdio`)return;let t=[e.command,...e.args].map(e=>e.toLowerCase());return KEEP_ALIVE_COMMANDS.find(e=>e.fragments.some(e=>t.some(t=>t.includes(e))))?.label}function commandRequiresDynamicChromePort(e){return e.kind===`stdio`?[e.command,...e.args].some(e=>CHROME_DEVTOOLS_URL_PLACEHOLDERS.some(t=>e.includes(t))):!1}function parseList(e){if(!e)return{all:!1,names:new Set};let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);return t.includes(`*`)?{all:!0,names:new Set}:{all:!1,names:new Set(t)}}function matchesOverride(e,t){for(let n of t)if(e.has(n))return!0;return!1}function coerceLifecycle(e){if(typeof e==`string`)return e===`keep-alive`?{mode:`keep-alive`}:e===`ephemeral`?{mode:`ephemeral`}:void 0;if(e.mode===`keep-alive`){let t=typeof e.idleTimeoutMs==`number`&&Number.isFinite(e.idleTimeoutMs)&&e.idleTimeoutMs>0?Math.trunc(e.idleTimeoutMs):void 0;return t?{mode:`keep-alive`,idleTimeoutMs:t}:{mode:`keep-alive`}}if(e.mode===`ephemeral`)return{mode:`ephemeral`}}function isKeepAliveServer(e){return e?.lifecycle?.mode===`keep-alive`}function keepAliveIdleTimeout(e){if(e.lifecycle?.mode===`keep-alive`)return e.lifecycle.idleTimeoutMs}function normalizeServerEntry(e,t,n,r,i){let a=t.description,o=t.env?{...t.env}:void 0,s=normalizeAuth(t.auth),c=normalizePath(t.tokenCacheDir??t.token_cache_dir),l=t.clientName??t.client_name,u=t.oauthRedirectUrl??t.oauth_redirect_url??void 0,d=t.oauthScope??t.oauth_scope??void 0,f=t.oauthCommand??t.oauth_command,p=f?{args:[...f.args]}:void 0,m=buildHeaders(t),h=getUrl(t),g=getCommand(t),_;if(h)_={kind:`http`,url:new URL(h),headers:ensureHttpAcceptHeader(m)};else if(g)_={kind:`stdio`,command:g.command,args:g.args,cwd:n};else throw Error(`Server '${e}' is missing a baseUrl/url or command definition in mcporter.json`);let v=resolveLifecycle(e,t.lifecycle,_),y=normalizeLogging(t.logging),b=!p&&e.toLowerCase()===`gmail`&&_.kind===`stdio`?{args:[`auth`,`http://localhost:3000/oauth2callback`]}:p;return{name:e,description:a,command:_,env:o,auth:s,tokenCacheDir:c,clientName:l,oauthRedirectUrl:u,oauthScope:d,oauthCommand:b,source:r,sources:i,lifecycle:v,logging:y}}const __configInternals={ensureHttpAcceptHeader};function normalizeAuth(e){if(e&&e.toLowerCase()===`oauth`)return`oauth`}function normalizePath(e){if(e)return expandHome(e)}function getUrl(e){return e.baseUrl??e.base_url??e.url??e.serverUrl??e.server_url??void 0}function getCommand(e){let t=e.command??e.executable;if(Array.isArray(t))return t.length===0||typeof t[0]!=`string`?void 0:{command:t[0],args:t.slice(1)};if(typeof t==`string`&&t.length>0){let n=Array.isArray(e.args)?e.args:[];if(n.length>0)return{command:t,args:n};let r=parseCommandString(t);if(r.length===0)return;let[i,...a]=r;return i?{command:i,args:a}:void 0}}function buildHeaders(e){let t={};e.headers&&Object.assign(t,e.headers);let n=e.bearerToken??e.bearer_token;n&&(t.Authorization=`Bearer ${n}`);let r=e.bearerTokenEnv??e.bearer_token_env;return r&&(t.Authorization=`$env:${r}`),Object.keys(t).length>0?t:void 0}function ensureHttpAcceptHeader(e){let t=`application/json, text/event-stream`,n=e?{...e}:{},r=Object.keys(n).find(e=>e.toLowerCase()===`accept`),i=r?n[r]:void 0;return(!i||!hasRequiredAcceptTokens(i))&&(n[r??`accept`]=`application/json, text/event-stream`),Object.keys(n).length>0?n:void 0}function hasRequiredAcceptTokens(e){let t=e.toLowerCase();return t.includes(`application/json`)&&t.includes(`text/event-stream`)}function parseCommandString(e){let t=[],n=``,r=!1,i=!1,a=!1;for(let o of e.trim()){if(a){n+=o,a=!1;continue}if(o===`\\`){a=!0;continue}if(o===`'`&&!i){r=!r;continue}if(o===`"`&&!r){i=!i;continue}if(o===` `&&!r&&!i){n.length>0&&(t.push(n),n=``);continue}n+=o}return a&&(n+=`\\`),n.length>0&&t.push(n),t}function normalizeLogging(e){if(e&&e.daemon)return{daemon:{enabled:e.daemon.enabled}}}async function loadServerDefinitions(e={}){let t=e.rootDir??process.cwd(),n=await loadConfigLayers(e,t),r=new Map;for(let e of n){let n=e.config.imports,i=n?n.length===0?n:[...n,...DEFAULT_IMPORTS.filter(e=>!n.includes(e))]:DEFAULT_IMPORTS;for(let e of i){let n=pathsForImport(e,t);for(let i of n){let n=expandHome(i),a=await readExternalEntries(n,{projectRoot:t,importKind:e});if(a)for(let[t,i]of a){if(r.has(t))continue;let a={kind:`import`,path:n,importKind:e},o=r.get(t);if(o){o.sources.push(a);continue}r.set(t,{raw:i,baseDir:node_path.default.dirname(n),source:a,sources:[a]})}}}for(let[t,n]of Object.entries(e.config.mcpServers)){let i={kind:`local`,path:e.path},a=RawEntrySchema.parse(n),o=r.get(t);if(o){let n=[i,...o.sources];r.set(t,{raw:a,baseDir:node_path.default.dirname(e.path),source:i,sources:n});continue}r.set(t,{raw:a,baseDir:node_path.default.dirname(e.path),source:i,sources:[i]})}}let i=[];for(let[e,{raw:t,baseDir:n,source:a,sources:o}]of r)i.push(normalizeServerEntry(e,t,n,a,o));return i}async function loadRawConfig(e={}){let t=e.rootDir??process.cwd(),n=resolveConfigPath(e.configPath,t);return{config:await readConfigFile(n.path,n.explicit),...n}}async function listConfigLayerPaths(e={},t=process.cwd()){return await listConfigLayerPaths$1(e,t)}async function writeRawConfig(e,t){await node_fs_promises.default.mkdir(node_path.default.dirname(e),{recursive:!0});let n=`${JSON.stringify(t,null,2)}\n`;await node_fs_promises.default.writeFile(e,n,`utf8`)}function resolveConfigPath(e,t){return resolveConfigPath$1(e,t)}let crypto$1;crypto$1=globalThis.crypto?.webcrypto??globalThis.crypto??import(`node:crypto`).then(e=>e.webcrypto);async function getRandomValues(e){return(await crypto$1).getRandomValues(new Uint8Array(e))}async function random(e){let t=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`,n=2**8-2**8%66,r=``;for(;r.length<e;){let t=await getRandomValues(e-r.length);for(let e of t)e<198&&(r+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return r}async function generateVerifier(e){return await random(e)}async function generateChallenge(e){let t=await(await crypto$1).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function pkceChallenge(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await generateVerifier(e);return{code_verifier:t,code_challenge:await generateChallenge(t)}}async function verifyChallenge(e,t){return await generateChallenge(e)===t}var classic_default=external_exports$2,v4_default=classic_default;const LATEST_PROTOCOL_VERSION=`2025-11-25`,DEFAULT_NEGOTIATED_PROTOCOL_VERSION=`2025-03-26`,SUPPORTED_PROTOCOL_VERSIONS=[LATEST_PROTOCOL_VERSION,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],RELATED_TASK_META_KEY=`io.modelcontextprotocol/related-task`,JSONRPC_VERSION=`2.0`,AssertObjectSchema=custom$2(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),ProgressTokenSchema=union$1([string$3(),number$3().int()]),CursorSchema=string$3(),TaskCreationParamsSchema=looseObject$1({ttl:number$3().optional(),pollInterval:number$3().optional()}),TaskMetadataSchema=object$1({ttl:number$3().optional()}),RelatedTaskMetadataSchema=object$1({taskId:string$3()}),RequestMetaSchema=looseObject$1({progressToken:ProgressTokenSchema.optional(),[RELATED_TASK_META_KEY]:RelatedTaskMetadataSchema.optional()}),BaseRequestParamsSchema=object$1({_meta:RequestMetaSchema.optional()}),TaskAugmentedRequestParamsSchema=BaseRequestParamsSchema.extend({task:TaskMetadataSchema.optional()}),isTaskAugmentedRequestParams=e=>TaskAugmentedRequestParamsSchema.safeParse(e).success,RequestSchema=object$1({method:string$3(),params:BaseRequestParamsSchema.loose().optional()}),NotificationsParamsSchema=object$1({_meta:RequestMetaSchema.optional()}),NotificationSchema=object$1({method:string$3(),params:NotificationsParamsSchema.loose().optional()}),ResultSchema=looseObject$1({_meta:RequestMetaSchema.optional()}),RequestIdSchema=union$1([string$3(),number$3().int()]),JSONRPCRequestSchema=object$1({jsonrpc:literal$1(JSONRPC_VERSION),id:RequestIdSchema,...RequestSchema.shape}).strict(),isJSONRPCRequest=e=>JSONRPCRequestSchema.safeParse(e).success,JSONRPCNotificationSchema=object$1({jsonrpc:literal$1(JSONRPC_VERSION),...NotificationSchema.shape}).strict(),isJSONRPCNotification=e=>JSONRPCNotificationSchema.safeParse(e).success,JSONRPCResultResponseSchema=object$1({jsonrpc:literal$1(JSONRPC_VERSION),id:RequestIdSchema,result:ResultSchema}).strict(),isJSONRPCResultResponse=e=>JSONRPCResultResponseSchema.safeParse(e).success,isJSONRPCResponse=isJSONRPCResultResponse;var ErrorCode;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(ErrorCode||={});const JSONRPCErrorResponseSchema=object$1({jsonrpc:literal$1(JSONRPC_VERSION),id:RequestIdSchema.optional(),error:object$1({code:number$3().int(),message:string$3(),data:unknown$1().optional()})}).strict(),JSONRPCErrorSchema=JSONRPCErrorResponseSchema,isJSONRPCErrorResponse=e=>JSONRPCErrorResponseSchema.safeParse(e).success,isJSONRPCError=isJSONRPCErrorResponse,JSONRPCMessageSchema=union$1([JSONRPCRequestSchema,JSONRPCNotificationSchema,JSONRPCResultResponseSchema,JSONRPCErrorResponseSchema]),JSONRPCResponseSchema=union$1([JSONRPCResultResponseSchema,JSONRPCErrorResponseSchema]),EmptyResultSchema=ResultSchema.strict(),CancelledNotificationParamsSchema=NotificationsParamsSchema.extend({requestId:RequestIdSchema.optional(),reason:string$3().optional()}),CancelledNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/cancelled`),params:CancelledNotificationParamsSchema}),IconSchema=object$1({src:string$3(),mimeType:string$3().optional(),sizes:array$1(string$3()).optional(),theme:_enum$1([`light`,`dark`]).optional()}),IconsSchema=object$1({icons:array$1(IconSchema).optional()}),BaseMetadataSchema=object$1({name:string$3(),title:string$3().optional()}),ImplementationSchema=BaseMetadataSchema.extend({...BaseMetadataSchema.shape,...IconsSchema.shape,version:string$3(),websiteUrl:string$3().optional(),description:string$3().optional()}),FormElicitationCapabilitySchema=intersection$1(object$1({applyDefaults:boolean$3().optional()}),record$1(string$3(),unknown$1())),ElicitationCapabilitySchema=preprocess(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,intersection$1(object$1({form:FormElicitationCapabilitySchema.optional(),url:AssertObjectSchema.optional()}),record$1(string$3(),unknown$1()).optional())),ClientTasksCapabilitySchema=looseObject$1({list:AssertObjectSchema.optional(),cancel:AssertObjectSchema.optional(),requests:looseObject$1({sampling:looseObject$1({createMessage:AssertObjectSchema.optional()}).optional(),elicitation:looseObject$1({create:AssertObjectSchema.optional()}).optional()}).optional()}),ServerTasksCapabilitySchema=looseObject$1({list:AssertObjectSchema.optional(),cancel:AssertObjectSchema.optional(),requests:looseObject$1({tools:looseObject$1({call:AssertObjectSchema.optional()}).optional()}).optional()}),ClientCapabilitiesSchema=object$1({experimental:record$1(string$3(),AssertObjectSchema).optional(),sampling:object$1({context:AssertObjectSchema.optional(),tools:AssertObjectSchema.optional()}).optional(),elicitation:ElicitationCapabilitySchema.optional(),roots:object$1({listChanged:boolean$3().optional()}).optional(),tasks:ClientTasksCapabilitySchema.optional(),extensions:record$1(string$3(),AssertObjectSchema).optional()}),InitializeRequestParamsSchema=BaseRequestParamsSchema.extend({protocolVersion:string$3(),capabilities:ClientCapabilitiesSchema,clientInfo:ImplementationSchema}),InitializeRequestSchema=RequestSchema.extend({method:literal$1(`initialize`),params:InitializeRequestParamsSchema}),isInitializeRequest=e=>InitializeRequestSchema.safeParse(e).success,ServerCapabilitiesSchema=object$1({experimental:record$1(string$3(),AssertObjectSchema).optional(),logging:AssertObjectSchema.optional(),completions:AssertObjectSchema.optional(),prompts:object$1({listChanged:boolean$3().optional()}).optional(),resources:object$1({subscribe:boolean$3().optional(),listChanged:boolean$3().optional()}).optional(),tools:object$1({listChanged:boolean$3().optional()}).optional(),tasks:ServerTasksCapabilitySchema.optional(),extensions:record$1(string$3(),AssertObjectSchema).optional()}),InitializeResultSchema=ResultSchema.extend({protocolVersion:string$3(),capabilities:ServerCapabilitiesSchema,serverInfo:ImplementationSchema,instructions:string$3().optional()}),InitializedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/initialized`),params:NotificationsParamsSchema.optional()}),isInitializedNotification=e=>InitializedNotificationSchema.safeParse(e).success,PingRequestSchema=RequestSchema.extend({method:literal$1(`ping`),params:BaseRequestParamsSchema.optional()}),ProgressSchema=object$1({progress:number$3(),total:optional$1(number$3()),message:optional$1(string$3())}),ProgressNotificationParamsSchema=object$1({...NotificationsParamsSchema.shape,...ProgressSchema.shape,progressToken:ProgressTokenSchema}),ProgressNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/progress`),params:ProgressNotificationParamsSchema}),PaginatedRequestParamsSchema=BaseRequestParamsSchema.extend({cursor:CursorSchema.optional()}),PaginatedRequestSchema=RequestSchema.extend({params:PaginatedRequestParamsSchema.optional()}),PaginatedResultSchema=ResultSchema.extend({nextCursor:CursorSchema.optional()}),TaskStatusSchema=_enum$1([`working`,`input_required`,`completed`,`failed`,`cancelled`]),TaskSchema=object$1({taskId:string$3(),status:TaskStatusSchema,ttl:union$1([number$3(),_null$1()]),createdAt:string$3(),lastUpdatedAt:string$3(),pollInterval:optional$1(number$3()),statusMessage:optional$1(string$3())}),CreateTaskResultSchema=ResultSchema.extend({task:TaskSchema}),TaskStatusNotificationParamsSchema=NotificationsParamsSchema.merge(TaskSchema),TaskStatusNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/tasks/status`),params:TaskStatusNotificationParamsSchema}),GetTaskRequestSchema=RequestSchema.extend({method:literal$1(`tasks/get`),params:BaseRequestParamsSchema.extend({taskId:string$3()})}),GetTaskResultSchema=ResultSchema.merge(TaskSchema),GetTaskPayloadRequestSchema=RequestSchema.extend({method:literal$1(`tasks/result`),params:BaseRequestParamsSchema.extend({taskId:string$3()})}),GetTaskPayloadResultSchema=ResultSchema.loose(),ListTasksRequestSchema=PaginatedRequestSchema.extend({method:literal$1(`tasks/list`)}),ListTasksResultSchema=PaginatedResultSchema.extend({tasks:array$1(TaskSchema)}),CancelTaskRequestSchema=RequestSchema.extend({method:literal$1(`tasks/cancel`),params:BaseRequestParamsSchema.extend({taskId:string$3()})}),CancelTaskResultSchema=ResultSchema.merge(TaskSchema),ResourceContentsSchema=object$1({uri:string$3(),mimeType:optional$1(string$3()),_meta:record$1(string$3(),unknown$1()).optional()}),TextResourceContentsSchema=ResourceContentsSchema.extend({text:string$3()}),Base64Schema=string$3().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),BlobResourceContentsSchema=ResourceContentsSchema.extend({blob:Base64Schema}),RoleSchema=_enum$1([`user`,`assistant`]),AnnotationsSchema=object$1({audience:array$1(RoleSchema).optional(),priority:number$3().min(0).max(1).optional(),lastModified:datetime$1({offset:!0}).optional()}),ResourceSchema=object$1({...BaseMetadataSchema.shape,...IconsSchema.shape,uri:string$3(),description:optional$1(string$3()),mimeType:optional$1(string$3()),size:optional$1(number$3()),annotations:AnnotationsSchema.optional(),_meta:optional$1(looseObject$1({}))}),ResourceTemplateSchema=object$1({...BaseMetadataSchema.shape,...IconsSchema.shape,uriTemplate:string$3(),description:optional$1(string$3()),mimeType:optional$1(string$3()),annotations:AnnotationsSchema.optional(),_meta:optional$1(looseObject$1({}))}),ListResourcesRequestSchema=PaginatedRequestSchema.extend({method:literal$1(`resources/list`)}),ListResourcesResultSchema=PaginatedResultSchema.extend({resources:array$1(ResourceSchema)}),ListResourceTemplatesRequestSchema=PaginatedRequestSchema.extend({method:literal$1(`resources/templates/list`)}),ListResourceTemplatesResultSchema=PaginatedResultSchema.extend({resourceTemplates:array$1(ResourceTemplateSchema)}),ResourceRequestParamsSchema=BaseRequestParamsSchema.extend({uri:string$3()}),ReadResourceRequestParamsSchema=ResourceRequestParamsSchema,ReadResourceRequestSchema=RequestSchema.extend({method:literal$1(`resources/read`),params:ReadResourceRequestParamsSchema}),ReadResourceResultSchema=ResultSchema.extend({contents:array$1(union$1([TextResourceContentsSchema,BlobResourceContentsSchema]))}),ResourceListChangedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/resources/list_changed`),params:NotificationsParamsSchema.optional()}),SubscribeRequestParamsSchema=ResourceRequestParamsSchema,SubscribeRequestSchema=RequestSchema.extend({method:literal$1(`resources/subscribe`),params:SubscribeRequestParamsSchema}),UnsubscribeRequestParamsSchema=ResourceRequestParamsSchema,UnsubscribeRequestSchema=RequestSchema.extend({method:literal$1(`resources/unsubscribe`),params:UnsubscribeRequestParamsSchema}),ResourceUpdatedNotificationParamsSchema=NotificationsParamsSchema.extend({uri:string$3()}),ResourceUpdatedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/resources/updated`),params:ResourceUpdatedNotificationParamsSchema}),PromptArgumentSchema=object$1({name:string$3(),description:optional$1(string$3()),required:optional$1(boolean$3())}),PromptSchema=object$1({...BaseMetadataSchema.shape,...IconsSchema.shape,description:optional$1(string$3()),arguments:optional$1(array$1(PromptArgumentSchema)),_meta:optional$1(looseObject$1({}))}),ListPromptsRequestSchema=PaginatedRequestSchema.extend({method:literal$1(`prompts/list`)}),ListPromptsResultSchema=PaginatedResultSchema.extend({prompts:array$1(PromptSchema)}),GetPromptRequestParamsSchema=BaseRequestParamsSchema.extend({name:string$3(),arguments:record$1(string$3(),string$3()).optional()}),GetPromptRequestSchema=RequestSchema.extend({method:literal$1(`prompts/get`),params:GetPromptRequestParamsSchema}),TextContentSchema=object$1({type:literal$1(`text`),text:string$3(),annotations:AnnotationsSchema.optional(),_meta:record$1(string$3(),unknown$1()).optional()}),ImageContentSchema=object$1({type:literal$1(`image`),data:Base64Schema,mimeType:string$3(),annotations:AnnotationsSchema.optional(),_meta:record$1(string$3(),unknown$1()).optional()}),AudioContentSchema=object$1({type:literal$1(`audio`),data:Base64Schema,mimeType:string$3(),annotations:AnnotationsSchema.optional(),_meta:record$1(string$3(),unknown$1()).optional()}),ToolUseContentSchema=object$1({type:literal$1(`tool_use`),name:string$3(),id:string$3(),input:record$1(string$3(),unknown$1()),_meta:record$1(string$3(),unknown$1()).optional()}),EmbeddedResourceSchema=object$1({type:literal$1(`resource`),resource:union$1([TextResourceContentsSchema,BlobResourceContentsSchema]),annotations:AnnotationsSchema.optional(),_meta:record$1(string$3(),unknown$1()).optional()}),ResourceLinkSchema=ResourceSchema.extend({type:literal$1(`resource_link`)}),ContentBlockSchema=union$1([TextContentSchema,ImageContentSchema,AudioContentSchema,ResourceLinkSchema,EmbeddedResourceSchema]),PromptMessageSchema=object$1({role:RoleSchema,content:ContentBlockSchema}),GetPromptResultSchema=ResultSchema.extend({description:string$3().optional(),messages:array$1(PromptMessageSchema)}),PromptListChangedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/prompts/list_changed`),params:NotificationsParamsSchema.optional()}),ToolAnnotationsSchema=object$1({title:string$3().optional(),readOnlyHint:boolean$3().optional(),destructiveHint:boolean$3().optional(),idempotentHint:boolean$3().optional(),openWorldHint:boolean$3().optional()}),ToolExecutionSchema=object$1({taskSupport:_enum$1([`required`,`optional`,`forbidden`]).optional()}),ToolSchema=object$1({...BaseMetadataSchema.shape,...IconsSchema.shape,description:string$3().optional(),inputSchema:object$1({type:literal$1(`object`),properties:record$1(string$3(),AssertObjectSchema).optional(),required:array$1(string$3()).optional()}).catchall(unknown$1()),outputSchema:object$1({type:literal$1(`object`),properties:record$1(string$3(),AssertObjectSchema).optional(),required:array$1(string$3()).optional()}).catchall(unknown$1()).optional(),annotations:ToolAnnotationsSchema.optional(),execution:ToolExecutionSchema.optional(),_meta:record$1(string$3(),unknown$1()).optional()}),ListToolsRequestSchema=PaginatedRequestSchema.extend({method:literal$1(`tools/list`)}),ListToolsResultSchema=PaginatedResultSchema.extend({tools:array$1(ToolSchema)}),CallToolResultSchema=ResultSchema.extend({content:array$1(ContentBlockSchema).default([]),structuredContent:record$1(string$3(),unknown$1()).optional(),isError:boolean$3().optional()}),CompatibilityCallToolResultSchema=CallToolResultSchema.or(ResultSchema.extend({toolResult:unknown$1()})),CallToolRequestParamsSchema=TaskAugmentedRequestParamsSchema.extend({name:string$3(),arguments:record$1(string$3(),unknown$1()).optional()}),CallToolRequestSchema=RequestSchema.extend({method:literal$1(`tools/call`),params:CallToolRequestParamsSchema}),ToolListChangedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/tools/list_changed`),params:NotificationsParamsSchema.optional()}),ListChangedOptionsBaseSchema=object$1({autoRefresh:boolean$3().default(!0),debounceMs:number$3().int().nonnegative().default(300)}),LoggingLevelSchema=_enum$1([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),SetLevelRequestParamsSchema=BaseRequestParamsSchema.extend({level:LoggingLevelSchema}),SetLevelRequestSchema=RequestSchema.extend({method:literal$1(`logging/setLevel`),params:SetLevelRequestParamsSchema}),LoggingMessageNotificationParamsSchema=NotificationsParamsSchema.extend({level:LoggingLevelSchema,logger:string$3().optional(),data:unknown$1()}),LoggingMessageNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/message`),params:LoggingMessageNotificationParamsSchema}),ModelHintSchema=object$1({name:string$3().optional()}),ModelPreferencesSchema=object$1({hints:array$1(ModelHintSchema).optional(),costPriority:number$3().min(0).max(1).optional(),speedPriority:number$3().min(0).max(1).optional(),intelligencePriority:number$3().min(0).max(1).optional()}),ToolChoiceSchema=object$1({mode:_enum$1([`auto`,`required`,`none`]).optional()}),ToolResultContentSchema=object$1({type:literal$1(`tool_result`),toolUseId:string$3().describe(`The unique identifier for the corresponding tool call.`),content:array$1(ContentBlockSchema).default([]),structuredContent:object$1({}).loose().optional(),isError:boolean$3().optional(),_meta:record$1(string$3(),unknown$1()).optional()}),SamplingContentSchema=discriminatedUnion$1(`type`,[TextContentSchema,ImageContentSchema,AudioContentSchema]),SamplingMessageContentBlockSchema=discriminatedUnion$1(`type`,[TextContentSchema,ImageContentSchema,AudioContentSchema,ToolUseContentSchema,ToolResultContentSchema]),SamplingMessageSchema=object$1({role:RoleSchema,content:union$1([SamplingMessageContentBlockSchema,array$1(SamplingMessageContentBlockSchema)]),_meta:record$1(string$3(),unknown$1()).optional()}),CreateMessageRequestParamsSchema=TaskAugmentedRequestParamsSchema.extend({messages:array$1(SamplingMessageSchema),modelPreferences:ModelPreferencesSchema.optional(),systemPrompt:string$3().optional(),includeContext:_enum$1([`none`,`thisServer`,`allServers`]).optional(),temperature:number$3().optional(),maxTokens:number$3().int(),stopSequences:array$1(string$3()).optional(),metadata:AssertObjectSchema.optional(),tools:array$1(ToolSchema).optional(),toolChoice:ToolChoiceSchema.optional()}),CreateMessageRequestSchema=RequestSchema.extend({method:literal$1(`sampling/createMessage`),params:CreateMessageRequestParamsSchema}),CreateMessageResultSchema=ResultSchema.extend({model:string$3(),stopReason:optional$1(_enum$1([`endTurn`,`stopSequence`,`maxTokens`]).or(string$3())),role:RoleSchema,content:SamplingContentSchema}),CreateMessageResultWithToolsSchema=ResultSchema.extend({model:string$3(),stopReason:optional$1(_enum$1([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(string$3())),role:RoleSchema,content:union$1([SamplingMessageContentBlockSchema,array$1(SamplingMessageContentBlockSchema)])}),BooleanSchemaSchema=object$1({type:literal$1(`boolean`),title:string$3().optional(),description:string$3().optional(),default:boolean$3().optional()}),StringSchemaSchema=object$1({type:literal$1(`string`),title:string$3().optional(),description:string$3().optional(),minLength:number$3().optional(),maxLength:number$3().optional(),format:_enum$1([`email`,`uri`,`date`,`date-time`]).optional(),default:string$3().optional()}),NumberSchemaSchema=object$1({type:_enum$1([`number`,`integer`]),title:string$3().optional(),description:string$3().optional(),minimum:number$3().optional(),maximum:number$3().optional(),default:number$3().optional()}),UntitledSingleSelectEnumSchemaSchema=object$1({type:literal$1(`string`),title:string$3().optional(),description:string$3().optional(),enum:array$1(string$3()),default:string$3().optional()}),TitledSingleSelectEnumSchemaSchema=object$1({type:literal$1(`string`),title:string$3().optional(),description:string$3().optional(),oneOf:array$1(object$1({const:string$3(),title:string$3()})),default:string$3().optional()}),LegacyTitledEnumSchemaSchema=object$1({type:literal$1(`string`),title:string$3().optional(),description:string$3().optional(),enum:array$1(string$3()),enumNames:array$1(string$3()).optional(),default:string$3().optional()}),SingleSelectEnumSchemaSchema=union$1([UntitledSingleSelectEnumSchemaSchema,TitledSingleSelectEnumSchemaSchema]),UntitledMultiSelectEnumSchemaSchema=object$1({type:literal$1(`array`),title:string$3().optional(),description:string$3().optional(),minItems:number$3().optional(),maxItems:number$3().optional(),items:object$1({type:literal$1(`string`),enum:array$1(string$3())}),default:array$1(string$3()).optional()}),TitledMultiSelectEnumSchemaSchema=object$1({type:literal$1(`array`),title:string$3().optional(),description:string$3().optional(),minItems:number$3().optional(),maxItems:number$3().optional(),items:object$1({anyOf:array$1(object$1({const:string$3(),title:string$3()}))}),default:array$1(string$3()).optional()}),MultiSelectEnumSchemaSchema=union$1([UntitledMultiSelectEnumSchemaSchema,TitledMultiSelectEnumSchemaSchema]),EnumSchemaSchema=union$1([LegacyTitledEnumSchemaSchema,SingleSelectEnumSchemaSchema,MultiSelectEnumSchemaSchema]),PrimitiveSchemaDefinitionSchema=union$1([EnumSchemaSchema,BooleanSchemaSchema,StringSchemaSchema,NumberSchemaSchema]),ElicitRequestFormParamsSchema=TaskAugmentedRequestParamsSchema.extend({mode:literal$1(`form`).optional(),message:string$3(),requestedSchema:object$1({type:literal$1(`object`),properties:record$1(string$3(),PrimitiveSchemaDefinitionSchema),required:array$1(string$3()).optional()})}),ElicitRequestURLParamsSchema=TaskAugmentedRequestParamsSchema.extend({mode:literal$1(`url`),message:string$3(),elicitationId:string$3(),url:string$3().url()}),ElicitRequestParamsSchema=union$1([ElicitRequestFormParamsSchema,ElicitRequestURLParamsSchema]),ElicitRequestSchema=RequestSchema.extend({method:literal$1(`elicitation/create`),params:ElicitRequestParamsSchema}),ElicitationCompleteNotificationParamsSchema=NotificationsParamsSchema.extend({elicitationId:string$3()}),ElicitationCompleteNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/elicitation/complete`),params:ElicitationCompleteNotificationParamsSchema}),ElicitResultSchema=ResultSchema.extend({action:_enum$1([`accept`,`decline`,`cancel`]),content:preprocess(e=>e===null?void 0:e,record$1(string$3(),union$1([string$3(),number$3(),boolean$3(),array$1(string$3())])).optional())}),ResourceTemplateReferenceSchema=object$1({type:literal$1(`ref/resource`),uri:string$3()}),ResourceReferenceSchema=ResourceTemplateReferenceSchema,PromptReferenceSchema=object$1({type:literal$1(`ref/prompt`),name:string$3()}),CompleteRequestParamsSchema=BaseRequestParamsSchema.extend({ref:union$1([PromptReferenceSchema,ResourceTemplateReferenceSchema]),argument:object$1({name:string$3(),value:string$3()}),context:object$1({arguments:record$1(string$3(),string$3()).optional()}).optional()}),CompleteRequestSchema=RequestSchema.extend({method:literal$1(`completion/complete`),params:CompleteRequestParamsSchema});function assertCompleteRequestPrompt(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function assertCompleteRequestResourceTemplate(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const CompleteResultSchema=ResultSchema.extend({completion:looseObject$1({values:array$1(string$3()).max(100),total:optional$1(number$3().int()),hasMore:optional$1(boolean$3())})}),RootSchema=object$1({uri:string$3().startsWith(`file://`),name:string$3().optional(),_meta:record$1(string$3(),unknown$1()).optional()}),ListRootsRequestSchema=RequestSchema.extend({method:literal$1(`roots/list`),params:BaseRequestParamsSchema.optional()}),ListRootsResultSchema=ResultSchema.extend({roots:array$1(RootSchema)}),RootsListChangedNotificationSchema=NotificationSchema.extend({method:literal$1(`notifications/roots/list_changed`),params:NotificationsParamsSchema.optional()}),ClientRequestSchema=union$1([PingRequestSchema,InitializeRequestSchema,CompleteRequestSchema,SetLevelRequestSchema,GetPromptRequestSchema,ListPromptsRequestSchema,ListResourcesRequestSchema,ListResourceTemplatesRequestSchema,ReadResourceRequestSchema,SubscribeRequestSchema,UnsubscribeRequestSchema,CallToolRequestSchema,ListToolsRequestSchema,GetTaskRequestSchema,GetTaskPayloadRequestSchema,ListTasksRequestSchema,CancelTaskRequestSchema]),ClientNotificationSchema=union$1([CancelledNotificationSchema,ProgressNotificationSchema,InitializedNotificationSchema,RootsListChangedNotificationSchema,TaskStatusNotificationSchema]),ClientResultSchema=union$1([EmptyResultSchema,CreateMessageResultSchema,CreateMessageResultWithToolsSchema,ElicitResultSchema,ListRootsResultSchema,GetTaskResultSchema,ListTasksResultSchema,CreateTaskResultSchema]),ServerRequestSchema=union$1([PingRequestSchema,CreateMessageRequestSchema,ElicitRequestSchema,ListRootsRequestSchema,GetTaskRequestSchema,GetTaskPayloadRequestSchema,ListTasksRequestSchema,CancelTaskRequestSchema]),ServerNotificationSchema=union$1([CancelledNotificationSchema,ProgressNotificationSchema,LoggingMessageNotificationSchema,ResourceUpdatedNotificationSchema,ResourceListChangedNotificationSchema,ToolListChangedNotificationSchema,PromptListChangedNotificationSchema,TaskStatusNotificationSchema,ElicitationCompleteNotificationSchema]),ServerResultSchema=union$1([EmptyResultSchema,InitializeResultSchema,CompleteResultSchema,GetPromptResultSchema,ListPromptsResultSchema,ListResourcesResultSchema,ListResourceTemplatesResultSchema,ReadResourceResultSchema,CallToolResultSchema,ListToolsResultSchema,GetTaskResultSchema,ListTasksResultSchema,CreateTaskResultSchema]);var McpError=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===ErrorCode.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new UrlElicitationRequiredError(e.elicitations,n)}return new e(t,n,r)}},UrlElicitationRequiredError=class extends McpError{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(ErrorCode.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};const SafeUrlSchema=url$1().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ZodIssueCode$1.custom,message:`URL must be parseable`,fatal:!0}),NEVER$1}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),OAuthProtectedResourceMetadataSchema=looseObject$1({resource:string$3().url(),authorization_servers:array$1(SafeUrlSchema).optional(),jwks_uri:string$3().url().optional(),scopes_supported:array$1(string$3()).optional(),bearer_methods_supported:array$1(string$3()).optional(),resource_signing_alg_values_supported:array$1(string$3()).optional(),resource_name:string$3().optional(),resource_documentation:string$3().optional(),resource_policy_uri:string$3().url().optional(),resource_tos_uri:string$3().url().optional(),tls_client_certificate_bound_access_tokens:boolean$3().optional(),authorization_details_types_supported:array$1(string$3()).optional(),dpop_signing_alg_values_supported:array$1(string$3()).optional(),dpop_bound_access_tokens_required:boolean$3().optional()}),OAuthMetadataSchema=looseObject$1({issuer:string$3(),authorization_endpoint:SafeUrlSchema,token_endpoint:SafeUrlSchema,registration_endpoint:SafeUrlSchema.optional(),scopes_supported:array$1(string$3()).optional(),response_types_supported:array$1(string$3()),response_modes_supported:array$1(string$3()).optional(),grant_types_supported:array$1(string$3()).optional(),token_endpoint_auth_methods_supported:array$1(string$3()).optional(),token_endpoint_auth_signing_alg_values_supported:array$1(string$3()).optional(),service_documentation:SafeUrlSchema.optional(),revocation_endpoint:SafeUrlSchema.optional(),revocation_endpoint_auth_methods_supported:array$1(string$3()).optional(),revocation_endpoint_auth_signing_alg_values_supported:array$1(string$3()).optional(),introspection_endpoint:string$3().optional(),introspection_endpoint_auth_methods_supported:array$1(string$3()).optional(),introspection_endpoint_auth_signing_alg_values_supported:array$1(string$3()).optional(),code_challenge_methods_supported:array$1(string$3()).optional(),client_id_metadata_document_supported:boolean$3().optional()}),OpenIdProviderMetadataSchema=looseObject$1({issuer:string$3(),authorization_endpoint:SafeUrlSchema,token_endpoint:SafeUrlSchema,userinfo_endpoint:SafeUrlSchema.optional(),jwks_uri:SafeUrlSchema,registration_endpoint:SafeUrlSchema.optional(),scopes_supported:array$1(string$3()).optional(),response_types_supported:array$1(string$3()),response_modes_supported:array$1(string$3()).optional(),grant_types_supported:array$1(string$3()).optional(),acr_values_supported:array$1(string$3()).optional(),subject_types_supported:array$1(string$3()),id_token_signing_alg_values_supported:array$1(string$3()),id_token_encryption_alg_values_supported:array$1(string$3()).optional(),id_token_encryption_enc_values_supported:array$1(string$3()).optional(),userinfo_signing_alg_values_supported:array$1(string$3()).optional(),userinfo_encryption_alg_values_supported:array$1(string$3()).optional(),userinfo_encryption_enc_values_supported:array$1(string$3()).optional(),request_object_signing_alg_values_supported:array$1(string$3()).optional(),request_object_encryption_alg_values_supported:array$1(string$3()).optional(),request_object_encryption_enc_values_supported:array$1(string$3()).optional(),token_endpoint_auth_methods_supported:array$1(string$3()).optional(),token_endpoint_auth_signing_alg_values_supported:array$1(string$3()).optional(),display_values_supported:array$1(string$3()).optional(),claim_types_supported:array$1(string$3()).optional(),claims_supported:array$1(string$3()).optional(),service_documentation:string$3().optional(),claims_locales_supported:array$1(string$3()).optional(),ui_locales_supported:array$1(string$3()).optional(),claims_parameter_supported:boolean$3().optional(),request_parameter_supported:boolean$3().optional(),request_uri_parameter_supported:boolean$3().optional(),require_request_uri_registration:boolean$3().optional(),op_policy_uri:SafeUrlSchema.optional(),op_tos_uri:SafeUrlSchema.optional(),client_id_metadata_document_supported:boolean$3().optional()}),OpenIdProviderDiscoveryMetadataSchema=object$1({...OpenIdProviderMetadataSchema.shape,...OAuthMetadataSchema.pick({code_challenge_methods_supported:!0}).shape}),OAuthTokensSchema=object$1({access_token:string$3(),id_token:string$3().optional(),token_type:string$3(),expires_in:number$2().optional(),scope:string$3().optional(),refresh_token:string$3().optional()}).strip(),OAuthErrorResponseSchema=object$1({error:string$3(),error_description:string$3().optional(),error_uri:string$3().optional()}),OptionalSafeUrlSchema=SafeUrlSchema.optional().or(literal$1(``).transform(()=>void 0)),OAuthClientMetadataSchema=object$1({redirect_uris:array$1(SafeUrlSchema),token_endpoint_auth_method:string$3().optional(),grant_types:array$1(string$3()).optional(),response_types:array$1(string$3()).optional(),client_name:string$3().optional(),client_uri:SafeUrlSchema.optional(),logo_uri:OptionalSafeUrlSchema,scope:string$3().optional(),contacts:array$1(string$3()).optional(),tos_uri:OptionalSafeUrlSchema,policy_uri:string$3().optional(),jwks_uri:SafeUrlSchema.optional(),jwks:any$1().optional(),software_id:string$3().optional(),software_version:string$3().optional(),software_statement:string$3().optional()}).strip(),OAuthClientInformationSchema=object$1({client_id:string$3(),client_secret:string$3().optional(),client_id_issued_at:number$3().optional(),client_secret_expires_at:number$3().optional()}).strip(),OAuthClientInformationFullSchema=OAuthClientMetadataSchema.merge(OAuthClientInformationSchema),OAuthClientRegistrationErrorSchema=object$1({error:string$3(),error_description:string$3().optional()}).strip(),OAuthTokenRevocationRequestSchema=object$1({token:string$3(),token_type_hint:string$3().optional()}).strip();function resourceUrlFromServerUrl(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function checkResourceAllowed({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var OAuthError=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},InvalidRequestError=class extends OAuthError{};InvalidRequestError.errorCode=`invalid_request`;var InvalidClientError=class extends OAuthError{};InvalidClientError.errorCode=`invalid_client`;var InvalidGrantError=class extends OAuthError{};InvalidGrantError.errorCode=`invalid_grant`;var UnauthorizedClientError=class extends OAuthError{};UnauthorizedClientError.errorCode=`unauthorized_client`;var UnsupportedGrantTypeError=class extends OAuthError{};UnsupportedGrantTypeError.errorCode=`unsupported_grant_type`;var InvalidScopeError=class extends OAuthError{};InvalidScopeError.errorCode=`invalid_scope`;var AccessDeniedError=class extends OAuthError{};AccessDeniedError.errorCode=`access_denied`;var ServerError=class extends OAuthError{};ServerError.errorCode=`server_error`;var TemporarilyUnavailableError=class extends OAuthError{};TemporarilyUnavailableError.errorCode=`temporarily_unavailable`;var UnsupportedResponseTypeError=class extends OAuthError{};UnsupportedResponseTypeError.errorCode=`unsupported_response_type`;var UnsupportedTokenTypeError=class extends OAuthError{};UnsupportedTokenTypeError.errorCode=`unsupported_token_type`;var InvalidTokenError=class extends OAuthError{};InvalidTokenError.errorCode=`invalid_token`;var MethodNotAllowedError=class extends OAuthError{};MethodNotAllowedError.errorCode=`method_not_allowed`;var TooManyRequestsError=class extends OAuthError{};TooManyRequestsError.errorCode=`too_many_requests`;var InvalidClientMetadataError=class extends OAuthError{};InvalidClientMetadataError.errorCode=`invalid_client_metadata`;var InsufficientScopeError=class extends OAuthError{};InsufficientScopeError.errorCode=`insufficient_scope`;var InvalidTargetError=class extends OAuthError{};InvalidTargetError.errorCode=`invalid_target`;var CustomOAuthError=class extends OAuthError{constructor(e,t,n){super(t,n),this.customErrorCode=e}get errorCode(){return this.customErrorCode}};const OAUTH_ERRORS={[InvalidRequestError.errorCode]:InvalidRequestError,[InvalidClientError.errorCode]:InvalidClientError,[InvalidGrantError.errorCode]:InvalidGrantError,[UnauthorizedClientError.errorCode]:UnauthorizedClientError,[UnsupportedGrantTypeError.errorCode]:UnsupportedGrantTypeError,[InvalidScopeError.errorCode]:InvalidScopeError,[AccessDeniedError.errorCode]:AccessDeniedError,[ServerError.errorCode]:ServerError,[TemporarilyUnavailableError.errorCode]:TemporarilyUnavailableError,[UnsupportedResponseTypeError.errorCode]:UnsupportedResponseTypeError,[UnsupportedTokenTypeError.errorCode]:UnsupportedTokenTypeError,[InvalidTokenError.errorCode]:InvalidTokenError,[MethodNotAllowedError.errorCode]:MethodNotAllowedError,[TooManyRequestsError.errorCode]:TooManyRequestsError,[InvalidClientMetadataError.errorCode]:InvalidClientMetadataError,[InsufficientScopeError.errorCode]:InsufficientScopeError,[InvalidTargetError.errorCode]:InvalidTargetError};var UnauthorizedError=class extends Error{constructor(e){super(e??`Unauthorized`)}};function isClientAuthMethod(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}const AUTHORIZATION_CODE_RESPONSE_TYPE=`code`,AUTHORIZATION_CODE_CHALLENGE_METHOD=`S256`;function selectClientAuthMethod(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&isClientAuthMethod(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?`client_secret_basic`:`none`:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function applyClientAuthentication(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:applyBasicAuth(i,a,n);return;case`client_secret_post`:applyPostAuth(i,a,r);return;case`none`:applyPublicAuth(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function applyBasicAuth(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function applyPostAuth(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function applyPublicAuth(e,t){t.set(`client_id`,e)}async function parseErrorResponse(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=OAuthErrorResponseSchema.parse(JSON.parse(n));return new(OAUTH_ERRORS[e]||ServerError)(t||``,r)}catch(e){return new ServerError(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function auth(e,t){try{return await authInternal(e,t)}catch(n){if(n instanceof InvalidClientError||n instanceof UnauthorizedClientError)return await e.invalidateCredentials?.(`all`),await authInternal(e,t);if(n instanceof InvalidGrantError)return await e.invalidateCredentials?.(`tokens`),await authInternal(e,t);throw n}}async function authInternal(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await discoverAuthorizationServerMetadata(c,{fetchFn:a}),!s)try{s=await discoverOAuthProtectedResourceMetadata(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await discoverOAuthServerInfo(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await selectResourceURL(t,e,s),f=r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,p=await Promise.resolve(e.clientInformation());if(!p){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!isHttpsUrl(r))throw new InvalidClientMetadataError(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)p={client_id:r},await e.saveClientInformation?.(p);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await registerClient(c,{metadata:l,clientMetadata:e.clientMetadata,scope:f,fetchFn:a});await e.saveClientInformation(t),p=t}}let m=!e.redirectUrl;if(n!==void 0||m){let t=await fetchToken(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let h=await e.tokens();if(h?.refresh_token)try{let t=await refreshAuthorization(c,{metadata:l,clientInformation:p,refreshToken:h.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof OAuthError)||e instanceof ServerError))throw e}let g=e.state?await e.state():void 0,{authorizationUrl:_,codeVerifier:v}=await startAuthorization(c,{metadata:l,clientInformation:p,state:g,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(_),`REDIRECT`}function isHttpsUrl(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function selectResourceURL(e,t,n){let r=resourceUrlFromServerUrl(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!checkResourceAllowed({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function extractWWWAuthenticateParams(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=extractFieldFromWwwAuth(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=extractFieldFromWwwAuth(e,`scope`)||void 0,s=extractFieldFromWwwAuth(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function extractFieldFromWwwAuth(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}function extractResourceMetadataUrl(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return;let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return;let i=/resource_metadata="([^"]*)"/.exec(t);if(i)try{return new URL(i[1])}catch{return}}async function discoverOAuthProtectedResourceMetadata(e,t,n=fetch){let r=await discoverMetadataWithFallback(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return OAuthProtectedResourceMetadataSchema.parse(await r.json())}async function fetchWithCorsRetry(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?fetchWithCorsRetry(e,void 0,n):void 0;throw r}}function buildWellKnownPath(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function tryMetadataDiscovery(e,t,n=fetch){return await fetchWithCorsRetry(e,{"MCP-Protocol-Version":t},n)}function shouldAttemptFallback(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function discoverMetadataWithFallback(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??LATEST_PROTOCOL_VERSION,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=buildWellKnownPath(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await tryMetadataDiscovery(o,a,n);return!r?.metadataUrl&&shouldAttemptFallback(s,i.pathname)&&(s=await tryMetadataDiscovery(new URL(`/.well-known/${t}`,i),a,n)),s}async function discoverOAuthMetadata(e,{authorizationServerUrl:t,protocolVersion:n}={},r=fetch){typeof e==`string`&&(e=new URL(e)),t||=e,typeof t==`string`&&(t=new URL(t)),n??=LATEST_PROTOCOL_VERSION;let i=await discoverMetadataWithFallback(t,`oauth-authorization-server`,r,{protocolVersion:n,metadataServerUrl:t});if(!i||i.status===404){await i?.body?.cancel();return}if(!i.ok)throw await i.body?.cancel(),Error(`HTTP ${i.status} trying to load well-known OAuth metadata`);return OAuthMetadataSchema.parse(await i.json())}function buildDiscoveryUrls(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function discoverAuthorizationServerMetadata(e,{fetchFn:t=fetch,protocolVersion:n=LATEST_PROTOCOL_VERSION}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=buildDiscoveryUrls(e);for(let{url:e,type:n}of i){let i=await fetchWithCorsRetry(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?OAuthMetadataSchema.parse(await i.json()):OpenIdProviderDiscoveryMetadataSchema.parse(await i.json())}}}async function discoverOAuthServerInfo(e,t){let n,r;try{n=await discoverOAuthProtectedResourceMetadata(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await discoverAuthorizationServerMetadata(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function startAuthorization(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(AUTHORIZATION_CODE_RESPONSE_TYPE))throw Error(`Incompatible auth server: does not support response type ${AUTHORIZATION_CODE_RESPONSE_TYPE}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(AUTHORIZATION_CODE_CHALLENGE_METHOD))throw Error(`Incompatible auth server: does not support code challenge method ${AUTHORIZATION_CODE_CHALLENGE_METHOD}`)}else s=new URL(`/authorize`,e);let c=await pkceChallenge(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,AUTHORIZATION_CODE_RESPONSE_TYPE),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,AUTHORIZATION_CODE_CHALLENGE_METHOD),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function prepareAuthorizationCodeRequest(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function executeTokenRequest(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&applyClientAuthentication(selectClientAuthMethod(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await parseErrorResponse(l);return OAuthTokensSchema.parse(await l.json())}async function exchangeAuthorization(e,{metadata:t,clientInformation:n,authorizationCode:r,codeVerifier:i,redirectUri:a,resource:o,addClientAuthentication:s,fetchFn:c}){return executeTokenRequest(e,{metadata:t,tokenRequestParams:prepareAuthorizationCodeRequest(r,i,a),clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:c})}async function refreshAuthorization(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await executeTokenRequest(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function fetchToken(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=prepareAuthorizationCodeRequest(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return executeTokenRequest(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function registerClient(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,...r===void 0?{}:{scope:r}})});if(!o.ok)throw await parseErrorResponse(o);return OAuthClientInformationFullSchema.parse(await o.json())}const AUTH_STATUSES=new Set([401,403]),OFFLINE_PATTERNS=[`fetch failed`,`econnrefused`,`connection refused`,`connection closed`,`connection reset`,`socket hang up`,`connect timeout`,`network is unreachable`,`timed out`,`timeout`,`timeout after`,`getaddrinfo`,`enotfound`,`enoent`,`eai_again`,`econnaborted`,`ehostunreach`,`no such host`,`failed to start`,`spawn enoent`],HTTP_STATUS_FALLBACK=/\bhttps?:\/\/[^\s]+(?:\s+returned\s+)?(?:status|code)?\s*(\d{3})\b/i,STATUS_DIRECT_PATTERN=/\b(?:status(?:\s+code)?|http(?:\s+(?:status|code|error))?)[:\s]*(\d{3})\b/i,STDIO_EXIT_PATTERN=/exit(?:ed)?(?:\s+with)?(?:\s+(?:code|status))\s+(-?\d+)/i,STDIO_SIGNAL_PATTERN=/signal\s+([A-Z0-9]+)/i;function analyzeConnectionError(e){let t=extractMessage(e);if(e instanceof UnauthorizedError)return{kind:`auth`,rawMessage:t};let n=extractStdioExit(t);if(n)return{kind:`stdio-exit`,rawMessage:t,...n};let r=extractErrorCode(e)??extractStatusCode(t),i=t.toLowerCase();return AUTH_STATUSES.has(r??-1)||containsAuthToken(i)?{kind:`auth`,rawMessage:t,statusCode:r}:r&&r>=400?{kind:`http`,rawMessage:t,statusCode:r}:OFFLINE_PATTERNS.some(e=>i.includes(e))?{kind:`offline`,rawMessage:t}:{kind:`other`,rawMessage:t}}function isAuthIssue(e){return e.kind===`auth`}function extractMessage(e){if(e instanceof Error)return e.message??``;if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return``}}function extractErrorCode(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`number`&&Number.isFinite(t)&&t>=100&&t<600)return t}}function extractStatusCode(e){let t=[e.match(/status code\s*\((\d{3})\)/i)?.[1],e.match(STATUS_DIRECT_PATTERN)?.[1],e.match(HTTP_STATUS_FALLBACK)?.[1]].filter(Boolean);for(let e of t){let t=Number.parseInt(e,10);if(Number.isFinite(t))return t}let n=e.trim();if(n.startsWith(`{`))try{let e=findStatusInObject(JSON.parse(n));if(typeof e==`number`)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isFinite(t))return t}}catch{}}function containsAuthToken(e){return e.includes(`401`)||e.includes(`unauthorized`)||e.includes(`invalid_token`)||e.includes(`forbidden`)}function extractStdioExit(e){if(!e.toLowerCase().includes(`stdio`)&&!STDIO_EXIT_PATTERN.test(e))return;let t=e.match(STDIO_EXIT_PATTERN),n=e.match(STDIO_SIGNAL_PATTERN);if(!t&&!n)return;let r=t?Number.parseInt(t[1]??``,10):void 0;return{stdioExitCode:Number.isFinite(r)?r:void 0,stdioSignal:n?.[1]}}function findStatusInObject(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.status==`number`||typeof t.status==`string`)return t.status;if(typeof t.code==`number`||typeof t.code==`string`)return t.code;if(typeof t.error==`object`&&t.error!==null)return findStatusInObject(t.error)}function extractEnvelope(e){if(!e||typeof e!=`object`)return{content:null,structuredContent:null};let t=e,n=null,r=null;if(`content`in t&&Array.isArray(t.content)&&(n=t.content),`structuredContent`in t&&(r=t.structuredContent),`raw`in t&&t.raw&&typeof t.raw==`object`){let e=t.raw;!n&&`content`in e&&Array.isArray(e.content)&&(n=e.content),r===null&&`structuredContent`in e&&(r=e.structuredContent)}return{content:n,structuredContent:r}}function asString(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`text`in e){let t=e.text;return typeof t==`string`?t:null}return null}function collectCallContent(e){let t=extractEnvelope(e),n=[],r=[],i=[],a=[];if(!t.content)return{content:t.content,structuredContent:t.structuredContent,textEntries:n,markdownEntries:r,jsonCandidates:i,images:a};for(let e of t.content){if(typeof e==`string`){let t=tryParseJson(e);t!==null&&i.push(t);continue}if(!e||typeof e!=`object`||!(`type`in e))continue;let t=e;if(t.type===`json`){let t=tryParseJson(e);t!==null&&i.push(t);continue}if(t.type===`image`){let e=t.data,n=t.mimeType??`image/png`;typeof e==`string`&&typeof n==`string`&&a.push({data:e,mimeType:n});continue}if(t.type===`resource`){let e=t.resource;if(e&&typeof e==`object`){let t=typeof e.uri==`string`?e.uri:``,a=typeof e.mimeType==`string`?e.mimeType:``;if(typeof e.text==`string`){n.push(e.text),a.toLowerCase().includes(`markdown`)&&r.push(e.text);let t=tryParseJson(e.text);t!==null&&i.push(t)}else typeof e.blob==`string`&&n.push(`[Binary resource: ${t}]`)}continue}if(t.type!==`text`&&t.type!==`markdown`)continue;let o=asString(e);if(!o)continue;n.push(o),t.type===`markdown`&&r.push(o);let s=tryParseJson(o);s!==null&&i.push(s)}return{content:t.content,structuredContent:t.structuredContent,textEntries:n,markdownEntries:r,jsonCandidates:i,images:a}}function collectText(e,t){return e.length===0?null:e.join(t)}function collectImages(e){return e.length===0?null:e}function unwrapJsonEnvelope(e,t){return`json`in e?e.json??null:`data`in e?Object.keys(e).length===1?e.data??null:t:null}function parseStructuredContent(e){return e==null?null:typeof e==`string`?tryParseJson(e):typeof e==`object`?unwrapJsonEnvelope(e,e)??e:null}function tryParseJson(e){if(e==null)return null;if(typeof e==`object`){let t=unwrapJsonEnvelope(e,e);if(t!==null)return t}if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return null}function createCallResult(e){let t,n=()=>t||(t=collectCallContent(e),t);return{raw:e,text(t=`
90
+ `){if(e==null)return null;if(typeof e==`string`)return e;let r=n();return collectText(r.textEntries,t)||asString(r.structuredContent)},markdown(e=`
91
+ `){let t=n(),r=t.structuredContent;if(r&&typeof r==`object`){let e=r.markdown;if(typeof e==`string`)return e}return collectText(t.markdownEntries,e)},json(){let t=n(),r=parseStructuredContent(t.structuredContent);if(r!==null)return r;if(t.jsonCandidates.length===1)return t.jsonCandidates[0];if(t.jsonCandidates.length>1)return t.jsonCandidates;if(typeof e==`string`){let t=tryParseJson(e);if(t!==null)return t}let i=this.text?.();if(typeof i==`string`){let e=tryParseJson(i);if(e!==null)return e}let a=this.markdown?.();if(typeof a==`string`){let e=tryParseJson(a);if(e!==null)return e}return null},images(){return collectImages(n().images)},content(){return n().content},structuredContent(){return n().structuredContent}}}function describeConnectionIssue(e){return analyzeConnectionError(e)}function wrapCallResult(e){return{raw:e,callResult:createCallResult(e)}}const LOG_LEVEL_ORDER={debug:10,info:20,warn:30,error:40},LOG_LEVEL_ALIASES={warning:`warn`,verbose:`debug`};function parseLogLevel(e,t=`warn`){if(!e)return t;let n=e.trim().toLowerCase();if(!n)return t;let r=LOG_LEVEL_ALIASES[n]??(n in LOG_LEVEL_ORDER?n:void 0);if(!r){let t=[...Object.keys(LOG_LEVEL_ORDER),...Object.keys(LOG_LEVEL_ALIASES)].filter((e,t,n)=>n.indexOf(e)===t).join(`, `);throw Error(`Invalid log level '${e}'. Expected one of: ${t}.`)}return r}function resolveLogLevelFromEnv(e=process.env,t=`warn`){try{return parseLogLevel(e.MCPORTER_LOG_LEVEL,t)}catch(n){let r=e.MCPORTER_LOG_LEVEL,i=n instanceof Error?n.message:String(n);return console.warn(`[mcporter] Ignoring invalid MCPORTER_LOG_LEVEL value '${r??``}': ${i}`),t}}function shouldLog(e,t){return LOG_LEVEL_ORDER[e]>=LOG_LEVEL_ORDER[t]}function createPrefixedConsoleLogger(e,t){let n=parseLogLevel(t),r=t=>`[${e}] ${t}`;return{debug(e){shouldLog(`debug`,n)&&console.debug(r(e))},info(e){shouldLog(`info`,n)&&console.log(r(e))},warn(e){shouldLog(`warn`,n)&&console.warn(r(e))},error(e,t){shouldLog(`error`,n)&&(console.error(r(e)),t&&console.error(t))}}}var require_windows=__commonJSMin(((e,t)=>{t.exports=a,a.sync=o;var n=require(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),require_mode=__commonJSMin(((e,t)=>{t.exports=r,r.sync=i;var n=require(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),require_isexe=__commonJSMin(((e,t)=>{var n=require(`fs`),r=process.platform===`win32`||global.TESTING_WINDOWS?require_windows():require_mode();t.exports=i,i.sync=a;function i(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){i(e,t||{},function(e,t){e?r(e):n(t)})})}r(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function a(e,t){try{return r.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),require_which=__commonJSMin(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=require(`path`),i=n?`;`:`:`,a=require_isexe(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),require_path_key=__commonJSMin(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),require_resolveCommand=__commonJSMin(((e,t)=>{let n=require(`path`),r=require_which(),i=require_path_key();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),require_escape=__commonJSMin(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),require_shebang_regex=__commonJSMin(((e,t)=>{t.exports=/^#!(.*)/})),require_shebang_command=__commonJSMin(((e,t)=>{let n=require_shebang_regex();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),require_readShebang=__commonJSMin(((e,t)=>{let n=require(`fs`),r=require_shebang_command();function i(e){let t=150,i=Buffer.alloc(150),a;try{a=n.openSync(e,`r`),n.readSync(a,i,0,150,0),n.closeSync(a)}catch{}return r(i.toString())}t.exports=i})),require_parse=__commonJSMin(((e,t)=>{let n=require(`path`),r=require_resolveCommand(),i=require_escape(),a=require_readShebang(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),require_enoent=__commonJSMin(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),require_cross_spawn=__commonJSMin(((e,t)=>{let n=require(`child_process`),r=require_parse(),i=require_enoent();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})),import_cross_spawn=__toESM(require_cross_spawn(),1),ReadBuffer=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
92
+ `);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);return this._buffer=this._buffer.subarray(e+1),deserializeMessage(t)}clear(){this._buffer=void 0}};function deserializeMessage(e){return JSONRPCMessageSchema.parse(JSON.parse(e))}function serializeMessage(e){return JSON.stringify(e)+`
93
+ `}const DEFAULT_INHERITED_ENV_VARS=node_process.default.platform===`win32`?[`APPDATA`,`HOMEDRIVE`,`HOMEPATH`,`LOCALAPPDATA`,`PATH`,`PROCESSOR_ARCHITECTURE`,`SYSTEMDRIVE`,`SYSTEMROOT`,`TEMP`,`USERNAME`,`USERPROFILE`,`PROGRAMFILES`]:[`HOME`,`LOGNAME`,`PATH`,`SHELL`,`TERM`,`USER`];function getDefaultEnvironment(){let e={};for(let t of DEFAULT_INHERITED_ENV_VARS){let n=node_process.default.env[t];n!==void 0&&(n.startsWith(`()`)||(e[t]=n))}return e}var StdioClientTransport=class{constructor(e){this._readBuffer=new ReadBuffer,this._stderrStream=null,this._serverParams=e,(e.stderr===`pipe`||e.stderr===`overlapped`)&&(this._stderrStream=new node_stream.PassThrough)}async start(){if(this._process)throw Error(`StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.`);return new Promise((e,t)=>{this._process=(0,import_cross_spawn.default)(this._serverParams.command,this._serverParams.args??[],{env:{...getDefaultEnvironment(),...this._serverParams.env},stdio:[`pipe`,`pipe`,this._serverParams.stderr??`inherit`],shell:!1,windowsHide:node_process.default.platform===`win32`,cwd:this._serverParams.cwd}),this._process.on(`error`,e=>{t(e),this.onerror?.(e)}),this._process.on(`spawn`,()=>{e()}),this._process.on(`close`,e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on(`error`,e=>{this.onerror?.(e)}),this._process.stdout?.on(`data`,e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on(`error`,e=>{this.onerror?.(e)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once(`close`,()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),e.exitCode===null){try{e.kill(`SIGTERM`)}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(e.exitCode===null)try{e.kill(`SIGKILL`)}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error(`Not connected`);let n=serializeMessage(e);this._process.stdin.write(n)?t():this._process.stdin.once(`drain`,t)})}};async function closeTransportAndWait(e,t){let n=getTransportPid(t),r=t instanceof StdioClientTransport?t._process??null:null;try{await t.close()}catch(t){e.warn(`Failed to close transport cleanly: ${t.message}`)}r&&await waitForChildClose$1(r,1e3).catch(()=>{}),n&&await ensureProcessTerminated(e,n)}function getTransportPid(e){if(e instanceof StdioClientTransport){let t=e.pid;return typeof t==`number`&&t>0?t:null}if(`pid`in e){let t=e.pid;if(typeof t==`number`&&t>0)return t}let t=e._process?.pid;return typeof t==`number`&&t>0?t:null}async function ensureProcessTerminated(e,t){await ensureProcessTreeTerminated(e,t)}async function waitForChildClose$1(e,t){if(!(e.exitCode!==null&&e.exitCode!==void 0)){await new Promise(n=>{let r=!1,i=()=>{r||(r=!0,a(),n())},a=()=>{e.removeListener(`close`,i),e.removeListener(`exit`,i),e.removeListener(`error`,i),o&&clearTimeout(o)};e.once(`close`,i),e.once(`exit`,i),e.once(`error`,i);let o;Number.isFinite(t)&&t>0&&(o=setTimeout(i,t),o.unref?.())});try{e.stdin?.end?.()}catch{}try{e.stdout?.destroy?.(),e.stdout?.removeAllListeners?.(),e.stdout?.unref?.()}catch{}try{e.stderr?.destroy?.(),e.stderr?.removeAllListeners?.(),e.stderr?.unref?.()}catch{}try{let t=e.stdio;if(Array.isArray(t)){for(let e of t)if(!(!e||typeof e!=`object`))try{e.removeAllListeners?.(),e.destroy?.(),e.end?.()}catch{}}}catch{}try{e.removeAllListeners()}catch{}try{e.unref?.()}catch{}}}function isProcessAlive(e){try{return process.kill(e,0),!0}catch{return!1}}async function ensureProcessTreeTerminated(e,t){if(!isProcessAlive(t))return;let n=await collectProcessTreePids(t);await waitForTreeExit(n,300)||(await sendSignalToTargets(n,`SIGTERM`),n=await collectProcessTreePids(t),!await waitForTreeExit(n,700)&&(n=await collectProcessTreePids(t),await sendSignalToTargets(n,`SIGKILL`),!await waitForTreeExit(n,500)&&e.warn(`Process tree rooted at pid=${t} did not exit after SIGKILL.`)))}async function sendSignalToTargets(e,t){let n=new Set;for(let r of e)n.has(r)||(n.add(r),sendSignal(r,t))}function sendSignal(e,t){try{process.kill(e,t)}catch(e){if(typeof e==`object`&&e&&`code`in e&&e.code===`ESRCH`)return;throw e}}async function listDescendantPids(e){if(!isProcessAlive(e))return[];if(process.platform===`win32`)return listDescendantPidsWindows(e);try{let{stdout:t}=await execFileAsync(`ps`,[`-eo`,`pid=,ppid=`]),n=new Map;for(let e of t.split(`
94
+ `)){let t=e.trim();if(!t)continue;let[r,i]=t.split(/\s+/,2),a=Number.parseInt(r??``,10),o=Number.parseInt(i??``,10);if(!Number.isFinite(a)||!Number.isFinite(o))continue;let s=n.get(o)??[];s.push(a),n.set(o,s)}return collectDescendantsFromChildren(e,n)}catch{return[]}}async function listDescendantPidsWindows(e){try{let t=`Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Compress`,{stdout:n}=await execFileAsync(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Compress`]),r=n.trim();if(!r)return[];let i=JSON.parse(r),a=Array.isArray(i)?i:[i],o=new Map;for(let e of a){let t=e?.ProcessId,n=e?.ParentProcessId;if(typeof t!=`number`||typeof n!=`number`)continue;let r=Number.isFinite(t)?t:void 0,i=Number.isFinite(n)?n:void 0;if(r===void 0||i===void 0)continue;let a=o.get(i)??[];a.push(r),o.set(i,a)}return collectDescendantsFromChildren(e,o)}catch{return[]}}function execFileAsync(e,t){return new Promise((n,r)=>{(0,node_child_process.execFile)(e,t,{encoding:`utf8`},(e,t,i)=>{if(e){r(e);return}n({stdout:t,stderr:i})})})}async function collectProcessTreePids(e){return[...await listDescendantPids(e),e]}function collectDescendantsFromChildren(e,t){let n=[],r=[...t.get(e)??[]],i=new Set(r);for(;r.length>0;){let e=r.shift();if(e!==void 0){n.push(e);for(let n of t.get(e)??[])i.has(n)||(i.add(n),r.push(n))}}return n}const __testHooks={listDescendantPids};async function waitForTreeExit(e,t){let n=Date.now()+t;for(;;){if(e.every(e=>!isProcessAlive(e)))return!0;if(Date.now()>=n)return!1;await delay(Math.max(10,Math.min(100,n-Date.now())))}}function delay(e){return new Promise(t=>{let n=setTimeout(t,e);typeof n.unref==`function`&&n.unref?.()})}const PROCESS_BUFFERS=new WeakMap,TRANSPORT_BUFFERS=new WeakMap,STDIO_LOGS_FORCED=process.env.MCPORTER_STDIO_LOGS===`1`,STDIO_TRACE_ENABLED$1=process.env.MCPORTER_STDIO_TRACE===`1`;let stdioLogMode=STDIO_LOGS_FORCED?`always`:`auto`;function getStdioLogMode(){return stdioLogMode}function setStdioLogMode(e){let t=stdioLogMode;return STDIO_LOGS_FORCED||(stdioLogMode=e),t}function evaluateStdioLogPolicy(e,t,n){return!t||e===`silent`?!1:e===`always`?!0:typeof n==`number`&&n!==0}function shouldPrintStdioLogs(e){return evaluateStdioLogPolicy(stdioLogMode,e.stderrChunks.length>0,e.code)}STDIO_TRACE_ENABLED$1&&console.log(`[mcporter] STDIO trace logging enabled (set MCPORTER_STDIO_TRACE=0 to disable).`);function destroyStream(e){if(!e||typeof e!=`object`)return;let t=e,n=()=>{};try{t.on?.(`error`,n)}catch{}try{t.destroy?.()}catch{}try{t.end?.()}catch{}try{t.unref?.()}catch{}try{t.off?.(`error`,n)}catch{}try{t.removeListener?.(`error`,n)}catch{}}function waitForChildClose(e,t){return!e||e.exitCode!==null&&e.exitCode!==void 0?Promise.resolve():new Promise(n=>{let r=!1,i=()=>{};try{e.on?.(`error`,i)}catch{}let a=()=>{r||(r=!0,o(),n())},o=()=>{e.removeListener(`exit`,a),e.removeListener(`close`,a),e.removeListener(`error`,a);try{e.removeListener?.(`error`,i)}catch{}s&&clearTimeout(s)};e.once(`exit`,a),e.once(`close`,a),e.once(`error`,a);let s;Number.isFinite(t)&&t>0&&(s=setTimeout(a,t),s.unref?.())})}function flushProcessLogs(e,t){if(!t.flushed){if(t.flushed=!0,STDIO_TRACE_ENABLED$1){let e=t.stderrChunks.length,n=t.stdoutChunks?.length??0,r=t.stdinChunks?.length??0,i=t.command??`stdio server`;console.log(`[mcporter] STDIO trace summary for ${i}: stdin=${r} message(s), stdout=${n} chunk(s), stderr=${e} chunk(s).`)}for(let{stream:e,event:n,handler:r}of t.listeners)try{e.removeListener?.(n,r)}catch{}if(t.listeners.length=0,shouldPrintStdioLogs(t)){let e=t.command?`[mcporter] stderr from ${t.command}`:`[mcporter] stderr from stdio server`;console.log(e),process.stdout.write(t.stderrChunks.join(``)),t.stderrChunks[t.stderrChunks.length-1]?.endsWith(`
95
+ `)||console.log(``)}if(STDIO_TRACE_ENABLED$1&&t.stdoutChunks&&t.stdoutChunks.length>0){let e=t.command?`[mcporter] stdout from ${t.command}`:`[mcporter] stdout from stdio server`;console.log(e),process.stdout.write(t.stdoutChunks.join(``)),t.stdoutChunks[t.stdoutChunks.length-1]?.endsWith(`
96
+ `)||console.log(``)}if(STDIO_TRACE_ENABLED$1&&t.stdinChunks&&t.stdinChunks.length>0){let e=t.command?`[mcporter] stdin to ${t.command}`:`[mcporter] stdin to stdio server`;console.log(e);for(let e of t.stdinChunks)console.log(e)}t.child&&PROCESS_BUFFERS.delete(t.child),t.transport&&TRANSPORT_BUFFERS.delete(t.transport)}}function patchStdioClose(){let e=Symbol.for(`mcporter.stdio.patched`),t=StdioClientTransport.prototype;t[e]||(patchStdioStart(),StdioClientTransport.prototype.close=async function(){let e=this,t=e._process??null,n=e._stderrStream??null,r=(t?PROCESS_BUFFERS.get(t):void 0)??TRANSPORT_BUFFERS.get(e);if(n&&(destroyStream(n),e._stderrStream=null),e._abortController?.abort(),e._abortController=null,e._readBuffer?.clear?.(),e._readBuffer=null,!t){e.onclose?.();return}destroyStream(t.stdin),destroyStream(t.stdout),destroyStream(t.stderr);let i=Array.isArray(t.stdio)?t.stdio:[];for(let e of i)destroyStream(e);let a=await waitForChildClose(t,700).then(()=>!0,()=>!1);if(!a){try{t.kill(`SIGTERM`)}catch{}a=await waitForChildClose(t,700).then(()=>!0,()=>!1)}if(!a){try{t.kill(`SIGKILL`)}catch{}await waitForChildClose(t,500).catch(()=>{})}destroyStream(t.stdin),destroyStream(t.stdout),destroyStream(t.stderr);let o=Array.isArray(t.stdio)?t.stdio:[];for(let e of o)destroyStream(e);t.unref?.(),r?flushProcessLogs(r.child??t,r):STDIO_TRACE_ENABLED$1&&console.log(`[mcporter] STDIO trace: attempted to close transport without recorded metadata.`),e._process=null,e.onclose?.()},t[e]=!0)}function patchStdioStart(){let e=Symbol.for(`mcporter.stdio.startPatched`),t=StdioClientTransport.prototype;if(t[e])return;let n=StdioClientTransport.prototype.start;StdioClientTransport.prototype.start=async function(){let e=this;STDIO_TRACE_ENABLED$1&&console.log(`[mcporter] STDIO trace: start() invoked for stdio transport.`),e._serverParams&&e._serverParams.stderr!==`pipe`&&(e._serverParams={...e._serverParams,stderr:`pipe`});let t=n.apply(this),r=e._process??null,i={stderrChunks:[],stdoutChunks:STDIO_TRACE_ENABLED$1?[]:void 0,stdinChunks:STDIO_TRACE_ENABLED$1?[]:void 0,command:e._serverParams?.command,code:null,listeners:[],child:r,transport:e};if(TRANSPORT_BUFFERS.set(e,i),r){if(PROCESS_BUFFERS.set(r,i),STDIO_TRACE_ENABLED$1){let e=typeof r.pid==`number`?r.pid:`unknown`;console.log(`[mcporter] STDIO trace: spawned ${i.command??`stdio server`} (pid=${e}).`)}}else STDIO_TRACE_ENABLED$1&&console.log(`[mcporter] STDIO trace: transport for ${i.command??`stdio server`} exited before spawn listeners attached.`);let a=e._stderrStream??r?.stderr??null;if(a){typeof a.setEncoding==`function`&&a.setEncoding?.(`utf8`);let e=e=>{typeof e==`string`?i.stderrChunks.push(e):Buffer.isBuffer(e)&&i.stderrChunks.push(e.toString(`utf8`))},t=()=>{};a.on(`data`,e),a.on(`error`,t),i.listeners.push({stream:a,event:`data`,handler:e}),i.listeners.push({stream:a,event:`error`,handler:t})}if(STDIO_TRACE_ENABLED$1&&r?.stdout){let e=r.stdout,t=e=>{i.stdoutChunks||=[],typeof e==`string`?i.stdoutChunks.push(e):Buffer.isBuffer(e)&&i.stdoutChunks.push(e.toString(`utf8`))},n=()=>{};e.on(`data`,t),e.on(`error`,n),i.listeners.push({stream:e,event:`data`,handler:t}),i.listeners.push({stream:e,event:`error`,handler:n})}r&&r.once(`exit`,e=>{let t=PROCESS_BUFFERS.get(r);t&&(t.code=e,flushProcessLogs(r,t))}),await t},t[e]=!0}patchStdioClose(),patchStdioSend();function patchStdioSend(){if(!STDIO_TRACE_ENABLED$1)return;let e=Symbol.for(`mcporter.stdio.sendPatched`),t=StdioClientTransport.prototype;if(t[e])return;let n=StdioClientTransport.prototype.send;StdioClientTransport.prototype.send=function(e){if(STDIO_TRACE_ENABLED$1)try{let t=this._process??null;if(t){let n=PROCESS_BUFFERS.get(t);n&&(n.stdinChunks||=[],n.stdinChunks.push(JSON.stringify(e)))}}catch{}return n.call(this,e)},t[e]=!0}const NON_FATAL_MCP_ERROR_CODES=new Set([ErrorCode.InvalidRequest,ErrorCode.MethodNotFound,ErrorCode.InvalidParams]);function shouldResetConnection(e){return e?e instanceof McpError?!NON_FATAL_MCP_ERROR_CODES.has(e.code):e instanceof Error:!1}function maybeEnableOAuth(e,t){if(e.auth!==`oauth`&&e.command.kind===`http`)return t.info(`Detected OAuth requirement for '${e.name}'. Launching browser flow...`),{...e,auth:`oauth`}}function isUnauthorizedError(e){return analyzeConnectionError(e).kind===`auth`}const DEFAULT_OAUTH_CODE_TIMEOUT_MS=6e4,OAUTH_FLOW_ERROR=Symbol(`oauth-flow-error`),POST_AUTH_CONNECT_ERROR=Symbol(`post-auth-connect-error`);var OAuthTimeoutError=class extends Error{timeoutMs;serverName;constructor(e,t){let n=Math.round(t/1e3);super(`OAuth authorization for '${e}' timed out after ${n}s; aborting.`),this.name=`OAuthTimeoutError`,this.timeoutMs=t,this.serverName=e}};function markOAuthFlowError(e){return markError(e,OAUTH_FLOW_ERROR)}function isOAuthFlowError(e){return hasErrorMarker(e,OAUTH_FLOW_ERROR)}function markPostAuthConnectError(e){return markError(e,POST_AUTH_CONNECT_ERROR)}function isPostAuthConnectError(e){return hasErrorMarker(e,POST_AUTH_CONNECT_ERROR)}function markError(e,t){return!e||typeof e!=`object`&&typeof e!=`function`||Object.defineProperty(e,t,{value:!0,enumerable:!1,configurable:!0}),e}function hasErrorMarker(e,t){return!!e&&(typeof e==`object`||typeof e==`function`)&&t in e&&!!e[t]}async function connectWithAuth(e,t,n,r,i={}){let{serverName:a,maxAttempts:o=3,oauthTimeoutMs:s=DEFAULT_OAUTH_CODE_TIMEOUT_MS,recreateTransport:c}=i,l={activeTransport:t,attempt:0,hasCompletedAuthFlow:!1};for(;;)try{return await attemptTransportConnect(e,l)}catch(e){let i=isUnauthorizedError(e);if(!shouldRetryAuthorization(l,i,n))throw await closeReplacementTransport(t,l.activeTransport),l.hasCompletedAuthFlow&&!i?markPostAuthConnectError(e):e;if(l.attempt+=1,l.attempt>o)throw await closeReplacementTransport(t,l.activeTransport),l.hasCompletedAuthFlow?markPostAuthConnectError(e):e;r.warn(`OAuth authorization required for '${a??`unknown`}'. Waiting for browser approval...`);try{l.activeTransport=await completeAuthorizationChallenge(l.activeTransport,n,r,e,{serverName:a,oauthTimeoutMs:s,recreateTransport:c}),l.hasCompletedAuthFlow=!0,r.info(`Authorization code accepted. Retrying connection...`)}catch(e){throw r.error(`OAuth authorization failed while waiting for callback.`,e),await closeReplacementTransport(t,l.activeTransport),markOAuthFlowError(e)}}}async function attemptTransportConnect(e,t){return await e.connect(t.activeTransport),t.activeTransport}function shouldRetryAuthorization(e,t,n){return!(!n||!t)}async function closeReplacementTransport(e,t){t!==e&&await t.close().catch(()=>{})}async function completeAuthorizationChallenge(e,t,n,r,i){let a=await waitForAuthorizationCodeWithTimeout(t,n,i.serverName,i.oauthTimeoutMs??DEFAULT_OAUTH_CODE_TIMEOUT_MS);if(typeof e.finishAuth!=`function`)throw n.warn(`Transport does not support finishAuth; cannot complete OAuth flow automatically.`),r;if(await e.finishAuth(a),!i.recreateTransport)return e;let o=await i.recreateTransport(e);return await e.close().catch(()=>{}),o}function waitForAuthorizationCodeWithTimeout(e,t,n,r=DEFAULT_OAUTH_CODE_TIMEOUT_MS){if(!Number.isFinite(r)||r<=0)return e.waitForAuthorizationCode();let i=n??`unknown`;return new Promise((n,a)=>{let o=setTimeout(()=>{let e=new OAuthTimeoutError(i,r);t.warn(e.message),a(e)},r);e.waitForAuthorizationCode().then(e=>{clearTimeout(o),n(e)},e=>{clearTimeout(o),a(e)})})}function parseOAuthTimeout(e){if(!e)return DEFAULT_OAUTH_CODE_TIMEOUT_MS;let t=Number.parseInt(e,10);return!Number.isFinite(t)||t<=0?DEFAULT_OAUTH_CODE_TIMEOUT_MS:t}function resolveOAuthTimeoutFromEnv(){return parseOAuthTimeout(process.env.MCPORTER_OAUTH_TIMEOUT_MS??process.env.MCPORTER_OAUTH_TIMEOUT)}var util;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(util||={});var objectUtil;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(objectUtil||={});const ZodParsedType=util.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),getParsedType=e=>{switch(typeof e){case`undefined`:return ZodParsedType.undefined;case`string`:return ZodParsedType.string;case`number`:return Number.isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case`boolean`:return ZodParsedType.boolean;case`function`:return ZodParsedType.function;case`bigint`:return ZodParsedType.bigint;case`symbol`:return ZodParsedType.symbol;case`object`:return Array.isArray(e)?ZodParsedType.array:e===null?ZodParsedType.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?ZodParsedType.promise:typeof Map<`u`&&e instanceof Map?ZodParsedType.map:typeof Set<`u`&&e instanceof Set?ZodParsedType.set:typeof Date<`u`&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var ZodError=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let n;switch(e.code){case ZodIssueCode.invalid_type:n=e.received===ZodParsedType.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:n=`Unrecognized key(s) in object: ${util.joinValues(e.keys,`, `)}`;break;case ZodIssueCode.invalid_union:n=`Invalid input`;break;case ZodIssueCode.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${util.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:n=`Invalid enum value. Expected ${util.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:n=`Invalid function arguments`;break;case ZodIssueCode.invalid_return_type:n=`Invalid function return type`;break;case ZodIssueCode.invalid_date:n=`Invalid date`;break;case ZodIssueCode.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:util.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case ZodIssueCode.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case ZodIssueCode.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case ZodIssueCode.custom:n=`Invalid input`;break;case ZodIssueCode.invalid_intersection_types:n=`Intersection results could not be merged`;break;case ZodIssueCode.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,util.assertNever(e)}return{message:n}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},EMPTY_PATH=[];function addIssueToContext(e,t){let n=getErrorMap(),r=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter(e=>!!e)});e.common.issues.push(r)}var ParseStatus=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return INVALID;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return INVALID;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const INVALID=Object.freeze({status:`aborted`}),DIRTY=e=>({status:`dirty`,value:e}),OK=e=>({status:`valid`,value:e}),isAborted=e=>e.status===`aborted`,isDirty=e=>e.status===`dirty`,isValid=e=>e.status===`valid`,isAsync=e=>typeof Promise<`u`&&e instanceof Promise;var errorUtil;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(errorUtil||={});var ParseInputLazyPath=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new ZodError(e.common.issues),this._error}}};function processCreateParams(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var ZodType=class{get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(isAsync(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};return handleResult(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return isValid(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>isValid(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},r=this._parse({data:e,path:n.path,parent:n});return handleResult(n,await(isAsync(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:ZodIssueCode.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;let emojiRegex$1;const ipv4Regex=/^(?:(?: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])$/,ipv4CidrRegex=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource=`((\\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])))`,dateRegex=RegExp(`^${dateRegexSource}$`);function timeRegexSource(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function timeRegex(e){return RegExp(`^${timeRegexSource(e)}$`)}function datetimeRegex(e){let t=`${dateRegexSource}T${timeRegexSource(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function isValidIP(e,t){return!!((t===`v4`||!t)&&ipv4Regex.test(e)||(t===`v6`||!t)&&ipv6Regex.test(e))}function isValidJWT(e,t){if(!jwtRegex.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function isValidCidr(e,t){return!!((t===`v4`||!t)&&ipv4CidrRegex.test(e)||(t===`v6`||!t)&&ipv6CidrRegex.test(e))}var ZodString=class e extends ZodType{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ZodParsedType.string){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}let t=new ParseStatus,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?addIssueToContext(n,{code:ZodIssueCode.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&addIssueToContext(n,{code:ZodIssueCode.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)emailRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`email`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)emojiRegex$1||=new RegExp(_emojiRegex,`u`),emojiRegex$1.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`emoji`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)uuidRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`uuid`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)nanoidRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`nanoid`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)cuidRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cuid`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)cuid2Regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cuid2`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)ulidRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`ulid`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`url`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`regex`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?datetimeRegex(r).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?dateRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?timeRegex(r).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?durationRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`duration`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?isValidIP(e.data,r.version)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`ip`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?isValidJWT(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`jwt`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?isValidCidr(e.data,r.version)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cidr`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?base64Regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`base64`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?base64urlRegex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`base64url`,code:ZodIssueCode.invalid_string,message:r.message}),t.dirty()):util.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...errorUtil.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...errorUtil.errToObj(t)})}nonempty(e){return this.min(1,errorUtil.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ZodString.create=e=>new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:e?.coerce??!1,...processCreateParams(e)});function floatSafeRemainder(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var ZodNumber=class e extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ZodParsedType.number){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t,n=new ParseStatus;for(let r of this._def.checks)r.kind===`int`?util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?floatSafeRemainder(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:r.message}),n.dirty()):util.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,errorUtil.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:errorUtil.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:errorUtil.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:e?.coerce||!1,...processCreateParams(e)});var ZodBigInt=class e extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ZodParsedType.bigint)return this._getInvalidInput(e);let t,n=new ParseStatus;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):util.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}gte(e,t){return this.setLimit(`min`,e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,errorUtil.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:errorUtil.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ZodBigInt.create=e=>new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:e?.coerce??!1,...processCreateParams(e)});var ZodBoolean=class extends ZodType{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ZodParsedType.boolean){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}};ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:e?.coerce||!1,...processCreateParams(e)});var ZodDate=class e extends ZodType{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ZodParsedType.date){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(Number.isNaN(e.data.getTime()))return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID;let t=new ParseStatus,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:ZodIssueCode.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):util.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};ZodDate.create=e=>new ZodDate({checks:[],coerce:e?.coerce||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});var ZodSymbol=class extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}};ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});var ZodUndefined=class extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}};ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});var ZodNull=class extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}};ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});var ZodAny=class extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}};ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});var ZodUnknown=class extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}};ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});var ZodNever=class extends ZodType{_parse(e){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}};ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});var ZodVoid=class extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}};ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});var ZodArray=class e extends ZodType{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n)))).then(e=>ParseStatus.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new ParseInputLazyPath(t,e,t.path,n)));return ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:errorUtil.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:errorUtil.toString(n)}})}nonempty(e){return this.min(1,e)}};ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});function deepPartialify(e){if(e instanceof ZodObject){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=ZodOptional.create(deepPartialify(r))}return new ZodObject({...e._def,shape:()=>t})}else if(e instanceof ZodArray)return new ZodArray({...e._def,type:deepPartialify(e.element)});else if(e instanceof ZodOptional)return ZodOptional.create(deepPartialify(e.unwrap()));else if(e instanceof ZodNullable)return ZodNullable.create(deepPartialify(e.unwrap()));else if(e instanceof ZodTuple)return ZodTuple.create(e.items.map(e=>deepPartialify(e)));else return e}var ZodObject=class e extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:util.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==ZodParsedType.object){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new ParseInputLazyPath(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ZodNever){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(addIssueToContext(n,{code:ZodIssueCode.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new ParseInputLazyPath(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ParseStatus.mergeObjectSync(t,e)):ParseStatus.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return errorUtil.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:errorUtil.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of util.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of util.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return deepPartialify(this)}partial(t){let n={};for(let e of util.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of util.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return createZodEnum(util.objectKeys(this.shape))}};ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:`strip`,catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:`strict`,catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:`strip`,catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});var ZodUnion=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new ZodError(e.ctx.common.issues));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:n}),INVALID}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new ZodError(e));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:i}),INVALID}}get options(){return this._def.options}};ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?util.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];var ZodDiscriminatedUnion=class e extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=getDiscriminator(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...processCreateParams(r)})}};function mergeValues(e,t){let n=getParsedType(e),r=getParsedType(t);if(e===t)return{valid:!0,data:e};if(n===ZodParsedType.object&&r===ZodParsedType.object){let n=util.objectKeys(t),r=util.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mergeValues(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===ZodParsedType.array&&r===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mergeValues(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===ZodParsedType.date&&r===ZodParsedType.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var ZodIntersection=class extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(isAborted(e)||isAborted(r))return INVALID;let i=mergeValues(e.value,r.value);return i.valid?((isDirty(e)||isDirty(r))&&t.dirty(),{status:t.value,value:i.data}):(addIssueToContext(n,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(n)});var ZodTuple=class e extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ZodParsedType.array)return addIssueToContext(n,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:n.parsedType}),INVALID;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),INVALID;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new ParseInputLazyPath(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>ParseStatus.mergeArray(t,e)):ParseStatus.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};var ZodRecord=class e extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ZodParsedType.object)return addIssueToContext(n,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:n.parsedType}),INVALID;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new ParseInputLazyPath(n,e,n.path,e)),value:a._parse(new ParseInputLazyPath(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,r):ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ZodType?new e({keyType:t,valueType:n,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}):new e({keyType:ZodString.create(),valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(n)})}},ZodMap=class extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ZodParsedType.map)return addIssueToContext(n,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:n.parsedType}),INVALID;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new ParseInputLazyPath(n,e,n.path,[a,`key`])),value:i._parse(new ParseInputLazyPath(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return INVALID;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return INVALID;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(n)});var ZodSet=class e extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ZodParsedType.set)return addIssueToContext(n,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:n.parsedType}),INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(addIssueToContext(n,{code:ZodIssueCode.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(addIssueToContext(n,{code:ZodIssueCode.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return INVALID;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new ParseInputLazyPath(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:errorUtil.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});var ZodFunction=class e extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function n(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter(e=>!!e),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:n}})}function r(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter(e=>!!e),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ZodPromise){let e=this;return OK(async function(...t){let o=new ZodError([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return OK(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new ZodError([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new ZodError([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ZodTuple.create(t).rest(ZodUnknown.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||ZodTuple.create([]).rest(ZodUnknown.create()),returns:n||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}},ZodLazy=class extends ZodType{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});var ZodLiteral=class extends ZodType{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}var ZodEnum=class e extends ZodType{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{expected:util.joinValues(n),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:n}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};ZodEnum.create=createZodEnum;var ZodNativeEnum=class extends ZodType{_parse(e){let t=util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ZodParsedType.string&&n.parsedType!==ZodParsedType.number){let e=util.objectValues(t);return addIssueToContext(n,{expected:util.joinValues(e),received:n.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(this._cache||=new Set(util.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=util.objectValues(t);return addIssueToContext(n,{received:n.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}};ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});var ZodPromise=class extends ZodType{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ZodParsedType.promise&&t.common.async===!1?(addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID):OK((t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});var ZodEffects=class extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{addIssueToContext(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return INVALID;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?INVALID:r.status===`dirty`||t.value===`dirty`?DIRTY(r.value):r});{if(t.value===`aborted`)return INVALID;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?INVALID:r.status===`dirty`||t.value===`dirty`?DIRTY(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?INVALID:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?INVALID:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!isValid(e))return INVALID;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>isValid(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):INVALID);util.assertNever(r)}};ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:`preprocess`,transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(n)});var ZodOptional=class extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});var ZodNullable=class extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});var ZodDefault=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...processCreateParams(t)});var ZodCatch=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...processCreateParams(t)});var ZodNaN=class extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:`valid`,value:e.data}}};ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol(`zod_brand`);var ZodBranded=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ZodPipeline=class e extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?INVALID:e.status===`dirty`?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?INVALID:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:ZodFirstPartyTypeKind.ZodPipeline})}},ZodReadonly=class extends ZodType{_parse(e){let t=this._def.innerType._parse(e),n=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(t)});function cleanParams(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function custom$1(e,t={},n){return e?ZodAny.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=cleanParams(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=cleanParams(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(ZodFirstPartyTypeKind||={});var Class$1=class{constructor(...e){}};const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom$1(t=>t instanceof e,t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:(e=>ZodString.create({...e,coerce:!0})),number:(e=>ZodNumber.create({...e,coerce:!0})),boolean:(e=>ZodBoolean.create({...e,coerce:!0})),bigint:(e=>ZodBigInt.create({...e,coerce:!0})),date:(e=>ZodDate.create({...e,coerce:!0}))},NEVER=INVALID;var external_exports$1=__exportAll({BRAND:()=>BRAND,DIRTY:()=>DIRTY,EMPTY_PATH:()=>EMPTY_PATH,INVALID:()=>INVALID,NEVER:()=>NEVER,OK:()=>OK,ParseStatus:()=>ParseStatus,Schema:()=>ZodType,ZodAny:()=>ZodAny,ZodArray:()=>ZodArray,ZodBigInt:()=>ZodBigInt,ZodBoolean:()=>ZodBoolean,ZodBranded:()=>ZodBranded,ZodCatch:()=>ZodCatch,ZodDate:()=>ZodDate,ZodDefault:()=>ZodDefault,ZodDiscriminatedUnion:()=>ZodDiscriminatedUnion,ZodEffects:()=>ZodEffects,ZodEnum:()=>ZodEnum,ZodError:()=>ZodError,ZodFirstPartyTypeKind:()=>ZodFirstPartyTypeKind,ZodFunction:()=>ZodFunction,ZodIntersection:()=>ZodIntersection,ZodIssueCode:()=>ZodIssueCode,ZodLazy:()=>ZodLazy,ZodLiteral:()=>ZodLiteral,ZodMap:()=>ZodMap,ZodNaN:()=>ZodNaN,ZodNativeEnum:()=>ZodNativeEnum,ZodNever:()=>ZodNever,ZodNull:()=>ZodNull,ZodNullable:()=>ZodNullable,ZodNumber:()=>ZodNumber,ZodObject:()=>ZodObject,ZodOptional:()=>ZodOptional,ZodParsedType:()=>ZodParsedType,ZodPipeline:()=>ZodPipeline,ZodPromise:()=>ZodPromise,ZodReadonly:()=>ZodReadonly,ZodRecord:()=>ZodRecord,ZodSchema:()=>ZodType,ZodSet:()=>ZodSet,ZodString:()=>ZodString,ZodSymbol:()=>ZodSymbol,ZodTransformer:()=>ZodEffects,ZodTuple:()=>ZodTuple,ZodType:()=>ZodType,ZodUndefined:()=>ZodUndefined,ZodUnion:()=>ZodUnion,ZodUnknown:()=>ZodUnknown,ZodVoid:()=>ZodVoid,addIssueToContext:()=>addIssueToContext,any:()=>anyType,array:()=>arrayType,bigint:()=>bigIntType,boolean:()=>booleanType,coerce:()=>coerce,custom:()=>custom$1,date:()=>dateType,datetimeRegex:()=>datetimeRegex,defaultErrorMap:()=>errorMap,discriminatedUnion:()=>discriminatedUnionType,effect:()=>effectsType,enum:()=>enumType,function:()=>functionType,getErrorMap:()=>getErrorMap,getParsedType:()=>getParsedType,instanceof:()=>instanceOfType,intersection:()=>intersectionType,isAborted:()=>isAborted,isAsync:()=>isAsync,isDirty:()=>isDirty,isValid:()=>isValid,late:()=>late,lazy:()=>lazyType,literal:()=>literalType,makeIssue:()=>makeIssue,map:()=>mapType,nan:()=>nanType,nativeEnum:()=>nativeEnumType,never:()=>neverType,null:()=>nullType,nullable:()=>nullableType,number:()=>numberType,object:()=>objectType,objectUtil:()=>objectUtil,oboolean:()=>oboolean,onumber:()=>onumber,optional:()=>optionalType,ostring:()=>ostring,pipeline:()=>pipelineType,preprocess:()=>preprocessType,promise:()=>promiseType,quotelessJson:()=>quotelessJson,record:()=>recordType,set:()=>setType,setErrorMap:()=>setErrorMap,strictObject:()=>strictObjectType,string:()=>stringType,symbol:()=>symbolType,transformer:()=>effectsType,tuple:()=>tupleType,undefined:()=>undefinedType,union:()=>unionType,unknown:()=>unknownType,util:()=>util,void:()=>voidType}),v3_default=external_exports$1;const ZodMiniType=$constructor(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);$ZodType.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>parse$3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>safeParse$2(e,t,n),e.parseAsync=async(t,n)=>parseAsync$1(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>safeParseAsync$2(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>clone(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),ZodMiniString=$constructor(`ZodMiniString`,(e,t)=>{$ZodString.init(e,t),ZodMiniType.init(e,t)});function string$1(e){return _string(ZodMiniString,e)}const ZodMiniStringFormat=$constructor(`ZodMiniStringFormat`,(e,t)=>{$ZodStringFormat.init(e,t),ZodMiniString.init(e,t)}),ZodMiniEmail=$constructor(`ZodMiniEmail`,(e,t)=>{$ZodEmail.init(e,t),ZodMiniStringFormat.init(e,t)});function email(e){return _email(ZodMiniEmail,e)}const ZodMiniGUID=$constructor(`ZodMiniGUID`,(e,t)=>{$ZodGUID.init(e,t),ZodMiniStringFormat.init(e,t)});function guid(e){return _guid(ZodMiniGUID,e)}const ZodMiniUUID=$constructor(`ZodMiniUUID`,(e,t)=>{$ZodUUID.init(e,t),ZodMiniStringFormat.init(e,t)});function uuid(e){return _uuid(ZodMiniUUID,e)}function uuidv4(e){return _uuidv4(ZodMiniUUID,e)}function uuidv6(e){return _uuidv6(ZodMiniUUID,e)}function uuidv7(e){return _uuidv7(ZodMiniUUID,e)}const ZodMiniURL=$constructor(`ZodMiniURL`,(e,t)=>{$ZodURL.init(e,t),ZodMiniStringFormat.init(e,t)});function url(e){return _url$1(ZodMiniURL,e)}function httpUrl(e){return _url$1(ZodMiniURL,{protocol:/^https?$/,hostname:domain,...normalizeParams(e)})}const ZodMiniEmoji=$constructor(`ZodMiniEmoji`,(e,t)=>{$ZodEmoji.init(e,t),ZodMiniStringFormat.init(e,t)});function emoji(e){return _emoji(ZodMiniEmoji,e)}const ZodMiniNanoID=$constructor(`ZodMiniNanoID`,(e,t)=>{$ZodNanoID.init(e,t),ZodMiniStringFormat.init(e,t)});function nanoid(e){return _nanoid(ZodMiniNanoID,e)}const ZodMiniCUID=$constructor(`ZodMiniCUID`,(e,t)=>{$ZodCUID.init(e,t),ZodMiniStringFormat.init(e,t)});function cuid(e){return _cuid(ZodMiniCUID,e)}const ZodMiniCUID2=$constructor(`ZodMiniCUID2`,(e,t)=>{$ZodCUID2.init(e,t),ZodMiniStringFormat.init(e,t)});function cuid2(e){return _cuid2(ZodMiniCUID2,e)}const ZodMiniULID=$constructor(`ZodMiniULID`,(e,t)=>{$ZodULID.init(e,t),ZodMiniStringFormat.init(e,t)});function ulid(e){return _ulid(ZodMiniULID,e)}const ZodMiniXID=$constructor(`ZodMiniXID`,(e,t)=>{$ZodXID.init(e,t),ZodMiniStringFormat.init(e,t)});function xid(e){return _xid(ZodMiniXID,e)}const ZodMiniKSUID=$constructor(`ZodMiniKSUID`,(e,t)=>{$ZodKSUID.init(e,t),ZodMiniStringFormat.init(e,t)});function ksuid(e){return _ksuid(ZodMiniKSUID,e)}const ZodMiniIPv4=$constructor(`ZodMiniIPv4`,(e,t)=>{$ZodIPv4.init(e,t),ZodMiniStringFormat.init(e,t)});function ipv4(e){return _ipv4(ZodMiniIPv4,e)}const ZodMiniIPv6=$constructor(`ZodMiniIPv6`,(e,t)=>{$ZodIPv6.init(e,t),ZodMiniStringFormat.init(e,t)});function ipv6(e){return _ipv6(ZodMiniIPv6,e)}const ZodMiniCIDRv4=$constructor(`ZodMiniCIDRv4`,(e,t)=>{$ZodCIDRv4.init(e,t),ZodMiniStringFormat.init(e,t)});function cidrv4(e){return _cidrv4(ZodMiniCIDRv4,e)}const ZodMiniCIDRv6=$constructor(`ZodMiniCIDRv6`,(e,t)=>{$ZodCIDRv6.init(e,t),ZodMiniStringFormat.init(e,t)});function cidrv6(e){return _cidrv6(ZodMiniCIDRv6,e)}const ZodMiniMAC=$constructor(`ZodMiniMAC`,(e,t)=>{$ZodMAC.init(e,t),ZodMiniStringFormat.init(e,t)});function mac(e){return _mac(ZodMiniMAC,e)}const ZodMiniBase64=$constructor(`ZodMiniBase64`,(e,t)=>{$ZodBase64.init(e,t),ZodMiniStringFormat.init(e,t)});function base64(e){return _base64(ZodMiniBase64,e)}const ZodMiniBase64URL=$constructor(`ZodMiniBase64URL`,(e,t)=>{$ZodBase64URL.init(e,t),ZodMiniStringFormat.init(e,t)});function base64url(e){return _base64url(ZodMiniBase64URL,e)}const ZodMiniE164=$constructor(`ZodMiniE164`,(e,t)=>{$ZodE164.init(e,t),ZodMiniStringFormat.init(e,t)});function e164(e){return _e164(ZodMiniE164,e)}const ZodMiniJWT=$constructor(`ZodMiniJWT`,(e,t)=>{$ZodJWT.init(e,t),ZodMiniStringFormat.init(e,t)});function jwt(e){return _jwt(ZodMiniJWT,e)}const ZodMiniCustomStringFormat=$constructor(`ZodMiniCustomStringFormat`,(e,t)=>{$ZodCustomStringFormat.init(e,t),ZodMiniStringFormat.init(e,t)});function stringFormat(e,t,n={}){return _stringFormat(ZodMiniCustomStringFormat,e,t,n)}function hostname(e){return _stringFormat(ZodMiniCustomStringFormat,`hostname`,hostname$2,e)}function hex(e){return _stringFormat(ZodMiniCustomStringFormat,`hex`,hex$2,e)}function hash(e,t){let n=`${e}_${t?.enc??`hex`}`,r=regexes_exports[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return _stringFormat(ZodMiniCustomStringFormat,n,r,t)}const ZodMiniNumber=$constructor(`ZodMiniNumber`,(e,t)=>{$ZodNumber.init(e,t),ZodMiniType.init(e,t)});function number$1(e){return _number(ZodMiniNumber,e)}const ZodMiniNumberFormat=$constructor(`ZodMiniNumberFormat`,(e,t)=>{$ZodNumberFormat.init(e,t),ZodMiniNumber.init(e,t)});function int(e){return _int(ZodMiniNumberFormat,e)}function float32(e){return _float32(ZodMiniNumberFormat,e)}function float64(e){return _float64(ZodMiniNumberFormat,e)}function int32(e){return _int32(ZodMiniNumberFormat,e)}function uint32(e){return _uint32(ZodMiniNumberFormat,e)}const ZodMiniBoolean=$constructor(`ZodMiniBoolean`,(e,t)=>{$ZodBoolean.init(e,t),ZodMiniType.init(e,t)});function boolean$1(e){return _boolean(ZodMiniBoolean,e)}const ZodMiniBigInt=$constructor(`ZodMiniBigInt`,(e,t)=>{$ZodBigInt.init(e,t),ZodMiniType.init(e,t)});function bigint$1(e){return _bigint(ZodMiniBigInt,e)}const ZodMiniBigIntFormat=$constructor(`ZodMiniBigIntFormat`,(e,t)=>{$ZodBigIntFormat.init(e,t),ZodMiniBigInt.init(e,t)});function int64(e){return _int64(ZodMiniBigIntFormat,e)}function uint64(e){return _uint64(ZodMiniBigIntFormat,e)}const ZodMiniSymbol=$constructor(`ZodMiniSymbol`,(e,t)=>{$ZodSymbol.init(e,t),ZodMiniType.init(e,t)});function symbol(e){return _symbol(ZodMiniSymbol,e)}const ZodMiniUndefined=$constructor(`ZodMiniUndefined`,(e,t)=>{$ZodUndefined.init(e,t),ZodMiniType.init(e,t)});function _undefined(e){return _undefined$2(ZodMiniUndefined,e)}const ZodMiniNull=$constructor(`ZodMiniNull`,(e,t)=>{$ZodNull.init(e,t),ZodMiniType.init(e,t)});function _null(e){return _null$2(ZodMiniNull,e)}const ZodMiniAny=$constructor(`ZodMiniAny`,(e,t)=>{$ZodAny.init(e,t),ZodMiniType.init(e,t)});function any(){return _any(ZodMiniAny)}const ZodMiniUnknown=$constructor(`ZodMiniUnknown`,(e,t)=>{$ZodUnknown.init(e,t),ZodMiniType.init(e,t)});function unknown(){return _unknown(ZodMiniUnknown)}const ZodMiniNever=$constructor(`ZodMiniNever`,(e,t)=>{$ZodNever.init(e,t),ZodMiniType.init(e,t)});function never(e){return _never(ZodMiniNever,e)}const ZodMiniVoid=$constructor(`ZodMiniVoid`,(e,t)=>{$ZodVoid.init(e,t),ZodMiniType.init(e,t)});function _void(e){return _void$2(ZodMiniVoid,e)}const ZodMiniDate=$constructor(`ZodMiniDate`,(e,t)=>{$ZodDate.init(e,t),ZodMiniType.init(e,t)});function date$2(e){return _date(ZodMiniDate,e)}const ZodMiniArray=$constructor(`ZodMiniArray`,(e,t)=>{$ZodArray.init(e,t),ZodMiniType.init(e,t)});function array(e,t){return new ZodMiniArray({type:`array`,element:e,...normalizeParams(t)})}function keyof(e){let t=e._zod.def.shape;return _enum(Object.keys(t))}const ZodMiniObject=$constructor(`ZodMiniObject`,(e,t)=>{$ZodObject.init(e,t),ZodMiniType.init(e,t),defineLazy(e,`shape`,()=>t.shape)});function object(e,t){return new ZodMiniObject({type:`object`,shape:e??{},...normalizeParams(t)})}function strictObject(e,t){return new ZodMiniObject({type:`object`,shape:e,catchall:never(),...normalizeParams(t)})}function looseObject(e,t){return new ZodMiniObject({type:`object`,shape:e,catchall:unknown(),...normalizeParams(t)})}function extend(e,t){return extend$1(e,t)}function safeExtend(e,t){return safeExtend$1(e,t)}function merge(e,t){return extend$1(e,t)}function pick(e,t){return pick$1(e,t)}function omit(e,t){return omit$1(e,t)}function partial(e,t){return partial$1(ZodMiniOptional,e,t)}function required(e,t){return required$1(ZodMiniNonOptional,e,t)}function catchall(e,t){return e.clone({...e._zod.def,catchall:t})}const ZodMiniUnion=$constructor(`ZodMiniUnion`,(e,t)=>{$ZodUnion.init(e,t),ZodMiniType.init(e,t)});function union(e,t){return new ZodMiniUnion({type:`union`,options:e,...normalizeParams(t)})}const ZodMiniXor=$constructor(`ZodMiniXor`,(e,t)=>{ZodMiniUnion.init(e,t),$ZodXor.init(e,t)});function xor(e,t){return new ZodMiniXor({type:`union`,options:e,inclusive:!1,...normalizeParams(t)})}const ZodMiniDiscriminatedUnion=$constructor(`ZodMiniDiscriminatedUnion`,(e,t)=>{$ZodDiscriminatedUnion.init(e,t),ZodMiniType.init(e,t)});function discriminatedUnion(e,t,n){return new ZodMiniDiscriminatedUnion({type:`union`,options:t,discriminator:e,...normalizeParams(n)})}const ZodMiniIntersection=$constructor(`ZodMiniIntersection`,(e,t)=>{$ZodIntersection.init(e,t),ZodMiniType.init(e,t)});function intersection(e,t){return new ZodMiniIntersection({type:`intersection`,left:e,right:t})}const ZodMiniTuple=$constructor(`ZodMiniTuple`,(e,t)=>{$ZodTuple.init(e,t),ZodMiniType.init(e,t)});function tuple(e,t,n){let r=t instanceof $ZodType;return new ZodMiniTuple({type:`tuple`,items:e,rest:r?t:null,...normalizeParams(r?n:t)})}const ZodMiniRecord=$constructor(`ZodMiniRecord`,(e,t)=>{$ZodRecord.init(e,t),ZodMiniType.init(e,t)});function record(e,t,n){return new ZodMiniRecord({type:`record`,keyType:e,valueType:t,...normalizeParams(n)})}function partialRecord(e,t,n){let r=clone(e);return r._zod.values=void 0,new ZodMiniRecord({type:`record`,keyType:r,valueType:t,...normalizeParams(n)})}function looseRecord(e,t,n){return new ZodMiniRecord({type:`record`,keyType:e,valueType:t,mode:`loose`,...normalizeParams(n)})}const ZodMiniMap=$constructor(`ZodMiniMap`,(e,t)=>{$ZodMap.init(e,t),ZodMiniType.init(e,t)});function map(e,t,n){return new ZodMiniMap({type:`map`,keyType:e,valueType:t,...normalizeParams(n)})}const ZodMiniSet=$constructor(`ZodMiniSet`,(e,t)=>{$ZodSet.init(e,t),ZodMiniType.init(e,t)});function set(e,t){return new ZodMiniSet({type:`set`,valueType:e,...normalizeParams(t)})}const ZodMiniEnum=$constructor(`ZodMiniEnum`,(e,t)=>{$ZodEnum.init(e,t),ZodMiniType.init(e,t),e.options=Object.values(t.entries)});function _enum(e,t){return new ZodMiniEnum({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...normalizeParams(t)})}function nativeEnum(e,t){return new ZodMiniEnum({type:`enum`,entries:e,...normalizeParams(t)})}const ZodMiniLiteral=$constructor(`ZodMiniLiteral`,(e,t)=>{$ZodLiteral.init(e,t),ZodMiniType.init(e,t)});function literal(e,t){return new ZodMiniLiteral({type:`literal`,values:Array.isArray(e)?e:[e],...normalizeParams(t)})}const ZodMiniFile=$constructor(`ZodMiniFile`,(e,t)=>{$ZodFile.init(e,t),ZodMiniType.init(e,t)});function file(e){return _file(ZodMiniFile,e)}const ZodMiniTransform=$constructor(`ZodMiniTransform`,(e,t)=>{$ZodTransform.init(e,t),ZodMiniType.init(e,t)});function transform(e){return new ZodMiniTransform({type:`transform`,transform:e})}const ZodMiniOptional=$constructor(`ZodMiniOptional`,(e,t)=>{$ZodOptional.init(e,t),ZodMiniType.init(e,t)});function optional(e){return new ZodMiniOptional({type:`optional`,innerType:e})}const ZodMiniExactOptional=$constructor(`ZodMiniExactOptional`,(e,t)=>{$ZodExactOptional.init(e,t),ZodMiniType.init(e,t)});function exactOptional(e){return new ZodMiniExactOptional({type:`optional`,innerType:e})}const ZodMiniNullable=$constructor(`ZodMiniNullable`,(e,t)=>{$ZodNullable.init(e,t),ZodMiniType.init(e,t)});function nullable(e){return new ZodMiniNullable({type:`nullable`,innerType:e})}function nullish(e){return optional(nullable(e))}const ZodMiniDefault=$constructor(`ZodMiniDefault`,(e,t)=>{$ZodDefault.init(e,t),ZodMiniType.init(e,t)});function _default(e,t){return new ZodMiniDefault({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():shallowClone(t)}})}const ZodMiniPrefault=$constructor(`ZodMiniPrefault`,(e,t)=>{$ZodPrefault.init(e,t),ZodMiniType.init(e,t)});function prefault(e,t){return new ZodMiniPrefault({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():shallowClone(t)}})}const ZodMiniNonOptional=$constructor(`ZodMiniNonOptional`,(e,t)=>{$ZodNonOptional.init(e,t),ZodMiniType.init(e,t)});function nonoptional(e,t){return new ZodMiniNonOptional({type:`nonoptional`,innerType:e,...normalizeParams(t)})}const ZodMiniSuccess=$constructor(`ZodMiniSuccess`,(e,t)=>{$ZodSuccess.init(e,t),ZodMiniType.init(e,t)});function success(e){return new ZodMiniSuccess({type:`success`,innerType:e})}const ZodMiniCatch=$constructor(`ZodMiniCatch`,(e,t)=>{$ZodCatch.init(e,t),ZodMiniType.init(e,t)});function _catch(e,t){return new ZodMiniCatch({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const ZodMiniNaN=$constructor(`ZodMiniNaN`,(e,t)=>{$ZodNaN.init(e,t),ZodMiniType.init(e,t)});function nan(e){return _nan(ZodMiniNaN,e)}const ZodMiniPipe=$constructor(`ZodMiniPipe`,(e,t)=>{$ZodPipe.init(e,t),ZodMiniType.init(e,t)});function pipe(e,t){return new ZodMiniPipe({type:`pipe`,in:e,out:t})}const ZodMiniCodec=$constructor(`ZodMiniCodec`,(e,t)=>{ZodMiniPipe.init(e,t),$ZodCodec.init(e,t)});function codec(e,t,n){return new ZodMiniCodec({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const ZodMiniReadonly=$constructor(`ZodMiniReadonly`,(e,t)=>{$ZodReadonly.init(e,t),ZodMiniType.init(e,t)});function readonly(e){return new ZodMiniReadonly({type:`readonly`,innerType:e})}const ZodMiniTemplateLiteral=$constructor(`ZodMiniTemplateLiteral`,(e,t)=>{$ZodTemplateLiteral.init(e,t),ZodMiniType.init(e,t)});function templateLiteral(e,t){return new ZodMiniTemplateLiteral({type:`template_literal`,parts:e,...normalizeParams(t)})}const ZodMiniLazy=$constructor(`ZodMiniLazy`,(e,t)=>{$ZodLazy.init(e,t),ZodMiniType.init(e,t)});function _lazy(e){return new ZodMiniLazy({type:`lazy`,getter:e})}const ZodMiniPromise=$constructor(`ZodMiniPromise`,(e,t)=>{$ZodPromise.init(e,t),ZodMiniType.init(e,t)});function promise(e){return new ZodMiniPromise({type:`promise`,innerType:e})}const ZodMiniCustom=$constructor(`ZodMiniCustom`,(e,t)=>{$ZodCustom.init(e,t),ZodMiniType.init(e,t)});function check(e,t){let n=new $ZodCheck({check:`custom`,...normalizeParams(t)});return n._zod.check=e,n}function custom(e,t){return _custom(ZodMiniCustom,e??(()=>!0),t)}function refine(e,t={}){return _refine(ZodMiniCustom,e,t)}function superRefine(e){return _superRefine(e)}const describe=describe$2,meta=meta$2;var Class=class{constructor(...e){}};function _instanceof(e,t={}){let n=custom(t=>t instanceof e,t);return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const stringbool=(...e)=>_stringbool({Codec:ZodMiniCodec,Boolean:ZodMiniBoolean,String:ZodMiniString},...e);function json(){let e=_lazy(()=>union([string$1(),number$1(),boolean$1(),_null(),array(e),record(string$1(),e)]));return e}const ZodMiniFunction=$constructor(`ZodMiniFunction`,(e,t)=>{$ZodFunction.init(e,t),ZodMiniType.init(e,t)});function _function(e){return new ZodMiniFunction({type:`function`,input:Array.isArray(e?.input)?tuple(e?.input):e?.input??array(unknown()),output:e?.output??unknown()})}var iso_exports=__exportAll({ZodMiniISODate:()=>ZodMiniISODate,ZodMiniISODateTime:()=>ZodMiniISODateTime,ZodMiniISODuration:()=>ZodMiniISODuration,ZodMiniISOTime:()=>ZodMiniISOTime,date:()=>date$1,datetime:()=>datetime,duration:()=>duration,time:()=>time});const ZodMiniISODateTime=$constructor(`ZodMiniISODateTime`,(e,t)=>{$ZodISODateTime.init(e,t),ZodMiniStringFormat.init(e,t)});function datetime(e){return _isoDateTime(ZodMiniISODateTime,e)}const ZodMiniISODate=$constructor(`ZodMiniISODate`,(e,t)=>{$ZodISODate.init(e,t),ZodMiniStringFormat.init(e,t)});function date$1(e){return _isoDate(ZodMiniISODate,e)}const ZodMiniISOTime=$constructor(`ZodMiniISOTime`,(e,t)=>{$ZodISOTime.init(e,t),ZodMiniStringFormat.init(e,t)});function time(e){return _isoTime(ZodMiniISOTime,e)}const ZodMiniISODuration=$constructor(`ZodMiniISODuration`,(e,t)=>{$ZodISODuration.init(e,t),ZodMiniStringFormat.init(e,t)});function duration(e){return _isoDuration(ZodMiniISODuration,e)}var coerce_exports=__exportAll({bigint:()=>bigint,boolean:()=>boolean,date:()=>date,number:()=>number,string:()=>string});function string(e){return _coercedString(ZodMiniString,e)}function number(e){return _coercedNumber(ZodMiniNumber,e)}function boolean(e){return _coercedBoolean(ZodMiniBoolean,e)}function bigint(e){return _coercedBigint(ZodMiniBigInt,e)}function date(e){return _coercedDate(ZodMiniDate,e)}var external_exports=__exportAll({$brand:()=>$brand,$input:()=>$input,$output:()=>$output,NEVER:()=>NEVER$1,TimePrecision:()=>TimePrecision,ZodMiniAny:()=>ZodMiniAny,ZodMiniArray:()=>ZodMiniArray,ZodMiniBase64:()=>ZodMiniBase64,ZodMiniBase64URL:()=>ZodMiniBase64URL,ZodMiniBigInt:()=>ZodMiniBigInt,ZodMiniBigIntFormat:()=>ZodMiniBigIntFormat,ZodMiniBoolean:()=>ZodMiniBoolean,ZodMiniCIDRv4:()=>ZodMiniCIDRv4,ZodMiniCIDRv6:()=>ZodMiniCIDRv6,ZodMiniCUID:()=>ZodMiniCUID,ZodMiniCUID2:()=>ZodMiniCUID2,ZodMiniCatch:()=>ZodMiniCatch,ZodMiniCodec:()=>ZodMiniCodec,ZodMiniCustom:()=>ZodMiniCustom,ZodMiniCustomStringFormat:()=>ZodMiniCustomStringFormat,ZodMiniDate:()=>ZodMiniDate,ZodMiniDefault:()=>ZodMiniDefault,ZodMiniDiscriminatedUnion:()=>ZodMiniDiscriminatedUnion,ZodMiniE164:()=>ZodMiniE164,ZodMiniEmail:()=>ZodMiniEmail,ZodMiniEmoji:()=>ZodMiniEmoji,ZodMiniEnum:()=>ZodMiniEnum,ZodMiniExactOptional:()=>ZodMiniExactOptional,ZodMiniFile:()=>ZodMiniFile,ZodMiniFunction:()=>ZodMiniFunction,ZodMiniGUID:()=>ZodMiniGUID,ZodMiniIPv4:()=>ZodMiniIPv4,ZodMiniIPv6:()=>ZodMiniIPv6,ZodMiniISODate:()=>ZodMiniISODate,ZodMiniISODateTime:()=>ZodMiniISODateTime,ZodMiniISODuration:()=>ZodMiniISODuration,ZodMiniISOTime:()=>ZodMiniISOTime,ZodMiniIntersection:()=>ZodMiniIntersection,ZodMiniJWT:()=>ZodMiniJWT,ZodMiniKSUID:()=>ZodMiniKSUID,ZodMiniLazy:()=>ZodMiniLazy,ZodMiniLiteral:()=>ZodMiniLiteral,ZodMiniMAC:()=>ZodMiniMAC,ZodMiniMap:()=>ZodMiniMap,ZodMiniNaN:()=>ZodMiniNaN,ZodMiniNanoID:()=>ZodMiniNanoID,ZodMiniNever:()=>ZodMiniNever,ZodMiniNonOptional:()=>ZodMiniNonOptional,ZodMiniNull:()=>ZodMiniNull,ZodMiniNullable:()=>ZodMiniNullable,ZodMiniNumber:()=>ZodMiniNumber,ZodMiniNumberFormat:()=>ZodMiniNumberFormat,ZodMiniObject:()=>ZodMiniObject,ZodMiniOptional:()=>ZodMiniOptional,ZodMiniPipe:()=>ZodMiniPipe,ZodMiniPrefault:()=>ZodMiniPrefault,ZodMiniPromise:()=>ZodMiniPromise,ZodMiniReadonly:()=>ZodMiniReadonly,ZodMiniRecord:()=>ZodMiniRecord,ZodMiniSet:()=>ZodMiniSet,ZodMiniString:()=>ZodMiniString,ZodMiniStringFormat:()=>ZodMiniStringFormat,ZodMiniSuccess:()=>ZodMiniSuccess,ZodMiniSymbol:()=>ZodMiniSymbol,ZodMiniTemplateLiteral:()=>ZodMiniTemplateLiteral,ZodMiniTransform:()=>ZodMiniTransform,ZodMiniTuple:()=>ZodMiniTuple,ZodMiniType:()=>ZodMiniType,ZodMiniULID:()=>ZodMiniULID,ZodMiniURL:()=>ZodMiniURL,ZodMiniUUID:()=>ZodMiniUUID,ZodMiniUndefined:()=>ZodMiniUndefined,ZodMiniUnion:()=>ZodMiniUnion,ZodMiniUnknown:()=>ZodMiniUnknown,ZodMiniVoid:()=>ZodMiniVoid,ZodMiniXID:()=>ZodMiniXID,ZodMiniXor:()=>ZodMiniXor,_default:()=>_default,_function:()=>_function,any:()=>any,array:()=>array,base64:()=>base64,base64url:()=>base64url,bigint:()=>bigint$1,boolean:()=>boolean$1,catch:()=>_catch,catchall:()=>catchall,check:()=>check,cidrv4:()=>cidrv4,cidrv6:()=>cidrv6,clone:()=>clone,codec:()=>codec,coerce:()=>coerce_exports,config:()=>config,core:()=>core_exports,cuid:()=>cuid,cuid2:()=>cuid2,custom:()=>custom,date:()=>date$2,decode:()=>decode$1,decodeAsync:()=>decodeAsync$1,describe:()=>describe,discriminatedUnion:()=>discriminatedUnion,e164:()=>e164,email:()=>email,emoji:()=>emoji,encode:()=>encode$1,encodeAsync:()=>encodeAsync$1,endsWith:()=>_endsWith,enum:()=>_enum,exactOptional:()=>exactOptional,extend:()=>extend,file:()=>file,flattenError:()=>flattenError$1,float32:()=>float32,float64:()=>float64,formatError:()=>formatError,function:()=>_function,globalRegistry:()=>globalRegistry,gt:()=>_gt,gte:()=>_gte,guid:()=>guid,hash:()=>hash,hex:()=>hex,hostname:()=>hostname,httpUrl:()=>httpUrl,includes:()=>_includes,instanceof:()=>_instanceof,int:()=>int,int32:()=>int32,int64:()=>int64,intersection:()=>intersection,ipv4:()=>ipv4,ipv6:()=>ipv6,iso:()=>iso_exports,json:()=>json,jwt:()=>jwt,keyof:()=>keyof,ksuid:()=>ksuid,lazy:()=>_lazy,length:()=>_length,literal:()=>literal,locales:()=>locales_exports,looseObject:()=>looseObject,looseRecord:()=>looseRecord,lowercase:()=>_lowercase,lt:()=>_lt,lte:()=>_lte,mac:()=>mac,map:()=>map,maxLength:()=>_maxLength,maxSize:()=>_maxSize,maximum:()=>_lte,merge:()=>merge,meta:()=>meta,mime:()=>_mime,minLength:()=>_minLength,minSize:()=>_minSize,minimum:()=>_gte,multipleOf:()=>_multipleOf,nan:()=>nan,nanoid:()=>nanoid,nativeEnum:()=>nativeEnum,negative:()=>_negative,never:()=>never,nonnegative:()=>_nonnegative,nonoptional:()=>nonoptional,nonpositive:()=>_nonpositive,normalize:()=>_normalize,null:()=>_null,nullable:()=>nullable,nullish:()=>nullish,number:()=>number$1,object:()=>object,omit:()=>omit,optional:()=>optional,overwrite:()=>_overwrite,parse:()=>parse$3,parseAsync:()=>parseAsync$1,partial:()=>partial,partialRecord:()=>partialRecord,pick:()=>pick,pipe:()=>pipe,positive:()=>_positive,prefault:()=>prefault,prettifyError:()=>prettifyError,promise:()=>promise,property:()=>_property,readonly:()=>readonly,record:()=>record,refine:()=>refine,regex:()=>_regex,regexes:()=>regexes_exports,registry:()=>registry,required:()=>required,safeDecode:()=>safeDecode$1,safeDecodeAsync:()=>safeDecodeAsync$1,safeEncode:()=>safeEncode$1,safeEncodeAsync:()=>safeEncodeAsync$1,safeExtend:()=>safeExtend,safeParse:()=>safeParse$2,safeParseAsync:()=>safeParseAsync$2,set:()=>set,size:()=>_size,startsWith:()=>_startsWith,strictObject:()=>strictObject,string:()=>string$1,stringFormat:()=>stringFormat,stringbool:()=>stringbool,success:()=>success,superRefine:()=>superRefine,symbol:()=>symbol,templateLiteral:()=>templateLiteral,toJSONSchema:()=>toJSONSchema,toLowerCase:()=>_toLowerCase,toUpperCase:()=>_toUpperCase,transform:()=>transform,treeifyError:()=>treeifyError,trim:()=>_trim,tuple:()=>tuple,uint32:()=>uint32,uint64:()=>uint64,ulid:()=>ulid,undefined:()=>_undefined,union:()=>union,unknown:()=>unknown,uppercase:()=>_uppercase,url:()=>url,util:()=>util_exports,uuid:()=>uuid,uuidv4:()=>uuidv4,uuidv6:()=>uuidv6,uuidv7:()=>uuidv7,void:()=>_void,xid:()=>xid,xor:()=>xor});function isZ4Schema(e){return!!e._zod}function objectFromShape(e){let t=Object.values(e);if(t.length===0)return object({});let n=t.every(isZ4Schema),r=t.every(e=>!isZ4Schema(e));if(n)return object(e);if(r)return objectType(e);throw Error(`Mixed Zod versions detected in object shape.`)}function safeParse(e,t){return isZ4Schema(e)?safeParse$2(e,t):e.safeParse(t)}async function safeParseAsync(e,t){return isZ4Schema(e)?await safeParseAsync$2(e,t):await e.safeParseAsync(t)}function getObjectShape(e){if(!e)return;let t;if(t=isZ4Schema(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function normalizeObjectSchema(e){if(e){if(typeof e==`object`){let t=e,n=e;if(!t._def&&!n._zod){let t=Object.values(e);if(t.length>0&&t.every(e=>typeof e==`object`&&!!e&&(e._def!==void 0||e._zod!==void 0||typeof e.parse==`function`)))return objectFromShape(e)}}if(isZ4Schema(e)){let t=e._zod?.def;if(t&&(t.type===`object`||t.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function getParseErrorMessage(e){if(e&&typeof e==`object`){if(`message`in e&&typeof e.message==`string`)return e.message;if(`issues`in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==`object`&&`message`in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function getSchemaDescription(e){return e.description}function isSchemaOptional(e){if(isZ4Schema(e))return e._zod?.def?.type===`optional`;let t=e;return typeof e.isOptional==`function`?e.isOptional():t._def?.typeName===`ZodOptional`}function getLiteralValue(e){if(isZ4Schema(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}function isTerminal(e){return e===`completed`||e===`failed`||e===`cancelled`}const ignoreOverride=Symbol(`Let zodToJsonSchema decide on which parser to use`),jsonDescription=(e,t)=>{if(t.description)try{return{...e,...JSON.parse(t.description)}}catch{}return e},defaultOptions={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,target:`jsonSchema7`,strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`,openAiAnyTypeName:`OpenAiAnyType`},getDefaultOptions=e=>typeof e==`string`?{...defaultOptions,name:e}:{...defaultOptions,...e},getRefs=e=>{let t=getDefaultOptions(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function addErrorMessage(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function setResponseValueAndErrors(e,t,n,r,i){e[t]=n,addErrorMessage(e,t,r,i)}const getRelativePath=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function parseAnyDef(e){if(e.target!==`openAi`)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy===`relative`?getRelativePath(t,e.currentPath):t.join(`/`)}}function parseArrayDef(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==ZodFirstPartyTypeKind.ZodAny&&(n.items=parseDef(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&setResponseValueAndErrors(n,`minItems`,e.minLength.value,e.minLength.message,t),e.maxLength&&setResponseValueAndErrors(n,`maxItems`,e.maxLength.value,e.maxLength.message,t),e.exactLength&&(setResponseValueAndErrors(n,`minItems`,e.exactLength.value,e.exactLength.message,t),setResponseValueAndErrors(n,`maxItems`,e.exactLength.value,e.exactLength.message,t)),n}function parseBigintDef(e,t){let n={type:`integer`,format:`int64`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`min`:t.target===`jsonSchema7`?r.inclusive?setResponseValueAndErrors(n,`minimum`,r.value,r.message,t):setResponseValueAndErrors(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),setResponseValueAndErrors(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?setResponseValueAndErrors(n,`maximum`,r.value,r.message,t):setResponseValueAndErrors(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),setResponseValueAndErrors(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:setResponseValueAndErrors(n,`multipleOf`,r.value,r.message,t);break}return n}function parseBooleanDef(){return{type:`boolean`}}function parseBrandedDef(e,t){return parseDef(e.type._def,t)}const parseCatchDef=(e,t)=>parseDef(e.innerType._def,t);function parseDateDef(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>parseDateDef(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return integerDateParser(e,t)}}const integerDateParser=(e,t)=>{let n={type:`integer`,format:`unix-time`};if(t.target===`openApi3`)return n;for(let r of e.checks)switch(r.kind){case`min`:setResponseValueAndErrors(n,`minimum`,r.value,r.message,t);break;case`max`:setResponseValueAndErrors(n,`maximum`,r.value,r.message,t);break}return n};function parseDefaultDef(e,t){return{...parseDef(e.innerType._def,t),default:e.defaultValue()}}function parseEffectsDef(e,t){return t.effectStrategy===`input`?parseDef(e.schema._def,t):parseAnyDef(t)}function parseEnumDef(e){return{type:`string`,enum:Array.from(e.values)}}const isJsonSchema7AllOfType=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function parseIntersectionDef(e,t){let n=[parseDef(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),parseDef(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=t.target===`jsonSchema2019-09`?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(e=>{if(isJsonSchema7AllOfType(e))i.push(...e.allOf),e.unevaluatedProperties===void 0&&(r=void 0);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}}),i.length?{allOf:i,...r}:void 0}function parseLiteralDef(e,t){let n=typeof e.value;return n!==`bigint`&&n!==`number`&&n!==`boolean`&&n!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:t.target===`openApi3`?{type:n===`bigint`?`integer`:n,enum:[e.value]}:{type:n===`bigint`?`integer`:n,const:e.value}}let emojiRegex;const zodPatterns={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(emojiRegex===void 0&&(emojiRegex=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),emojiRegex),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function parseStringDef(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:setResponseValueAndErrors(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t);break;case`max`:setResponseValueAndErrors(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`email`:switch(t.emailStrategy){case`format:email`:addFormat(n,`email`,r.message,t);break;case`format:idn-email`:addFormat(n,`idn-email`,r.message,t);break;case`pattern:zod`:addPattern(n,zodPatterns.email,r.message,t);break}break;case`url`:addFormat(n,`uri`,r.message,t);break;case`uuid`:addFormat(n,`uuid`,r.message,t);break;case`regex`:addPattern(n,r.regex,r.message,t);break;case`cuid`:addPattern(n,zodPatterns.cuid,r.message,t);break;case`cuid2`:addPattern(n,zodPatterns.cuid2,r.message,t);break;case`startsWith`:addPattern(n,RegExp(`^${escapeLiteralCheckValue(r.value,t)}`),r.message,t);break;case`endsWith`:addPattern(n,RegExp(`${escapeLiteralCheckValue(r.value,t)}$`),r.message,t);break;case`datetime`:addFormat(n,`date-time`,r.message,t);break;case`date`:addFormat(n,`date`,r.message,t);break;case`time`:addFormat(n,`time`,r.message,t);break;case`duration`:addFormat(n,`duration`,r.message,t);break;case`length`:setResponseValueAndErrors(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t),setResponseValueAndErrors(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`includes`:addPattern(n,RegExp(escapeLiteralCheckValue(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&addFormat(n,`ipv4`,r.message,t),r.version!==`v4`&&addFormat(n,`ipv6`,r.message,t);break;case`base64url`:addPattern(n,zodPatterns.base64url,r.message,t);break;case`jwt`:addPattern(n,zodPatterns.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&addPattern(n,zodPatterns.ipv4Cidr,r.message,t),r.version!==`v4`&&addPattern(n,zodPatterns.ipv6Cidr,r.message,t);break;case`emoji`:addPattern(n,zodPatterns.emoji(),r.message,t);break;case`ulid`:addPattern(n,zodPatterns.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:addFormat(n,`binary`,r.message,t);break;case`contentEncoding:base64`:setResponseValueAndErrors(n,`contentEncoding`,`base64`,r.message,t);break;case`pattern:zod`:addPattern(n,zodPatterns.base64,r.message,t);break}break;case`nanoid`:addPattern(n,zodPatterns.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:(e=>{})(r)}return n}function escapeLiteralCheckValue(e,t){return t.patternStrategy===`escape`?escapeNonAlphaNumeric(e):e}const ALPHA_NUMERIC=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function escapeNonAlphaNumeric(e){let t=``;for(let n=0;n<e.length;n++)ALPHA_NUMERIC.has(e[n])||(t+=`\\`),t+=e[n];return t}function addFormat(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):setResponseValueAndErrors(e,`format`,t,n,r)}function addPattern(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:stringifyRegExpWithFlags(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):setResponseValueAndErrors(e,`pattern`,stringifyRegExpWithFlags(t,r),n,r)}function stringifyRegExpWithFlags(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
97
+ ]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
98
+ ]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function parseRecordDef(e,t){if(t.target===`openAi`&&console.warn(`Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.`),t.target===`openApi3`&&e.keyType?._def.typeName===ZodFirstPartyTypeKind.ZodEnum)return{type:`object`,required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:parseDef(e.valueType._def,{...t,currentPath:[...t.currentPath,`properties`,r]})??parseAnyDef(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:`object`,additionalProperties:parseDef(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(t.target===`openApi3`)return n;if(e.keyType?._def.typeName===ZodFirstPartyTypeKind.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=parseStringDef(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===ZodFirstPartyTypeKind.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===ZodFirstPartyTypeKind.ZodBranded&&e.keyType._def.type._def.typeName===ZodFirstPartyTypeKind.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=parseBrandedDef(e.keyType._def,t);return{...n,propertyNames:i}}return n}function parseMapDef(e,t){return t.mapStrategy===`record`?parseRecordDef(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[parseDef(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||parseAnyDef(t),parseDef(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||parseAnyDef(t)],minItems:2,maxItems:2}}}function parseNativeEnumDef(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function parseNeverDef(e){return e.target===`openAi`?void 0:{not:parseAnyDef({...e,currentPath:[...e.currentPath,`not`]})}}function parseNullDef(e){return e.target===`openApi3`?{enum:[`null`],nullable:!0}:{type:`null`}}const primitiveMappings={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function parseUnionDef(e,t){if(t.target===`openApi3`)return asAnyOf(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in primitiveMappings&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=primitiveMappings[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return asAnyOf(e,t)}const asAnyOf=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>parseDef(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function parseNullableDef(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target===`openApi3`?{type:primitiveMappings[e.innerType._def.typeName],nullable:!0}:{type:[primitiveMappings[e.innerType._def.typeName],`null`]};if(t.target===`openApi3`){let n=parseDef(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&`$ref`in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let n=parseDef(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function parseNumberDef(e,t){let n={type:`number`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`int`:n.type=`integer`,addErrorMessage(n,`type`,r.message,t);break;case`min`:t.target===`jsonSchema7`?r.inclusive?setResponseValueAndErrors(n,`minimum`,r.value,r.message,t):setResponseValueAndErrors(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),setResponseValueAndErrors(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?setResponseValueAndErrors(n,`maximum`,r.value,r.message,t):setResponseValueAndErrors(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),setResponseValueAndErrors(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:setResponseValueAndErrors(n,`multipleOf`,r.value,r.message,t);break}return n}function parseObjectDef(e,t){let n=t.target===`openAi`,r={type:`object`,properties:{}},i=[],a=e.shape();for(let e in a){let o=a[e];if(o===void 0||o._def===void 0)continue;let s=safeIsOptional(o);s&&n&&(o._def.typeName===`ZodOptional`&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let c=parseDef(o._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});c!==void 0&&(r.properties[e]=c,s||i.push(e))}i.length&&(r.required=i);let o=decideAdditionalProperties(e,t);return o!==void 0&&(r.additionalProperties=o),r}function decideAdditionalProperties(e,t){if(e.catchall._def.typeName!==`ZodNever`)return parseDef(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function safeIsOptional(e){try{return e.isOptional()}catch{return!0}}const parseOptionalDef=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return parseDef(e.innerType._def,t);let n=parseDef(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:parseAnyDef(t)},n]}:parseAnyDef(t)},parsePipelineDef=(e,t)=>{if(t.pipeStrategy===`input`)return parseDef(e.in._def,t);if(t.pipeStrategy===`output`)return parseDef(e.out._def,t);let n=parseDef(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,parseDef(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function parsePromiseDef(e,t){return parseDef(e.type._def,t)}function parseSetDef(e,t){let n={type:`array`,uniqueItems:!0,items:parseDef(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&setResponseValueAndErrors(n,`minItems`,e.minSize.value,e.minSize.message,t),e.maxSize&&setResponseValueAndErrors(n,`maxItems`,e.maxSize.value,e.maxSize.message,t),n}function parseTupleDef(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>parseDef(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:parseDef(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>parseDef(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function parseUndefinedDef(e){return{not:parseAnyDef(e)}}function parseUnknownDef(e){return parseAnyDef(e)}const parseReadonlyDef=(e,t)=>parseDef(e.innerType._def,t),selectParser=(e,t,n)=>{switch(t){case ZodFirstPartyTypeKind.ZodString:return parseStringDef(e,n);case ZodFirstPartyTypeKind.ZodNumber:return parseNumberDef(e,n);case ZodFirstPartyTypeKind.ZodObject:return parseObjectDef(e,n);case ZodFirstPartyTypeKind.ZodBigInt:return parseBigintDef(e,n);case ZodFirstPartyTypeKind.ZodBoolean:return parseBooleanDef();case ZodFirstPartyTypeKind.ZodDate:return parseDateDef(e,n);case ZodFirstPartyTypeKind.ZodUndefined:return parseUndefinedDef(n);case ZodFirstPartyTypeKind.ZodNull:return parseNullDef(n);case ZodFirstPartyTypeKind.ZodArray:return parseArrayDef(e,n);case ZodFirstPartyTypeKind.ZodUnion:case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return parseUnionDef(e,n);case ZodFirstPartyTypeKind.ZodIntersection:return parseIntersectionDef(e,n);case ZodFirstPartyTypeKind.ZodTuple:return parseTupleDef(e,n);case ZodFirstPartyTypeKind.ZodRecord:return parseRecordDef(e,n);case ZodFirstPartyTypeKind.ZodLiteral:return parseLiteralDef(e,n);case ZodFirstPartyTypeKind.ZodEnum:return parseEnumDef(e);case ZodFirstPartyTypeKind.ZodNativeEnum:return parseNativeEnumDef(e);case ZodFirstPartyTypeKind.ZodNullable:return parseNullableDef(e,n);case ZodFirstPartyTypeKind.ZodOptional:return parseOptionalDef(e,n);case ZodFirstPartyTypeKind.ZodMap:return parseMapDef(e,n);case ZodFirstPartyTypeKind.ZodSet:return parseSetDef(e,n);case ZodFirstPartyTypeKind.ZodLazy:return()=>e.getter()._def;case ZodFirstPartyTypeKind.ZodPromise:return parsePromiseDef(e,n);case ZodFirstPartyTypeKind.ZodNaN:case ZodFirstPartyTypeKind.ZodNever:return parseNeverDef(n);case ZodFirstPartyTypeKind.ZodEffects:return parseEffectsDef(e,n);case ZodFirstPartyTypeKind.ZodAny:return parseAnyDef(n);case ZodFirstPartyTypeKind.ZodUnknown:return parseUnknownDef(n);case ZodFirstPartyTypeKind.ZodDefault:return parseDefaultDef(e,n);case ZodFirstPartyTypeKind.ZodBranded:return parseBrandedDef(e,n);case ZodFirstPartyTypeKind.ZodReadonly:return parseReadonlyDef(e,n);case ZodFirstPartyTypeKind.ZodCatch:return parseCatchDef(e,n);case ZodFirstPartyTypeKind.ZodPipeline:return parsePipelineDef(e,n);case ZodFirstPartyTypeKind.ZodFunction:case ZodFirstPartyTypeKind.ZodVoid:case ZodFirstPartyTypeKind.ZodSymbol:return;default:return(e=>void 0)(t)}};function parseDef(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==ignoreOverride)return i}if(r&&!n){let e=get$ref(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=selectParser(e,e.typeName,t),o=typeof a==`function`?parseDef(a(),t):a;if(o&&addMeta(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const get$ref=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:getRelativePath(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),parseAnyDef(t)):t.$refStrategy===`seen`?parseAnyDef(t):void 0}},addMeta=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),zodToJsonSchema=(e,t)=>{let n=getRefs(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:parseDef(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??parseAnyDef(n)}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=parseDef(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??parseAnyDef(n),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o),n.flags.hasReferencedOpenAiAnyType&&(r||={},r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:[`string`,`number`,`integer`,`boolean`,`array`,`null`],items:{$ref:n.$refStrategy===`relative`?`1`:[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join(`/`)}}));let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return n.target===`jsonSchema7`?s.$schema=`http://json-schema.org/draft-07/schema#`:(n.target===`jsonSchema2019-09`||n.target===`openAi`)&&(s.$schema=`https://json-schema.org/draft/2019-09/schema#`),n.target===`openAi`&&(`anyOf`in s||`oneOf`in s||`allOf`in s||`type`in s&&Array.isArray(s.type))&&console.warn(`Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.`),s};var esm_default=zodToJsonSchema;function mapMiniTarget(e){return!e||e===`jsonSchema7`||e===`draft-7`?`draft-7`:e===`jsonSchema2019-09`||e===`draft-2020-12`?`draft-2020-12`:`draft-7`}function toJsonSchemaCompat(e,t){return isZ4Schema(e)?toJSONSchema(e,{target:mapMiniTarget(t?.target),io:t?.pipeStrategy??`input`}):zodToJsonSchema(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??`input`})}function getMethodLiteral(e){let t=getObjectShape(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=getLiteralValue(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function parseWithCompat(e,t){let n=safeParse(e,t);if(!n.success)throw n.error;return n.data}const DEFAULT_REQUEST_TIMEOUT_MSEC=6e4;var Protocol=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(CancelledNotificationSchema,e=>{this._oncancel(e)}),this.setNotificationHandler(ProgressNotificationSchema,e=>{this._onprogress(e)}),this.setRequestHandler(PingRequestSchema,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(GetTaskRequestSchema,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new McpError(ErrorCode.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(GetTaskPayloadRequestSchema,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new McpError(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new McpError(ErrorCode.InvalidParams,`Task not found: ${r}`);if(!isTerminal(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(isTerminal(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[RELATED_TASK_META_KEY]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(ListTasksRequestSchema,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new McpError(ErrorCode.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(CancelTaskRequestSchema,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new McpError(ErrorCode.InvalidParams,`Task not found: ${e.params.taskId}`);if(isTerminal(n.status))throw new McpError(ErrorCode.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new McpError(ErrorCode.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof McpError?e:new McpError(ErrorCode.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),McpError.fromError(ErrorCode.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),isJSONRPCResultResponse(e)||isJSONRPCErrorResponse(e)?this._onresponse(e):isJSONRPCRequest(e)?this._onrequest(e,t):isJSONRPCNotification(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=McpError.fromError(ErrorCode.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:ErrorCode.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=isTaskAugmentedRequestParams(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new McpError(ErrorCode.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:ErrorCode.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),isJSONRPCResultResponse(e)?n(e):n(new McpError(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(isJSONRPCResultResponse(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),isJSONRPCResultResponse(e)?r(e):r(McpError.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof McpError?e:new McpError(ErrorCode.InternalError,String(e))}}return}let i;try{let r=await this.request(e,CreateTaskResultSchema,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new McpError(ErrorCode.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},isTerminal(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new McpError(ErrorCode.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new McpError(ErrorCode.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof McpError?e:new McpError(ErrorCode.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[RELATED_TASK_META_KEY]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof McpError?e:new McpError(ErrorCode.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=safeParse(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??DEFAULT_REQUEST_TIMEOUT_MSEC;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(McpError.fromError(ErrorCode.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},GetTaskResultSchema,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},ListTasksResultSchema,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},CancelTaskResultSchema,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[RELATED_TASK_META_KEY]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[RELATED_TASK_META_KEY]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[RELATED_TASK_META_KEY]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=getMethodLiteral(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=parseWithCompat(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=getMethodLiteral(e);this._notificationHandlers.set(n,n=>{let r=parseWithCompat(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&isJSONRPCRequest(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new McpError(ErrorCode.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new McpError(ErrorCode.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new McpError(ErrorCode.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new McpError(ErrorCode.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=TaskStatusNotificationSchema.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),isTerminal(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new McpError(ErrorCode.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(isTerminal(a.status))throw new McpError(ErrorCode.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=TaskStatusNotificationSchema.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),isTerminal(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function isPlainObject$1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mergeCapabilities(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];isPlainObject$1(a)&&isPlainObject$1(i)?n[r]={...a,...i}:n[r]=i}return n}var require_code$1=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){var e;return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){var e;return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),require_scope=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=require_code$1();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let r=this.toName(e),{prefix:i}=r,a=t.key??t.ref,o=this._values[i];if(o){let e=o.get(a);if(e)return e}else o=this._values[i]=new Map;o.set(a,r);let s=this._scope[i]||(this._scope[i]=[]),c=s.length;return s[c]=t.ref,r.setValue(t,{property:i,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),require_codegen=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=require_code$1(),n=require_scope();var r=require_code$1();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=require_scope();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){var n;if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),this.catch?.optimizeNodes(),this.finally?.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),this.catch?.optimizeNames(e,t),this.finally?.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
99
+ `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;let M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;let P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),require_util=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=require_codegen(),n=require_code$1();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),require_names=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),require_errors=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=require_codegen(),n=require_util(),r=require_names();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),require_boolSchema=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=require_errors(),n=require_codegen(),r=require_names(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),require_rules=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),require_applicability=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){var n;return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),require_dataType=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=require_rules(),n=require_applicability(),r=require_errors(),i=require_codegen(),a=require_util();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
100
+ || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
101
+ || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
102
+ || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;let g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),require_defaults=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;let t=require_codegen(),n=require_util();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),require_code=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=require_codegen(),n=require_util(),r=require_names(),i=require_util();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;let h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),require_keyword=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=require_codegen(),n=require_names(),r=require_code(),i=require_errors();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){var a;let{gen:o,keyword:d,schema:f,parentSchema:p,$data:m,it:h}=e;l(h,i);let g=u(o,d,!m&&i.compile?i.compile.call(h.self,f,p,h):i.validate),_=o.let(`valid`);e.block$data(_,v),e.ok(i.valid??_);function v(){if(i.errors===!1)x(),i.modifying&&s(e),S(()=>e.error());else{let t=i.async?y():b();i.modifying&&s(e),S(()=>c(e,t))}}function y(){let e=o.let(`ruleErrs`,null);return o.try(()=>x((0,t._)`await `),n=>o.assign(_,!1).if((0,t._)`${n} instanceof ${h.ValidationError}`,()=>o.assign(e,(0,t._)`${n}.errors`),()=>o.throw(n))),e}function b(){let e=(0,t._)`${g}.errors`;return o.assign(e,null),x(t.nil),e}function x(a=i.async?(0,t._)`await `:t.nil){let s=h.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!m||i.schema===!1);o.assign(_,(0,t._)`${a}${(0,r.callValidateCode)(e,g,s,c)}`,i.modifying)}function S(e){var n;o.if((0,t.not)(i.valid??_),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),require_subschema=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=require_codegen(),n=require_util();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),require_fast_deep_equal=__commonJSMin(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),require_json_schema_traverse=__commonJSMin(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),require_resolve=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=require_util(),n=require_fast_deep_equal(),r=require_json_schema_traverse(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;let o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;let d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;let m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),require_validate=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=require_boolSchema(),n=require_dataType(),r=require_applicability(),i=require_dataType(),a=require_defaults(),o=require_keyword(),s=require_subschema(),c=require_codegen(),l=require_names(),u=require_resolve(),d=require_util(),f=require_errors();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function N(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>G(e,`$ref`,h.all.$ref.definition));return}p.jtd||F(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),P(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):P(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function P(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&G(e,n.keyword,n.definition,t.type)})}function F(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(I(e,t),e.opts.allowUnionTypes||L(e,t),R(e,e.dataTypes))}function I(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{V(e.dataTypes,t)||U(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),H(e,t)}}function L(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&U(e,`use allowUnionTypes to allow union type keyword`)}function R(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>B(t,e))&&U(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function B(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function V(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function H(e,t){let n=[];for(let r of e.dataTypes)V(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function U(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var W=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,J(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=W;function G(e,t,n,r){let i=new W(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}let K=/^\/(?:[^~]|~0|~1)*$/,q=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function J(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!K.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=q.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=J})),require_validation_error=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),require_ref_error=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_resolve();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),require_compile=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=require_codegen(),n=require_validation_error(),r=require_names(),i=require_resolve(),a=require_util(),o=require_validate();var s=class{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;typeof e.schema==`object`&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(n?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){var r;n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let a=e.refs[n];if(a)return a;let o=p.call(this,e,n);if(o===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(o=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(o!==void 0)return e.refs[n]=u.call(this,o)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;let h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){var o;if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let c;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);c=m.call(this,r,e)}let{schemaId:l}=this.opts;if(c||=new s({schema:n,schemaId:l,root:r,baseId:t}),c.schema!==c.root.schema)return c}})),require_data=__commonJSMin(((e,t)=>{t.exports={$id:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,description:`Meta-schema for $data reference (JSON AnySchema extension proposal)`,type:`object`,required:[`$data`],properties:{$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},additionalProperties:!1}})),require_utils=__commonJSMin(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}let a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),require_schemes=__commonJSMin(((e,t)=>{let{isUUID:n}=require_utils(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=S(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=S(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}let h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},y={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},b={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},x={http:h,https:g,ws:_,wss:v,urn:y,"urn:uuid":b};Object.setPrototypeOf(x,null);function S(e){return e&&(x[e]||x[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:x,isValidSchemeName:a,getSchemeHandler:S}})),require_fast_uri=__commonJSMin(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=require_utils(),{SCHEMES:c,getSchemeHandler:l}=require_schemes();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}let _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),require_uri=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_fast_uri();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),require_core$1=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=require_validate();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=require_codegen();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});let r=require_validation_error(),i=require_ref_error(),a=require_rules(),o=require_compile(),s=require_codegen(),c=require_resolve(),l=require_dataType(),u=require_util(),d=require_data(),f=require_uri(),p=(e,t)=>new RegExp(e,t);p.code=`new RegExp`;let m=[`removeAdditional`,`useDefaults`,`coerceTypes`],h=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),g={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},_={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},v=200;function y(e){var t,n,r,i,a,o,s,c,l,u,d,m,h,g,_,v,y,b,x,S,C,w,T,E,D;let O=e.strict,k=e.code?.optimize,A=k===!0||k===void 0?1:k||0,j=e.code?.regExp??p,M=e.uriResolver??f.default;return{strictSchema:e.strictSchema??O??!0,strictNumbers:e.strictNumbers??O??!0,strictTypes:e.strictTypes??O??`log`,strictTuples:e.strictTuples??O??`log`,strictRequired:e.strictRequired??O??!1,code:e.code?{...e.code,optimize:A,regExp:j}:{optimize:A,regExp:j},loopRequired:e.loopRequired??200,loopEnum:e.loopEnum??200,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:M}}var b=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...y(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:h,es5:t,lines:n}),this.logger=O(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),x.call(this,g,e,`NOT SUPPORTED`),x.call(this,_,e,`DEPRECATED`,`warn`),this._metaOpts=E.call(this),e.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&T.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),C.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=d;n===`id`&&(r={...d},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=S.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=S.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(A.call(this,n,t),!t)return(0,u.eachItem)(n,e=>j.call(this,e)),this;N.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>j.call(this,e,r):e=>r.type.forEach(t=>j.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=F(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else{if(this.opts.jtd)throw Error(`schema must be object`);if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`)}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};b.ValidationError=r.default,b.MissingRefError=i.default,e.default=b;function x(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function S(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function C(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function w(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function T(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function E(){let e={...this.opts};for(let t of m)delete e[t];return e}let D={log(){},warn(){},error(){}};function O(e){if(e===!1)return D;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}let k=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!k.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function j(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?M.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,t.implements?.forEach(e=>this.addKeyword(e))}function M(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function N(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=F(t)),e.validateSchema=this.compile(t,!0))}let P={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function F(e){return{anyOf:[e,P]}}})),require_id=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),require_ref=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;let t=require_ref_error(),n=require_code(),r=require_codegen(),i=require_names(),a=require_compile(),o=require_util(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){var t;if(!l.opts.unevaluated)return;let n=a?.validate?.evaluated;if(l.props!==!0)if(n&&!n.dynamicProps)n.props!==void 0&&(l.props=o.mergeEvaluated.props(c,n.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(n&&!n.dynamicItems)n.items!==void 0&&(l.items=o.mergeEvaluated.items(c,n.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),require_core=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_id(),n=require_ref();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),require_limitNumber=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),require_multipleOf=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),require_ucs2length=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),require_limitLength=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util(),r=require_ucs2length();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),require_pattern=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_code(),n=require_util(),r=require_codegen();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),require_limitProperties=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),require_required=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_code(),n=require_codegen(),r=require_util();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),require_limitItems=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),require_equal=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_fast_deep_equal();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),require_uniqueItems=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_dataType(),n=require_codegen(),r=require_util(),i=require_equal();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),require_const=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util(),r=require_equal();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),require_enum=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util(),r=require_equal();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),require_validation=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_limitNumber(),n=require_multipleOf(),r=require_limitLength(),i=require_pattern(),a=require_limitProperties(),o=require_required(),s=require_limitItems(),c=require_uniqueItems(),l=require_const(),u=require_enum();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),require_additionalItems=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;let t=require_codegen(),n=require_util(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),require_items=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;let t=require_codegen(),n=require_util(),r=require_code(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),require_prefixItems=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_items();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),require_items2020=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util(),r=require_code(),i=require_additionalItems();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),require_contains=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),require_dependencies=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=require_codegen(),n=require_util(),r=require_code();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
103
+ missingProperty: ${i},
104
+ depsCount: ${n},
105
+ deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),require_propertyNames=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),require_additionalProperties=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_code(),n=require_codegen(),r=require_names(),i=require_util();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),require_properties=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_validate(),n=require_code(),r=require_util(),i=require_additionalProperties();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),require_patternProperties=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_code(),n=require_codegen(),r=require_util(),i=require_util();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),require_not=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_util();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),require_anyOf=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:require_code().validateUnion,error:{message:`must match a schema in anyOf`}}})),require_oneOf=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),require_allOf=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_util();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),require_if=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_util(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),require_thenElse=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_util();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),require_applicator=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_additionalItems(),n=require_prefixItems(),r=require_items(),i=require_items2020(),a=require_contains(),o=require_dependencies(),s=require_propertyNames(),c=require_additionalProperties(),l=require_properties(),u=require_patternProperties(),d=require_not(),f=require_anyOf(),p=require_oneOf(),m=require_allOf(),h=require_if(),g=require_thenElse();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),require_format$1=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),require_format=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[require_format$1().default]})),require_metadata=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),require_draft7=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_core(),n=require_validation(),r=require_applicator(),i=require_format(),a=require_metadata();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),require_types=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),require_discriminator=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=require_codegen(),n=require_types(),r=require_compile(),i=require_ref_error(),a=require_util();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){var e;let t={},n=s(l),o=!0;for(let e=0;e<d.length;e++){let t=d[e];if(t?.$ref&&!(0,a.schemaHasRulesButRef)(t,u.self.RULES)){let e=t.$ref;if(t=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),t instanceof r.SchemaEnv&&(t=t.schema),t===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=t?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);o&&=n||s(t),c(l,e)}if(!o)throw Error(`discriminator: "${f}" must be required`);return t;function s({required:e}){return Array.isArray(e)&&e.includes(f)}function c(e,t){if(e.const)p(e.const,t);else if(e.enum)for(let n of e.enum)p(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function p(e,n){if(typeof e!=`string`||e in t)throw Error(`discriminator: "${f}" values must be unique strings`);t[e]=n}}}}})),require_json_schema_draft_07=__commonJSMin(((e,t)=>{t.exports={$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}})),require_ajv=__commonJSMin(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=require_core$1(),r=require_draft7(),i=require_discriminator(),a=require_json_schema_draft_07(),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`;var c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=require_validate();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=require_codegen();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=require_validation_error();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=require_ref_error();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),require_formats=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}let v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}let b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}let T=/[^\\]\\Z/;function E(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),require_limit=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;let t=require_ajv(),n=require_codegen(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),require_dist=__commonJSMin(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});let n=require_formats(),r=require_limit(),i=require_codegen(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a,o;(o=e.opts.code).formats??(o.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),import_ajv=__toESM(require_ajv(),1),import_dist=__toESM(require_dist(),1);function createDefaultAjvInstance(){let e=new import_ajv.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0}),t=import_dist.default;return t(e),e}var AjvJsonSchemaValidator=class{constructor(e){this._ajv=e??createDefaultAjvInstance()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}},ExperimentalClientTasks=class{constructor(e){this._client=e}async*callToolStream(e,t=CallToolResultSchema,n){let r=this._client,i={...n,task:n?.task??(r.isToolTask(e.name)?{}:void 0)},a=r.requestStream({method:`tools/call`,params:e},t,i),o=r.getToolOutputValidator(e.name);for await(let t of a){if(t.type===`result`&&o){let n=t.result;if(!n.structuredContent&&!n.isError){yield{type:`error`,error:new McpError(ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(n.structuredContent)try{let e=o(n.structuredContent);if(!e.valid){yield{type:`error`,error:new McpError(ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)};return}}catch(e){if(e instanceof McpError){yield{type:`error`,error:e};return}yield{type:`error`,error:new McpError(ErrorCode.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._client.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,n){return this._client.requestStream(e,t,n)}};function assertToolsCallTaskCapability(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`tools/call`:if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function assertClientRequestTaskCapability(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function applyElicitationDefaults(e,t){if(!(!e||typeof t!=`object`||!t)){if(e.type===`object`&&e.properties&&typeof e.properties==`object`){let n=t,r=e.properties;for(let e of Object.keys(r)){let t=r[e];n[e]===void 0&&Object.prototype.hasOwnProperty.call(t,`default`)&&(n[e]=t.default),n[e]!==void 0&&applyElicitationDefaults(t,n[e])}}if(Array.isArray(e.anyOf))for(let n of e.anyOf)typeof n!=`boolean`&&applyElicitationDefaults(n,t);if(Array.isArray(e.oneOf))for(let n of e.oneOf)typeof n!=`boolean`&&applyElicitationDefaults(n,t)}}function getSupportedElicitationModes(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}var Client=class extends Protocol{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new AjvJsonSchemaValidator,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler(`tools`,ToolListChangedNotificationSchema,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler(`prompts`,PromptListChangedNotificationSchema,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler(`resources`,ResourceListChangedNotificationSchema,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||={tasks:new ExperimentalClientTasks(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=mergeCapabilities(this._capabilities,e)}setRequestHandler(e,t){let n=getObjectShape(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(isZ4Schema(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);let i=r;return i===`elicitation/create`?super.setRequestHandler(e,async(e,n)=>{let r=safeParse(ElicitRequestSchema,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new McpError(ErrorCode.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:i}=r.data;i.mode=i.mode??`form`;let{supportsFormMode:a,supportsUrlMode:o}=getSupportedElicitationModes(this._capabilities.elicitation);if(i.mode===`form`&&!a)throw new McpError(ErrorCode.InvalidParams,`Client does not support form-mode elicitation requests`);if(i.mode===`url`&&!o)throw new McpError(ErrorCode.InvalidParams,`Client does not support URL-mode elicitation requests`);let s=await Promise.resolve(t(e,n));if(i.task){let e=safeParse(CreateTaskResultSchema,s);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new McpError(ErrorCode.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let c=safeParse(ElicitResultSchema,s);if(!c.success){let e=c.error instanceof Error?c.error.message:String(c.error);throw new McpError(ErrorCode.InvalidParams,`Invalid elicitation result: ${e}`)}let l=c.data,u=i.mode===`form`?i.requestedSchema:void 0;if(i.mode===`form`&&l.action===`accept`&&l.content&&u&&this._capabilities.elicitation?.form?.applyDefaults)try{applyElicitationDefaults(u,l.content)}catch{}return l}):i===`sampling/createMessage`?super.setRequestHandler(e,async(e,n)=>{let r=safeParse(CreateMessageRequestSchema,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new McpError(ErrorCode.InvalidParams,`Invalid sampling request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=safeParse(CreateTaskResultSchema,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new McpError(ErrorCode.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=safeParse(i.tools||i.toolChoice?CreateMessageResultWithToolsSchema:CreateMessageResultSchema,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new McpError(ErrorCode.InvalidParams,`Invalid sampling result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:`initialize`,params:{protocolVersion:LATEST_PROTOCOL_VERSION,capabilities:this._capabilities,clientInfo:this._clientInfo}},InitializeResultSchema,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!SUPPORTED_PROTOCOL_VERSIONS.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:`notifications/initialized`}),this._pendingListChangedConfig&&=(this._setupListChangedHandlers(this._pendingListChangedConfig),void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case`logging/setLevel`:if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:case`resources/subscribe`:case`resources/unsubscribe`:if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e===`resources/subscribe`&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`completion/complete`:if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`initialize`:break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/roots/list_changed`:if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case`notifications/initialized`:break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`sampling/createMessage`:if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case`elicitation/create`:if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case`roots/list`:if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case`ping`:break}}assertTaskCapability(e){assertToolsCallTaskCapability(this._serverCapabilities?.tasks?.requests,e,`Server`)}assertTaskHandlerCapability(e){this._capabilities&&assertClientRequestTaskCapability(this._capabilities.tasks?.requests,e,`Client`)}async ping(e){return this.request({method:`ping`},EmptyResultSchema,e)}async complete(e,t){return this.request({method:`completion/complete`,params:e},CompleteResultSchema,t)}async setLoggingLevel(e,t){return this.request({method:`logging/setLevel`,params:{level:e}},EmptyResultSchema,t)}async getPrompt(e,t){return this.request({method:`prompts/get`,params:e},GetPromptResultSchema,t)}async listPrompts(e,t){return this.request({method:`prompts/list`,params:e},ListPromptsResultSchema,t)}async listResources(e,t){return this.request({method:`resources/list`,params:e},ListResourcesResultSchema,t)}async listResourceTemplates(e,t){return this.request({method:`resources/templates/list`,params:e},ListResourceTemplatesResultSchema,t)}async readResource(e,t){return this.request({method:`resources/read`,params:e},ReadResourceResultSchema,t)}async subscribeResource(e,t){return this.request({method:`resources/subscribe`,params:e},EmptyResultSchema,t)}async unsubscribeResource(e,t){return this.request({method:`resources/unsubscribe`,params:e},EmptyResultSchema,t)}async callTool(e,t=CallToolResultSchema,n){if(this.isToolTaskRequired(e.name))throw new McpError(ErrorCode.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let r=await this.request({method:`tools/call`,params:e},t,n),i=this.getToolOutputValidator(e.name);if(i){if(!r.structuredContent&&!r.isError)throw new McpError(ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{let e=i(r.structuredContent);if(!e.valid)throw new McpError(ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){throw e instanceof McpError?e:new McpError(ErrorCode.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;(e===`required`||e===`optional`)&&this._cachedKnownTaskTools.add(t.name),e===`required`&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let n=await this.request({method:`tools/list`,params:e},ListToolsResultSchema,t);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,t,n,r){let i=ListChangedOptionsBaseSchema.safeParse(n);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!=`function`)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:o}=i.data,{onChanged:s}=n,c=async()=>{if(!a){s(null,null);return}try{s(null,await r())}catch(e){s(e instanceof Error?e:Error(String(e)),null)}};this.setNotificationHandler(t,()=>{if(o){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let n=setTimeout(c,o);this._listChangedDebounceTimers.set(e,n)}else c()})}async sendRootsListChanged(){return this.notification({method:`notifications/roots/list_changed`})}},ParseError=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function noop(e){}function createParser(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=noop,onError:n=noop,onRetry:r=noop,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=splitLines(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
106
+ `;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new ParseError(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new ParseError(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
107
+ `)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function splitLines(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
108
+ `,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
109
+ `&&r++}}return[t,n]}var ErrorEvent=class extends Event{constructor(e,t){var n,r;super(e),this.code=t?.code??void 0,this.message=t?.message??void 0}[Symbol.for(`nodejs.util.inspect.custom`)](e,t,n){return n(inspectableError(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(inspectableError(this),t)}};function syntaxError(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function flattenError(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(flattenError).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${flattenError(e.cause)}`:e.message:`${e}`}function inspectableError(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var __typeError=e=>{throw TypeError(e)},__accessCheck=(e,t,n)=>t.has(e)||__typeError(`Cannot `+n),__privateGet=(e,t,n)=>(__accessCheck(e,t,`read from private field`),n?n.call(e):t.get(e)),__privateAdd=(e,t,n)=>t.has(e)?__typeError(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),__privateSet=(e,t,n,r)=>(__accessCheck(e,t,`write to private field`),t.set(e,n),n),__privateMethod=(e,t,n)=>(__accessCheck(e,t,`access private method`),n),_readyState,_url,_redirectUrl,_withCredentials,_fetch,_reconnectInterval,_reconnectTimer,_lastEventId,_controller,_parser,_onError,_onMessage,_onOpen,_EventSource_instances,connect_fn,_onFetchResponse,_onFetchError,getRequestOptions_fn,_onEvent,_onRetryChange,failConnection_fn,scheduleReconnect_fn,_reconnect,EventSource=class extends EventTarget{constructor(e,t){var n,r;super(),__privateAdd(this,_EventSource_instances),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,__privateAdd(this,_readyState),__privateAdd(this,_url),__privateAdd(this,_redirectUrl),__privateAdd(this,_withCredentials),__privateAdd(this,_fetch),__privateAdd(this,_reconnectInterval),__privateAdd(this,_reconnectTimer),__privateAdd(this,_lastEventId,null),__privateAdd(this,_controller),__privateAdd(this,_parser),__privateAdd(this,_onError,null),__privateAdd(this,_onMessage,null),__privateAdd(this,_onOpen,null),__privateAdd(this,_onFetchResponse,async e=>{var t;__privateGet(this,_parser).reset();let{body:n,redirected:r,status:i,headers:a}=e;if(i===204){__privateMethod(this,_EventSource_instances,failConnection_fn).call(this,`Server sent HTTP 204, not reconnecting`,204),this.close();return}if(r?__privateSet(this,_redirectUrl,new URL(e.url)):__privateSet(this,_redirectUrl,void 0),i!==200){__privateMethod(this,_EventSource_instances,failConnection_fn).call(this,`Non-200 status code (${i})`,i);return}if(!(a.get(`content-type`)||``).startsWith(`text/event-stream`)){__privateMethod(this,_EventSource_instances,failConnection_fn).call(this,`Invalid content type, expected "text/event-stream"`,i);return}if(__privateGet(this,_readyState)===this.CLOSED)return;__privateSet(this,_readyState,this.OPEN);let o=new Event(`open`);if((t=__privateGet(this,_onOpen))==null||t.call(this,o),this.dispatchEvent(o),typeof n!=`object`||!n||!(`getReader`in n)){__privateMethod(this,_EventSource_instances,failConnection_fn).call(this,`Invalid response body, expected a web ReadableStream`,i),this.close();return}let s=new TextDecoder,c=n.getReader(),l=!0;do{let{done:e,value:t}=await c.read();t&&__privateGet(this,_parser).feed(s.decode(t,{stream:!e})),e&&(l=!1,__privateGet(this,_parser).reset(),__privateMethod(this,_EventSource_instances,scheduleReconnect_fn).call(this))}while(l)}),__privateAdd(this,_onFetchError,e=>{__privateSet(this,_controller,void 0),!(e.name===`AbortError`||e.type===`aborted`)&&__privateMethod(this,_EventSource_instances,scheduleReconnect_fn).call(this,flattenError(e))}),__privateAdd(this,_onEvent,e=>{typeof e.id==`string`&&__privateSet(this,_lastEventId,e.id);let t=new MessageEvent(e.event||`message`,{data:e.data,origin:__privateGet(this,_redirectUrl)?__privateGet(this,_redirectUrl).origin:__privateGet(this,_url).origin,lastEventId:e.id||``});__privateGet(this,_onMessage)&&(!e.event||e.event===`message`)&&__privateGet(this,_onMessage).call(this,t),this.dispatchEvent(t)}),__privateAdd(this,_onRetryChange,e=>{__privateSet(this,_reconnectInterval,e)}),__privateAdd(this,_reconnect,()=>{__privateSet(this,_reconnectTimer,void 0),__privateGet(this,_readyState)===this.CONNECTING&&__privateMethod(this,_EventSource_instances,connect_fn).call(this)});try{if(e instanceof URL)__privateSet(this,_url,e);else if(typeof e==`string`)__privateSet(this,_url,new URL(e,getBaseURL()));else throw Error(`Invalid URL`)}catch{throw syntaxError(`An invalid or illegal string was specified`)}__privateSet(this,_parser,createParser({onEvent:__privateGet(this,_onEvent),onRetry:__privateGet(this,_onRetryChange)})),__privateSet(this,_readyState,this.CONNECTING),__privateSet(this,_reconnectInterval,3e3),__privateSet(this,_fetch,t?.fetch??globalThis.fetch),__privateSet(this,_withCredentials,t?.withCredentials??!1),__privateMethod(this,_EventSource_instances,connect_fn).call(this)}get readyState(){return __privateGet(this,_readyState)}get url(){return __privateGet(this,_url).href}get withCredentials(){return __privateGet(this,_withCredentials)}get onerror(){return __privateGet(this,_onError)}set onerror(e){__privateSet(this,_onError,e)}get onmessage(){return __privateGet(this,_onMessage)}set onmessage(e){__privateSet(this,_onMessage,e)}get onopen(){return __privateGet(this,_onOpen)}set onopen(e){__privateSet(this,_onOpen,e)}addEventListener(e,t,n){let r=t;super.addEventListener(e,r,n)}removeEventListener(e,t,n){let r=t;super.removeEventListener(e,r,n)}close(){__privateGet(this,_reconnectTimer)&&clearTimeout(__privateGet(this,_reconnectTimer)),__privateGet(this,_readyState)!==this.CLOSED&&(__privateGet(this,_controller)&&__privateGet(this,_controller).abort(),__privateSet(this,_readyState,this.CLOSED),__privateSet(this,_controller,void 0))}};_readyState=new WeakMap,_url=new WeakMap,_redirectUrl=new WeakMap,_withCredentials=new WeakMap,_fetch=new WeakMap,_reconnectInterval=new WeakMap,_reconnectTimer=new WeakMap,_lastEventId=new WeakMap,_controller=new WeakMap,_parser=new WeakMap,_onError=new WeakMap,_onMessage=new WeakMap,_onOpen=new WeakMap,_EventSource_instances=new WeakSet,connect_fn=function(){__privateSet(this,_readyState,this.CONNECTING),__privateSet(this,_controller,new AbortController),__privateGet(this,_fetch)(__privateGet(this,_url),__privateMethod(this,_EventSource_instances,getRequestOptions_fn).call(this)).then(__privateGet(this,_onFetchResponse)).catch(__privateGet(this,_onFetchError))},_onFetchResponse=new WeakMap,_onFetchError=new WeakMap,getRequestOptions_fn=function(){var e;let t={mode:`cors`,redirect:`follow`,headers:{Accept:`text/event-stream`,...__privateGet(this,_lastEventId)?{"Last-Event-ID":__privateGet(this,_lastEventId)}:void 0},cache:`no-store`,signal:__privateGet(this,_controller)?.signal};return`window`in globalThis&&(t.credentials=this.withCredentials?`include`:`same-origin`),t},_onEvent=new WeakMap,_onRetryChange=new WeakMap,failConnection_fn=function(e,t){var n;__privateGet(this,_readyState)!==this.CLOSED&&__privateSet(this,_readyState,this.CLOSED);let r=new ErrorEvent(`error`,{code:t,message:e});(n=__privateGet(this,_onError))==null||n.call(this,r),this.dispatchEvent(r)},scheduleReconnect_fn=function(e,t){var n;if(__privateGet(this,_readyState)===this.CLOSED)return;__privateSet(this,_readyState,this.CONNECTING);let r=new ErrorEvent(`error`,{code:t,message:e});(n=__privateGet(this,_onError))==null||n.call(this,r),this.dispatchEvent(r),__privateSet(this,_reconnectTimer,setTimeout(__privateGet(this,_reconnect),__privateGet(this,_reconnectInterval)))},_reconnect=new WeakMap,EventSource.CONNECTING=0,EventSource.OPEN=1,EventSource.CLOSED=2;function getBaseURL(){let e=`document`in globalThis?globalThis.document:void 0;return e&&typeof e==`object`&&`baseURI`in e&&typeof e.baseURI==`string`?e.baseURI:void 0}function normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function createFetchWithInit(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...normalizeHeaders(t.headers),...normalizeHeaders(r.headers)}:t.headers}):e}var SseError=class extends Error{constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n}},SSEClientTransport=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=createFetchWithInit(t?.fetch,t?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new UnauthorizedError(`No auth provider`);let e;try{e=await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if(e!==`AUTHORIZED`)throw new UnauthorizedError;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let t=normalizeHeaders(this._requestInit?.headers);return new Headers({...e,...t})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((t,n)=>{this._eventSource=new EventSource(this._url.href,{...this._eventSourceInit,fetch:async(t,n)=>{let r=await this._commonHeaders();r.set(`Accept`,`text/event-stream`);let i=await e(t,{...n,headers:r});if(i.status===401&&i.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=extractWWWAuthenticateParams(i);this._resourceMetadataUrl=e,this._scope=t}return i}}),this._abortController=new AbortController,this._eventSource.onerror=e=>{if(e.code===401&&this._authProvider){this._authThenStart().then(t,n);return}let r=new SseError(e.code,e.message,e);n(r),this.onerror?.(r)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener(`endpoint`,e=>{let r=e;try{if(this._endpoint=new URL(r.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(e){n(e),this.onerror?.(e),this.close();return}t()}),this._eventSource.onmessage=e=>{let t=e,n;try{n=JSONRPCMessageSchema.parse(JSON.parse(t.data))}catch(e){this.onerror?.(e);return}this.onmessage?.(n)}})}async start(){if(this._eventSource)throw Error(`SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.`);return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new UnauthorizedError(`No auth provider`);if(await auth(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new UnauthorizedError(`Failed to authorize`)}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw Error(`Not connected`);try{let t=await this._commonHeaders();t.set(`content-type`,`application/json`);let n={...this._requestInit,method:`POST`,headers:t,body:JSON.stringify(e),signal:this._abortController?.signal},r=await(this._fetch??fetch)(this._endpoint,n);if(!r.ok){let t=await r.text().catch(()=>null);if(r.status===401&&this._authProvider){let{resourceMetadataUrl:t,scope:n}=extractWWWAuthenticateParams(r);if(this._resourceMetadataUrl=t,this._scope=n,await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new UnauthorizedError;return this.send(e)}throw Error(`Error POSTing to endpoint (HTTP ${r.status}): ${t}`)}await r.body?.cancel()}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}},EventSourceParserStream=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=createParser({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};var StreamableHTTPError=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},StreamableHTTPClientTransport=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=createFetchWithInit(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS}async _authThenStart(){if(!this._authProvider)throw new UnauthorizedError(`No auth provider`);let e;try{e=await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if(e!==`AUTHORIZED`)throw new UnauthorizedError;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e[`mcp-session-id`]=this._sessionId),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let t=normalizeHeaders(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let n=await this._commonHeaders();n.set(`Accept`,`text/event-stream`),t&&n.set(`last-event-id`,t);let r=await(this._fetch??fetch)(this._url,{method:`GET`,headers:n,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new StreamableHTTPError(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*n**+e,r)}_scheduleReconnection(e,t=0){let n=this._reconnectionOptions.maxRetries;if(t>=n){this.onerror?.(Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(n=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,n){if(!e)return;let{onresumptiontoken:r,replayMessageId:i}=t,a,o=!1,s=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new EventSourceParserStream({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:n}=await t.read();if(n)break;if(e.id&&(a=e.id,o=!0,r?.(e.id)),e.data&&(!e.event||e.event===`message`))try{let t=JSONRPCMessageSchema.parse(JSON.parse(e.data));isJSONRPCResultResponse(t)&&(s=!0,i!==void 0&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw Error(`StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.`);this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new UnauthorizedError(`No auth provider`);if(await auth(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new UnauthorizedError(`Failed to authorize`)}async close(){this._reconnectionTimeout&&=(clearTimeout(this._reconnectionTimeout),void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:n,onresumptiontoken:r}=t||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:isJSONRPCRequest(e)?e.id:void 0}).catch(e=>this.onerror?.(e));return}let i=await this._commonHeaders();i.set(`content-type`,`application/json`),i.set(`accept`,`application/json, text/event-stream`);let a={...this._requestInit,method:`POST`,headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,a),s=o.headers.get(`mcp-session-id`);if(s&&(this._sessionId=s),!o.ok){let t=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new StreamableHTTPError(401,`Server returned 401 after successful authentication`);let{resourceMetadataUrl:t,scope:n}=extractWWWAuthenticateParams(o);if(this._resourceMetadataUrl=t,this._scope=n,await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new UnauthorizedError;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){let{resourceMetadataUrl:t,scope:n,error:r}=extractWWWAuthenticateParams(o);if(r===`insufficient_scope`){let r=o.headers.get(`WWW-Authenticate`);if(this._lastUpscopingHeader===r)throw new StreamableHTTPError(403,`Server returned 403 after trying upscoping`);if(n&&(this._scope=n),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=r??void 0,await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!==`AUTHORIZED`)throw new UnauthorizedError;return this.send(e)}}throw new StreamableHTTPError(o.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),isInitializedNotification(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let c=(Array.isArray(e)?e:[e]).filter(e=>`method`in e&&`id`in e&&e.id!==void 0).length>0,l=o.headers.get(`content-type`);if(c)if(l?.includes(`text/event-stream`))this._handleSseStream(o.body,{onresumptiontoken:r},!1);else if(l?.includes(`application/json`)){let e=await o.json(),t=Array.isArray(e)?e.map(e=>JSONRPCMessageSchema.parse(e)):[JSONRPCMessageSchema.parse(e)];for(let e of t)this.onmessage?.(e)}else throw await o.body?.cancel(),new StreamableHTTPError(-1,`Unexpected content type: ${l}`);else await o.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:`DELETE`,headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,t);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new StreamableHTTPError(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};async function readJsonFile(e){try{let t=await node_fs_promises.default.readFile(e,`utf8`);return JSON.parse(t)}catch(e){if(e.code===`ENOENT`)return;throw e}}async function writeJsonFile(e,t){await node_fs_promises.default.mkdir(node_path.default.dirname(e),{recursive:!0}),await node_fs_promises.default.writeFile(e,JSON.stringify(t,null,2),`utf8`)}function vaultPath(){return node_path.default.join(node_os.default.homedir(),`.mcporter`,`credentials.json`)}async function readVault(){let e=!1;try{let t=await readJsonFile(vaultPath());if(t&&t.version===1&&t.entries&&typeof t.entries==`object`)return t;e=!0}catch{e=!0}let t={version:1,entries:{}};return e&&await writeVault(t),t}async function writeVault(e){let t=vaultPath(),n=node_path.default.dirname(t);await node_fs_promises.default.mkdir(n,{recursive:!0}),await writeJsonFile(t,e)}function vaultKeyForDefinition(e){let t={name:e.name,url:e.command.kind===`http`?e.command.url.toString():null,command:e.command.kind===`stdio`?{command:e.command.command,args:e.command.args??[]}:null},n=node_crypto.default.createHash(`sha256`).update(JSON.stringify(t)).digest(`hex`).slice(0,16);return`${e.name}|${n}`}async function loadVaultEntry(e){return(await readVault()).entries[vaultKeyForDefinition(e)]}async function saveVaultEntry(e,t){let n=await readVault(),r=vaultKeyForDefinition(e),i=n.entries[r]??{serverName:e.name,serverUrl:e.command.kind===`http`?e.command.url.toString():void 0,updatedAt:new Date().toISOString()};n.entries[r]={...i,...t,updatedAt:new Date().toISOString()},await writeVault(n)}async function clearVaultEntry(e,t){let n=await readVault(),r=vaultKeyForDefinition(e),i=n.entries[r];if(i){if(t===`all`)delete n.entries[r];else{let e={...i};t===`tokens`&&delete e.tokens,t===`client`&&delete e.clientInfo,t===`verifier`&&delete e.codeVerifier,t===`state`&&delete e.state,e.updatedAt=new Date().toISOString(),n.entries[r]=e}await writeVault(n)}}var DirectoryPersistence=class{root;logger;tokenPath;clientInfoPath;codeVerifierPath;statePath;constructor(e,t){this.root=e,this.logger=t,this.tokenPath=node_path.default.join(e,`tokens.json`),this.clientInfoPath=node_path.default.join(e,`client.json`),this.codeVerifierPath=node_path.default.join(e,`code_verifier.txt`),this.statePath=node_path.default.join(e,`state.txt`)}describe(){return this.root}async ensureDir(){await node_fs_promises.default.mkdir(this.root,{recursive:!0})}async readTokens(){return readJsonFile(this.tokenPath)}async saveTokens(e){await this.ensureDir(),await writeJsonFile(this.tokenPath,e),this.logger?.debug?.(`Saved tokens to ${this.tokenPath}`)}async readClientInfo(){return readJsonFile(this.clientInfoPath)}async saveClientInfo(e){await this.ensureDir(),await writeJsonFile(this.clientInfoPath,e)}async readCodeVerifier(){try{return(await node_fs_promises.default.readFile(this.codeVerifierPath,`utf8`)).trim()}catch(e){if(e.code===`ENOENT`)return;throw e}}async saveCodeVerifier(e){await this.ensureDir(),await node_fs_promises.default.writeFile(this.codeVerifierPath,e,`utf8`)}async readState(){return readJsonFile(this.statePath)}async saveState(e){await this.ensureDir(),await writeJsonFile(this.statePath,e)}async clear(e){let t=[];(e===`all`||e===`tokens`)&&t.push(this.tokenPath),(e===`all`||e===`client`)&&t.push(this.clientInfoPath),(e===`all`||e===`verifier`)&&t.push(this.codeVerifierPath),(e===`all`||e===`state`)&&t.push(this.statePath),await Promise.all(t.map(async e=>{try{await node_fs_promises.default.unlink(e)}catch(e){if(e.code!==`ENOENT`)throw e}}))}},VaultPersistence=class{definition;constructor(e){this.definition=e}describe(){return`~/.mcporter/credentials.json (vault)`}async readTokens(){return(await loadVaultEntry(this.definition))?.tokens}async saveTokens(e){await saveVaultEntry(this.definition,{tokens:e})}async readClientInfo(){return(await loadVaultEntry(this.definition))?.clientInfo}async saveClientInfo(e){await saveVaultEntry(this.definition,{clientInfo:e})}async readCodeVerifier(){return(await loadVaultEntry(this.definition))?.codeVerifier}async saveCodeVerifier(e){await saveVaultEntry(this.definition,{codeVerifier:e})}async readState(){return(await loadVaultEntry(this.definition))?.state}async saveState(e){await saveVaultEntry(this.definition,{state:e})}async clear(e){await clearVaultEntry(this.definition,e)}},CompositePersistence=class{stores;constructor(e){this.stores=e}describe(){return this.stores.map(e=>e.describe()).join(` + `)}async readTokens(){for(let e of this.stores){let t=await e.readTokens();if(t)return t}}async saveTokens(e){await Promise.all(this.stores.map(t=>t.saveTokens(e)))}async readClientInfo(){for(let e of this.stores){let t=await e.readClientInfo();if(t)return t}}async saveClientInfo(e){await Promise.all(this.stores.map(t=>t.saveClientInfo(e)))}async readCodeVerifier(){for(let e of this.stores){let t=await e.readCodeVerifier();if(t)return t}}async saveCodeVerifier(e){await Promise.all(this.stores.map(t=>t.saveCodeVerifier(e)))}async readState(){for(let e of this.stores){let t=await e.readState();if(t)return t}}async saveState(e){await Promise.all(this.stores.map(t=>t.saveState(e)))}async clear(e){await Promise.all(this.stores.map(t=>t.clear(e)))}};async function buildOAuthPersistence(e,t){let n=new VaultPersistence(e),r=[n];e.tokenCacheDir&&r.unshift(new DirectoryPersistence(e.tokenCacheDir,t));let i=node_path.default.join(node_os.default.homedir(),`.mcporter`,e.name);if(!e.tokenCacheDir&&i){let r=new DirectoryPersistence(i,t),a=await r.readTokens(),o=await r.readClientInfo(),s=await r.readCodeVerifier(),c=await r.readState();(a||o||s||c)&&(a&&await n.saveTokens(a),o&&await n.saveClientInfo(o),s&&await n.saveCodeVerifier(s),c&&await n.saveState(c),t?.info?.(`Migrated legacy OAuth cache for '${e.name}' into vault.`))}return r.length===1?n:new CompositePersistence(r)}async function clearOAuthCaches(e,t,n=`all`){await(await buildOAuthPersistence(e,t)).clear(n);let r=node_path.default.join(node_os.default.homedir(),`.mcporter`,e.name);r&&(!e.tokenCacheDir||r!==e.tokenCacheDir)&&await new DirectoryPersistence(r,t).clear(n),e.tokenCacheDir&&await node_fs_promises.default.rm(e.tokenCacheDir,{recursive:!0,force:!0});let i=[];e.name.toLowerCase()===`gmail`&&i.push(node_path.default.join(node_os.default.homedir(),`.gmail-mcp`,`credentials.json`)),await Promise.all(i.map(async e=>{try{await node_fs_promises.default.unlink(e),t?.info?.(`Cleared legacy OAuth cache file ${e}`)}catch(e){if(e.code!==`ENOENT`)throw e}}))}async function readCachedAccessToken(e,t){let n=await(await buildOAuthPersistence(e,t)).readTokens();if(n&&typeof n.access_token==`string`&&n.access_token.trim().length>0)return n.access_token}const CALLBACK_HOST=`127.0.0.1`,CALLBACK_PATH=`/callback`;function createDeferred(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function openExternal(e,t=process.platform,n=node_child_process.spawn){let r=`ignore`;try{if(t===`darwin`)n(`open`,[e],{stdio:r,detached:!0}).unref();else if(t===`win32`)n(`cmd`,[`/c`,`start`,`""`,e],{stdio:r,detached:!0}).unref();else try{let t=n(`xdg-open`,[e],{stdio:r,detached:!0});t.on(`error`,()=>{}),t.unref()}catch{}}catch{}}var PersistentOAuthClientProvider=class e{definition;metadata;logger;persistence;redirectUrlValue;authorizationDeferred=null;server;constructor(e,t,n,r){this.definition=e,this.redirectUrlValue=n,this.logger=r,this.persistence=t,this.metadata={client_name:e.clientName??`mcporter (${e.name})`,redirect_uris:[this.redirectUrlValue.toString()],grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],token_endpoint_auth_method:`none`,...e.oauthScope===void 0?{}:{scope:e.oauthScope||void 0}}}static async create(t,n){let r=await buildOAuthPersistence(t,n),i=node_http.default.createServer(),a=t.oauthRedirectUrl?new node_url.URL(t.oauthRedirectUrl):null,o=a?.hostname??CALLBACK_HOST,s=a?.port??``,c=!a||s===``||s===`0`,l=c?void 0:Number.parseInt(s,10),u=a?.pathname&&a.pathname!==`/`?a.pathname:CALLBACK_PATH,d=await new Promise((e,t)=>{i.listen(l??0,o,()=>{let n=i.address();typeof n==`object`&&n&&`port`in n?e(n.port):t(Error(`Failed to determine callback port`))}),i.once(`error`,e=>t(e))}),f=a?new node_url.URL(a.toString()):new node_url.URL(`http://${o}:${d}${u}`);if(c&&(f.port=String(d)),(!a||a.pathname===`/`||a.pathname===``)&&(f.pathname=u),c)try{let e=firstRedirectUri(await r.readClientInfo());e&&e!==f.toString()&&(n.info(`Redirect URI changed (${e} → ${f.toString()}); clearing stale client registration.`),await r.clear(`client`))}catch(e){throw await new Promise(e=>{i.close(()=>e())}),e}let p=new e(t,r,f,n);return p.attachServer(i),{provider:p,close:async()=>{await p.close()}}}attachServer(e){this.server=e,e.on(`request`,async(e,t)=>{try{let n=e.url??``,r=new node_url.URL(n,this.redirectUrlValue),i=this.redirectUrlValue.pathname||`/callback`;if(r.pathname!==i){t.statusCode=404,t.end(`Not found`);return}let a=r.searchParams.get(`code`),o=r.searchParams.get(`error`),s=r.searchParams.get(`state`),c=await this.persistence.readState();if(c&&s&&s!==c){t.statusCode=400,t.setHeader(`Content-Type`,`text/html`),t.end(`<html><body><h1>Authorization failed</h1><p>Invalid OAuth state</p></body></html>`),this.authorizationDeferred?.reject(Error(`Invalid OAuth state`)),this.authorizationDeferred=null;return}a?(this.logger.info(`Received OAuth authorization code for ${this.definition.name}`),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(`<html><body><h1>Authorization successful</h1><p>You can return to the CLI.</p></body></html>`),this.authorizationDeferred?.resolve(a),this.authorizationDeferred=null):o?(t.statusCode=400,t.setHeader(`Content-Type`,`text/html`),t.end(`<html><body><h1>Authorization failed</h1><p>${o}</p></body></html>`),this.authorizationDeferred?.reject(Error(`OAuth error: ${o}`)),this.authorizationDeferred=null):(t.statusCode=400,t.end(`Missing authorization code`),this.authorizationDeferred?.reject(Error(`Missing authorization code`)),this.authorizationDeferred=null)}catch(e){this.authorizationDeferred?.reject(e),this.authorizationDeferred=null}})}get redirectUrl(){return this.redirectUrlValue}get clientMetadata(){return this.metadata}async state(){let e=await this.persistence.readState();if(e)return e;let t=(0,node_crypto.randomUUID)();return await this.persistence.saveState(t),t}async clientInformation(){return this.persistence.readClientInfo()}async saveClientInformation(e){await this.persistence.saveClientInfo(e)}async tokens(){return this.persistence.readTokens()}async saveTokens(e){await this.persistence.saveTokens(e),this.logger.info(`Saved OAuth tokens for ${this.definition.name} (${this.persistence.describe()})`)}async redirectToAuthorization(e){this.logger.info(`Authorization required for ${this.definition.name}. Opening browser...`),this.ensureAuthorizationDeferred(),__oauthInternals.openExternal(e.toString()),this.logger.info(`If the browser did not open, visit ${e.toString()} manually.`)}async saveCodeVerifier(e){await this.persistence.saveCodeVerifier(e)}async codeVerifier(){let e=await this.persistence.readCodeVerifier();if(!e)throw Error(`Missing PKCE code verifier for ${this.definition.name}`);return e.trim()}async invalidateCredentials(e){await this.persistence.clear(e)}async waitForAuthorizationCode(){return this.ensureAuthorizationDeferred().promise}async close(){this.authorizationDeferred&&=(this.authorizationDeferred.reject(Error(`OAuth session closed before receiving authorization code.`)),null),this.server&&=(await new Promise(e=>{this.server?.close(()=>e())}),void 0)}ensureAuthorizationDeferred(){return this.authorizationDeferred||=createDeferred(),this.authorizationDeferred}};async function createOAuthSession(e,t){let{provider:n,close:r}=await PersistentOAuthClientProvider.create(e,t);return{provider:n,waitForAuthorizationCode:()=>n.waitForAuthorizationCode(),close:r}}function firstRedirectUri(e){if(!e||typeof e!=`object`)return;let t=e.redirect_uris;if(!Array.isArray(t))return;let[n]=t;return typeof n==`string`?n:void 0}const __oauthInternals={openExternal};function materializeHeaders(e,t){if(!e)return;let n={};for(let[r,i]of Object.entries(e))try{n[r]=resolveEnvPlaceholders(i)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`Failed to resolve header '${r}' for server '${t}': ${n}`)}return n}const ENV_PLACEHOLDER_PATTERN=/\$\{[A-Za-z_][A-Za-z0-9_]*\}/;function resolveCommandArgument(e){return!e||!e.includes(`$`)||!(e.startsWith(`$env:`)||ENV_PLACEHOLDER_PATTERN.test(e))?e:resolveEnvPlaceholders(e)}function resolveCommandArguments(e){return!e||e.length===0?[]:e.map(e=>resolveCommandArgument(e))}function normalizeTimeout(e){if(e==null||!Number.isFinite(e))return;let t=Math.trunc(e);return t>0?t:void 0}function raceWithTimeout(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(Error(`Timeout`))},t);e.then(e=>{clearTimeout(i),n(e)},e=>{clearTimeout(i),r(e)})})}const STDIO_TRACE_ENABLED=process.env.MCPORTER_STDIO_TRACE===`1`;function extractTransportStatusCode(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[t.code,t.status,t.statusCode]){if(typeof e==`number`)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isFinite(t))return t}}}function isLegacySseTransportMismatch(e){if(e instanceof StreamableHTTPError)return e.code===404||e.code===405;let t=extractTransportStatusCode(e);if(t===404||t===405)return!0;let n=analyzeConnectionError(e);return n.kind===`http`&&(n.statusCode===404||n.statusCode===405)}function attachStdioTraceLogging(e,t){}function removeAuthorizationHeader(e){if(e){for(let t of Object.keys(e))t.toLowerCase()===`authorization`&&delete e[t];return Object.keys(e).length>0?e:void 0}}function createHttpTransportOptions(e,t,n){let r=e.command;if(r.kind!==`http`)throw Error(`Server '${e.name}' is not configured for HTTP transport.`);let i=materializeHeaders(r.headers,e.name),a=n?removeAuthorizationHeader(i):i;return{requestInit:a?{headers:a}:void 0,authProvider:t?.provider}}async function closeOAuthSession(e){await e?.close().catch(()=>{})}function shouldAbortSseFallback(e){return isPostAuthConnectError(e)?!isLegacySseTransportMismatch(e):isOAuthFlowError(e)||e instanceof OAuthTimeoutError}function maybePromoteHttpDefinition(e,t,n){if(n.maxOAuthAttempts!==0)return maybeEnableOAuth(e,t)}async function connectHttpTransport(e,t,n,r,i){try{return await connectWithAuth(e,t,n,r,i)}catch(e){throw await closeTransportAndWait(r,t).catch(()=>{}),e}}async function applyCachedOAuthHeaderIfAvailable(e,t,n){if(!n||e.auth!==`oauth`||e.command.kind!==`http`)return e;try{let n=await readCachedAccessToken(e,t);if(!n)return e;let r=e.command.headers??{};return`Authorization`in r?e:(t.debug?.(`Using cached OAuth access token for '${e.name}' (non-interactive).`),{...e,command:{...e.command,headers:{...r,Authorization:`Bearer ${n}`}}})}catch(n){return t.debug?.(`Failed to read cached OAuth token for '${e.name}': ${n instanceof Error?n.message:String(n)}`),e}}async function createStdioClientContext(e,t,n){let r=t.env&&Object.keys(t.env).length>0?Object.fromEntries(Object.entries(t.env).map(([e,t])=>[e,resolveEnvValue(t)]).filter(([,e])=>e!==``)):void 0,i=r&&Object.keys(r).length>0?{...process.env,...r}:{...process.env},a=new StdioClientTransport({command:resolveCommandArgument(t.command.command),args:resolveCommandArguments(t.command.args),cwd:t.command.cwd,env:i});STDIO_TRACE_ENABLED&&(t.name??t.command.command);try{await e.connect(a)}catch(e){throw await closeTransportAndWait(n,a).catch(()=>{}),e}return{client:e,transport:a,definition:t,oauthSession:void 0}}async function retryHttpTransportWithFallback(e,t,n,r){let i=t;for(;;){let t=await attemptHttpClientContext(e,i,n,r);if(!t.nextDefinition)return t.context;i=t.nextDefinition,r.onDefinitionPromoted?.(i)}}async function attemptHttpClientContext(e,t,n,r){let i=t.command;if(i.kind!==`http`)throw Error(`Server '${t.name}' is not configured for HTTP transport.`);let a,o=t.auth===`oauth`&&r.maxOAuthAttempts!==0;o&&(a=await createOAuthSession(t,n));let s=createHttpTransportOptions(t,a,o);try{return{context:await connectPrimaryHttpTransport(e,t,i,s,a,n,r)}}catch(o){if(shouldAbortSseFallback(o))throw await closeOAuthSession(a),o;if(isUnauthorizedError(o)){await closeOAuthSession(a);let e=maybePromoteHttpDefinition(t,n,r);if(e)return{nextDefinition:e};a=void 0}return o instanceof Error&&n.info(`Falling back to SSE transport for '${t.name}': ${o.message}`),{context:await connectSseFallbackTransport(e,t,i,s,a,n,r)}}}async function connectPrimaryHttpTransport(e,t,n,r,i,a,o){let s=()=>new StreamableHTTPClientTransport(n.url,r);return{client:e,transport:await connectHttpTransport(e,s(),i,a,{serverName:t.name,maxAttempts:o.maxOAuthAttempts,oauthTimeoutMs:o.oauthTimeoutMs,recreateTransport:async()=>s()}),definition:t,oauthSession:i}}async function connectSseFallbackTransport(e,t,n,r,i,a,o){try{return{client:e,transport:await connectHttpTransport(e,new SSEClientTransport(n.url,r),i,a,{serverName:t.name,maxAttempts:o.maxOAuthAttempts,oauthTimeoutMs:o.oauthTimeoutMs}),definition:t,oauthSession:i}}catch(n){if(await closeOAuthSession(i),n instanceof OAuthTimeoutError)throw n;if(isUnauthorizedError(n)){let n=maybePromoteHttpDefinition(t,a,o);if(n)return o.onDefinitionPromoted?.(n),retryHttpTransportWithFallback(e,n,a,o)}throw n}}async function createClientContext(e,t,n,r={}){let i=new Client(n),a=await applyCachedOAuthHeaderIfAvailable(e,t,r.allowCachedAuth);return withEnvOverrides(a.env,async()=>a.command.kind===`stdio`?createStdioClientContext(i,a,t):retryHttpTransportWithFallback(i,a,t,r))}const PACKAGE_NAME=`mcporter`,CLIENT_VERSION=(()=>{try{return(0,node_module.createRequire)(require(`url`).pathToFileURL(__filename).href)(`../package.json`).version}catch{return process.env.MCPORTER_VERSION??`0.0.0-dev`}})(),MCPORTER_VERSION=CLIENT_VERSION,OAUTH_CODE_TIMEOUT_MS=resolveOAuthTimeoutFromEnv();async function createRuntime(e={}){return new McpRuntime(e.servers??await loadServerDefinitions({configPath:e.configPath,rootDir:e.rootDir}),e)}async function callOnce(e){let t=await createRuntime({configPath:e.configPath});try{return await t.callTool(e.server,e.toolName,{args:e.args})}finally{await t.close(e.server)}}var McpRuntime=class{definitions;clients=new Map;logger;clientInfo;oauthTimeoutMs;constructor(e,t={}){this.definitions=new Map(e.map(e=>[e.name,e])),this.logger=t.logger??createConsoleLogger(),this.clientInfo=t.clientInfo??{name:PACKAGE_NAME,version:CLIENT_VERSION},this.oauthTimeoutMs=t.oauthTimeoutMs}listServers(){return[...this.definitions.keys()].sort((e,t)=>e.localeCompare(t))}getDefinitions(){return[...this.definitions.values()]}getDefinition(e){let t=this.definitions.get(e);if(!t)throw Error(`Unknown MCP server '${e}'.`);return t}registerDefinition(e,t={}){if(!t.overwrite&&this.definitions.has(e.name))throw Error(`MCP server '${e.name}' already exists.`);this.definitions.set(e.name,e),this.clients.delete(e.name)}async listTools(e,t={}){let n=t.autoAuthorize!==!1,r=await this.connect(e,{maxOAuthAttempts:n?void 0:0,skipCache:!n,allowCachedAuth:t.allowCachedAuth});try{let e=[],n;do{let i=await r.client.listTools(n?{cursor:n}:void 0);e.push(...(i.tools??[]).map(e=>({name:e.name,description:e.description??void 0,inputSchema:t.includeSchema?e.inputSchema:void 0,outputSchema:t.includeSchema?e.outputSchema:void 0}))),n=i.nextCursor??void 0}while(n);return e}catch(t){throw await this.resetConnectionOnError(e,t),t}finally{n||(await r.client.close().catch(()=>{}),await closeTransportAndWait(this.logger,r.transport).catch(()=>{}),await r.oauthSession?.close().catch(()=>{}))}}async callTool(e,t,n={}){try{let{client:r}=await this.connect(e),i={name:t,arguments:n.args??{}},a=normalizeTimeout(n.timeoutMs),o=r.callTool(i,void 0,{timeout:a,resetTimeoutOnProgress:!0,maxTotalTimeout:a});return a?await raceWithTimeout(o,a):await o}catch(t){throw await this.resetConnectionOnError(e,t),t}}async listResources(e,t={}){try{let{client:n}=await this.connect(e);return await n.listResources(t)}catch(t){throw await this.resetConnectionOnError(e,t),t}}async connect(e,t={}){let n=e.trim(),r=t.skipCache!==!0&&t.maxOAuthAttempts===void 0;if(r){let e=this.clients.get(n);if(e)return e}let i=this.definitions.get(n);if(!i)throw Error(`Unknown MCP server '${n}'.`);let a=createClientContext(i,this.logger,this.clientInfo,{maxOAuthAttempts:t.maxOAuthAttempts,oauthTimeoutMs:this.oauthTimeoutMs??OAUTH_CODE_TIMEOUT_MS,onDefinitionPromoted:e=>this.definitions.set(e.name,e),allowCachedAuth:t.allowCachedAuth});if(r){this.clients.set(n,a);try{return await a}catch(e){throw this.clients.delete(n),e}}return a}async close(e){if(e){let t=e.trim(),n=await this.clients.get(t);if(!n)return;await n.client.close().catch(()=>{}),await closeTransportAndWait(this.logger,n.transport).catch(()=>{}),await n.oauthSession?.close().catch(()=>{}),this.clients.delete(t);return}for(let[e,t]of this.clients.entries())try{let e=await t;await e.client.close().catch(()=>{}),await closeTransportAndWait(this.logger,e.transport).catch(()=>{}),await e.oauthSession?.close().catch(()=>{})}finally{this.clients.delete(e)}}async resetConnectionOnError(e,t){if(!shouldResetConnection(t))return;let n=e.trim();if(this.clients.has(n))try{await this.close(n)}catch(e){let t=e instanceof Error?e.message:String(e);this.logger.warn(`Failed to reset '${n}' after error: ${t}`)}}};function createConsoleLogger(e=resolveLogLevelFromEnv()){return createPrefixedConsoleLogger(`mcporter`,e)}const SCHEMA_FILENAME=`schema.json`;function resolveSchemaCacheDir(e){return e.tokenCacheDir??node_path.default.join(node_os.default.homedir(),`.mcporter`,e.name)}function resolveSchemaCachePath(e){return node_path.default.join(resolveSchemaCacheDir(e),SCHEMA_FILENAME)}async function readSchemaCache(e){let t=resolveSchemaCachePath(e);try{let e=await node_fs_promises.default.readFile(t,`utf8`),n=JSON.parse(e);return!n||typeof n!=`object`||!n.tools||typeof n.tools!=`object`?void 0:n}catch(e){if(e.code===`ENOENT`)return;throw e}}async function writeSchemaCache(e,t){let n=resolveSchemaCachePath(e);await node_fs_promises.default.mkdir(node_path.default.dirname(n),{recursive:!0}),await node_fs_promises.default.writeFile(n,JSON.stringify(t,null,2),`utf8`)}const KNOWN_OPTION_KEYS=new Set([`tailLog`,`timeout`,`stream`,`streamLog`,`mimeType`,`metadata`,`log`]);function defaultToolNameMapper(e){if(typeof e!=`string`)throw TypeError(`Tool name must be a string when using server proxy.`);return e.replace(/([a-z\d])([A-Z])/g,`$1-$2`).toLowerCase()}function canonicalizeToolName(e){return e.toLowerCase().replace(/[^a-z0-9]/g,``)}function isPlainObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function createToolSchemaInfo(e){if(!e||typeof e!=`object`)return;let t=e,n=t.properties,r=n&&typeof n==`object`?Object.keys(n):[],i=Array.isArray(t.required)?t.required:[],a=[],o=new Set;for(let e of i)typeof e==`string`&&!o.has(e)&&(a.push(e),o.add(e));for(let e of r)o.has(e)||(a.push(e),o.add(e));return{schema:t,orderedKeys:a,requiredKeys:i,propertySet:new Set([...r,...i])}}function applyDefaults(e,t){let n=e.schema.properties;if(!n||typeof n!=`object`)return t;let r=isPlainObject(t)?{...t}:{};for(let[e,t]of Object.entries(n))t&&typeof t==`object`&&`default`in t&&r[e]===void 0&&(r[e]=t.default);return Object.keys(r).length===0&&!isPlainObject(t)?t:r}function validateRequired(e,t){if(e.requiredKeys.length===0)return;if(!isPlainObject(t))throw Error(`Missing required arguments: ${e.requiredKeys.join(`, `)}`);let n=e.requiredKeys.filter(e=>t[e]===void 0);if(n.length>0)throw Error(`Missing required arguments: ${n.join(`, `)}`)}function createServerProxy(e,t,n,r){let i=defaultToolNameMapper,a;typeof n==`function`?(i=n,a=r):n&&(a=n,typeof n.mapPropertyToTool==`function`&&(i=n.mapPropertyToTool));let o=a?.cacheSchemas??!0,s=a?.initialSchemas??void 0,c=new Map,l=new Map,u=new Map,d=null,f=null,p=null,m=!1,h;if(o)try{h=e.getDefinition(t)}catch{h=void 0}if(o&&!s&&h&&(f=y(h),m=!0),s){for(let[e,t]of Object.entries(s))v(e,t);p=b()}async function g(){if(p)try{await p}finally{p=null}}async function _(n){await g();let r=c.get(n);if(r&&!m)return r;if(f){try{await f}finally{f=null}if(c.has(n)&&!m)return c.get(n)}return d||=e.listTools(t,{includeSchema:!0}).then(e=>{for(let t of e)!t.inputSchema||typeof t.inputSchema!=`object`||v(t.name,t.inputSchema);p=b(),m=!1}).catch(e=>{throw d=null,e}),await d,await g(),c.get(n)}function v(e,t){let n=createToolSchemaInfo(t);if(!n)return;let r=i(e);c.set(r,n),r!==e&&c.set(e,n);let a=canonicalizeToolName(e);u.has(a)||u.set(a,e);let s=canonicalizeToolName(r);u.has(s)||u.set(s,e),o&&h&&isPlainObject(t)&&l.set(r,t)}async function y(e){try{let t=await readSchemaCache(e);if(!t)return;for(let[e,n]of Object.entries(t.tools))v(e,n)}catch{}}function b(){return!o||!h||l.size===0?null:writeSchemaCache(h,{updatedAt:new Date().toISOString(),tools:Object.fromEntries(l.entries())}).catch(()=>{})}return new Proxy({call:async(n,r)=>createCallResult(await e.callTool(t,n,r??{})),listTools:n=>e.listTools(t,n)},{get(n,r,a){if(Reflect.has(n,r))return Reflect.get(n,r,a);let o=r,s=typeof o==`string`?canonicalizeToolName(o):null,c=typeof o==`string`&&s?u.get(s)??i(o):i(o);return async(...n)=>{let r;try{r=await _(c)}catch{r=void 0}if(typeof o==`string`&&s){let e=u.get(s);if(e&&e!==c){c=e;try{r=await _(c)}catch{}}}let i=[],a={},l={};for(let e of n)if(isPlainObject(e)){let t=Object.keys(e);r!==void 0&&t.length>0&&(t.every(e=>r.propertySet.has(e))||t.every(e=>!KNOWN_OPTION_KEYS.has(e)))?Object.assign(a,e):Object.assign(l,e)}else i.push(e);let d=l.args;d!==void 0&&delete l.args;let f={...l},p=d;if(r){let e=r;if(i.length>e.orderedKeys.length)throw Error(`Too many positional arguments for tool "${c}"`);if(i.length>0){let t=isPlainObject(p)?{...p}:{};i.forEach((n,r)=>{let i=e.orderedKeys[r];i&&(t[i]=n)}),p=t}if(Object.keys(a).length>0){let e=isPlainObject(p)?{...p}:{};Object.assign(e,a),p=e}if(p!==void 0)p=applyDefaults(e,p);else{let t=applyDefaults(e,void 0);t&&typeof t==`object`&&(p=t)}validateRequired(e,p)}else if(i.length>0&&(p=i),Object.keys(a).length>0){let e=isPlainObject(p)?{...p}:{};Object.assign(e,a),p=e}return p!==void 0&&(f.args=p),createCallResult(await e.callTool(t,c,f))}}})}const embeddedServer={name:`meow-onboarding`,description:`Create a Meow business banking account and complete onboarding. Start with create_account to sign up, then verify_email. After verification, call issue_onboarding_key to get an API key. Use that API key for all subsequent onboarding tools.`,command:{kind:`http`,url:`https://onboarding-mcp.dev.meow.com/`}},embeddedSchemas={create_account:{type:`object`,properties:{email:{type:`string`,format:`email`,title:`Email`,description:`Email address for the new account`}},required:[`email`]},verify_email:{type:`object`,properties:{email:{type:`string`,format:`email`,title:`Email`,description:`Email address to verify`},code:{type:`string`,maxLength:6,minLength:6,pattern:`^\\d{6}$`,title:`Code`,description:`6-digit verification code from email`}},required:[`email`,`code`]},resend_verification_code:{type:`object`,properties:{email:{type:`string`,format:`email`,title:`Email`,description:`Email address to resend verification code to`}},required:[`email`]},issue_onboarding_key:{type:`object`,properties:{email:{type:`string`,format:`email`,title:`Email`,description:`Email address of the verified account`},verification_token:{type:`string`,title:`Verification Token`,description:`Token returned by verify_email`}},required:[`email`,`verification_token`]},update_user_info:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},first_name:{anyOf:[{type:`string`,maxLength:140,minLength:1,pattern:`^[a-zA-Z' -]+$`},{type:`null`}],title:`First Name`},middle_name:{anyOf:[{type:`string`,maxLength:140,minLength:1,pattern:`^[a-zA-Z' -]+$`},{type:`null`}],title:`Middle Name`},last_name:{anyOf:[{type:`string`,maxLength:140,minLength:1,pattern:`^[a-zA-Z' -]+$`},{type:`null`}],title:`Last Name`},user_permissions:{type:`boolean`,title:`User Permissions`,default:!1}},required:[`api_key`]},update_business_address:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},business:{properties:{country:{anyOf:[{type:`string`,enum:`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`),title:`CountryCodeAlpha2`,"x-enum-varnames":`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`)},{type:`null`}]},address:{anyOf:[{type:`string`,maxLength:900,minLength:2},{type:`null`}],title:`Address`},secondary_address:{anyOf:[{type:`string`,maxLength:900,minLength:1},{type:`null`}],title:`Secondary Address`},city:{anyOf:[{type:`string`,maxLength:300,minLength:2},{type:`null`}],title:`City`},state:{anyOf:[{type:`string`,maxLength:300,minLength:1},{type:`null`}],title:`State`},zip:{anyOf:[{type:`string`,maxLength:100,minLength:2},{type:`null`}],title:`Zip`}},type:`object`,title:`AddressOptionalFields`,default:{}},physical:{properties:{country:{anyOf:[{type:`string`,enum:`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`),title:`CountryCodeAlpha2`,"x-enum-varnames":`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`)},{type:`null`}]},address:{anyOf:[{type:`string`,maxLength:900,minLength:2},{type:`null`}],title:`Address`},secondary_address:{anyOf:[{type:`string`,maxLength:900,minLength:1},{type:`null`}],title:`Secondary Address`},city:{anyOf:[{type:`string`,maxLength:300,minLength:2},{type:`null`}],title:`City`},state:{anyOf:[{type:`string`,maxLength:300,minLength:1},{type:`null`}],title:`State`},zip:{anyOf:[{type:`string`,maxLength:100,minLength:2},{type:`null`}],title:`Zip`}},type:`object`,title:`AddressOptionalFields`,default:{}}},required:[`api_key`]},update_business_details:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},is_r365:{type:`boolean`,title:`Is R365`,default:!1},business_name:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Name`},business_nickname:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Nickname`},business_dba_name:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Dba Name`},business_description:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Description`},business_phone:{anyOf:[{type:`string`,maxLength:20,minLength:10},{type:`null`}],title:`Business Phone`},business_date_of_incorporation:{anyOf:[{type:`string`,format:`date`},{type:`null`}],title:`Business Date Of Incorporation`},business_asset_source_description:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Asset Source Description`},business_taxid:{anyOf:[{type:`string`,maxLength:50,minLength:0},{type:`null`}],title:`Business Taxid`},anticipated_deposit_size:{type:`null`,title:`Anticipated Deposit Size`},incorporation_state:{anyOf:[{type:`string`,enum:`AL.AK.AZ.AR.CA.CO.CT.DC.DE.FL.GA.HI.ID.IL.IN.IA.KS.KY.LA.ME.MD.MA.MI.MN.MS.MO.MT.NE.NV.NH.NJ.NM.NY.NC.ND.OH.OK.OR.PA.RI.SC.SD.TN.TX.UT.VT.VA.WA.WV.WI.WY.PR`.split(`.`),title:`StateCode`,"x-enum-varnames":`AL.AK.AZ.AR.CA.CO.CT.DC.DE.FL.GA.HI.ID.IL.IN.IA.KS.KY.LA.ME.MD.MA.MI.MN.MS.MO.MT.NE.NV.NH.NJ.NM.NY.NC.ND.OH.OK.OR.PA.RI.SC.SD.TN.TX.UT.VT.VA.WA.WV.WI.WY.PR`.split(`.`)},{type:`null`}]},legal_structure:{anyOf:[{type:`string`,enum:[`ccorp`,`corp`,`estate`,`foreign_entity`,`llc`,`llp`,`lp`,`nonprofit`,`partnership`,`scheme`,`scorp`,`soleprop`,`trust`],title:`LegalStructure`},{type:`null`}]},naics_code:{anyOf:[{type:`integer`},{type:`null`}],title:`Naics Code`},business_website:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Business Website`},referral_code:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Referral Code`},how_did_you_hear_about_us:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`How Did You Hear About Us`},legal_entity_number:{anyOf:[{type:`string`,maxLength:50,minLength:0},{type:`null`}],title:`Legal Entity Number`},industry:{anyOf:[{type:`string`,enum:`accounting_bookkeeping.accounting_bookkeeping_tax_preparation.advertising.art.art_theater.art_painting.art_sculpting.beauty_cosmetic_services.biotech.business_management.cafeterias_grill_buffets_buffets.caterers.cleaning_services.construction.consulting.consulting_strategy.consulting_business.consulting_financial.crypto.crypto_exchange.crypto_investments.crypto_daos.crypto_nfts.crypto_mining.saas.design.design_web.design_digital.design_interior.design_fashion.drinking_places_alcoholic_beverages.ecommerce.ecommerce_amazon.ecommerce_ebay.ecommerce_shopify.education.education_university.education_financial.energy.energy_solar.energy_wind.energy_refining.energy_fuel.entertainment.entertainment_television.entertainment_film.entertainment_music.entertainment_print.financial_services.financial_services_money_services_business.financial_services_payment_processor.financial_services_fintech.financial_services_consumer_commercial_lending.fitness.food.food_restaurant_food_truck.food_manufacturing.food_service_contractors.full_service_restaurants.hardware.health_services.health_services_clinic.health_services_telehealth.health_services_holistic_services.health_services_healthcare_tech.holding.insurance.investment.investment_venture_capital.legal.legal_attorney.legal_paralegal.limited_service_restaurants.marketing.marketplace.merchant_banking.merges_and_acquisitions.mining.mobile_food_services.nonprofit.other.private_equity.professional_services.professional_services_architect.professional_services_attorney.professional_services_doctor.professional_services_engineer.professional_services_paralegal.real_estate.real_estate_short_term_rental.real_estate_development.real_estate_investing.real_estate_property_management.recruiting.research.research_medical.research_scientific.research_market.retail_wholesale.security.security_private.security_infosec.shipping_warehousing.sports_team.support_services.snack_and_nonalcoholic_beverage_bars.software.software_b2b.software_developer_tools.software_enterprise_software.technology.technology_agriculture.technology_artificial_intelligence.technology_augmented_reality.technology_community.technology_consumer.technology_drones.technology_government.technology_it_telecom.technology_robotics.technology_virtual_reality.transportation.transportation_limo_car_service.transportation_ride_share.travel.travel_agency.travel_hotel_reservations.waste_management.cannabis`.split(`.`),title:`Industry`},{type:`null`}]},legal_business_name:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Legal Business Name`},r365_instance_url:{anyOf:[{type:`string`},{type:`null`}],title:`R365 Instance Url`},restaurant_locations:{anyOf:[{type:`string`,maxLength:400,minLength:0},{type:`null`}],title:`Restaurant Locations`},provides_blockchain_or_digital_currency_services:{anyOf:[{type:`boolean`},{type:`null`}],title:`Provides Blockchain Or Digital Currency Services`},transacts_in_digital_currency:{anyOf:[{type:`boolean`},{type:`null`}],title:`Transacts In Digital Currency`},develops_governs_supports_blockchain_protocol:{anyOf:[{type:`boolean`},{type:`null`}],title:`Develops Governs Supports Blockchain Protocol`}},required:[`api_key`]},update_additional_details:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},kyb_info:{anyOf:[{properties:{business_description:{anyOf:[{type:`string`,maxLength:5e3},{type:`null`}],title:`Business Description`},business_website:{anyOf:[{type:`string`,maxLength:1e3},{type:`null`}],title:`Business Website`},legal_structure:{anyOf:[{type:`string`,enum:[`ccorp`,`corp`,`estate`,`foreign_entity`,`llc`,`llp`,`lp`,`nonprofit`,`partnership`,`scheme`,`scorp`,`soleprop`,`trust`],title:`LegalStructure`},{type:`null`}]},incorporation_state:{anyOf:[{type:`string`,enum:`AL.AK.AZ.AR.CA.CO.CT.DC.DE.FL.GA.HI.ID.IL.IN.IA.KS.KY.LA.ME.MD.MA.MI.MN.MS.MO.MT.NE.NV.NH.NJ.NM.NY.NC.ND.OH.OK.OR.PA.RI.SC.SD.TN.TX.UT.VT.VA.WA.WV.WI.WY.PR`.split(`.`),title:`StateCode`,"x-enum-varnames":`AL.AK.AZ.AR.CA.CO.CT.DC.DE.FL.GA.HI.ID.IL.IN.IA.KS.KY.LA.ME.MD.MA.MI.MN.MS.MO.MT.NE.NV.NH.NJ.NM.NY.NC.ND.OH.OK.OR.PA.RI.SC.SD.TN.TX.UT.VT.VA.WA.WV.WI.WY.PR`.split(`.`)},{type:`null`}]},prohibited_industry:{anyOf:[{type:`string`,enum:[`registered_with_sec`,`internet_gambling`,`dealing_with_controlled_substances`,`involved_in_weapons`,`adult_entertainment`,`financial_aggregation`,`counterfeit_goods`,`gift_cards`,`offering_high_yield_investment_opportunities`,`investment_and_credit`,`bail_bonds_adoption_services`,`multilevel_marketing`,`virtual_currencies`,`none`],title:`ProhibitedIndustry`},{type:`null`}]},industry:{anyOf:[{type:`string`,enum:`accounting_bookkeeping.accounting_bookkeeping_tax_preparation.advertising.art.art_theater.art_painting.art_sculpting.beauty_cosmetic_services.biotech.business_management.cafeterias_grill_buffets_buffets.caterers.cleaning_services.construction.consulting.consulting_strategy.consulting_business.consulting_financial.crypto.crypto_exchange.crypto_investments.crypto_daos.crypto_nfts.crypto_mining.saas.design.design_web.design_digital.design_interior.design_fashion.drinking_places_alcoholic_beverages.ecommerce.ecommerce_amazon.ecommerce_ebay.ecommerce_shopify.education.education_university.education_financial.energy.energy_solar.energy_wind.energy_refining.energy_fuel.entertainment.entertainment_television.entertainment_film.entertainment_music.entertainment_print.financial_services.financial_services_money_services_business.financial_services_payment_processor.financial_services_fintech.financial_services_consumer_commercial_lending.fitness.food.food_restaurant_food_truck.food_manufacturing.food_service_contractors.full_service_restaurants.hardware.health_services.health_services_clinic.health_services_telehealth.health_services_holistic_services.health_services_healthcare_tech.holding.insurance.investment.investment_venture_capital.legal.legal_attorney.legal_paralegal.limited_service_restaurants.marketing.marketplace.merchant_banking.merges_and_acquisitions.mining.mobile_food_services.nonprofit.other.private_equity.professional_services.professional_services_architect.professional_services_attorney.professional_services_doctor.professional_services_engineer.professional_services_paralegal.real_estate.real_estate_short_term_rental.real_estate_development.real_estate_investing.real_estate_property_management.recruiting.research.research_medical.research_scientific.research_market.retail_wholesale.security.security_private.security_infosec.shipping_warehousing.sports_team.support_services.snack_and_nonalcoholic_beverage_bars.software.software_b2b.software_developer_tools.software_enterprise_software.technology.technology_agriculture.technology_artificial_intelligence.technology_augmented_reality.technology_community.technology_consumer.technology_drones.technology_government.technology_it_telecom.technology_robotics.technology_virtual_reality.transportation.transportation_limo_car_service.transportation_ride_share.travel.travel_agency.travel_hotel_reservations.waste_management.cannabis`.split(`.`),title:`Industry`},{type:`null`}]},account_purpose:{anyOf:[{type:`string`,enum:[`additional_yield`,`business_operations`,`other`],title:`AccountPurpose`},{type:`null`}]},account_purpose_description:{anyOf:[{type:`string`},{type:`null`}],title:`Account Purpose Description`},twentyfive_or_more_transactions_a_month:{anyOf:[{type:`boolean`},{type:`null`}],title:`Twentyfive Or More Transactions A Month`},international_wires:{type:`boolean`,title:`International Wires`,default:!1},international_activity_countries:{type:`null`,title:`International Activity Countries`},international_activity_description:{type:`null`,title:`International Activity Description`},business_phone:{anyOf:[{type:`string`,maxLength:50},{type:`null`}],title:`Business Phone`},business_date_of_incorporation:{anyOf:[{type:`string`,format:`date`},{type:`null`}],title:`Business Date Of Incorporation`},industry_category_code:{anyOf:[{type:`string`,enum:`ICCV3_0000XX.ICCV3_0001XX.ICCV3_0002XX.ICCV3_000300.ICCV3_000301.ICCV3_0004XX.ICCV3_000500.ICCV3_000501.ICCV3_0006XX.ICCV3_0007XX.ICCV3_1012XX.ICCV3_1000XX.ICCV3_1001XX.ICCV3_1002XX.ICCV3_1003XX.ICCV3_1004XX.ICCV3_1005XX.ICCV3_100600.ICCV3_100601.ICCV3_1007XX.ICCV3_1008XX.ICCV3_1009XX.ICCV3_1010XX.ICCV3_1011XX.ICCV3_1018XX.ICCV3_1013XX.ICCV3_1014XX.ICCV3_101500.ICCV3_101501.ICCV3_1016XX.ICCV3_1017XX.ICCV3_1019XX.ICCV3_1020XX.ICCV3_1021XX.ICCV3_1022XX.ICCV3_1023XX.ICCV3_102801.ICCV3_102802.ICCV3_1024XX.ICCV3_1025XX.ICCV3_1026XX.ICCV3_1027XX.ICCV3_0100XX.ICCV3_0101XX.ICCV3_0102XX.ICCV3_0103XX.ICCV3_0104XX.ICCV3_0105XX.ICCV3_0200XX.ICCV3_0201XX.ICCV3_0202XX.ICCV3_0203XX.ICCV3_0204XX.ICCV3_0205XX.ICCV3_0206XX.ICCV3_0207XX.ICCV3_0208XX.ICCV3_0209XX.ICCV3_0210XX.ICCV3_0211XX.ICCV3_0212XX.ICCV3_1101XX.ICCV3_1100XX.ICCV3_1102XX.ICCV3_1103XX.ICCV3_1104XX.ICCV3_1105XX.ICCV3_1106XX.ICCV3_1107XX.ICCV3_1108XX.ICCV3_1109XX.ICCV3_1210XX.ICCV3_1200XX.ICCV3_1201XX.ICCV3_1202XX.ICCV3_1203XX.ICCV3_1204XX.ICCV3_1205XX.ICCV3_120600.ICCV3_120601.ICCV3_1207XX.ICCV3_1208XX.ICCV3_1209XX.ICCV3_1211XX.ICCV3_1212XX.ICCV3_1213XX.ICCV3_1214XX.ICCV3_121500.ICCV3_121501.ICCV3_1216XX.ICCV3_1217XX.ICCV3_1218XX.ICCV3_1219XX.ICCV3_1220XX.ICCV3_1221XX.ICCV3_122501.ICCV3_122502.ICCV3_1222XX.ICCV3_1223XX.ICCV3_1224XX.ICCV3_0300XX.ICCV3_0301XX.ICCV3_0302XX.ICCV3_0303XX.ICCV3_0304XX.ICCV3_0305XX.ICCV3_0306XX.ICCV3_0307XX.ICCV3_0400XX.ICCV3_0401XX.ICCV3_0402XX.ICCV3_0403XX.ICCV3_0404XX.ICCV3_0405XX.ICCV3_0406XX.ICCV3_0407XX.ICCV3_0408XX.ICCV3_0409XX.ICCV3_0410XX.ICCV3_0411XX.ICCV3_0412XX.ICCV3_041501.ICCV3_041502.ICCV3_0413XX.ICCV3_0414XX.ICCV3_0500XX.ICCV3_0501XX.ICCV3_0502XX.ICCV3_0503XX.ICCV3_0504XX.ICCV3_0505XX.ICCV3_0600XX.ICCV3_0601XX.ICCV3_0603XX.ICCV3_0700XX.ICCV3_0701XX.ICCV3_0702XX.ICCV3_0703XX.ICCV3_0704XX.ICCV3_0705XX.ICCV3_0706XX.ICCV3_0800XX.ICCV3_0801XX.ICCV3_0802XX.ICCV3_0803XX.ICCV3_0804XX.ICCV3_0805XX.ICCV3_0806XX.ICCV3_0807XX.ICCV3_0808XX.ICCV3_0809XX.ICCV3_0810XX.ICCV3_0811XX.ICCV3_0812XX.ICCV3_0813XX.ICCV3_0900XX.ICCV3_0901XX.ICCV3_0902XX.ICCV3_0903XX.ICCV3_0904XX.ICCV3_0905XX.ICCV3_0906XX.ICCV3_0907XX.ICCV3_0908XX`.split(`.`),title:`AwxIndustryCategoryCode`,"x-enum-varnames":`ICCV3_0000XX.ICCV3_0001XX.ICCV3_0002XX.ICCV3_000300.ICCV3_000301.ICCV3_0004XX.ICCV3_000500.ICCV3_000501.ICCV3_0006XX.ICCV3_0007XX.ICCV3_1012XX.ICCV3_1000XX.ICCV3_1001XX.ICCV3_1002XX.ICCV3_1003XX.ICCV3_1004XX.ICCV3_1005XX.ICCV3_100600.ICCV3_100601.ICCV3_1007XX.ICCV3_1008XX.ICCV3_1009XX.ICCV3_1010XX.ICCV3_1011XX.ICCV3_1018XX.ICCV3_1013XX.ICCV3_1014XX.ICCV3_101500.ICCV3_101501.ICCV3_1016XX.ICCV3_1017XX.ICCV3_1019XX.ICCV3_1020XX.ICCV3_1021XX.ICCV3_1022XX.ICCV3_1023XX.ICCV3_102801.ICCV3_102802.ICCV3_1024XX.ICCV3_1025XX.ICCV3_1026XX.ICCV3_1027XX.ICCV3_0100XX.ICCV3_0101XX.ICCV3_0102XX.ICCV3_0103XX.ICCV3_0104XX.ICCV3_0105XX.ICCV3_0200XX.ICCV3_0201XX.ICCV3_0202XX.ICCV3_0203XX.ICCV3_0204XX.ICCV3_0205XX.ICCV3_0206XX.ICCV3_0207XX.ICCV3_0208XX.ICCV3_0209XX.ICCV3_0210XX.ICCV3_0211XX.ICCV3_0212XX.ICCV3_1101XX.ICCV3_1100XX.ICCV3_1102XX.ICCV3_1103XX.ICCV3_1104XX.ICCV3_1105XX.ICCV3_1106XX.ICCV3_1107XX.ICCV3_1108XX.ICCV3_1109XX.ICCV3_1210XX.ICCV3_1200XX.ICCV3_1201XX.ICCV3_1202XX.ICCV3_1203XX.ICCV3_1204XX.ICCV3_1205XX.ICCV3_120600.ICCV3_120601.ICCV3_1207XX.ICCV3_1208XX.ICCV3_1209XX.ICCV3_1211XX.ICCV3_1212XX.ICCV3_1213XX.ICCV3_1214XX.ICCV3_121500.ICCV3_121501.ICCV3_1216XX.ICCV3_1217XX.ICCV3_1218XX.ICCV3_1219XX.ICCV3_1220XX.ICCV3_1221XX.ICCV3_122501.ICCV3_122502.ICCV3_1222XX.ICCV3_1223XX.ICCV3_1224XX.ICCV3_0300XX.ICCV3_0301XX.ICCV3_0302XX.ICCV3_0303XX.ICCV3_0304XX.ICCV3_0305XX.ICCV3_0306XX.ICCV3_0307XX.ICCV3_0400XX.ICCV3_0401XX.ICCV3_0402XX.ICCV3_0403XX.ICCV3_0404XX.ICCV3_0405XX.ICCV3_0406XX.ICCV3_0407XX.ICCV3_0408XX.ICCV3_0409XX.ICCV3_0410XX.ICCV3_0411XX.ICCV3_0412XX.ICCV3_041501.ICCV3_041502.ICCV3_0413XX.ICCV3_0414XX.ICCV3_0500XX.ICCV3_0501XX.ICCV3_0502XX.ICCV3_0503XX.ICCV3_0504XX.ICCV3_0505XX.ICCV3_0600XX.ICCV3_0601XX.ICCV3_0603XX.ICCV3_0700XX.ICCV3_0701XX.ICCV3_0702XX.ICCV3_0703XX.ICCV3_0704XX.ICCV3_0705XX.ICCV3_0706XX.ICCV3_0800XX.ICCV3_0801XX.ICCV3_0802XX.ICCV3_0803XX.ICCV3_0804XX.ICCV3_0805XX.ICCV3_0806XX.ICCV3_0807XX.ICCV3_0808XX.ICCV3_0809XX.ICCV3_0810XX.ICCV3_0811XX.ICCV3_0812XX.ICCV3_0813XX.ICCV3_0900XX.ICCV3_0901XX.ICCV3_0902XX.ICCV3_0903XX.ICCV3_0904XX.ICCV3_0905XX.ICCV3_0906XX.ICCV3_0907XX.ICCV3_0908XX`.split(`.`)},{type:`null`}]},operating_countries:{anyOf:[{items:{type:`string`,enum:`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`),title:`CountryCodeAlpha2`,"x-enum-varnames":`AW.AF.AO.AI.AX.AL.AD.AE.AR.AM.AS.AQ.TF.AG.AU.AT.AZ.BI.BE.BJ.BQ.BF.BD.BG.BH.BS.BA.BL.BY.BZ.BM.BO.BR.BB.BN.BT.BV.BW.CF.CA.CC.CH.CL.CN.CI.CM.CD.CG.CK.CO.KM.CV.CR.CU.CW.CX.KY.CY.CZ.DE.DJ.DM.DK.DO.DZ.EC.EG.ER.EH.ES.EE.ET.FI.FJ.FK.FR.FO.FM.GA.GB.GE.GG.GH.GI.GN.GP.GM.GW.GQ.GR.GD.GL.GT.GF.GU.GY.HK.HM.HN.HR.HT.HU.ID.IM.IN.IO.IE.IR.IQ.IS.IL.IT.JM.JE.JO.JP.KZ.KE.KG.KH.KI.KN.KR.KW.LA.LB.LR.LY.LC.LI.LK.LS.LT.LU.LV.MO.MF.MA.MC.MD.MG.MV.MX.MH.MK.ML.MT.MM.ME.MN.MP.MZ.MR.MS.MQ.MU.MW.MY.YT.NA.NC.NE.NF.NG.NI.NU.NL.NO.NP.NR.NZ.OM.PK.PA.PN.PE.PH.PW.PG.PL.PR.KP.PT.PY.PS.PF.QA.RE.RO.RU.RW.SA.SD.SN.SG.GS.SH.SJ.SB.SL.SV.SM.SO.PM.RS.SS.ST.SR.SK.SI.SE.SZ.SX.SC.SY.TC.TD.TG.TH.TJ.TK.TM.TL.TO.TT.TN.TR.TV.TW.TZ.UG.UA.UM.UY.US.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.ZA.ZM.ZW`.split(`.`)},type:`array`,uniqueItems:!0},{type:`null`}],title:`Operating Countries`},estimated_monthly_revenue_amount:{anyOf:[{type:`number`,exclusiveMaximum:1e9,minimum:0},{type:`string`,pattern:`^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d{0,0}0*$`},{type:`null`}],title:`Estimated Monthly Revenue Amount`},estimated_monthly_revenue_currency:{anyOf:[{type:`string`,enum:`AED.AFN.ALL.AMD.ANG.AOA.ARS.AUD.AWG.AZN.BAM.BBD.BDT.BGN.BHD.BIF.BMD.BND.BOB.BOV.BRL.BSD.BTN.BWP.BYN.BZD.CAD.CDF.CHE.CHF.CHW.CLF.CLP.CNY.COP.COU.CRC.CUC.CUP.CVE.CZK.DJF.DKK.DOP.DZD.EGP.ERN.ETB.EUR.FJD.FKP.GBP.GEL.GHS.GIP.GMD.GNF.GTQ.GYD.HKD.HNL.HRK.HTG.HUF.IDR.ILS.INR.IQD.IRR.ISK.JMD.JOD.JPY.KES.KGS.KHR.KMF.KPW.KRW.KWD.KYD.KZT.LAK.LBP.LKR.LRD.LSL.LYD.MAD.MDL.MGA.MKD.MMK.MNT.MOP.MRU.MUR.MVR.MWK.MXN.MXV.MYR.MZN.NAD.NGN.NIO.NOK.NPR.NZD.OMR.PAB.PEN.PGK.PHP.PKR.PLN.PYG.QAR.RON.RSD.RUB.RWF.SAR.SBD.SCR.SDG.SLE.SEK.SGD.SHP.SLL.SOS.SRD.SSP.STN.SVC.SYP.SZL.THB.TJS.TMT.TND.TOP.TRY.TTD.TWD.TZS.UAH.UGX.USD.USN.UYI.UYU.UYW.UZS.VED.VES.VND.VUV.WST.XAF.XAG.XAU.XBA.XBB.XBC.XBD.XCD.XDR.XOF.XPD.XPF.XPT.XSU.XTS.XUA.XXX.YER.ZAR.ZMW.ZWG.ZWL`.split(`.`),title:`Iso4217Code`},{type:`null`}]},estimated_amount_per_invoice:{anyOf:[{type:`integer`,exclusiveMinimum:0},{type:`null`}],title:`Estimated Amount Per Invoice`},estimated_max_amount_per_invoice:{anyOf:[{type:`integer`,exclusiveMinimum:0},{type:`null`}],title:`Estimated Max Amount Per Invoice`},estimated_monthly_invoice_volume:{anyOf:[{type:`integer`,exclusiveMinimum:0},{type:`null`}],title:`Estimated Monthly Invoice Volume`},account_number:{anyOf:[{type:`string`},{type:`null`}],title:`Account Number`},routing_number:{anyOf:[{type:`string`},{type:`null`}],title:`Routing Number`},account_type:{anyOf:[{type:`string`},{type:`null`}],title:`Account Type`},business_nickname:{anyOf:[{type:`string`},{type:`null`}],title:`Business Nickname`},provides_blockchain_or_digital_currency_services:{anyOf:[{type:`boolean`},{type:`null`}],title:`Provides Blockchain Or Digital Currency Services`},transacts_in_digital_currency:{anyOf:[{type:`boolean`},{type:`null`}],title:`Transacts In Digital Currency`},develops_governs_supports_blockchain_protocol:{anyOf:[{type:`boolean`},{type:`null`}],title:`Develops Governs Supports Blockchain Protocol`}},type:`object`,title:`McpUpdateKybInfoData`},{type:`null`}]}},required:[`api_key`]},create_business_representative:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},to_email:{type:`string`,title:`To Email`,description:`Email address of the representative`},title_id:{type:`string`,enum:[`chief executive officer`,`chief financial officer`,`chief operating officer`,`finance manager`,`general partner`,`managing member`,`president`],title:`Title Id`,description:`Job title of the representative`},is_beneficial_owner:{type:`boolean`,title:`Is Beneficial Owner`,description:`Whether this person owns 10%+ of the business`},percent_ownership:{anyOf:[{type:`number`,maximum:100,minimum:10},{type:`string`,pattern:`^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$`},{type:`null`}],title:`Percent Ownership`,description:`Ownership percentage (required if beneficial owner)`},significant_responsibility:{anyOf:[{type:`boolean`},{type:`null`}],title:`Significant Responsibility`,description:`Whether this person has significant management responsibility`},is_primary_representative:{type:`boolean`,title:`Is Primary Representative`,description:`Whether this is the primary signer`,default:!1},send_email:{type:`boolean`,title:`Send Email`,description:`Whether to send an invitation email`,default:!1}},required:[`api_key`,`to_email`,`title_id`,`is_beneficial_owner`]},get_onboarding_status:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`}},required:[`api_key`]},check_identity_verification:{type:`object`,properties:{representative_id:{type:`string`,format:`uuid`,title:`Representative Id`},api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`}},required:[`representative_id`,`api_key`]},upload_document:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},proof_type:{type:`string`,enum:`accredited.address.articles_of_organization.bank_statement.client_contract.client_invoice.beneficial_owner_address.beneficial_owner_id.beneficial_owner_id_back.beneficial_ownership_register.certificate_of_good_standing.corporate_resolution.drivers_license.due_diligence.ein.government_issued_business_license.hemp_cultivator_state_license.incorporation.industry_related_license.lease_agreement.llc_resolution.money_service_business_license.money_transmitter_registration.mortgage_statement.national_id.org_chart.partnership_agreement.partnership_agreement_due_diligence.partnership_resolution.personal_address.remote_employees_due_diligence.signed_ss4.tax_exemption_certificate.uk_officer_passport.uk_officer_registry.uk_registry.uk_shareholder_registry.uk_w8_en.utility_bill.us_based_office_proof_of_address_due_diligence.pitch_deck.active_business_registration.proof_of_ownership_or_banking_authorization.non_profit_bylaws.operating_agreement.flow_of_funds.aml_sanction.registration_or_license.sec_filing.legal_opinion.certificate_of_formation_master_llc.series_operating_agreement.share_subscription_agreement.fund_subscription_agreement.safe_agreement.convertible_note_agreement.loan_promissory_note.token_purchase_agreement.saft_agreement.deal_memo_hybrid_agreement.issuer_due_diligence_report.protocol_ecosystem_questionnaire.investment_company_due_diligence_form.us_based_operations_due_diligence_form.register_of_directors.articles_of_association.memorandum_of_association.non_profit_status.ofac_sanctions_screening_policy.aml_kyc_policy.w8_bene.corporate_structure_chart.sanctions_vendor_service_agreement.contractual_fund_flow_agreements`.split(`.`),title:`KybProofType`,description:`Type of document (e.g. incorporation, uk_shareholder_registry, uk_officer_registry)`},file_name:{type:`string`,title:`File Name`,description:`File name including extension (e.g. articles_of_org.pdf)`},file_content_base64:{type:`string`,title:`File Content Base64`,description:`Base64-encoded file content`},content_type:{type:`string`,title:`Content Type`,description:`MIME type (application/pdf, image/jpeg, image/png)`,default:`application/pdf`}},required:[`api_key`,`proof_type`,`file_name`,`file_content_base64`]},confirm_onboarding:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`}},required:[`api_key`]},get_info_requests:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`}},required:[`api_key`]},submit_followup_answers:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},request_id:{type:`string`,format:`uuid`,title:`Request Id`,description:`The info request ID from get_info_requests response`},answers:{additionalProperties:{anyOf:[{type:`string`},{type:`boolean`},{type:`integer`},{type:`number`},{items:{},type:`array`},{additionalProperties:!0,type:`object`},{type:`null`}]},type:`object`,title:`Answers`,description:`Answers keyed by question field name. Values depend on the question type: string for text/dropdown/comment, bool for boolean/confirm, number for number, list[str] for checkbox/text_list, string (YYYY-MM-DD) for date, country/state code for country_select/state_select.`}},required:[`api_key`,`request_id`,`answers`]},upload_followup_document:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`},request_id:{type:`string`,format:`uuid`,title:`Request Id`,description:`The info request ID from get_info_requests response`},proof_type:{type:`string`,enum:`accredited.address.articles_of_organization.bank_statement.client_contract.client_invoice.beneficial_owner_address.beneficial_owner_id.beneficial_owner_id_back.beneficial_ownership_register.certificate_of_good_standing.corporate_resolution.drivers_license.due_diligence.ein.government_issued_business_license.hemp_cultivator_state_license.incorporation.industry_related_license.lease_agreement.llc_resolution.money_service_business_license.money_transmitter_registration.mortgage_statement.national_id.org_chart.partnership_agreement.partnership_agreement_due_diligence.partnership_resolution.personal_address.remote_employees_due_diligence.signed_ss4.tax_exemption_certificate.uk_officer_passport.uk_officer_registry.uk_registry.uk_shareholder_registry.uk_w8_en.utility_bill.us_based_office_proof_of_address_due_diligence.pitch_deck.active_business_registration.proof_of_ownership_or_banking_authorization.non_profit_bylaws.operating_agreement.flow_of_funds.aml_sanction.registration_or_license.sec_filing.legal_opinion.certificate_of_formation_master_llc.series_operating_agreement.share_subscription_agreement.fund_subscription_agreement.safe_agreement.convertible_note_agreement.loan_promissory_note.token_purchase_agreement.saft_agreement.deal_memo_hybrid_agreement.issuer_due_diligence_report.protocol_ecosystem_questionnaire.investment_company_due_diligence_form.us_based_operations_due_diligence_form.register_of_directors.articles_of_association.memorandum_of_association.non_profit_status.ofac_sanctions_screening_policy.aml_kyc_policy.w8_bene.corporate_structure_chart.sanctions_vendor_service_agreement.contractual_fund_flow_agreements`.split(`.`),title:`KybProofType`,description:`Document type matching one of the required_proofs from the info request`},file_name:{type:`string`,title:`File Name`,description:`File name including extension (e.g. proof_of_address.pdf)`},file_content_base64:{type:`string`,title:`File Content Base64`,description:`Base64-encoded file content`},content_type:{type:`string`,title:`Content Type`,description:`MIME type (application/pdf, image/jpeg, image/png)`,default:`application/pdf`}},required:[`api_key`,`request_id`,`proof_type`,`file_name`,`file_content_base64`]},get_next_step:{type:`object`,properties:{api_key:{type:`string`,title:`Api Key`,description:`API key from issue_onboarding_key`}},required:[`api_key`]}},embeddedName=`meow-onboarding`,embeddedDescription=`Create a Meow business banking account and complete onboarding. Start with create_account to sign up, then verify_email. After verification, call issue_onboarding_key to get an API key. Use that API key for all subsequent onboarding tools.`,generatorInfo=`Generated by @joinmeow/onboarding-cli@0.0.2 — https://github.com/steipete/mcporter`,generatorTools=[{name:`create-account`,description:`Create a new Meow business banking account. A verification code will be sent to the provided email.`,usage:`create-account --email <email:email> [--raw <json>]`,flags:`--email <email:email> [--raw <json>]`},{name:`verify-email`,description:`Verify email address with the 6-digit code sent to your email. Returns a short-lived verification_token required for issue_onboarding_key.`,usage:`verify-email --email <email:email> --code <code> [--raw <json>]`,flags:`--email <email:email> --code <code> [--raw <json>]`},{name:`resend-verification-code`,description:`Resend the email verification code.`,usage:`resend-verification-code --email <email:email> [--raw <json>]`,flags:`--email <email:email> [--raw <json>]`},{name:`issue-onboarding-key`,description:`Issue an API key for onboarding after email verification. Use the returned api_key in the api_key parameter of all onboarding tools.`,usage:`issue-onboarding-key --email <email:email> --verification-token <verification-token> [--raw <json>]`,flags:`--email <email:email> --verification-token <verification-token> [--raw <json>]`},{name:`update-user-info`,description:`Update the primary user's name.`,usage:`update-user-info --api-key <api-key> [--first-name <first-name>] [--middle-name <middle-name>] [--last-name <last-name>] [--user-permissions <user-permissions:true|false>] [--raw <json>]`,flags:`--api-key <api-key> [--first-name <first-name>] [--middle-name <middle-name>] [--last-name <last-name>] [--user-permissions <user-permissions:true|false>] [--raw <json>]`},{name:`update-business-address`,description:`Update the business legal and physical addresses.`,usage:`update-business-address --api-key <api-key> [--business <business:json>] [--physical <physical:json>] [--raw <json>]`,flags:`--api-key <api-key> [--business <business:json>] [--physical <physical:json>] [--raw <json>]`},{name:`update-business-details`,description:`Update business name, phone, EIN, incorporation details, and industry.`,usage:`update-business-details --api-key <api-key> [--is-r365 <is-r365:true|false>] [--business-name <business-name>] [--business-nickname <business-nickname>] [--business-dba-name <business-dba-name>] [--raw <json>]`,flags:`--api-key <api-key> [--is-r365 <is-r365:true|false>] [--business-name <business-name>] [--business-nickname <business-nickname>] [--business-dba-name <business-dba-name>] [--raw <json>]`},{name:`update-additional-details`,description:`Update account purpose and crypto/blockchain details.`,usage:`update-additional-details --api-key <api-key> [--kyb-info <kyb-info>] [--raw <json>]`,flags:`--api-key <api-key> [--kyb-info <kyb-info>] [--raw <json>]`},{name:`create-business-representative`,description:`Add a business representative. For the primary representative, returns a Plaid identity verification link. For other representatives, an IDV link is emailed to them.`,usage:`create-business-representative --api-key <api-key> --to-email <to-email> --title-id <title-id:chief executive officer|chief financial officer|chief operating officer|finance manager|general partner|managing member|president> --is-beneficial-owner <is-beneficial-owner:true|false> [--percent-ownership <percent-ownership>] [--raw <json>]`,flags:`--api-key <api-key> --to-email <to-email> --title-id <title-id:chief executive officer|chief financial officer|chief operating officer|finance manager|general partner|managing member|president> --is-beneficial-owner <is-beneficial-owner:true|false> [--percent-ownership <percent-ownership>] [--raw <json>]`},{name:`get-onboarding-status`,description:`Get full onboarding details including representative IDs.`,usage:`get-onboarding-status --api-key <api-key> [--raw <json>]`,flags:`--api-key <api-key> [--raw <json>]`},{name:`check-identity-verification`,description:`Check the status of identity verification for a representative.`,usage:`check-identity-verification --representative-id <representative-id:uuid> --api-key <api-key> [--raw <json>]`,flags:`--representative-id <representative-id:uuid> --api-key <api-key> [--raw <json>]`},{name:`upload-document`,description:`Upload a KYB proof document (base64-encoded).`,usage:`upload-document --api-key <api-key> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--content-type <content-type>] [--raw <json>]`,flags:`--api-key <api-key> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--content-type <content-type>] [--raw <json>]`},{name:`confirm-onboarding`,description:`Submit the onboarding application for review.`,usage:`confirm-onboarding --api-key <api-key> [--raw <json>]`,flags:`--api-key <api-key> [--raw <json>]`},{name:`get-info-requests`,description:`Poll for compliance review status and any follow-up information requests. Returns the review status (pending/running/completed/failed) and any active document or question requests.`,usage:`get-info-requests --api-key <api-key> [--raw <json>]`,flags:`--api-key <api-key> [--raw <json>]`},{name:`submit-followup-answers`,description:`Submit answers to followup questions from an info request. Pass the request_id from get_info_requests and answers keyed by question field name. If all questions are answered and all required documents uploaded, the request is marked complete and triggers a compliance re-review.`,usage:`submit-followup-answers --api-key <api-key> --request-id <request-id:uuid> --answers <answers:json> [--raw <json>]`,flags:`--api-key <api-key> --request-id <request-id:uuid> --answers <answers:json> [--raw <json>]`},{name:`upload-followup-document`,description:`Upload a document required by an info request. Pass the request_id from get_info_requests and the proof_type matching one of the required_proofs. The document is tied to the info request for completion tracking.`,usage:`upload-followup-document --api-key <api-key> --request-id <request-id:uuid> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--raw <json>]`,flags:`--api-key <api-key> --request-id <request-id:uuid> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--raw <json>]`},{name:`get-next-step`,description:`Get the current onboarding phase and what to do next. Returns allowed tools, phase description, and whether the application can be submitted.`,usage:`get-next-step --api-key <api-key> [--raw <json>]`,flags:`--api-key <api-key> [--raw <json>]`}],embeddedMetadata={schemaVersion:1,generatedAt:`2026-04-03T01:02:20.137Z`,generator:{name:`@joinmeow/onboarding-cli`,version:`0.0.2`},server:{name:`meow-onboarding`,definition:{name:`meow-onboarding`,description:`Create a Meow business banking account and complete onboarding. Start with create_account to sign up, then verify_email. After verification, call issue_onboarding_key to get an API key. Use that API key for all subsequent onboarding tools.`,command:{kind:`http`,url:`https://onboarding-mcp.dev.meow.com/`}}},artifact:{path:``,kind:`template`},invocation:{serverRef:`{"name":"meow-onboarding","command":"https://onboarding-mcp.dev.meow.com/"}`,runtime:`node`,bundler:`rolldown`,outputPath:`dist/cli.ts`,bundle:`dist/cli.cjs`,timeoutMs:3e4,minify:!0}},artifactKind=determineArtifactKind(),program=new import_commander.Command;program.name(embeddedName),program.description(embeddedDescription),program.option(`-t, --timeout <ms>`,`Call timeout in milliseconds`,e=>parseInt(e,10),3e4),program.option(`-o, --output <format>`,`Output format: text|markdown|json|raw`,`text`);const commandSignatures={"create-account":`function create_account(email: string): SignupResponse;`,"verify-email":`function verify_email(email: string, code: string): McpVerifyEmailResponse;`,"resend-verification-code":`function resend_verification_code(email: string): SignupResponse;`,"issue-onboarding-key":`function issue_onboarding_key(email: string, verification_token: string): IssueOnboardingKeyResponse;`,"update-user-info":`function update_user_info(api_key: string, first_name?: unknown, middle_name?: unknown, last_name?: unknown, user_permissions?: boolean): McpToolResponse;`,"update-business-address":`function update_business_address(api_key: string, business?: Record<string, unknown>, physical?: Record<string, unknown>): McpToolResponse;`,"update-business-details":`function update_business_details(api_key: string, is_r365?: boolean, business_name?: unknown, business_nickname?: unknown, business_dba_name?: unknown): McpToolResponse;`,"update-additional-details":`function update_additional_details(api_key: string, kyb_info?: unknown): McpToolResponse;`,"create-business-representative":`function create_business_representative(api_key: string, to_email: string, title_id: "chief executive officer" | "chief financial officer" | "chief operating officer" | "finance manager" | "general partner" | "managing member" | "president", is_beneficial_owner: boolean, percent_ownership?: unknown): McpCreateRepresentativeResponse;`,"get-onboarding-status":`function get_onboarding_status(api_key: string): McpOnboardingStatus;`,"check-identity-verification":`function check_identity_verification(representative_id: string /* UUID */, api_key: string): CheckIdentityVerificationResponse;`,"upload-document":`function upload_document(api_key: string, proof_type: "accredited" | "address" | "articles_of_organization" | "bank_statement" | "client_contract" | "client_invoice" | "beneficial_owner_address" | "beneficial_owner_id" | "beneficial_owner_id_back" | "beneficial_ownership_register" | "certificate_of_good_standing" | "corporate_resolution" | "drivers_license" | "due_diligence" | "ein" | "government_issued_business_license" | "hemp_cultivator_state_license" | "incorporation" | "industry_related_license" | "lease_agreement" | "llc_resolution" | "money_service_business_license" | "money_transmitter_registration" | "mortgage_statement" | "national_id" | "org_chart" | "partnership_agreement" | "partnership_agreement_due_diligence" | "partnership_resolution" | "personal_address" | "remote_employees_due_diligence" | "signed_ss4" | "tax_exemption_certificate" | "uk_officer_passport" | "uk_officer_registry" | "uk_registry" | "uk_shareholder_registry" | "uk_w8_en" | "utility_bill" | "us_based_office_proof_of_address_due_diligence" | "pitch_deck" | "active_business_registration" | "proof_of_ownership_or_banking_authorization" | "non_profit_bylaws" | "operating_agreement" | "flow_of_funds" | "aml_sanction" | "registration_or_license" | "sec_filing" | "legal_opinion" | "certificate_of_formation_master_llc" | "series_operating_agreement" | "share_subscription_agreement" | "fund_subscription_agreement" | "safe_agreement" | "convertible_note_agreement" | "loan_promissory_note" | "token_purchase_agreement" | "saft_agreement" | "deal_memo_hybrid_agreement" | "issuer_due_diligence_report" | "protocol_ecosystem_questionnaire" | "investment_company_due_diligence_form" | "us_based_operations_due_diligence_form" | "register_of_directors" | "articles_of_association" | "memorandum_of_association" | "non_profit_status" | "ofac_sanctions_screening_policy" | "aml_kyc_policy" | "w8_bene" | "corporate_structure_chart" | "sanctions_vendor_service_agreement" | "contractual_fund_flow_agreements", file_name: string, file_content_base64: string, content_type?: string): McpToolResponse;`,"confirm-onboarding":`function confirm_onboarding(api_key: string): McpToolResponse;`,"get-info-requests":`function get_info_requests(api_key: string): GetInfoRequestsResponse;`,"submit-followup-answers":`function submit_followup_answers(api_key: string, request_id: string /* UUID */, answers: Record<string, unknown>): SubmitFollowupAnswersResponse;`,"upload-followup-document":`function upload_followup_document(api_key: string, request_id: string /* UUID */, proof_type: "accredited" | "address" | "articles_of_organization" | "bank_statement" | "client_contract" | "client_invoice" | "beneficial_owner_address" | "beneficial_owner_id" | "beneficial_owner_id_back" | "beneficial_ownership_register" | "certificate_of_good_standing" | "corporate_resolution" | "drivers_license" | "due_diligence" | "ein" | "government_issued_business_license" | "hemp_cultivator_state_license" | "incorporation" | "industry_related_license" | "lease_agreement" | "llc_resolution" | "money_service_business_license" | "money_transmitter_registration" | "mortgage_statement" | "national_id" | "org_chart" | "partnership_agreement" | "partnership_agreement_due_diligence" | "partnership_resolution" | "personal_address" | "remote_employees_due_diligence" | "signed_ss4" | "tax_exemption_certificate" | "uk_officer_passport" | "uk_officer_registry" | "uk_registry" | "uk_shareholder_registry" | "uk_w8_en" | "utility_bill" | "us_based_office_proof_of_address_due_diligence" | "pitch_deck" | "active_business_registration" | "proof_of_ownership_or_banking_authorization" | "non_profit_bylaws" | "operating_agreement" | "flow_of_funds" | "aml_sanction" | "registration_or_license" | "sec_filing" | "legal_opinion" | "certificate_of_formation_master_llc" | "series_operating_agreement" | "share_subscription_agreement" | "fund_subscription_agreement" | "safe_agreement" | "convertible_note_agreement" | "loan_promissory_note" | "token_purchase_agreement" | "saft_agreement" | "deal_memo_hybrid_agreement" | "issuer_due_diligence_report" | "protocol_ecosystem_questionnaire" | "investment_company_due_diligence_form" | "us_based_operations_due_diligence_form" | "register_of_directors" | "articles_of_association" | "memorandum_of_association" | "non_profit_status" | "ofac_sanctions_screening_policy" | "aml_kyc_policy" | "w8_bene" | "corporate_structure_chart" | "sanctions_vendor_service_agreement" | "contractual_fund_flow_agreements", file_name: string, file_content_base64: string): UploadFollowupDocumentResponse;`,"get-next-step":`function get_next_step(api_key: string): NextStepResult;`};program.configureHelp({commandTerm(e){return commandSignatures[e.name()]??e.name()}}),program.showSuggestionAfterError(!0),program.command(`create-account`).summary(`create-account --email <email:email> [--raw <json>]`).description(`Create a new Meow business banking account. A verification code will be sent to the provided email.`).usage(`--email <email:email> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--email <email:email>`,`Email address for the new account`).alias(`create_account`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.email!==void 0&&(n.email=e.email),printResult(await invokeWithTimeout(i.createAccount(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
110
+ Example:
111
+ mcporter call meow-onboarding.create_account(email: "value")`),program.command(`verify-email`).summary(`verify-email --email <email:email> --code <code> [--raw <json>]`).description(`Verify email address with the 6-digit code sent to your email. Returns a short-lived verification_token required for issue_onboarding_key.`).usage(`--email <email:email> --code <code> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--email <email:email>`,`Email address to verify`).requiredOption(`--code <code>`,`6-digit verification code from email`).alias(`verify_email`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.email!==void 0&&(n.email=e.email),e.code!==void 0&&(n.code=e.code),printResult(await invokeWithTimeout(i.verifyEmail(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
112
+ Example:
113
+ mcporter call meow-onboarding.verify_email(email: "value", code: "value")`),program.command(`resend-verification-code`).summary(`resend-verification-code --email <email:email> [--raw <json>]`).description(`Resend the email verification code.`).usage(`--email <email:email> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--email <email:email>`,`Email address to resend verification code to`).alias(`resend_verification_code`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.email!==void 0&&(n.email=e.email),printResult(await invokeWithTimeout(i.resendVerificationCode(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
114
+ Example:
115
+ mcporter call meow-onboarding.resend_verification_code(email: "value")`),program.command(`issue-onboarding-key`).summary(`issue-onboarding-key --email <email:email> --verification-token <verification-token> [--raw <json>]`).description(`Issue an API key for onboarding after email verification. Use the returned api_key in the api_key parameter of all onboarding tools.`).usage(`--email <email:email> --verification-token <verification-token> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--email <email:email>`,`Email address of the verified account`).requiredOption(`--verification-token <verification-token>`,`Token returned by verify_email`).alias(`issue_onboarding_key`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.email!==void 0&&(n.email=e.email),e.verificationToken!==void 0&&(n.verification_token=e.verificationToken),printResult(await invokeWithTimeout(i.issueOnboardingKey(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
116
+ Example:
117
+ mcporter call meow-onboarding.issue_onboarding_key(email: "value", verific, ...)`),program.command(`update-user-info`).summary(`update-user-info --api-key <api-key> [--first-name <first-name>] [--middle-name <middle-name>] [--last-name <last-name>] [--user-permissions <user-permissions:true|false>] [--raw <json>]`).description(`Update the primary user's name.`).usage(`--api-key <api-key> [--first-name <first-name>] [--middle-name <middle-name>] [--last-name <last-name>] [--user-permissions <user-permissions:true|false>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).option(`--first-name <first-name>`,`Set first_name.`).option(`--middle-name <middle-name>`,`Set middle_name. (example: example-id)`).option(`--last-name <last-name>`,`Set last_name.`).option(`--user-permissions <user-permissions:true|false>`,`Set user_permissions. (default: false; example: false)`,e=>e!==`false`).alias(`update_user_info`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.firstName!==void 0&&(n.first_name=e.firstName),e.middleName!==void 0&&(n.middle_name=e.middleName),e.lastName!==void 0&&(n.last_name=e.lastName),e.userPermissions!==void 0&&(n.user_permissions=e.userPermissions),printResult(await invokeWithTimeout(i.updateUserInfo(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
118
+ Example:
119
+ mcporter call meow-onboarding.update_user_info(api_key: "value", middle_na, ...)`),program.command(`update-business-address`).summary(`update-business-address --api-key <api-key> [--business <business:json>] [--physical <physical:json>] [--raw <json>]`).description(`Update the business legal and physical addresses.`).usage(`--api-key <api-key> [--business <business:json>] [--physical <physical:json>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).option(`--business <business:json>`,`Set business. (default: {}; example: {})`,e=>JSON.parse(e)).option(`--physical <physical:json>`,`Set physical. (default: {}; example: {})`,e=>JSON.parse(e)).alias(`update_business_address`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.business!==void 0&&(n.business=e.business),e.physical!==void 0&&(n.physical=e.physical),printResult(await invokeWithTimeout(i.updateBusinessAddress(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
120
+ Example:
121
+ mcporter call meow-onboarding.update_business_address(api_key: "value", bu, ...)`),program.command(`update-business-details`).summary(`update-business-details --api-key <api-key> [--is-r365 <is-r365:true|false>] [--business-name <business-name>] [--business-nickname <business-nickname>] [--business-dba-name <business-dba-name>] [--raw <json>]`).description(`Update business name, phone, EIN, incorporation details, and industry.`).usage(`--api-key <api-key> [--is-r365 <is-r365:true|false>] [--business-name <business-name>] [--business-nickname <business-nickname>] [--business-dba-name <business-dba-name>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).option(`--is-r365 <is-r365:true|false>`,`Set is_r365. (default: false; example: false)`,e=>e!==`false`).option(`--business-name <business-name>`,`Set business_name.`).option(`--business-nickname <business-nickname>`,`Set business_nickname.`).option(`--business-dba-name <business-dba-name>`,`Set business_dba_name.`).option(`--business-description <business-description>`,`Set business_description.`).option(`--business-phone <business-phone>`,`Set business_phone.`).option(`--business-date-of-incorporation <business-date-of-incorporation>`,`Set business_date_of_incorporation.`).option(`--business-asset-source-description <business-asset-source-description>`,`Set business_asset_source_description.`).option(`--business-taxid <business-taxid>`,`Set business_taxid. (example: example-id)`).option(`--anticipated-deposit-size <anticipated-deposit-size>`,`Set anticipated_deposit_size.`).option(`--incorporation-state <incorporation-state>`,`Set incorporation_state.`).option(`--legal-structure <legal-structure>`,`Set legal_structure.`).option(`--naics-code <naics-code>`,`Set naics_code.`).option(`--business-website <business-website>`,`Set business_website.`).option(`--referral-code <referral-code>`,`Set referral_code.`).option(`--how-did-you-hear-about-us <how-did-you-hear-about-us>`,`Set how_did_you_hear_about_us. (example: example-id)`).option(`--legal-entity-number <legal-entity-number>`,`Set legal_entity_number.`).option(`--industry <industry>`,`Set industry.`).option(`--legal-business-name <legal-business-name>`,`Set legal_business_name.`).option(`--r365-instance-url <r365-instance-url>`,`Set r365_instance_url.`).option(`--restaurant-locations <restaurant-locations>`,`Set restaurant_locations.`).option(`--provides-blockchain-or-digital-currency-services <provides-blockchain-or-digital-currency-services>`,`Set provides_blockchain_or_digital_currency_services. (example: example-id)`).option(`--transacts-in-digital-currency <transacts-in-digital-currency>`,`Set transacts_in_digital_currency.`).option(`--develops-governs-supports-blockchain-protocol <develops-governs-supports-blockchain-protocol>`,`Set develops_governs_supports_blockchain_protocol.`).alias(`update_business_details`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.isR365!==void 0&&(n.is_r365=e.isR365),e.businessName!==void 0&&(n.business_name=e.businessName),e.businessNickname!==void 0&&(n.business_nickname=e.businessNickname),e.businessDbaName!==void 0&&(n.business_dba_name=e.businessDbaName),e.businessDescription!==void 0&&(n.business_description=e.businessDescription),e.businessPhone!==void 0&&(n.business_phone=e.businessPhone),e.businessDateOfIncorporation!==void 0&&(n.business_date_of_incorporation=e.businessDateOfIncorporation),e.businessAssetSourceDescription!==void 0&&(n.business_asset_source_description=e.businessAssetSourceDescription),e.businessTaxid!==void 0&&(n.business_taxid=e.businessTaxid),e.anticipatedDepositSize!==void 0&&(n.anticipated_deposit_size=e.anticipatedDepositSize),e.incorporationState!==void 0&&(n.incorporation_state=e.incorporationState),e.legalStructure!==void 0&&(n.legal_structure=e.legalStructure),e.naicsCode!==void 0&&(n.naics_code=e.naicsCode),e.businessWebsite!==void 0&&(n.business_website=e.businessWebsite),e.referralCode!==void 0&&(n.referral_code=e.referralCode),e.howDidYouHearAboutUs!==void 0&&(n.how_did_you_hear_about_us=e.howDidYouHearAboutUs),e.legalEntityNumber!==void 0&&(n.legal_entity_number=e.legalEntityNumber),e.industry!==void 0&&(n.industry=e.industry),e.legalBusinessName!==void 0&&(n.legal_business_name=e.legalBusinessName),e.r365InstanceUrl!==void 0&&(n.r365_instance_url=e.r365InstanceUrl),e.restaurantLocations!==void 0&&(n.restaurant_locations=e.restaurantLocations),e.providesBlockchainOrDigitalCurrencyServices!==void 0&&(n.provides_blockchain_or_digital_currency_services=e.providesBlockchainOrDigitalCurrencyServices),e.transactsInDigitalCurrency!==void 0&&(n.transacts_in_digital_currency=e.transactsInDigitalCurrency),e.developsGovernsSupportsBlockchainProtocol!==void 0&&(n.develops_governs_supports_blockchain_protocol=e.developsGovernsSupportsBlockchainProtocol),printResult(await invokeWithTimeout(i.updateBusinessDetails(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
122
+ Example:
123
+ mcporter call meow-onboarding.update_business_details(api_key: "value", is, ...)`).addHelpText(`afterAll`,()=>`
124
+ // optional (20): business_description, business_phone, business_date_of_incorporation, business_asset_source_description, business_taxid, ...
125
+ `),program.command(`update-additional-details`).summary(`update-additional-details --api-key <api-key> [--kyb-info <kyb-info>] [--raw <json>]`).description(`Update account purpose and crypto/blockchain details.`).usage(`--api-key <api-key> [--kyb-info <kyb-info>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).option(`--kyb-info <kyb-info>`,`Set kyb_info.`).alias(`update_additional_details`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.kybInfo!==void 0&&(n.kyb_info=e.kybInfo),printResult(await invokeWithTimeout(i.updateAdditionalDetails(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
126
+ Example:
127
+ mcporter call meow-onboarding.update_additional_details(api_key: "value")`),program.command(`create-business-representative`).summary(`create-business-representative --api-key <api-key> --to-email <to-email> --title-id <title-id:chief executive officer|chief financial officer|chief operating officer|finance manager|general partner|managing member|president> --is-beneficial-owner <is-beneficial-owner:true|false> [--percent-ownership <percent-ownership>] [--raw <json>]`).description(`Add a business representative. For the primary representative, returns a Plaid identity verification link. For other representatives, an IDV link is emailed to them.`).usage(`--api-key <api-key> --to-email <to-email> --title-id <title-id:chief executive officer|chief financial officer|chief operating officer|finance manager|general partner|managing member|president> --is-beneficial-owner <is-beneficial-owner:true|false> [--percent-ownership <percent-ownership>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).requiredOption(`--to-email <to-email>`,`Email address of the representative`).requiredOption(`--title-id <title-id:chief executive officer|chief financial officer|chief operating officer|finance manager|general partner|managing member|president>`,`Job title of the representative (choices: chief executive officer, chief financial officer, chief operating officer, finance manager, general partner, managing member, president; example: chief executive officer)`).requiredOption(`--is-beneficial-owner <is-beneficial-owner:true|false>`,`Whether this person owns 10%+ of the business (example: true)`,e=>e!==`false`).option(`--percent-ownership <percent-ownership>`,`Ownership percentage (required if beneficial owner)`).option(`--significant-responsibility <significant-responsibility>`,`Whether this person has significant management responsibility`).option(`--is-primary-representative <is-primary-representative:true|false>`,`Whether this is the primary signer (default: false; example: false)`,e=>e!==`false`).option(`--send-email <send-email:true|false>`,`Whether to send an invitation email (default: false; example: false)`,e=>e!==`false`).alias(`create_business_representative`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.toEmail!==void 0&&(n.to_email=e.toEmail),e.titleId!==void 0&&(n.title_id=e.titleId),e.isBeneficialOwner!==void 0&&(n.is_beneficial_owner=e.isBeneficialOwner),e.percentOwnership!==void 0&&(n.percent_ownership=e.percentOwnership),e.significantResponsibility!==void 0&&(n.significant_responsibility=e.significantResponsibility),e.isPrimaryRepresentative!==void 0&&(n.is_primary_representative=e.isPrimaryRepresentative),e.sendEmail!==void 0&&(n.send_email=e.sendEmail),printResult(await invokeWithTimeout(i.createBusinessRepresentative(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
128
+ Example:
129
+ mcporter call meow-onboarding.create_business_representative(api_key: "val, ...)`).addHelpText(`afterAll`,()=>`
130
+ // optional (3): significant_responsibility, is_primary_representative, send_email
131
+ `),program.command(`get-onboarding-status`).summary(`get-onboarding-status --api-key <api-key> [--raw <json>]`).description(`Get full onboarding details including representative IDs.`).usage(`--api-key <api-key> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).alias(`get_onboarding_status`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),printResult(await invokeWithTimeout(i.getOnboardingStatus(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
132
+ Example:
133
+ mcporter call meow-onboarding.get_onboarding_status(api_key: "value")`),program.command(`check-identity-verification`).summary(`check-identity-verification --representative-id <representative-id:uuid> --api-key <api-key> [--raw <json>]`).description(`Check the status of identity verification for a representative.`).usage(`--representative-id <representative-id:uuid> --api-key <api-key> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--representative-id <representative-id:uuid>`,`Set representative_id. (example: example-id)`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).alias(`check_identity_verification`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.representativeId!==void 0&&(n.representative_id=e.representativeId),e.apiKey!==void 0&&(n.api_key=e.apiKey),printResult(await invokeWithTimeout(i.checkIdentityVerification(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
134
+ Example:
135
+ mcporter call meow-onboarding.check_identity_verification(representative_i, ...)`),program.command(`upload-document`).summary(`upload-document --api-key <api-key> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--content-type <content-type>] [--raw <json>]`).description(`Upload a KYB proof document (base64-encoded).`).usage(`--api-key <api-key> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--content-type <content-type>] [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).requiredOption(`--proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements>`,`Type of document (e.g. incorporation, uk_shareholder_registry, uk_officer_registry) (choices: accredited, address, articles_of_organization, bank_statement, client_contract, client_invoice, beneficial_owner_address, beneficial_owner_id, beneficial_owner_id_back, beneficial_ownership_register, certificate_of_good_standing, corporate_resolution, drivers_license, due_diligence, ein, government_issued_business_license, hemp_cultivator_state_license, incorporation, industry_related_license, lease_agreement, llc_resolution, money_service_business_license, money_transmitter_registration, mortgage_statement, national_id, org_chart, partnership_agreement, partnership_agreement_due_diligence, partnership_resolution, personal_address, remote_employees_due_diligence, signed_ss4, tax_exemption_certificate, uk_officer_passport, uk_officer_registry, uk_registry, uk_shareholder_registry, uk_w8_en, utility_bill, us_based_office_proof_of_address_due_diligence, pitch_deck, active_business_registration, proof_of_ownership_or_banking_authorization, non_profit_bylaws, operating_agreement, flow_of_funds, aml_sanction, registration_or_license, sec_filing, legal_opinion, certificate_of_formation_master_llc, series_operating_agreement, share_subscription_agreement, fund_subscription_agreement, safe_agreement, convertible_note_agreement, loan_promissory_note, token_purchase_agreement, saft_agreement, deal_memo_hybrid_agreement, issuer_due_diligence_report, protocol_ecosystem_questionnaire, investment_company_due_diligence_form, us_based_operations_due_diligence_form, register_of_directors, articles_of_association, memorandum_of_association, non_profit_status, ofac_sanctions_screening_policy, aml_kyc_policy, w8_bene, corporate_structure_chart, sanctions_vendor_service_agreement, contractual_fund_flow_agreements; example: accredited)`).requiredOption(`--file-name <file-name>`,`File name including extension (e.g. articles_of_org.pdf)`).requiredOption(`--file-content-base64 <file-content-base64>`,`Base64-encoded file content`).option(`--content-type <content-type>`,`MIME type (application/pdf, image/jpeg, image/png) (default: application/pdf; example: application/pdf)`).alias(`upload_document`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.proofType!==void 0&&(n.proof_type=e.proofType),e.fileName!==void 0&&(n.file_name=e.fileName),e.fileContentBase64!==void 0&&(n.file_content_base64=e.fileContentBase64),e.contentType!==void 0&&(n.content_type=e.contentType),printResult(await invokeWithTimeout(i.uploadDocument(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
136
+ Example:
137
+ mcporter call meow-onboarding.upload_document(api_key: "value", proof_type, ...)`),program.command(`confirm-onboarding`).summary(`confirm-onboarding --api-key <api-key> [--raw <json>]`).description(`Submit the onboarding application for review.`).usage(`--api-key <api-key> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).alias(`confirm_onboarding`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),printResult(await invokeWithTimeout(i.confirmOnboarding(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
138
+ Example:
139
+ mcporter call meow-onboarding.confirm_onboarding(api_key: "value")`),program.command(`get-info-requests`).summary(`get-info-requests --api-key <api-key> [--raw <json>]`).description(`Poll for compliance review status and any follow-up information requests. Returns the review status (pending/running/completed/failed) and any active document or question requests.`).usage(`--api-key <api-key> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).alias(`get_info_requests`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),printResult(await invokeWithTimeout(i.getInfoRequests(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
140
+ Example:
141
+ mcporter call meow-onboarding.get_info_requests(api_key: "value")`),program.command(`submit-followup-answers`).summary(`submit-followup-answers --api-key <api-key> --request-id <request-id:uuid> --answers <answers:json> [--raw <json>]`).description(`Submit answers to followup questions from an info request. Pass the request_id from get_info_requests and answers keyed by question field name. If all questions are answered and all required documents uploaded, the request is marked complete and triggers a compliance re-review.`).usage(`--api-key <api-key> --request-id <request-id:uuid> --answers <answers:json> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).requiredOption(`--request-id <request-id:uuid>`,`The info request ID from get_info_requests response (example: example-id)`).requiredOption(`--answers <answers:json>`,`Answers keyed by question field name. Values depend on the question type: string for text/dropdown/comment, bool for boolean/confirm, number for number, list[str] for checkbox/text_list, string (YYYY-MM-DD) for date, country/state code for country_select/state_select. (example: {"key":"value"})`,e=>JSON.parse(e)).alias(`submit_followup_answers`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.requestId!==void 0&&(n.request_id=e.requestId),e.answers!==void 0&&(n.answers=e.answers),printResult(await invokeWithTimeout(i.submitFollowupAnswers(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
142
+ Example:
143
+ mcporter call meow-onboarding.submit_followup_answers(api_key: "value", re, ...)`),program.command(`upload-followup-document`).summary(`upload-followup-document --api-key <api-key> --request-id <request-id:uuid> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--raw <json>]`).description(`Upload a document required by an info request. Pass the request_id from get_info_requests and the proof_type matching one of the required_proofs. The document is tied to the info request for completion tracking.`).usage(`--api-key <api-key> --request-id <request-id:uuid> --proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements> --file-name <file-name> --file-content-base64 <file-content-base64> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).requiredOption(`--request-id <request-id:uuid>`,`The info request ID from get_info_requests response (example: example-id)`).requiredOption(`--proof-type <proof-type:accredited|address|articles_of_organization|bank_statement|client_contract|client_invoice|beneficial_owner_address|beneficial_owner_id|beneficial_owner_id_back|beneficial_ownership_register|certificate_of_good_standing|corporate_resolution|drivers_license|due_diligence|ein|government_issued_business_license|hemp_cultivator_state_license|incorporation|industry_related_license|lease_agreement|llc_resolution|money_service_business_license|money_transmitter_registration|mortgage_statement|national_id|org_chart|partnership_agreement|partnership_agreement_due_diligence|partnership_resolution|personal_address|remote_employees_due_diligence|signed_ss4|tax_exemption_certificate|uk_officer_passport|uk_officer_registry|uk_registry|uk_shareholder_registry|uk_w8_en|utility_bill|us_based_office_proof_of_address_due_diligence|pitch_deck|active_business_registration|proof_of_ownership_or_banking_authorization|non_profit_bylaws|operating_agreement|flow_of_funds|aml_sanction|registration_or_license|sec_filing|legal_opinion|certificate_of_formation_master_llc|series_operating_agreement|share_subscription_agreement|fund_subscription_agreement|safe_agreement|convertible_note_agreement|loan_promissory_note|token_purchase_agreement|saft_agreement|deal_memo_hybrid_agreement|issuer_due_diligence_report|protocol_ecosystem_questionnaire|investment_company_due_diligence_form|us_based_operations_due_diligence_form|register_of_directors|articles_of_association|memorandum_of_association|non_profit_status|ofac_sanctions_screening_policy|aml_kyc_policy|w8_bene|corporate_structure_chart|sanctions_vendor_service_agreement|contractual_fund_flow_agreements>`,`Document type matching one of the required_proofs from the info request (choices: accredited, address, articles_of_organization, bank_statement, client_contract, client_invoice, beneficial_owner_address, beneficial_owner_id, beneficial_owner_id_back, beneficial_ownership_register, certificate_of_good_standing, corporate_resolution, drivers_license, due_diligence, ein, government_issued_business_license, hemp_cultivator_state_license, incorporation, industry_related_license, lease_agreement, llc_resolution, money_service_business_license, money_transmitter_registration, mortgage_statement, national_id, org_chart, partnership_agreement, partnership_agreement_due_diligence, partnership_resolution, personal_address, remote_employees_due_diligence, signed_ss4, tax_exemption_certificate, uk_officer_passport, uk_officer_registry, uk_registry, uk_shareholder_registry, uk_w8_en, utility_bill, us_based_office_proof_of_address_due_diligence, pitch_deck, active_business_registration, proof_of_ownership_or_banking_authorization, non_profit_bylaws, operating_agreement, flow_of_funds, aml_sanction, registration_or_license, sec_filing, legal_opinion, certificate_of_formation_master_llc, series_operating_agreement, share_subscription_agreement, fund_subscription_agreement, safe_agreement, convertible_note_agreement, loan_promissory_note, token_purchase_agreement, saft_agreement, deal_memo_hybrid_agreement, issuer_due_diligence_report, protocol_ecosystem_questionnaire, investment_company_due_diligence_form, us_based_operations_due_diligence_form, register_of_directors, articles_of_association, memorandum_of_association, non_profit_status, ofac_sanctions_screening_policy, aml_kyc_policy, w8_bene, corporate_structure_chart, sanctions_vendor_service_agreement, contractual_fund_flow_agreements; example: accredited)`).requiredOption(`--file-name <file-name>`,`File name including extension (e.g. proof_of_address.pdf)`).requiredOption(`--file-content-base64 <file-content-base64>`,`Base64-encoded file content`).option(`--content-type <content-type>`,`MIME type (application/pdf, image/jpeg, image/png) (default: application/pdf; example: application/pdf)`).alias(`upload_followup_document`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),e.requestId!==void 0&&(n.request_id=e.requestId),e.proofType!==void 0&&(n.proof_type=e.proofType),e.fileName!==void 0&&(n.file_name=e.fileName),e.fileContentBase64!==void 0&&(n.file_content_base64=e.fileContentBase64),e.contentType!==void 0&&(n.content_type=e.contentType),printResult(await invokeWithTimeout(i.uploadFollowupDocument(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
144
+ Example:
145
+ mcporter call meow-onboarding.upload_followup_document(api_key: "value", r, ...)`).addHelpText(`afterAll`,()=>`
146
+ // optional (1): content_type
147
+ `),program.command(`get-next-step`).summary(`get-next-step --api-key <api-key> [--raw <json>]`).description(`Get the current onboarding phase and what to do next. Returns allowed tools, phase description, and whether the application can be submitted.`).usage(`--api-key <api-key> [--raw <json>]`).option(`--raw <json>`,`Provide raw JSON arguments to the tool, bypassing flag parsing.`).requiredOption(`--api-key <api-key>`,`API key from issue_onboarding_key`).alias(`get_next_step`).action(async e=>{let t=program.opts(),n=await ensureRuntime(),r=embeddedName,i=createServerProxy(n,r,{initialSchemas:embeddedSchemas});try{let n=e.raw?JSON.parse(e.raw):{};e.apiKey!==void 0&&(n.api_key=e.apiKey),printResult(await invokeWithTimeout(i.getNextStep(n),t.timeout||3e4),t.output??`text`)}finally{await n.close(r).catch(()=>{})}}).addHelpText(`after`,()=>`
148
+ Example:
149
+ mcporter call meow-onboarding.get_next_step(api_key: "value")`),program.command(`__mcporter_inspect`,{hidden:!0}).description(`Internal metadata printer for mcporter inspect-cli.`).action(()=>{let e=buildMetadataPayload();console.log(JSON.stringify(e,null,2))}),configureToolCommandHelps();const FORCE_COLOR=process.env.FORCE_COLOR?.toLowerCase(),forceDisableColor=FORCE_COLOR===`0`||FORCE_COLOR===`false`,forceEnableColor=FORCE_COLOR===`1`||FORCE_COLOR===`true`||FORCE_COLOR===`2`||FORCE_COLOR===`3`,hasNoColor=process.env.NO_COLOR!==void 0,stdoutStream=process.stdout,supportsAnsiColor=!hasNoColor&&(forceEnableColor||!forceDisableColor&&!!stdoutStream?.isTTY),tint={bold(e){return supportsAnsiColor?`\x1B[1m`+e+`\x1B[0m`:e},dim(e){return supportsAnsiColor?`\x1B[90m`+e+`\x1B[0m`:e},extraDim(e){return supportsAnsiColor?`\x1B[38;5;244m`+e+`\x1B[0m`:e}};function configureGeneratedCommandHelp(e){e.configureHelp({commandUsage(e){let t=(e.name()+` `+e.usage()).trim()||e.name();return supportsAnsiColor?tint.bold(t):t},optionTerm(e){let t=e.flags??``;return supportsAnsiColor?tint.bold(t):t},optionDescription(e){let t=e.description??``;return supportsAnsiColor?tint.extraDim(t):t}})}function configureToolCommandHelps(){program.commands.forEach(e=>{e.name()!==`__mcporter_inspect`&&configureGeneratedCommandHelp(e)})}function renderStandaloneHelp(){let e=tint.bold(embeddedName)+` `+tint.dim(`— `+embeddedDescription),t=embeddedName+` — `+embeddedDescription,n=[supportsAnsiColor?e:t,``,`Usage: `+embeddedName+` <command> [options]`,``];return generatorTools&&n.push(formatEmbeddedTools()),n.push(``,formatGlobalFlags(),``,formatQuickStart()),generatorInfo&&n.push(``,tint.extraDim(generatorInfo)),n.join(`
150
+ `)}program.helpInformation=()=>renderStandaloneHelp();function formatEmbeddedTools(){let e=supportsAnsiColor?tint.bold(`Embedded tools`):`Embedded tools`;if(!generatorTools.length)return e;let t=[e];return generatorTools.forEach(e=>{let n=e.description?supportsAnsiColor?tint.extraDim(e.description):e.description:void 0,r=n?e.name+` - `+n:e.name;if(t.push(` `+r),e.flags){let n=supportsAnsiColor?tint.extraDim(e.flags):e.flags;t.push(` `+n)}t.push(``)}),t[t.length-1]===``&&t.pop(),t.join(`
151
+ `)}function formatGlobalFlags(){return[supportsAnsiColor?tint.bold(`Global flags`):`Global flags`,...[[`-t, --timeout <ms>`,`Call timeout in milliseconds`],[`-o, --output <format>`,`text | markdown | json | raw (default text)`]].map(([e,t])=>` `+e.padEnd(28)+t)].join(`
152
+ `)}function formatQuickStart(){let e=supportsAnsiColor?tint.bold(`Quick start`):`Quick start`,t=quickStartExamples();return t.length?[e,...t.map(([e,t])=>` `+e+`
153
+ `+tint.dim(`# `+t))].join(`
154
+ `):e}function quickStartExamples(){let e=[],t=new Map;program.commands.forEach(e=>{let n=e.name();n!==`__mcporter_inspect`&&t.set(n,n)});let n=Array.isArray(generatorTools)?generatorTools:[];for(let r of n.slice(0,3)){let n=t.get(r.name)??r.name,i=r.flags?` `+r.flags.replace(/<[^>]+>/g,`<value>`):``;e.push([embeddedName+` `+n+i,`invoke `+n])}return e.length||e.push([embeddedName+` <tool> --key value`,`invoke a tool with flags`]),e}function printResult(e,t){let n=createCallResult(e);switch(t){case`json`:{let e=n.json();if(e){console.log(JSON.stringify(e,null,2));return}break}case`markdown`:{let e=n.markdown();if(e){console.log(e);return}break}case`raw`:console.log(JSON.stringify(n.raw,null,2));return}let r=n.text();r?console.log(r):console.log(JSON.stringify(n.raw,null,2))}function normalizeEmbeddedServer(e){let t={...e};if(e.command.kind===`http`){let n=e.command.url,r=typeof n==`string`?n:String(n);return{...t,command:{...e.command,url:new URL(r)}}}return e.command.kind===`stdio`?{...t,command:{...e.command,args:[...e.command.args??[]]}}:t}function determineArtifactKind(){let e=typeof process<`u`&&Array.isArray(process.argv)?process.argv[1]??``:``;return e.endsWith(`.ts`)?`template`:e.endsWith(`.js`)?`bundle`:`binary`}function resolveArtifactPath(){if(typeof process<`u`&&Array.isArray(process.argv)&&process.argv.length>1){let e=process.argv[1];if(e)return e}return embeddedMetadata.artifact.path}function buildMetadataPayload(){let e={...embeddedMetadata.invocation},t=resolveArtifactPath();return artifactKind===`template`&&t?e.outputPath=e.outputPath??t:artifactKind===`bundle`&&t?e.bundle=e.bundle??t:artifactKind===`binary`&&t&&(e.compile=e.compile??t),{...embeddedMetadata,artifact:{path:t,kind:artifactKind},invocation:e}}async function ensureRuntime(){return await createRuntime({servers:[normalizeEmbeddedServer(embeddedServer)]})}async function invokeWithTimeout(e,t){if(!Number.isFinite(t)||t<=0)return await e;let n;try{return await Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>{r(Error(`Call timed out after `+t+`ms.`))},t)})])}finally{n&&clearTimeout(n)}}async function runCli(){if(process.argv.slice(2).length===0){program.outputHelp();return}await program.parseAsync(process.argv)}process.env.MCPORTER_DISABLE_AUTORUN!==`1`&&runCli().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(t),process.exit(1)});