create-gamecn 0.0.4 → 0.0.5
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.
- package/index.js +277 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -24,7 +24,7 @@ Expecting one of '${allowedValues.join("', '")}'`)}if(this._lifeCycleHooks[event
|
|
|
24
24
|
`);this.outputHelp({error:true})}const config=errorOptions||{};const exitCode=config.exitCode||1;const code=config.code||"commander.error";this._exit(exitCode,code,message)}_parseOptionsEnv(){this.options.forEach((option)=>{if(option.envVar&&option.envVar in process2.env){const optionKey=option.attributeName();if(this.getOptionValue(optionKey)===undefined||["default","config","env"].includes(this.getOptionValueSource(optionKey))){if(option.required||option.optional){this.emit(`optionEnv:${option.name()}`,process2.env[option.envVar])}else{this.emit(`optionEnv:${option.name()}`)}}}})}_parseOptionsImplied(){const dualHelper=new DualOptions(this.options);const hasCustomOptionValue=(optionKey)=>{return this.getOptionValue(optionKey)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(optionKey))};this.options.filter((option)=>option.implied!==undefined&&hasCustomOptionValue(option.attributeName())&&dualHelper.valueFromOption(this.getOptionValue(option.attributeName()),option)).forEach((option)=>{Object.keys(option.implied).filter((impliedKey)=>!hasCustomOptionValue(impliedKey)).forEach((impliedKey)=>{this.setOptionValueWithSource(impliedKey,option.implied[impliedKey],"implied")})})}missingArgument(name){const message=`error: missing required argument '${name}'`;this.error(message,{code:"commander.missingArgument"})}optionMissingArgument(option){const message=`error: option '${option.flags}' argument missing`;this.error(message,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(option){const message=`error: required option '${option.flags}' not specified`;this.error(message,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(option,conflictingOption){const findBestOptionFromValue=(option2)=>{const optionKey=option2.attributeName();const optionValue=this.getOptionValue(optionKey);const negativeOption=this.options.find((target)=>target.negate&&optionKey===target.attributeName());const positiveOption=this.options.find((target)=>!target.negate&&optionKey===target.attributeName());if(negativeOption&&(negativeOption.presetArg===undefined&&optionValue===false||negativeOption.presetArg!==undefined&&optionValue===negativeOption.presetArg)){return negativeOption}return positiveOption||option2};const getErrorMessage=(option2)=>{const bestOption=findBestOptionFromValue(option2);const optionKey=bestOption.attributeName();const source=this.getOptionValueSource(optionKey);if(source==="env"){return`environment variable '${bestOption.envVar}'`}return`option '${bestOption.flags}'`};const message=`error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;this.error(message,{code:"commander.conflictingOption"})}unknownOption(flag){if(this._allowUnknownOption)return;let suggestion="";if(flag.startsWith("--")&&this._showSuggestionAfterError){let candidateFlags=[];let command=this;do{const moreFlags=command.createHelp().visibleOptions(command).filter((option)=>option.long).map((option)=>option.long);candidateFlags=candidateFlags.concat(moreFlags);command=command.parent}while(command&&!command._enablePositionalOptions);suggestion=suggestSimilar(flag,candidateFlags)}const message=`error: unknown option '${flag}'${suggestion}`;this.error(message,{code:"commander.unknownOption"})}_excessArguments(receivedArgs){if(this._allowExcessArguments)return;const expected=this.registeredArguments.length;const s=expected===1?"":"s";const forSubcommand=this.parent?` for '${this.name()}'`:"";const message=`error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;this.error(message,{code:"commander.excessArguments"})}unknownCommand(){const unknownName=this.args[0];let suggestion="";if(this._showSuggestionAfterError){const candidateNames=[];this.createHelp().visibleCommands(this).forEach((command)=>{candidateNames.push(command.name());if(command.alias())candidateNames.push(command.alias())});suggestion=suggestSimilar(unknownName,candidateNames)}const message=`error: unknown command '${unknownName}'${suggestion}`;this.error(message,{code:"commander.unknownCommand"})}version(str,flags,description){if(str===undefined)return this._version;this._version=str;flags=flags||"-V, --version";description=description||"output the version number";const versionOption=this.createOption(flags,description);this._versionOptionName=versionOption.attributeName();this._registerOption(versionOption);this.on("option:"+versionOption.name(),()=>{this._outputConfiguration.writeOut(`${str}
|
|
25
25
|
`);this._exit(0,"commander.version",str)});return this}description(str,argsDescription){if(str===undefined&&argsDescription===undefined)return this._description;this._description=str;if(argsDescription){this._argsDescription=argsDescription}return this}summary(str){if(str===undefined)return this._summary;this._summary=str;return this}alias(alias){if(alias===undefined)return this._aliases[0];let command=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){command=this.commands[this.commands.length-1]}if(alias===command._name)throw new Error("Command alias can't be the same as its name");const matchingCommand=this.parent?._findCommand(alias);if(matchingCommand){const existingCmd=[matchingCommand.name()].concat(matchingCommand.aliases()).join("|");throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`)}command._aliases.push(alias);return this}aliases(aliases){if(aliases===undefined)return this._aliases;aliases.forEach((alias)=>this.alias(alias));return this}usage(str){if(str===undefined){if(this._usage)return this._usage;const args=this.registeredArguments.map((arg)=>{return humanReadableArgName(arg)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?args:[]).join(" ")}this._usage=str;return this}name(str){if(str===undefined)return this._name;this._name=str;return this}helpGroup(heading){if(heading===undefined)return this._helpGroupHeading??"";this._helpGroupHeading=heading;return this}commandsGroup(heading){if(heading===undefined)return this._defaultCommandGroup??"";this._defaultCommandGroup=heading;return this}optionsGroup(heading){if(heading===undefined)return this._defaultOptionGroup??"";this._defaultOptionGroup=heading;return this}_initOptionGroup(option){if(this._defaultOptionGroup&&!option.helpGroupHeading)option.helpGroup(this._defaultOptionGroup)}_initCommandGroup(cmd){if(this._defaultCommandGroup&&!cmd.helpGroup())cmd.helpGroup(this._defaultCommandGroup)}nameFromFilename(filename){this._name=path.basename(filename,path.extname(filename));return this}executableDir(path2){if(path2===undefined)return this._executableDir;this._executableDir=path2;return this}helpInformation(contextOptions){const helper=this.createHelp();const context=this._getOutputContext(contextOptions);helper.prepareContext({error:context.error,helpWidth:context.helpWidth,outputHasColors:context.hasColors});const text=helper.formatHelp(this,helper);if(context.hasColors)return text;return this._outputConfiguration.stripColor(text)}_getOutputContext(contextOptions){contextOptions=contextOptions||{};const error=!!contextOptions.error;let baseWrite;let hasColors;let helpWidth;if(error){baseWrite=(str)=>this._outputConfiguration.writeErr(str);hasColors=this._outputConfiguration.getErrHasColors();helpWidth=this._outputConfiguration.getErrHelpWidth()}else{baseWrite=(str)=>this._outputConfiguration.writeOut(str);hasColors=this._outputConfiguration.getOutHasColors();helpWidth=this._outputConfiguration.getOutHelpWidth()}const write=(str)=>{if(!hasColors)str=this._outputConfiguration.stripColor(str);return baseWrite(str)};return{error,write,hasColors,helpWidth}}outputHelp(contextOptions){let deprecatedCallback;if(typeof contextOptions==="function"){deprecatedCallback=contextOptions;contextOptions=undefined}const outputContext=this._getOutputContext(contextOptions);const eventContext={error:outputContext.error,write:outputContext.write,command:this};this._getCommandAndAncestors().reverse().forEach((command)=>command.emit("beforeAllHelp",eventContext));this.emit("beforeHelp",eventContext);let helpInformation=this.helpInformation({error:outputContext.error});if(deprecatedCallback){helpInformation=deprecatedCallback(helpInformation);if(typeof helpInformation!=="string"&&!Buffer.isBuffer(helpInformation)){throw new Error("outputHelp callback must return a string or a Buffer")}}outputContext.write(helpInformation);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",eventContext);this._getCommandAndAncestors().forEach((command)=>command.emit("afterAllHelp",eventContext))}helpOption(flags,description){if(typeof flags==="boolean"){if(flags){if(this._helpOption===null)this._helpOption=undefined;if(this._defaultOptionGroup){this._initOptionGroup(this._getHelpOption())}}else{this._helpOption=null}return this}this._helpOption=this.createOption(flags??"-h, --help",description??"display help for command");if(flags||description)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(option){this._helpOption=option;this._initOptionGroup(option);return this}help(contextOptions){this.outputHelp(contextOptions);let exitCode=Number(process2.exitCode??0);if(exitCode===0&&contextOptions&&typeof contextOptions!=="function"&&contextOptions.error){exitCode=1}this._exit(exitCode,"commander.help","(outputHelp)")}addHelpText(position,text){const allowedValues=["beforeAll","before","after","afterAll"];if(!allowedValues.includes(position)){throw new Error(`Unexpected value for position to addHelpText.
|
|
26
26
|
Expecting one of '${allowedValues.join("', '")}'`)}const helpEvent=`${position}Help`;this.on(helpEvent,(context)=>{let helpStr;if(typeof text==="function"){helpStr=text({error:context.error,command:context.command})}else{helpStr=text}if(helpStr){context.write(`${helpStr}
|
|
27
|
-
`)}});return this}_outputHelpIfRequested(args){const helpOption=this._getHelpOption();const helpRequested=helpOption&&args.find((arg)=>helpOption.is(arg));if(helpRequested){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(args){return args.map((arg)=>{if(!arg.startsWith("--inspect")){return arg}let debugOption;let debugHost="127.0.0.1";let debugPort="9229";let match;if((match=arg.match(/^(--inspect(-brk)?)$/))!==null){debugOption=match[1]}else if((match=arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){debugOption=match[1];if(/^\d+$/.test(match[3])){debugPort=match[3]}else{debugHost=match[3]}}else if((match=arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){debugOption=match[1];debugHost=match[3];debugPort=match[4]}if(debugOption&&debugPort!=="0"){return`${debugOption}=${debugHost}:${parseInt(debugPort)+1}`}return arg})}function useColor(){if(process2.env.NO_COLOR||process2.env.FORCE_COLOR==="0"||process2.env.FORCE_COLOR==="false")return false;if(process2.env.FORCE_COLOR||process2.env.CLICOLOR_FORCE!==undefined)return true;return}exports.Command=Command;exports.useColor=useColor});var require_commander=__commonJS((exports)=>{var{Argument}=require_argument();var{Command}=require_command();var{CommanderError,InvalidArgumentError}=require_error();var{Help}=require_help();var{Option}=require_option();exports.program=new Command;exports.createCommand=(name)=>new Command(name);exports.createOption=(flags,description)=>new Option(flags,description);exports.createArgument=(name,description)=>new Argument(name,description);exports.Command=Command;exports.Option=Option;exports.Argument=Argument;exports.Help=Help;exports.CommanderError=CommanderError;exports.InvalidArgumentError=InvalidArgumentError;exports.InvalidOptionArgumentError=InvalidArgumentError});var require_src=__commonJS((exports,module)=>{var ESC="\x1B";var CSI=`${ESC}[`;var beep="\x07";var cursor={to(x,y){if(!y)return`${CSI}${x+1}G`;return`${CSI}${y+1};${x+1}H`},move(x,y){let ret="";if(x<0)ret+=`${CSI}${-x}D`;else if(x>0)ret+=`${CSI}${x}C`;if(y<0)ret+=`${CSI}${-y}A`;else if(y>0)ret+=`${CSI}${y}B`;return ret},up:(count=1)=>`${CSI}${count}A`,down:(count=1)=>`${CSI}${count}B`,forward:(count=1)=>`${CSI}${count}C`,backward:(count=1)=>`${CSI}${count}D`,nextLine:(count=1)=>`${CSI}E`.repeat(count),prevLine:(count=1)=>`${CSI}F`.repeat(count),left:`${CSI}G`,hide:`${CSI}?25l`,show:`${CSI}?25h`,save:`${ESC}7`,restore:`${ESC}8`};var scroll={up:(count=1)=>`${CSI}S`.repeat(count),down:(count=1)=>`${CSI}T`.repeat(count)};var erase={screen:`${CSI}2J`,up:(count=1)=>`${CSI}1J`.repeat(count),down:(count=1)=>`${CSI}J`.repeat(count),line:`${CSI}2K`,lineEnd:`${CSI}K`,lineStart:`${CSI}1K`,lines(count){let clear="";for(let i=0;i<count;i++)clear+=this.line+(i<count-1?cursor.up():"");if(count)clear+=cursor.left;return clear}};module.exports={cursor,scroll,erase,beep}});var require_picocolors=__commonJS((exports,module)=>{var p=process||{};var argv=p.argv||[];var env=p.env||{};var isColorSupported=!(!!env.NO_COLOR||argv.includes("--no-color"))&&(!!env.FORCE_COLOR||argv.includes("--color")||p.platform==="win32"||(p.stdout||{}).isTTY&&env.TERM!=="dumb"||!!env.CI);var formatter=(open,close,replace=open)=>(input)=>{let string=""+input,index=string.indexOf(close,open.length);return~index?open+replaceClose(string,close,replace,index)+close:open+string+close};var replaceClose=(string,close,replace,index)=>{let result="",cursor=0;do{result+=string.substring(cursor,index)+replace;cursor=index+close.length;index=string.indexOf(close,cursor)}while(~index);return result+string.substring(cursor)};var createColors=(enabled=isColorSupported)=>{let f=enabled?formatter:()=>String;return{isColorSupported:enabled,reset:f("\x1B[0m","\x1B[0m"),bold:f("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:f("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:f("\x1B[3m","\x1B[23m"),underline:f("\x1B[4m","\x1B[24m"),inverse:f("\x1B[7m","\x1B[27m"),hidden:f("\x1B[8m","\x1B[28m"),strikethrough:f("\x1B[9m","\x1B[29m"),black:f("\x1B[30m","\x1B[39m"),red:f("\x1B[31m","\x1B[39m"),green:f("\x1B[32m","\x1B[39m"),yellow:f("\x1B[33m","\x1B[39m"),blue:f("\x1B[34m","\x1B[39m"),magenta:f("\x1B[35m","\x1B[39m"),cyan:f("\x1B[36m","\x1B[39m"),white:f("\x1B[37m","\x1B[39m"),gray:f("\x1B[90m","\x1B[39m"),bgBlack:f("\x1B[40m","\x1B[49m"),bgRed:f("\x1B[41m","\x1B[49m"),bgGreen:f("\x1B[42m","\x1B[49m"),bgYellow:f("\x1B[43m","\x1B[49m"),bgBlue:f("\x1B[44m","\x1B[49m"),bgMagenta:f("\x1B[45m","\x1B[49m"),bgCyan:f("\x1B[46m","\x1B[49m"),bgWhite:f("\x1B[47m","\x1B[49m"),blackBright:f("\x1B[90m","\x1B[39m"),redBright:f("\x1B[91m","\x1B[39m"),greenBright:f("\x1B[92m","\x1B[39m"),yellowBright:f("\x1B[93m","\x1B[39m"),blueBright:f("\x1B[94m","\x1B[39m"),magentaBright:f("\x1B[95m","\x1B[39m"),cyanBright:f("\x1B[96m","\x1B[39m"),whiteBright:f("\x1B[97m","\x1B[39m"),bgBlackBright:f("\x1B[100m","\x1B[49m"),bgRedBright:f("\x1B[101m","\x1B[49m"),bgGreenBright:f("\x1B[102m","\x1B[49m"),bgYellowBright:f("\x1B[103m","\x1B[49m"),bgBlueBright:f("\x1B[104m","\x1B[49m"),bgMagentaBright:f("\x1B[105m","\x1B[49m"),bgCyanBright:f("\x1B[106m","\x1B[49m"),bgWhiteBright:f("\x1B[107m","\x1B[49m")}};module.exports=createColors();module.exports.createColors=createColors});var require_constants=__commonJS((exports,module)=>{var SEMVER_SPEC_VERSION="2.0.0";var MAX_LENGTH=256;var MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991;var MAX_SAFE_COMPONENT_LENGTH=16;var MAX_SAFE_BUILD_LENGTH=MAX_LENGTH-6;var RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];module.exports={MAX_LENGTH,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var require_debug=__commonJS((exports,module)=>{var debug=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...args)=>console.error("SEMVER",...args):()=>{};module.exports=debug});var require_re=__commonJS((exports,module)=>{var{MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_LENGTH}=require_constants();var debug=require_debug();exports=module.exports={};var re=exports.re=[];var safeRe=exports.safeRe=[];var src=exports.src=[];var safeSrc=exports.safeSrc=[];var t=exports.t={};var R2=0;var LETTERDASHNUMBER="[a-zA-Z0-9-]";var safeRegexReplacements=[["\\s",1],["\\d",MAX_LENGTH],[LETTERDASHNUMBER,MAX_SAFE_BUILD_LENGTH]];var makeSafeRegex=(value)=>{for(const[token,max]of safeRegexReplacements){value=value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`)}return value};var createToken=(name,value,isGlobal)=>{const safe=makeSafeRegex(value);const index=R2++;debug(name,index,value);t[name]=index;src[index]=value;safeSrc[index]=safe;re[index]=new RegExp(value,isGlobal?"g":undefined);safeRe[index]=new RegExp(safe,isGlobal?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","\\d+");createToken("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);createToken("MAINVERSION",`(${src[t.NUMERICIDENTIFIER]})\\.`+`(${src[t.NUMERICIDENTIFIER]})\\.`+`(${src[t.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.`+`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.`+`(${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASE",`(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER",`${LETTERDASHNUMBER}+`);createToken("BUILD",`(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);createToken("FULL",`^${src[t.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);createToken("LOOSE",`^${src[t.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${src[t.XRANGEIDENTIFIER]})`+`(?:\\.(${src[t.XRANGEIDENTIFIER]})`+`(?:\\.(${src[t.XRANGEIDENTIFIER]})`+`(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);createToken("COERCEPLAIN",`${"(^|[^\\d])"+"(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})`+`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`+`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);createToken("COERCE",`${src[t.COERCEPLAIN]}(?:$|[^\\d])`);createToken("COERCEFULL",src[t.COERCEPLAIN]+`(?:${src[t.PRERELEASE]})?`+`(?:${src[t.BUILD]})?`+`(?:$|[^\\d])`);createToken("COERCERTL",src[t.COERCE],true);createToken("COERCERTLFULL",src[t.COERCEFULL],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${src[t.LONETILDE]}\\s+`,true);exports.tildeTrimReplace="$1~";createToken("TILDE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${src[t.LONECARET]}\\s+`,true);exports.caretTrimReplace="$1^";createToken("CARET",`^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`,true);exports.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${src[t.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${src[t.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${src[t.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${src[t.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*");createToken("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");createToken("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var require_parse_options=__commonJS((exports,module)=>{var looseOption=Object.freeze({loose:true});var emptyOpts=Object.freeze({});var parseOptions=(options)=>{if(!options){return emptyOpts}if(typeof options!=="object"){return looseOption}return options};module.exports=parseOptions});var require_identifiers=__commonJS((exports,module)=>{var numeric=/^[0-9]+$/;var compareIdentifiers=(a,b3)=>{if(typeof a==="number"&&typeof b3==="number"){return a===b3?0:a<b3?-1:1}const anum=numeric.test(a);const bnum=numeric.test(b3);if(anum&&bnum){a=+a;b3=+b3}return a===b3?0:anum&&!bnum?-1:bnum&&!anum?1:a<b3?-1:1};var rcompareIdentifiers=(a,b3)=>compareIdentifiers(b3,a);module.exports={compareIdentifiers,rcompareIdentifiers}});var require_semver=__commonJS((exports,module)=>{var debug=require_debug();var{MAX_LENGTH,MAX_SAFE_INTEGER}=require_constants();var{safeRe:re,t}=require_re();var parseOptions=require_parse_options();var{compareIdentifiers}=require_identifiers();class SemVer{constructor(version2,options){options=parseOptions(options);if(version2 instanceof SemVer){if(version2.loose===!!options.loose&&version2.includePrerelease===!!options.includePrerelease){return version2}else{version2=version2.version}}else if(typeof version2!=="string"){throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`)}if(version2.length>MAX_LENGTH){throw new TypeError(`version is longer than ${MAX_LENGTH} characters`)}debug("SemVer",version2,options);this.options=options;this.loose=!!options.loose;this.includePrerelease=!!options.includePrerelease;const m2=version2.trim().match(options.loose?re[t.LOOSE]:re[t.FULL]);if(!m2){throw new TypeError(`Invalid Version: ${version2}`)}this.raw=version2;this.major=+m2[1];this.minor=+m2[2];this.patch=+m2[3];if(this.major>MAX_SAFE_INTEGER||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>MAX_SAFE_INTEGER||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>MAX_SAFE_INTEGER||this.patch<0){throw new TypeError("Invalid patch version")}if(!m2[4]){this.prerelease=[]}else{this.prerelease=m2[4].split(".").map((id)=>{if(/^[0-9]+$/.test(id)){const num=+id;if(num>=0&&num<MAX_SAFE_INTEGER){return num}}return id})}this.build=m2[5]?m2[5].split("."):[];this.format()}format(){this.version=`${this.major}.${this.minor}.${this.patch}`;if(this.prerelease.length){this.version+=`-${this.prerelease.join(".")}`}return this.version}toString(){return this.version}compare(other){debug("SemVer.compare",this.version,this.options,other);if(!(other instanceof SemVer)){if(typeof other==="string"&&other===this.version){return 0}other=new SemVer(other,this.options)}if(other.version===this.version){return 0}return this.compareMain(other)||this.comparePre(other)}compareMain(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}if(this.major<other.major){return-1}if(this.major>other.major){return 1}if(this.minor<other.minor){return-1}if(this.minor>other.minor){return 1}if(this.patch<other.patch){return-1}if(this.patch>other.patch){return 1}return 0}comparePre(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}if(this.prerelease.length&&!other.prerelease.length){return-1}else if(!this.prerelease.length&&other.prerelease.length){return 1}else if(!this.prerelease.length&&!other.prerelease.length){return 0}let i=0;do{const a=this.prerelease[i];const b3=other.prerelease[i];debug("prerelease compare",i,a,b3);if(a===undefined&&b3===undefined){return 0}else if(b3===undefined){return 1}else if(a===undefined){return-1}else if(a===b3){continue}else{return compareIdentifiers(a,b3)}}while(++i)}compareBuild(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}let i=0;do{const a=this.build[i];const b3=other.build[i];debug("build compare",i,a,b3);if(a===undefined&&b3===undefined){return 0}else if(b3===undefined){return 1}else if(a===undefined){return-1}else if(a===b3){continue}else{return compareIdentifiers(a,b3)}}while(++i)}inc(release,identifier,identifierBase){if(release.startsWith("pre")){if(!identifier&&identifierBase===false){throw new Error("invalid increment argument: identifier is empty")}if(identifier){const match=`-${identifier}`.match(this.options.loose?re[t.PRERELEASELOOSE]:re[t.PRERELEASE]);if(!match||match[1]!==identifier){throw new Error(`invalid identifier: ${identifier}`)}}}switch(release){case"premajor":this.prerelease.length=0;this.patch=0;this.minor=0;this.major++;this.inc("pre",identifier,identifierBase);break;case"preminor":this.prerelease.length=0;this.patch=0;this.minor++;this.inc("pre",identifier,identifierBase);break;case"prepatch":this.prerelease.length=0;this.inc("patch",identifier,identifierBase);this.inc("pre",identifier,identifierBase);break;case"prerelease":if(this.prerelease.length===0){this.inc("patch",identifier,identifierBase)}this.inc("pre",identifier,identifierBase);break;case"release":if(this.prerelease.length===0){throw new Error(`version ${this.raw} is not a prerelease`)}this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0){this.major++}this.minor=0;this.patch=0;this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0){this.minor++}this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0){this.patch++}this.prerelease=[];break;case"pre":{const base=Number(identifierBase)?1:0;if(this.prerelease.length===0){this.prerelease=[base]}else{let i=this.prerelease.length;while(--i>=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1){if(identifier===this.prerelease.join(".")&&identifierBase===false){throw new Error("invalid increment argument: identifier already exists")}this.prerelease.push(base)}}if(identifier){let prerelease2=[identifier,base];if(identifierBase===false){prerelease2=[identifier]}if(compareIdentifiers(this.prerelease[0],identifier)===0){if(isNaN(this.prerelease[1])){this.prerelease=prerelease2}}else{this.prerelease=prerelease2}}break}default:throw new Error(`invalid increment argument: ${release}`)}this.raw=this.format();if(this.build.length){this.raw+=`+${this.build.join(".")}`}return this}}module.exports=SemVer});var require_parse=__commonJS((exports,module)=>{var SemVer=require_semver();var parse4=(version2,options,throwErrors=false)=>{if(version2 instanceof SemVer){return version2}try{return new SemVer(version2,options)}catch(er){if(!throwErrors){return null}throw er}};module.exports=parse4});var require_valid=__commonJS((exports,module)=>{var parse4=require_parse();var valid=(version2,options)=>{const v=parse4(version2,options);return v?v.version:null};module.exports=valid});var require_clean=__commonJS((exports,module)=>{var parse4=require_parse();var clean=(version2,options)=>{const s=parse4(version2.trim().replace(/^[=v]+/,""),options);return s?s.version:null};module.exports=clean});var require_inc=__commonJS((exports,module)=>{var SemVer=require_semver();var inc=(version2,release,options,identifier,identifierBase)=>{if(typeof options==="string"){identifierBase=identifier;identifier=options;options=undefined}try{return new SemVer(version2 instanceof SemVer?version2.version:version2,options).inc(release,identifier,identifierBase).version}catch(er){return null}};module.exports=inc});var require_diff=__commonJS((exports,module)=>{var parse4=require_parse();var diff=(version1,version2)=>{const v1=parse4(version1,null,true);const v2=parse4(version2,null,true);const comparison=v1.compare(v2);if(comparison===0){return null}const v1Higher=comparison>0;const highVersion=v1Higher?v1:v2;const lowVersion=v1Higher?v2:v1;const highHasPre=!!highVersion.prerelease.length;const lowHasPre=!!lowVersion.prerelease.length;if(lowHasPre&&!highHasPre){if(!lowVersion.patch&&!lowVersion.minor){return"major"}if(lowVersion.compareMain(highVersion)===0){if(lowVersion.minor&&!lowVersion.patch){return"minor"}return"patch"}}const prefix=highHasPre?"pre":"";if(v1.major!==v2.major){return prefix+"major"}if(v1.minor!==v2.minor){return prefix+"minor"}if(v1.patch!==v2.patch){return prefix+"patch"}return"prerelease"};module.exports=diff});var require_major=__commonJS((exports,module)=>{var SemVer=require_semver();var major=(a,loose)=>new SemVer(a,loose).major;module.exports=major});var require_minor=__commonJS((exports,module)=>{var SemVer=require_semver();var minor2=(a,loose)=>new SemVer(a,loose).minor;module.exports=minor2});var require_patch=__commonJS((exports,module)=>{var SemVer=require_semver();var patch2=(a,loose)=>new SemVer(a,loose).patch;module.exports=patch2});var require_prerelease=__commonJS((exports,module)=>{var parse4=require_parse();var prerelease2=(version2,options)=>{const parsed=parse4(version2,options);return parsed&&parsed.prerelease.length?parsed.prerelease:null};module.exports=prerelease2});var require_compare=__commonJS((exports,module)=>{var SemVer=require_semver();var compare=(a,b3,loose)=>new SemVer(a,loose).compare(new SemVer(b3,loose));module.exports=compare});var require_rcompare=__commonJS((exports,module)=>{var compare=require_compare();var rcompare=(a,b3,loose)=>compare(b3,a,loose);module.exports=rcompare});var require_compare_loose=__commonJS((exports,module)=>{var compare=require_compare();var compareLoose=(a,b3)=>compare(a,b3,true);module.exports=compareLoose});var require_compare_build=__commonJS((exports,module)=>{var SemVer=require_semver();var compareBuild=(a,b3,loose)=>{const versionA=new SemVer(a,loose);const versionB=new SemVer(b3,loose);return versionA.compare(versionB)||versionA.compareBuild(versionB)};module.exports=compareBuild});var require_sort=__commonJS((exports,module)=>{var compareBuild=require_compare_build();var sort=(list,loose)=>list.sort((a,b3)=>compareBuild(a,b3,loose));module.exports=sort});var require_rsort=__commonJS((exports,module)=>{var compareBuild=require_compare_build();var rsort=(list,loose)=>list.sort((a,b3)=>compareBuild(b3,a,loose));module.exports=rsort});var require_gt=__commonJS((exports,module)=>{var compare=require_compare();var gt=(a,b3,loose)=>compare(a,b3,loose)>0;module.exports=gt});var require_lt=__commonJS((exports,module)=>{var compare=require_compare();var lt=(a,b3,loose)=>compare(a,b3,loose)<0;module.exports=lt});var require_eq=__commonJS((exports,module)=>{var compare=require_compare();var eq=(a,b3,loose)=>compare(a,b3,loose)===0;module.exports=eq});var require_neq=__commonJS((exports,module)=>{var compare=require_compare();var neq=(a,b3,loose)=>compare(a,b3,loose)!==0;module.exports=neq});var require_gte=__commonJS((exports,module)=>{var compare=require_compare();var gte=(a,b3,loose)=>compare(a,b3,loose)>=0;module.exports=gte});var require_lte=__commonJS((exports,module)=>{var compare=require_compare();var lte=(a,b3,loose)=>compare(a,b3,loose)<=0;module.exports=lte});var require_cmp=__commonJS((exports,module)=>{var eq=require_eq();var neq=require_neq();var gt=require_gt();var gte=require_gte();var lt=require_lt();var lte=require_lte();var cmp=(a,op,b3,loose)=>{switch(op){case"===":if(typeof a==="object"){a=a.version}if(typeof b3==="object"){b3=b3.version}return a===b3;case"!==":if(typeof a==="object"){a=a.version}if(typeof b3==="object"){b3=b3.version}return a!==b3;case"":case"=":case"==":return eq(a,b3,loose);case"!=":return neq(a,b3,loose);case">":return gt(a,b3,loose);case">=":return gte(a,b3,loose);case"<":return lt(a,b3,loose);case"<=":return lte(a,b3,loose);default:throw new TypeError(`Invalid operator: ${op}`)}};module.exports=cmp});var require_coerce=__commonJS((exports,module)=>{var SemVer=require_semver();var parse4=require_parse();var{safeRe:re,t}=require_re();var coerce=(version2,options)=>{if(version2 instanceof SemVer){return version2}if(typeof version2==="number"){version2=String(version2)}if(typeof version2!=="string"){return null}options=options||{};let match=null;if(!options.rtl){match=version2.match(options.includePrerelease?re[t.COERCEFULL]:re[t.COERCE])}else{const coerceRtlRegex=options.includePrerelease?re[t.COERCERTLFULL]:re[t.COERCERTL];let next;while((next=coerceRtlRegex.exec(version2))&&(!match||match.index+match[0].length!==version2.length)){if(!match||next.index+next[0].length!==match.index+match[0].length){match=next}coerceRtlRegex.lastIndex=next.index+next[1].length+next[2].length}coerceRtlRegex.lastIndex=-1}if(match===null){return null}const major=match[2];const minor2=match[3]||"0";const patch2=match[4]||"0";const prerelease2=options.includePrerelease&&match[5]?`-${match[5]}`:"";const build2=options.includePrerelease&&match[6]?`+${match[6]}`:"";return parse4(`${major}.${minor2}.${patch2}${prerelease2}${build2}`,options)};module.exports=coerce});var require_lrucache=__commonJS((exports,module)=>{class LRUCache{constructor(){this.max=1000;this.map=new Map}get(key){const value=this.map.get(key);if(value===undefined){return}else{this.map.delete(key);this.map.set(key,value);return value}}delete(key){return this.map.delete(key)}set(key,value){const deleted=this.delete(key);if(!deleted&&value!==undefined){if(this.map.size>=this.max){const firstKey=this.map.keys().next().value;this.delete(firstKey)}this.map.set(key,value)}return this}}module.exports=LRUCache});var require_range=__commonJS((exports,module)=>{var SPACE_CHARACTERS=/\s+/g;class Range{constructor(range,options){options=parseOptions(options);if(range instanceof Range){if(range.loose===!!options.loose&&range.includePrerelease===!!options.includePrerelease){return range}else{return new Range(range.raw,options)}}if(range instanceof Comparator){this.raw=range.value;this.set=[[range]];this.formatted=undefined;return this}this.options=options;this.loose=!!options.loose;this.includePrerelease=!!options.includePrerelease;this.raw=range.trim().replace(SPACE_CHARACTERS," ");this.set=this.raw.split("||").map((r2)=>this.parseRange(r2.trim())).filter((c)=>c.length);if(!this.set.length){throw new TypeError(`Invalid SemVer Range: ${this.raw}`)}if(this.set.length>1){const first=this.set[0];this.set=this.set.filter((c)=>!isNullSet(c[0]));if(this.set.length===0){this.set=[first]}else if(this.set.length>1){for(const c of this.set){if(c.length===1&&isAny(c[0])){this.set=[c];break}}}}this.formatted=undefined}get range(){if(this.formatted===undefined){this.formatted="";for(let i=0;i<this.set.length;i++){if(i>0){this.formatted+="||"}const comps=this.set[i];for(let k3=0;k3<comps.length;k3++){if(k3>0){this.formatted+=" "}this.formatted+=comps[k3].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(range){const memoOpts=(this.options.includePrerelease&&FLAG_INCLUDE_PRERELEASE)|(this.options.loose&&FLAG_LOOSE);const memoKey=memoOpts+":"+range;const cached2=cache.get(memoKey);if(cached2){return cached2}const loose=this.options.loose;const hr=loose?re[t.HYPHENRANGELOOSE]:re[t.HYPHENRANGE];range=range.replace(hr,hyphenReplace(this.options.includePrerelease));debug("hyphen replace",range);range=range.replace(re[t.COMPARATORTRIM],comparatorTrimReplace);debug("comparator trim",range);range=range.replace(re[t.TILDETRIM],tildeTrimReplace);debug("tilde trim",range);range=range.replace(re[t.CARETTRIM],caretTrimReplace);debug("caret trim",range);let rangeList=range.split(" ").map((comp)=>parseComparator(comp,this.options)).join(" ").split(/\s+/).map((comp)=>replaceGTE0(comp,this.options));if(loose){rangeList=rangeList.filter((comp)=>{debug("loose invalid filter",comp,this.options);return!!comp.match(re[t.COMPARATORLOOSE])})}debug("range list",rangeList);const rangeMap=new Map;const comparators=rangeList.map((comp)=>new Comparator(comp,this.options));for(const comp of comparators){if(isNullSet(comp)){return[comp]}rangeMap.set(comp.value,comp)}if(rangeMap.size>1&&rangeMap.has("")){rangeMap.delete("")}const result=[...rangeMap.values()];cache.set(memoKey,result);return result}intersects(range,options){if(!(range instanceof Range)){throw new TypeError("a Range is required")}return this.set.some((thisComparators)=>{return isSatisfiable(thisComparators,options)&&range.set.some((rangeComparators)=>{return isSatisfiable(rangeComparators,options)&&thisComparators.every((thisComparator)=>{return rangeComparators.every((rangeComparator)=>{return thisComparator.intersects(rangeComparator,options)})})})})}test(version2){if(!version2){return false}if(typeof version2==="string"){try{version2=new SemVer(version2,this.options)}catch(er){return false}}for(let i=0;i<this.set.length;i++){if(testSet(this.set[i],version2,this.options)){return true}}return false}}module.exports=Range;var LRU=require_lrucache();var cache=new LRU;var parseOptions=require_parse_options();var Comparator=require_comparator();var debug=require_debug();var SemVer=require_semver();var{safeRe:re,t,comparatorTrimReplace,tildeTrimReplace,caretTrimReplace}=require_re();var{FLAG_INCLUDE_PRERELEASE,FLAG_LOOSE}=require_constants();var isNullSet=(c)=>c.value==="<0.0.0-0";var isAny=(c)=>c.value==="";var isSatisfiable=(comparators,options)=>{let result=true;const remainingComparators=comparators.slice();let testComparator=remainingComparators.pop();while(result&&remainingComparators.length){result=remainingComparators.every((otherComparator)=>{return testComparator.intersects(otherComparator,options)});testComparator=remainingComparators.pop()}return result};var parseComparator=(comp,options)=>{comp=comp.replace(re[t.BUILD],"");debug("comp",comp,options);comp=replaceCarets(comp,options);debug("caret",comp);comp=replaceTildes(comp,options);debug("tildes",comp);comp=replaceXRanges(comp,options);debug("xrange",comp);comp=replaceStars(comp,options);debug("stars",comp);return comp};var isX=(id)=>!id||id.toLowerCase()==="x"||id==="*";var replaceTildes=(comp,options)=>{return comp.trim().split(/\s+/).map((c)=>replaceTilde(c,options)).join(" ")};var replaceTilde=(comp,options)=>{const r2=options.loose?re[t.TILDELOOSE]:re[t.TILDE];return comp.replace(r2,(_3,M2,m2,p2,pr)=>{debug("tilde",comp,_3,M2,m2,p2,pr);let ret;if(isX(M2)){ret=""}else if(isX(m2)){ret=`>=${M2}.0.0 <${+M2+1}.0.0-0`}else if(isX(p2)){ret=`>=${M2}.${m2}.0 <${M2}.${+m2+1}.0-0`}else if(pr){debug("replaceTilde pr",pr);ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2+1}.0-0`}else{ret=`>=${M2}.${m2}.${p2} <${M2}.${+m2+1}.0-0`}debug("tilde return",ret);return ret})};var replaceCarets=(comp,options)=>{return comp.trim().split(/\s+/).map((c)=>replaceCaret(c,options)).join(" ")};var replaceCaret=(comp,options)=>{debug("caret",comp,options);const r2=options.loose?re[t.CARETLOOSE]:re[t.CARET];const z2=options.includePrerelease?"-0":"";return comp.replace(r2,(_3,M2,m2,p2,pr)=>{debug("caret",comp,_3,M2,m2,p2,pr);let ret;if(isX(M2)){ret=""}else if(isX(m2)){ret=`>=${M2}.0.0${z2} <${+M2+1}.0.0-0`}else if(isX(p2)){if(M2==="0"){ret=`>=${M2}.${m2}.0${z2} <${M2}.${+m2+1}.0-0`}else{ret=`>=${M2}.${m2}.0${z2} <${+M2+1}.0.0-0`}}else if(pr){debug("replaceCaret pr",pr);if(M2==="0"){if(m2==="0"){ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${m2}.${+p2+1}-0`}else{ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2+1}.0-0`}}else{ret=`>=${M2}.${m2}.${p2}-${pr} <${+M2+1}.0.0-0`}}else{debug("no pr");if(M2==="0"){if(m2==="0"){ret=`>=${M2}.${m2}.${p2}${z2} <${M2}.${m2}.${+p2+1}-0`}else{ret=`>=${M2}.${m2}.${p2}${z2} <${M2}.${+m2+1}.0-0`}}else{ret=`>=${M2}.${m2}.${p2} <${+M2+1}.0.0-0`}}debug("caret return",ret);return ret})};var replaceXRanges=(comp,options)=>{debug("replaceXRanges",comp,options);return comp.split(/\s+/).map((c)=>replaceXRange(c,options)).join(" ")};var replaceXRange=(comp,options)=>{comp=comp.trim();const r2=options.loose?re[t.XRANGELOOSE]:re[t.XRANGE];return comp.replace(r2,(ret,gtlt,M2,m2,p2,pr)=>{debug("xRange",comp,ret,gtlt,M2,m2,p2,pr);const xM=isX(M2);const xm=xM||isX(m2);const xp=xm||isX(p2);const anyX=xp;if(gtlt==="="&&anyX){gtlt=""}pr=options.includePrerelease?"-0":"";if(xM){if(gtlt===">"||gtlt==="<"){ret="<0.0.0-0"}else{ret="*"}}else if(gtlt&&anyX){if(xm){m2=0}p2=0;if(gtlt===">"){gtlt=">=";if(xm){M2=+M2+1;m2=0;p2=0}else{m2=+m2+1;p2=0}}else if(gtlt==="<="){gtlt="<";if(xm){M2=+M2+1}else{m2=+m2+1}}if(gtlt==="<"){pr="-0"}ret=`${gtlt+M2}.${m2}.${p2}${pr}`}else if(xm){ret=`>=${M2}.0.0${pr} <${+M2+1}.0.0-0`}else if(xp){ret=`>=${M2}.${m2}.0${pr} <${M2}.${+m2+1}.0-0`}debug("xRange return",ret);return ret})};var replaceStars=(comp,options)=>{debug("replaceStars",comp,options);return comp.trim().replace(re[t.STAR],"")};var replaceGTE0=(comp,options)=>{debug("replaceGTE0",comp,options);return comp.trim().replace(re[options.includePrerelease?t.GTE0PRE:t.GTE0],"")};var hyphenReplace=(incPr)=>($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr)=>{if(isX(fM)){from=""}else if(isX(fm)){from=`>=${fM}.0.0${incPr?"-0":""}`}else if(isX(fp)){from=`>=${fM}.${fm}.0${incPr?"-0":""}`}else if(fpr){from=`>=${from}`}else{from=`>=${from}${incPr?"-0":""}`}if(isX(tM)){to=""}else if(isX(tm)){to=`<${+tM+1}.0.0-0`}else if(isX(tp)){to=`<${tM}.${+tm+1}.0-0`}else if(tpr){to=`<=${tM}.${tm}.${tp}-${tpr}`}else if(incPr){to=`<${tM}.${tm}.${+tp+1}-0`}else{to=`<=${to}`}return`${from} ${to}`.trim()};var testSet=(set,version2,options)=>{for(let i=0;i<set.length;i++){if(!set[i].test(version2)){return false}}if(version2.prerelease.length&&!options.includePrerelease){for(let i=0;i<set.length;i++){debug(set[i].semver);if(set[i].semver===Comparator.ANY){continue}if(set[i].semver.prerelease.length>0){const allowed=set[i].semver;if(allowed.major===version2.major&&allowed.minor===version2.minor&&allowed.patch===version2.patch){return true}}}return false}return true}});var require_comparator=__commonJS((exports,module)=>{var ANY=Symbol("SemVer ANY");class Comparator{static get ANY(){return ANY}constructor(comp,options){options=parseOptions(options);if(comp instanceof Comparator){if(comp.loose===!!options.loose){return comp}else{comp=comp.value}}comp=comp.trim().split(/\s+/).join(" ");debug("comparator",comp,options);this.options=options;this.loose=!!options.loose;this.parse(comp);if(this.semver===ANY){this.value=""}else{this.value=this.operator+this.semver.version}debug("comp",this)}parse(comp){const r2=this.options.loose?re[t.COMPARATORLOOSE]:re[t.COMPARATOR];const m2=comp.match(r2);if(!m2){throw new TypeError(`Invalid comparator: ${comp}`)}this.operator=m2[1]!==undefined?m2[1]:"";if(this.operator==="="){this.operator=""}if(!m2[2]){this.semver=ANY}else{this.semver=new SemVer(m2[2],this.options.loose)}}toString(){return this.value}test(version2){debug("Comparator.test",version2,this.options.loose);if(this.semver===ANY||version2===ANY){return true}if(typeof version2==="string"){try{version2=new SemVer(version2,this.options)}catch(er){return false}}return cmp(version2,this.operator,this.semver,this.options)}intersects(comp,options){if(!(comp instanceof Comparator)){throw new TypeError("a Comparator is required")}if(this.operator===""){if(this.value===""){return true}return new Range(comp.value,options).test(this.value)}else if(comp.operator===""){if(comp.value===""){return true}return new Range(this.value,options).test(comp.semver)}options=parseOptions(options);if(options.includePrerelease&&(this.value==="<0.0.0-0"||comp.value==="<0.0.0-0")){return false}if(!options.includePrerelease&&(this.value.startsWith("<0.0.0")||comp.value.startsWith("<0.0.0"))){return false}if(this.operator.startsWith(">")&&comp.operator.startsWith(">")){return true}if(this.operator.startsWith("<")&&comp.operator.startsWith("<")){return true}if(this.semver.version===comp.semver.version&&this.operator.includes("=")&&comp.operator.includes("=")){return true}if(cmp(this.semver,"<",comp.semver,options)&&this.operator.startsWith(">")&&comp.operator.startsWith("<")){return true}if(cmp(this.semver,">",comp.semver,options)&&this.operator.startsWith("<")&&comp.operator.startsWith(">")){return true}return false}}module.exports=Comparator;var parseOptions=require_parse_options();var{safeRe:re,t}=require_re();var cmp=require_cmp();var debug=require_debug();var SemVer=require_semver();var Range=require_range()});var require_satisfies=__commonJS((exports,module)=>{var Range=require_range();var satisfies=(version2,range,options)=>{try{range=new Range(range,options)}catch(er){return false}return range.test(version2)};module.exports=satisfies});var require_to_comparators=__commonJS((exports,module)=>{var Range=require_range();var toComparators=(range,options)=>new Range(range,options).set.map((comp)=>comp.map((c)=>c.value).join(" ").trim().split(" "));module.exports=toComparators});var require_max_satisfying=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var maxSatisfying=(versions2,range,options)=>{let max=null;let maxSV=null;let rangeObj=null;try{rangeObj=new Range(range,options)}catch(er){return null}versions2.forEach((v)=>{if(rangeObj.test(v)){if(!max||maxSV.compare(v)===-1){max=v;maxSV=new SemVer(max,options)}}});return max};module.exports=maxSatisfying});var require_min_satisfying=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var minSatisfying=(versions2,range,options)=>{let min=null;let minSV=null;let rangeObj=null;try{rangeObj=new Range(range,options)}catch(er){return null}versions2.forEach((v)=>{if(rangeObj.test(v)){if(!min||minSV.compare(v)===1){min=v;minSV=new SemVer(min,options)}}});return min};module.exports=minSatisfying});var require_min_version=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var gt=require_gt();var minVersion=(range,loose)=>{range=new Range(range,loose);let minver=new SemVer("0.0.0");if(range.test(minver)){return minver}minver=new SemVer("0.0.0-0");if(range.test(minver)){return minver}minver=null;for(let i=0;i<range.set.length;++i){const comparators=range.set[i];let setMin=null;comparators.forEach((comparator2)=>{const compver=new SemVer(comparator2.semver.version);switch(comparator2.operator){case">":if(compver.prerelease.length===0){compver.patch++}else{compver.prerelease.push(0)}compver.raw=compver.format();case"":case">=":if(!setMin||gt(compver,setMin)){setMin=compver}break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${comparator2.operator}`)}});if(setMin&&(!minver||gt(minver,setMin))){minver=setMin}}if(minver&&range.test(minver)){return minver}return null};module.exports=minVersion});var require_valid2=__commonJS((exports,module)=>{var Range=require_range();var validRange=(range,options)=>{try{return new Range(range,options).range||"*"}catch(er){return null}};module.exports=validRange});var require_outside=__commonJS((exports,module)=>{var SemVer=require_semver();var Comparator=require_comparator();var{ANY}=Comparator;var Range=require_range();var satisfies=require_satisfies();var gt=require_gt();var lt=require_lt();var lte=require_lte();var gte=require_gte();var outside=(version2,range,hilo,options)=>{version2=new SemVer(version2,options);range=new Range(range,options);let gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version2,range,options)){return false}for(let i=0;i<range.set.length;++i){const comparators=range.set[i];let high=null;let low=null;comparators.forEach((comparator2)=>{if(comparator2.semver===ANY){comparator2=new Comparator(">=0.0.0")}high=high||comparator2;low=low||comparator2;if(gtfn(comparator2.semver,high.semver,options)){high=comparator2}else if(ltfn(comparator2.semver,low.semver,options)){low=comparator2}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&<efn(version2,low.semver)){return false}else if(low.operator===ecomp&<fn(version2,low.semver)){return false}}return true};module.exports=outside});var require_gtr=__commonJS((exports,module)=>{var outside=require_outside();var gtr=(version2,range,options)=>outside(version2,range,">",options);module.exports=gtr});var require_ltr=__commonJS((exports,module)=>{var outside=require_outside();var ltr=(version2,range,options)=>outside(version2,range,"<",options);module.exports=ltr});var require_intersects=__commonJS((exports,module)=>{var Range=require_range();var intersects=(r1,r2,options)=>{r1=new Range(r1,options);r2=new Range(r2,options);return r1.intersects(r2,options)};module.exports=intersects});var require_simplify=__commonJS((exports,module)=>{var satisfies=require_satisfies();var compare=require_compare();module.exports=(versions2,range,options)=>{const set=[];let first=null;let prev=null;const v=versions2.sort((a,b3)=>compare(a,b3,options));for(const version2 of v){const included=satisfies(version2,range,options);if(included){prev=version2;if(!first){first=version2}}else{if(prev){set.push([first,prev])}prev=null;first=null}}if(first){set.push([first,null])}const ranges=[];for(const[min,max]of set){if(min===max){ranges.push(min)}else if(!max&&min===v[0]){ranges.push("*")}else if(!max){ranges.push(`>=${min}`)}else if(min===v[0]){ranges.push(`<=${max}`)}else{ranges.push(`${min} - ${max}`)}}const simplified=ranges.join(" || ");const original=typeof range.raw==="string"?range.raw:String(range);return simplified.length<original.length?simplified:range}});var require_subset=__commonJS((exports,module)=>{var Range=require_range();var Comparator=require_comparator();var{ANY}=Comparator;var satisfies=require_satisfies();var compare=require_compare();var subset=(sub,dom,options={})=>{if(sub===dom){return true}sub=new Range(sub,options);dom=new Range(dom,options);let sawNonNull=false;OUTER:for(const simpleSub of sub.set){for(const simpleDom of dom.set){const isSub=simpleSubset(simpleSub,simpleDom,options);sawNonNull=sawNonNull||isSub!==null;if(isSub){continue OUTER}}if(sawNonNull){return false}}return true};var minimumVersionWithPreRelease=[new Comparator(">=0.0.0-0")];var minimumVersion=[new Comparator(">=0.0.0")];var simpleSubset=(sub,dom,options)=>{if(sub===dom){return true}if(sub.length===1&&sub[0].semver===ANY){if(dom.length===1&&dom[0].semver===ANY){return true}else if(options.includePrerelease){sub=minimumVersionWithPreRelease}else{sub=minimumVersion}}if(dom.length===1&&dom[0].semver===ANY){if(options.includePrerelease){return true}else{dom=minimumVersion}}const eqSet=new Set;let gt,lt;for(const c of sub){if(c.operator===">"||c.operator===">="){gt=higherGT(gt,c,options)}else if(c.operator==="<"||c.operator==="<="){lt=lowerLT(lt,c,options)}else{eqSet.add(c.semver)}}if(eqSet.size>1){return null}let gtltComp;if(gt&<){gtltComp=compare(gt.semver,lt.semver,options);if(gtltComp>0){return null}else if(gtltComp===0&&(gt.operator!==">="||lt.operator!=="<=")){return null}}for(const eq of eqSet){if(gt&&!satisfies(eq,String(gt),options)){return null}if(lt&&!satisfies(eq,String(lt),options)){return null}for(const c of dom){if(!satisfies(eq,String(c),options)){return false}}return true}let higher,lower;let hasDomLT,hasDomGT;let needDomLTPre=lt&&!options.includePrerelease&<.semver.prerelease.length?lt.semver:false;let needDomGTPre=gt&&!options.includePrerelease&>.semver.prerelease.length?gt.semver:false;if(needDomLTPre&&needDomLTPre.prerelease.length===1&<.operator==="<"&&needDomLTPre.prerelease[0]===0){needDomLTPre=false}for(const c of dom){hasDomGT=hasDomGT||c.operator===">"||c.operator===">=";hasDomLT=hasDomLT||c.operator==="<"||c.operator==="<=";if(gt){if(needDomGTPre){if(c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomGTPre.major&&c.semver.minor===needDomGTPre.minor&&c.semver.patch===needDomGTPre.patch){needDomGTPre=false}}if(c.operator===">"||c.operator===">="){higher=higherGT(gt,c,options);if(higher===c&&higher!==gt){return false}}else if(gt.operator===">="&&!satisfies(gt.semver,String(c),options)){return false}}if(lt){if(needDomLTPre){if(c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomLTPre.major&&c.semver.minor===needDomLTPre.minor&&c.semver.patch===needDomLTPre.patch){needDomLTPre=false}}if(c.operator==="<"||c.operator==="<="){lower=lowerLT(lt,c,options);if(lower===c&&lower!==lt){return false}}else if(lt.operator==="<="&&!satisfies(lt.semver,String(c),options)){return false}}if(!c.operator&&(lt||gt)&>ltComp!==0){return false}}if(gt&&hasDomLT&&!lt&>ltComp!==0){return false}if(lt&&hasDomGT&&!gt&>ltComp!==0){return false}if(needDomGTPre||needDomLTPre){return false}return true};var higherGT=(a,b3,options)=>{if(!a){return b3}const comp=compare(a.semver,b3.semver,options);return comp>0?a:comp<0?b3:b3.operator===">"&&a.operator===">="?b3:a};var lowerLT=(a,b3,options)=>{if(!a){return b3}const comp=compare(a.semver,b3.semver,options);return comp<0?a:comp>0?b3:b3.operator==="<"&&a.operator==="<="?b3:a};module.exports=subset});var require_semver2=__commonJS((exports,module)=>{var internalRe=require_re();var constants=require_constants();var SemVer=require_semver();var identifiers=require_identifiers();var parse4=require_parse();var valid=require_valid();var clean=require_clean();var inc=require_inc();var diff=require_diff();var major=require_major();var minor2=require_minor();var patch2=require_patch();var prerelease2=require_prerelease();var compare=require_compare();var rcompare=require_rcompare();var compareLoose=require_compare_loose();var compareBuild=require_compare_build();var sort=require_sort();var rsort=require_rsort();var gt=require_gt();var lt=require_lt();var eq=require_eq();var neq=require_neq();var gte=require_gte();var lte=require_lte();var cmp=require_cmp();var coerce=require_coerce();var Comparator=require_comparator();var Range=require_range();var satisfies=require_satisfies();var toComparators=require_to_comparators();var maxSatisfying=require_max_satisfying();var minSatisfying=require_min_satisfying();var minVersion=require_min_version();var validRange=require_valid2();var outside=require_outside();var gtr=require_gtr();var ltr=require_ltr();var intersects=require_intersects();var simplifyRange=require_simplify();var subset=require_subset();module.exports={parse:parse4,valid,clean,inc,diff,major,minor:minor2,patch:patch2,prerelease:prerelease2,compare,rcompare,compareLoose,compareBuild,sort,rsort,gt,lt,eq,neq,gte,lte,cmp,coerce,Comparator,Range,satisfies,toComparators,maxSatisfying,minSatisfying,minVersion,validRange,outside,gtr,ltr,intersects,simplifyRange,subset,SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers}});var import__=__toESM(require_commander(),1);var{program,createCommand,createArgument,createOption,CommanderError,InvalidArgumentError,InvalidOptionArgumentError,Command,Argument,Option,Help}=import__.default;var import_sisteransi=__toESM(require_src(),1);import{stdin as j,stdout as M}from"node:process";import O from"node:readline";import{Writable as X}from"node:stream";function DD({onlyFirst:e=false}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?undefined:"g")}var uD=DD();function P(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(uD,"")}function L(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}};(function(e){var u={};e.exports=u,u.eastAsianWidth=function(F){var s=F.charCodeAt(0),i=F.length==2?F.charCodeAt(1):0,D=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,D=s<<10|i,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},u.characterLength=function(F){var s=this.eastAsianWidth(F);return s=="F"||s=="W"||s=="A"?2:1};function t(F){return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(F){for(var s=t(F),i=0,D=0;D<s.length;D++)i=i+this.characterLength(s[D]);return i},u.slice=function(F,s,i){textLen=u.length(F),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var D="",C=0,n=t(F),E=0;E<n.length;E++){var a=n[E],o=u.length(a);if(C>=s-(o==2?1:0))if(C+o<=i)D+=a;else break;C+=o}return D}})(W);var tD=W.exports;var eD=L(tD);var FD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};var sD=L(FD);function p(e,u={}){if(typeof e!="string"||e.length===0||(u={ambiguousIsNarrow:true,...u},e=P(e),e.length===0))return 0;e=e.replace(sD()," ");const t=u.ambiguousIsNarrow?1:2;let F=0;for(const s of e){const i=s.codePointAt(0);if(i<=31||i>=127&&i<=159||i>=768&&i<=879)continue;switch(eD.eastAsianWidth(s)){case"F":case"W":F+=2;break;case"A":F+=t;break;default:F+=1}}return F}var w=10;var N=(e=0)=>(u)=>`\x1B[${u+e}m`;var I=(e=0)=>(u)=>`\x1B[${38+e};5;${u}m`;var R=(e=0)=>(u,t,F)=>`\x1B[${38+e};2;${u};${t};${F}m`;var r={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(r.modifier);var iD=Object.keys(r.color);var CD=Object.keys(r.bgColor);[...iD,...CD];function rD(){const e=new Map;for(const[u,t]of Object.entries(r)){for(const[F,s]of Object.entries(t))r[F]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[F]=r[F],e.set(s[0],s[1]);Object.defineProperty(r,u,{value:t,enumerable:false})}return Object.defineProperty(r,"codes",{value:e,enumerable:false}),r.color.close="\x1B[39m",r.bgColor.close="\x1B[49m",r.color.ansi=N(),r.color.ansi256=I(),r.color.ansi16m=R(),r.bgColor.ansi=N(w),r.bgColor.ansi256=I(w),r.bgColor.ansi16m=R(w),Object.defineProperties(r,{rgbToAnsi256:{value:(u,t,F)=>u===t&&t===F?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(t/255*5)+Math.round(F/255*5),enumerable:false},hexToRgb:{value:(u)=>{const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!t)return[0,0,0];let[F]=t;F.length===3&&(F=[...F].map((i)=>i+i).join(""));const s=Number.parseInt(F,16);return[s>>16&255,s>>8&255,s&255]},enumerable:false},hexToAnsi256:{value:(u)=>r.rgbToAnsi256(...r.hexToRgb(u)),enumerable:false},ansi256ToAnsi:{value:(u)=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let t,F,s;if(u>=232)t=((u-232)*10+8)/255,F=t,s=t;else{u-=16;const C=u%36;t=Math.floor(u/36)/5,F=Math.floor(C/6)/5,s=C%6/5}const i=Math.max(t,F,s)*2;if(i===0)return 30;let D=30+(Math.round(s)<<2|Math.round(F)<<1|Math.round(t));return i===2&&(D+=60),D},enumerable:false},rgbToAnsi:{value:(u,t,F)=>r.ansi256ToAnsi(r.rgbToAnsi256(u,t,F)),enumerable:false},hexToAnsi:{value:(u)=>r.ansi256ToAnsi(r.hexToAnsi256(u)),enumerable:false}}),r}var ED=rD();var d=new Set(["\x1B",""]);var oD=39;var y="\x07";var V="[";var nD="]";var G="m";var _=`${nD}8;;`;var z=(e)=>`${d.values().next().value}${V}${e}${G}`;var K=(e)=>`${d.values().next().value}${_}${e}${y}`;var aD=(e)=>e.split(" ").map((u)=>p(u));var k=(e,u,t)=>{const F=[...u];let s=false,i=false,D=p(P(e[e.length-1]));for(const[C,n]of F.entries()){const E=p(n);if(D+E<=t?e[e.length-1]+=n:(e.push(n),D=0),d.has(n)&&(s=true,i=F.slice(C+1).join("").startsWith(_)),s){i?n===y&&(s=false,i=false):n===G&&(s=false);continue}D+=E,D===t&&C<F.length-1&&(e.push(""),D=0)}!D&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())};var hD=(e)=>{const u=e.split(" ");let t=u.length;for(;t>0&&!(p(u[t-1])>0);)t--;return t===u.length?e:u.slice(0,t).join(" ")+u.slice(t).join("")};var lD=(e,u,t={})=>{if(t.trim!==false&&e.trim()==="")return"";let F="",s,i;const D=aD(e);let C=[""];for(const[E,a]of e.split(" ").entries()){t.trim!==false&&(C[C.length-1]=C[C.length-1].trimStart());let o=p(C[C.length-1]);if(E!==0&&(o>=u&&(t.wordWrap===false||t.trim===false)&&(C.push(""),o=0),(o>0||t.trim===false)&&(C[C.length-1]+=" ",o++)),t.hard&&D[E]>u){const c=u-o,f=1+Math.floor((D[E]-c-1)/u);Math.floor((D[E]-1)/u)<f&&C.push(""),k(C,a,u);continue}if(o+D[E]>u&&o>0&&D[E]>0){if(t.wordWrap===false&&o<u){k(C,a,u);continue}C.push("")}if(o+D[E]>u&&t.wordWrap===false){k(C,a,u);continue}C[C.length-1]+=a}t.trim!==false&&(C=C.map((E)=>hD(E)));const n=[...C.join(`
|
|
27
|
+
`)}});return this}_outputHelpIfRequested(args){const helpOption=this._getHelpOption();const helpRequested=helpOption&&args.find((arg)=>helpOption.is(arg));if(helpRequested){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(args){return args.map((arg)=>{if(!arg.startsWith("--inspect")){return arg}let debugOption;let debugHost="127.0.0.1";let debugPort="9229";let match;if((match=arg.match(/^(--inspect(-brk)?)$/))!==null){debugOption=match[1]}else if((match=arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){debugOption=match[1];if(/^\d+$/.test(match[3])){debugPort=match[3]}else{debugHost=match[3]}}else if((match=arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){debugOption=match[1];debugHost=match[3];debugPort=match[4]}if(debugOption&&debugPort!=="0"){return`${debugOption}=${debugHost}:${parseInt(debugPort)+1}`}return arg})}function useColor(){if(process2.env.NO_COLOR||process2.env.FORCE_COLOR==="0"||process2.env.FORCE_COLOR==="false")return false;if(process2.env.FORCE_COLOR||process2.env.CLICOLOR_FORCE!==undefined)return true;return}exports.Command=Command;exports.useColor=useColor});var require_commander=__commonJS((exports)=>{var{Argument}=require_argument();var{Command}=require_command();var{CommanderError,InvalidArgumentError}=require_error();var{Help}=require_help();var{Option}=require_option();exports.program=new Command;exports.createCommand=(name)=>new Command(name);exports.createOption=(flags,description)=>new Option(flags,description);exports.createArgument=(name,description)=>new Argument(name,description);exports.Command=Command;exports.Option=Option;exports.Argument=Argument;exports.Help=Help;exports.CommanderError=CommanderError;exports.InvalidArgumentError=InvalidArgumentError;exports.InvalidOptionArgumentError=InvalidArgumentError});var require_src=__commonJS((exports,module)=>{var ESC="\x1B";var CSI=`${ESC}[`;var beep="\x07";var cursor={to(x,y){if(!y)return`${CSI}${x+1}G`;return`${CSI}${y+1};${x+1}H`},move(x,y){let ret="";if(x<0)ret+=`${CSI}${-x}D`;else if(x>0)ret+=`${CSI}${x}C`;if(y<0)ret+=`${CSI}${-y}A`;else if(y>0)ret+=`${CSI}${y}B`;return ret},up:(count=1)=>`${CSI}${count}A`,down:(count=1)=>`${CSI}${count}B`,forward:(count=1)=>`${CSI}${count}C`,backward:(count=1)=>`${CSI}${count}D`,nextLine:(count=1)=>`${CSI}E`.repeat(count),prevLine:(count=1)=>`${CSI}F`.repeat(count),left:`${CSI}G`,hide:`${CSI}?25l`,show:`${CSI}?25h`,save:`${ESC}7`,restore:`${ESC}8`};var scroll={up:(count=1)=>`${CSI}S`.repeat(count),down:(count=1)=>`${CSI}T`.repeat(count)};var erase={screen:`${CSI}2J`,up:(count=1)=>`${CSI}1J`.repeat(count),down:(count=1)=>`${CSI}J`.repeat(count),line:`${CSI}2K`,lineEnd:`${CSI}K`,lineStart:`${CSI}1K`,lines(count){let clear="";for(let i=0;i<count;i++)clear+=this.line+(i<count-1?cursor.up():"");if(count)clear+=cursor.left;return clear}};module.exports={cursor,scroll,erase,beep}});var require_picocolors=__commonJS((exports,module)=>{var p=process||{};var argv=p.argv||[];var env=p.env||{};var isColorSupported=!(!!env.NO_COLOR||argv.includes("--no-color"))&&(!!env.FORCE_COLOR||argv.includes("--color")||p.platform==="win32"||(p.stdout||{}).isTTY&&env.TERM!=="dumb"||!!env.CI);var formatter=(open,close,replace=open)=>(input)=>{let string=""+input,index=string.indexOf(close,open.length);return~index?open+replaceClose(string,close,replace,index)+close:open+string+close};var replaceClose=(string,close,replace,index)=>{let result="",cursor=0;do{result+=string.substring(cursor,index)+replace;cursor=index+close.length;index=string.indexOf(close,cursor)}while(~index);return result+string.substring(cursor)};var createColors=(enabled=isColorSupported)=>{let f=enabled?formatter:()=>String;return{isColorSupported:enabled,reset:f("\x1B[0m","\x1B[0m"),bold:f("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:f("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:f("\x1B[3m","\x1B[23m"),underline:f("\x1B[4m","\x1B[24m"),inverse:f("\x1B[7m","\x1B[27m"),hidden:f("\x1B[8m","\x1B[28m"),strikethrough:f("\x1B[9m","\x1B[29m"),black:f("\x1B[30m","\x1B[39m"),red:f("\x1B[31m","\x1B[39m"),green:f("\x1B[32m","\x1B[39m"),yellow:f("\x1B[33m","\x1B[39m"),blue:f("\x1B[34m","\x1B[39m"),magenta:f("\x1B[35m","\x1B[39m"),cyan:f("\x1B[36m","\x1B[39m"),white:f("\x1B[37m","\x1B[39m"),gray:f("\x1B[90m","\x1B[39m"),bgBlack:f("\x1B[40m","\x1B[49m"),bgRed:f("\x1B[41m","\x1B[49m"),bgGreen:f("\x1B[42m","\x1B[49m"),bgYellow:f("\x1B[43m","\x1B[49m"),bgBlue:f("\x1B[44m","\x1B[49m"),bgMagenta:f("\x1B[45m","\x1B[49m"),bgCyan:f("\x1B[46m","\x1B[49m"),bgWhite:f("\x1B[47m","\x1B[49m"),blackBright:f("\x1B[90m","\x1B[39m"),redBright:f("\x1B[91m","\x1B[39m"),greenBright:f("\x1B[92m","\x1B[39m"),yellowBright:f("\x1B[93m","\x1B[39m"),blueBright:f("\x1B[94m","\x1B[39m"),magentaBright:f("\x1B[95m","\x1B[39m"),cyanBright:f("\x1B[96m","\x1B[39m"),whiteBright:f("\x1B[97m","\x1B[39m"),bgBlackBright:f("\x1B[100m","\x1B[49m"),bgRedBright:f("\x1B[101m","\x1B[49m"),bgGreenBright:f("\x1B[102m","\x1B[49m"),bgYellowBright:f("\x1B[103m","\x1B[49m"),bgBlueBright:f("\x1B[104m","\x1B[49m"),bgMagentaBright:f("\x1B[105m","\x1B[49m"),bgCyanBright:f("\x1B[106m","\x1B[49m"),bgWhiteBright:f("\x1B[107m","\x1B[49m")}};module.exports=createColors();module.exports.createColors=createColors});var require_constants=__commonJS((exports,module)=>{var SEMVER_SPEC_VERSION="2.0.0";var MAX_LENGTH=256;var MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991;var MAX_SAFE_COMPONENT_LENGTH=16;var MAX_SAFE_BUILD_LENGTH=MAX_LENGTH-6;var RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];module.exports={MAX_LENGTH,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var require_debug=__commonJS((exports,module)=>{var debug=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...args)=>console.error("SEMVER",...args):()=>{};module.exports=debug});var require_re=__commonJS((exports,module)=>{var{MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_LENGTH}=require_constants();var debug=require_debug();exports=module.exports={};var re=exports.re=[];var safeRe=exports.safeRe=[];var src=exports.src=[];var safeSrc=exports.safeSrc=[];var t=exports.t={};var R2=0;var LETTERDASHNUMBER="[a-zA-Z0-9-]";var safeRegexReplacements=[["\\s",1],["\\d",MAX_LENGTH],[LETTERDASHNUMBER,MAX_SAFE_BUILD_LENGTH]];var makeSafeRegex=(value)=>{for(const[token,max]of safeRegexReplacements){value=value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`)}return value};var createToken=(name,value,isGlobal)=>{const safe=makeSafeRegex(value);const index=R2++;debug(name,index,value);t[name]=index;src[index]=value;safeSrc[index]=safe;re[index]=new RegExp(value,isGlobal?"g":undefined);safeRe[index]=new RegExp(safe,isGlobal?"g":undefined)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","\\d+");createToken("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);createToken("MAINVERSION",`(${src[t.NUMERICIDENTIFIER]})\\.`+`(${src[t.NUMERICIDENTIFIER]})\\.`+`(${src[t.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.`+`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.`+`(${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASE",`(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER",`${LETTERDASHNUMBER}+`);createToken("BUILD",`(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);createToken("FULL",`^${src[t.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);createToken("LOOSE",`^${src[t.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${src[t.XRANGEIDENTIFIER]})`+`(?:\\.(${src[t.XRANGEIDENTIFIER]})`+`(?:\\.(${src[t.XRANGEIDENTIFIER]})`+`(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?`+`)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})`+`(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?`+`)?)?`);createToken("XRANGE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);createToken("COERCEPLAIN",`${"(^|[^\\d])"+"(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})`+`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`+`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);createToken("COERCE",`${src[t.COERCEPLAIN]}(?:$|[^\\d])`);createToken("COERCEFULL",src[t.COERCEPLAIN]+`(?:${src[t.PRERELEASE]})?`+`(?:${src[t.BUILD]})?`+`(?:$|[^\\d])`);createToken("COERCERTL",src[t.COERCE],true);createToken("COERCERTLFULL",src[t.COERCEFULL],true);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${src[t.LONETILDE]}\\s+`,true);exports.tildeTrimReplace="$1~";createToken("TILDE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${src[t.LONECARET]}\\s+`,true);exports.caretTrimReplace="$1^";createToken("CARET",`^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`,true);exports.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${src[t.XRANGEPLAIN]})`+`\\s+-\\s+`+`(${src[t.XRANGEPLAIN]})`+`\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${src[t.XRANGEPLAINLOOSE]})`+`\\s+-\\s+`+`(${src[t.XRANGEPLAINLOOSE]})`+`\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*");createToken("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");createToken("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var require_parse_options=__commonJS((exports,module)=>{var looseOption=Object.freeze({loose:true});var emptyOpts=Object.freeze({});var parseOptions=(options)=>{if(!options){return emptyOpts}if(typeof options!=="object"){return looseOption}return options};module.exports=parseOptions});var require_identifiers=__commonJS((exports,module)=>{var numeric=/^[0-9]+$/;var compareIdentifiers=(a,b3)=>{if(typeof a==="number"&&typeof b3==="number"){return a===b3?0:a<b3?-1:1}const anum=numeric.test(a);const bnum=numeric.test(b3);if(anum&&bnum){a=+a;b3=+b3}return a===b3?0:anum&&!bnum?-1:bnum&&!anum?1:a<b3?-1:1};var rcompareIdentifiers=(a,b3)=>compareIdentifiers(b3,a);module.exports={compareIdentifiers,rcompareIdentifiers}});var require_semver=__commonJS((exports,module)=>{var debug=require_debug();var{MAX_LENGTH,MAX_SAFE_INTEGER}=require_constants();var{safeRe:re,t}=require_re();var parseOptions=require_parse_options();var{compareIdentifiers}=require_identifiers();class SemVer{constructor(version2,options){options=parseOptions(options);if(version2 instanceof SemVer){if(version2.loose===!!options.loose&&version2.includePrerelease===!!options.includePrerelease){return version2}else{version2=version2.version}}else if(typeof version2!=="string"){throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`)}if(version2.length>MAX_LENGTH){throw new TypeError(`version is longer than ${MAX_LENGTH} characters`)}debug("SemVer",version2,options);this.options=options;this.loose=!!options.loose;this.includePrerelease=!!options.includePrerelease;const m2=version2.trim().match(options.loose?re[t.LOOSE]:re[t.FULL]);if(!m2){throw new TypeError(`Invalid Version: ${version2}`)}this.raw=version2;this.major=+m2[1];this.minor=+m2[2];this.patch=+m2[3];if(this.major>MAX_SAFE_INTEGER||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>MAX_SAFE_INTEGER||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>MAX_SAFE_INTEGER||this.patch<0){throw new TypeError("Invalid patch version")}if(!m2[4]){this.prerelease=[]}else{this.prerelease=m2[4].split(".").map((id)=>{if(/^[0-9]+$/.test(id)){const num=+id;if(num>=0&&num<MAX_SAFE_INTEGER){return num}}return id})}this.build=m2[5]?m2[5].split("."):[];this.format()}format(){this.version=`${this.major}.${this.minor}.${this.patch}`;if(this.prerelease.length){this.version+=`-${this.prerelease.join(".")}`}return this.version}toString(){return this.version}compare(other){debug("SemVer.compare",this.version,this.options,other);if(!(other instanceof SemVer)){if(typeof other==="string"&&other===this.version){return 0}other=new SemVer(other,this.options)}if(other.version===this.version){return 0}return this.compareMain(other)||this.comparePre(other)}compareMain(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}if(this.major<other.major){return-1}if(this.major>other.major){return 1}if(this.minor<other.minor){return-1}if(this.minor>other.minor){return 1}if(this.patch<other.patch){return-1}if(this.patch>other.patch){return 1}return 0}comparePre(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}if(this.prerelease.length&&!other.prerelease.length){return-1}else if(!this.prerelease.length&&other.prerelease.length){return 1}else if(!this.prerelease.length&&!other.prerelease.length){return 0}let i=0;do{const a=this.prerelease[i];const b3=other.prerelease[i];debug("prerelease compare",i,a,b3);if(a===undefined&&b3===undefined){return 0}else if(b3===undefined){return 1}else if(a===undefined){return-1}else if(a===b3){continue}else{return compareIdentifiers(a,b3)}}while(++i)}compareBuild(other){if(!(other instanceof SemVer)){other=new SemVer(other,this.options)}let i=0;do{const a=this.build[i];const b3=other.build[i];debug("build compare",i,a,b3);if(a===undefined&&b3===undefined){return 0}else if(b3===undefined){return 1}else if(a===undefined){return-1}else if(a===b3){continue}else{return compareIdentifiers(a,b3)}}while(++i)}inc(release,identifier,identifierBase){if(release.startsWith("pre")){if(!identifier&&identifierBase===false){throw new Error("invalid increment argument: identifier is empty")}if(identifier){const match=`-${identifier}`.match(this.options.loose?re[t.PRERELEASELOOSE]:re[t.PRERELEASE]);if(!match||match[1]!==identifier){throw new Error(`invalid identifier: ${identifier}`)}}}switch(release){case"premajor":this.prerelease.length=0;this.patch=0;this.minor=0;this.major++;this.inc("pre",identifier,identifierBase);break;case"preminor":this.prerelease.length=0;this.patch=0;this.minor++;this.inc("pre",identifier,identifierBase);break;case"prepatch":this.prerelease.length=0;this.inc("patch",identifier,identifierBase);this.inc("pre",identifier,identifierBase);break;case"prerelease":if(this.prerelease.length===0){this.inc("patch",identifier,identifierBase)}this.inc("pre",identifier,identifierBase);break;case"release":if(this.prerelease.length===0){throw new Error(`version ${this.raw} is not a prerelease`)}this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0){this.major++}this.minor=0;this.patch=0;this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0){this.minor++}this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0){this.patch++}this.prerelease=[];break;case"pre":{const base=Number(identifierBase)?1:0;if(this.prerelease.length===0){this.prerelease=[base]}else{let i=this.prerelease.length;while(--i>=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1){if(identifier===this.prerelease.join(".")&&identifierBase===false){throw new Error("invalid increment argument: identifier already exists")}this.prerelease.push(base)}}if(identifier){let prerelease2=[identifier,base];if(identifierBase===false){prerelease2=[identifier]}if(compareIdentifiers(this.prerelease[0],identifier)===0){if(isNaN(this.prerelease[1])){this.prerelease=prerelease2}}else{this.prerelease=prerelease2}}break}default:throw new Error(`invalid increment argument: ${release}`)}this.raw=this.format();if(this.build.length){this.raw+=`+${this.build.join(".")}`}return this}}module.exports=SemVer});var require_parse=__commonJS((exports,module)=>{var SemVer=require_semver();var parse4=(version2,options,throwErrors=false)=>{if(version2 instanceof SemVer){return version2}try{return new SemVer(version2,options)}catch(er){if(!throwErrors){return null}throw er}};module.exports=parse4});var require_valid=__commonJS((exports,module)=>{var parse4=require_parse();var valid=(version2,options)=>{const v=parse4(version2,options);return v?v.version:null};module.exports=valid});var require_clean=__commonJS((exports,module)=>{var parse4=require_parse();var clean=(version2,options)=>{const s=parse4(version2.trim().replace(/^[=v]+/,""),options);return s?s.version:null};module.exports=clean});var require_inc=__commonJS((exports,module)=>{var SemVer=require_semver();var inc=(version2,release,options,identifier,identifierBase)=>{if(typeof options==="string"){identifierBase=identifier;identifier=options;options=undefined}try{return new SemVer(version2 instanceof SemVer?version2.version:version2,options).inc(release,identifier,identifierBase).version}catch(er){return null}};module.exports=inc});var require_diff=__commonJS((exports,module)=>{var parse4=require_parse();var diff=(version1,version2)=>{const v1=parse4(version1,null,true);const v2=parse4(version2,null,true);const comparison=v1.compare(v2);if(comparison===0){return null}const v1Higher=comparison>0;const highVersion=v1Higher?v1:v2;const lowVersion=v1Higher?v2:v1;const highHasPre=!!highVersion.prerelease.length;const lowHasPre=!!lowVersion.prerelease.length;if(lowHasPre&&!highHasPre){if(!lowVersion.patch&&!lowVersion.minor){return"major"}if(lowVersion.compareMain(highVersion)===0){if(lowVersion.minor&&!lowVersion.patch){return"minor"}return"patch"}}const prefix=highHasPre?"pre":"";if(v1.major!==v2.major){return prefix+"major"}if(v1.minor!==v2.minor){return prefix+"minor"}if(v1.patch!==v2.patch){return prefix+"patch"}return"prerelease"};module.exports=diff});var require_major=__commonJS((exports,module)=>{var SemVer=require_semver();var major=(a,loose)=>new SemVer(a,loose).major;module.exports=major});var require_minor=__commonJS((exports,module)=>{var SemVer=require_semver();var minor2=(a,loose)=>new SemVer(a,loose).minor;module.exports=minor2});var require_patch=__commonJS((exports,module)=>{var SemVer=require_semver();var patch2=(a,loose)=>new SemVer(a,loose).patch;module.exports=patch2});var require_prerelease=__commonJS((exports,module)=>{var parse4=require_parse();var prerelease2=(version2,options)=>{const parsed=parse4(version2,options);return parsed&&parsed.prerelease.length?parsed.prerelease:null};module.exports=prerelease2});var require_compare=__commonJS((exports,module)=>{var SemVer=require_semver();var compare=(a,b3,loose)=>new SemVer(a,loose).compare(new SemVer(b3,loose));module.exports=compare});var require_rcompare=__commonJS((exports,module)=>{var compare=require_compare();var rcompare=(a,b3,loose)=>compare(b3,a,loose);module.exports=rcompare});var require_compare_loose=__commonJS((exports,module)=>{var compare=require_compare();var compareLoose=(a,b3)=>compare(a,b3,true);module.exports=compareLoose});var require_compare_build=__commonJS((exports,module)=>{var SemVer=require_semver();var compareBuild=(a,b3,loose)=>{const versionA=new SemVer(a,loose);const versionB=new SemVer(b3,loose);return versionA.compare(versionB)||versionA.compareBuild(versionB)};module.exports=compareBuild});var require_sort=__commonJS((exports,module)=>{var compareBuild=require_compare_build();var sort=(list,loose)=>list.sort((a,b3)=>compareBuild(a,b3,loose));module.exports=sort});var require_rsort=__commonJS((exports,module)=>{var compareBuild=require_compare_build();var rsort=(list,loose)=>list.sort((a,b3)=>compareBuild(b3,a,loose));module.exports=rsort});var require_gt=__commonJS((exports,module)=>{var compare=require_compare();var gt=(a,b3,loose)=>compare(a,b3,loose)>0;module.exports=gt});var require_lt=__commonJS((exports,module)=>{var compare=require_compare();var lt=(a,b3,loose)=>compare(a,b3,loose)<0;module.exports=lt});var require_eq=__commonJS((exports,module)=>{var compare=require_compare();var eq=(a,b3,loose)=>compare(a,b3,loose)===0;module.exports=eq});var require_neq=__commonJS((exports,module)=>{var compare=require_compare();var neq=(a,b3,loose)=>compare(a,b3,loose)!==0;module.exports=neq});var require_gte=__commonJS((exports,module)=>{var compare=require_compare();var gte=(a,b3,loose)=>compare(a,b3,loose)>=0;module.exports=gte});var require_lte=__commonJS((exports,module)=>{var compare=require_compare();var lte=(a,b3,loose)=>compare(a,b3,loose)<=0;module.exports=lte});var require_cmp=__commonJS((exports,module)=>{var eq=require_eq();var neq=require_neq();var gt=require_gt();var gte=require_gte();var lt=require_lt();var lte=require_lte();var cmp=(a,op,b3,loose)=>{switch(op){case"===":if(typeof a==="object"){a=a.version}if(typeof b3==="object"){b3=b3.version}return a===b3;case"!==":if(typeof a==="object"){a=a.version}if(typeof b3==="object"){b3=b3.version}return a!==b3;case"":case"=":case"==":return eq(a,b3,loose);case"!=":return neq(a,b3,loose);case">":return gt(a,b3,loose);case">=":return gte(a,b3,loose);case"<":return lt(a,b3,loose);case"<=":return lte(a,b3,loose);default:throw new TypeError(`Invalid operator: ${op}`)}};module.exports=cmp});var require_coerce=__commonJS((exports,module)=>{var SemVer=require_semver();var parse4=require_parse();var{safeRe:re,t}=require_re();var coerce=(version2,options)=>{if(version2 instanceof SemVer){return version2}if(typeof version2==="number"){version2=String(version2)}if(typeof version2!=="string"){return null}options=options||{};let match=null;if(!options.rtl){match=version2.match(options.includePrerelease?re[t.COERCEFULL]:re[t.COERCE])}else{const coerceRtlRegex=options.includePrerelease?re[t.COERCERTLFULL]:re[t.COERCERTL];let next;while((next=coerceRtlRegex.exec(version2))&&(!match||match.index+match[0].length!==version2.length)){if(!match||next.index+next[0].length!==match.index+match[0].length){match=next}coerceRtlRegex.lastIndex=next.index+next[1].length+next[2].length}coerceRtlRegex.lastIndex=-1}if(match===null){return null}const major=match[2];const minor2=match[3]||"0";const patch2=match[4]||"0";const prerelease2=options.includePrerelease&&match[5]?`-${match[5]}`:"";const build2=options.includePrerelease&&match[6]?`+${match[6]}`:"";return parse4(`${major}.${minor2}.${patch2}${prerelease2}${build2}`,options)};module.exports=coerce});var require_truncate=__commonJS((exports,module)=>{var parse4=require_parse();var constants=require_constants();var SemVer=require_semver();var truncate=(version2,truncation,options)=>{if(!constants.RELEASE_TYPES.includes(truncation)){return null}const clonedVersion=cloneInputVersion(version2,options);return clonedVersion&&doTruncation(clonedVersion,truncation)};var cloneInputVersion=(version2,options)=>{const versionStringToParse=version2 instanceof SemVer?version2.version:version2;return parse4(versionStringToParse,options)};var doTruncation=(version2,truncation)=>{if(isPrerelease(truncation)){return version2.version}version2.prerelease=[];switch(truncation){case"major":version2.minor=0;version2.patch=0;break;case"minor":version2.patch=0;break}return version2.format()};var isPrerelease=(type)=>{return type.startsWith("pre")};module.exports=truncate});var require_lrucache=__commonJS((exports,module)=>{class LRUCache{constructor(){this.max=1000;this.map=new Map}get(key){const value=this.map.get(key);if(value===undefined){return}else{this.map.delete(key);this.map.set(key,value);return value}}delete(key){return this.map.delete(key)}set(key,value){const deleted=this.delete(key);if(!deleted&&value!==undefined){if(this.map.size>=this.max){const firstKey=this.map.keys().next().value;this.delete(firstKey)}this.map.set(key,value)}return this}}module.exports=LRUCache});var require_range=__commonJS((exports,module)=>{var SPACE_CHARACTERS=/\s+/g;class Range{constructor(range,options){options=parseOptions(options);if(range instanceof Range){if(range.loose===!!options.loose&&range.includePrerelease===!!options.includePrerelease){return range}else{return new Range(range.raw,options)}}if(range instanceof Comparator){this.raw=range.value;this.set=[[range]];this.formatted=undefined;return this}this.options=options;this.loose=!!options.loose;this.includePrerelease=!!options.includePrerelease;this.raw=range.trim().replace(SPACE_CHARACTERS," ");this.set=this.raw.split("||").map((r2)=>this.parseRange(r2.trim())).filter((c)=>c.length);if(!this.set.length){throw new TypeError(`Invalid SemVer Range: ${this.raw}`)}if(this.set.length>1){const first=this.set[0];this.set=this.set.filter((c)=>!isNullSet(c[0]));if(this.set.length===0){this.set=[first]}else if(this.set.length>1){for(const c of this.set){if(c.length===1&&isAny(c[0])){this.set=[c];break}}}}this.formatted=undefined}get range(){if(this.formatted===undefined){this.formatted="";for(let i=0;i<this.set.length;i++){if(i>0){this.formatted+="||"}const comps=this.set[i];for(let k3=0;k3<comps.length;k3++){if(k3>0){this.formatted+=" "}this.formatted+=comps[k3].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(range){const memoOpts=(this.options.includePrerelease&&FLAG_INCLUDE_PRERELEASE)|(this.options.loose&&FLAG_LOOSE);const memoKey=memoOpts+":"+range;const cached2=cache.get(memoKey);if(cached2){return cached2}const loose=this.options.loose;const hr=loose?re[t.HYPHENRANGELOOSE]:re[t.HYPHENRANGE];range=range.replace(hr,hyphenReplace(this.options.includePrerelease));debug("hyphen replace",range);range=range.replace(re[t.COMPARATORTRIM],comparatorTrimReplace);debug("comparator trim",range);range=range.replace(re[t.TILDETRIM],tildeTrimReplace);debug("tilde trim",range);range=range.replace(re[t.CARETTRIM],caretTrimReplace);debug("caret trim",range);let rangeList=range.split(" ").map((comp)=>parseComparator(comp,this.options)).join(" ").split(/\s+/).map((comp)=>replaceGTE0(comp,this.options));if(loose){rangeList=rangeList.filter((comp)=>{debug("loose invalid filter",comp,this.options);return!!comp.match(re[t.COMPARATORLOOSE])})}debug("range list",rangeList);const rangeMap=new Map;const comparators=rangeList.map((comp)=>new Comparator(comp,this.options));for(const comp of comparators){if(isNullSet(comp)){return[comp]}rangeMap.set(comp.value,comp)}if(rangeMap.size>1&&rangeMap.has("")){rangeMap.delete("")}const result=[...rangeMap.values()];cache.set(memoKey,result);return result}intersects(range,options){if(!(range instanceof Range)){throw new TypeError("a Range is required")}return this.set.some((thisComparators)=>{return isSatisfiable(thisComparators,options)&&range.set.some((rangeComparators)=>{return isSatisfiable(rangeComparators,options)&&thisComparators.every((thisComparator)=>{return rangeComparators.every((rangeComparator)=>{return thisComparator.intersects(rangeComparator,options)})})})})}test(version2){if(!version2){return false}if(typeof version2==="string"){try{version2=new SemVer(version2,this.options)}catch(er){return false}}for(let i=0;i<this.set.length;i++){if(testSet(this.set[i],version2,this.options)){return true}}return false}}module.exports=Range;var LRU=require_lrucache();var cache=new LRU;var parseOptions=require_parse_options();var Comparator=require_comparator();var debug=require_debug();var SemVer=require_semver();var{safeRe:re,t,comparatorTrimReplace,tildeTrimReplace,caretTrimReplace}=require_re();var{FLAG_INCLUDE_PRERELEASE,FLAG_LOOSE}=require_constants();var isNullSet=(c)=>c.value==="<0.0.0-0";var isAny=(c)=>c.value==="";var isSatisfiable=(comparators,options)=>{let result=true;const remainingComparators=comparators.slice();let testComparator=remainingComparators.pop();while(result&&remainingComparators.length){result=remainingComparators.every((otherComparator)=>{return testComparator.intersects(otherComparator,options)});testComparator=remainingComparators.pop()}return result};var parseComparator=(comp,options)=>{comp=comp.replace(re[t.BUILD],"");debug("comp",comp,options);comp=replaceCarets(comp,options);debug("caret",comp);comp=replaceTildes(comp,options);debug("tildes",comp);comp=replaceXRanges(comp,options);debug("xrange",comp);comp=replaceStars(comp,options);debug("stars",comp);return comp};var isX=(id)=>!id||id.toLowerCase()==="x"||id==="*";var replaceTildes=(comp,options)=>{return comp.trim().split(/\s+/).map((c)=>replaceTilde(c,options)).join(" ")};var replaceTilde=(comp,options)=>{const r2=options.loose?re[t.TILDELOOSE]:re[t.TILDE];return comp.replace(r2,(_3,M2,m2,p2,pr)=>{debug("tilde",comp,_3,M2,m2,p2,pr);let ret;if(isX(M2)){ret=""}else if(isX(m2)){ret=`>=${M2}.0.0 <${+M2+1}.0.0-0`}else if(isX(p2)){ret=`>=${M2}.${m2}.0 <${M2}.${+m2+1}.0-0`}else if(pr){debug("replaceTilde pr",pr);ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2+1}.0-0`}else{ret=`>=${M2}.${m2}.${p2} <${M2}.${+m2+1}.0-0`}debug("tilde return",ret);return ret})};var replaceCarets=(comp,options)=>{return comp.trim().split(/\s+/).map((c)=>replaceCaret(c,options)).join(" ")};var replaceCaret=(comp,options)=>{debug("caret",comp,options);const r2=options.loose?re[t.CARETLOOSE]:re[t.CARET];const z2=options.includePrerelease?"-0":"";return comp.replace(r2,(_3,M2,m2,p2,pr)=>{debug("caret",comp,_3,M2,m2,p2,pr);let ret;if(isX(M2)){ret=""}else if(isX(m2)){ret=`>=${M2}.0.0${z2} <${+M2+1}.0.0-0`}else if(isX(p2)){if(M2==="0"){ret=`>=${M2}.${m2}.0${z2} <${M2}.${+m2+1}.0-0`}else{ret=`>=${M2}.${m2}.0${z2} <${+M2+1}.0.0-0`}}else if(pr){debug("replaceCaret pr",pr);if(M2==="0"){if(m2==="0"){ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${m2}.${+p2+1}-0`}else{ret=`>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2+1}.0-0`}}else{ret=`>=${M2}.${m2}.${p2}-${pr} <${+M2+1}.0.0-0`}}else{debug("no pr");if(M2==="0"){if(m2==="0"){ret=`>=${M2}.${m2}.${p2}${z2} <${M2}.${m2}.${+p2+1}-0`}else{ret=`>=${M2}.${m2}.${p2}${z2} <${M2}.${+m2+1}.0-0`}}else{ret=`>=${M2}.${m2}.${p2} <${+M2+1}.0.0-0`}}debug("caret return",ret);return ret})};var replaceXRanges=(comp,options)=>{debug("replaceXRanges",comp,options);return comp.split(/\s+/).map((c)=>replaceXRange(c,options)).join(" ")};var replaceXRange=(comp,options)=>{comp=comp.trim();const r2=options.loose?re[t.XRANGELOOSE]:re[t.XRANGE];return comp.replace(r2,(ret,gtlt,M2,m2,p2,pr)=>{debug("xRange",comp,ret,gtlt,M2,m2,p2,pr);const xM=isX(M2);const xm=xM||isX(m2);const xp=xm||isX(p2);const anyX=xp;if(gtlt==="="&&anyX){gtlt=""}pr=options.includePrerelease?"-0":"";if(xM){if(gtlt===">"||gtlt==="<"){ret="<0.0.0-0"}else{ret="*"}}else if(gtlt&&anyX){if(xm){m2=0}p2=0;if(gtlt===">"){gtlt=">=";if(xm){M2=+M2+1;m2=0;p2=0}else{m2=+m2+1;p2=0}}else if(gtlt==="<="){gtlt="<";if(xm){M2=+M2+1}else{m2=+m2+1}}if(gtlt==="<"){pr="-0"}ret=`${gtlt+M2}.${m2}.${p2}${pr}`}else if(xm){ret=`>=${M2}.0.0${pr} <${+M2+1}.0.0-0`}else if(xp){ret=`>=${M2}.${m2}.0${pr} <${M2}.${+m2+1}.0-0`}debug("xRange return",ret);return ret})};var replaceStars=(comp,options)=>{debug("replaceStars",comp,options);return comp.trim().replace(re[t.STAR],"")};var replaceGTE0=(comp,options)=>{debug("replaceGTE0",comp,options);return comp.trim().replace(re[options.includePrerelease?t.GTE0PRE:t.GTE0],"")};var hyphenReplace=(incPr)=>($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr)=>{if(isX(fM)){from=""}else if(isX(fm)){from=`>=${fM}.0.0${incPr?"-0":""}`}else if(isX(fp)){from=`>=${fM}.${fm}.0${incPr?"-0":""}`}else if(fpr){from=`>=${from}`}else{from=`>=${from}${incPr?"-0":""}`}if(isX(tM)){to=""}else if(isX(tm)){to=`<${+tM+1}.0.0-0`}else if(isX(tp)){to=`<${tM}.${+tm+1}.0-0`}else if(tpr){to=`<=${tM}.${tm}.${tp}-${tpr}`}else if(incPr){to=`<${tM}.${tm}.${+tp+1}-0`}else{to=`<=${to}`}return`${from} ${to}`.trim()};var testSet=(set,version2,options)=>{for(let i=0;i<set.length;i++){if(!set[i].test(version2)){return false}}if(version2.prerelease.length&&!options.includePrerelease){for(let i=0;i<set.length;i++){debug(set[i].semver);if(set[i].semver===Comparator.ANY){continue}if(set[i].semver.prerelease.length>0){const allowed=set[i].semver;if(allowed.major===version2.major&&allowed.minor===version2.minor&&allowed.patch===version2.patch){return true}}}return false}return true}});var require_comparator=__commonJS((exports,module)=>{var ANY=Symbol("SemVer ANY");class Comparator{static get ANY(){return ANY}constructor(comp,options){options=parseOptions(options);if(comp instanceof Comparator){if(comp.loose===!!options.loose){return comp}else{comp=comp.value}}comp=comp.trim().split(/\s+/).join(" ");debug("comparator",comp,options);this.options=options;this.loose=!!options.loose;this.parse(comp);if(this.semver===ANY){this.value=""}else{this.value=this.operator+this.semver.version}debug("comp",this)}parse(comp){const r2=this.options.loose?re[t.COMPARATORLOOSE]:re[t.COMPARATOR];const m2=comp.match(r2);if(!m2){throw new TypeError(`Invalid comparator: ${comp}`)}this.operator=m2[1]!==undefined?m2[1]:"";if(this.operator==="="){this.operator=""}if(!m2[2]){this.semver=ANY}else{this.semver=new SemVer(m2[2],this.options.loose)}}toString(){return this.value}test(version2){debug("Comparator.test",version2,this.options.loose);if(this.semver===ANY||version2===ANY){return true}if(typeof version2==="string"){try{version2=new SemVer(version2,this.options)}catch(er){return false}}return cmp(version2,this.operator,this.semver,this.options)}intersects(comp,options){if(!(comp instanceof Comparator)){throw new TypeError("a Comparator is required")}if(this.operator===""){if(this.value===""){return true}return new Range(comp.value,options).test(this.value)}else if(comp.operator===""){if(comp.value===""){return true}return new Range(this.value,options).test(comp.semver)}options=parseOptions(options);if(options.includePrerelease&&(this.value==="<0.0.0-0"||comp.value==="<0.0.0-0")){return false}if(!options.includePrerelease&&(this.value.startsWith("<0.0.0")||comp.value.startsWith("<0.0.0"))){return false}if(this.operator.startsWith(">")&&comp.operator.startsWith(">")){return true}if(this.operator.startsWith("<")&&comp.operator.startsWith("<")){return true}if(this.semver.version===comp.semver.version&&this.operator.includes("=")&&comp.operator.includes("=")){return true}if(cmp(this.semver,"<",comp.semver,options)&&this.operator.startsWith(">")&&comp.operator.startsWith("<")){return true}if(cmp(this.semver,">",comp.semver,options)&&this.operator.startsWith("<")&&comp.operator.startsWith(">")){return true}return false}}module.exports=Comparator;var parseOptions=require_parse_options();var{safeRe:re,t}=require_re();var cmp=require_cmp();var debug=require_debug();var SemVer=require_semver();var Range=require_range()});var require_satisfies=__commonJS((exports,module)=>{var Range=require_range();var satisfies=(version2,range,options)=>{try{range=new Range(range,options)}catch(er){return false}return range.test(version2)};module.exports=satisfies});var require_to_comparators=__commonJS((exports,module)=>{var Range=require_range();var toComparators=(range,options)=>new Range(range,options).set.map((comp)=>comp.map((c)=>c.value).join(" ").trim().split(" "));module.exports=toComparators});var require_max_satisfying=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var maxSatisfying=(versions2,range,options)=>{let max=null;let maxSV=null;let rangeObj=null;try{rangeObj=new Range(range,options)}catch(er){return null}versions2.forEach((v)=>{if(rangeObj.test(v)){if(!max||maxSV.compare(v)===-1){max=v;maxSV=new SemVer(max,options)}}});return max};module.exports=maxSatisfying});var require_min_satisfying=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var minSatisfying=(versions2,range,options)=>{let min=null;let minSV=null;let rangeObj=null;try{rangeObj=new Range(range,options)}catch(er){return null}versions2.forEach((v)=>{if(rangeObj.test(v)){if(!min||minSV.compare(v)===1){min=v;minSV=new SemVer(min,options)}}});return min};module.exports=minSatisfying});var require_min_version=__commonJS((exports,module)=>{var SemVer=require_semver();var Range=require_range();var gt=require_gt();var minVersion=(range,loose)=>{range=new Range(range,loose);let minver=new SemVer("0.0.0");if(range.test(minver)){return minver}minver=new SemVer("0.0.0-0");if(range.test(minver)){return minver}minver=null;for(let i=0;i<range.set.length;++i){const comparators=range.set[i];let setMin=null;comparators.forEach((comparator2)=>{const compver=new SemVer(comparator2.semver.version);switch(comparator2.operator){case">":if(compver.prerelease.length===0){compver.patch++}else{compver.prerelease.push(0)}compver.raw=compver.format();case"":case">=":if(!setMin||gt(compver,setMin)){setMin=compver}break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${comparator2.operator}`)}});if(setMin&&(!minver||gt(minver,setMin))){minver=setMin}}if(minver&&range.test(minver)){return minver}return null};module.exports=minVersion});var require_valid2=__commonJS((exports,module)=>{var Range=require_range();var validRange=(range,options)=>{try{return new Range(range,options).range||"*"}catch(er){return null}};module.exports=validRange});var require_outside=__commonJS((exports,module)=>{var SemVer=require_semver();var Comparator=require_comparator();var{ANY}=Comparator;var Range=require_range();var satisfies=require_satisfies();var gt=require_gt();var lt=require_lt();var lte=require_lte();var gte=require_gte();var outside=(version2,range,hilo,options)=>{version2=new SemVer(version2,options);range=new Range(range,options);let gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version2,range,options)){return false}for(let i=0;i<range.set.length;++i){const comparators=range.set[i];let high=null;let low=null;comparators.forEach((comparator2)=>{if(comparator2.semver===ANY){comparator2=new Comparator(">=0.0.0")}high=high||comparator2;low=low||comparator2;if(gtfn(comparator2.semver,high.semver,options)){high=comparator2}else if(ltfn(comparator2.semver,low.semver,options)){low=comparator2}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&<efn(version2,low.semver)){return false}else if(low.operator===ecomp&<fn(version2,low.semver)){return false}}return true};module.exports=outside});var require_gtr=__commonJS((exports,module)=>{var outside=require_outside();var gtr=(version2,range,options)=>outside(version2,range,">",options);module.exports=gtr});var require_ltr=__commonJS((exports,module)=>{var outside=require_outside();var ltr=(version2,range,options)=>outside(version2,range,"<",options);module.exports=ltr});var require_intersects=__commonJS((exports,module)=>{var Range=require_range();var intersects2=(r1,r2,options)=>{r1=new Range(r1,options);r2=new Range(r2,options);return r1.intersects(r2,options)};module.exports=intersects2});var require_simplify=__commonJS((exports,module)=>{var satisfies=require_satisfies();var compare=require_compare();module.exports=(versions2,range,options)=>{const set=[];let first=null;let prev=null;const v=versions2.sort((a,b3)=>compare(a,b3,options));for(const version2 of v){const included=satisfies(version2,range,options);if(included){prev=version2;if(!first){first=version2}}else{if(prev){set.push([first,prev])}prev=null;first=null}}if(first){set.push([first,null])}const ranges=[];for(const[min,max]of set){if(min===max){ranges.push(min)}else if(!max&&min===v[0]){ranges.push("*")}else if(!max){ranges.push(`>=${min}`)}else if(min===v[0]){ranges.push(`<=${max}`)}else{ranges.push(`${min} - ${max}`)}}const simplified=ranges.join(" || ");const original=typeof range.raw==="string"?range.raw:String(range);return simplified.length<original.length?simplified:range}});var require_subset=__commonJS((exports,module)=>{var Range=require_range();var Comparator=require_comparator();var{ANY}=Comparator;var satisfies=require_satisfies();var compare=require_compare();var subset=(sub,dom,options={})=>{if(sub===dom){return true}sub=new Range(sub,options);dom=new Range(dom,options);let sawNonNull=false;OUTER:for(const simpleSub of sub.set){for(const simpleDom of dom.set){const isSub=simpleSubset(simpleSub,simpleDom,options);sawNonNull=sawNonNull||isSub!==null;if(isSub){continue OUTER}}if(sawNonNull){return false}}return true};var minimumVersionWithPreRelease=[new Comparator(">=0.0.0-0")];var minimumVersion=[new Comparator(">=0.0.0")];var simpleSubset=(sub,dom,options)=>{if(sub===dom){return true}if(sub.length===1&&sub[0].semver===ANY){if(dom.length===1&&dom[0].semver===ANY){return true}else if(options.includePrerelease){sub=minimumVersionWithPreRelease}else{sub=minimumVersion}}if(dom.length===1&&dom[0].semver===ANY){if(options.includePrerelease){return true}else{dom=minimumVersion}}const eqSet=new Set;let gt,lt;for(const c of sub){if(c.operator===">"||c.operator===">="){gt=higherGT(gt,c,options)}else if(c.operator==="<"||c.operator==="<="){lt=lowerLT(lt,c,options)}else{eqSet.add(c.semver)}}if(eqSet.size>1){return null}let gtltComp;if(gt&<){gtltComp=compare(gt.semver,lt.semver,options);if(gtltComp>0){return null}else if(gtltComp===0&&(gt.operator!==">="||lt.operator!=="<=")){return null}}for(const eq of eqSet){if(gt&&!satisfies(eq,String(gt),options)){return null}if(lt&&!satisfies(eq,String(lt),options)){return null}for(const c of dom){if(!satisfies(eq,String(c),options)){return false}}return true}let higher,lower;let hasDomLT,hasDomGT;let needDomLTPre=lt&&!options.includePrerelease&<.semver.prerelease.length?lt.semver:false;let needDomGTPre=gt&&!options.includePrerelease&>.semver.prerelease.length?gt.semver:false;if(needDomLTPre&&needDomLTPre.prerelease.length===1&<.operator==="<"&&needDomLTPre.prerelease[0]===0){needDomLTPre=false}for(const c of dom){hasDomGT=hasDomGT||c.operator===">"||c.operator===">=";hasDomLT=hasDomLT||c.operator==="<"||c.operator==="<=";if(gt){if(needDomGTPre){if(c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomGTPre.major&&c.semver.minor===needDomGTPre.minor&&c.semver.patch===needDomGTPre.patch){needDomGTPre=false}}if(c.operator===">"||c.operator===">="){higher=higherGT(gt,c,options);if(higher===c&&higher!==gt){return false}}else if(gt.operator===">="&&!satisfies(gt.semver,String(c),options)){return false}}if(lt){if(needDomLTPre){if(c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomLTPre.major&&c.semver.minor===needDomLTPre.minor&&c.semver.patch===needDomLTPre.patch){needDomLTPre=false}}if(c.operator==="<"||c.operator==="<="){lower=lowerLT(lt,c,options);if(lower===c&&lower!==lt){return false}}else if(lt.operator==="<="&&!satisfies(lt.semver,String(c),options)){return false}}if(!c.operator&&(lt||gt)&>ltComp!==0){return false}}if(gt&&hasDomLT&&!lt&>ltComp!==0){return false}if(lt&&hasDomGT&&!gt&>ltComp!==0){return false}if(needDomGTPre||needDomLTPre){return false}return true};var higherGT=(a,b3,options)=>{if(!a){return b3}const comp=compare(a.semver,b3.semver,options);return comp>0?a:comp<0?b3:b3.operator===">"&&a.operator===">="?b3:a};var lowerLT=(a,b3,options)=>{if(!a){return b3}const comp=compare(a.semver,b3.semver,options);return comp<0?a:comp>0?b3:b3.operator==="<"&&a.operator==="<="?b3:a};module.exports=subset});var require_semver2=__commonJS((exports,module)=>{var internalRe=require_re();var constants=require_constants();var SemVer=require_semver();var identifiers=require_identifiers();var parse4=require_parse();var valid=require_valid();var clean=require_clean();var inc=require_inc();var diff=require_diff();var major=require_major();var minor2=require_minor();var patch2=require_patch();var prerelease2=require_prerelease();var compare=require_compare();var rcompare=require_rcompare();var compareLoose=require_compare_loose();var compareBuild=require_compare_build();var sort=require_sort();var rsort=require_rsort();var gt=require_gt();var lt=require_lt();var eq=require_eq();var neq=require_neq();var gte=require_gte();var lte=require_lte();var cmp=require_cmp();var coerce=require_coerce();var truncate=require_truncate();var Comparator=require_comparator();var Range=require_range();var satisfies=require_satisfies();var toComparators=require_to_comparators();var maxSatisfying=require_max_satisfying();var minSatisfying=require_min_satisfying();var minVersion=require_min_version();var validRange=require_valid2();var outside=require_outside();var gtr=require_gtr();var ltr=require_ltr();var intersects2=require_intersects();var simplifyRange=require_simplify();var subset=require_subset();module.exports={parse:parse4,valid,clean,inc,diff,major,minor:minor2,patch:patch2,prerelease:prerelease2,compare,rcompare,compareLoose,compareBuild,sort,rsort,gt,lt,eq,neq,gte,lte,cmp,coerce,truncate,Comparator,Range,satisfies,toComparators,maxSatisfying,minSatisfying,minVersion,validRange,outside,gtr,ltr,intersects:intersects2,simplifyRange,subset,SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers}});var import__=__toESM(require_commander(),1);var{program,createCommand,createArgument,createOption,CommanderError,InvalidArgumentError,InvalidOptionArgumentError,Command,Argument,Option,Help}=import__.default;import{stripVTControlCharacters as S2}from"node:util";var import_sisteransi=__toESM(require_src(),1);import{stdin as j,stdout as M}from"node:process";import O from"node:readline";import{Writable as X}from"node:stream";function DD({onlyFirst:e=false}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?undefined:"g")}var uD=DD();function P(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(uD,"")}function L(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}};(function(e){var u={};e.exports=u,u.eastAsianWidth=function(F){var s=F.charCodeAt(0),i=F.length==2?F.charCodeAt(1):0,D=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,D=s<<10|i,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},u.characterLength=function(F){var s=this.eastAsianWidth(F);return s=="F"||s=="W"||s=="A"?2:1};function t(F){return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(F){for(var s=t(F),i=0,D=0;D<s.length;D++)i=i+this.characterLength(s[D]);return i},u.slice=function(F,s,i){textLen=u.length(F),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var D="",C=0,n=t(F),E=0;E<n.length;E++){var a=n[E],o=u.length(a);if(C>=s-(o==2?1:0))if(C+o<=i)D+=a;else break;C+=o}return D}})(W);var tD=W.exports;var eD=L(tD);var FD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};var sD=L(FD);function p(e,u={}){if(typeof e!="string"||e.length===0||(u={ambiguousIsNarrow:true,...u},e=P(e),e.length===0))return 0;e=e.replace(sD()," ");const t=u.ambiguousIsNarrow?1:2;let F=0;for(const s of e){const i=s.codePointAt(0);if(i<=31||i>=127&&i<=159||i>=768&&i<=879)continue;switch(eD.eastAsianWidth(s)){case"F":case"W":F+=2;break;case"A":F+=t;break;default:F+=1}}return F}var w=10;var N=(e=0)=>(u)=>`\x1B[${u+e}m`;var I=(e=0)=>(u)=>`\x1B[${38+e};5;${u}m`;var R=(e=0)=>(u,t,F)=>`\x1B[${38+e};2;${u};${t};${F}m`;var r={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(r.modifier);var iD=Object.keys(r.color);var CD=Object.keys(r.bgColor);[...iD,...CD];function rD(){const e=new Map;for(const[u,t]of Object.entries(r)){for(const[F,s]of Object.entries(t))r[F]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[F]=r[F],e.set(s[0],s[1]);Object.defineProperty(r,u,{value:t,enumerable:false})}return Object.defineProperty(r,"codes",{value:e,enumerable:false}),r.color.close="\x1B[39m",r.bgColor.close="\x1B[49m",r.color.ansi=N(),r.color.ansi256=I(),r.color.ansi16m=R(),r.bgColor.ansi=N(w),r.bgColor.ansi256=I(w),r.bgColor.ansi16m=R(w),Object.defineProperties(r,{rgbToAnsi256:{value:(u,t,F)=>u===t&&t===F?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(t/255*5)+Math.round(F/255*5),enumerable:false},hexToRgb:{value:(u)=>{const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!t)return[0,0,0];let[F]=t;F.length===3&&(F=[...F].map((i)=>i+i).join(""));const s=Number.parseInt(F,16);return[s>>16&255,s>>8&255,s&255]},enumerable:false},hexToAnsi256:{value:(u)=>r.rgbToAnsi256(...r.hexToRgb(u)),enumerable:false},ansi256ToAnsi:{value:(u)=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let t,F,s;if(u>=232)t=((u-232)*10+8)/255,F=t,s=t;else{u-=16;const C=u%36;t=Math.floor(u/36)/5,F=Math.floor(C/6)/5,s=C%6/5}const i=Math.max(t,F,s)*2;if(i===0)return 30;let D=30+(Math.round(s)<<2|Math.round(F)<<1|Math.round(t));return i===2&&(D+=60),D},enumerable:false},rgbToAnsi:{value:(u,t,F)=>r.ansi256ToAnsi(r.rgbToAnsi256(u,t,F)),enumerable:false},hexToAnsi:{value:(u)=>r.ansi256ToAnsi(r.hexToAnsi256(u)),enumerable:false}}),r}var ED=rD();var d=new Set(["\x1B",""]);var oD=39;var y="\x07";var V="[";var nD="]";var G="m";var _=`${nD}8;;`;var z=(e)=>`${d.values().next().value}${V}${e}${G}`;var K=(e)=>`${d.values().next().value}${_}${e}${y}`;var aD=(e)=>e.split(" ").map((u)=>p(u));var k=(e,u,t)=>{const F=[...u];let s=false,i=false,D=p(P(e[e.length-1]));for(const[C,n]of F.entries()){const E=p(n);if(D+E<=t?e[e.length-1]+=n:(e.push(n),D=0),d.has(n)&&(s=true,i=F.slice(C+1).join("").startsWith(_)),s){i?n===y&&(s=false,i=false):n===G&&(s=false);continue}D+=E,D===t&&C<F.length-1&&(e.push(""),D=0)}!D&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())};var hD=(e)=>{const u=e.split(" ");let t=u.length;for(;t>0&&!(p(u[t-1])>0);)t--;return t===u.length?e:u.slice(0,t).join(" ")+u.slice(t).join("")};var lD=(e,u,t={})=>{if(t.trim!==false&&e.trim()==="")return"";let F="",s,i;const D=aD(e);let C=[""];for(const[E,a]of e.split(" ").entries()){t.trim!==false&&(C[C.length-1]=C[C.length-1].trimStart());let o=p(C[C.length-1]);if(E!==0&&(o>=u&&(t.wordWrap===false||t.trim===false)&&(C.push(""),o=0),(o>0||t.trim===false)&&(C[C.length-1]+=" ",o++)),t.hard&&D[E]>u){const c=u-o,f=1+Math.floor((D[E]-c-1)/u);Math.floor((D[E]-1)/u)<f&&C.push(""),k(C,a,u);continue}if(o+D[E]>u&&o>0&&D[E]>0){if(t.wordWrap===false&&o<u){k(C,a,u);continue}C.push("")}if(o+D[E]>u&&t.wordWrap===false){k(C,a,u);continue}C[C.length-1]+=a}t.trim!==false&&(C=C.map((E)=>hD(E)));const n=[...C.join(`
|
|
28
28
|
`)];for(const[E,a]of n.entries()){if(F+=a,d.has(a)){const{groups:c}=new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join(""))||{groups:{}};if(c.code!==undefined){const f=Number.parseFloat(c.code);s=f===oD?undefined:f}else c.uri!==undefined&&(i=c.uri.length===0?undefined:c.uri)}const o=ED.codes.get(Number(s));n[E+1]===`
|
|
29
29
|
`?(i&&(F+=K("")),s&&o&&(F+=z(o))):a===`
|
|
30
30
|
`&&(s&&o&&(F+=z(s)),i&&(F+=K(i)))}return F};function Y(e,u,t){return String(e).normalize().replace(/\r\n/g,`
|
|
@@ -37,19 +37,39 @@ Expecting one of '${allowedValues.join("', '")}'`)}const helpEvent=`${position}H
|
|
|
37
37
|
`).length-1;this.output.write(import_sisteransi.cursor.move(-999,u*-1))}render(){const u=Y(this._render(this)??"",process.stdout.columns,{hard:true});if(u!==this._prevFrame){if(this.state==="initial")this.output.write(import_sisteransi.cursor.hide);else{const t=BD(this._prevFrame,u);if(this.restoreCursor(),t&&t?.length===1){const F=t[0];this.output.write(import_sisteransi.cursor.move(0,F)),this.output.write(import_sisteransi.erase.lines(1));const s=u.split(`
|
|
38
38
|
`);this.output.write(s[F]),this._prevFrame=u,this.output.write(import_sisteransi.cursor.move(0,s.length-F-1));return}if(t&&t?.length>1){const F=t[0];this.output.write(import_sisteransi.cursor.move(0,F)),this.output.write(import_sisteransi.erase.down());const s=u.split(`
|
|
39
39
|
`).slice(F);this.output.write(s.join(`
|
|
40
|
-
`)),this._prevFrame=u;return}this.output.write(import_sisteransi.erase.down())}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u}}}var A;A=new WeakMap;var OD=Object.defineProperty;var PD=(e,u,t)=>(u in e)?OD(e,u,{enumerable:true,configurable:true,writable:true,value:t}):e[u]=t;var J=(e,u,t)=>(PD(e,typeof u!="symbol"?u+"":u,t),t);class LD extends x{constructor(u){super(u,false),J(this,"options"),J(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:t})=>t===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var import_picocolors=__toESM(require_picocolors(),1);var import_sisteransi2=__toESM(require_src(),1);import y2 from"node:process";function ce(){return y2.platform!=="win32"?y2.env.TERM!=="linux":!!y2.env.CI||!!y2.env.WT_SESSION||!!y2.env.TERMINUS_SUBLIME||y2.env.ConEmuTask==="{cmd::Cmder}"||y2.env.TERM_PROGRAM==="Terminus-Sublime"||y2.env.TERM_PROGRAM==="vscode"||y2.env.TERM==="xterm-256color"||y2.env.TERM==="alacritty"||y2.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var V2=ce();var u=(t,n)=>V2?t:n;var le=u("◆","*");var L2=u("■","x");var W2=u("▲","x");var C=u("◇","o");var ue=u("┌","T");var o=u("│","|");var d2=u("└","—");var k2=u("●",">");var P2=u("○"," ");var A2=u("◻","[•]");var T=u("◼","[+]");var F=u("◻","[ ]");var $e=u("▪","•");var _2=u("─","-");var me=u("╮","+");var de=u("├","+");var pe=u("╯","+");var q=u("●","•");var D=u("◆","*");var U=u("▲","!");var K2=u("■","x");var b2=(t)=>{switch(t){case"initial":case"active":return import_picocolors.default.cyan(le);case"cancel":return import_picocolors.default.red(L2);case"error":return import_picocolors.default.yellow(W2);case"submit":return import_picocolors.default.green(C)}};var G2=(t)=>{const{cursor:n,options:r2,style:i}=t,s=t.maxItems??Number.POSITIVE_INFINITY,c=Math.max(process.stdout.rows-4,0),a=Math.min(c,Math.max(s,5));let l2=0;n>=l2+a-3?l2=Math.max(Math.min(n-a+3,r2.length-a),0):n<l2+2&&(l2=Math.max(n-2,0));const $2=a<r2.length&&l2>0,g=a<r2.length&&l2+a<r2.length;return r2.slice(l2,l2+a).map((p2,v,f)=>{const j2=v===0&&$2,E=v===f.length-1&&g;return j2||E?import_picocolors.default.dim("..."):i(p2,v+l2===n)})};var ve=(t)=>{const n=(r2,i)=>{const s=r2.label??String(r2.value);switch(i){case"selected":return`${import_picocolors.default.dim(s)}`;case"active":return`${import_picocolors.default.green(k2)} ${s} ${r2.hint?import_picocolors.default.dim(`(${r2.hint})`):""}`;case"cancelled":return`${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;default:return`${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`}};return new LD({options:t.options,initialValue:t.initialValue,render(){const r2=`${import_picocolors.default.gray(o)}
|
|
40
|
+
`)),this._prevFrame=u;return}this.output.write(import_sisteransi.erase.down())}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u}}}var A;A=new WeakMap;var kD=Object.defineProperty;var $D=(e,u,t)=>(u in e)?kD(e,u,{enumerable:true,configurable:true,writable:true,value:t}):e[u]=t;var H=(e,u,t)=>($D(e,typeof u!="symbol"?u+"":u,t),t);var SD=class extends x{constructor(u){super(u,false),H(this,"options"),H(this,"cursor",0),this.options=u.options,this.value=[...u.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===u.cursorAt),0),this.on("key",(t)=>{t==="a"&&this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){const u=this.value.length===this.options.length;this.value=u?[]:this.options.map((t)=>t.value)}toggleValue(){const u=this.value.includes(this._value);this.value=u?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}};var OD=Object.defineProperty;var PD=(e,u,t)=>(u in e)?OD(e,u,{enumerable:true,configurable:true,writable:true,value:t}):e[u]=t;var J=(e,u,t)=>(PD(e,typeof u!="symbol"?u+"":u,t),t);class LD extends x{constructor(u){super(u,false),J(this,"options"),J(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:t})=>t===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var import_picocolors=__toESM(require_picocolors(),1);var import_sisteransi2=__toESM(require_src(),1);import y2 from"node:process";function ce(){return y2.platform!=="win32"?y2.env.TERM!=="linux":!!y2.env.CI||!!y2.env.WT_SESSION||!!y2.env.TERMINUS_SUBLIME||y2.env.ConEmuTask==="{cmd::Cmder}"||y2.env.TERM_PROGRAM==="Terminus-Sublime"||y2.env.TERM_PROGRAM==="vscode"||y2.env.TERM==="xterm-256color"||y2.env.TERM==="alacritty"||y2.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var V2=ce();var u=(t,n)=>V2?t:n;var le=u("◆","*");var L2=u("■","x");var W2=u("▲","x");var C=u("◇","o");var ue=u("┌","T");var o=u("│","|");var d2=u("└","—");var k2=u("●",">");var P2=u("○"," ");var A2=u("◻","[•]");var T=u("◼","[+]");var F=u("◻","[ ]");var $e=u("▪","•");var _2=u("─","-");var me=u("╮","+");var de=u("├","+");var pe=u("╯","+");var q=u("●","•");var D=u("◆","*");var U=u("▲","!");var K2=u("■","x");var b2=(t)=>{switch(t){case"initial":case"active":return import_picocolors.default.cyan(le);case"cancel":return import_picocolors.default.red(L2);case"error":return import_picocolors.default.yellow(W2);case"submit":return import_picocolors.default.green(C)}};var G2=(t)=>{const{cursor:n,options:r2,style:i}=t,s=t.maxItems??Number.POSITIVE_INFINITY,c=Math.max(process.stdout.rows-4,0),a=Math.min(c,Math.max(s,5));let l2=0;n>=l2+a-3?l2=Math.max(Math.min(n-a+3,r2.length-a),0):n<l2+2&&(l2=Math.max(n-2,0));const $2=a<r2.length&&l2>0,g=a<r2.length&&l2+a<r2.length;return r2.slice(l2,l2+a).map((p2,v,f)=>{const j2=v===0&&$2,E=v===f.length-1&&g;return j2||E?import_picocolors.default.dim("..."):i(p2,v+l2===n)})};var ve=(t)=>{const n=(r2,i)=>{const s=r2.label??String(r2.value);switch(i){case"selected":return`${import_picocolors.default.dim(s)}`;case"active":return`${import_picocolors.default.green(k2)} ${s} ${r2.hint?import_picocolors.default.dim(`(${r2.hint})`):""}`;case"cancelled":return`${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;default:return`${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`}};return new LD({options:t.options,initialValue:t.initialValue,render(){const r2=`${import_picocolors.default.gray(o)}
|
|
41
41
|
${b2(this.state)} ${t.message}
|
|
42
42
|
`;switch(this.state){case"submit":return`${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor],"selected")}`;case"cancel":return`${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor],"cancelled")}
|
|
43
43
|
${import_picocolors.default.gray(o)}`;default:return`${r2}${import_picocolors.default.cyan(o)} ${G2({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(i,s)=>n(i,s?"active":"inactive")}).join(`
|
|
44
44
|
${import_picocolors.default.cyan(o)} `)}
|
|
45
45
|
${import_picocolors.default.cyan(d2)}
|
|
46
|
-
`}}}).prompt()};var
|
|
46
|
+
`}}}).prompt()};var fe=(t)=>{const n=(r2,i)=>{const s=r2.label??String(r2.value);return i==="active"?`${import_picocolors.default.cyan(A2)} ${s} ${r2.hint?import_picocolors.default.dim(`(${r2.hint})`):""}`:i==="selected"?`${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r2.hint?import_picocolors.default.dim(`(${r2.hint})`):""}`:i==="cancelled"?`${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`:i==="active-selected"?`${import_picocolors.default.green(T)} ${s} ${r2.hint?import_picocolors.default.dim(`(${r2.hint})`):""}`:i==="submitted"?`${import_picocolors.default.dim(s)}`:`${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`};return new SD({options:t.options,initialValues:t.initialValues,required:t.required??true,cursorAt:t.cursorAt,validate(r2){if(this.required&&r2.length===0)return`Please select at least one option.
|
|
47
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`},render(){const r2=`${import_picocolors.default.gray(o)}
|
|
48
|
+
${b2(this.state)} ${t.message}
|
|
49
|
+
`,i=(s,c)=>{const a=this.value.includes(s.value);return c&&a?n(s,"active-selected"):a?n(s,"selected"):n(s,c?"active":"inactive")};switch(this.state){case"submit":return`${r2}${import_picocolors.default.gray(o)} ${this.options.filter(({value:s})=>this.value.includes(s)).map((s)=>n(s,"submitted")).join(import_picocolors.default.dim(", "))||import_picocolors.default.dim("none")}`;case"cancel":{const s=this.options.filter(({value:c})=>this.value.includes(c)).map((c)=>n(c,"cancelled")).join(import_picocolors.default.dim(", "));return`${r2}${import_picocolors.default.gray(o)} ${s.trim()?`${s}
|
|
50
|
+
${import_picocolors.default.gray(o)}`:""}`}case"error":{const s=this.error.split(`
|
|
51
|
+
`).map((c,a)=>a===0?`${import_picocolors.default.yellow(d2)} ${import_picocolors.default.yellow(c)}`:` ${c}`).join(`
|
|
52
|
+
`);return`${r2+import_picocolors.default.yellow(o)} ${G2({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
|
|
53
|
+
${import_picocolors.default.yellow(o)} `)}
|
|
54
|
+
${s}
|
|
55
|
+
`}default:return`${r2}${import_picocolors.default.cyan(o)} ${G2({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
|
|
56
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
57
|
+
${import_picocolors.default.cyan(d2)}
|
|
58
|
+
`}}}).prompt()};var Me=(t="",n="")=>{const r2=`
|
|
59
|
+
${t}
|
|
60
|
+
`.split(`
|
|
61
|
+
`),i=S2(n).length,s=Math.max(r2.reduce((a,l2)=>{const $2=S2(l2);return $2.length>a?$2.length:a},0),i)+2,c=r2.map((a)=>`${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s-S2(a).length)}${import_picocolors.default.gray(o)}`).join(`
|
|
62
|
+
`);process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
63
|
+
${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_2.repeat(Math.max(s-i-1,1))+me)}
|
|
64
|
+
${c}
|
|
65
|
+
${import_picocolors.default.gray(de+_2.repeat(s+2)+pe)}
|
|
66
|
+
`)};var xe=(t="")=>{process.stdout.write(`${import_picocolors.default.gray(d2)} ${import_picocolors.default.red(t)}
|
|
47
67
|
|
|
48
68
|
`)};var Ie=(t="")=>{process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
|
|
49
69
|
`)};var Se=(t="")=>{process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
50
70
|
${import_picocolors.default.gray(d2)} ${t}
|
|
51
71
|
|
|
52
|
-
`)};var J2=`${import_picocolors.default.gray(o)} `;var import_picocolors2=__toESM(require_picocolors(),1);import{spawn}from"node:child_process";import{mkdir as mkdir3,readFile as readFile6,readdir,writeFile as writeFile4}from"node:fs/promises";import{resolve as resolve4}from"node:path";import{isAbsolute,join,resolve,sep}from"node:path";var _a;function $constructor(name,initializer,params){function init(inst,def){if(!inst._zod){Object.defineProperty(inst,"_zod",{value:{def,constr:_3,traits:new Set},enumerable:false})}if(inst._zod.traits.has(name)){return}inst._zod.traits.add(name);initializer(inst,def);const proto=_3.prototype;const keys=Object.keys(proto);for(let i=0;i<keys.length;i++){const k3=keys[i];if(!(k3 in inst)){inst[k3]=proto[k3].bind(inst)}}}const Parent=params?.Parent??Object;class Definition extends Parent{}Object.defineProperty(Definition,"name",{value:name});function _3(def){var _a2;const inst=params?.Parent?new Definition:this;init(inst,def);(_a2=inst._zod).deferred??(_a2.deferred=[]);for(const fn of inst._zod.deferred){fn()}return inst}Object.defineProperty(_3,"init",{value:init});Object.defineProperty(_3,Symbol.hasInstance,{value:(inst)=>{if(params?.Parent&&inst instanceof params.Parent)return true;return inst?._zod?.traits?.has(name)}});Object.defineProperty(_3,"name",{value:name});return _3}var $brand=Symbol("zod_brand");class $ZodAsyncError extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}}class $ZodEncodeError extends Error{constructor(name){super(`Encountered unidirectional transform during encode: ${name}`);this.name="ZodEncodeError"}}(_a=globalThis).__zod_globalConfig??(_a.__zod_globalConfig={});var globalConfig=globalThis.__zod_globalConfig;function config(newConfig){if(newConfig)Object.assign(globalConfig,newConfig);return globalConfig}var exports_util={};__export(exports_util,{unwrapMessage:()=>unwrapMessage,uint8ArrayToHex:()=>uint8ArrayToHex,uint8ArrayToBase64url:()=>uint8ArrayToBase64url,uint8ArrayToBase64:()=>uint8ArrayToBase64,stringifyPrimitive:()=>stringifyPrimitive,slugify:()=>slugify,shallowClone:()=>shallowClone,safeExtend:()=>safeExtend,required:()=>required,randomString:()=>randomString,propertyKeyTypes:()=>propertyKeyTypes,promiseAllObject:()=>promiseAllObject,primitiveTypes:()=>primitiveTypes,prefixIssues:()=>prefixIssues,pick:()=>pick,partial:()=>partial,parsedType:()=>parsedType,optionalKeys:()=>optionalKeys,omit:()=>omit,objectClone:()=>objectClone,numKeys:()=>numKeys,nullish:()=>nullish,normalizeParams:()=>normalizeParams,mergeDefs:()=>mergeDefs,merge:()=>merge,jsonStringifyReplacer:()=>jsonStringifyReplacer,joinValues:()=>joinValues,issue:()=>issue,isPlainObject:()=>isPlainObject,isObject:()=>isObject,hexToUint8Array:()=>hexToUint8Array,getSizableOrigin:()=>getSizableOrigin,getParsedType:()=>getParsedType,getLengthableOrigin:()=>getLengthableOrigin,getEnumValues:()=>getEnumValues,getElementAtPath:()=>getElementAtPath,floatSafeRemainder:()=>floatSafeRemainder,finalizeIssue:()=>finalizeIssue,extend:()=>extend,explicitlyAborted:()=>explicitlyAborted,escapeRegex:()=>escapeRegex,esc:()=>esc,defineLazy:()=>defineLazy,createTransparentProxy:()=>createTransparentProxy,cloneDef:()=>cloneDef,clone:()=>clone,cleanRegex:()=>cleanRegex,cleanEnum:()=>cleanEnum,captureStackTrace:()=>captureStackTrace,cached:()=>cached,base64urlToUint8Array:()=>base64urlToUint8Array,base64ToUint8Array:()=>base64ToUint8Array,assignProp:()=>assignProp,assertNotEqual:()=>assertNotEqual,assertNever:()=>assertNever,assertIs:()=>assertIs,assertEqual:()=>assertEqual,assert:()=>assert,allowsEval:()=>allowsEval,aborted:()=>aborted,NUMBER_FORMAT_RANGES:()=>NUMBER_FORMAT_RANGES,Class:()=>Class,BIGINT_FORMAT_RANGES:()=>BIGINT_FORMAT_RANGES});function assertEqual(val){return val}function assertNotEqual(val){return val}function assertIs(_arg){}function assertNever(_x){throw new Error("Unexpected value in exhaustive check")}function assert(_3){}function getEnumValues(entries){const numericValues=Object.values(entries).filter((v)=>typeof v==="number");const values=Object.entries(entries).filter(([k3,_3])=>numericValues.indexOf(+k3)===-1).map(([_3,v])=>v);return values}function joinValues(array,separator="|"){return array.map((val)=>stringifyPrimitive(val)).join(separator)}function jsonStringifyReplacer(_3,value){if(typeof value==="bigint")return value.toString();return value}function cached(getter){const set=false;return{get value(){if(!set){const value=getter();Object.defineProperty(this,"value",{value});return value}throw new Error("cached value already set")}}}function nullish(input){return input===null||input===undefined}function cleanRegex(source){const start=source.startsWith("^")?1:0;const end=source.endsWith("$")?source.length-1:source.length;return source.slice(start,end)}function floatSafeRemainder(val,step){const ratio=val/step;const roundedRatio=Math.round(ratio);const tolerance=Number.EPSILON*Math.max(Math.abs(ratio),1);if(Math.abs(ratio-roundedRatio)<tolerance)return 0;return ratio-roundedRatio}var EVALUATING=Symbol("evaluating");function defineLazy(object,key,getter){let value=undefined;Object.defineProperty(object,key,{get(){if(value===EVALUATING){return}if(value===undefined){value=EVALUATING;value=getter()}return value},set(v){Object.defineProperty(object,key,{value:v})},configurable:true})}function objectClone(obj){return Object.create(Object.getPrototypeOf(obj),Object.getOwnPropertyDescriptors(obj))}function assignProp(target,prop,value){Object.defineProperty(target,prop,{value,writable:true,enumerable:true,configurable:true})}function mergeDefs(...defs){const mergedDescriptors={};for(const def of defs){const descriptors=Object.getOwnPropertyDescriptors(def);Object.assign(mergedDescriptors,descriptors)}return Object.defineProperties({},mergedDescriptors)}function cloneDef(schema){return mergeDefs(schema._zod.def)}function getElementAtPath(obj,path){if(!path)return obj;return path.reduce((acc,key)=>acc?.[key],obj)}function promiseAllObject(promisesObj){const keys=Object.keys(promisesObj);const promises=keys.map((key)=>promisesObj[key]);return Promise.all(promises).then((results)=>{const resolvedObj={};for(let i=0;i<keys.length;i++){resolvedObj[keys[i]]=results[i]}return resolvedObj})}function randomString(length=10){const chars="abcdefghijklmnopqrstuvwxyz";let str="";for(let i=0;i<length;i++){str+=chars[Math.floor(Math.random()*chars.length)]}return str}function esc(str){return JSON.stringify(str)}function slugify(input){return input.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(..._args)=>{};function isObject(data){return typeof data==="object"&&data!==null&&!Array.isArray(data)}var allowsEval=cached(()=>{if(globalConfig.jitless){return false}if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare")){return false}try{const F2=Function;new F2("");return true}catch(_3){return false}});function isPlainObject(o2){if(isObject(o2)===false)return false;const ctor=o2.constructor;if(ctor===undefined)return true;if(typeof ctor!=="function")return true;const prot=ctor.prototype;if(isObject(prot)===false)return false;if(Object.prototype.hasOwnProperty.call(prot,"isPrototypeOf")===false){return false}return true}function shallowClone(o2){if(isPlainObject(o2))return{...o2};if(Array.isArray(o2))return[...o2];if(o2 instanceof Map)return new Map(o2);if(o2 instanceof Set)return new Set(o2);return o2}function numKeys(data){let keyCount=0;for(const key in data){if(Object.prototype.hasOwnProperty.call(data,key)){keyCount++}}return keyCount}var getParsedType=(data)=>{const t=typeof data;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(data)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(data)){return"array"}if(data===null){return"null"}if(data.then&&typeof data.then==="function"&&data.catch&&typeof data.catch==="function"){return"promise"}if(typeof Map!=="undefined"&&data instanceof Map){return"map"}if(typeof Set!=="undefined"&&data instanceof Set){return"set"}if(typeof Date!=="undefined"&&data instanceof Date){return"date"}if(typeof File!=="undefined"&&data instanceof File){return"file"}return"object";default:throw new Error(`Unknown data type: ${t}`)}};var propertyKeyTypes=new Set(["string","number","symbol"]);var primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function escapeRegex(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function clone(inst,def,params){const cl=new inst._zod.constr(def??inst._zod.def);if(!def||params?.parent)cl._zod.parent=inst;return cl}function normalizeParams(_params){const params=_params;if(!params)return{};if(typeof params==="string")return{error:()=>params};if(params?.message!==undefined){if(params?.error!==undefined)throw new Error("Cannot specify both `message` and `error` params");params.error=params.message}delete params.message;if(typeof params.error==="string")return{...params,error:()=>params.error};return params}function createTransparentProxy(getter){let target;return new Proxy({},{get(_3,prop,receiver){target??(target=getter());return Reflect.get(target,prop,receiver)},set(_3,prop,value,receiver){target??(target=getter());return Reflect.set(target,prop,value,receiver)},has(_3,prop){target??(target=getter());return Reflect.has(target,prop)},deleteProperty(_3,prop){target??(target=getter());return Reflect.deleteProperty(target,prop)},ownKeys(_3){target??(target=getter());return Reflect.ownKeys(target)},getOwnPropertyDescriptor(_3,prop){target??(target=getter());return Reflect.getOwnPropertyDescriptor(target,prop)},defineProperty(_3,prop,descriptor){target??(target=getter());return Reflect.defineProperty(target,prop,descriptor)}})}function stringifyPrimitive(value){if(typeof value==="bigint")return value.toString()+"n";if(typeof value==="string")return`"${value}"`;return`${value}`}function optionalKeys(shape){return Object.keys(shape).filter((k3)=>{return shape[k3]._zod.optin==="optional"&&shape[k3]._zod.optout==="optional"})}var NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};var BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pick(schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".pick() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const newShape={};for(const key in mask){if(!(key in currDef.shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;newShape[key]=currDef.shape[key]}assignProp(this,"shape",newShape);return newShape},checks:[]});return clone(schema,def)}function omit(schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".omit() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const newShape={...schema._zod.def.shape};for(const key in mask){if(!(key in currDef.shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;delete newShape[key]}assignProp(this,"shape",newShape);return newShape},checks:[]});return clone(schema,def)}function extend(schema,shape){if(!isPlainObject(shape)){throw new Error("Invalid input to extend: expected a plain object")}const checks=schema._zod.def.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){const existingShape=schema._zod.def.shape;for(const key in shape){if(Object.getOwnPropertyDescriptor(existingShape,key)!==undefined){throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}}}const def=mergeDefs(schema._zod.def,{get shape(){const _shape={...schema._zod.def.shape,...shape};assignProp(this,"shape",_shape);return _shape}});return clone(schema,def)}function safeExtend(schema,shape){if(!isPlainObject(shape)){throw new Error("Invalid input to safeExtend: expected a plain object")}const def=mergeDefs(schema._zod.def,{get shape(){const _shape={...schema._zod.def.shape,...shape};assignProp(this,"shape",_shape);return _shape}});return clone(schema,def)}function merge(a,b3){if(a._zod.def.checks?.length){throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.")}const def=mergeDefs(a._zod.def,{get shape(){const _shape={...a._zod.def.shape,...b3._zod.def.shape};assignProp(this,"shape",_shape);return _shape},get catchall(){return b3._zod.def.catchall},checks:b3._zod.def.checks??[]});return clone(a,def)}function partial(Class,schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".partial() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const oldShape=schema._zod.def.shape;const shape={...oldShape};if(mask){for(const key in mask){if(!(key in oldShape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;shape[key]=Class?new Class({type:"optional",innerType:oldShape[key]}):oldShape[key]}}else{for(const key in oldShape){shape[key]=Class?new Class({type:"optional",innerType:oldShape[key]}):oldShape[key]}}assignProp(this,"shape",shape);return shape},checks:[]});return clone(schema,def)}function required(Class,schema,mask){const def=mergeDefs(schema._zod.def,{get shape(){const oldShape=schema._zod.def.shape;const shape={...oldShape};if(mask){for(const key in mask){if(!(key in shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;shape[key]=new Class({type:"nonoptional",innerType:oldShape[key]})}}else{for(const key in oldShape){shape[key]=new Class({type:"nonoptional",innerType:oldShape[key]})}}assignProp(this,"shape",shape);return shape}});return clone(schema,def)}function aborted(x2,startIndex=0){if(x2.aborted===true)return true;for(let i=startIndex;i<x2.issues.length;i++){if(x2.issues[i]?.continue!==true){return true}}return false}function explicitlyAborted(x2,startIndex=0){if(x2.aborted===true)return true;for(let i=startIndex;i<x2.issues.length;i++){if(x2.issues[i]?.continue===false){return true}}return false}function prefixIssues(path,issues){return issues.map((iss)=>{var _a2;(_a2=iss).path??(_a2.path=[]);iss.path.unshift(path);return iss})}function unwrapMessage(message){return typeof message==="string"?message:message?.message}function finalizeIssue(iss,ctx,config2){const message=iss.message?iss.message:unwrapMessage(iss.inst?._zod.def?.error?.(iss))??unwrapMessage(ctx?.error?.(iss))??unwrapMessage(config2.customError?.(iss))??unwrapMessage(config2.localeError?.(iss))??"Invalid input";const{inst:_inst,continue:_continue,input:_input,...rest}=iss;rest.path??(rest.path=[]);rest.message=message;if(ctx?.reportInput){rest.input=_input}return rest}function getSizableOrigin(input){if(input instanceof Set)return"set";if(input instanceof Map)return"map";if(input instanceof File)return"file";return"unknown"}function getLengthableOrigin(input){if(Array.isArray(input))return"array";if(typeof input==="string")return"string";return"unknown"}function parsedType(data){const t=typeof data;switch(t){case"number":{return Number.isNaN(data)?"nan":"number"}case"object":{if(data===null){return"null"}if(Array.isArray(data)){return"array"}const obj=data;if(obj&&Object.getPrototypeOf(obj)!==Object.prototype&&"constructor"in obj&&obj.constructor){return obj.constructor.name}}}return t}function issue(...args){const[iss,input,inst]=args;if(typeof iss==="string"){return{message:iss,code:"custom",input,inst}}return{...iss}}function cleanEnum(obj){return Object.entries(obj).filter(([k3,_3])=>{return Number.isNaN(Number.parseInt(k3,10))}).map((el)=>el[1])}function base64ToUint8Array(base64){const binaryString=atob(base64);const bytes=new Uint8Array(binaryString.length);for(let i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i)}return bytes}function uint8ArrayToBase64(bytes){let binaryString="";for(let i=0;i<bytes.length;i++){binaryString+=String.fromCharCode(bytes[i])}return btoa(binaryString)}function base64urlToUint8Array(base64url){const base64=base64url.replace(/-/g,"+").replace(/_/g,"/");const padding="=".repeat((4-base64.length%4)%4);return base64ToUint8Array(base64+padding)}function uint8ArrayToBase64url(bytes){return uint8ArrayToBase64(bytes).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function hexToUint8Array(hex){const cleanHex=hex.replace(/^0x/,"");if(cleanHex.length%2!==0){throw new Error("Invalid hex string length")}const bytes=new Uint8Array(cleanHex.length/2);for(let i=0;i<cleanHex.length;i+=2){bytes[i/2]=Number.parseInt(cleanHex.slice(i,i+2),16)}return bytes}function uint8ArrayToHex(bytes){return Array.from(bytes).map((b3)=>b3.toString(16).padStart(2,"0")).join("")}class Class{constructor(..._args){}}var initializer=(inst,def)=>{inst.name="$ZodError";Object.defineProperty(inst,"_zod",{value:inst._zod,enumerable:false});Object.defineProperty(inst,"issues",{value:def,enumerable:false});inst.message=JSON.stringify(def,jsonStringifyReplacer,2);Object.defineProperty(inst,"toString",{value:()=>inst.message,enumerable:false})};var $ZodError=$constructor("$ZodError",initializer);var $ZodRealError=$constructor("$ZodError",initializer,{Parent:Error});function flattenError(error,mapper=(issue2)=>issue2.message){const fieldErrors={};const formErrors=[];for(const sub of error.issues){if(sub.path.length>0){fieldErrors[sub.path[0]]=fieldErrors[sub.path[0]]||[];fieldErrors[sub.path[0]].push(mapper(sub))}else{formErrors.push(mapper(sub))}}return{formErrors,fieldErrors}}function formatError(error,mapper=(issue2)=>issue2.message){const fieldErrors={_errors:[]};const processError=(error2,path=[])=>{for(const issue2 of error2.issues){if(issue2.code==="invalid_union"&&issue2.errors.length){issue2.errors.map((issues)=>processError({issues},[...path,...issue2.path]))}else if(issue2.code==="invalid_key"){processError({issues:issue2.issues},[...path,...issue2.path])}else if(issue2.code==="invalid_element"){processError({issues:issue2.issues},[...path,...issue2.path])}else{const fullpath=[...path,...issue2.path];if(fullpath.length===0){fieldErrors._errors.push(mapper(issue2))}else{let curr=fieldErrors;let i=0;while(i<fullpath.length){const el=fullpath[i];const terminal=i===fullpath.length-1;if(!terminal){curr[el]=curr[el]||{_errors:[]}}else{curr[el]=curr[el]||{_errors:[]};curr[el]._errors.push(mapper(issue2))}curr=curr[el];i++}}}}};processError(error);return fieldErrors}var _parse=(_Err)=>(schema,value,_ctx,_params)=>{const ctx=_ctx?{..._ctx,async:false}:{async:false};const result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise){throw new $ZodAsyncError}if(result.issues.length){const e2=new(_params?.Err??_Err)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())));captureStackTrace(e2,_params?.callee);throw e2}return result.value};var _parseAsync=(_Err)=>async(schema,value,_ctx,params)=>{const ctx=_ctx?{..._ctx,async:true}:{async:true};let result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise)result=await result;if(result.issues.length){const e2=new(params?.Err??_Err)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())));captureStackTrace(e2,params?.callee);throw e2}return result.value};var _safeParse=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,async:false}:{async:false};const result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise){throw new $ZodAsyncError}return result.issues.length?{success:false,error:new(_Err??$ZodError)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))}:{success:true,data:result.value}};var safeParse=_safeParse($ZodRealError);var _safeParseAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,async:true}:{async:true};let result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise)result=await result;return result.issues.length?{success:false,error:new _Err(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))}:{success:true,data:result.value}};var safeParseAsync=_safeParseAsync($ZodRealError);var _encode=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _parse(_Err)(schema,value,ctx)};var _decode=(_Err)=>(schema,value,_ctx)=>{return _parse(_Err)(schema,value,_ctx)};var _encodeAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _parseAsync(_Err)(schema,value,ctx)};var _decodeAsync=(_Err)=>async(schema,value,_ctx)=>{return _parseAsync(_Err)(schema,value,_ctx)};var _safeEncode=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _safeParse(_Err)(schema,value,ctx)};var _safeDecode=(_Err)=>(schema,value,_ctx)=>{return _safeParse(_Err)(schema,value,_ctx)};var _safeEncodeAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _safeParseAsync(_Err)(schema,value,ctx)};var _safeDecodeAsync=(_Err)=>async(schema,value,_ctx)=>{return _safeParseAsync(_Err)(schema,value,_ctx)};var cuid=/^[cC][0-9a-z]{6,}$/;var cuid2=/^[0-9a-z]+$/;var ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;var xid=/^[0-9a-vA-V]{20}$/;var ksuid=/^[A-Za-z0-9]{27}$/;var nanoid=/^[a-zA-Z0-9_-]{21}$/;var duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var guid=/^([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})$/;var uuid=(version)=>{if(!version)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var _emoji=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function emoji(){return new RegExp(_emoji,"u")}var 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])$/;var ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var cidrv4=/^((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])$/;var cidrv6=/^(([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])$/;var base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;var base64url=/^[A-Za-z0-9_-]*$/;var httpProtocol=/^https?$/;var e164=/^\+[1-9]\d{6,14}$/;var 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])))`;var date=new RegExp(`^${dateSource}$`);function timeSource(args){const hhmm=`(?:[01]\\d|2[0-3]):[0-5]\\d`;const regex=typeof args.precision==="number"?args.precision===-1?`${hhmm}`:args.precision===0?`${hhmm}:[0-5]\\d`:`${hhmm}:[0-5]\\d\\.\\d{${args.precision}}`:`${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;return regex}function time(args){return new RegExp(`^${timeSource(args)}$`)}function datetime(args){const time2=timeSource({precision:args.precision});const opts=["Z"];if(args.local)opts.push("");if(args.offset)opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);const timeRegex=`${time2}(?:${opts.join("|")})`;return new RegExp(`^${dateSource}T(?:${timeRegex})$`)}var string=(params)=>{const regex=params?`[\\s\\S]{${params?.minimum??0},${params?.maximum??""}}`:`[\\s\\S]*`;return new RegExp(`^${regex}$`)};var integer=/^-?\d+$/;var number=/^-?\d+(?:\.\d+)?$/;var boolean=/^(?:true|false)$/i;var lowercase=/^[^A-Z]*$/;var uppercase=/^[^a-z]*$/;var $ZodCheck=$constructor("$ZodCheck",(inst,def)=>{var _a2;inst._zod??(inst._zod={});inst._zod.def=def;(_a2=inst._zod).onattach??(_a2.onattach=[])});var numericOriginMap={number:"number",bigint:"bigint",object:"date"};var $ZodCheckLessThan=$constructor("$ZodCheckLessThan",(inst,def)=>{$ZodCheck.init(inst,def);const origin=numericOriginMap[typeof def.value];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;const curr=(def.inclusive?bag.maximum:bag.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(def.value<curr){if(def.inclusive)bag.maximum=def.value;else bag.exclusiveMaximum=def.value}});inst._zod.check=(payload)=>{if(def.inclusive?payload.value<=def.value:payload.value<def.value){return}payload.issues.push({origin,code:"too_big",maximum:typeof def.value==="object"?def.value.getTime():def.value,input:payload.value,inclusive:def.inclusive,inst,continue:!def.abort})}});var $ZodCheckGreaterThan=$constructor("$ZodCheckGreaterThan",(inst,def)=>{$ZodCheck.init(inst,def);const origin=numericOriginMap[typeof def.value];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;const curr=(def.inclusive?bag.minimum:bag.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(def.value>curr){if(def.inclusive)bag.minimum=def.value;else bag.exclusiveMinimum=def.value}});inst._zod.check=(payload)=>{if(def.inclusive?payload.value>=def.value:payload.value>def.value){return}payload.issues.push({origin,code:"too_small",minimum:typeof def.value==="object"?def.value.getTime():def.value,input:payload.value,inclusive:def.inclusive,inst,continue:!def.abort})}});var $ZodCheckMultipleOf=$constructor("$ZodCheckMultipleOf",(inst,def)=>{$ZodCheck.init(inst,def);inst._zod.onattach.push((inst2)=>{var _a2;(_a2=inst2._zod.bag).multipleOf??(_a2.multipleOf=def.value)});inst._zod.check=(payload)=>{if(typeof payload.value!==typeof def.value)throw new Error("Cannot mix number and bigint in multiple_of check.");const isMultiple=typeof payload.value==="bigint"?payload.value%def.value===BigInt(0):floatSafeRemainder(payload.value,def.value)===0;if(isMultiple)return;payload.issues.push({origin:typeof payload.value,code:"not_multiple_of",divisor:def.value,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckNumberFormat=$constructor("$ZodCheckNumberFormat",(inst,def)=>{$ZodCheck.init(inst,def);def.format=def.format||"float64";const isInt=def.format?.includes("int");const origin=isInt?"int":"number";const[minimum,maximum]=NUMBER_FORMAT_RANGES[def.format];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.format=def.format;bag.minimum=minimum;bag.maximum=maximum;if(isInt)bag.pattern=integer});inst._zod.check=(payload)=>{const input=payload.value;if(isInt){if(!Number.isInteger(input)){payload.issues.push({expected:origin,format:def.format,code:"invalid_type",continue:false,input,inst});return}if(!Number.isSafeInteger(input)){if(input>0){payload.issues.push({input,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst,origin,inclusive:true,continue:!def.abort})}else{payload.issues.push({input,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst,origin,inclusive:true,continue:!def.abort})}return}}if(input<minimum){payload.issues.push({origin:"number",input,code:"too_small",minimum,inclusive:true,inst,continue:!def.abort})}if(input>maximum){payload.issues.push({origin:"number",input,code:"too_big",maximum,inclusive:true,inst,continue:!def.abort})}}});var $ZodCheckMaxLength=$constructor("$ZodCheckMaxLength",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const curr=inst2._zod.bag.maximum??Number.POSITIVE_INFINITY;if(def.maximum<curr)inst2._zod.bag.maximum=def.maximum});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length<=def.maximum)return;const origin=getLengthableOrigin(input);payload.issues.push({origin,code:"too_big",maximum:def.maximum,inclusive:true,input,inst,continue:!def.abort})}});var $ZodCheckMinLength=$constructor("$ZodCheckMinLength",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const curr=inst2._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(def.minimum>curr)inst2._zod.bag.minimum=def.minimum});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length>=def.minimum)return;const origin=getLengthableOrigin(input);payload.issues.push({origin,code:"too_small",minimum:def.minimum,inclusive:true,input,inst,continue:!def.abort})}});var $ZodCheckLengthEquals=$constructor("$ZodCheckLengthEquals",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.minimum=def.length;bag.maximum=def.length;bag.length=def.length});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length===def.length)return;const origin=getLengthableOrigin(input);const tooBig=length>def.length;payload.issues.push({origin,...tooBig?{code:"too_big",maximum:def.length}:{code:"too_small",minimum:def.length},inclusive:true,exact:true,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckStringFormat=$constructor("$ZodCheckStringFormat",(inst,def)=>{var _a2,_b;$ZodCheck.init(inst,def);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.format=def.format;if(def.pattern){bag.patterns??(bag.patterns=new Set);bag.patterns.add(def.pattern)}});if(def.pattern)(_a2=inst._zod).check??(_a2.check=(payload)=>{def.pattern.lastIndex=0;if(def.pattern.test(payload.value))return;payload.issues.push({origin:"string",code:"invalid_format",format:def.format,input:payload.value,...def.pattern?{pattern:def.pattern.toString()}:{},inst,continue:!def.abort})});else(_b=inst._zod).check??(_b.check=()=>{})});var $ZodCheckRegex=$constructor("$ZodCheckRegex",(inst,def)=>{$ZodCheckStringFormat.init(inst,def);inst._zod.check=(payload)=>{def.pattern.lastIndex=0;if(def.pattern.test(payload.value))return;payload.issues.push({origin:"string",code:"invalid_format",format:"regex",input:payload.value,pattern:def.pattern.toString(),inst,continue:!def.abort})}});var $ZodCheckLowerCase=$constructor("$ZodCheckLowerCase",(inst,def)=>{def.pattern??(def.pattern=lowercase);$ZodCheckStringFormat.init(inst,def)});var $ZodCheckUpperCase=$constructor("$ZodCheckUpperCase",(inst,def)=>{def.pattern??(def.pattern=uppercase);$ZodCheckStringFormat.init(inst,def)});var $ZodCheckIncludes=$constructor("$ZodCheckIncludes",(inst,def)=>{$ZodCheck.init(inst,def);const escapedRegex=escapeRegex(def.includes);const pattern=new RegExp(typeof def.position==="number"?`^.{${def.position}}${escapedRegex}`:escapedRegex);def.pattern=pattern;inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.includes(def.includes,def.position))return;payload.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:def.includes,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckStartsWith=$constructor("$ZodCheckStartsWith",(inst,def)=>{$ZodCheck.init(inst,def);const pattern=new RegExp(`^${escapeRegex(def.prefix)}.*`);def.pattern??(def.pattern=pattern);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.startsWith(def.prefix))return;payload.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:def.prefix,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckEndsWith=$constructor("$ZodCheckEndsWith",(inst,def)=>{$ZodCheck.init(inst,def);const pattern=new RegExp(`.*${escapeRegex(def.suffix)}$`);def.pattern??(def.pattern=pattern);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.endsWith(def.suffix))return;payload.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:def.suffix,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckOverwrite=$constructor("$ZodCheckOverwrite",(inst,def)=>{$ZodCheck.init(inst,def);inst._zod.check=(payload)=>{payload.value=def.tx(payload.value)}});class Doc{constructor(args=[]){this.content=[];this.indent=0;if(this)this.args=args}indented(fn){this.indent+=1;fn(this);this.indent-=1}write(arg){if(typeof arg==="function"){arg(this,{execution:"sync"});arg(this,{execution:"async"});return}const content=arg;const lines=content.split(`
|
|
72
|
+
`)};var J2=`${import_picocolors.default.gray(o)} `;var import_picocolors4=__toESM(require_picocolors(),1);var _a;function $constructor(name,initializer,params){function init(inst,def){if(!inst._zod){Object.defineProperty(inst,"_zod",{value:{def,constr:_3,traits:new Set},enumerable:false})}if(inst._zod.traits.has(name)){return}inst._zod.traits.add(name);initializer(inst,def);const proto=_3.prototype;const keys=Object.keys(proto);for(let i=0;i<keys.length;i++){const k3=keys[i];if(!(k3 in inst)){inst[k3]=proto[k3].bind(inst)}}}const Parent=params?.Parent??Object;class Definition extends Parent{}Object.defineProperty(Definition,"name",{value:name});function _3(def){var _a2;const inst=params?.Parent?new Definition:this;init(inst,def);(_a2=inst._zod).deferred??(_a2.deferred=[]);for(const fn of inst._zod.deferred){fn()}return inst}Object.defineProperty(_3,"init",{value:init});Object.defineProperty(_3,Symbol.hasInstance,{value:(inst)=>{if(params?.Parent&&inst instanceof params.Parent)return true;return inst?._zod?.traits?.has(name)}});Object.defineProperty(_3,"name",{value:name});return _3}var $brand=Symbol("zod_brand");class $ZodAsyncError extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}}class $ZodEncodeError extends Error{constructor(name){super(`Encountered unidirectional transform during encode: ${name}`);this.name="ZodEncodeError"}}(_a=globalThis).__zod_globalConfig??(_a.__zod_globalConfig={});var globalConfig=globalThis.__zod_globalConfig;function config(newConfig){if(newConfig)Object.assign(globalConfig,newConfig);return globalConfig}var exports_util={};__export(exports_util,{unwrapMessage:()=>unwrapMessage,uint8ArrayToHex:()=>uint8ArrayToHex,uint8ArrayToBase64url:()=>uint8ArrayToBase64url,uint8ArrayToBase64:()=>uint8ArrayToBase64,stringifyPrimitive:()=>stringifyPrimitive,slugify:()=>slugify,shallowClone:()=>shallowClone,safeExtend:()=>safeExtend,required:()=>required,randomString:()=>randomString,propertyKeyTypes:()=>propertyKeyTypes,promiseAllObject:()=>promiseAllObject,primitiveTypes:()=>primitiveTypes,prefixIssues:()=>prefixIssues,pick:()=>pick,partial:()=>partial,parsedType:()=>parsedType,optionalKeys:()=>optionalKeys,omit:()=>omit,objectClone:()=>objectClone,numKeys:()=>numKeys,nullish:()=>nullish,normalizeParams:()=>normalizeParams,mergeDefs:()=>mergeDefs,merge:()=>merge,jsonStringifyReplacer:()=>jsonStringifyReplacer,joinValues:()=>joinValues,issue:()=>issue,isPlainObject:()=>isPlainObject,isObject:()=>isObject,hexToUint8Array:()=>hexToUint8Array,getSizableOrigin:()=>getSizableOrigin,getParsedType:()=>getParsedType,getLengthableOrigin:()=>getLengthableOrigin,getEnumValues:()=>getEnumValues,getElementAtPath:()=>getElementAtPath,floatSafeRemainder:()=>floatSafeRemainder,finalizeIssue:()=>finalizeIssue,extend:()=>extend,explicitlyAborted:()=>explicitlyAborted,escapeRegex:()=>escapeRegex,esc:()=>esc,defineLazy:()=>defineLazy,createTransparentProxy:()=>createTransparentProxy,cloneDef:()=>cloneDef,clone:()=>clone,cleanRegex:()=>cleanRegex,cleanEnum:()=>cleanEnum,captureStackTrace:()=>captureStackTrace,cached:()=>cached,base64urlToUint8Array:()=>base64urlToUint8Array,base64ToUint8Array:()=>base64ToUint8Array,assignProp:()=>assignProp,assertNotEqual:()=>assertNotEqual,assertNever:()=>assertNever,assertIs:()=>assertIs,assertEqual:()=>assertEqual,assert:()=>assert,allowsEval:()=>allowsEval,aborted:()=>aborted,NUMBER_FORMAT_RANGES:()=>NUMBER_FORMAT_RANGES,Class:()=>Class,BIGINT_FORMAT_RANGES:()=>BIGINT_FORMAT_RANGES});function assertEqual(val){return val}function assertNotEqual(val){return val}function assertIs(_arg){}function assertNever(_x){throw new Error("Unexpected value in exhaustive check")}function assert(_3){}function getEnumValues(entries){const numericValues=Object.values(entries).filter((v)=>typeof v==="number");const values=Object.entries(entries).filter(([k3,_3])=>numericValues.indexOf(+k3)===-1).map(([_3,v])=>v);return values}function joinValues(array,separator="|"){return array.map((val)=>stringifyPrimitive(val)).join(separator)}function jsonStringifyReplacer(_3,value){if(typeof value==="bigint")return value.toString();return value}function cached(getter){const set=false;return{get value(){if(!set){const value=getter();Object.defineProperty(this,"value",{value});return value}throw new Error("cached value already set")}}}function nullish(input){return input===null||input===undefined}function cleanRegex(source){const start=source.startsWith("^")?1:0;const end=source.endsWith("$")?source.length-1:source.length;return source.slice(start,end)}function floatSafeRemainder(val,step){const ratio=val/step;const roundedRatio=Math.round(ratio);const tolerance=Number.EPSILON*Math.max(Math.abs(ratio),1);if(Math.abs(ratio-roundedRatio)<tolerance)return 0;return ratio-roundedRatio}var EVALUATING=Symbol("evaluating");function defineLazy(object,key,getter){let value=undefined;Object.defineProperty(object,key,{get(){if(value===EVALUATING){return}if(value===undefined){value=EVALUATING;value=getter()}return value},set(v){Object.defineProperty(object,key,{value:v})},configurable:true})}function objectClone(obj){return Object.create(Object.getPrototypeOf(obj),Object.getOwnPropertyDescriptors(obj))}function assignProp(target,prop,value){Object.defineProperty(target,prop,{value,writable:true,enumerable:true,configurable:true})}function mergeDefs(...defs){const mergedDescriptors={};for(const def of defs){const descriptors=Object.getOwnPropertyDescriptors(def);Object.assign(mergedDescriptors,descriptors)}return Object.defineProperties({},mergedDescriptors)}function cloneDef(schema){return mergeDefs(schema._zod.def)}function getElementAtPath(obj,path){if(!path)return obj;return path.reduce((acc,key)=>acc?.[key],obj)}function promiseAllObject(promisesObj){const keys=Object.keys(promisesObj);const promises=keys.map((key)=>promisesObj[key]);return Promise.all(promises).then((results)=>{const resolvedObj={};for(let i=0;i<keys.length;i++){resolvedObj[keys[i]]=results[i]}return resolvedObj})}function randomString(length=10){const chars="abcdefghijklmnopqrstuvwxyz";let str="";for(let i=0;i<length;i++){str+=chars[Math.floor(Math.random()*chars.length)]}return str}function esc(str){return JSON.stringify(str)}function slugify(input){return input.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(..._args)=>{};function isObject(data){return typeof data==="object"&&data!==null&&!Array.isArray(data)}var allowsEval=cached(()=>{if(globalConfig.jitless){return false}if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare")){return false}try{const F2=Function;new F2("");return true}catch(_3){return false}});function isPlainObject(o2){if(isObject(o2)===false)return false;const ctor=o2.constructor;if(ctor===undefined)return true;if(typeof ctor!=="function")return true;const prot=ctor.prototype;if(isObject(prot)===false)return false;if(Object.prototype.hasOwnProperty.call(prot,"isPrototypeOf")===false){return false}return true}function shallowClone(o2){if(isPlainObject(o2))return{...o2};if(Array.isArray(o2))return[...o2];if(o2 instanceof Map)return new Map(o2);if(o2 instanceof Set)return new Set(o2);return o2}function numKeys(data){let keyCount=0;for(const key in data){if(Object.prototype.hasOwnProperty.call(data,key)){keyCount++}}return keyCount}var getParsedType=(data)=>{const t=typeof data;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(data)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(data)){return"array"}if(data===null){return"null"}if(data.then&&typeof data.then==="function"&&data.catch&&typeof data.catch==="function"){return"promise"}if(typeof Map!=="undefined"&&data instanceof Map){return"map"}if(typeof Set!=="undefined"&&data instanceof Set){return"set"}if(typeof Date!=="undefined"&&data instanceof Date){return"date"}if(typeof File!=="undefined"&&data instanceof File){return"file"}return"object";default:throw new Error(`Unknown data type: ${t}`)}};var propertyKeyTypes=new Set(["string","number","symbol"]);var primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function escapeRegex(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function clone(inst,def,params){const cl=new inst._zod.constr(def??inst._zod.def);if(!def||params?.parent)cl._zod.parent=inst;return cl}function normalizeParams(_params){const params=_params;if(!params)return{};if(typeof params==="string")return{error:()=>params};if(params?.message!==undefined){if(params?.error!==undefined)throw new Error("Cannot specify both `message` and `error` params");params.error=params.message}delete params.message;if(typeof params.error==="string")return{...params,error:()=>params.error};return params}function createTransparentProxy(getter){let target;return new Proxy({},{get(_3,prop,receiver){target??(target=getter());return Reflect.get(target,prop,receiver)},set(_3,prop,value,receiver){target??(target=getter());return Reflect.set(target,prop,value,receiver)},has(_3,prop){target??(target=getter());return Reflect.has(target,prop)},deleteProperty(_3,prop){target??(target=getter());return Reflect.deleteProperty(target,prop)},ownKeys(_3){target??(target=getter());return Reflect.ownKeys(target)},getOwnPropertyDescriptor(_3,prop){target??(target=getter());return Reflect.getOwnPropertyDescriptor(target,prop)},defineProperty(_3,prop,descriptor){target??(target=getter());return Reflect.defineProperty(target,prop,descriptor)}})}function stringifyPrimitive(value){if(typeof value==="bigint")return value.toString()+"n";if(typeof value==="string")return`"${value}"`;return`${value}`}function optionalKeys(shape){return Object.keys(shape).filter((k3)=>{return shape[k3]._zod.optin==="optional"&&shape[k3]._zod.optout==="optional"})}var NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};var BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pick(schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".pick() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const newShape={};for(const key in mask){if(!(key in currDef.shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;newShape[key]=currDef.shape[key]}assignProp(this,"shape",newShape);return newShape},checks:[]});return clone(schema,def)}function omit(schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".omit() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const newShape={...schema._zod.def.shape};for(const key in mask){if(!(key in currDef.shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;delete newShape[key]}assignProp(this,"shape",newShape);return newShape},checks:[]});return clone(schema,def)}function extend(schema,shape){if(!isPlainObject(shape)){throw new Error("Invalid input to extend: expected a plain object")}const checks=schema._zod.def.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){const existingShape=schema._zod.def.shape;for(const key in shape){if(Object.getOwnPropertyDescriptor(existingShape,key)!==undefined){throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}}}const def=mergeDefs(schema._zod.def,{get shape(){const _shape={...schema._zod.def.shape,...shape};assignProp(this,"shape",_shape);return _shape}});return clone(schema,def)}function safeExtend(schema,shape){if(!isPlainObject(shape)){throw new Error("Invalid input to safeExtend: expected a plain object")}const def=mergeDefs(schema._zod.def,{get shape(){const _shape={...schema._zod.def.shape,...shape};assignProp(this,"shape",_shape);return _shape}});return clone(schema,def)}function merge(a,b3){if(a._zod.def.checks?.length){throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.")}const def=mergeDefs(a._zod.def,{get shape(){const _shape={...a._zod.def.shape,...b3._zod.def.shape};assignProp(this,"shape",_shape);return _shape},get catchall(){return b3._zod.def.catchall},checks:b3._zod.def.checks??[]});return clone(a,def)}function partial(Class,schema,mask){const currDef=schema._zod.def;const checks=currDef.checks;const hasChecks=checks&&checks.length>0;if(hasChecks){throw new Error(".partial() cannot be used on object schemas containing refinements")}const def=mergeDefs(schema._zod.def,{get shape(){const oldShape=schema._zod.def.shape;const shape={...oldShape};if(mask){for(const key in mask){if(!(key in oldShape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;shape[key]=Class?new Class({type:"optional",innerType:oldShape[key]}):oldShape[key]}}else{for(const key in oldShape){shape[key]=Class?new Class({type:"optional",innerType:oldShape[key]}):oldShape[key]}}assignProp(this,"shape",shape);return shape},checks:[]});return clone(schema,def)}function required(Class,schema,mask){const def=mergeDefs(schema._zod.def,{get shape(){const oldShape=schema._zod.def.shape;const shape={...oldShape};if(mask){for(const key in mask){if(!(key in shape)){throw new Error(`Unrecognized key: "${key}"`)}if(!mask[key])continue;shape[key]=new Class({type:"nonoptional",innerType:oldShape[key]})}}else{for(const key in oldShape){shape[key]=new Class({type:"nonoptional",innerType:oldShape[key]})}}assignProp(this,"shape",shape);return shape}});return clone(schema,def)}function aborted(x2,startIndex=0){if(x2.aborted===true)return true;for(let i=startIndex;i<x2.issues.length;i++){if(x2.issues[i]?.continue!==true){return true}}return false}function explicitlyAborted(x2,startIndex=0){if(x2.aborted===true)return true;for(let i=startIndex;i<x2.issues.length;i++){if(x2.issues[i]?.continue===false){return true}}return false}function prefixIssues(path,issues){return issues.map((iss)=>{var _a2;(_a2=iss).path??(_a2.path=[]);iss.path.unshift(path);return iss})}function unwrapMessage(message){return typeof message==="string"?message:message?.message}function finalizeIssue(iss,ctx,config2){const message=iss.message?iss.message:unwrapMessage(iss.inst?._zod.def?.error?.(iss))??unwrapMessage(ctx?.error?.(iss))??unwrapMessage(config2.customError?.(iss))??unwrapMessage(config2.localeError?.(iss))??"Invalid input";const{inst:_inst,continue:_continue,input:_input,...rest}=iss;rest.path??(rest.path=[]);rest.message=message;if(ctx?.reportInput){rest.input=_input}return rest}function getSizableOrigin(input){if(input instanceof Set)return"set";if(input instanceof Map)return"map";if(input instanceof File)return"file";return"unknown"}function getLengthableOrigin(input){if(Array.isArray(input))return"array";if(typeof input==="string")return"string";return"unknown"}function parsedType(data){const t=typeof data;switch(t){case"number":{return Number.isNaN(data)?"nan":"number"}case"object":{if(data===null){return"null"}if(Array.isArray(data)){return"array"}const obj=data;if(obj&&Object.getPrototypeOf(obj)!==Object.prototype&&"constructor"in obj&&obj.constructor){return obj.constructor.name}}}return t}function issue(...args){const[iss,input,inst]=args;if(typeof iss==="string"){return{message:iss,code:"custom",input,inst}}return{...iss}}function cleanEnum(obj){return Object.entries(obj).filter(([k3,_3])=>{return Number.isNaN(Number.parseInt(k3,10))}).map((el)=>el[1])}function base64ToUint8Array(base64){const binaryString=atob(base64);const bytes=new Uint8Array(binaryString.length);for(let i=0;i<binaryString.length;i++){bytes[i]=binaryString.charCodeAt(i)}return bytes}function uint8ArrayToBase64(bytes){let binaryString="";for(let i=0;i<bytes.length;i++){binaryString+=String.fromCharCode(bytes[i])}return btoa(binaryString)}function base64urlToUint8Array(base64url){const base64=base64url.replace(/-/g,"+").replace(/_/g,"/");const padding="=".repeat((4-base64.length%4)%4);return base64ToUint8Array(base64+padding)}function uint8ArrayToBase64url(bytes){return uint8ArrayToBase64(bytes).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function hexToUint8Array(hex){const cleanHex=hex.replace(/^0x/,"");if(cleanHex.length%2!==0){throw new Error("Invalid hex string length")}const bytes=new Uint8Array(cleanHex.length/2);for(let i=0;i<cleanHex.length;i+=2){bytes[i/2]=Number.parseInt(cleanHex.slice(i,i+2),16)}return bytes}function uint8ArrayToHex(bytes){return Array.from(bytes).map((b3)=>b3.toString(16).padStart(2,"0")).join("")}class Class{constructor(..._args){}}var initializer=(inst,def)=>{inst.name="$ZodError";Object.defineProperty(inst,"_zod",{value:inst._zod,enumerable:false});Object.defineProperty(inst,"issues",{value:def,enumerable:false});inst.message=JSON.stringify(def,jsonStringifyReplacer,2);Object.defineProperty(inst,"toString",{value:()=>inst.message,enumerable:false})};var $ZodError=$constructor("$ZodError",initializer);var $ZodRealError=$constructor("$ZodError",initializer,{Parent:Error});function flattenError(error,mapper=(issue2)=>issue2.message){const fieldErrors={};const formErrors=[];for(const sub of error.issues){if(sub.path.length>0){fieldErrors[sub.path[0]]=fieldErrors[sub.path[0]]||[];fieldErrors[sub.path[0]].push(mapper(sub))}else{formErrors.push(mapper(sub))}}return{formErrors,fieldErrors}}function formatError(error,mapper=(issue2)=>issue2.message){const fieldErrors={_errors:[]};const processError=(error2,path=[])=>{for(const issue2 of error2.issues){if(issue2.code==="invalid_union"&&issue2.errors.length){issue2.errors.map((issues)=>processError({issues},[...path,...issue2.path]))}else if(issue2.code==="invalid_key"){processError({issues:issue2.issues},[...path,...issue2.path])}else if(issue2.code==="invalid_element"){processError({issues:issue2.issues},[...path,...issue2.path])}else{const fullpath=[...path,...issue2.path];if(fullpath.length===0){fieldErrors._errors.push(mapper(issue2))}else{let curr=fieldErrors;let i=0;while(i<fullpath.length){const el=fullpath[i];const terminal=i===fullpath.length-1;if(!terminal){curr[el]=curr[el]||{_errors:[]}}else{curr[el]=curr[el]||{_errors:[]};curr[el]._errors.push(mapper(issue2))}curr=curr[el];i++}}}}};processError(error);return fieldErrors}var _parse=(_Err)=>(schema,value,_ctx,_params)=>{const ctx=_ctx?{..._ctx,async:false}:{async:false};const result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise){throw new $ZodAsyncError}if(result.issues.length){const e2=new(_params?.Err??_Err)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())));captureStackTrace(e2,_params?.callee);throw e2}return result.value};var _parseAsync=(_Err)=>async(schema,value,_ctx,params)=>{const ctx=_ctx?{..._ctx,async:true}:{async:true};let result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise)result=await result;if(result.issues.length){const e2=new(params?.Err??_Err)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())));captureStackTrace(e2,params?.callee);throw e2}return result.value};var _safeParse=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,async:false}:{async:false};const result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise){throw new $ZodAsyncError}return result.issues.length?{success:false,error:new(_Err??$ZodError)(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))}:{success:true,data:result.value}};var safeParse=_safeParse($ZodRealError);var _safeParseAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,async:true}:{async:true};let result=schema._zod.run({value,issues:[]},ctx);if(result instanceof Promise)result=await result;return result.issues.length?{success:false,error:new _Err(result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))}:{success:true,data:result.value}};var safeParseAsync=_safeParseAsync($ZodRealError);var _encode=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _parse(_Err)(schema,value,ctx)};var _decode=(_Err)=>(schema,value,_ctx)=>{return _parse(_Err)(schema,value,_ctx)};var _encodeAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _parseAsync(_Err)(schema,value,ctx)};var _decodeAsync=(_Err)=>async(schema,value,_ctx)=>{return _parseAsync(_Err)(schema,value,_ctx)};var _safeEncode=(_Err)=>(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _safeParse(_Err)(schema,value,ctx)};var _safeDecode=(_Err)=>(schema,value,_ctx)=>{return _safeParse(_Err)(schema,value,_ctx)};var _safeEncodeAsync=(_Err)=>async(schema,value,_ctx)=>{const ctx=_ctx?{..._ctx,direction:"backward"}:{direction:"backward"};return _safeParseAsync(_Err)(schema,value,ctx)};var _safeDecodeAsync=(_Err)=>async(schema,value,_ctx)=>{return _safeParseAsync(_Err)(schema,value,_ctx)};var cuid=/^[cC][0-9a-z]{6,}$/;var cuid2=/^[0-9a-z]+$/;var ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;var xid=/^[0-9a-vA-V]{20}$/;var ksuid=/^[A-Za-z0-9]{27}$/;var nanoid=/^[a-zA-Z0-9_-]{21}$/;var duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var guid=/^([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})$/;var uuid=(version)=>{if(!version)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var _emoji=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function emoji(){return new RegExp(_emoji,"u")}var 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])$/;var ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var cidrv4=/^((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])$/;var cidrv6=/^(([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])$/;var base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;var base64url=/^[A-Za-z0-9_-]*$/;var httpProtocol=/^https?$/;var e164=/^\+[1-9]\d{6,14}$/;var 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])))`;var date=new RegExp(`^${dateSource}$`);function timeSource(args){const hhmm=`(?:[01]\\d|2[0-3]):[0-5]\\d`;const regex=typeof args.precision==="number"?args.precision===-1?`${hhmm}`:args.precision===0?`${hhmm}:[0-5]\\d`:`${hhmm}:[0-5]\\d\\.\\d{${args.precision}}`:`${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;return regex}function time(args){return new RegExp(`^${timeSource(args)}$`)}function datetime(args){const time2=timeSource({precision:args.precision});const opts=["Z"];if(args.local)opts.push("");if(args.offset)opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);const timeRegex=`${time2}(?:${opts.join("|")})`;return new RegExp(`^${dateSource}T(?:${timeRegex})$`)}var string=(params)=>{const regex=params?`[\\s\\S]{${params?.minimum??0},${params?.maximum??""}}`:`[\\s\\S]*`;return new RegExp(`^${regex}$`)};var integer=/^-?\d+$/;var number=/^-?\d+(?:\.\d+)?$/;var boolean=/^(?:true|false)$/i;var lowercase=/^[^A-Z]*$/;var uppercase=/^[^a-z]*$/;var $ZodCheck=$constructor("$ZodCheck",(inst,def)=>{var _a2;inst._zod??(inst._zod={});inst._zod.def=def;(_a2=inst._zod).onattach??(_a2.onattach=[])});var numericOriginMap={number:"number",bigint:"bigint",object:"date"};var $ZodCheckLessThan=$constructor("$ZodCheckLessThan",(inst,def)=>{$ZodCheck.init(inst,def);const origin=numericOriginMap[typeof def.value];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;const curr=(def.inclusive?bag.maximum:bag.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(def.value<curr){if(def.inclusive)bag.maximum=def.value;else bag.exclusiveMaximum=def.value}});inst._zod.check=(payload)=>{if(def.inclusive?payload.value<=def.value:payload.value<def.value){return}payload.issues.push({origin,code:"too_big",maximum:typeof def.value==="object"?def.value.getTime():def.value,input:payload.value,inclusive:def.inclusive,inst,continue:!def.abort})}});var $ZodCheckGreaterThan=$constructor("$ZodCheckGreaterThan",(inst,def)=>{$ZodCheck.init(inst,def);const origin=numericOriginMap[typeof def.value];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;const curr=(def.inclusive?bag.minimum:bag.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(def.value>curr){if(def.inclusive)bag.minimum=def.value;else bag.exclusiveMinimum=def.value}});inst._zod.check=(payload)=>{if(def.inclusive?payload.value>=def.value:payload.value>def.value){return}payload.issues.push({origin,code:"too_small",minimum:typeof def.value==="object"?def.value.getTime():def.value,input:payload.value,inclusive:def.inclusive,inst,continue:!def.abort})}});var $ZodCheckMultipleOf=$constructor("$ZodCheckMultipleOf",(inst,def)=>{$ZodCheck.init(inst,def);inst._zod.onattach.push((inst2)=>{var _a2;(_a2=inst2._zod.bag).multipleOf??(_a2.multipleOf=def.value)});inst._zod.check=(payload)=>{if(typeof payload.value!==typeof def.value)throw new Error("Cannot mix number and bigint in multiple_of check.");const isMultiple=typeof payload.value==="bigint"?payload.value%def.value===BigInt(0):floatSafeRemainder(payload.value,def.value)===0;if(isMultiple)return;payload.issues.push({origin:typeof payload.value,code:"not_multiple_of",divisor:def.value,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckNumberFormat=$constructor("$ZodCheckNumberFormat",(inst,def)=>{$ZodCheck.init(inst,def);def.format=def.format||"float64";const isInt=def.format?.includes("int");const origin=isInt?"int":"number";const[minimum,maximum]=NUMBER_FORMAT_RANGES[def.format];inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.format=def.format;bag.minimum=minimum;bag.maximum=maximum;if(isInt)bag.pattern=integer});inst._zod.check=(payload)=>{const input=payload.value;if(isInt){if(!Number.isInteger(input)){payload.issues.push({expected:origin,format:def.format,code:"invalid_type",continue:false,input,inst});return}if(!Number.isSafeInteger(input)){if(input>0){payload.issues.push({input,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst,origin,inclusive:true,continue:!def.abort})}else{payload.issues.push({input,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst,origin,inclusive:true,continue:!def.abort})}return}}if(input<minimum){payload.issues.push({origin:"number",input,code:"too_small",minimum,inclusive:true,inst,continue:!def.abort})}if(input>maximum){payload.issues.push({origin:"number",input,code:"too_big",maximum,inclusive:true,inst,continue:!def.abort})}}});var $ZodCheckMaxLength=$constructor("$ZodCheckMaxLength",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const curr=inst2._zod.bag.maximum??Number.POSITIVE_INFINITY;if(def.maximum<curr)inst2._zod.bag.maximum=def.maximum});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length<=def.maximum)return;const origin=getLengthableOrigin(input);payload.issues.push({origin,code:"too_big",maximum:def.maximum,inclusive:true,input,inst,continue:!def.abort})}});var $ZodCheckMinLength=$constructor("$ZodCheckMinLength",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const curr=inst2._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(def.minimum>curr)inst2._zod.bag.minimum=def.minimum});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length>=def.minimum)return;const origin=getLengthableOrigin(input);payload.issues.push({origin,code:"too_small",minimum:def.minimum,inclusive:true,input,inst,continue:!def.abort})}});var $ZodCheckLengthEquals=$constructor("$ZodCheckLengthEquals",(inst,def)=>{var _a2;$ZodCheck.init(inst,def);(_a2=inst._zod.def).when??(_a2.when=(payload)=>{const val=payload.value;return!nullish(val)&&val.length!==undefined});inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.minimum=def.length;bag.maximum=def.length;bag.length=def.length});inst._zod.check=(payload)=>{const input=payload.value;const length=input.length;if(length===def.length)return;const origin=getLengthableOrigin(input);const tooBig=length>def.length;payload.issues.push({origin,...tooBig?{code:"too_big",maximum:def.length}:{code:"too_small",minimum:def.length},inclusive:true,exact:true,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckStringFormat=$constructor("$ZodCheckStringFormat",(inst,def)=>{var _a2,_b;$ZodCheck.init(inst,def);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.format=def.format;if(def.pattern){bag.patterns??(bag.patterns=new Set);bag.patterns.add(def.pattern)}});if(def.pattern)(_a2=inst._zod).check??(_a2.check=(payload)=>{def.pattern.lastIndex=0;if(def.pattern.test(payload.value))return;payload.issues.push({origin:"string",code:"invalid_format",format:def.format,input:payload.value,...def.pattern?{pattern:def.pattern.toString()}:{},inst,continue:!def.abort})});else(_b=inst._zod).check??(_b.check=()=>{})});var $ZodCheckRegex=$constructor("$ZodCheckRegex",(inst,def)=>{$ZodCheckStringFormat.init(inst,def);inst._zod.check=(payload)=>{def.pattern.lastIndex=0;if(def.pattern.test(payload.value))return;payload.issues.push({origin:"string",code:"invalid_format",format:"regex",input:payload.value,pattern:def.pattern.toString(),inst,continue:!def.abort})}});var $ZodCheckLowerCase=$constructor("$ZodCheckLowerCase",(inst,def)=>{def.pattern??(def.pattern=lowercase);$ZodCheckStringFormat.init(inst,def)});var $ZodCheckUpperCase=$constructor("$ZodCheckUpperCase",(inst,def)=>{def.pattern??(def.pattern=uppercase);$ZodCheckStringFormat.init(inst,def)});var $ZodCheckIncludes=$constructor("$ZodCheckIncludes",(inst,def)=>{$ZodCheck.init(inst,def);const escapedRegex=escapeRegex(def.includes);const pattern=new RegExp(typeof def.position==="number"?`^.{${def.position}}${escapedRegex}`:escapedRegex);def.pattern=pattern;inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.includes(def.includes,def.position))return;payload.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:def.includes,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckStartsWith=$constructor("$ZodCheckStartsWith",(inst,def)=>{$ZodCheck.init(inst,def);const pattern=new RegExp(`^${escapeRegex(def.prefix)}.*`);def.pattern??(def.pattern=pattern);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.startsWith(def.prefix))return;payload.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:def.prefix,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckEndsWith=$constructor("$ZodCheckEndsWith",(inst,def)=>{$ZodCheck.init(inst,def);const pattern=new RegExp(`.*${escapeRegex(def.suffix)}$`);def.pattern??(def.pattern=pattern);inst._zod.onattach.push((inst2)=>{const bag=inst2._zod.bag;bag.patterns??(bag.patterns=new Set);bag.patterns.add(pattern)});inst._zod.check=(payload)=>{if(payload.value.endsWith(def.suffix))return;payload.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:def.suffix,input:payload.value,inst,continue:!def.abort})}});var $ZodCheckOverwrite=$constructor("$ZodCheckOverwrite",(inst,def)=>{$ZodCheck.init(inst,def);inst._zod.check=(payload)=>{payload.value=def.tx(payload.value)}});class Doc{constructor(args=[]){this.content=[];this.indent=0;if(this)this.args=args}indented(fn){this.indent+=1;fn(this);this.indent-=1}write(arg){if(typeof arg==="function"){arg(this,{execution:"sync"});arg(this,{execution:"async"});return}const content=arg;const lines=content.split(`
|
|
53
73
|
`).filter((x2)=>x2);const minIndent=Math.min(...lines.map((x2)=>x2.length-x2.trimStart().length));const dedented=lines.map((x2)=>x2.slice(minIndent)).map((x2)=>" ".repeat(this.indent*2)+x2);for(const line of dedented){this.content.push(line)}}compile(){const F2=Function;const args=this?.args;const content=this?.content??[``];const lines=[...content.map((x2)=>` ${x2}`)];return new F2(...args,lines.join(`
|
|
54
74
|
`))}}var version={major:4,minor:4,patch:3};var $ZodType=$constructor("$ZodType",(inst,def)=>{var _a2;inst??(inst={});inst._zod.def=def;inst._zod.bag=inst._zod.bag||{};inst._zod.version=version;const checks=[...inst._zod.def.checks??[]];if(inst._zod.traits.has("$ZodCheck")){checks.unshift(inst)}for(const ch of checks){for(const fn of ch._zod.onattach){fn(inst)}}if(checks.length===0){(_a2=inst._zod).deferred??(_a2.deferred=[]);inst._zod.deferred?.push(()=>{inst._zod.run=inst._zod.parse})}else{const runChecks=(payload,checks2,ctx)=>{let isAborted=aborted(payload);let asyncResult;for(const ch of checks2){if(ch._zod.def.when){if(explicitlyAborted(payload))continue;const shouldRun=ch._zod.def.when(payload);if(!shouldRun)continue}else if(isAborted){continue}const currLen=payload.issues.length;const _3=ch._zod.check(payload);if(_3 instanceof Promise&&ctx?.async===false){throw new $ZodAsyncError}if(asyncResult||_3 instanceof Promise){asyncResult=(asyncResult??Promise.resolve()).then(async()=>{await _3;const nextLen=payload.issues.length;if(nextLen===currLen)return;if(!isAborted)isAborted=aborted(payload,currLen)})}else{const nextLen=payload.issues.length;if(nextLen===currLen)continue;if(!isAborted)isAborted=aborted(payload,currLen)}}if(asyncResult){return asyncResult.then(()=>{return payload})}return payload};const handleCanaryResult=(canary,payload,ctx)=>{if(aborted(canary)){canary.aborted=true;return canary}const checkResult=runChecks(payload,checks,ctx);if(checkResult instanceof Promise){if(ctx.async===false)throw new $ZodAsyncError;return checkResult.then((checkResult2)=>inst._zod.parse(checkResult2,ctx))}return inst._zod.parse(checkResult,ctx)};inst._zod.run=(payload,ctx)=>{if(ctx.skipChecks){return inst._zod.parse(payload,ctx)}if(ctx.direction==="backward"){const canary=inst._zod.parse({value:payload.value,issues:[]},{...ctx,skipChecks:true});if(canary instanceof Promise){return canary.then((canary2)=>{return handleCanaryResult(canary2,payload,ctx)})}return handleCanaryResult(canary,payload,ctx)}const result=inst._zod.parse(payload,ctx);if(result instanceof Promise){if(ctx.async===false)throw new $ZodAsyncError;return result.then((result2)=>runChecks(result2,checks,ctx))}return runChecks(result,checks,ctx)}}defineLazy(inst,"~standard",()=>({validate:(value)=>{try{const r2=safeParse(inst,value);return r2.success?{value:r2.data}:{issues:r2.error?.issues}}catch(_3){return safeParseAsync(inst,value).then((r2)=>r2.success?{value:r2.data}:{issues:r2.error?.issues})}},vendor:"zod",version:1}))});var $ZodString=$constructor("$ZodString",(inst,def)=>{$ZodType.init(inst,def);inst._zod.pattern=[...inst?._zod.bag?.patterns??[]].pop()??string(inst._zod.bag);inst._zod.parse=(payload,_3)=>{if(def.coerce)try{payload.value=String(payload.value)}catch(_4){}if(typeof payload.value==="string")return payload;payload.issues.push({expected:"string",code:"invalid_type",input:payload.value,inst});return payload}});var $ZodStringFormat=$constructor("$ZodStringFormat",(inst,def)=>{$ZodCheckStringFormat.init(inst,def);$ZodString.init(inst,def)});var $ZodGUID=$constructor("$ZodGUID",(inst,def)=>{def.pattern??(def.pattern=guid);$ZodStringFormat.init(inst,def)});var $ZodUUID=$constructor("$ZodUUID",(inst,def)=>{if(def.version){const versionMap={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8};const v=versionMap[def.version];if(v===undefined)throw new Error(`Invalid UUID version: "${def.version}"`);def.pattern??(def.pattern=uuid(v))}else def.pattern??(def.pattern=uuid());$ZodStringFormat.init(inst,def)});var $ZodEmail=$constructor("$ZodEmail",(inst,def)=>{def.pattern??(def.pattern=email);$ZodStringFormat.init(inst,def)});var $ZodURL=$constructor("$ZodURL",(inst,def)=>{$ZodStringFormat.init(inst,def);inst._zod.check=(payload)=>{try{const trimmed=payload.value.trim();if(!def.normalize&&def.protocol?.source===httpProtocol.source){if(!/^https?:\/\//i.test(trimmed)){payload.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:payload.value,inst,continue:!def.abort});return}}const url=new URL(trimmed);if(def.hostname){def.hostname.lastIndex=0;if(!def.hostname.test(url.hostname)){payload.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:def.hostname.source,input:payload.value,inst,continue:!def.abort})}}if(def.protocol){def.protocol.lastIndex=0;if(!def.protocol.test(url.protocol.endsWith(":")?url.protocol.slice(0,-1):url.protocol)){payload.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:def.protocol.source,input:payload.value,inst,continue:!def.abort})}}if(def.normalize){payload.value=url.href}else{payload.value=trimmed}return}catch(_3){payload.issues.push({code:"invalid_format",format:"url",input:payload.value,inst,continue:!def.abort})}}});var $ZodEmoji=$constructor("$ZodEmoji",(inst,def)=>{def.pattern??(def.pattern=emoji());$ZodStringFormat.init(inst,def)});var $ZodNanoID=$constructor("$ZodNanoID",(inst,def)=>{def.pattern??(def.pattern=nanoid);$ZodStringFormat.init(inst,def)});var $ZodCUID=$constructor("$ZodCUID",(inst,def)=>{def.pattern??(def.pattern=cuid);$ZodStringFormat.init(inst,def)});var $ZodCUID2=$constructor("$ZodCUID2",(inst,def)=>{def.pattern??(def.pattern=cuid2);$ZodStringFormat.init(inst,def)});var $ZodULID=$constructor("$ZodULID",(inst,def)=>{def.pattern??(def.pattern=ulid);$ZodStringFormat.init(inst,def)});var $ZodXID=$constructor("$ZodXID",(inst,def)=>{def.pattern??(def.pattern=xid);$ZodStringFormat.init(inst,def)});var $ZodKSUID=$constructor("$ZodKSUID",(inst,def)=>{def.pattern??(def.pattern=ksuid);$ZodStringFormat.init(inst,def)});var $ZodISODateTime=$constructor("$ZodISODateTime",(inst,def)=>{def.pattern??(def.pattern=datetime(def));$ZodStringFormat.init(inst,def)});var $ZodISODate=$constructor("$ZodISODate",(inst,def)=>{def.pattern??(def.pattern=date);$ZodStringFormat.init(inst,def)});var $ZodISOTime=$constructor("$ZodISOTime",(inst,def)=>{def.pattern??(def.pattern=time(def));$ZodStringFormat.init(inst,def)});var $ZodISODuration=$constructor("$ZodISODuration",(inst,def)=>{def.pattern??(def.pattern=duration);$ZodStringFormat.init(inst,def)});var $ZodIPv4=$constructor("$ZodIPv4",(inst,def)=>{def.pattern??(def.pattern=ipv4);$ZodStringFormat.init(inst,def);inst._zod.bag.format=`ipv4`});var $ZodIPv6=$constructor("$ZodIPv6",(inst,def)=>{def.pattern??(def.pattern=ipv6);$ZodStringFormat.init(inst,def);inst._zod.bag.format=`ipv6`;inst._zod.check=(payload)=>{try{new URL(`http://[${payload.value}]`)}catch{payload.issues.push({code:"invalid_format",format:"ipv6",input:payload.value,inst,continue:!def.abort})}}});var $ZodCIDRv4=$constructor("$ZodCIDRv4",(inst,def)=>{def.pattern??(def.pattern=cidrv4);$ZodStringFormat.init(inst,def)});var $ZodCIDRv6=$constructor("$ZodCIDRv6",(inst,def)=>{def.pattern??(def.pattern=cidrv6);$ZodStringFormat.init(inst,def);inst._zod.check=(payload)=>{const parts=payload.value.split("/");try{if(parts.length!==2)throw new Error;const[address,prefix]=parts;if(!prefix)throw new Error;const prefixNum=Number(prefix);if(`${prefixNum}`!==prefix)throw new Error;if(prefixNum<0||prefixNum>128)throw new Error;new URL(`http://[${address}]`)}catch{payload.issues.push({code:"invalid_format",format:"cidrv6",input:payload.value,inst,continue:!def.abort})}}});function isValidBase64(data){if(data==="")return true;if(/\s/.test(data))return false;if(data.length%4!==0)return false;try{atob(data);return true}catch{return false}}var $ZodBase64=$constructor("$ZodBase64",(inst,def)=>{def.pattern??(def.pattern=base64);$ZodStringFormat.init(inst,def);inst._zod.bag.contentEncoding="base64";inst._zod.check=(payload)=>{if(isValidBase64(payload.value))return;payload.issues.push({code:"invalid_format",format:"base64",input:payload.value,inst,continue:!def.abort})}});function isValidBase64URL(data){if(!base64url.test(data))return false;const base642=data.replace(/[-_]/g,(c)=>c==="-"?"+":"/");const padded=base642.padEnd(Math.ceil(base642.length/4)*4,"=");return isValidBase64(padded)}var $ZodBase64URL=$constructor("$ZodBase64URL",(inst,def)=>{def.pattern??(def.pattern=base64url);$ZodStringFormat.init(inst,def);inst._zod.bag.contentEncoding="base64url";inst._zod.check=(payload)=>{if(isValidBase64URL(payload.value))return;payload.issues.push({code:"invalid_format",format:"base64url",input:payload.value,inst,continue:!def.abort})}});var $ZodE164=$constructor("$ZodE164",(inst,def)=>{def.pattern??(def.pattern=e164);$ZodStringFormat.init(inst,def)});function isValidJWT(token,algorithm=null){try{const tokensParts=token.split(".");if(tokensParts.length!==3)return false;const[header]=tokensParts;if(!header)return false;const parsedHeader=JSON.parse(atob(header));if("typ"in parsedHeader&&parsedHeader?.typ!=="JWT")return false;if(!parsedHeader.alg)return false;if(algorithm&&(!("alg"in parsedHeader)||parsedHeader.alg!==algorithm))return false;return true}catch{return false}}var $ZodJWT=$constructor("$ZodJWT",(inst,def)=>{$ZodStringFormat.init(inst,def);inst._zod.check=(payload)=>{if(isValidJWT(payload.value,def.alg))return;payload.issues.push({code:"invalid_format",format:"jwt",input:payload.value,inst,continue:!def.abort})}});var $ZodNumber=$constructor("$ZodNumber",(inst,def)=>{$ZodType.init(inst,def);inst._zod.pattern=inst._zod.bag.pattern??number;inst._zod.parse=(payload,_ctx)=>{if(def.coerce)try{payload.value=Number(payload.value)}catch(_3){}const input=payload.value;if(typeof input==="number"&&!Number.isNaN(input)&&Number.isFinite(input)){return payload}const received=typeof input==="number"?Number.isNaN(input)?"NaN":!Number.isFinite(input)?"Infinity":undefined:undefined;payload.issues.push({expected:"number",code:"invalid_type",input,inst,...received?{received}:{}});return payload}});var $ZodNumberFormat=$constructor("$ZodNumberFormat",(inst,def)=>{$ZodCheckNumberFormat.init(inst,def);$ZodNumber.init(inst,def)});var $ZodBoolean=$constructor("$ZodBoolean",(inst,def)=>{$ZodType.init(inst,def);inst._zod.pattern=boolean;inst._zod.parse=(payload,_ctx)=>{if(def.coerce)try{payload.value=Boolean(payload.value)}catch(_3){}const input=payload.value;if(typeof input==="boolean")return payload;payload.issues.push({expected:"boolean",code:"invalid_type",input,inst});return payload}});var $ZodUnknown=$constructor("$ZodUnknown",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload)=>payload});var $ZodNever=$constructor("$ZodNever",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,_ctx)=>{payload.issues.push({expected:"never",code:"invalid_type",input:payload.value,inst});return payload}});function handleArrayResult(result,final,index){if(result.issues.length){final.issues.push(...prefixIssues(index,result.issues))}final.value[index]=result.value}var $ZodArray=$constructor("$ZodArray",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,ctx)=>{const input=payload.value;if(!Array.isArray(input)){payload.issues.push({expected:"array",code:"invalid_type",input,inst});return payload}payload.value=Array(input.length);const proms=[];for(let i=0;i<input.length;i++){const item=input[i];const result=def.element._zod.run({value:item,issues:[]},ctx);if(result instanceof Promise){proms.push(result.then((result2)=>handleArrayResult(result2,payload,i)))}else{handleArrayResult(result,payload,i)}}if(proms.length){return Promise.all(proms).then(()=>payload)}return payload}});function handlePropertyResult(result,final,key,input,isOptionalIn,isOptionalOut){const isPresent=key in input;if(result.issues.length){if(isOptionalIn&&isOptionalOut&&!isPresent){return}final.issues.push(...prefixIssues(key,result.issues))}if(!isPresent&&!isOptionalIn){if(!result.issues.length){final.issues.push({code:"invalid_type",expected:"nonoptional",input:undefined,path:[key]})}return}if(result.value===undefined){if(isPresent){final.value[key]=undefined}}else{final.value[key]=result.value}}function normalizeDef(def){const keys=Object.keys(def.shape);for(const k3 of keys){if(!def.shape?.[k3]?._zod?.traits?.has("$ZodType")){throw new Error(`Invalid element at key "${k3}": expected a Zod schema`)}}const okeys=optionalKeys(def.shape);return{...def,keys,keySet:new Set(keys),numKeys:keys.length,optionalKeys:new Set(okeys)}}function handleCatchall(proms,input,payload,ctx,def,inst){const unrecognized=[];const keySet=def.keySet;const _catchall=def.catchall._zod;const t=_catchall.def.type;const isOptionalIn=_catchall.optin==="optional";const isOptionalOut=_catchall.optout==="optional";for(const key in input){if(key==="__proto__")continue;if(keySet.has(key))continue;if(t==="never"){unrecognized.push(key);continue}const r2=_catchall.run({value:input[key],issues:[]},ctx);if(r2 instanceof Promise){proms.push(r2.then((r3)=>handlePropertyResult(r3,payload,key,input,isOptionalIn,isOptionalOut)))}else{handlePropertyResult(r2,payload,key,input,isOptionalIn,isOptionalOut)}}if(unrecognized.length){payload.issues.push({code:"unrecognized_keys",keys:unrecognized,input,inst})}if(!proms.length)return payload;return Promise.all(proms).then(()=>{return payload})}var $ZodObject=$constructor("$ZodObject",(inst,def)=>{$ZodType.init(inst,def);const desc=Object.getOwnPropertyDescriptor(def,"shape");if(!desc?.get){const sh=def.shape;Object.defineProperty(def,"shape",{get:()=>{const newSh={...sh};Object.defineProperty(def,"shape",{value:newSh});return newSh}})}const _normalized=cached(()=>normalizeDef(def));defineLazy(inst._zod,"propValues",()=>{const shape=def.shape;const propValues={};for(const key in shape){const field=shape[key]._zod;if(field.values){propValues[key]??(propValues[key]=new Set);for(const v of field.values)propValues[key].add(v)}}return propValues});const isObject2=isObject;const catchall=def.catchall;let value;inst._zod.parse=(payload,ctx)=>{value??(value=_normalized.value);const input=payload.value;if(!isObject2(input)){payload.issues.push({expected:"object",code:"invalid_type",input,inst});return payload}payload.value={};const proms=[];const shape=value.shape;for(const key of value.keys){const el=shape[key];const isOptionalIn=el._zod.optin==="optional";const isOptionalOut=el._zod.optout==="optional";const r2=el._zod.run({value:input[key],issues:[]},ctx);if(r2 instanceof Promise){proms.push(r2.then((r3)=>handlePropertyResult(r3,payload,key,input,isOptionalIn,isOptionalOut)))}else{handlePropertyResult(r2,payload,key,input,isOptionalIn,isOptionalOut)}}if(!catchall){return proms.length?Promise.all(proms).then(()=>payload):payload}return handleCatchall(proms,input,payload,ctx,_normalized.value,inst)}});var $ZodObjectJIT=$constructor("$ZodObjectJIT",(inst,def)=>{$ZodObject.init(inst,def);const superParse=inst._zod.parse;const _normalized=cached(()=>normalizeDef(def));const generateFastpass=(shape)=>{const doc=new Doc(["shape","payload","ctx"]);const normalized=_normalized.value;const parseStr=(key)=>{const k3=esc(key);return`shape[${k3}]._zod.run({ value: input[${k3}], issues: [] }, ctx)`};doc.write(`const input = payload.value;`);const ids=Object.create(null);let counter=0;for(const key of normalized.keys){ids[key]=`key_${counter++}`}doc.write(`const newResult = {};`);for(const key of normalized.keys){const id=ids[key];const k3=esc(key);const schema=shape[key];const isOptionalIn=schema?._zod?.optin==="optional";const isOptionalOut=schema?._zod?.optout==="optional";doc.write(`const ${id} = ${parseStr(key)};`);if(isOptionalIn&&isOptionalOut){doc.write(`
|
|
55
75
|
if (${id}.issues.length) {
|
|
@@ -110,12 +130,260 @@ ${import_picocolors.default.gray(d2)} ${t}
|
|
|
110
130
|
newResult[${k3}] = ${id}.value;
|
|
111
131
|
}
|
|
112
132
|
|
|
113
|
-
`)}}doc.write(`payload.value = newResult;`);doc.write(`return payload;`);const fn=doc.compile();return(payload,ctx)=>fn(shape,payload,ctx)};let fastpass;const isObject2=isObject;const jit=!globalConfig.jitless;const allowsEval2=allowsEval;const fastEnabled=jit&&allowsEval2.value;const catchall=def.catchall;let value;inst._zod.parse=(payload,ctx)=>{value??(value=_normalized.value);const input=payload.value;if(!isObject2(input)){payload.issues.push({expected:"object",code:"invalid_type",input,inst});return payload}if(jit&&fastEnabled&&ctx?.async===false&&ctx.jitless!==true){if(!fastpass)fastpass=generateFastpass(def.shape);payload=fastpass(payload,ctx);if(!catchall)return payload;return handleCatchall([],input,payload,ctx,value,inst)}return superParse(payload,ctx)}});function handleUnionResults(results,final,inst,ctx){for(const result of results){if(result.issues.length===0){final.value=result.value;return final}}const nonaborted=results.filter((r2)=>!aborted(r2));if(nonaborted.length===1){final.value=nonaborted[0].value;return nonaborted[0]}final.issues.push({code:"invalid_union",input:final.value,inst,errors:results.map((result)=>result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))});return final}var $ZodUnion=$constructor("$ZodUnion",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"optin",()=>def.options.some((o2)=>o2._zod.optin==="optional")?"optional":undefined);defineLazy(inst._zod,"optout",()=>def.options.some((o2)=>o2._zod.optout==="optional")?"optional":undefined);defineLazy(inst._zod,"values",()=>{if(def.options.every((o2)=>o2._zod.values)){return new Set(def.options.flatMap((option)=>Array.from(option._zod.values)))}return});defineLazy(inst._zod,"pattern",()=>{if(def.options.every((o2)=>o2._zod.pattern)){const patterns=def.options.map((o2)=>o2._zod.pattern);return new RegExp(`^(${patterns.map((p2)=>cleanRegex(p2.source)).join("|")})$`)}return});const first=def.options.length===1?def.options[0]._zod.run:null;inst._zod.parse=(payload,ctx)=>{if(first){return first(payload,ctx)}let async=false;const results=[];for(const option of def.options){const result=option._zod.run({value:payload.value,issues:[]},ctx);if(result instanceof Promise){results.push(result);async=true}else{if(result.issues.length===0)return result;results.push(result)}}if(!async)return handleUnionResults(results,payload,inst,ctx);return Promise.all(results).then((results2)=>{return handleUnionResults(results2,payload,inst,ctx)})}});var $ZodDiscriminatedUnion=$constructor("$ZodDiscriminatedUnion",(inst,def)=>{def.inclusive=false;$ZodUnion.init(inst,def);const _super=inst._zod.parse;defineLazy(inst._zod,"propValues",()=>{const propValues={};for(const option of def.options){const pv=option._zod.propValues;if(!pv||Object.keys(pv).length===0)throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);for(const[k3,v]of Object.entries(pv)){if(!propValues[k3])propValues[k3]=new Set;for(const val of v){propValues[k3].add(val)}}}return propValues});const disc=cached(()=>{const opts=def.options;const map=new Map;for(const o2 of opts){const values=o2._zod.propValues?.[def.discriminator];if(!values||values.size===0)throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);for(const v of values){if(map.has(v)){throw new Error(`Duplicate discriminator value "${String(v)}"`)}map.set(v,o2)}}return map});inst._zod.parse=(payload,ctx)=>{const input=payload.value;if(!isObject(input)){payload.issues.push({code:"invalid_type",expected:"object",input,inst});return payload}const opt=disc.value.get(input?.[def.discriminator]);if(opt){return opt._zod.run(payload,ctx)}if(def.unionFallback||ctx.direction==="backward"){return _super(payload,ctx)}payload.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:def.discriminator,options:Array.from(disc.value.keys()),input,path:[def.discriminator],inst});return payload}});var $ZodIntersection=$constructor("$ZodIntersection",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,ctx)=>{const input=payload.value;const left=def.left._zod.run({value:input,issues:[]},ctx);const right=def.right._zod.run({value:input,issues:[]},ctx);const async=left instanceof Promise||right instanceof Promise;if(async){return Promise.all([left,right]).then(([left2,right2])=>{return handleIntersectionResults(payload,left2,right2)})}return handleIntersectionResults(payload,left,right)}});function mergeValues(a,b3){if(a===b3){return{valid:true,data:a}}if(a instanceof Date&&b3 instanceof Date&&+a===+b3){return{valid:true,data:a}}if(isPlainObject(a)&&isPlainObject(b3)){const bKeys=Object.keys(b3);const sharedKeys=Object.keys(a).filter((key)=>bKeys.indexOf(key)!==-1);const newObj={...a,...b3};for(const key of sharedKeys){const sharedValue=mergeValues(a[key],b3[key]);if(!sharedValue.valid){return{valid:false,mergeErrorPath:[key,...sharedValue.mergeErrorPath]}}newObj[key]=sharedValue.data}return{valid:true,data:newObj}}if(Array.isArray(a)&&Array.isArray(b3)){if(a.length!==b3.length){return{valid:false,mergeErrorPath:[]}}const newArray=[];for(let index=0;index<a.length;index++){const itemA=a[index];const itemB=b3[index];const sharedValue=mergeValues(itemA,itemB);if(!sharedValue.valid){return{valid:false,mergeErrorPath:[index,...sharedValue.mergeErrorPath]}}newArray.push(sharedValue.data)}return{valid:true,data:newArray}}return{valid:false,mergeErrorPath:[]}}function handleIntersectionResults(result,left,right){const unrecKeys=new Map;let unrecIssue;for(const iss of left.issues){if(iss.code==="unrecognized_keys"){unrecIssue??(unrecIssue=iss);for(const k3 of iss.keys){if(!unrecKeys.has(k3))unrecKeys.set(k3,{});unrecKeys.get(k3).l=true}}else{result.issues.push(iss)}}for(const iss of right.issues){if(iss.code==="unrecognized_keys"){for(const k3 of iss.keys){if(!unrecKeys.has(k3))unrecKeys.set(k3,{});unrecKeys.get(k3).r=true}}else{result.issues.push(iss)}}const bothKeys=[...unrecKeys].filter(([,f])=>f.l&&f.r).map(([k3])=>k3);if(bothKeys.length&&unrecIssue){result.issues.push({...unrecIssue,keys:bothKeys})}if(aborted(result))return result;const merged=mergeValues(left.value,right.value);if(!merged.valid){throw new Error(`Unmergable intersection. Error path: `+`${JSON.stringify(merged.mergeErrorPath)}`)}result.value=merged.data;return result}var $ZodRecord=$constructor("$ZodRecord",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,ctx)=>{const input=payload.value;if(!isPlainObject(input)){payload.issues.push({expected:"record",code:"invalid_type",input,inst});return payload}const proms=[];const values=def.keyType._zod.values;if(values){payload.value={};const recordKeys=new Set;for(const key of values){if(typeof key==="string"||typeof key==="number"||typeof key==="symbol"){recordKeys.add(typeof key==="number"?key.toString():key);const keyResult=def.keyType._zod.run({value:key,issues:[]},ctx);if(keyResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(keyResult.issues.length){payload.issues.push({code:"invalid_key",origin:"record",issues:keyResult.issues.map((iss)=>finalizeIssue(iss,ctx,config())),input:key,path:[key],inst});continue}const outKey=keyResult.value;const result=def.valueType._zod.run({value:input[key],issues:[]},ctx);if(result instanceof Promise){proms.push(result.then((result2)=>{if(result2.issues.length){payload.issues.push(...prefixIssues(key,result2.issues))}payload.value[outKey]=result2.value}))}else{if(result.issues.length){payload.issues.push(...prefixIssues(key,result.issues))}payload.value[outKey]=result.value}}}let unrecognized;for(const key in input){if(!recordKeys.has(key)){unrecognized=unrecognized??[];unrecognized.push(key)}}if(unrecognized&&unrecognized.length>0){payload.issues.push({code:"unrecognized_keys",input,inst,keys:unrecognized})}}else{payload.value={};for(const key of Reflect.ownKeys(input)){if(key==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(input,key))continue;let keyResult=def.keyType._zod.run({value:key,issues:[]},ctx);if(keyResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}const checkNumericKey=typeof key==="string"&&number.test(key)&&keyResult.issues.length;if(checkNumericKey){const retryResult=def.keyType._zod.run({value:Number(key),issues:[]},ctx);if(retryResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(retryResult.issues.length===0){keyResult=retryResult}}if(keyResult.issues.length){if(def.mode==="loose"){payload.value[key]=input[key]}else{payload.issues.push({code:"invalid_key",origin:"record",issues:keyResult.issues.map((iss)=>finalizeIssue(iss,ctx,config())),input:key,path:[key],inst})}continue}const result=def.valueType._zod.run({value:input[key],issues:[]},ctx);if(result instanceof Promise){proms.push(result.then((result2)=>{if(result2.issues.length){payload.issues.push(...prefixIssues(key,result2.issues))}payload.value[keyResult.value]=result2.value}))}else{if(result.issues.length){payload.issues.push(...prefixIssues(key,result.issues))}payload.value[keyResult.value]=result.value}}}if(proms.length){return Promise.all(proms).then(()=>payload)}return payload}});var $ZodEnum=$constructor("$ZodEnum",(inst,def)=>{$ZodType.init(inst,def);const values=getEnumValues(def.entries);const valuesSet=new Set(values);inst._zod.values=valuesSet;inst._zod.pattern=new RegExp(`^(${values.filter((k3)=>propertyKeyTypes.has(typeof k3)).map((o2)=>typeof o2==="string"?escapeRegex(o2):o2.toString()).join("|")})$`);inst._zod.parse=(payload,_ctx)=>{const input=payload.value;if(valuesSet.has(input)){return payload}payload.issues.push({code:"invalid_value",values,input,inst});return payload}});var $ZodLiteral=$constructor("$ZodLiteral",(inst,def)=>{$ZodType.init(inst,def);if(def.values.length===0){throw new Error("Cannot create literal schema with no valid values")}const values=new Set(def.values);inst._zod.values=values;inst._zod.pattern=new RegExp(`^(${def.values.map((o2)=>typeof o2==="string"?escapeRegex(o2):o2?escapeRegex(o2.toString()):String(o2)).join("|")})$`);inst._zod.parse=(payload,_ctx)=>{const input=payload.value;if(values.has(input)){return payload}payload.issues.push({code:"invalid_value",values:def.values,input,inst});return payload}});var $ZodTransform=$constructor("$ZodTransform",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){throw new $ZodEncodeError(inst.constructor.name)}const _out=def.transform(payload.value,payload);if(ctx.async){const output=_out instanceof Promise?_out:Promise.resolve(_out);return output.then((output2)=>{payload.value=output2;payload.fallback=true;return payload})}if(_out instanceof Promise){throw new $ZodAsyncError}payload.value=_out;payload.fallback=true;return payload}});function handleOptionalResult(result,input){if(input===undefined&&(result.issues.length||result.fallback)){return{issues:[],value:undefined}}return result}var $ZodOptional=$constructor("$ZodOptional",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";inst._zod.optout="optional";defineLazy(inst._zod,"values",()=>{return def.innerType._zod.values?new Set([...def.innerType._zod.values,undefined]):undefined});defineLazy(inst._zod,"pattern",()=>{const pattern=def.innerType._zod.pattern;return pattern?new RegExp(`^(${cleanRegex(pattern.source)})?$`):undefined});inst._zod.parse=(payload,ctx)=>{if(def.innerType._zod.optin==="optional"){const input=payload.value;const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise)return result.then((r2)=>handleOptionalResult(r2,input));return handleOptionalResult(result,input)}if(payload.value===undefined){return payload}return def.innerType._zod.run(payload,ctx)}});var $ZodExactOptional=$constructor("$ZodExactOptional",(inst,def)=>{$ZodOptional.init(inst,def);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);defineLazy(inst._zod,"pattern",()=>def.innerType._zod.pattern);inst._zod.parse=(payload,ctx)=>{return def.innerType._zod.run(payload,ctx)}});var $ZodNullable=$constructor("$ZodNullable",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"optin",()=>def.innerType._zod.optin);defineLazy(inst._zod,"optout",()=>def.innerType._zod.optout);defineLazy(inst._zod,"pattern",()=>{const pattern=def.innerType._zod.pattern;return pattern?new RegExp(`^(${cleanRegex(pattern.source)}|null)$`):undefined});defineLazy(inst._zod,"values",()=>{return def.innerType._zod.values?new Set([...def.innerType._zod.values,null]):undefined});inst._zod.parse=(payload,ctx)=>{if(payload.value===null)return payload;return def.innerType._zod.run(payload,ctx)}});var $ZodDefault=$constructor("$ZodDefault",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}if(payload.value===undefined){payload.value=def.defaultValue;return payload}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>handleDefaultResult(result2,def))}return handleDefaultResult(result,def)}});function handleDefaultResult(payload,def){if(payload.value===undefined){payload.value=def.defaultValue}return payload}var $ZodPrefault=$constructor("$ZodPrefault",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}if(payload.value===undefined){payload.value=def.defaultValue}return def.innerType._zod.run(payload,ctx)}});var $ZodNonOptional=$constructor("$ZodNonOptional",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"values",()=>{const v=def.innerType._zod.values;return v?new Set([...v].filter((x2)=>x2!==undefined)):undefined});inst._zod.parse=(payload,ctx)=>{const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>handleNonOptionalResult(result2,inst))}return handleNonOptionalResult(result,inst)}});function handleNonOptionalResult(payload,inst){if(!payload.issues.length&&payload.value===undefined){payload.issues.push({code:"invalid_type",expected:"nonoptional",input:payload.value,inst})}return payload}var $ZodCatch=$constructor("$ZodCatch",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"optout",()=>def.innerType._zod.optout);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>{payload.value=result2.value;if(result2.issues.length){payload.value=def.catchValue({...payload,error:{issues:result2.issues.map((iss)=>finalizeIssue(iss,ctx,config()))},input:payload.value});payload.issues=[];payload.fallback=true}return payload})}payload.value=result.value;if(result.issues.length){payload.value=def.catchValue({...payload,error:{issues:result.issues.map((iss)=>finalizeIssue(iss,ctx,config()))},input:payload.value});payload.issues=[];payload.fallback=true}return payload}});var $ZodPipe=$constructor("$ZodPipe",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"values",()=>def.in._zod.values);defineLazy(inst._zod,"optin",()=>def.in._zod.optin);defineLazy(inst._zod,"optout",()=>def.out._zod.optout);defineLazy(inst._zod,"propValues",()=>def.in._zod.propValues);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){const right=def.out._zod.run(payload,ctx);if(right instanceof Promise){return right.then((right2)=>handlePipeResult(right2,def.in,ctx))}return handlePipeResult(right,def.in,ctx)}const left=def.in._zod.run(payload,ctx);if(left instanceof Promise){return left.then((left2)=>handlePipeResult(left2,def.out,ctx))}return handlePipeResult(left,def.out,ctx)}});function handlePipeResult(left,next,ctx){if(left.issues.length){left.aborted=true;return left}return next._zod.run({value:left.value,issues:left.issues,fallback:left.fallback},ctx)}var $ZodReadonly=$constructor("$ZodReadonly",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"propValues",()=>def.innerType._zod.propValues);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);defineLazy(inst._zod,"optin",()=>def.innerType?._zod?.optin);defineLazy(inst._zod,"optout",()=>def.innerType?._zod?.optout);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then(handleReadonlyResult)}return handleReadonlyResult(result)}});function handleReadonlyResult(payload){payload.value=Object.freeze(payload.value);return payload}var $ZodCustom=$constructor("$ZodCustom",(inst,def)=>{$ZodCheck.init(inst,def);$ZodType.init(inst,def);inst._zod.parse=(payload,_3)=>{return payload};inst._zod.check=(payload)=>{const input=payload.value;const r2=def.fn(input);if(r2 instanceof Promise){return r2.then((r3)=>handleRefineResult(r3,payload,input,inst))}handleRefineResult(r2,payload,input,inst);return}});function handleRefineResult(result,payload,input,inst){if(!result){const _iss={code:"custom",input,inst,path:[...inst._zod.def.path??[]],continue:!inst._zod.def.abort};if(inst._zod.def.params)_iss.params=inst._zod.def.params;payload.issues.push(issue(_iss))}}var _a2;var $output=Symbol("ZodOutput");var $input=Symbol("ZodInput");class $ZodRegistry{constructor(){this._map=new WeakMap;this._idmap=new Map}add(schema,..._meta){const meta=_meta[0];this._map.set(schema,meta);if(meta&&typeof meta==="object"&&"id"in meta){this._idmap.set(meta.id,schema)}return this}clear(){this._map=new WeakMap;this._idmap=new Map;return this}remove(schema){const meta=this._map.get(schema);if(meta&&typeof meta==="object"&&"id"in meta){this._idmap.delete(meta.id)}this._map.delete(schema);return this}get(schema){const p2=schema._zod.parent;if(p2){const pm={...this.get(p2)??{}};delete pm.id;const f={...pm,...this._map.get(schema)};return Object.keys(f).length?f:undefined}return this._map.get(schema)}has(schema){return this._map.has(schema)}}function registry(){return new $ZodRegistry}(_a2=globalThis).__zod_globalRegistry??(_a2.__zod_globalRegistry=registry());var globalRegistry=globalThis.__zod_globalRegistry;function _string(Class2,params){return new Class2({type:"string",...normalizeParams(params)})}function _email(Class2,params){return new Class2({type:"string",format:"email",check:"string_format",abort:false,...normalizeParams(params)})}function _guid(Class2,params){return new Class2({type:"string",format:"guid",check:"string_format",abort:false,...normalizeParams(params)})}function _uuid(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,...normalizeParams(params)})}function _uuidv4(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v4",...normalizeParams(params)})}function _uuidv6(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v6",...normalizeParams(params)})}function _uuidv7(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v7",...normalizeParams(params)})}function _url(Class2,params){return new Class2({type:"string",format:"url",check:"string_format",abort:false,...normalizeParams(params)})}function _emoji2(Class2,params){return new Class2({type:"string",format:"emoji",check:"string_format",abort:false,...normalizeParams(params)})}function _nanoid(Class2,params){return new Class2({type:"string",format:"nanoid",check:"string_format",abort:false,...normalizeParams(params)})}function _cuid(Class2,params){return new Class2({type:"string",format:"cuid",check:"string_format",abort:false,...normalizeParams(params)})}function _cuid2(Class2,params){return new Class2({type:"string",format:"cuid2",check:"string_format",abort:false,...normalizeParams(params)})}function _ulid(Class2,params){return new Class2({type:"string",format:"ulid",check:"string_format",abort:false,...normalizeParams(params)})}function _xid(Class2,params){return new Class2({type:"string",format:"xid",check:"string_format",abort:false,...normalizeParams(params)})}function _ksuid(Class2,params){return new Class2({type:"string",format:"ksuid",check:"string_format",abort:false,...normalizeParams(params)})}function _ipv4(Class2,params){return new Class2({type:"string",format:"ipv4",check:"string_format",abort:false,...normalizeParams(params)})}function _ipv6(Class2,params){return new Class2({type:"string",format:"ipv6",check:"string_format",abort:false,...normalizeParams(params)})}function _cidrv4(Class2,params){return new Class2({type:"string",format:"cidrv4",check:"string_format",abort:false,...normalizeParams(params)})}function _cidrv6(Class2,params){return new Class2({type:"string",format:"cidrv6",check:"string_format",abort:false,...normalizeParams(params)})}function _base64(Class2,params){return new Class2({type:"string",format:"base64",check:"string_format",abort:false,...normalizeParams(params)})}function _base64url(Class2,params){return new Class2({type:"string",format:"base64url",check:"string_format",abort:false,...normalizeParams(params)})}function _e164(Class2,params){return new Class2({type:"string",format:"e164",check:"string_format",abort:false,...normalizeParams(params)})}function _jwt(Class2,params){return new Class2({type:"string",format:"jwt",check:"string_format",abort:false,...normalizeParams(params)})}function _isoDateTime(Class2,params){return new Class2({type:"string",format:"datetime",check:"string_format",offset:false,local:false,precision:null,...normalizeParams(params)})}function _isoDate(Class2,params){return new Class2({type:"string",format:"date",check:"string_format",...normalizeParams(params)})}function _isoTime(Class2,params){return new Class2({type:"string",format:"time",check:"string_format",precision:null,...normalizeParams(params)})}function _isoDuration(Class2,params){return new Class2({type:"string",format:"duration",check:"string_format",...normalizeParams(params)})}function _number(Class2,params){return new Class2({type:"number",checks:[],...normalizeParams(params)})}function _int(Class2,params){return new Class2({type:"number",check:"number_format",abort:false,format:"safeint",...normalizeParams(params)})}function _boolean(Class2,params){return new Class2({type:"boolean",...normalizeParams(params)})}function _unknown(Class2){return new Class2({type:"unknown"})}function _never(Class2,params){return new Class2({type:"never",...normalizeParams(params)})}function _lt(value,params){return new $ZodCheckLessThan({check:"less_than",...normalizeParams(params),value,inclusive:false})}function _lte(value,params){return new $ZodCheckLessThan({check:"less_than",...normalizeParams(params),value,inclusive:true})}function _gt(value,params){return new $ZodCheckGreaterThan({check:"greater_than",...normalizeParams(params),value,inclusive:false})}function _gte(value,params){return new $ZodCheckGreaterThan({check:"greater_than",...normalizeParams(params),value,inclusive:true})}function _multipleOf(value,params){return new $ZodCheckMultipleOf({check:"multiple_of",...normalizeParams(params),value})}function _maxLength(maximum,params){const ch=new $ZodCheckMaxLength({check:"max_length",...normalizeParams(params),maximum});return ch}function _minLength(minimum,params){return new $ZodCheckMinLength({check:"min_length",...normalizeParams(params),minimum})}function _length(length,params){return new $ZodCheckLengthEquals({check:"length_equals",...normalizeParams(params),length})}function _regex(pattern,params){return new $ZodCheckRegex({check:"string_format",format:"regex",...normalizeParams(params),pattern})}function _lowercase(params){return new $ZodCheckLowerCase({check:"string_format",format:"lowercase",...normalizeParams(params)})}function _uppercase(params){return new $ZodCheckUpperCase({check:"string_format",format:"uppercase",...normalizeParams(params)})}function _includes(includes,params){return new $ZodCheckIncludes({check:"string_format",format:"includes",...normalizeParams(params),includes})}function _startsWith(prefix,params){return new $ZodCheckStartsWith({check:"string_format",format:"starts_with",...normalizeParams(params),prefix})}function _endsWith(suffix,params){return new $ZodCheckEndsWith({check:"string_format",format:"ends_with",...normalizeParams(params),suffix})}function _overwrite(tx){return new $ZodCheckOverwrite({check:"overwrite",tx})}function _normalize(form){return _overwrite((input)=>input.normalize(form))}function _trim(){return _overwrite((input)=>input.trim())}function _toLowerCase(){return _overwrite((input)=>input.toLowerCase())}function _toUpperCase(){return _overwrite((input)=>input.toUpperCase())}function _slugify(){return _overwrite((input)=>slugify(input))}function _array(Class2,element,params){return new Class2({type:"array",element,...normalizeParams(params)})}function _refine(Class2,fn,_params){const schema=new Class2({type:"custom",check:"custom",fn,...normalizeParams(_params)});return schema}function _superRefine(fn,params){const ch=_check((payload)=>{payload.addIssue=(issue2)=>{if(typeof issue2==="string"){payload.issues.push(issue(issue2,payload.value,ch._zod.def))}else{const _issue=issue2;if(_issue.fatal)_issue.continue=false;_issue.code??(_issue.code="custom");_issue.input??(_issue.input=payload.value);_issue.inst??(_issue.inst=ch);_issue.continue??(_issue.continue=!ch._zod.def.abort);payload.issues.push(issue(_issue))}};return fn(payload.value,payload)},params);return ch}function _check(fn,params){const ch=new $ZodCheck({check:"custom",...normalizeParams(params)});ch._zod.check=fn;return ch}function initializeContext(params){let target=params?.target??"draft-2020-12";if(target==="draft-4")target="draft-04";if(target==="draft-7")target="draft-07";return{processors:params.processors??{},metadataRegistry:params?.metadata??globalRegistry,target,unrepresentable:params?.unrepresentable??"throw",override:params?.override??(()=>{}),io:params?.io??"output",counter:0,seen:new Map,cycles:params?.cycles??"ref",reused:params?.reused??"inline",external:params?.external??undefined}}function process2(schema,ctx,_params={path:[],schemaPath:[]}){var _a3;const def=schema._zod.def;const seen=ctx.seen.get(schema);if(seen){seen.count++;const isCycle=_params.schemaPath.includes(schema);if(isCycle){seen.cycle=_params.path}return seen.schema}const result={schema:{},count:1,cycle:undefined,path:_params.path};ctx.seen.set(schema,result);const overrideSchema=schema._zod.toJSONSchema?.();if(overrideSchema){result.schema=overrideSchema}else{const params={..._params,schemaPath:[..._params.schemaPath,schema],path:_params.path};if(schema._zod.processJSONSchema){schema._zod.processJSONSchema(ctx,result.schema,params)}else{const _json=result.schema;const processor=ctx.processors[def.type];if(!processor){throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`)}processor(schema,ctx,_json,params)}const parent=schema._zod.parent;if(parent){if(!result.ref)result.ref=parent;process2(parent,ctx,params);ctx.seen.get(parent).isParent=true}}const meta=ctx.metadataRegistry.get(schema);if(meta)Object.assign(result.schema,meta);if(ctx.io==="input"&&isTransforming(schema)){delete result.schema.examples;delete result.schema.default}if(ctx.io==="input"&&"_prefault"in result.schema)(_a3=result.schema).default??(_a3.default=result.schema._prefault);delete result.schema._prefault;const _result=ctx.seen.get(schema);return _result.schema}function extractDefs(ctx,schema){const root=ctx.seen.get(schema);if(!root)throw new Error("Unprocessed schema. This is a bug in Zod.");const idToSchema=new Map;for(const entry of ctx.seen.entries()){const id=ctx.metadataRegistry.get(entry[0])?.id;if(id){const existing=idToSchema.get(id);if(existing&&existing!==entry[0]){throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`)}idToSchema.set(id,entry[0])}}const makeURI=(entry)=>{const defsSegment=ctx.target==="draft-2020-12"?"$defs":"definitions";if(ctx.external){const externalId=ctx.external.registry.get(entry[0])?.id;const uriGenerator=ctx.external.uri??((id2)=>id2);if(externalId){return{ref:uriGenerator(externalId)}}const id=entry[1].defId??entry[1].schema.id??`schema${ctx.counter++}`;entry[1].defId=id;return{defId:id,ref:`${uriGenerator("__shared")}#/${defsSegment}/${id}`}}if(entry[1]===root){return{ref:"#"}}const uriPrefix=`#`;const defUriPrefix=`${uriPrefix}/${defsSegment}/`;const defId=entry[1].schema.id??`__schema${ctx.counter++}`;return{defId,ref:defUriPrefix+defId}};const extractToDef=(entry)=>{if(entry[1].schema.$ref){return}const seen=entry[1];const{ref,defId}=makeURI(entry);seen.def={...seen.schema};if(defId)seen.defId=defId;const schema2=seen.schema;for(const key in schema2){delete schema2[key]}schema2.$ref=ref};if(ctx.cycles==="throw"){for(const entry of ctx.seen.entries()){const seen=entry[1];if(seen.cycle){throw new Error("Cycle detected: "+`#/${seen.cycle?.join("/")}/<root>`+'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.')}}}for(const entry of ctx.seen.entries()){const seen=entry[1];if(schema===entry[0]){extractToDef(entry);continue}if(ctx.external){const ext=ctx.external.registry.get(entry[0])?.id;if(schema!==entry[0]&&ext){extractToDef(entry);continue}}const id=ctx.metadataRegistry.get(entry[0])?.id;if(id){extractToDef(entry);continue}if(seen.cycle){extractToDef(entry);continue}if(seen.count>1){if(ctx.reused==="ref"){extractToDef(entry);continue}}}}function finalize(ctx,schema){const root=ctx.seen.get(schema);if(!root)throw new Error("Unprocessed schema. This is a bug in Zod.");const flattenRef=(zodSchema)=>{const seen=ctx.seen.get(zodSchema);if(seen.ref===null)return;const schema2=seen.def??seen.schema;const _cached={...schema2};const ref=seen.ref;seen.ref=null;if(ref){flattenRef(ref);const refSeen=ctx.seen.get(ref);const refSchema=refSeen.schema;if(refSchema.$ref&&(ctx.target==="draft-07"||ctx.target==="draft-04"||ctx.target==="openapi-3.0")){schema2.allOf=schema2.allOf??[];schema2.allOf.push(refSchema)}else{Object.assign(schema2,refSchema)}Object.assign(schema2,_cached);const isParentRef=zodSchema._zod.parent===ref;if(isParentRef){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(!(key in _cached)){delete schema2[key]}}}if(refSchema.$ref&&refSeen.def){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(key in refSeen.def&&JSON.stringify(schema2[key])===JSON.stringify(refSeen.def[key])){delete schema2[key]}}}}const parent=zodSchema._zod.parent;if(parent&&parent!==ref){flattenRef(parent);const parentSeen=ctx.seen.get(parent);if(parentSeen?.schema.$ref){schema2.$ref=parentSeen.schema.$ref;if(parentSeen.def){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(key in parentSeen.def&&JSON.stringify(schema2[key])===JSON.stringify(parentSeen.def[key])){delete schema2[key]}}}}}ctx.override({zodSchema,jsonSchema:schema2,path:seen.path??[]})};for(const entry of[...ctx.seen.entries()].reverse()){flattenRef(entry[0])}const result={};if(ctx.target==="draft-2020-12"){result.$schema="https://json-schema.org/draft/2020-12/schema"}else if(ctx.target==="draft-07"){result.$schema="http://json-schema.org/draft-07/schema#"}else if(ctx.target==="draft-04"){result.$schema="http://json-schema.org/draft-04/schema#"}else if(ctx.target==="openapi-3.0"){}else{}if(ctx.external?.uri){const id=ctx.external.registry.get(schema)?.id;if(!id)throw new Error("Schema is missing an `id` property");result.$id=ctx.external.uri(id)}Object.assign(result,root.def??root.schema);const rootMetaId=ctx.metadataRegistry.get(schema)?.id;if(rootMetaId!==undefined&&result.id===rootMetaId)delete result.id;const defs=ctx.external?.defs??{};for(const entry of ctx.seen.entries()){const seen=entry[1];if(seen.def&&seen.defId){if(seen.def.id===seen.defId)delete seen.def.id;defs[seen.defId]=seen.def}}if(ctx.external){}else{if(Object.keys(defs).length>0){if(ctx.target==="draft-2020-12"){result.$defs=defs}else{result.definitions=defs}}}try{const finalized=JSON.parse(JSON.stringify(result));Object.defineProperty(finalized,"~standard",{value:{...schema["~standard"],jsonSchema:{input:createStandardJSONSchemaMethod(schema,"input",ctx.processors),output:createStandardJSONSchemaMethod(schema,"output",ctx.processors)}},enumerable:false,writable:false});return finalized}catch(_err){throw new Error("Error converting schema to JSON.")}}function isTransforming(_schema,_ctx){const ctx=_ctx??{seen:new Set};if(ctx.seen.has(_schema))return false;ctx.seen.add(_schema);const def=_schema._zod.def;if(def.type==="transform")return true;if(def.type==="array")return isTransforming(def.element,ctx);if(def.type==="set")return isTransforming(def.valueType,ctx);if(def.type==="lazy")return isTransforming(def.getter(),ctx);if(def.type==="promise"||def.type==="optional"||def.type==="nonoptional"||def.type==="nullable"||def.type==="readonly"||def.type==="default"||def.type==="prefault"){return isTransforming(def.innerType,ctx)}if(def.type==="intersection"){return isTransforming(def.left,ctx)||isTransforming(def.right,ctx)}if(def.type==="record"||def.type==="map"){return isTransforming(def.keyType,ctx)||isTransforming(def.valueType,ctx)}if(def.type==="pipe"){if(_schema._zod.traits.has("$ZodCodec"))return true;return isTransforming(def.in,ctx)||isTransforming(def.out,ctx)}if(def.type==="object"){for(const key in def.shape){if(isTransforming(def.shape[key],ctx))return true}return false}if(def.type==="union"){for(const option of def.options){if(isTransforming(option,ctx))return true}return false}if(def.type==="tuple"){for(const item of def.items){if(isTransforming(item,ctx))return true}if(def.rest&&isTransforming(def.rest,ctx))return true;return false}return false}var createToJSONSchemaMethod=(schema,processors={})=>(params)=>{const ctx=initializeContext({...params,processors});process2(schema,ctx);extractDefs(ctx,schema);return finalize(ctx,schema)};var createStandardJSONSchemaMethod=(schema,io,processors={})=>(params)=>{const{libraryOptions,target}=params??{};const ctx=initializeContext({...libraryOptions??{},target,io,processors});process2(schema,ctx);extractDefs(ctx,schema);return finalize(ctx,schema)};var formatMap={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};var stringProcessor=(schema,ctx,_json,_params)=>{const json=_json;json.type="string";const{minimum,maximum,format,patterns,contentEncoding}=schema._zod.bag;if(typeof minimum==="number")json.minLength=minimum;if(typeof maximum==="number")json.maxLength=maximum;if(format){json.format=formatMap[format]??format;if(json.format==="")delete json.format;if(format==="time"){delete json.format}}if(contentEncoding)json.contentEncoding=contentEncoding;if(patterns&&patterns.size>0){const regexes=[...patterns];if(regexes.length===1)json.pattern=regexes[0].source;else if(regexes.length>1){json.allOf=[...regexes.map((regex)=>({...ctx.target==="draft-07"||ctx.target==="draft-04"||ctx.target==="openapi-3.0"?{type:"string"}:{},pattern:regex.source}))]}}};var numberProcessor=(schema,ctx,_json,_params)=>{const json=_json;const{minimum,maximum,format,multipleOf,exclusiveMaximum,exclusiveMinimum}=schema._zod.bag;if(typeof format==="string"&&format.includes("int"))json.type="integer";else json.type="number";const exMin=typeof exclusiveMinimum==="number"&&exclusiveMinimum>=(minimum??Number.NEGATIVE_INFINITY);const exMax=typeof exclusiveMaximum==="number"&&exclusiveMaximum<=(maximum??Number.POSITIVE_INFINITY);const legacy=ctx.target==="draft-04"||ctx.target==="openapi-3.0";if(exMin){if(legacy){json.minimum=exclusiveMinimum;json.exclusiveMinimum=true}else{json.exclusiveMinimum=exclusiveMinimum}}else if(typeof minimum==="number"){json.minimum=minimum}if(exMax){if(legacy){json.maximum=exclusiveMaximum;json.exclusiveMaximum=true}else{json.exclusiveMaximum=exclusiveMaximum}}else if(typeof maximum==="number"){json.maximum=maximum}if(typeof multipleOf==="number")json.multipleOf=multipleOf};var booleanProcessor=(_schema,_ctx,json,_params)=>{json.type="boolean"};var neverProcessor=(_schema,_ctx,json,_params)=>{json.not={}};var unknownProcessor=(_schema,_ctx,_json,_params)=>{};var enumProcessor=(schema,_ctx,json,_params)=>{const def=schema._zod.def;const values=getEnumValues(def.entries);if(values.every((v)=>typeof v==="number"))json.type="number";if(values.every((v)=>typeof v==="string"))json.type="string";json.enum=values};var literalProcessor=(schema,ctx,json,_params)=>{const def=schema._zod.def;const vals=[];for(const val of def.values){if(val===undefined){if(ctx.unrepresentable==="throw"){throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else{}}else if(typeof val==="bigint"){if(ctx.unrepresentable==="throw"){throw new Error("BigInt literals cannot be represented in JSON Schema")}else{vals.push(Number(val))}}else{vals.push(val)}}if(vals.length===0){}else if(vals.length===1){const val=vals[0];json.type=val===null?"null":typeof val;if(ctx.target==="draft-04"||ctx.target==="openapi-3.0"){json.enum=[val]}else{json.const=val}}else{if(vals.every((v)=>typeof v==="number"))json.type="number";if(vals.every((v)=>typeof v==="string"))json.type="string";if(vals.every((v)=>typeof v==="boolean"))json.type="boolean";if(vals.every((v)=>v===null))json.type="null";json.enum=vals}};var customProcessor=(_schema,ctx,_json,_params)=>{if(ctx.unrepresentable==="throw"){throw new Error("Custom types cannot be represented in JSON Schema")}};var transformProcessor=(_schema,ctx,_json,_params)=>{if(ctx.unrepresentable==="throw"){throw new Error("Transforms cannot be represented in JSON Schema")}};var arrayProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;const{minimum,maximum}=schema._zod.bag;if(typeof minimum==="number")json.minItems=minimum;if(typeof maximum==="number")json.maxItems=maximum;json.type="array";json.items=process2(def.element,ctx,{...params,path:[...params.path,"items"]})};var objectProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;json.type="object";json.properties={};const shape=def.shape;for(const key in shape){json.properties[key]=process2(shape[key],ctx,{...params,path:[...params.path,"properties",key]})}const allKeys=new Set(Object.keys(shape));const requiredKeys=new Set([...allKeys].filter((key)=>{const v=def.shape[key]._zod;if(ctx.io==="input"){return v.optin===undefined}else{return v.optout===undefined}}));if(requiredKeys.size>0){json.required=Array.from(requiredKeys)}if(def.catchall?._zod.def.type==="never"){json.additionalProperties=false}else if(!def.catchall){if(ctx.io==="output")json.additionalProperties=false}else if(def.catchall){json.additionalProperties=process2(def.catchall,ctx,{...params,path:[...params.path,"additionalProperties"]})}};var unionProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const isExclusive=def.inclusive===false;const options=def.options.map((x2,i)=>process2(x2,ctx,{...params,path:[...params.path,isExclusive?"oneOf":"anyOf",i]}));if(isExclusive){json.oneOf=options}else{json.anyOf=options}};var intersectionProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const a=process2(def.left,ctx,{...params,path:[...params.path,"allOf",0]});const b3=process2(def.right,ctx,{...params,path:[...params.path,"allOf",1]});const isSimpleIntersection=(val)=>("allOf"in val)&&Object.keys(val).length===1;const allOf=[...isSimpleIntersection(a)?a.allOf:[a],...isSimpleIntersection(b3)?b3.allOf:[b3]];json.allOf=allOf};var recordProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;json.type="object";const keyType=def.keyType;const keyBag=keyType._zod.bag;const patterns=keyBag?.patterns;if(def.mode==="loose"&&patterns&&patterns.size>0){const valueSchema=process2(def.valueType,ctx,{...params,path:[...params.path,"patternProperties","*"]});json.patternProperties={};for(const pattern of patterns){json.patternProperties[pattern.source]=valueSchema}}else{if(ctx.target==="draft-07"||ctx.target==="draft-2020-12"){json.propertyNames=process2(def.keyType,ctx,{...params,path:[...params.path,"propertyNames"]})}json.additionalProperties=process2(def.valueType,ctx,{...params,path:[...params.path,"additionalProperties"]})}const keyValues=keyType._zod.values;if(keyValues){const validKeyValues=[...keyValues].filter((v)=>typeof v==="string"||typeof v==="number");if(validKeyValues.length>0){json.required=validKeyValues}}};var nullableProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const inner=process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);if(ctx.target==="openapi-3.0"){seen.ref=def.innerType;json.nullable=true}else{json.anyOf=[inner,{type:"null"}]}};var nonoptionalProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType};var defaultProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;json.default=JSON.parse(JSON.stringify(def.defaultValue))};var prefaultProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;if(ctx.io==="input")json._prefault=JSON.parse(JSON.stringify(def.defaultValue))};var catchProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;let catchValue;try{catchValue=def.catchValue(undefined)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}json.default=catchValue};var pipeProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;const inIsTransform=def.in._zod.traits.has("$ZodTransform");const innerType=ctx.io==="input"?inIsTransform?def.out:def.in:def.out;process2(innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=innerType};var readonlyProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;json.readOnly=true};var optionalProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType};var ZodISODateTime=$constructor("ZodISODateTime",(inst,def)=>{$ZodISODateTime.init(inst,def);ZodStringFormat.init(inst,def)});function datetime2(params){return _isoDateTime(ZodISODateTime,params)}var ZodISODate=$constructor("ZodISODate",(inst,def)=>{$ZodISODate.init(inst,def);ZodStringFormat.init(inst,def)});function date2(params){return _isoDate(ZodISODate,params)}var ZodISOTime=$constructor("ZodISOTime",(inst,def)=>{$ZodISOTime.init(inst,def);ZodStringFormat.init(inst,def)});function time2(params){return _isoTime(ZodISOTime,params)}var ZodISODuration=$constructor("ZodISODuration",(inst,def)=>{$ZodISODuration.init(inst,def);ZodStringFormat.init(inst,def)});function duration2(params){return _isoDuration(ZodISODuration,params)}var initializer2=(inst,issues)=>{$ZodError.init(inst,issues);inst.name="ZodError";Object.defineProperties(inst,{format:{value:(mapper)=>formatError(inst,mapper)},flatten:{value:(mapper)=>flattenError(inst,mapper)},addIssue:{value:(issue2)=>{inst.issues.push(issue2);inst.message=JSON.stringify(inst.issues,jsonStringifyReplacer,2)}},addIssues:{value:(issues2)=>{inst.issues.push(...issues2);inst.message=JSON.stringify(inst.issues,jsonStringifyReplacer,2)}},isEmpty:{get(){return inst.issues.length===0}}})};var ZodRealError=$constructor("ZodError",initializer2,{Parent:Error});var parse3=_parse(ZodRealError);var parseAsync2=_parseAsync(ZodRealError);var safeParse2=_safeParse(ZodRealError);var safeParseAsync2=_safeParseAsync(ZodRealError);var encode=_encode(ZodRealError);var decode=_decode(ZodRealError);var encodeAsync=_encodeAsync(ZodRealError);var decodeAsync=_decodeAsync(ZodRealError);var safeEncode=_safeEncode(ZodRealError);var safeDecode=_safeDecode(ZodRealError);var safeEncodeAsync=_safeEncodeAsync(ZodRealError);var safeDecodeAsync=_safeDecodeAsync(ZodRealError);var _installedGroups=new WeakMap;function _installLazyMethods(inst,group,methods){const proto=Object.getPrototypeOf(inst);let installed=_installedGroups.get(proto);if(!installed){installed=new Set;_installedGroups.set(proto,installed)}if(installed.has(group))return;installed.add(group);for(const key in methods){const fn=methods[key];Object.defineProperty(proto,key,{configurable:true,enumerable:false,get(){const bound=fn.bind(this);Object.defineProperty(this,key,{configurable:true,writable:true,enumerable:true,value:bound});return bound},set(v){Object.defineProperty(this,key,{configurable:true,writable:true,enumerable:true,value:v})}})}}var ZodType=$constructor("ZodType",(inst,def)=>{$ZodType.init(inst,def);Object.assign(inst["~standard"],{jsonSchema:{input:createStandardJSONSchemaMethod(inst,"input"),output:createStandardJSONSchemaMethod(inst,"output")}});inst.toJSONSchema=createToJSONSchemaMethod(inst,{});inst.def=def;inst.type=def.type;Object.defineProperty(inst,"_def",{value:def});inst.parse=(data,params)=>parse3(inst,data,params,{callee:inst.parse});inst.safeParse=(data,params)=>safeParse2(inst,data,params);inst.parseAsync=async(data,params)=>parseAsync2(inst,data,params,{callee:inst.parseAsync});inst.safeParseAsync=async(data,params)=>safeParseAsync2(inst,data,params);inst.spa=inst.safeParseAsync;inst.encode=(data,params)=>encode(inst,data,params);inst.decode=(data,params)=>decode(inst,data,params);inst.encodeAsync=async(data,params)=>encodeAsync(inst,data,params);inst.decodeAsync=async(data,params)=>decodeAsync(inst,data,params);inst.safeEncode=(data,params)=>safeEncode(inst,data,params);inst.safeDecode=(data,params)=>safeDecode(inst,data,params);inst.safeEncodeAsync=async(data,params)=>safeEncodeAsync(inst,data,params);inst.safeDecodeAsync=async(data,params)=>safeDecodeAsync(inst,data,params);_installLazyMethods(inst,"ZodType",{check(...chks){const def2=this.def;return this.clone(exports_util.mergeDefs(def2,{checks:[...def2.checks??[],...chks.map((ch)=>typeof ch==="function"?{_zod:{check:ch,def:{check:"custom"},onattach:[]}}:ch)]}),{parent:true})},with(...chks){return this.check(...chks)},clone(def2,params){return clone(this,def2,params)},brand(){return this},register(reg,meta2){reg.add(this,meta2);return this},refine(check,params){return this.check(refine(check,params))},superRefine(refinement,params){return this.check(superRefine(refinement,params))},overwrite(fn){return this.check(_overwrite(fn))},optional(){return optional(this)},exactOptional(){return exactOptional(this)},nullable(){return nullable(this)},nullish(){return optional(nullable(this))},nonoptional(params){return nonoptional(this,params)},array(){return array(this)},or(arg){return union([this,arg])},and(arg){return intersection(this,arg)},transform(tx){return pipe(this,transform(tx))},default(d3){return _default(this,d3)},prefault(d3){return prefault(this,d3)},catch(params){return _catch(this,params)},pipe(target){return pipe(this,target)},readonly(){return readonly(this)},describe(description){const cl=this.clone();globalRegistry.add(cl,{description});return cl},meta(...args){if(args.length===0)return globalRegistry.get(this);const cl=this.clone();globalRegistry.add(cl,args[0]);return cl},isOptional(){return this.safeParse(undefined).success},isNullable(){return this.safeParse(null).success},apply(fn){return fn(this)}});Object.defineProperty(inst,"description",{get(){return globalRegistry.get(inst)?.description},configurable:true});return inst});var _ZodString=$constructor("_ZodString",(inst,def)=>{$ZodString.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>stringProcessor(inst,ctx,json,params);const bag=inst._zod.bag;inst.format=bag.format??null;inst.minLength=bag.minimum??null;inst.maxLength=bag.maximum??null;_installLazyMethods(inst,"_ZodString",{regex(...args){return this.check(_regex(...args))},includes(...args){return this.check(_includes(...args))},startsWith(...args){return this.check(_startsWith(...args))},endsWith(...args){return this.check(_endsWith(...args))},min(...args){return this.check(_minLength(...args))},max(...args){return this.check(_maxLength(...args))},length(...args){return this.check(_length(...args))},nonempty(...args){return this.check(_minLength(1,...args))},lowercase(params){return this.check(_lowercase(params))},uppercase(params){return this.check(_uppercase(params))},trim(){return this.check(_trim())},normalize(...args){return this.check(_normalize(...args))},toLowerCase(){return this.check(_toLowerCase())},toUpperCase(){return this.check(_toUpperCase())},slugify(){return this.check(_slugify())}})});var ZodString=$constructor("ZodString",(inst,def)=>{$ZodString.init(inst,def);_ZodString.init(inst,def);inst.email=(params)=>inst.check(_email(ZodEmail,params));inst.url=(params)=>inst.check(_url(ZodURL,params));inst.jwt=(params)=>inst.check(_jwt(ZodJWT,params));inst.emoji=(params)=>inst.check(_emoji2(ZodEmoji,params));inst.guid=(params)=>inst.check(_guid(ZodGUID,params));inst.uuid=(params)=>inst.check(_uuid(ZodUUID,params));inst.uuidv4=(params)=>inst.check(_uuidv4(ZodUUID,params));inst.uuidv6=(params)=>inst.check(_uuidv6(ZodUUID,params));inst.uuidv7=(params)=>inst.check(_uuidv7(ZodUUID,params));inst.nanoid=(params)=>inst.check(_nanoid(ZodNanoID,params));inst.guid=(params)=>inst.check(_guid(ZodGUID,params));inst.cuid=(params)=>inst.check(_cuid(ZodCUID,params));inst.cuid2=(params)=>inst.check(_cuid2(ZodCUID2,params));inst.ulid=(params)=>inst.check(_ulid(ZodULID,params));inst.base64=(params)=>inst.check(_base64(ZodBase64,params));inst.base64url=(params)=>inst.check(_base64url(ZodBase64URL,params));inst.xid=(params)=>inst.check(_xid(ZodXID,params));inst.ksuid=(params)=>inst.check(_ksuid(ZodKSUID,params));inst.ipv4=(params)=>inst.check(_ipv4(ZodIPv4,params));inst.ipv6=(params)=>inst.check(_ipv6(ZodIPv6,params));inst.cidrv4=(params)=>inst.check(_cidrv4(ZodCIDRv4,params));inst.cidrv6=(params)=>inst.check(_cidrv6(ZodCIDRv6,params));inst.e164=(params)=>inst.check(_e164(ZodE164,params));inst.datetime=(params)=>inst.check(datetime2(params));inst.date=(params)=>inst.check(date2(params));inst.time=(params)=>inst.check(time2(params));inst.duration=(params)=>inst.check(duration2(params))});function string2(params){return _string(ZodString,params)}var ZodStringFormat=$constructor("ZodStringFormat",(inst,def)=>{$ZodStringFormat.init(inst,def);_ZodString.init(inst,def)});var ZodEmail=$constructor("ZodEmail",(inst,def)=>{$ZodEmail.init(inst,def);ZodStringFormat.init(inst,def)});var ZodGUID=$constructor("ZodGUID",(inst,def)=>{$ZodGUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodUUID=$constructor("ZodUUID",(inst,def)=>{$ZodUUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodURL=$constructor("ZodURL",(inst,def)=>{$ZodURL.init(inst,def);ZodStringFormat.init(inst,def)});function url(params){return _url(ZodURL,params)}var ZodEmoji=$constructor("ZodEmoji",(inst,def)=>{$ZodEmoji.init(inst,def);ZodStringFormat.init(inst,def)});var ZodNanoID=$constructor("ZodNanoID",(inst,def)=>{$ZodNanoID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCUID=$constructor("ZodCUID",(inst,def)=>{$ZodCUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCUID2=$constructor("ZodCUID2",(inst,def)=>{$ZodCUID2.init(inst,def);ZodStringFormat.init(inst,def)});var ZodULID=$constructor("ZodULID",(inst,def)=>{$ZodULID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodXID=$constructor("ZodXID",(inst,def)=>{$ZodXID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodKSUID=$constructor("ZodKSUID",(inst,def)=>{$ZodKSUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodIPv4=$constructor("ZodIPv4",(inst,def)=>{$ZodIPv4.init(inst,def);ZodStringFormat.init(inst,def)});var ZodIPv6=$constructor("ZodIPv6",(inst,def)=>{$ZodIPv6.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCIDRv4=$constructor("ZodCIDRv4",(inst,def)=>{$ZodCIDRv4.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCIDRv6=$constructor("ZodCIDRv6",(inst,def)=>{$ZodCIDRv6.init(inst,def);ZodStringFormat.init(inst,def)});var ZodBase64=$constructor("ZodBase64",(inst,def)=>{$ZodBase64.init(inst,def);ZodStringFormat.init(inst,def)});var ZodBase64URL=$constructor("ZodBase64URL",(inst,def)=>{$ZodBase64URL.init(inst,def);ZodStringFormat.init(inst,def)});var ZodE164=$constructor("ZodE164",(inst,def)=>{$ZodE164.init(inst,def);ZodStringFormat.init(inst,def)});var ZodJWT=$constructor("ZodJWT",(inst,def)=>{$ZodJWT.init(inst,def);ZodStringFormat.init(inst,def)});var ZodNumber=$constructor("ZodNumber",(inst,def)=>{$ZodNumber.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>numberProcessor(inst,ctx,json,params);_installLazyMethods(inst,"ZodNumber",{gt(value,params){return this.check(_gt(value,params))},gte(value,params){return this.check(_gte(value,params))},min(value,params){return this.check(_gte(value,params))},lt(value,params){return this.check(_lt(value,params))},lte(value,params){return this.check(_lte(value,params))},max(value,params){return this.check(_lte(value,params))},int(params){return this.check(int(params))},safe(params){return this.check(int(params))},positive(params){return this.check(_gt(0,params))},nonnegative(params){return this.check(_gte(0,params))},negative(params){return this.check(_lt(0,params))},nonpositive(params){return this.check(_lte(0,params))},multipleOf(value,params){return this.check(_multipleOf(value,params))},step(value,params){return this.check(_multipleOf(value,params))},finite(){return this}});const bag=inst._zod.bag;inst.minValue=Math.max(bag.minimum??Number.NEGATIVE_INFINITY,bag.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null;inst.maxValue=Math.min(bag.maximum??Number.POSITIVE_INFINITY,bag.exclusiveMaximum??Number.POSITIVE_INFINITY)??null;inst.isInt=(bag.format??"").includes("int")||Number.isSafeInteger(bag.multipleOf??0.5);inst.isFinite=true;inst.format=bag.format??null});function number2(params){return _number(ZodNumber,params)}var ZodNumberFormat=$constructor("ZodNumberFormat",(inst,def)=>{$ZodNumberFormat.init(inst,def);ZodNumber.init(inst,def)});function int(params){return _int(ZodNumberFormat,params)}var ZodBoolean=$constructor("ZodBoolean",(inst,def)=>{$ZodBoolean.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>booleanProcessor(inst,ctx,json,params)});function boolean2(params){return _boolean(ZodBoolean,params)}var ZodUnknown=$constructor("ZodUnknown",(inst,def)=>{$ZodUnknown.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>unknownProcessor(inst,ctx,json,params)});function unknown(){return _unknown(ZodUnknown)}var ZodNever=$constructor("ZodNever",(inst,def)=>{$ZodNever.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>neverProcessor(inst,ctx,json,params)});function never(params){return _never(ZodNever,params)}var ZodArray=$constructor("ZodArray",(inst,def)=>{$ZodArray.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>arrayProcessor(inst,ctx,json,params);inst.element=def.element;_installLazyMethods(inst,"ZodArray",{min(n,params){return this.check(_minLength(n,params))},nonempty(params){return this.check(_minLength(1,params))},max(n,params){return this.check(_maxLength(n,params))},length(n,params){return this.check(_length(n,params))},unwrap(){return this.element}})});function array(element,params){return _array(ZodArray,element,params)}var ZodObject=$constructor("ZodObject",(inst,def)=>{$ZodObjectJIT.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>objectProcessor(inst,ctx,json,params);exports_util.defineLazy(inst,"shape",()=>{return def.shape});_installLazyMethods(inst,"ZodObject",{keyof(){return _enum(Object.keys(this._zod.def.shape))},catchall(catchall){return this.clone({...this._zod.def,catchall})},passthrough(){return this.clone({...this._zod.def,catchall:unknown()})},loose(){return this.clone({...this._zod.def,catchall:unknown()})},strict(){return this.clone({...this._zod.def,catchall:never()})},strip(){return this.clone({...this._zod.def,catchall:undefined})},extend(incoming){return exports_util.extend(this,incoming)},safeExtend(incoming){return exports_util.safeExtend(this,incoming)},merge(other){return exports_util.merge(this,other)},pick(mask){return exports_util.pick(this,mask)},omit(mask){return exports_util.omit(this,mask)},partial(...args){return exports_util.partial(ZodOptional,this,args[0])},required(...args){return exports_util.required(ZodNonOptional,this,args[0])}})});function object(shape,params){const def={type:"object",shape:shape??{},...exports_util.normalizeParams(params)};return new ZodObject(def)}var ZodUnion=$constructor("ZodUnion",(inst,def)=>{$ZodUnion.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>unionProcessor(inst,ctx,json,params);inst.options=def.options});function union(options,params){return new ZodUnion({type:"union",options,...exports_util.normalizeParams(params)})}var ZodDiscriminatedUnion=$constructor("ZodDiscriminatedUnion",(inst,def)=>{ZodUnion.init(inst,def);$ZodDiscriminatedUnion.init(inst,def)});function discriminatedUnion(discriminator,options,params){return new ZodDiscriminatedUnion({type:"union",options,discriminator,...exports_util.normalizeParams(params)})}var ZodIntersection=$constructor("ZodIntersection",(inst,def)=>{$ZodIntersection.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>intersectionProcessor(inst,ctx,json,params)});function intersection(left,right){return new ZodIntersection({type:"intersection",left,right})}var ZodRecord=$constructor("ZodRecord",(inst,def)=>{$ZodRecord.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>recordProcessor(inst,ctx,json,params);inst.keyType=def.keyType;inst.valueType=def.valueType});function record(keyType,valueType,params){if(!valueType||!valueType._zod){return new ZodRecord({type:"record",keyType:string2(),valueType:keyType,...exports_util.normalizeParams(valueType)})}return new ZodRecord({type:"record",keyType,valueType,...exports_util.normalizeParams(params)})}var ZodEnum=$constructor("ZodEnum",(inst,def)=>{$ZodEnum.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>enumProcessor(inst,ctx,json,params);inst.enum=def.entries;inst.options=Object.values(def.entries);const keys=new Set(Object.keys(def.entries));inst.extract=(values,params)=>{const newEntries={};for(const value of values){if(keys.has(value)){newEntries[value]=def.entries[value]}else throw new Error(`Key ${value} not found in enum`)}return new ZodEnum({...def,checks:[],...exports_util.normalizeParams(params),entries:newEntries})};inst.exclude=(values,params)=>{const newEntries={...def.entries};for(const value of values){if(keys.has(value)){delete newEntries[value]}else throw new Error(`Key ${value} not found in enum`)}return new ZodEnum({...def,checks:[],...exports_util.normalizeParams(params),entries:newEntries})}});function _enum(values,params){const entries=Array.isArray(values)?Object.fromEntries(values.map((v)=>[v,v])):values;return new ZodEnum({type:"enum",entries,...exports_util.normalizeParams(params)})}var ZodLiteral=$constructor("ZodLiteral",(inst,def)=>{$ZodLiteral.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>literalProcessor(inst,ctx,json,params);inst.values=new Set(def.values);Object.defineProperty(inst,"value",{get(){if(def.values.length>1){throw new Error("This schema contains multiple valid literal values. Use `.values` instead.")}return def.values[0]}})});function literal(value,params){return new ZodLiteral({type:"literal",values:Array.isArray(value)?value:[value],...exports_util.normalizeParams(params)})}var ZodTransform=$constructor("ZodTransform",(inst,def)=>{$ZodTransform.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>transformProcessor(inst,ctx,json,params);inst._zod.parse=(payload,_ctx)=>{if(_ctx.direction==="backward"){throw new $ZodEncodeError(inst.constructor.name)}payload.addIssue=(issue2)=>{if(typeof issue2==="string"){payload.issues.push(exports_util.issue(issue2,payload.value,def))}else{const _issue=issue2;if(_issue.fatal)_issue.continue=false;_issue.code??(_issue.code="custom");_issue.input??(_issue.input=payload.value);_issue.inst??(_issue.inst=inst);payload.issues.push(exports_util.issue(_issue))}};const output=def.transform(payload.value,payload);if(output instanceof Promise){return output.then((output2)=>{payload.value=output2;payload.fallback=true;return payload})}payload.value=output;payload.fallback=true;return payload}});function transform(fn){return new ZodTransform({type:"transform",transform:fn})}var ZodOptional=$constructor("ZodOptional",(inst,def)=>{$ZodOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>optionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function optional(innerType){return new ZodOptional({type:"optional",innerType})}var ZodExactOptional=$constructor("ZodExactOptional",(inst,def)=>{$ZodExactOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>optionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function exactOptional(innerType){return new ZodExactOptional({type:"optional",innerType})}var ZodNullable=$constructor("ZodNullable",(inst,def)=>{$ZodNullable.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>nullableProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function nullable(innerType){return new ZodNullable({type:"nullable",innerType})}var ZodDefault=$constructor("ZodDefault",(inst,def)=>{$ZodDefault.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>defaultProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType;inst.removeDefault=inst.unwrap});function _default(innerType,defaultValue){return new ZodDefault({type:"default",innerType,get defaultValue(){return typeof defaultValue==="function"?defaultValue():exports_util.shallowClone(defaultValue)}})}var ZodPrefault=$constructor("ZodPrefault",(inst,def)=>{$ZodPrefault.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>prefaultProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function prefault(innerType,defaultValue){return new ZodPrefault({type:"prefault",innerType,get defaultValue(){return typeof defaultValue==="function"?defaultValue():exports_util.shallowClone(defaultValue)}})}var ZodNonOptional=$constructor("ZodNonOptional",(inst,def)=>{$ZodNonOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>nonoptionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function nonoptional(innerType,params){return new ZodNonOptional({type:"nonoptional",innerType,...exports_util.normalizeParams(params)})}var ZodCatch=$constructor("ZodCatch",(inst,def)=>{$ZodCatch.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>catchProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType;inst.removeCatch=inst.unwrap});function _catch(innerType,catchValue){return new ZodCatch({type:"catch",innerType,catchValue:typeof catchValue==="function"?catchValue:()=>catchValue})}var ZodPipe=$constructor("ZodPipe",(inst,def)=>{$ZodPipe.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>pipeProcessor(inst,ctx,json,params);inst.in=def.in;inst.out=def.out});function pipe(in_,out){return new ZodPipe({type:"pipe",in:in_,out})}var ZodReadonly=$constructor("ZodReadonly",(inst,def)=>{$ZodReadonly.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>readonlyProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function readonly(innerType){return new ZodReadonly({type:"readonly",innerType})}var ZodCustom=$constructor("ZodCustom",(inst,def)=>{$ZodCustom.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>customProcessor(inst,ctx,json,params)});function refine(fn,_params={}){return _refine(ZodCustom,fn,_params)}function superRefine(fn,params){return _superRefine(fn,params)}var ImageAssetSchema=object({id:string2().min(1),type:literal("image"),path:string2().min(1),width:number2().int().positive().optional(),height:number2().int().positive().optional()});var SpritesheetAssetSchema=object({id:string2().min(1),type:literal("spritesheet"),path:string2().min(1),width:number2().int().positive().optional(),height:number2().int().positive().optional(),frameWidth:number2().int().positive(),frameHeight:number2().int().positive(),animations:array(object({key:string2().min(1),frames:array(number2().int().nonnegative()),frameRate:number2().positive().optional(),repeat:number2().int().optional()})).optional()});var AudioAssetSchema=object({id:string2().min(1),type:literal("audio"),path:string2().min(1),duration:number2().nonnegative().optional(),formats:array(_enum(["wav","mp3","ogg","m4a","webm"])).optional()});var ModelAssetSchema=object({id:string2().min(1),type:literal("model"),path:string2().min(1),format:_enum(["glb","gltf","obj","fbx"]),triangles:number2().int().positive().optional(),animations:array(string2()).optional()});var ShaderAssetSchema=object({id:string2().min(1),type:literal("shader"),path:string2().min(1),stage:_enum(["vertex","fragment","compute"])});var TilesetAssetSchema=object({id:string2().min(1),type:literal("tileset"),path:string2().min(1),tileWidth:number2().int().positive(),tileHeight:number2().int().positive(),columns:number2().int().positive().optional(),rows:number2().int().positive().optional()});var AssetSchema=discriminatedUnion("type",[ImageAssetSchema,SpritesheetAssetSchema,AudioAssetSchema,ModelAssetSchema,ShaderAssetSchema,TilesetAssetSchema]);var RegistryConfigSchema=union([string2().min(1),object({url:string2().min(1),index:string2().min(1).optional(),headers:record(string2(),string2()).optional()})]);var DepSpecRegex=/^(?:@[a-z0-9][a-z0-9_-]*\/[a-z0-9][a-z0-9_./-]*|[a-z0-9][a-z0-9_-]*|https?:\/\/[^\s]+|gh:[^\s]+|github:[^\s]+|\.{1,2}\/[^\s]+)$/i;var GamecnConfigSchema=object({$schema:string2().optional(),engine:_enum(["phaser","three","pixi","vanilla"]),framework:_enum(["vanilla","react"]),language:_enum(["typescript","javascript"]),packageManager:_enum(["npm","pnpm","yarn","bun"]).optional().default("npm"),paths:object({src:string2().min(1),assets:string2().min(1),components:string2().optional(),systems:string2().optional(),scenes:string2().optional(),shaders:string2().optional(),ui:string2().optional()}),registries:record(string2(),RegistryConfigSchema).optional(),deps:array(string2().regex(DepSpecRegex,{error:"Each `deps[]` entry must be a registry spec — e.g. `event-bus`, `@main/event-bus`, or `https://...`."})).optional()});var ITEM_TYPES=["registry:template","registry:scene","registry:component","registry:system","registry:asset","registry:shader","registry:audio","registry:model","registry:tileset","registry:ui","registry:hook","registry:utility","registry:config","registry:recipe","registry:plugin"];var LockedFileSchema=object({path:string2().min(1),sha256:string2().regex(/^[a-f0-9]{64}$/,{error:"sha256 must be a 64-character lowercase hex string."})});var LockedItemSchema=object({name:string2().min(1),version:string2().min(1),registry:string2().min(1),resolved:string2().min(1),installedAt:string2(),files:array(LockedFileSchema)});var LockfileSchema=object({$schema:string2().optional(),version:literal(1),items:record(string2(),LockedItemSchema)});var ItemSummarySchema=object({name:string2().min(1),type:_enum(ITEM_TYPES),title:string2(),description:string2(),version:string2().min(1),engines:array(string2()).optional(),frameworks:array(string2()).optional(),languages:array(string2()).optional(),tags:array(string2()).optional()});var RegistryIndexSchema=object({$schema:string2().optional(),name:string2().min(1),homepage:url().optional(),items:array(ItemSummarySchema)});var GENRE_TAGS=["endless-runner","dodger","platformer","top-down-shooter","twin-stick","tower-defense","survivors","racing","puzzle","arcade","simulation","fighter","rpg","blank"];var STYLE_TAGS=["pixel","flat-2d","hand-drawn","low-poly-3d","voxel","photoreal-3d"];var PLATFORM_TAGS=["web","mobile-web","desktop"];var NAMESPACE_VALUES={genre:new Set(GENRE_TAGS),style:new Set(STYLE_TAGS),platform:new Set(PLATFORM_TAGS)};var CONTROLLED_PREFIXES=Object.keys(NAMESPACE_VALUES);function isControlledTag(tag){const idx=tag.indexOf(":");if(idx<=0)return false;const ns=tag.slice(0,idx);const value=tag.slice(idx+1);const allowed=NAMESPACE_VALUES[ns];return allowed!==undefined&&allowed.has(value)}function hasControlledPrefix(tag){for(const ns of CONTROLLED_PREFIXES){if(tag.startsWith(ns+":"))return true}return false}var semverRegex=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;var numericIdentifier="(?:0|[1-9]\\d*)";var prereleaseIdentifier=[numericIdentifier,"\\d*[a-zA-Z-][0-9a-zA-Z-]*"].join("|");var prerelease=`(?:${prereleaseIdentifier})(?:\\.(?:${prereleaseIdentifier}))*`;var build="[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*";var concretePatch=`${numericIdentifier}(?:-${prerelease})?(?:\\+${build})?`;var patch=`(?:[xX*]|${concretePatch})`;var minor=`(?:[xX*]|${numericIdentifier}(?:\\.${patch})?)`;var rangeVersion=`(?:[xX*]|${numericIdentifier}(?:\\.${minor})?)`;var comparatorOperator="(?:<=|>=|<|>|=|~>|~|\\^)";var comparator=`(?:(?:${comparatorOperator})\\s*)?${rangeVersion}`;var comparatorSet=`${comparator}(?:\\s+${comparator})*`;var hyphenRange=`${rangeVersion}\\s+-\\s+${rangeVersion}`;var simpleRange=`(?:${hyphenRange}|${comparatorSet})`;var semverRangeRegex=new RegExp(`^\\s*${simpleRange}(?:\\s*\\|\\|\\s*${simpleRange})*\\s*$`);var FILE_TYPES=["source","asset","documentation"];var integrityRegex=/^sha256-[A-Za-z0-9+/=]+$/;var FileSpecSchema=object({path:string2().min(1),target:string2().min(1),type:_enum(FILE_TYPES),language:_enum(["typescript","javascript"]).optional(),content:string2().optional(),url:url().optional(),integrity:string2().regex(integrityRegex,{error:"Integrity must be a Subresource Integrity string (sha256-...)."}).optional()}).refine((obj)=>!(obj.content!==undefined&&obj.url!==undefined),{error:"File spec cannot have both `content` and `url`."});var PreloadInstructionSchema=object({kind:string2().min(1),key:string2().min(1),path:string2().min(1),frameWidth:number2().int().positive().optional(),frameHeight:number2().int().positive().optional()}).catchall(unknown());var IntegrationBlockSchema=object({preload:array(PreloadInstructionSchema).optional(),usage:array(string2()).optional()});var AuthorSchema=union([string2().min(1),object({name:string2().min(1),url:url().optional(),email:string2().optional()})]);var RegistryItemSchema=object({$schema:string2().optional(),name:string2().min(1),type:_enum(ITEM_TYPES),title:string2(),description:string2(),version:string2().regex(semverRegex,{error:"Invalid SemVer string."}),license:string2().optional(),licenseUrl:url().optional(),author:AuthorSchema,tags:array(string2().refine((s)=>!hasControlledPrefix(s)||isControlledTag(s),{error:"Namespaced tag (genre:/style:/platform:) suffix is not in the controlled vocabulary."})).optional(),attributionRequired:boolean2().optional(),commercialUse:boolean2().optional(),redistribution:boolean2().optional(),aiGenerated:boolean2().optional(),compatibility:object({engines:record(string2(),string2().regex(semverRangeRegex)),frameworks:array(_enum(["vanilla","react"])),languages:array(_enum(["typescript","javascript"])),bundlers:array(string2()),libraries:record(string2(),string2().regex(semverRangeRegex)).optional(),platforms:array(string2()).optional()}).optional(),dependencies:object({npm:array(string2()).optional(),registry:array(string2()).optional()}).optional(),files:array(FileSpecSchema),assets:array(AssetSchema).optional(),integration:record(string2(),IntegrationBlockSchema).optional(),preview:object({thumbnail:url().optional(),demo:url().optional(),gif:url().optional()}).optional()});class GamecnError extends Error{constructor(message,name="GamecnError"){super(message);this.name=name}}class ItemNotFoundError extends GamecnError{spec;constructor(spec,reason){super(`Could not resolve item "${spec}": ${reason}`,"ItemNotFoundError");this.spec=spec}}class IntegrityError extends GamecnError{path;expected;actual;constructor(path,expected,actual){super(`Integrity check failed for ${path} (expected ${expected}, got ${actual})`,"IntegrityError");this.path=path;this.expected=expected;this.actual=actual}}class ConflictError extends GamecnError{path;constructor(path){super(`File already exists: ${path}`,"ConflictError");this.path=path}}class IncompatibleError extends GamecnError{constructor(message){super(message,"IncompatibleError")}}class IncompatibleVersionError extends GamecnError{itemName;engine;required;installed;constructor(itemName,engine,required2,installed){super(`${itemName} requires ${engine} ${required2}, but ${installed} is installed.`,"IncompatibleVersionError");this.itemName=itemName;this.engine=engine;this.required=required2;this.installed=installed}}class PathEscapeError extends GamecnError{constructor(target,resolved){super(`File target "${target}" resolves outside the project root (${resolved})`,"PathEscapeError")}}class UnsupportedSourceError extends GamecnError{constructor(message){super(message,"UnsupportedSourceError")}}class HttpError extends GamecnError{url;status;statusText;constructor(url2,status,statusText){super(`HTTP ${status} ${statusText}: ${url2}`,"HttpError");this.url=url2;this.status=status;this.statusText=statusText}}class MissingEnvVarError extends GamecnError{variable;constructor(variable){super(`Required environment variable not set: ${variable}`,"MissingEnvVarError");this.variable=variable}}function resolveTargetPath(config2,target,cwd){const paths=config2.paths;const placeholders={"{src}":paths.src,"{assets}":paths.assets,"{components}":paths.components??join(paths.src,"components"),"{systems}":paths.systems??join(paths.src,"systems"),"{scenes}":paths.scenes??join(paths.src,"scenes"),"{shaders}":paths.shaders??join(paths.src,"shaders"),"{ui}":paths.ui??join(paths.src,"ui")};let interpolated=target;for(const[k3,v]of Object.entries(placeholders)){interpolated=interpolated.split(k3).join(v)}const absCwd=resolve(cwd);const absTarget=isAbsolute(interpolated)?resolve(interpolated):resolve(absCwd,interpolated);if(absTarget!==absCwd&&!absTarget.startsWith(absCwd+sep)){throw new PathEscapeError(target,absTarget)}return absTarget}import{createHash}from"node:crypto";import{readFile,writeFile}from"node:fs/promises";import{join as join2}from"node:path";var LOCKFILE_NAME="gamecn-lock.json";async function loadLockfile(cwd){const path=join2(cwd,LOCKFILE_NAME);try{const raw=await readFile(path,"utf8");return LockfileSchema.parse(JSON.parse(raw))}catch(err){if(err.code==="ENOENT"){return{version:1,items:{}}}throw err}}async function saveLockfile(cwd,lock){const path=join2(cwd,LOCKFILE_NAME);await writeFile(path,JSON.stringify(lock,null,2)+`
|
|
114
|
-
`,"utf8")}function sha256OfBuffer(buf){const hash=createHash("sha256");hash.update(buf);return hash.digest("hex")}function recordInstall(lock,item,registry2,resolved,files){lock.items[item.name]={name:item.name,version:item.version,registry:registry2,resolved,installedAt:new Date().toISOString(),files}}var import_semver=__toESM(require_semver2(),1);import{readFile as readFile2,stat}from"node:fs/promises";import{join as join3,relative,resolve as resolve2}from"node:path";async function fileExists(path){try{await stat(path);return true}catch{return false}}function planFileSource(spec,baseDir,headers){if(spec.content!==undefined){return{kind:"inline",content:spec.content}}if(spec.url!==undefined){return{kind:"remote",url:spec.url,integrity:spec.integrity,...headers?{headers}:{}}}if(baseDir===undefined){throw new UnsupportedSourceError(`File "${spec.path}" has neither content nor url, and no baseDir is set for resolution.`)}return{kind:"local",absolutePath:resolve2(baseDir,spec.path)}}async function readPackageJson(cwd){try{const raw=await readFile2(join3(cwd,"package.json"),"utf8");return JSON.parse(raw)}catch{return}}function depName(spec){if(spec.startsWith("@")){const at2=spec.indexOf("@",1);return at2===-1?spec:spec.slice(0,at2)}const at=spec.indexOf("@");return at===-1?spec:spec.slice(0,at)}function normalizePath(p2){return p2.split(/[\\/]/).join("/")}async function plan(resolved,config2,lock,cwd){const item=resolved.item;const lockEntry=lock.items[item.name];const alreadyInstalled=lockEntry!==undefined&&lockEntry.version===item.version;const files=[];const conflicts=[];for(const spec of item.files){const target=resolveTargetPath(config2,spec.target,cwd);const source=planFileSource(spec,resolved.baseDir,resolved.headers);files.push({spec,source,target});if(await fileExists(target)){const targetRel=normalizePath(relative(cwd,target));const existingOwner=Object.values(lock.items).find((entry)=>entry.files.some((f)=>normalizePath(f.path)===targetRel));if(existingOwner===undefined||existingOwner.name!==item.name){conflicts.push({target,reason:"exists",ownedBy:existingOwner?.name})}}}const pkg=await readPackageJson(cwd);const allDeps={...pkg?.dependencies,...pkg?.devDependencies,...pkg?.peerDependencies};const npmDeps=(item.dependencies?.npm??[]).filter((d3)=>{const name=depName(d3);return!(name in allDeps)});const registryDeps=item.dependencies?.registry??[];const incompatibilities=checkEngineCompatibility(item,allDeps);return{item,resolved,files,conflicts,incompatibilities,npmDeps,registryDeps,alreadyInstalled}}function checkEngineCompatibility(item,allDeps){const required2=item.compatibility?.engines;if(!required2)return[];const out=[];for(const[engine,range]of Object.entries(required2)){const installed=allDeps[engine];if(!installed)continue;const minInstalled=import_semver.default.minVersion(installed);if(!minInstalled)continue;if(!import_semver.default.satisfies(minInstalled,range,{includePrerelease:true})){out.push({itemName:item.name,engine,required:range,installed,message:`${item.name} requires ${engine} ${range}, but ${installed} is installed.`})}}return out}import{randomBytes}from"node:crypto";import{mkdir,readFile as readFile3,rename,writeFile as writeFile2}from"node:fs/promises";import{dirname,relative as relative2}from"node:path";async function readSource(file,fetcher){switch(file.source.kind){case"inline":return file.source.content;case"local":return readFile3(file.source.absolutePath);case"remote":if(!fetcher){throw new UnsupportedSourceError(`Remote file "${file.spec.path}" requires an AssetFetcher. Pass one to executePlan via the fetcher argument.`)}return fetcher.fetch(file.source.url,file.source.integrity,file.source.headers)}}async function writeAtomic(target,data){await mkdir(dirname(target),{recursive:true});const tmp=`${target}.tmp.${randomBytes(6).toString("hex")}`;await writeFile2(tmp,data);await rename(tmp,target)}function normalizeRelPath(absPath,cwd){return relative2(cwd,absPath).split(/[\\/]/).join("/")}async function executePlan(plan2,lock,cwd,options={},fetcher){const result={itemName:plan2.item.name,installed:[],skipped:[]};if(options.dryRun){return result}if(plan2.incompatibilities.length>0&&!options.force){const first=plan2.incompatibilities[0];throw new IncompatibleVersionError(first.itemName,first.engine,first.required,first.installed)}if(plan2.conflicts.length>0&&!options.force){const first=plan2.conflicts[0];throw new ConflictError(first.target)}for(const file of plan2.files){const data=await readSource(file,fetcher);await writeAtomic(file.target,data);const buf=typeof data==="string"?Buffer.from(data,"utf8"):data;const sha=sha256OfBuffer(buf);result.installed.push({path:normalizeRelPath(file.target,cwd),sha256:sha})}recordInstall(lock,plan2.item,plan2.resolved.registry,plan2.resolved.resolved,result.installed);return result}import{createHash as createHash3}from"node:crypto";import{mkdir as mkdir2,readFile as readFile4,rename as rename2,writeFile as writeFile3}from"node:fs/promises";import{homedir}from"node:os";import{dirname as dirname2,join as join4}from"node:path";import{createHash as createHash2}from"node:crypto";var SRI_RE=/^sha256-([A-Za-z0-9+/]+={0,2})$/;function parseSriSha256(sri){const m2=SRI_RE.exec(sri);if(!m2){throw new Error(`Invalid SRI string (expected "sha256-<base64>"): ${sri}`)}return Buffer.from(m2[1],"base64")}function sriOfBuffer(data){return"sha256-"+createHash2("sha256").update(data).digest("base64")}function hexOfSri(sri){return parseSriSha256(sri).toString("hex")}function verifyIntegrity(sri,data,label){const expected=parseSriSha256(sri);const actual=createHash2("sha256").update(data).digest();if(!expected.equals(actual)){throw new IntegrityError(label,sri,sriOfBuffer(data))}}function defaultCacheDir(){return process.env.GAMECN_CACHE_DIR??join4(homedir(),".gamecn","cache")}function sha1(s){return createHash3("sha1").update(s).digest("hex")}async function sleep(ms){return new Promise((res)=>setTimeout(res,ms))}async function fetchWithRetry(url2,init,opts={}){const attempts=opts.attempts??3;const initialDelayMs=opts.initialDelayMs??250;const fetcher=init.fetcher??fetch;const{fetcher:_3,...rest}=init;let lastErr;for(let i=0;i<attempts;i++){try{const res=await fetcher(url2,rest);if(res.status>=500&&res.status<600&&i<attempts-1){await sleep(initialDelayMs*2**i);continue}return res}catch(err){lastErr=err;if(i<attempts-1){await sleep(initialDelayMs*2**i);continue}}}throw lastErr??new Error(`fetch failed after ${attempts} attempts: ${url2}`)}async function readJsonIfExists(path){try{return JSON.parse(await readFile4(path,"utf8"))}catch(err){if(err.code==="ENOENT")return;throw err}}class ManifestCache{dir;fetcher;constructor(cacheDir,fetcher=fetch){this.dir=join4(cacheDir,"manifests");this.fetcher=fetcher}async getOrFetch(url2,headers={}){const key=sha1(url2);const file=join4(this.dir,`${key}.json`);const metaFile=join4(this.dir,`${key}.meta.json`);const meta2=await readJsonIfExists(metaFile);const reqHeaders={...headers};if(meta2?.etag)reqHeaders["If-None-Match"]=meta2.etag;const res=await fetchWithRetry(url2,{method:"GET",headers:reqHeaders,fetcher:this.fetcher});if(res.status===304){const cached2=await readJsonIfExists(file);if(cached2!==undefined)return cached2;const refetch=await fetchWithRetry(url2,{method:"GET",headers,fetcher:this.fetcher});return parseAndCache(refetch,url2,file,metaFile)}if(!res.ok){throw new HttpError(url2,res.status,res.statusText)}return parseAndCache(res,url2,file,metaFile)}}async function parseAndCache(res,url2,file,metaFile){const text=await res.text();let json;try{json=JSON.parse(text)}catch(err){throw new HttpError(url2,res.status,`invalid JSON: ${err.message}`)}await mkdir2(dirname2(file),{recursive:true});await writeFile3(file,text,"utf8");const meta2={etag:res.headers.get("etag")??undefined,fetchedAt:new Date().toISOString()};await writeFile3(metaFile,JSON.stringify(meta2),"utf8");return json}class AssetCache{dir;fetcher;constructor(cacheDir,fetcher=fetch){this.dir=join4(cacheDir,"assets");this.fetcher=fetcher}async getOrFetch(url2,integrity,headers={}){if(integrity){const hex2=hexOfSri(integrity);const cached2=join4(this.dir,hex2);try{const buf2=await readFile4(cached2);verifyIntegrity(integrity,buf2,cached2);return buf2}catch(err){if(err.code!=="ENOENT"){}}}const res=await fetchWithRetry(url2,{method:"GET",headers,fetcher:this.fetcher});if(!res.ok){throw new HttpError(url2,res.status,res.statusText)}const buf=Buffer.from(await res.arrayBuffer());if(integrity){verifyIntegrity(integrity,buf,url2)}const hex=createHash3("sha256").update(buf).digest("hex");const target=join4(this.dir,hex);await mkdir2(dirname2(target),{recursive:true});const tmp=`${target}.tmp.${createHash3("sha1").update(`${url2}${Date.now()}`).digest("hex").slice(0,8)}`;await writeFile3(tmp,buf);try{await rename2(tmp,target)}catch{}return buf}}import{isAbsolute as isAbsolute2}from"node:path";var ENV_VAR_RE=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function interpolateHeaders(headers,env=process.env){const out={};for(const[k3,v]of Object.entries(headers)){out[k3]=interpolate(v,env)}return out}function interpolate(template,env=process.env){return template.replace(ENV_VAR_RE,(_3,name)=>{const value=env[name];if(value===undefined){throw new MissingEnvVarError(name)}return value})}var DEFAULT_REGISTRY_URL="https://gamecn.dev/r/{name}.json";var BARE_NAME_RE=/^[a-z0-9][a-z0-9_-]{0,213}$/i;class DefaultRegistryResolver{config;cache;env;constructor(config2,cache,env=process.env){this.config=config2;this.cache=cache;this.env=env}canResolve(spec){if(spec.startsWith("@"))return false;if(spec.startsWith("http://")||spec.startsWith("https://"))return false;if(spec.startsWith("gh:")||spec.startsWith("github:"))return false;if(spec.startsWith("./")||spec.startsWith("../"))return false;if(isAbsolute2(spec))return false;if(spec.endsWith(".json"))return false;if(spec.includes("/")||spec.includes("\\"))return false;return BARE_NAME_RE.test(spec)}async resolve(spec,_ctx){const reg=this.config.registries?.["@main"];const urlTemplate=!reg?DEFAULT_REGISTRY_URL:typeof reg==="string"?reg:reg.url;const rawHeaders=typeof reg==="object"&®.headers?reg.headers:{};const headers=interpolateHeaders(rawHeaders,this.env);const url2=urlTemplate.replace(/\{name\}/g,spec);try{const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"@main",resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}catch(err){if(err instanceof HttpError&&err.status===404){throw new ItemNotFoundError(spec,`not found in the default @main registry (${url2}). Either configure 'registries["@main"]' in gamecn.json to point at a different registry, or use a fully-qualified spec (\`@scope/name\`, \`./local.json\`, \`gh:owner/repo/path\`, or \`https://...\`).`)}throw err}}}var GH_PREFIX_RE=/^(gh|github):/;function parseGitHubSpec(spec){if(!GH_PREFIX_RE.test(spec)){throw new ItemNotFoundError(spec,"not a GitHub spec")}const stripped=spec.replace(GH_PREFIX_RE,"");const hashIdx=stripped.indexOf("#");const pathPart=hashIdx===-1?stripped:stripped.slice(0,hashIdx);const ref=hashIdx===-1?"HEAD":stripped.slice(hashIdx+1)||"HEAD";const segs=pathPart.split("/").filter(Boolean);if(segs.length<3){throw new ItemNotFoundError(spec,"expected gh:owner/repo/path/to/item.json")}const[owner,repo,...rest]=segs;return{owner,repo,path:rest.join("/"),ref,hasExplicitRef:hashIdx!==-1}}function githubSpecToUrl(spec){const p2=parseGitHubSpec(spec);return`https://raw.githubusercontent.com/${p2.owner}/${p2.repo}/${p2.ref}/${p2.path}`}class GitHubResolver{cache;env;warn;constructor(cache,env=process.env,warn=(m2)=>console.warn(m2)){this.cache=cache;this.env=env;this.warn=warn}canResolve(spec){return GH_PREFIX_RE.test(spec)}async resolve(spec,_ctx){const parsed=parseGitHubSpec(spec);if(!parsed.hasExplicitRef){this.warn(`[gamecn] ${spec} has no ref; using HEAD (non-reproducible). Pin a ref with #v1.2.0 or #commit-sha.`)}const url2=githubSpecToUrl(spec);const headers={};const token=this.env["GITHUB_TOKEN"];if(token)headers["Authorization"]=`token ${token}`;const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"github",resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}}class HttpsResolver{cache;headers;constructor(cache,headers={}){this.cache=cache;this.headers=headers}canResolve(spec){return spec.startsWith("http://")||spec.startsWith("https://")}async resolve(spec,_ctx){const json=await this.cache.getOrFetch(spec,this.headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"https",resolved:spec,headers:Object.keys(this.headers).length>0?this.headers:undefined}}}import{readFile as readFile5}from"node:fs/promises";import{dirname as dirname3,isAbsolute as isAbsolute3,resolve as resolve3}from"node:path";class LocalFileResolver{canResolve(spec){if(spec.startsWith("./")||spec.startsWith("../"))return true;if(spec.startsWith("/")||spec.startsWith("~/"))return true;if(/^[A-Za-z]:[\\/]/.test(spec))return true;if(spec.endsWith(".json"))return true;return false}async resolve(spec,ctx){const absSpec=isAbsolute3(spec)?spec:resolve3(ctx.cwd,spec);let raw;try{raw=await readFile5(absSpec,"utf8")}catch(err){const code=err.code;throw new ItemNotFoundError(spec,code==="ENOENT"?"file not found":`read failed: ${err.message}`)}let json;try{json=JSON.parse(raw)}catch(err){throw new ItemNotFoundError(spec,`JSON parse error: ${err.message}`)}const item=RegistryItemSchema.parse(json);return{item,spec,registry:"local",resolved:absSpec,baseDir:dirname3(absSpec)}}}var NAMESPACE_RE=/^(@[A-Za-z0-9_-]+)\/(.+)$/;class NamespaceResolver{config;cache;env;constructor(config2,cache,env=process.env){this.config=config2;this.cache=cache;this.env=env}canResolve(spec){return NAMESPACE_RE.test(spec)}async resolve(spec,_ctx){const m2=NAMESPACE_RE.exec(spec);if(!m2)throw new ItemNotFoundError(spec,"not a namespaced spec");const namespace=m2[1];const name=m2[2];const reg=this.config.registries?.[namespace];if(!reg){throw new ItemNotFoundError(spec,`unknown registry namespace "${namespace}". Add it to gamecn.json#registries.`)}const urlTemplate=typeof reg==="string"?reg:reg.url;const rawHeaders=typeof reg==="string"?{}:reg.headers??{};const headers=interpolateHeaders(rawHeaders,this.env);const url2=urlTemplate.replace(/\{name\}/g,name);const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:namespace,resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}}function createResolver(config2,opts={}){const cacheDir=opts.cacheDir??defaultCacheDir();const fetcher=opts.fetcher??fetch;const env=opts.env??process.env;const manifestCache=new ManifestCache(cacheDir,fetcher);const resolvers=[new NamespaceResolver(config2,manifestCache,env),new GitHubResolver(manifestCache,env),new DefaultRegistryResolver(config2,manifestCache,env),new HttpsResolver(manifestCache),new LocalFileResolver];return{canResolve(spec){return resolvers.some((r2)=>r2.canResolve(spec))},async resolve(spec,ctx){for(const r2 of resolvers){if(r2.canResolve(spec))return r2.resolve(spec,ctx)}throw new ItemNotFoundError(spec,"no resolver matches this spec")}}}function createAssetFetcher(opts={}){const cacheDir=opts.cacheDir??defaultCacheDir();const fetcher=opts.fetcher??fetch;const cache=new AssetCache(cacheDir,fetcher);return{fetch:(url2,integrity,headers)=>cache.getOrFetch(url2,integrity,headers)}}var TEXT_EXTS=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]);var MAX_SCAN_BYTES=256*1024;var SKIP_DIRS=new Set(["node_modules",".git","dist",".turbo",".cache","registry-dist"]);var DEFAULT_REGISTRY="https://gamecn.dev/r/{name}.json";var NAME_RE=/^[a-z0-9][a-z0-9._-]{0,213}$/i;var RESERVED=new Set(["node_modules","favicon.ico"]);function validateProjectName(name){if(!NAME_RE.test(name)){throw new Error(`Invalid project name "${name}". Use lowercase letters, numbers, dot, underscore, or hyphen.`)}if(RESERVED.has(name)||name.startsWith(".")||name.startsWith("_")){throw new Error(`Reserved or invalid project name: "${name}".`)}}async function dirIsEmptyOrMissing(path){try{const entries=await readdir(path);return entries.length===0}catch(err){if(err.code==="ENOENT")return true;throw err}}function resolveTemplateSpec(template){if(template.startsWith("@")||template.startsWith("http://")||template.startsWith("https://")||template.startsWith("gh:")||template.startsWith("github:")||template.startsWith("./")||template.startsWith("/")||/^[A-Za-z]:[\\/]/.test(template)){return template}return`@main/${template}`}async function defaultInstallRunner(cwd,pm){await new Promise((res,rej)=>{const proc=spawn(pm,["install"],{cwd,stdio:"inherit",shell:process.platform==="win32"});proc.on("exit",(code)=>{if(code===0)res();else rej(new Error(`${pm} install exited with code ${code}`))});proc.on("error",rej)})}async function scaffold(opts){validateProjectName(opts.name);const parentDir=opts.parentDir??process.cwd();const cwd=resolve4(parentDir,opts.name);if(!await dirIsEmptyOrMissing(cwd)&&!opts.force){throw new Error(`Directory "${opts.name}" already exists and is not empty. Pass --force to overwrite.`)}await mkdir3(cwd,{recursive:true});const pm=opts.packageManager??"pnpm";const config2={engine:"phaser",framework:"vanilla",language:"typescript",packageManager:pm,paths:{src:"src",assets:"public/assets"},registries:{"@main":opts.registry??DEFAULT_REGISTRY}};const resolverOpts=opts.cacheDir?{cacheDir:opts.cacheDir}:{};const resolver=createResolver(config2,resolverOpts);const fetcher=createAssetFetcher(resolverOpts);const spec=resolveTemplateSpec(opts.template);const resolved=await resolver.resolve(spec,{cwd,config:config2});if(resolved.item.type!=="registry:template"){throw new IncompatibleError(`"${spec}" is type ${resolved.item.type}, not registry:template.`)}const lock=await loadLockfile(cwd);const p2=await plan(resolved,config2,lock,cwd);const result=await executePlan(p2,lock,cwd,{force:opts.force??false},fetcher);await saveLockfile(cwd,lock);const pkgPath=resolve4(cwd,"package.json");try{const raw=await readFile6(pkgPath,"utf8");const pkg=JSON.parse(raw);pkg.name=opts.name;await writeFile4(pkgPath,JSON.stringify(pkg,null,2)+`
|
|
115
|
-
|
|
133
|
+
`)}}doc.write(`payload.value = newResult;`);doc.write(`return payload;`);const fn=doc.compile();return(payload,ctx)=>fn(shape,payload,ctx)};let fastpass;const isObject2=isObject;const jit=!globalConfig.jitless;const allowsEval2=allowsEval;const fastEnabled=jit&&allowsEval2.value;const catchall=def.catchall;let value;inst._zod.parse=(payload,ctx)=>{value??(value=_normalized.value);const input=payload.value;if(!isObject2(input)){payload.issues.push({expected:"object",code:"invalid_type",input,inst});return payload}if(jit&&fastEnabled&&ctx?.async===false&&ctx.jitless!==true){if(!fastpass)fastpass=generateFastpass(def.shape);payload=fastpass(payload,ctx);if(!catchall)return payload;return handleCatchall([],input,payload,ctx,value,inst)}return superParse(payload,ctx)}});function handleUnionResults(results,final,inst,ctx){for(const result of results){if(result.issues.length===0){final.value=result.value;return final}}const nonaborted=results.filter((r2)=>!aborted(r2));if(nonaborted.length===1){final.value=nonaborted[0].value;return nonaborted[0]}final.issues.push({code:"invalid_union",input:final.value,inst,errors:results.map((result)=>result.issues.map((iss)=>finalizeIssue(iss,ctx,config())))});return final}var $ZodUnion=$constructor("$ZodUnion",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"optin",()=>def.options.some((o2)=>o2._zod.optin==="optional")?"optional":undefined);defineLazy(inst._zod,"optout",()=>def.options.some((o2)=>o2._zod.optout==="optional")?"optional":undefined);defineLazy(inst._zod,"values",()=>{if(def.options.every((o2)=>o2._zod.values)){return new Set(def.options.flatMap((option)=>Array.from(option._zod.values)))}return});defineLazy(inst._zod,"pattern",()=>{if(def.options.every((o2)=>o2._zod.pattern)){const patterns=def.options.map((o2)=>o2._zod.pattern);return new RegExp(`^(${patterns.map((p2)=>cleanRegex(p2.source)).join("|")})$`)}return});const first=def.options.length===1?def.options[0]._zod.run:null;inst._zod.parse=(payload,ctx)=>{if(first){return first(payload,ctx)}let async=false;const results=[];for(const option of def.options){const result=option._zod.run({value:payload.value,issues:[]},ctx);if(result instanceof Promise){results.push(result);async=true}else{if(result.issues.length===0)return result;results.push(result)}}if(!async)return handleUnionResults(results,payload,inst,ctx);return Promise.all(results).then((results2)=>{return handleUnionResults(results2,payload,inst,ctx)})}});var $ZodDiscriminatedUnion=$constructor("$ZodDiscriminatedUnion",(inst,def)=>{def.inclusive=false;$ZodUnion.init(inst,def);const _super=inst._zod.parse;defineLazy(inst._zod,"propValues",()=>{const propValues={};for(const option of def.options){const pv=option._zod.propValues;if(!pv||Object.keys(pv).length===0)throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);for(const[k3,v]of Object.entries(pv)){if(!propValues[k3])propValues[k3]=new Set;for(const val of v){propValues[k3].add(val)}}}return propValues});const disc=cached(()=>{const opts=def.options;const map=new Map;for(const o2 of opts){const values=o2._zod.propValues?.[def.discriminator];if(!values||values.size===0)throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);for(const v of values){if(map.has(v)){throw new Error(`Duplicate discriminator value "${String(v)}"`)}map.set(v,o2)}}return map});inst._zod.parse=(payload,ctx)=>{const input=payload.value;if(!isObject(input)){payload.issues.push({code:"invalid_type",expected:"object",input,inst});return payload}const opt=disc.value.get(input?.[def.discriminator]);if(opt){return opt._zod.run(payload,ctx)}if(def.unionFallback||ctx.direction==="backward"){return _super(payload,ctx)}payload.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:def.discriminator,options:Array.from(disc.value.keys()),input,path:[def.discriminator],inst});return payload}});var $ZodIntersection=$constructor("$ZodIntersection",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,ctx)=>{const input=payload.value;const left=def.left._zod.run({value:input,issues:[]},ctx);const right=def.right._zod.run({value:input,issues:[]},ctx);const async=left instanceof Promise||right instanceof Promise;if(async){return Promise.all([left,right]).then(([left2,right2])=>{return handleIntersectionResults(payload,left2,right2)})}return handleIntersectionResults(payload,left,right)}});function mergeValues(a,b3){if(a===b3){return{valid:true,data:a}}if(a instanceof Date&&b3 instanceof Date&&+a===+b3){return{valid:true,data:a}}if(isPlainObject(a)&&isPlainObject(b3)){const bKeys=Object.keys(b3);const sharedKeys=Object.keys(a).filter((key)=>bKeys.indexOf(key)!==-1);const newObj={...a,...b3};for(const key of sharedKeys){const sharedValue=mergeValues(a[key],b3[key]);if(!sharedValue.valid){return{valid:false,mergeErrorPath:[key,...sharedValue.mergeErrorPath]}}newObj[key]=sharedValue.data}return{valid:true,data:newObj}}if(Array.isArray(a)&&Array.isArray(b3)){if(a.length!==b3.length){return{valid:false,mergeErrorPath:[]}}const newArray=[];for(let index=0;index<a.length;index++){const itemA=a[index];const itemB=b3[index];const sharedValue=mergeValues(itemA,itemB);if(!sharedValue.valid){return{valid:false,mergeErrorPath:[index,...sharedValue.mergeErrorPath]}}newArray.push(sharedValue.data)}return{valid:true,data:newArray}}return{valid:false,mergeErrorPath:[]}}function handleIntersectionResults(result,left,right){const unrecKeys=new Map;let unrecIssue;for(const iss of left.issues){if(iss.code==="unrecognized_keys"){unrecIssue??(unrecIssue=iss);for(const k3 of iss.keys){if(!unrecKeys.has(k3))unrecKeys.set(k3,{});unrecKeys.get(k3).l=true}}else{result.issues.push(iss)}}for(const iss of right.issues){if(iss.code==="unrecognized_keys"){for(const k3 of iss.keys){if(!unrecKeys.has(k3))unrecKeys.set(k3,{});unrecKeys.get(k3).r=true}}else{result.issues.push(iss)}}const bothKeys=[...unrecKeys].filter(([,f])=>f.l&&f.r).map(([k3])=>k3);if(bothKeys.length&&unrecIssue){result.issues.push({...unrecIssue,keys:bothKeys})}if(aborted(result))return result;const merged=mergeValues(left.value,right.value);if(!merged.valid){throw new Error(`Unmergable intersection. Error path: `+`${JSON.stringify(merged.mergeErrorPath)}`)}result.value=merged.data;return result}var $ZodRecord=$constructor("$ZodRecord",(inst,def)=>{$ZodType.init(inst,def);inst._zod.parse=(payload,ctx)=>{const input=payload.value;if(!isPlainObject(input)){payload.issues.push({expected:"record",code:"invalid_type",input,inst});return payload}const proms=[];const values=def.keyType._zod.values;if(values){payload.value={};const recordKeys=new Set;for(const key of values){if(typeof key==="string"||typeof key==="number"||typeof key==="symbol"){recordKeys.add(typeof key==="number"?key.toString():key);const keyResult=def.keyType._zod.run({value:key,issues:[]},ctx);if(keyResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(keyResult.issues.length){payload.issues.push({code:"invalid_key",origin:"record",issues:keyResult.issues.map((iss)=>finalizeIssue(iss,ctx,config())),input:key,path:[key],inst});continue}const outKey=keyResult.value;const result=def.valueType._zod.run({value:input[key],issues:[]},ctx);if(result instanceof Promise){proms.push(result.then((result2)=>{if(result2.issues.length){payload.issues.push(...prefixIssues(key,result2.issues))}payload.value[outKey]=result2.value}))}else{if(result.issues.length){payload.issues.push(...prefixIssues(key,result.issues))}payload.value[outKey]=result.value}}}let unrecognized;for(const key in input){if(!recordKeys.has(key)){unrecognized=unrecognized??[];unrecognized.push(key)}}if(unrecognized&&unrecognized.length>0){payload.issues.push({code:"unrecognized_keys",input,inst,keys:unrecognized})}}else{payload.value={};for(const key of Reflect.ownKeys(input)){if(key==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(input,key))continue;let keyResult=def.keyType._zod.run({value:key,issues:[]},ctx);if(keyResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}const checkNumericKey=typeof key==="string"&&number.test(key)&&keyResult.issues.length;if(checkNumericKey){const retryResult=def.keyType._zod.run({value:Number(key),issues:[]},ctx);if(retryResult instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(retryResult.issues.length===0){keyResult=retryResult}}if(keyResult.issues.length){if(def.mode==="loose"){payload.value[key]=input[key]}else{payload.issues.push({code:"invalid_key",origin:"record",issues:keyResult.issues.map((iss)=>finalizeIssue(iss,ctx,config())),input:key,path:[key],inst})}continue}const result=def.valueType._zod.run({value:input[key],issues:[]},ctx);if(result instanceof Promise){proms.push(result.then((result2)=>{if(result2.issues.length){payload.issues.push(...prefixIssues(key,result2.issues))}payload.value[keyResult.value]=result2.value}))}else{if(result.issues.length){payload.issues.push(...prefixIssues(key,result.issues))}payload.value[keyResult.value]=result.value}}}if(proms.length){return Promise.all(proms).then(()=>payload)}return payload}});var $ZodEnum=$constructor("$ZodEnum",(inst,def)=>{$ZodType.init(inst,def);const values=getEnumValues(def.entries);const valuesSet=new Set(values);inst._zod.values=valuesSet;inst._zod.pattern=new RegExp(`^(${values.filter((k3)=>propertyKeyTypes.has(typeof k3)).map((o2)=>typeof o2==="string"?escapeRegex(o2):o2.toString()).join("|")})$`);inst._zod.parse=(payload,_ctx)=>{const input=payload.value;if(valuesSet.has(input)){return payload}payload.issues.push({code:"invalid_value",values,input,inst});return payload}});var $ZodLiteral=$constructor("$ZodLiteral",(inst,def)=>{$ZodType.init(inst,def);if(def.values.length===0){throw new Error("Cannot create literal schema with no valid values")}const values=new Set(def.values);inst._zod.values=values;inst._zod.pattern=new RegExp(`^(${def.values.map((o2)=>typeof o2==="string"?escapeRegex(o2):o2?escapeRegex(o2.toString()):String(o2)).join("|")})$`);inst._zod.parse=(payload,_ctx)=>{const input=payload.value;if(values.has(input)){return payload}payload.issues.push({code:"invalid_value",values:def.values,input,inst});return payload}});var $ZodTransform=$constructor("$ZodTransform",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){throw new $ZodEncodeError(inst.constructor.name)}const _out=def.transform(payload.value,payload);if(ctx.async){const output=_out instanceof Promise?_out:Promise.resolve(_out);return output.then((output2)=>{payload.value=output2;payload.fallback=true;return payload})}if(_out instanceof Promise){throw new $ZodAsyncError}payload.value=_out;payload.fallback=true;return payload}});function handleOptionalResult(result,input){if(input===undefined&&(result.issues.length||result.fallback)){return{issues:[],value:undefined}}return result}var $ZodOptional=$constructor("$ZodOptional",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";inst._zod.optout="optional";defineLazy(inst._zod,"values",()=>{return def.innerType._zod.values?new Set([...def.innerType._zod.values,undefined]):undefined});defineLazy(inst._zod,"pattern",()=>{const pattern=def.innerType._zod.pattern;return pattern?new RegExp(`^(${cleanRegex(pattern.source)})?$`):undefined});inst._zod.parse=(payload,ctx)=>{if(def.innerType._zod.optin==="optional"){const input=payload.value;const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise)return result.then((r2)=>handleOptionalResult(r2,input));return handleOptionalResult(result,input)}if(payload.value===undefined){return payload}return def.innerType._zod.run(payload,ctx)}});var $ZodExactOptional=$constructor("$ZodExactOptional",(inst,def)=>{$ZodOptional.init(inst,def);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);defineLazy(inst._zod,"pattern",()=>def.innerType._zod.pattern);inst._zod.parse=(payload,ctx)=>{return def.innerType._zod.run(payload,ctx)}});var $ZodNullable=$constructor("$ZodNullable",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"optin",()=>def.innerType._zod.optin);defineLazy(inst._zod,"optout",()=>def.innerType._zod.optout);defineLazy(inst._zod,"pattern",()=>{const pattern=def.innerType._zod.pattern;return pattern?new RegExp(`^(${cleanRegex(pattern.source)}|null)$`):undefined});defineLazy(inst._zod,"values",()=>{return def.innerType._zod.values?new Set([...def.innerType._zod.values,null]):undefined});inst._zod.parse=(payload,ctx)=>{if(payload.value===null)return payload;return def.innerType._zod.run(payload,ctx)}});var $ZodDefault=$constructor("$ZodDefault",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}if(payload.value===undefined){payload.value=def.defaultValue;return payload}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>handleDefaultResult(result2,def))}return handleDefaultResult(result,def)}});function handleDefaultResult(payload,def){if(payload.value===undefined){payload.value=def.defaultValue}return payload}var $ZodPrefault=$constructor("$ZodPrefault",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}if(payload.value===undefined){payload.value=def.defaultValue}return def.innerType._zod.run(payload,ctx)}});var $ZodNonOptional=$constructor("$ZodNonOptional",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"values",()=>{const v=def.innerType._zod.values;return v?new Set([...v].filter((x2)=>x2!==undefined)):undefined});inst._zod.parse=(payload,ctx)=>{const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>handleNonOptionalResult(result2,inst))}return handleNonOptionalResult(result,inst)}});function handleNonOptionalResult(payload,inst){if(!payload.issues.length&&payload.value===undefined){payload.issues.push({code:"invalid_type",expected:"nonoptional",input:payload.value,inst})}return payload}var $ZodCatch=$constructor("$ZodCatch",(inst,def)=>{$ZodType.init(inst,def);inst._zod.optin="optional";defineLazy(inst._zod,"optout",()=>def.innerType._zod.optout);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then((result2)=>{payload.value=result2.value;if(result2.issues.length){payload.value=def.catchValue({...payload,error:{issues:result2.issues.map((iss)=>finalizeIssue(iss,ctx,config()))},input:payload.value});payload.issues=[];payload.fallback=true}return payload})}payload.value=result.value;if(result.issues.length){payload.value=def.catchValue({...payload,error:{issues:result.issues.map((iss)=>finalizeIssue(iss,ctx,config()))},input:payload.value});payload.issues=[];payload.fallback=true}return payload}});var $ZodPipe=$constructor("$ZodPipe",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"values",()=>def.in._zod.values);defineLazy(inst._zod,"optin",()=>def.in._zod.optin);defineLazy(inst._zod,"optout",()=>def.out._zod.optout);defineLazy(inst._zod,"propValues",()=>def.in._zod.propValues);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){const right=def.out._zod.run(payload,ctx);if(right instanceof Promise){return right.then((right2)=>handlePipeResult(right2,def.in,ctx))}return handlePipeResult(right,def.in,ctx)}const left=def.in._zod.run(payload,ctx);if(left instanceof Promise){return left.then((left2)=>handlePipeResult(left2,def.out,ctx))}return handlePipeResult(left,def.out,ctx)}});function handlePipeResult(left,next,ctx){if(left.issues.length){left.aborted=true;return left}return next._zod.run({value:left.value,issues:left.issues,fallback:left.fallback},ctx)}var $ZodReadonly=$constructor("$ZodReadonly",(inst,def)=>{$ZodType.init(inst,def);defineLazy(inst._zod,"propValues",()=>def.innerType._zod.propValues);defineLazy(inst._zod,"values",()=>def.innerType._zod.values);defineLazy(inst._zod,"optin",()=>def.innerType?._zod?.optin);defineLazy(inst._zod,"optout",()=>def.innerType?._zod?.optout);inst._zod.parse=(payload,ctx)=>{if(ctx.direction==="backward"){return def.innerType._zod.run(payload,ctx)}const result=def.innerType._zod.run(payload,ctx);if(result instanceof Promise){return result.then(handleReadonlyResult)}return handleReadonlyResult(result)}});function handleReadonlyResult(payload){payload.value=Object.freeze(payload.value);return payload}var $ZodCustom=$constructor("$ZodCustom",(inst,def)=>{$ZodCheck.init(inst,def);$ZodType.init(inst,def);inst._zod.parse=(payload,_3)=>{return payload};inst._zod.check=(payload)=>{const input=payload.value;const r2=def.fn(input);if(r2 instanceof Promise){return r2.then((r3)=>handleRefineResult(r3,payload,input,inst))}handleRefineResult(r2,payload,input,inst);return}});function handleRefineResult(result,payload,input,inst){if(!result){const _iss={code:"custom",input,inst,path:[...inst._zod.def.path??[]],continue:!inst._zod.def.abort};if(inst._zod.def.params)_iss.params=inst._zod.def.params;payload.issues.push(issue(_iss))}}var _a2;var $output=Symbol("ZodOutput");var $input=Symbol("ZodInput");class $ZodRegistry{constructor(){this._map=new WeakMap;this._idmap=new Map}add(schema,..._meta){const meta=_meta[0];this._map.set(schema,meta);if(meta&&typeof meta==="object"&&"id"in meta){this._idmap.set(meta.id,schema)}return this}clear(){this._map=new WeakMap;this._idmap=new Map;return this}remove(schema){const meta=this._map.get(schema);if(meta&&typeof meta==="object"&&"id"in meta){this._idmap.delete(meta.id)}this._map.delete(schema);return this}get(schema){const p2=schema._zod.parent;if(p2){const pm={...this.get(p2)??{}};delete pm.id;const f={...pm,...this._map.get(schema)};return Object.keys(f).length?f:undefined}return this._map.get(schema)}has(schema){return this._map.has(schema)}}function registry(){return new $ZodRegistry}(_a2=globalThis).__zod_globalRegistry??(_a2.__zod_globalRegistry=registry());var globalRegistry=globalThis.__zod_globalRegistry;function _string(Class2,params){return new Class2({type:"string",...normalizeParams(params)})}function _email(Class2,params){return new Class2({type:"string",format:"email",check:"string_format",abort:false,...normalizeParams(params)})}function _guid(Class2,params){return new Class2({type:"string",format:"guid",check:"string_format",abort:false,...normalizeParams(params)})}function _uuid(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,...normalizeParams(params)})}function _uuidv4(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v4",...normalizeParams(params)})}function _uuidv6(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v6",...normalizeParams(params)})}function _uuidv7(Class2,params){return new Class2({type:"string",format:"uuid",check:"string_format",abort:false,version:"v7",...normalizeParams(params)})}function _url(Class2,params){return new Class2({type:"string",format:"url",check:"string_format",abort:false,...normalizeParams(params)})}function _emoji2(Class2,params){return new Class2({type:"string",format:"emoji",check:"string_format",abort:false,...normalizeParams(params)})}function _nanoid(Class2,params){return new Class2({type:"string",format:"nanoid",check:"string_format",abort:false,...normalizeParams(params)})}function _cuid(Class2,params){return new Class2({type:"string",format:"cuid",check:"string_format",abort:false,...normalizeParams(params)})}function _cuid2(Class2,params){return new Class2({type:"string",format:"cuid2",check:"string_format",abort:false,...normalizeParams(params)})}function _ulid(Class2,params){return new Class2({type:"string",format:"ulid",check:"string_format",abort:false,...normalizeParams(params)})}function _xid(Class2,params){return new Class2({type:"string",format:"xid",check:"string_format",abort:false,...normalizeParams(params)})}function _ksuid(Class2,params){return new Class2({type:"string",format:"ksuid",check:"string_format",abort:false,...normalizeParams(params)})}function _ipv4(Class2,params){return new Class2({type:"string",format:"ipv4",check:"string_format",abort:false,...normalizeParams(params)})}function _ipv6(Class2,params){return new Class2({type:"string",format:"ipv6",check:"string_format",abort:false,...normalizeParams(params)})}function _cidrv4(Class2,params){return new Class2({type:"string",format:"cidrv4",check:"string_format",abort:false,...normalizeParams(params)})}function _cidrv6(Class2,params){return new Class2({type:"string",format:"cidrv6",check:"string_format",abort:false,...normalizeParams(params)})}function _base64(Class2,params){return new Class2({type:"string",format:"base64",check:"string_format",abort:false,...normalizeParams(params)})}function _base64url(Class2,params){return new Class2({type:"string",format:"base64url",check:"string_format",abort:false,...normalizeParams(params)})}function _e164(Class2,params){return new Class2({type:"string",format:"e164",check:"string_format",abort:false,...normalizeParams(params)})}function _jwt(Class2,params){return new Class2({type:"string",format:"jwt",check:"string_format",abort:false,...normalizeParams(params)})}function _isoDateTime(Class2,params){return new Class2({type:"string",format:"datetime",check:"string_format",offset:false,local:false,precision:null,...normalizeParams(params)})}function _isoDate(Class2,params){return new Class2({type:"string",format:"date",check:"string_format",...normalizeParams(params)})}function _isoTime(Class2,params){return new Class2({type:"string",format:"time",check:"string_format",precision:null,...normalizeParams(params)})}function _isoDuration(Class2,params){return new Class2({type:"string",format:"duration",check:"string_format",...normalizeParams(params)})}function _number(Class2,params){return new Class2({type:"number",checks:[],...normalizeParams(params)})}function _int(Class2,params){return new Class2({type:"number",check:"number_format",abort:false,format:"safeint",...normalizeParams(params)})}function _boolean(Class2,params){return new Class2({type:"boolean",...normalizeParams(params)})}function _unknown(Class2){return new Class2({type:"unknown"})}function _never(Class2,params){return new Class2({type:"never",...normalizeParams(params)})}function _lt(value,params){return new $ZodCheckLessThan({check:"less_than",...normalizeParams(params),value,inclusive:false})}function _lte(value,params){return new $ZodCheckLessThan({check:"less_than",...normalizeParams(params),value,inclusive:true})}function _gt(value,params){return new $ZodCheckGreaterThan({check:"greater_than",...normalizeParams(params),value,inclusive:false})}function _gte(value,params){return new $ZodCheckGreaterThan({check:"greater_than",...normalizeParams(params),value,inclusive:true})}function _multipleOf(value,params){return new $ZodCheckMultipleOf({check:"multiple_of",...normalizeParams(params),value})}function _maxLength(maximum,params){const ch=new $ZodCheckMaxLength({check:"max_length",...normalizeParams(params),maximum});return ch}function _minLength(minimum,params){return new $ZodCheckMinLength({check:"min_length",...normalizeParams(params),minimum})}function _length(length,params){return new $ZodCheckLengthEquals({check:"length_equals",...normalizeParams(params),length})}function _regex(pattern,params){return new $ZodCheckRegex({check:"string_format",format:"regex",...normalizeParams(params),pattern})}function _lowercase(params){return new $ZodCheckLowerCase({check:"string_format",format:"lowercase",...normalizeParams(params)})}function _uppercase(params){return new $ZodCheckUpperCase({check:"string_format",format:"uppercase",...normalizeParams(params)})}function _includes(includes,params){return new $ZodCheckIncludes({check:"string_format",format:"includes",...normalizeParams(params),includes})}function _startsWith(prefix,params){return new $ZodCheckStartsWith({check:"string_format",format:"starts_with",...normalizeParams(params),prefix})}function _endsWith(suffix,params){return new $ZodCheckEndsWith({check:"string_format",format:"ends_with",...normalizeParams(params),suffix})}function _overwrite(tx){return new $ZodCheckOverwrite({check:"overwrite",tx})}function _normalize(form){return _overwrite((input)=>input.normalize(form))}function _trim(){return _overwrite((input)=>input.trim())}function _toLowerCase(){return _overwrite((input)=>input.toLowerCase())}function _toUpperCase(){return _overwrite((input)=>input.toUpperCase())}function _slugify(){return _overwrite((input)=>slugify(input))}function _array(Class2,element,params){return new Class2({type:"array",element,...normalizeParams(params)})}function _refine(Class2,fn,_params){const schema=new Class2({type:"custom",check:"custom",fn,...normalizeParams(_params)});return schema}function _superRefine(fn,params){const ch=_check((payload)=>{payload.addIssue=(issue2)=>{if(typeof issue2==="string"){payload.issues.push(issue(issue2,payload.value,ch._zod.def))}else{const _issue=issue2;if(_issue.fatal)_issue.continue=false;_issue.code??(_issue.code="custom");_issue.input??(_issue.input=payload.value);_issue.inst??(_issue.inst=ch);_issue.continue??(_issue.continue=!ch._zod.def.abort);payload.issues.push(issue(_issue))}};return fn(payload.value,payload)},params);return ch}function _check(fn,params){const ch=new $ZodCheck({check:"custom",...normalizeParams(params)});ch._zod.check=fn;return ch}function initializeContext(params){let target=params?.target??"draft-2020-12";if(target==="draft-4")target="draft-04";if(target==="draft-7")target="draft-07";return{processors:params.processors??{},metadataRegistry:params?.metadata??globalRegistry,target,unrepresentable:params?.unrepresentable??"throw",override:params?.override??(()=>{}),io:params?.io??"output",counter:0,seen:new Map,cycles:params?.cycles??"ref",reused:params?.reused??"inline",external:params?.external??undefined}}function process2(schema,ctx,_params={path:[],schemaPath:[]}){var _a3;const def=schema._zod.def;const seen=ctx.seen.get(schema);if(seen){seen.count++;const isCycle=_params.schemaPath.includes(schema);if(isCycle){seen.cycle=_params.path}return seen.schema}const result={schema:{},count:1,cycle:undefined,path:_params.path};ctx.seen.set(schema,result);const overrideSchema=schema._zod.toJSONSchema?.();if(overrideSchema){result.schema=overrideSchema}else{const params={..._params,schemaPath:[..._params.schemaPath,schema],path:_params.path};if(schema._zod.processJSONSchema){schema._zod.processJSONSchema(ctx,result.schema,params)}else{const _json=result.schema;const processor=ctx.processors[def.type];if(!processor){throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`)}processor(schema,ctx,_json,params)}const parent=schema._zod.parent;if(parent){if(!result.ref)result.ref=parent;process2(parent,ctx,params);ctx.seen.get(parent).isParent=true}}const meta=ctx.metadataRegistry.get(schema);if(meta)Object.assign(result.schema,meta);if(ctx.io==="input"&&isTransforming(schema)){delete result.schema.examples;delete result.schema.default}if(ctx.io==="input"&&"_prefault"in result.schema)(_a3=result.schema).default??(_a3.default=result.schema._prefault);delete result.schema._prefault;const _result=ctx.seen.get(schema);return _result.schema}function extractDefs(ctx,schema){const root=ctx.seen.get(schema);if(!root)throw new Error("Unprocessed schema. This is a bug in Zod.");const idToSchema=new Map;for(const entry of ctx.seen.entries()){const id=ctx.metadataRegistry.get(entry[0])?.id;if(id){const existing=idToSchema.get(id);if(existing&&existing!==entry[0]){throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`)}idToSchema.set(id,entry[0])}}const makeURI=(entry)=>{const defsSegment=ctx.target==="draft-2020-12"?"$defs":"definitions";if(ctx.external){const externalId=ctx.external.registry.get(entry[0])?.id;const uriGenerator=ctx.external.uri??((id2)=>id2);if(externalId){return{ref:uriGenerator(externalId)}}const id=entry[1].defId??entry[1].schema.id??`schema${ctx.counter++}`;entry[1].defId=id;return{defId:id,ref:`${uriGenerator("__shared")}#/${defsSegment}/${id}`}}if(entry[1]===root){return{ref:"#"}}const uriPrefix=`#`;const defUriPrefix=`${uriPrefix}/${defsSegment}/`;const defId=entry[1].schema.id??`__schema${ctx.counter++}`;return{defId,ref:defUriPrefix+defId}};const extractToDef=(entry)=>{if(entry[1].schema.$ref){return}const seen=entry[1];const{ref,defId}=makeURI(entry);seen.def={...seen.schema};if(defId)seen.defId=defId;const schema2=seen.schema;for(const key in schema2){delete schema2[key]}schema2.$ref=ref};if(ctx.cycles==="throw"){for(const entry of ctx.seen.entries()){const seen=entry[1];if(seen.cycle){throw new Error("Cycle detected: "+`#/${seen.cycle?.join("/")}/<root>`+'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.')}}}for(const entry of ctx.seen.entries()){const seen=entry[1];if(schema===entry[0]){extractToDef(entry);continue}if(ctx.external){const ext=ctx.external.registry.get(entry[0])?.id;if(schema!==entry[0]&&ext){extractToDef(entry);continue}}const id=ctx.metadataRegistry.get(entry[0])?.id;if(id){extractToDef(entry);continue}if(seen.cycle){extractToDef(entry);continue}if(seen.count>1){if(ctx.reused==="ref"){extractToDef(entry);continue}}}}function finalize(ctx,schema){const root=ctx.seen.get(schema);if(!root)throw new Error("Unprocessed schema. This is a bug in Zod.");const flattenRef=(zodSchema)=>{const seen=ctx.seen.get(zodSchema);if(seen.ref===null)return;const schema2=seen.def??seen.schema;const _cached={...schema2};const ref=seen.ref;seen.ref=null;if(ref){flattenRef(ref);const refSeen=ctx.seen.get(ref);const refSchema=refSeen.schema;if(refSchema.$ref&&(ctx.target==="draft-07"||ctx.target==="draft-04"||ctx.target==="openapi-3.0")){schema2.allOf=schema2.allOf??[];schema2.allOf.push(refSchema)}else{Object.assign(schema2,refSchema)}Object.assign(schema2,_cached);const isParentRef=zodSchema._zod.parent===ref;if(isParentRef){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(!(key in _cached)){delete schema2[key]}}}if(refSchema.$ref&&refSeen.def){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(key in refSeen.def&&JSON.stringify(schema2[key])===JSON.stringify(refSeen.def[key])){delete schema2[key]}}}}const parent=zodSchema._zod.parent;if(parent&&parent!==ref){flattenRef(parent);const parentSeen=ctx.seen.get(parent);if(parentSeen?.schema.$ref){schema2.$ref=parentSeen.schema.$ref;if(parentSeen.def){for(const key in schema2){if(key==="$ref"||key==="allOf")continue;if(key in parentSeen.def&&JSON.stringify(schema2[key])===JSON.stringify(parentSeen.def[key])){delete schema2[key]}}}}}ctx.override({zodSchema,jsonSchema:schema2,path:seen.path??[]})};for(const entry of[...ctx.seen.entries()].reverse()){flattenRef(entry[0])}const result={};if(ctx.target==="draft-2020-12"){result.$schema="https://json-schema.org/draft/2020-12/schema"}else if(ctx.target==="draft-07"){result.$schema="http://json-schema.org/draft-07/schema#"}else if(ctx.target==="draft-04"){result.$schema="http://json-schema.org/draft-04/schema#"}else if(ctx.target==="openapi-3.0"){}else{}if(ctx.external?.uri){const id=ctx.external.registry.get(schema)?.id;if(!id)throw new Error("Schema is missing an `id` property");result.$id=ctx.external.uri(id)}Object.assign(result,root.def??root.schema);const rootMetaId=ctx.metadataRegistry.get(schema)?.id;if(rootMetaId!==undefined&&result.id===rootMetaId)delete result.id;const defs=ctx.external?.defs??{};for(const entry of ctx.seen.entries()){const seen=entry[1];if(seen.def&&seen.defId){if(seen.def.id===seen.defId)delete seen.def.id;defs[seen.defId]=seen.def}}if(ctx.external){}else{if(Object.keys(defs).length>0){if(ctx.target==="draft-2020-12"){result.$defs=defs}else{result.definitions=defs}}}try{const finalized=JSON.parse(JSON.stringify(result));Object.defineProperty(finalized,"~standard",{value:{...schema["~standard"],jsonSchema:{input:createStandardJSONSchemaMethod(schema,"input",ctx.processors),output:createStandardJSONSchemaMethod(schema,"output",ctx.processors)}},enumerable:false,writable:false});return finalized}catch(_err){throw new Error("Error converting schema to JSON.")}}function isTransforming(_schema,_ctx){const ctx=_ctx??{seen:new Set};if(ctx.seen.has(_schema))return false;ctx.seen.add(_schema);const def=_schema._zod.def;if(def.type==="transform")return true;if(def.type==="array")return isTransforming(def.element,ctx);if(def.type==="set")return isTransforming(def.valueType,ctx);if(def.type==="lazy")return isTransforming(def.getter(),ctx);if(def.type==="promise"||def.type==="optional"||def.type==="nonoptional"||def.type==="nullable"||def.type==="readonly"||def.type==="default"||def.type==="prefault"){return isTransforming(def.innerType,ctx)}if(def.type==="intersection"){return isTransforming(def.left,ctx)||isTransforming(def.right,ctx)}if(def.type==="record"||def.type==="map"){return isTransforming(def.keyType,ctx)||isTransforming(def.valueType,ctx)}if(def.type==="pipe"){if(_schema._zod.traits.has("$ZodCodec"))return true;return isTransforming(def.in,ctx)||isTransforming(def.out,ctx)}if(def.type==="object"){for(const key in def.shape){if(isTransforming(def.shape[key],ctx))return true}return false}if(def.type==="union"){for(const option of def.options){if(isTransforming(option,ctx))return true}return false}if(def.type==="tuple"){for(const item of def.items){if(isTransforming(item,ctx))return true}if(def.rest&&isTransforming(def.rest,ctx))return true;return false}return false}var createToJSONSchemaMethod=(schema,processors={})=>(params)=>{const ctx=initializeContext({...params,processors});process2(schema,ctx);extractDefs(ctx,schema);return finalize(ctx,schema)};var createStandardJSONSchemaMethod=(schema,io,processors={})=>(params)=>{const{libraryOptions,target}=params??{};const ctx=initializeContext({...libraryOptions??{},target,io,processors});process2(schema,ctx);extractDefs(ctx,schema);return finalize(ctx,schema)};var formatMap={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};var stringProcessor=(schema,ctx,_json,_params)=>{const json=_json;json.type="string";const{minimum,maximum,format,patterns,contentEncoding}=schema._zod.bag;if(typeof minimum==="number")json.minLength=minimum;if(typeof maximum==="number")json.maxLength=maximum;if(format){json.format=formatMap[format]??format;if(json.format==="")delete json.format;if(format==="time"){delete json.format}}if(contentEncoding)json.contentEncoding=contentEncoding;if(patterns&&patterns.size>0){const regexes=[...patterns];if(regexes.length===1)json.pattern=regexes[0].source;else if(regexes.length>1){json.allOf=[...regexes.map((regex)=>({...ctx.target==="draft-07"||ctx.target==="draft-04"||ctx.target==="openapi-3.0"?{type:"string"}:{},pattern:regex.source}))]}}};var numberProcessor=(schema,ctx,_json,_params)=>{const json=_json;const{minimum,maximum,format,multipleOf,exclusiveMaximum,exclusiveMinimum}=schema._zod.bag;if(typeof format==="string"&&format.includes("int"))json.type="integer";else json.type="number";const exMin=typeof exclusiveMinimum==="number"&&exclusiveMinimum>=(minimum??Number.NEGATIVE_INFINITY);const exMax=typeof exclusiveMaximum==="number"&&exclusiveMaximum<=(maximum??Number.POSITIVE_INFINITY);const legacy=ctx.target==="draft-04"||ctx.target==="openapi-3.0";if(exMin){if(legacy){json.minimum=exclusiveMinimum;json.exclusiveMinimum=true}else{json.exclusiveMinimum=exclusiveMinimum}}else if(typeof minimum==="number"){json.minimum=minimum}if(exMax){if(legacy){json.maximum=exclusiveMaximum;json.exclusiveMaximum=true}else{json.exclusiveMaximum=exclusiveMaximum}}else if(typeof maximum==="number"){json.maximum=maximum}if(typeof multipleOf==="number")json.multipleOf=multipleOf};var booleanProcessor=(_schema,_ctx,json,_params)=>{json.type="boolean"};var neverProcessor=(_schema,_ctx,json,_params)=>{json.not={}};var unknownProcessor=(_schema,_ctx,_json,_params)=>{};var enumProcessor=(schema,_ctx,json,_params)=>{const def=schema._zod.def;const values=getEnumValues(def.entries);if(values.every((v)=>typeof v==="number"))json.type="number";if(values.every((v)=>typeof v==="string"))json.type="string";json.enum=values};var literalProcessor=(schema,ctx,json,_params)=>{const def=schema._zod.def;const vals=[];for(const val of def.values){if(val===undefined){if(ctx.unrepresentable==="throw"){throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else{}}else if(typeof val==="bigint"){if(ctx.unrepresentable==="throw"){throw new Error("BigInt literals cannot be represented in JSON Schema")}else{vals.push(Number(val))}}else{vals.push(val)}}if(vals.length===0){}else if(vals.length===1){const val=vals[0];json.type=val===null?"null":typeof val;if(ctx.target==="draft-04"||ctx.target==="openapi-3.0"){json.enum=[val]}else{json.const=val}}else{if(vals.every((v)=>typeof v==="number"))json.type="number";if(vals.every((v)=>typeof v==="string"))json.type="string";if(vals.every((v)=>typeof v==="boolean"))json.type="boolean";if(vals.every((v)=>v===null))json.type="null";json.enum=vals}};var customProcessor=(_schema,ctx,_json,_params)=>{if(ctx.unrepresentable==="throw"){throw new Error("Custom types cannot be represented in JSON Schema")}};var transformProcessor=(_schema,ctx,_json,_params)=>{if(ctx.unrepresentable==="throw"){throw new Error("Transforms cannot be represented in JSON Schema")}};var arrayProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;const{minimum,maximum}=schema._zod.bag;if(typeof minimum==="number")json.minItems=minimum;if(typeof maximum==="number")json.maxItems=maximum;json.type="array";json.items=process2(def.element,ctx,{...params,path:[...params.path,"items"]})};var objectProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;json.type="object";json.properties={};const shape=def.shape;for(const key in shape){json.properties[key]=process2(shape[key],ctx,{...params,path:[...params.path,"properties",key]})}const allKeys=new Set(Object.keys(shape));const requiredKeys=new Set([...allKeys].filter((key)=>{const v=def.shape[key]._zod;if(ctx.io==="input"){return v.optin===undefined}else{return v.optout===undefined}}));if(requiredKeys.size>0){json.required=Array.from(requiredKeys)}if(def.catchall?._zod.def.type==="never"){json.additionalProperties=false}else if(!def.catchall){if(ctx.io==="output")json.additionalProperties=false}else if(def.catchall){json.additionalProperties=process2(def.catchall,ctx,{...params,path:[...params.path,"additionalProperties"]})}};var unionProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const isExclusive=def.inclusive===false;const options=def.options.map((x2,i)=>process2(x2,ctx,{...params,path:[...params.path,isExclusive?"oneOf":"anyOf",i]}));if(isExclusive){json.oneOf=options}else{json.anyOf=options}};var intersectionProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const a=process2(def.left,ctx,{...params,path:[...params.path,"allOf",0]});const b3=process2(def.right,ctx,{...params,path:[...params.path,"allOf",1]});const isSimpleIntersection=(val)=>("allOf"in val)&&Object.keys(val).length===1;const allOf=[...isSimpleIntersection(a)?a.allOf:[a],...isSimpleIntersection(b3)?b3.allOf:[b3]];json.allOf=allOf};var recordProcessor=(schema,ctx,_json,params)=>{const json=_json;const def=schema._zod.def;json.type="object";const keyType=def.keyType;const keyBag=keyType._zod.bag;const patterns=keyBag?.patterns;if(def.mode==="loose"&&patterns&&patterns.size>0){const valueSchema=process2(def.valueType,ctx,{...params,path:[...params.path,"patternProperties","*"]});json.patternProperties={};for(const pattern of patterns){json.patternProperties[pattern.source]=valueSchema}}else{if(ctx.target==="draft-07"||ctx.target==="draft-2020-12"){json.propertyNames=process2(def.keyType,ctx,{...params,path:[...params.path,"propertyNames"]})}json.additionalProperties=process2(def.valueType,ctx,{...params,path:[...params.path,"additionalProperties"]})}const keyValues=keyType._zod.values;if(keyValues){const validKeyValues=[...keyValues].filter((v)=>typeof v==="string"||typeof v==="number");if(validKeyValues.length>0){json.required=validKeyValues}}};var nullableProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;const inner=process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);if(ctx.target==="openapi-3.0"){seen.ref=def.innerType;json.nullable=true}else{json.anyOf=[inner,{type:"null"}]}};var nonoptionalProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType};var defaultProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;json.default=JSON.parse(JSON.stringify(def.defaultValue))};var prefaultProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;if(ctx.io==="input")json._prefault=JSON.parse(JSON.stringify(def.defaultValue))};var catchProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;let catchValue;try{catchValue=def.catchValue(undefined)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}json.default=catchValue};var pipeProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;const inIsTransform=def.in._zod.traits.has("$ZodTransform");const innerType=ctx.io==="input"?inIsTransform?def.out:def.in:def.out;process2(innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=innerType};var readonlyProcessor=(schema,ctx,json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType;json.readOnly=true};var optionalProcessor=(schema,ctx,_json,params)=>{const def=schema._zod.def;process2(def.innerType,ctx,params);const seen=ctx.seen.get(schema);seen.ref=def.innerType};var ZodISODateTime=$constructor("ZodISODateTime",(inst,def)=>{$ZodISODateTime.init(inst,def);ZodStringFormat.init(inst,def)});function datetime2(params){return _isoDateTime(ZodISODateTime,params)}var ZodISODate=$constructor("ZodISODate",(inst,def)=>{$ZodISODate.init(inst,def);ZodStringFormat.init(inst,def)});function date2(params){return _isoDate(ZodISODate,params)}var ZodISOTime=$constructor("ZodISOTime",(inst,def)=>{$ZodISOTime.init(inst,def);ZodStringFormat.init(inst,def)});function time2(params){return _isoTime(ZodISOTime,params)}var ZodISODuration=$constructor("ZodISODuration",(inst,def)=>{$ZodISODuration.init(inst,def);ZodStringFormat.init(inst,def)});function duration2(params){return _isoDuration(ZodISODuration,params)}var initializer2=(inst,issues)=>{$ZodError.init(inst,issues);inst.name="ZodError";Object.defineProperties(inst,{format:{value:(mapper)=>formatError(inst,mapper)},flatten:{value:(mapper)=>flattenError(inst,mapper)},addIssue:{value:(issue2)=>{inst.issues.push(issue2);inst.message=JSON.stringify(inst.issues,jsonStringifyReplacer,2)}},addIssues:{value:(issues2)=>{inst.issues.push(...issues2);inst.message=JSON.stringify(inst.issues,jsonStringifyReplacer,2)}},isEmpty:{get(){return inst.issues.length===0}}})};var ZodRealError=$constructor("ZodError",initializer2,{Parent:Error});var parse3=_parse(ZodRealError);var parseAsync2=_parseAsync(ZodRealError);var safeParse2=_safeParse(ZodRealError);var safeParseAsync2=_safeParseAsync(ZodRealError);var encode=_encode(ZodRealError);var decode=_decode(ZodRealError);var encodeAsync=_encodeAsync(ZodRealError);var decodeAsync=_decodeAsync(ZodRealError);var safeEncode=_safeEncode(ZodRealError);var safeDecode=_safeDecode(ZodRealError);var safeEncodeAsync=_safeEncodeAsync(ZodRealError);var safeDecodeAsync=_safeDecodeAsync(ZodRealError);var _installedGroups=new WeakMap;function _installLazyMethods(inst,group,methods){const proto=Object.getPrototypeOf(inst);let installed=_installedGroups.get(proto);if(!installed){installed=new Set;_installedGroups.set(proto,installed)}if(installed.has(group))return;installed.add(group);for(const key in methods){const fn=methods[key];Object.defineProperty(proto,key,{configurable:true,enumerable:false,get(){const bound=fn.bind(this);Object.defineProperty(this,key,{configurable:true,writable:true,enumerable:true,value:bound});return bound},set(v){Object.defineProperty(this,key,{configurable:true,writable:true,enumerable:true,value:v})}})}}var ZodType=$constructor("ZodType",(inst,def)=>{$ZodType.init(inst,def);Object.assign(inst["~standard"],{jsonSchema:{input:createStandardJSONSchemaMethod(inst,"input"),output:createStandardJSONSchemaMethod(inst,"output")}});inst.toJSONSchema=createToJSONSchemaMethod(inst,{});inst.def=def;inst.type=def.type;Object.defineProperty(inst,"_def",{value:def});inst.parse=(data,params)=>parse3(inst,data,params,{callee:inst.parse});inst.safeParse=(data,params)=>safeParse2(inst,data,params);inst.parseAsync=async(data,params)=>parseAsync2(inst,data,params,{callee:inst.parseAsync});inst.safeParseAsync=async(data,params)=>safeParseAsync2(inst,data,params);inst.spa=inst.safeParseAsync;inst.encode=(data,params)=>encode(inst,data,params);inst.decode=(data,params)=>decode(inst,data,params);inst.encodeAsync=async(data,params)=>encodeAsync(inst,data,params);inst.decodeAsync=async(data,params)=>decodeAsync(inst,data,params);inst.safeEncode=(data,params)=>safeEncode(inst,data,params);inst.safeDecode=(data,params)=>safeDecode(inst,data,params);inst.safeEncodeAsync=async(data,params)=>safeEncodeAsync(inst,data,params);inst.safeDecodeAsync=async(data,params)=>safeDecodeAsync(inst,data,params);_installLazyMethods(inst,"ZodType",{check(...chks){const def2=this.def;return this.clone(exports_util.mergeDefs(def2,{checks:[...def2.checks??[],...chks.map((ch)=>typeof ch==="function"?{_zod:{check:ch,def:{check:"custom"},onattach:[]}}:ch)]}),{parent:true})},with(...chks){return this.check(...chks)},clone(def2,params){return clone(this,def2,params)},brand(){return this},register(reg,meta2){reg.add(this,meta2);return this},refine(check,params){return this.check(refine(check,params))},superRefine(refinement,params){return this.check(superRefine(refinement,params))},overwrite(fn){return this.check(_overwrite(fn))},optional(){return optional(this)},exactOptional(){return exactOptional(this)},nullable(){return nullable(this)},nullish(){return optional(nullable(this))},nonoptional(params){return nonoptional(this,params)},array(){return array(this)},or(arg){return union([this,arg])},and(arg){return intersection(this,arg)},transform(tx){return pipe(this,transform(tx))},default(d3){return _default(this,d3)},prefault(d3){return prefault(this,d3)},catch(params){return _catch(this,params)},pipe(target){return pipe(this,target)},readonly(){return readonly(this)},describe(description){const cl=this.clone();globalRegistry.add(cl,{description});return cl},meta(...args){if(args.length===0)return globalRegistry.get(this);const cl=this.clone();globalRegistry.add(cl,args[0]);return cl},isOptional(){return this.safeParse(undefined).success},isNullable(){return this.safeParse(null).success},apply(fn){return fn(this)}});Object.defineProperty(inst,"description",{get(){return globalRegistry.get(inst)?.description},configurable:true});return inst});var _ZodString=$constructor("_ZodString",(inst,def)=>{$ZodString.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>stringProcessor(inst,ctx,json,params);const bag=inst._zod.bag;inst.format=bag.format??null;inst.minLength=bag.minimum??null;inst.maxLength=bag.maximum??null;_installLazyMethods(inst,"_ZodString",{regex(...args){return this.check(_regex(...args))},includes(...args){return this.check(_includes(...args))},startsWith(...args){return this.check(_startsWith(...args))},endsWith(...args){return this.check(_endsWith(...args))},min(...args){return this.check(_minLength(...args))},max(...args){return this.check(_maxLength(...args))},length(...args){return this.check(_length(...args))},nonempty(...args){return this.check(_minLength(1,...args))},lowercase(params){return this.check(_lowercase(params))},uppercase(params){return this.check(_uppercase(params))},trim(){return this.check(_trim())},normalize(...args){return this.check(_normalize(...args))},toLowerCase(){return this.check(_toLowerCase())},toUpperCase(){return this.check(_toUpperCase())},slugify(){return this.check(_slugify())}})});var ZodString=$constructor("ZodString",(inst,def)=>{$ZodString.init(inst,def);_ZodString.init(inst,def);inst.email=(params)=>inst.check(_email(ZodEmail,params));inst.url=(params)=>inst.check(_url(ZodURL,params));inst.jwt=(params)=>inst.check(_jwt(ZodJWT,params));inst.emoji=(params)=>inst.check(_emoji2(ZodEmoji,params));inst.guid=(params)=>inst.check(_guid(ZodGUID,params));inst.uuid=(params)=>inst.check(_uuid(ZodUUID,params));inst.uuidv4=(params)=>inst.check(_uuidv4(ZodUUID,params));inst.uuidv6=(params)=>inst.check(_uuidv6(ZodUUID,params));inst.uuidv7=(params)=>inst.check(_uuidv7(ZodUUID,params));inst.nanoid=(params)=>inst.check(_nanoid(ZodNanoID,params));inst.guid=(params)=>inst.check(_guid(ZodGUID,params));inst.cuid=(params)=>inst.check(_cuid(ZodCUID,params));inst.cuid2=(params)=>inst.check(_cuid2(ZodCUID2,params));inst.ulid=(params)=>inst.check(_ulid(ZodULID,params));inst.base64=(params)=>inst.check(_base64(ZodBase64,params));inst.base64url=(params)=>inst.check(_base64url(ZodBase64URL,params));inst.xid=(params)=>inst.check(_xid(ZodXID,params));inst.ksuid=(params)=>inst.check(_ksuid(ZodKSUID,params));inst.ipv4=(params)=>inst.check(_ipv4(ZodIPv4,params));inst.ipv6=(params)=>inst.check(_ipv6(ZodIPv6,params));inst.cidrv4=(params)=>inst.check(_cidrv4(ZodCIDRv4,params));inst.cidrv6=(params)=>inst.check(_cidrv6(ZodCIDRv6,params));inst.e164=(params)=>inst.check(_e164(ZodE164,params));inst.datetime=(params)=>inst.check(datetime2(params));inst.date=(params)=>inst.check(date2(params));inst.time=(params)=>inst.check(time2(params));inst.duration=(params)=>inst.check(duration2(params))});function string2(params){return _string(ZodString,params)}var ZodStringFormat=$constructor("ZodStringFormat",(inst,def)=>{$ZodStringFormat.init(inst,def);_ZodString.init(inst,def)});var ZodEmail=$constructor("ZodEmail",(inst,def)=>{$ZodEmail.init(inst,def);ZodStringFormat.init(inst,def)});var ZodGUID=$constructor("ZodGUID",(inst,def)=>{$ZodGUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodUUID=$constructor("ZodUUID",(inst,def)=>{$ZodUUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodURL=$constructor("ZodURL",(inst,def)=>{$ZodURL.init(inst,def);ZodStringFormat.init(inst,def)});function url(params){return _url(ZodURL,params)}var ZodEmoji=$constructor("ZodEmoji",(inst,def)=>{$ZodEmoji.init(inst,def);ZodStringFormat.init(inst,def)});var ZodNanoID=$constructor("ZodNanoID",(inst,def)=>{$ZodNanoID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCUID=$constructor("ZodCUID",(inst,def)=>{$ZodCUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCUID2=$constructor("ZodCUID2",(inst,def)=>{$ZodCUID2.init(inst,def);ZodStringFormat.init(inst,def)});var ZodULID=$constructor("ZodULID",(inst,def)=>{$ZodULID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodXID=$constructor("ZodXID",(inst,def)=>{$ZodXID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodKSUID=$constructor("ZodKSUID",(inst,def)=>{$ZodKSUID.init(inst,def);ZodStringFormat.init(inst,def)});var ZodIPv4=$constructor("ZodIPv4",(inst,def)=>{$ZodIPv4.init(inst,def);ZodStringFormat.init(inst,def)});var ZodIPv6=$constructor("ZodIPv6",(inst,def)=>{$ZodIPv6.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCIDRv4=$constructor("ZodCIDRv4",(inst,def)=>{$ZodCIDRv4.init(inst,def);ZodStringFormat.init(inst,def)});var ZodCIDRv6=$constructor("ZodCIDRv6",(inst,def)=>{$ZodCIDRv6.init(inst,def);ZodStringFormat.init(inst,def)});var ZodBase64=$constructor("ZodBase64",(inst,def)=>{$ZodBase64.init(inst,def);ZodStringFormat.init(inst,def)});var ZodBase64URL=$constructor("ZodBase64URL",(inst,def)=>{$ZodBase64URL.init(inst,def);ZodStringFormat.init(inst,def)});var ZodE164=$constructor("ZodE164",(inst,def)=>{$ZodE164.init(inst,def);ZodStringFormat.init(inst,def)});var ZodJWT=$constructor("ZodJWT",(inst,def)=>{$ZodJWT.init(inst,def);ZodStringFormat.init(inst,def)});var ZodNumber=$constructor("ZodNumber",(inst,def)=>{$ZodNumber.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>numberProcessor(inst,ctx,json,params);_installLazyMethods(inst,"ZodNumber",{gt(value,params){return this.check(_gt(value,params))},gte(value,params){return this.check(_gte(value,params))},min(value,params){return this.check(_gte(value,params))},lt(value,params){return this.check(_lt(value,params))},lte(value,params){return this.check(_lte(value,params))},max(value,params){return this.check(_lte(value,params))},int(params){return this.check(int(params))},safe(params){return this.check(int(params))},positive(params){return this.check(_gt(0,params))},nonnegative(params){return this.check(_gte(0,params))},negative(params){return this.check(_lt(0,params))},nonpositive(params){return this.check(_lte(0,params))},multipleOf(value,params){return this.check(_multipleOf(value,params))},step(value,params){return this.check(_multipleOf(value,params))},finite(){return this}});const bag=inst._zod.bag;inst.minValue=Math.max(bag.minimum??Number.NEGATIVE_INFINITY,bag.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null;inst.maxValue=Math.min(bag.maximum??Number.POSITIVE_INFINITY,bag.exclusiveMaximum??Number.POSITIVE_INFINITY)??null;inst.isInt=(bag.format??"").includes("int")||Number.isSafeInteger(bag.multipleOf??0.5);inst.isFinite=true;inst.format=bag.format??null});function number2(params){return _number(ZodNumber,params)}var ZodNumberFormat=$constructor("ZodNumberFormat",(inst,def)=>{$ZodNumberFormat.init(inst,def);ZodNumber.init(inst,def)});function int(params){return _int(ZodNumberFormat,params)}var ZodBoolean=$constructor("ZodBoolean",(inst,def)=>{$ZodBoolean.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>booleanProcessor(inst,ctx,json,params)});function boolean2(params){return _boolean(ZodBoolean,params)}var ZodUnknown=$constructor("ZodUnknown",(inst,def)=>{$ZodUnknown.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>unknownProcessor(inst,ctx,json,params)});function unknown(){return _unknown(ZodUnknown)}var ZodNever=$constructor("ZodNever",(inst,def)=>{$ZodNever.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>neverProcessor(inst,ctx,json,params)});function never(params){return _never(ZodNever,params)}var ZodArray=$constructor("ZodArray",(inst,def)=>{$ZodArray.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>arrayProcessor(inst,ctx,json,params);inst.element=def.element;_installLazyMethods(inst,"ZodArray",{min(n,params){return this.check(_minLength(n,params))},nonempty(params){return this.check(_minLength(1,params))},max(n,params){return this.check(_maxLength(n,params))},length(n,params){return this.check(_length(n,params))},unwrap(){return this.element}})});function array(element,params){return _array(ZodArray,element,params)}var ZodObject=$constructor("ZodObject",(inst,def)=>{$ZodObjectJIT.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>objectProcessor(inst,ctx,json,params);exports_util.defineLazy(inst,"shape",()=>{return def.shape});_installLazyMethods(inst,"ZodObject",{keyof(){return _enum(Object.keys(this._zod.def.shape))},catchall(catchall){return this.clone({...this._zod.def,catchall})},passthrough(){return this.clone({...this._zod.def,catchall:unknown()})},loose(){return this.clone({...this._zod.def,catchall:unknown()})},strict(){return this.clone({...this._zod.def,catchall:never()})},strip(){return this.clone({...this._zod.def,catchall:undefined})},extend(incoming){return exports_util.extend(this,incoming)},safeExtend(incoming){return exports_util.safeExtend(this,incoming)},merge(other){return exports_util.merge(this,other)},pick(mask){return exports_util.pick(this,mask)},omit(mask){return exports_util.omit(this,mask)},partial(...args){return exports_util.partial(ZodOptional,this,args[0])},required(...args){return exports_util.required(ZodNonOptional,this,args[0])}})});function object(shape,params){const def={type:"object",shape:shape??{},...exports_util.normalizeParams(params)};return new ZodObject(def)}var ZodUnion=$constructor("ZodUnion",(inst,def)=>{$ZodUnion.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>unionProcessor(inst,ctx,json,params);inst.options=def.options});function union(options,params){return new ZodUnion({type:"union",options,...exports_util.normalizeParams(params)})}var ZodDiscriminatedUnion=$constructor("ZodDiscriminatedUnion",(inst,def)=>{ZodUnion.init(inst,def);$ZodDiscriminatedUnion.init(inst,def)});function discriminatedUnion(discriminator,options,params){return new ZodDiscriminatedUnion({type:"union",options,discriminator,...exports_util.normalizeParams(params)})}var ZodIntersection=$constructor("ZodIntersection",(inst,def)=>{$ZodIntersection.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>intersectionProcessor(inst,ctx,json,params)});function intersection(left,right){return new ZodIntersection({type:"intersection",left,right})}var ZodRecord=$constructor("ZodRecord",(inst,def)=>{$ZodRecord.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>recordProcessor(inst,ctx,json,params);inst.keyType=def.keyType;inst.valueType=def.valueType});function record(keyType,valueType,params){if(!valueType||!valueType._zod){return new ZodRecord({type:"record",keyType:string2(),valueType:keyType,...exports_util.normalizeParams(valueType)})}return new ZodRecord({type:"record",keyType,valueType,...exports_util.normalizeParams(params)})}var ZodEnum=$constructor("ZodEnum",(inst,def)=>{$ZodEnum.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>enumProcessor(inst,ctx,json,params);inst.enum=def.entries;inst.options=Object.values(def.entries);const keys=new Set(Object.keys(def.entries));inst.extract=(values,params)=>{const newEntries={};for(const value of values){if(keys.has(value)){newEntries[value]=def.entries[value]}else throw new Error(`Key ${value} not found in enum`)}return new ZodEnum({...def,checks:[],...exports_util.normalizeParams(params),entries:newEntries})};inst.exclude=(values,params)=>{const newEntries={...def.entries};for(const value of values){if(keys.has(value)){delete newEntries[value]}else throw new Error(`Key ${value} not found in enum`)}return new ZodEnum({...def,checks:[],...exports_util.normalizeParams(params),entries:newEntries})}});function _enum(values,params){const entries=Array.isArray(values)?Object.fromEntries(values.map((v)=>[v,v])):values;return new ZodEnum({type:"enum",entries,...exports_util.normalizeParams(params)})}var ZodLiteral=$constructor("ZodLiteral",(inst,def)=>{$ZodLiteral.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>literalProcessor(inst,ctx,json,params);inst.values=new Set(def.values);Object.defineProperty(inst,"value",{get(){if(def.values.length>1){throw new Error("This schema contains multiple valid literal values. Use `.values` instead.")}return def.values[0]}})});function literal(value,params){return new ZodLiteral({type:"literal",values:Array.isArray(value)?value:[value],...exports_util.normalizeParams(params)})}var ZodTransform=$constructor("ZodTransform",(inst,def)=>{$ZodTransform.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>transformProcessor(inst,ctx,json,params);inst._zod.parse=(payload,_ctx)=>{if(_ctx.direction==="backward"){throw new $ZodEncodeError(inst.constructor.name)}payload.addIssue=(issue2)=>{if(typeof issue2==="string"){payload.issues.push(exports_util.issue(issue2,payload.value,def))}else{const _issue=issue2;if(_issue.fatal)_issue.continue=false;_issue.code??(_issue.code="custom");_issue.input??(_issue.input=payload.value);_issue.inst??(_issue.inst=inst);payload.issues.push(exports_util.issue(_issue))}};const output=def.transform(payload.value,payload);if(output instanceof Promise){return output.then((output2)=>{payload.value=output2;payload.fallback=true;return payload})}payload.value=output;payload.fallback=true;return payload}});function transform(fn){return new ZodTransform({type:"transform",transform:fn})}var ZodOptional=$constructor("ZodOptional",(inst,def)=>{$ZodOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>optionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function optional(innerType){return new ZodOptional({type:"optional",innerType})}var ZodExactOptional=$constructor("ZodExactOptional",(inst,def)=>{$ZodExactOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>optionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function exactOptional(innerType){return new ZodExactOptional({type:"optional",innerType})}var ZodNullable=$constructor("ZodNullable",(inst,def)=>{$ZodNullable.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>nullableProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function nullable(innerType){return new ZodNullable({type:"nullable",innerType})}var ZodDefault=$constructor("ZodDefault",(inst,def)=>{$ZodDefault.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>defaultProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType;inst.removeDefault=inst.unwrap});function _default(innerType,defaultValue){return new ZodDefault({type:"default",innerType,get defaultValue(){return typeof defaultValue==="function"?defaultValue():exports_util.shallowClone(defaultValue)}})}var ZodPrefault=$constructor("ZodPrefault",(inst,def)=>{$ZodPrefault.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>prefaultProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function prefault(innerType,defaultValue){return new ZodPrefault({type:"prefault",innerType,get defaultValue(){return typeof defaultValue==="function"?defaultValue():exports_util.shallowClone(defaultValue)}})}var ZodNonOptional=$constructor("ZodNonOptional",(inst,def)=>{$ZodNonOptional.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>nonoptionalProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function nonoptional(innerType,params){return new ZodNonOptional({type:"nonoptional",innerType,...exports_util.normalizeParams(params)})}var ZodCatch=$constructor("ZodCatch",(inst,def)=>{$ZodCatch.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>catchProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType;inst.removeCatch=inst.unwrap});function _catch(innerType,catchValue){return new ZodCatch({type:"catch",innerType,catchValue:typeof catchValue==="function"?catchValue:()=>catchValue})}var ZodPipe=$constructor("ZodPipe",(inst,def)=>{$ZodPipe.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>pipeProcessor(inst,ctx,json,params);inst.in=def.in;inst.out=def.out});function pipe(in_,out){return new ZodPipe({type:"pipe",in:in_,out})}var ZodReadonly=$constructor("ZodReadonly",(inst,def)=>{$ZodReadonly.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>readonlyProcessor(inst,ctx,json,params);inst.unwrap=()=>inst._zod.def.innerType});function readonly(innerType){return new ZodReadonly({type:"readonly",innerType})}var ZodCustom=$constructor("ZodCustom",(inst,def)=>{$ZodCustom.init(inst,def);ZodType.init(inst,def);inst._zod.processJSONSchema=(ctx,json,params)=>customProcessor(inst,ctx,json,params)});function refine(fn,_params={}){return _refine(ZodCustom,fn,_params)}function superRefine(fn,params){return _superRefine(fn,params)}var SKILL_NAME_RE=/^[a-z0-9][a-z0-9._-]*$/;var WhenPredicateSchema=object({engine:array(string2().min(1)).optional(),framework:array(string2().min(1)).optional(),language:array(string2().min(1)).optional(),templateTags:array(string2().min(1)).optional(),flow:array(_enum(["scaffold","init"])).optional()}).strict();var RecommendBlockSchema=object({default:_enum(["always","when","never"]),when:WhenPredicateSchema.optional(),label:string2().min(1).optional(),hint:string2().min(1).optional()}).strict();var SkillFrontmatterSchema=object({name:string2().regex(SKILL_NAME_RE,{error:"Skill name must be lowercase alphanumeric with dots, dashes, or underscores."}),description:string2().min(1),metadata:record(string2(),unknown()).optional(),recommend:RecommendBlockSchema.optional()}).passthrough();var CatalogSkillSchema=object({name:string2().regex(SKILL_NAME_RE),source:string2().min(1),description:string2().min(1),recommend:RecommendBlockSchema.optional()}).strict();var CatalogSourceSchema=object({name:string2().min(1),ref:string2().min(1)}).strict();var SkillsCatalogSchema=object({syncedAt:string2().min(1),sources:array(CatalogSourceSchema),skills:array(CatalogSkillSchema)}).strict();function parseCatalog(raw){const result=SkillsCatalogSchema.safeParse(raw);if(!result.success){const first=result.error.issues[0];const path=first?.path?.join(".")??"<root>";throw new Error(`skills-catalog.json failed validation at ${path}: ${first?.message??"unknown error"}. `+`Re-run \`bun scripts/sync-skills.ts\` to regenerate.`)}return result.data}var skills_catalog_default={syncedAt:"2026-05-11T15:22:36.040Z",sources:[{name:"gamecn (local)",ref:"a3f864a778d2165c6a87803b1dc6495ab3d9f1b5"}],skills:[{name:"gamecn",source:"gamecn (local)",description:"Use the `gamecn` ecosystem for installing, managing, and discovering game assets, components, scenes, and utilities for engines like Three.js, Phaser, Pixi, and other JavaScript/TypeScript-based video games. Components are added as editable source code, not as npm dependencies.",recommend:{default:"always",label:"gamecn",hint:"teaches the agent to use the gamecn CLI"}}]};var CATALOG=parseCatalog(skills_catalog_default);function loadCatalog(){return CATALOG}var SKILLS_BUNDLE={gamecn:{"SKILL.md":`---
|
|
134
|
+
name: gamecn
|
|
135
|
+
description: Use the \`gamecn\` ecosystem for installing, managing, and discovering game assets, components, scenes, and utilities for engines like Three.js, Phaser, Pixi, and other JavaScript/TypeScript-based video games. Components are added as editable source code, not as npm dependencies.
|
|
136
|
+
metadata:
|
|
137
|
+
author: OpusGameLabs
|
|
138
|
+
version: 1.0.0
|
|
139
|
+
recommend:
|
|
140
|
+
default: always
|
|
141
|
+
label: gamecn
|
|
142
|
+
hint: teaches the agent to use the gamecn CLI
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
# GameCN
|
|
146
|
+
|
|
147
|
+
The GameCN CLI (\`gamecn\`) is the package manager for the open game-component ecosystem. It installs editable source code — components, assets, scenes, systems, and full project templates — for games written in JavaScript and TypeScript across Phaser, Three.js, PixiJS, and vanilla setups.
|
|
148
|
+
|
|
149
|
+
> **IMPORTANT**: Run all CLI commands using the project's package runner: \`npx gamecn@latest\`, \`pnpm dlx gamecn@latest\`, or \`bunx --bun gamecn@latest\`. Pick the runner that matches the project's \`packageManager\` field. Examples below use \`npx gamecn@latest\` — substitute the correct runner.
|
|
150
|
+
|
|
151
|
+
## When to Use This Skill
|
|
152
|
+
|
|
153
|
+
Use this skill when the user:
|
|
154
|
+
|
|
155
|
+
- Asks to install, add, or remove items from \`gamecn\`
|
|
156
|
+
- Asks to find, search, or browse \`gamecn\` registries
|
|
157
|
+
- Wants to start a new TypeScript or JavaScript game project
|
|
158
|
+
- Wants to manage assets in a project using Three.js, Phaser, PixiJS, or a similar engine
|
|
159
|
+
- Wants to add a feature that could be served by an existing reusable component (mobile controls, a character controller, a HUD, a scene)
|
|
160
|
+
- References \`gamecn.json\`, the gamecn lockfile, or a registry namespace like \`@main\`
|
|
161
|
+
|
|
162
|
+
## Principles
|
|
163
|
+
|
|
164
|
+
1. **Use existing components first.** Run \`npx gamecn@latest search <query>\` before writing custom systems, UI, or assets. Search community registries too — they're listed in \`gamecn.json\` under \`registries\`.
|
|
165
|
+
2. **Compose, don't reinvent.** Mobile controls = \`mobile-joystick\` + GLTF character controller. A Flappy Bird reskin = \`flappy-bird\` template + a swap-in art pack.
|
|
166
|
+
3. **Use built-in variants before custom styling.** Components ship with sensible defaults — prefer prop/variant changes over forking the source.
|
|
167
|
+
4. **Preview before installing.** Use \`view\` and \`add --dry-run\` to inspect files, dependencies, and conflicts before touching disk.
|
|
168
|
+
5. **Treat installed source as yours.** Files land in the project tree under \`paths.src\` / \`paths.assets\` and are tracked in the lockfile. The user is expected to edit them.
|
|
169
|
+
|
|
170
|
+
## Core Commands
|
|
171
|
+
|
|
172
|
+
The CLI is project-aware: most commands require a \`gamecn.json\` at the project root. Initialize first if it's missing.
|
|
173
|
+
|
|
174
|
+
**Project setup:**
|
|
175
|
+
- \`init\` — detect engine/framework from \`package.json\` and write \`gamecn.json\` (use \`--yes\` to skip prompts, \`--force\` to overwrite)
|
|
176
|
+
- \`create <name>\` — scaffold a new project from a template (e.g., \`--template phaser-endless-runner\`)
|
|
177
|
+
|
|
178
|
+
**Discover:**
|
|
179
|
+
- \`list [namespace]\` — list every item in configured registries; pass a namespace like \`@main\` to scope
|
|
180
|
+
- \`search <query>\` — substring + token-overlap search across all registries
|
|
181
|
+
- \`view <spec>\` — show metadata, files, npm deps, and registry deps for a single item without installing
|
|
182
|
+
|
|
183
|
+
**Install & maintain:**
|
|
184
|
+
- \`add <specs...>\` — resolve, plan, confirm, and install one or more items; runs engine/framework adapter post-install steps
|
|
185
|
+
- \`diff [item]\` — show registry-installed files that have been modified locally (sha256 against the lockfile)
|
|
186
|
+
- \`outdated\` — compare installed versions against the latest manifest in each registry
|
|
187
|
+
|
|
188
|
+
**Authoring (for users publishing their own registries):**
|
|
189
|
+
- \`registry build\` — build a publishable registry from a source tree
|
|
190
|
+
- \`registry validate [name]\` — validate one or all items without emitting
|
|
191
|
+
|
|
192
|
+
### Universally useful flags
|
|
193
|
+
|
|
194
|
+
- \`--json\` — machine-readable output (supported by \`list\`, \`search\`, \`outdated\`, \`diff\`)
|
|
195
|
+
- \`--dry-run\` — \`add\` shows the plan but writes nothing
|
|
196
|
+
- \`--force\` — \`add\` overwrites conflicting files; \`init\` overwrites an existing \`gamecn.json\`
|
|
197
|
+
- \`--yes\` — skip all confirmation prompts (suitable for CI / agent flows)
|
|
198
|
+
- \`--guided\` — \`add\` walks the user through marker-based source edits (e.g., inserting a \`preload()\` call) interactively
|
|
199
|
+
|
|
200
|
+
### Filter flags (shared by \`list\` and \`search\`)
|
|
201
|
+
|
|
202
|
+
- \`--type <type>\` — e.g. \`registry:component\`, \`registry:asset\`, \`registry:scene\`, \`registry:template\`
|
|
203
|
+
- \`--engine <engine>\` — \`phaser\`, \`three\`, \`pixi\`, \`vanilla\`
|
|
204
|
+
- \`--framework <fw>\` — \`vanilla\`, \`react\`
|
|
205
|
+
- \`--language <lang>\` — \`typescript\`, \`javascript\`
|
|
206
|
+
- \`--tag <tag>\` — repeatable; filter by registry-item tag
|
|
207
|
+
- \`--registry <ns>\` — limit to one namespace (e.g., \`@main\`)
|
|
208
|
+
- \`--limit <n>\` — \`search\` only; default 50
|
|
209
|
+
|
|
210
|
+
## Critical Rules
|
|
211
|
+
|
|
212
|
+
1. **Never edit the lockfile by hand.** \`gamecn-lock.json\` records sha256s of installed files. Mutate it only through \`add\` / future \`update\`. Hand-edits desync \`diff\` and \`outdated\`.
|
|
213
|
+
2. **Always run \`init\` before \`add\`.** \`add\` errors out with \`ConfigNotFoundError\` if \`gamecn.json\` is missing. If the user is in a fresh repo, run \`init --yes\` first.
|
|
214
|
+
3. **Resolve conflicts deliberately.** When \`add\` reports a conflict (a target file already exists), prefer reading the existing file and merging by hand over \`--force\`. Only use \`--force\` when the user has confirmed they want to overwrite.
|
|
215
|
+
4. **Engine compatibility is non-negotiable.** If \`add\` reports an engine mismatch, do not pass \`--force\` to bypass it without first confirming with the user. The component may rely on APIs that don't exist in their installed engine version.
|
|
216
|
+
5. **Use the project's package runner.** Read \`packageManager\` in \`gamecn.json\` (or fall back to detecting \`package-lock.json\` / \`pnpm-lock.yaml\` / \`bun.lock\` / \`yarn.lock\`). A wrong runner usually still works, but it pollutes the user's lockfile and is annoying to undo.
|
|
217
|
+
6. **Don't add what's already installed.** Run \`list\` (or read \`gamecn-lock.json\`) before suggesting an install. \`add\` will tell the user it's already installed, but proposing a redundant install wastes a turn.
|
|
218
|
+
7. **Read \`view\` output before recommending.** A component that pulls in five npm deps and ten files is a different sell than one that drops a single util. Surface that to the user.
|
|
219
|
+
|
|
220
|
+
## Project Context: \`gamecn.json\`
|
|
221
|
+
|
|
222
|
+
Before working with a project, read \`gamecn.json\`. Key fields:
|
|
223
|
+
|
|
224
|
+
| Field | Why it matters |
|
|
225
|
+
| ---------------- | ------------------------------------------------------------------------------------------- |
|
|
226
|
+
| \`engine\` | \`phaser\` \\| \`three\` \\| \`pixi\` \\| \`vanilla\` — drives which registry items are compatible |
|
|
227
|
+
| \`framework\` | \`vanilla\` \\| \`react\` — determines whether React-flavored items are listed |
|
|
228
|
+
| \`language\` | \`typescript\` \\| \`javascript\` — items publish per-language sources |
|
|
229
|
+
| \`packageManager\` | \`npm\` \\| \`pnpm\` \\| \`yarn\` \\| \`bun\` — use this for runner and any \`npm install\` followups |
|
|
230
|
+
| \`paths.src\` | Where component/system source files install (default \`src\`) |
|
|
231
|
+
| \`paths.assets\` | Where asset files install (default \`public/assets\`) |
|
|
232
|
+
| \`paths.components\`, \`paths.systems\`, \`paths.scenes\`, \`paths.shaders\`, \`paths.ui\` | Optional per-type overrides |
|
|
233
|
+
| \`registries\` | Map of namespaces (e.g. \`@main\`, \`@oglabs\`) to URLs or \`{ url, index, headers }\` objects |
|
|
234
|
+
| \`deps\` | Items that \`create-gamecn\` will \`add\` after scaffolding from a template |
|
|
235
|
+
|
|
236
|
+
If you change any of these, the user should re-run \`gamecn init --force\` or hand-edit — not both.
|
|
237
|
+
|
|
238
|
+
## Registry Item Specs
|
|
239
|
+
|
|
240
|
+
The \`add\`, \`view\`, and dep arrays accept several spec shapes:
|
|
241
|
+
|
|
242
|
+
- \`bare-name\` — resolves against \`@main\` (e.g., \`mobile-joystick\`)
|
|
243
|
+
- \`@scope/name\` — namespaced lookup (e.g., \`@oglabs/parallax-bg\`)
|
|
244
|
+
- \`https://…/manifest.json\` — direct URL to a registry item manifest
|
|
245
|
+
- \`gh:owner/repo[#ref]\` or \`github:owner/repo[#ref]\` — fetch from a GitHub repo
|
|
246
|
+
- \`./relative/path\` or \`../relative/path\` — resolve from disk (useful while authoring)
|
|
247
|
+
|
|
248
|
+
When a user pastes a URL, prefer passing it through verbatim — don't try to translate it to a bare name.
|
|
249
|
+
|
|
250
|
+
## How to Help Users with GameCN
|
|
251
|
+
|
|
252
|
+
### Step 1: Read the project state
|
|
253
|
+
|
|
254
|
+
Before recommending anything, gather context:
|
|
255
|
+
|
|
256
|
+
1. Read \`gamecn.json\` for \`engine\`, \`framework\`, \`language\`, \`paths\`, and configured \`registries\`.
|
|
257
|
+
2. Read \`gamecn-lock.json\` (if present) to know what's already installed.
|
|
258
|
+
3. Skim \`package.json\` to confirm engine versions and the package manager.
|
|
259
|
+
|
|
260
|
+
If \`gamecn.json\` is missing, the project hasn't been initialized — offer to run \`init\`.
|
|
261
|
+
|
|
262
|
+
### Step 2: Match the request to an existing item
|
|
263
|
+
|
|
264
|
+
Run \`search\` with a focused query. Multi-word queries are tokenized and rank items where multiple tokens hit. Filter aggressively: pass \`--engine\`, \`--framework\`, and \`--language\` from the project's \`gamecn.json\` so the user only sees compatible results.
|
|
265
|
+
|
|
266
|
+
\`\`\`bash
|
|
267
|
+
npx gamecn@latest search "mobile joystick" --engine phaser --framework react --language typescript
|
|
268
|
+
\`\`\`
|
|
269
|
+
|
|
270
|
+
If nothing matches in \`@main\`, broaden the search by dropping \`--registry\`, then try synonyms (e.g., "virtual stick", "touch controls").
|
|
271
|
+
|
|
272
|
+
### Step 3: Inspect before installing
|
|
273
|
+
|
|
274
|
+
Run \`view <spec>\` to surface:
|
|
275
|
+
|
|
276
|
+
- Total file count and target paths (will any conflict?)
|
|
277
|
+
- npm dependencies (does the user need to approve adding \`nipplejs\` or similar?)
|
|
278
|
+
- Registry dependencies (does this pull in a partner component?)
|
|
279
|
+
- License
|
|
280
|
+
|
|
281
|
+
Summarize the answer for the user before proposing the install.
|
|
282
|
+
|
|
283
|
+
### Step 4: Plan the install
|
|
284
|
+
|
|
285
|
+
Run \`add <spec> --dry-run\` to print the full plan without writing. Show the user:
|
|
286
|
+
|
|
287
|
+
- Which files will be created
|
|
288
|
+
- Which will conflict with existing files (and what your resolution plan is)
|
|
289
|
+
- Any engine version mismatches
|
|
290
|
+
- Any required npm installs
|
|
291
|
+
|
|
292
|
+
### Step 5: Install, then wire it up
|
|
293
|
+
|
|
294
|
+
Once the user approves, run the real install. For agent flows that don't need prompts:
|
|
295
|
+
|
|
296
|
+
\`\`\`bash
|
|
297
|
+
npx gamecn@latest add <spec> --yes --guided
|
|
298
|
+
\`\`\`
|
|
299
|
+
|
|
300
|
+
\`--guided\` walks through marker-based source edits — items can declare snippets to insert at \`// gamecn:<marker>:start\` / \`// gamecn:<marker>:end\` blocks (e.g., adding a \`this.load.image(...)\` line in a Phaser scene's \`preload()\`). If the project doesn't have the markers yet, the CLI prints a scaffold hint instead of failing.
|
|
301
|
+
|
|
302
|
+
After install, the CLI may emit adapter-specific instructions (a Three.js item might tell you which scene to mount the component in). Surface those to the user verbatim.
|
|
303
|
+
|
|
304
|
+
### Step 6: Maintain
|
|
305
|
+
|
|
306
|
+
- \`gamecn outdated\` periodically to surface upstream releases.
|
|
307
|
+
- \`gamecn diff\` to see whether the user has modified an installed file before suggesting an update.
|
|
308
|
+
- When a registry item is updated, the user's local edits will conflict — resolve them as a normal merge.
|
|
309
|
+
|
|
310
|
+
## Quick Reference
|
|
311
|
+
|
|
312
|
+
\`\`\`bash
|
|
313
|
+
# Initialize gamecn in an existing project (auto-detects engine + framework)
|
|
314
|
+
npx gamecn@latest init -y
|
|
315
|
+
|
|
316
|
+
# Scaffold a new project from a template
|
|
317
|
+
npx gamecn@latest create my-game --template phaser-endless-runner -y
|
|
318
|
+
|
|
319
|
+
# Discover
|
|
320
|
+
npx gamecn@latest list # everything in every configured registry
|
|
321
|
+
npx gamecn@latest list @main --type registry:component # narrow by namespace and type
|
|
322
|
+
npx gamecn@latest search "joystick" --engine phaser # ranked search
|
|
323
|
+
|
|
324
|
+
# Inspect
|
|
325
|
+
npx gamecn@latest view mobile-joystick # files, deps, license — no writes
|
|
326
|
+
|
|
327
|
+
# Install
|
|
328
|
+
npx gamecn@latest add mobile-joystick # interactive
|
|
329
|
+
npx gamecn@latest add mobile-joystick --dry-run # preview only
|
|
330
|
+
npx gamecn@latest add mobile-joystick --yes --guided # CI-friendly + auto-edits
|
|
331
|
+
|
|
332
|
+
# Maintain
|
|
333
|
+
npx gamecn@latest outdated # registry vs. lockfile
|
|
334
|
+
npx gamecn@latest diff # local edits vs. lockfile sha256
|
|
335
|
+
npx gamecn@latest diff mobile-joystick # narrow to one item
|
|
336
|
+
|
|
337
|
+
# Author your own registry
|
|
338
|
+
npx gamecn@latest registry validate
|
|
339
|
+
npx gamecn@latest registry build --src registry --out public --base-url https://my-registry.example.com
|
|
340
|
+
\`\`\`
|
|
341
|
+
|
|
342
|
+
## Common Item Categories
|
|
343
|
+
|
|
344
|
+
When searching, these are the categories users land on most often:
|
|
345
|
+
|
|
346
|
+
| Category | Typical types | Example queries |
|
|
347
|
+
| ----------- | -------------------------------------------------------- | --------------------------------------- |
|
|
348
|
+
| Controls | \`registry:component\`, \`registry:system\` | \`joystick\`, \`keyboard\`, \`gamepad\` |
|
|
349
|
+
| Characters | \`registry:component\`, \`registry:asset\` | \`character controller\`, \`gltf rig\` |
|
|
350
|
+
| UI / HUD | \`registry:component\`, \`registry:ui\` | \`health bar\`, \`score\`, \`pause menu\` |
|
|
351
|
+
| Scenes | \`registry:scene\` | \`main menu\`, \`loading\`, \`game over\` |
|
|
352
|
+
| Templates | \`registry:template\` | \`endless runner\`, \`flappy\`, \`top-down\` |
|
|
353
|
+
| Assets | \`registry:asset\` | \`tileset\`, \`spritesheet\`, \`audio\` |
|
|
354
|
+
| Systems | \`registry:system\` | \`event bus\`, \`state machine\`, \`physics\` |
|
|
355
|
+
| Shaders | \`registry:shader\` | \`outline\`, \`dissolve\`, \`water\` |
|
|
356
|
+
|
|
357
|
+
## Tips for Effective Use
|
|
358
|
+
|
|
359
|
+
1. **Be specific in queries.** \`"phaser parallax"\` ranks better than \`"background"\`.
|
|
360
|
+
2. **Always pass engine + framework filters.** Cross-engine items exist but are the minority — filtering keeps results relevant.
|
|
361
|
+
3. **Prefer \`@main\` for first-time recommendations.** Community registries vary in quality; only promote third-party namespaces when they're already in the user's \`gamecn.json\`.
|
|
362
|
+
4. **Use \`--json\` for parsing.** When you need to programmatically pick an item out of search results, request JSON output instead of scraping the table.
|
|
363
|
+
5. **Treat templates as starting points, not finished games.** After \`gamecn create\`, expect the user to immediately \`add\` more items.
|
|
364
|
+
|
|
365
|
+
## When Nothing Matches
|
|
366
|
+
|
|
367
|
+
If \`search\` returns nothing in \`@main\` and any community registries:
|
|
368
|
+
|
|
369
|
+
1. Acknowledge that no existing item was found.
|
|
370
|
+
2. Offer to build the feature directly using the project's stack.
|
|
371
|
+
3. Mention the user can later publish their work as a registry item — point them at \`gamecn registry build\` and \`gamecn registry validate\`.
|
|
372
|
+
|
|
373
|
+
\`\`\`text
|
|
374
|
+
I searched @main and the configured community registries for "boss healthbar"
|
|
375
|
+
and didn't find a match. I can build it inline against your Phaser scene —
|
|
376
|
+
want me to proceed? If you'd like to share it later, we can extract it into
|
|
377
|
+
a registry item and publish it via \`gamecn registry build\`.
|
|
378
|
+
\`\`\`
|
|
379
|
+
`}};function intersects(a,b3){for(const v of a)if(b3.includes(v))return true;return false}function predicateMatches(when,ctx){if(!when)return false;if(when.engine&&!when.engine.includes(ctx.engine))return false;if(when.framework&&!when.framework.includes(ctx.framework))return false;if(when.language&&!when.language.includes(ctx.language))return false;if(when.flow&&!when.flow.includes(ctx.flow))return false;if(when.templateTags){if(!intersects(when.templateTags,ctx.templateTags))return false}return true}function toRec(skill,ctx){const rec=skill.recommend;const def=rec?.default??"never";let alwaysRecommended=false;let defaultSelected=false;if(def==="always"){alwaysRecommended=true;defaultSelected=true}else if(def==="when"){defaultSelected=predicateMatches(rec?.when,ctx)}return{name:skill.name,label:rec?.label??skill.name,hint:rec?.hint??skill.description,alwaysRecommended,defaultSelected}}function recommendSkills(ctx,opts={}){const catalog=opts.catalog??loadCatalog();const recs=catalog.skills.map((s)=>toRec(s,ctx));recs.sort((a,b3)=>{if(a.alwaysRecommended!==b3.alwaysRecommended){return a.alwaysRecommended?-1:1}if(a.defaultSelected!==b3.defaultSelected){return a.defaultSelected?-1:1}return a.name.localeCompare(b3.name)});return recs}import{mkdir,rm,writeFile}from"node:fs/promises";import{dirname,join,resolve}from"node:path";var SKILL_TARGETS=[".claude/skills",".agent/skills"];async function installSkills(recs,targets){if(recs.length===0){return{installed:[],failed:[],writtenPaths:[]}}const bundle=targets.bundle??SKILLS_BUNDLE;const cwd=resolve(targets.cwd);const installed=[];const failed=[];const writtenPaths=[];for(const rec of recs){const files=bundle[rec.name];if(!files){failed.push({rec,reason:`skill "${rec.name}" not in bundle (catalog/bundle drift; re-run \`bun scripts/sync-skills.ts\`)`});continue}let allOk=true;const recPaths=[];for(const targetRoot of SKILL_TARGETS){const skillDir=join(cwd,targetRoot,rec.name);try{await rm(skillDir,{recursive:true,force:true});await mkdir(skillDir,{recursive:true});for(const[relPath,content]of Object.entries(files)){const dest=join(skillDir,relPath);await mkdir(dirname(dest),{recursive:true});await writeFile(dest,content,"utf8");recPaths.push(dest)}}catch(err){allOk=false;failed.push({rec,reason:`${skillDir}: ${err.message}`});break}}if(allOk)installed.push(rec);if(allOk)writtenPaths.push(...recPaths)}return{installed,failed,writtenPaths}}var import_picocolors2=__toESM(require_picocolors(),1);function applyPreselected(all,preselected){const byName=new Map(all.map((r2)=>[r2.name,r2]));const recs=[];const unknown2=[];for(const name of preselected){const rec=byName.get(name);if(rec)recs.push(rec);else unknown2.push(name)}return{recs,unknown:unknown2}}async function promptSkillsInstall(ctx,opts){if(opts.skip)return{recs:[],unknownPreselected:[]};const all=recommendSkills(ctx,opts.catalog?{catalog:opts.catalog}:{});if(opts.preselected&&opts.preselected.length>0){const{recs,unknown:unknown2}=applyPreselected(all,opts.preselected);return{recs,unknownPreselected:unknown2}}if(opts.yes){return{recs:all.filter((r2)=>r2.defaultSelected),unknownPreselected:[]}}if(all.length===0)return{recs:[],unknownPreselected:[]};const targetHint=opts.cwd?`${opts.cwd}/.claude/skills/<name>/ and ${opts.cwd}/.agent/skills/<name>/`:"<project>/.claude/skills/<name>/ and <project>/.agent/skills/<name>/";Me(`Recommended skills install to:
|
|
380
|
+
${targetHint}
|
|
381
|
+
`+`For Claude Code, Codex, or other skill-aware agents. `+import_picocolors2.default.dim("Skip if you're not using one — press ESC."),"Claude Code / Codex skills");const impl=opts.multiselectImpl??fe;const choice=await impl({message:"Install recommended skills?",options:all.map((rec)=>({value:rec.name,label:rec.alwaysRecommended?`${rec.label} ${import_picocolors2.default.dim("(recommended)")}`:rec.label,hint:rec.hint})),initialValues:all.filter((r2)=>r2.defaultSelected).map((r2)=>r2.name),required:false});if(pD(choice))return{recs:[],unknownPreselected:[]};const selected=new Set(choice);return{recs:all.filter((r2)=>selected.has(r2.name)),unknownPreselected:[]}}var import_picocolors3=__toESM(require_picocolors(),1);function renderSkillsSummary(result,log=console.log){if(result.installed.length===0&&result.failed.length===0){return}if(result.installed.length>0){const names=result.installed.map((r2)=>r2.name).join(", ");log(import_picocolors3.default.green(`✓ Installed skills: ${names}`));log(import_picocolors3.default.dim(" Written to .claude/skills/<name>/ and .agent/skills/<name>/ under the project root."))}if(result.failed.length>0){log(import_picocolors3.default.yellow(`! ${result.failed.length} skill(s) failed to install:`));for(const fail of result.failed){log(import_picocolors3.default.yellow(` - ${fail.rec.name}: ${fail.reason}`))}log(import_picocolors3.default.dim(" Re-run with `--skills <name>` after fixing, or hand-copy from node_modules/@gamecn/skills/skills-bundle/."))}}function renderUnknownPreselected(names,log=console.log){if(names.length===0)return;log(import_picocolors3.default.yellow(`! Unknown skills (not in catalog, ignored): ${names.join(", ")}`))}import{readFile as readFile7}from"node:fs/promises";import{resolve as resolvePath}from"node:path";var ImageAssetSchema=object({id:string2().min(1),type:literal("image"),path:string2().min(1),width:number2().int().positive().optional(),height:number2().int().positive().optional()});var SpritesheetAssetSchema=object({id:string2().min(1),type:literal("spritesheet"),path:string2().min(1),width:number2().int().positive().optional(),height:number2().int().positive().optional(),frameWidth:number2().int().positive(),frameHeight:number2().int().positive(),animations:array(object({key:string2().min(1),frames:array(number2().int().nonnegative()),frameRate:number2().positive().optional(),repeat:number2().int().optional()})).optional()});var AudioAssetSchema=object({id:string2().min(1),type:literal("audio"),path:string2().min(1),duration:number2().nonnegative().optional(),formats:array(_enum(["wav","mp3","ogg","m4a","webm"])).optional()});var ModelAssetSchema=object({id:string2().min(1),type:literal("model"),path:string2().min(1),format:_enum(["glb","gltf","obj","fbx"]),triangles:number2().int().positive().optional(),animations:array(string2()).optional()});var ShaderAssetSchema=object({id:string2().min(1),type:literal("shader"),path:string2().min(1),stage:_enum(["vertex","fragment","compute"])});var TilesetAssetSchema=object({id:string2().min(1),type:literal("tileset"),path:string2().min(1),tileWidth:number2().int().positive(),tileHeight:number2().int().positive(),columns:number2().int().positive().optional(),rows:number2().int().positive().optional()});var AssetSchema=discriminatedUnion("type",[ImageAssetSchema,SpritesheetAssetSchema,AudioAssetSchema,ModelAssetSchema,ShaderAssetSchema,TilesetAssetSchema]);var RegistryConfigSchema=union([string2().min(1),object({url:string2().min(1),index:string2().min(1).optional(),headers:record(string2(),string2()).optional()})]);var DepSpecRegex=/^(?:@[a-z0-9][a-z0-9_-]*\/[a-z0-9][a-z0-9_./-]*|[a-z0-9][a-z0-9_-]*|https?:\/\/[^\s]+|gh:[^\s]+|github:[^\s]+|\.{1,2}\/[^\s]+)$/i;var GamecnConfigSchema=object({$schema:string2().optional(),engine:_enum(["phaser","three","pixi","vanilla"]),framework:_enum(["vanilla","react"]),language:_enum(["typescript","javascript"]),packageManager:_enum(["npm","pnpm","yarn","bun"]).optional().default("npm"),paths:object({src:string2().min(1),assets:string2().min(1),components:string2().optional(),systems:string2().optional(),scenes:string2().optional(),shaders:string2().optional(),ui:string2().optional()}),registries:record(string2(),RegistryConfigSchema).optional(),deps:array(string2().regex(DepSpecRegex,{error:"Each `deps[]` entry must be a registry spec — e.g. `event-bus`, `@main/event-bus`, or `https://...`."})).optional()});var ITEM_TYPES=["registry:template","registry:scene","registry:component","registry:system","registry:asset","registry:shader","registry:audio","registry:model","registry:tileset","registry:ui","registry:hook","registry:utility","registry:config","registry:recipe","registry:plugin"];var LockedFileSchema=object({path:string2().min(1),sha256:string2().regex(/^[a-f0-9]{64}$/,{error:"sha256 must be a 64-character lowercase hex string."})});var LockedItemSchema=object({name:string2().min(1),version:string2().min(1),registry:string2().min(1),resolved:string2().min(1),installedAt:string2(),files:array(LockedFileSchema)});var LockfileSchema=object({$schema:string2().optional(),version:literal(1),items:record(string2(),LockedItemSchema)});var ItemSummarySchema=object({name:string2().min(1),type:_enum(ITEM_TYPES),title:string2(),description:string2(),version:string2().min(1),engines:array(string2()).optional(),frameworks:array(string2()).optional(),languages:array(string2()).optional(),tags:array(string2()).optional()});var RegistryIndexSchema=object({$schema:string2().optional(),name:string2().min(1),homepage:url().optional(),items:array(ItemSummarySchema)});var GENRE_TAGS=["endless-runner","dodger","platformer","top-down-shooter","twin-stick","tower-defense","survivors","racing","puzzle","arcade","simulation","fighter","rpg","blank"];var STYLE_TAGS=["pixel","flat-2d","hand-drawn","low-poly-3d","voxel","photoreal-3d"];var PLATFORM_TAGS=["web","mobile-web","desktop"];var NAMESPACE_VALUES={genre:new Set(GENRE_TAGS),style:new Set(STYLE_TAGS),platform:new Set(PLATFORM_TAGS)};var CONTROLLED_PREFIXES=Object.keys(NAMESPACE_VALUES);function isControlledTag(tag){const idx=tag.indexOf(":");if(idx<=0)return false;const ns=tag.slice(0,idx);const value=tag.slice(idx+1);const allowed=NAMESPACE_VALUES[ns];return allowed!==undefined&&allowed.has(value)}function hasControlledPrefix(tag){for(const ns of CONTROLLED_PREFIXES){if(tag.startsWith(ns+":"))return true}return false}var semverRegex=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;var numericIdentifier="(?:0|[1-9]\\d*)";var prereleaseIdentifier=[numericIdentifier,"\\d*[a-zA-Z-][0-9a-zA-Z-]*"].join("|");var prerelease=`(?:${prereleaseIdentifier})(?:\\.(?:${prereleaseIdentifier}))*`;var build="[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*";var concretePatch=`${numericIdentifier}(?:-${prerelease})?(?:\\+${build})?`;var patch=`(?:[xX*]|${concretePatch})`;var minor=`(?:[xX*]|${numericIdentifier}(?:\\.${patch})?)`;var rangeVersion=`(?:[xX*]|${numericIdentifier}(?:\\.${minor})?)`;var comparatorOperator="(?:<=|>=|<|>|=|~>|~|\\^)";var comparator=`(?:(?:${comparatorOperator})\\s*)?${rangeVersion}`;var comparatorSet=`${comparator}(?:\\s+${comparator})*`;var hyphenRange=`${rangeVersion}\\s+-\\s+${rangeVersion}`;var simpleRange=`(?:${hyphenRange}|${comparatorSet})`;var semverRangeRegex=new RegExp(`^\\s*${simpleRange}(?:\\s*\\|\\|\\s*${simpleRange})*\\s*$`);var FILE_TYPES=["source","asset","documentation"];var integrityRegex=/^sha256-[A-Za-z0-9+/=]+$/;var FileSpecSchema=object({path:string2().min(1),target:string2().min(1),type:_enum(FILE_TYPES),language:_enum(["typescript","javascript"]).optional(),content:string2().optional(),url:url().optional(),integrity:string2().regex(integrityRegex,{error:"Integrity must be a Subresource Integrity string (sha256-...)."}).optional()}).refine((obj)=>!(obj.content!==undefined&&obj.url!==undefined),{error:"File spec cannot have both `content` and `url`."});var PreloadInstructionSchema=object({kind:string2().min(1),key:string2().min(1),path:string2().min(1),frameWidth:number2().int().positive().optional(),frameHeight:number2().int().positive().optional()}).catchall(unknown());var IntegrationBlockSchema=object({preload:array(PreloadInstructionSchema).optional(),usage:array(string2()).optional()});var AuthorSchema=union([string2().min(1),object({name:string2().min(1),url:url().optional(),email:string2().optional()})]);var RegistryItemSchema=object({$schema:string2().optional(),name:string2().min(1),type:_enum(ITEM_TYPES),title:string2(),description:string2(),version:string2().regex(semverRegex,{error:"Invalid SemVer string."}),license:string2().optional(),licenseUrl:url().optional(),author:AuthorSchema,tags:array(string2().refine((s)=>!hasControlledPrefix(s)||isControlledTag(s),{error:"Namespaced tag (genre:/style:/platform:) suffix is not in the controlled vocabulary."})).optional(),attributionRequired:boolean2().optional(),commercialUse:boolean2().optional(),redistribution:boolean2().optional(),aiGenerated:boolean2().optional(),compatibility:object({engines:record(string2(),string2().regex(semverRangeRegex)),frameworks:array(_enum(["vanilla","react"])),languages:array(_enum(["typescript","javascript"])),bundlers:array(string2()),libraries:record(string2(),string2().regex(semverRangeRegex)).optional(),platforms:array(string2()).optional()}).optional(),dependencies:object({npm:array(string2()).optional(),registry:array(string2()).optional()}).optional(),files:array(FileSpecSchema),assets:array(AssetSchema).optional(),integration:record(string2(),IntegrationBlockSchema).optional(),preview:object({thumbnail:url().optional(),demo:url().optional(),gif:url().optional()}).optional()});import{spawn}from"node:child_process";import{mkdir as mkdir4,readFile as readFile6,readdir,writeFile as writeFile5}from"node:fs/promises";import{resolve as resolve5}from"node:path";import{isAbsolute,join as join2,resolve as resolve2,sep}from"node:path";class GamecnError extends Error{constructor(message,name="GamecnError"){super(message);this.name=name}}class ItemNotFoundError extends GamecnError{spec;constructor(spec,reason){super(`Could not resolve item "${spec}": ${reason}`,"ItemNotFoundError");this.spec=spec}}class IntegrityError extends GamecnError{path;expected;actual;constructor(path,expected,actual){super(`Integrity check failed for ${path} (expected ${expected}, got ${actual})`,"IntegrityError");this.path=path;this.expected=expected;this.actual=actual}}class ConflictError extends GamecnError{path;constructor(path){super(`File already exists: ${path}`,"ConflictError");this.path=path}}class IncompatibleError extends GamecnError{constructor(message){super(message,"IncompatibleError")}}class IncompatibleVersionError extends GamecnError{itemName;engine;required;installed;constructor(itemName,engine,required2,installed){super(`${itemName} requires ${engine} ${required2}, but ${installed} is installed.`,"IncompatibleVersionError");this.itemName=itemName;this.engine=engine;this.required=required2;this.installed=installed}}class PathEscapeError extends GamecnError{constructor(target,resolved){super(`File target "${target}" resolves outside the project root (${resolved})`,"PathEscapeError")}}class UnsupportedSourceError extends GamecnError{constructor(message){super(message,"UnsupportedSourceError")}}class HttpError extends GamecnError{url;status;statusText;constructor(url2,status,statusText){super(`HTTP ${status} ${statusText}: ${url2}`,"HttpError");this.url=url2;this.status=status;this.statusText=statusText}}class MissingEnvVarError extends GamecnError{variable;constructor(variable){super(`Required environment variable not set: ${variable}`,"MissingEnvVarError");this.variable=variable}}function resolveTargetPath(config2,target,cwd){const paths=config2.paths;const placeholders={"{src}":paths.src,"{assets}":paths.assets,"{components}":paths.components??join2(paths.src,"components"),"{systems}":paths.systems??join2(paths.src,"systems"),"{scenes}":paths.scenes??join2(paths.src,"scenes"),"{shaders}":paths.shaders??join2(paths.src,"shaders"),"{ui}":paths.ui??join2(paths.src,"ui")};let interpolated=target;for(const[k3,v]of Object.entries(placeholders)){interpolated=interpolated.split(k3).join(v)}const absCwd=resolve2(cwd);const absTarget=isAbsolute(interpolated)?resolve2(interpolated):resolve2(absCwd,interpolated);if(absTarget!==absCwd&&!absTarget.startsWith(absCwd+sep)){throw new PathEscapeError(target,absTarget)}return absTarget}import{createHash}from"node:crypto";import{readFile,writeFile as writeFile2}from"node:fs/promises";import{join as join3}from"node:path";var LOCKFILE_NAME="gamecn-lock.json";async function loadLockfile(cwd){const path=join3(cwd,LOCKFILE_NAME);try{const raw=await readFile(path,"utf8");return LockfileSchema.parse(JSON.parse(raw))}catch(err){if(err.code==="ENOENT"){return{version:1,items:{}}}throw err}}async function saveLockfile(cwd,lock){const path=join3(cwd,LOCKFILE_NAME);await writeFile2(path,JSON.stringify(lock,null,2)+`
|
|
382
|
+
`,"utf8")}function sha256OfBuffer(buf){const hash=createHash("sha256");hash.update(buf);return hash.digest("hex")}function recordInstall(lock,item,registry2,resolved,files){lock.items[item.name]={name:item.name,version:item.version,registry:registry2,resolved,installedAt:new Date().toISOString(),files}}var import_semver=__toESM(require_semver2(),1);import{readFile as readFile2,stat}from"node:fs/promises";import{join as join4,relative,resolve as resolve3}from"node:path";async function fileExists(path){try{await stat(path);return true}catch{return false}}function planFileSource(spec,baseDir,headers){if(spec.content!==undefined){return{kind:"inline",content:spec.content}}if(spec.url!==undefined){return{kind:"remote",url:spec.url,integrity:spec.integrity,...headers?{headers}:{}}}if(baseDir===undefined){throw new UnsupportedSourceError(`File "${spec.path}" has neither content nor url, and no baseDir is set for resolution.`)}return{kind:"local",absolutePath:resolve3(baseDir,spec.path)}}async function readPackageJson(cwd){try{const raw=await readFile2(join4(cwd,"package.json"),"utf8");return JSON.parse(raw)}catch{return}}function depName(spec){if(spec.startsWith("@")){const at2=spec.indexOf("@",1);return at2===-1?spec:spec.slice(0,at2)}const at=spec.indexOf("@");return at===-1?spec:spec.slice(0,at)}function normalizePath(p2){return p2.split(/[\\/]/).join("/")}async function plan(resolved,config2,lock,cwd){const item=resolved.item;const lockEntry=lock.items[item.name];const alreadyInstalled=lockEntry!==undefined&&lockEntry.version===item.version;const files=[];const conflicts=[];for(const spec of item.files){const target=resolveTargetPath(config2,spec.target,cwd);const source=planFileSource(spec,resolved.baseDir,resolved.headers);files.push({spec,source,target});if(await fileExists(target)){const targetRel=normalizePath(relative(cwd,target));const existingOwner=Object.values(lock.items).find((entry)=>entry.files.some((f)=>normalizePath(f.path)===targetRel));if(existingOwner===undefined||existingOwner.name!==item.name){conflicts.push({target,reason:"exists",ownedBy:existingOwner?.name})}}}const pkg=await readPackageJson(cwd);const allDeps={...pkg?.dependencies,...pkg?.devDependencies,...pkg?.peerDependencies};const npmDeps=(item.dependencies?.npm??[]).filter((d3)=>{const name=depName(d3);return!(name in allDeps)});const registryDeps=item.dependencies?.registry??[];const incompatibilities=checkEngineCompatibility(item,allDeps);return{item,resolved,files,conflicts,incompatibilities,npmDeps,registryDeps,alreadyInstalled}}function checkEngineCompatibility(item,allDeps){const required2=item.compatibility?.engines;if(!required2)return[];const out=[];for(const[engine,range]of Object.entries(required2)){const installed=allDeps[engine];if(!installed)continue;const minInstalled=import_semver.default.minVersion(installed);if(!minInstalled)continue;if(!import_semver.default.satisfies(minInstalled,range,{includePrerelease:true})){out.push({itemName:item.name,engine,required:range,installed,message:`${item.name} requires ${engine} ${range}, but ${installed} is installed.`})}}return out}import{randomBytes}from"node:crypto";import{mkdir as mkdir2,readFile as readFile3,rename,writeFile as writeFile3}from"node:fs/promises";import{dirname as dirname2,relative as relative2}from"node:path";async function readSource(file,fetcher){switch(file.source.kind){case"inline":return file.source.content;case"local":return readFile3(file.source.absolutePath);case"remote":if(!fetcher){throw new UnsupportedSourceError(`Remote file "${file.spec.path}" requires an AssetFetcher. Pass one to executePlan via the fetcher argument.`)}return fetcher.fetch(file.source.url,file.source.integrity,file.source.headers)}}async function writeAtomic(target,data){await mkdir2(dirname2(target),{recursive:true});const tmp=`${target}.tmp.${randomBytes(6).toString("hex")}`;await writeFile3(tmp,data);await rename(tmp,target)}function normalizeRelPath(absPath,cwd){return relative2(cwd,absPath).split(/[\\/]/).join("/")}async function executePlan(plan2,lock,cwd,options={},fetcher){const result={itemName:plan2.item.name,installed:[],skipped:[]};if(options.dryRun){return result}if(plan2.incompatibilities.length>0&&!options.force){const first=plan2.incompatibilities[0];throw new IncompatibleVersionError(first.itemName,first.engine,first.required,first.installed)}if(plan2.conflicts.length>0&&!options.force){const first=plan2.conflicts[0];throw new ConflictError(first.target)}for(const file of plan2.files){const data=await readSource(file,fetcher);await writeAtomic(file.target,data);const buf=typeof data==="string"?Buffer.from(data,"utf8"):data;const sha=sha256OfBuffer(buf);result.installed.push({path:normalizeRelPath(file.target,cwd),sha256:sha})}recordInstall(lock,plan2.item,plan2.resolved.registry,plan2.resolved.resolved,result.installed);return result}import{createHash as createHash3}from"node:crypto";import{mkdir as mkdir3,readFile as readFile4,rename as rename2,writeFile as writeFile4}from"node:fs/promises";import{homedir}from"node:os";import{dirname as dirname3,join as join5}from"node:path";import{createHash as createHash2}from"node:crypto";var SRI_RE=/^sha256-([A-Za-z0-9+/]+={0,2})$/;function parseSriSha256(sri){const m2=SRI_RE.exec(sri);if(!m2){throw new Error(`Invalid SRI string (expected "sha256-<base64>"): ${sri}`)}return Buffer.from(m2[1],"base64")}function sriOfBuffer(data){return"sha256-"+createHash2("sha256").update(data).digest("base64")}function hexOfSri(sri){return parseSriSha256(sri).toString("hex")}function verifyIntegrity(sri,data,label){const expected=parseSriSha256(sri);const actual=createHash2("sha256").update(data).digest();if(!expected.equals(actual)){throw new IntegrityError(label,sri,sriOfBuffer(data))}}function defaultCacheDir(){return process.env.GAMECN_CACHE_DIR??join5(homedir(),".gamecn","cache")}function sha1(s){return createHash3("sha1").update(s).digest("hex")}async function sleep(ms){return new Promise((res)=>setTimeout(res,ms))}async function fetchWithRetry(url2,init,opts={}){const attempts=opts.attempts??3;const initialDelayMs=opts.initialDelayMs??250;const fetcher=init.fetcher??fetch;const{fetcher:_3,...rest}=init;let lastErr;for(let i=0;i<attempts;i++){try{const res=await fetcher(url2,rest);if(res.status>=500&&res.status<600&&i<attempts-1){await sleep(initialDelayMs*2**i);continue}return res}catch(err){lastErr=err;if(i<attempts-1){await sleep(initialDelayMs*2**i);continue}}}throw lastErr??new Error(`fetch failed after ${attempts} attempts: ${url2}`)}async function readJsonIfExists(path){try{return JSON.parse(await readFile4(path,"utf8"))}catch(err){if(err.code==="ENOENT")return;throw err}}class ManifestCache{dir;fetcher;constructor(cacheDir,fetcher=fetch){this.dir=join5(cacheDir,"manifests");this.fetcher=fetcher}async getOrFetch(url2,headers={}){const key=sha1(url2);const file=join5(this.dir,`${key}.json`);const metaFile=join5(this.dir,`${key}.meta.json`);const meta2=await readJsonIfExists(metaFile);const reqHeaders={...headers};if(meta2?.etag)reqHeaders["If-None-Match"]=meta2.etag;const res=await fetchWithRetry(url2,{method:"GET",headers:reqHeaders,fetcher:this.fetcher});if(res.status===304){const cached2=await readJsonIfExists(file);if(cached2!==undefined)return cached2;const refetch=await fetchWithRetry(url2,{method:"GET",headers,fetcher:this.fetcher});return parseAndCache(refetch,url2,file,metaFile)}if(!res.ok){throw new HttpError(url2,res.status,res.statusText)}return parseAndCache(res,url2,file,metaFile)}}async function parseAndCache(res,url2,file,metaFile){const text=await res.text();let json;try{json=JSON.parse(text)}catch(err){throw new HttpError(url2,res.status,`invalid JSON: ${err.message}`)}await mkdir3(dirname3(file),{recursive:true});await writeFile4(file,text,"utf8");const meta2={etag:res.headers.get("etag")??undefined,fetchedAt:new Date().toISOString()};await writeFile4(metaFile,JSON.stringify(meta2),"utf8");return json}class AssetCache{dir;fetcher;constructor(cacheDir,fetcher=fetch){this.dir=join5(cacheDir,"assets");this.fetcher=fetcher}async getOrFetch(url2,integrity,headers={}){if(integrity){const hex2=hexOfSri(integrity);const cached2=join5(this.dir,hex2);try{const buf2=await readFile4(cached2);verifyIntegrity(integrity,buf2,cached2);return buf2}catch(err){if(err.code!=="ENOENT"){}}}const res=await fetchWithRetry(url2,{method:"GET",headers,fetcher:this.fetcher});if(!res.ok){throw new HttpError(url2,res.status,res.statusText)}const buf=Buffer.from(await res.arrayBuffer());if(integrity){verifyIntegrity(integrity,buf,url2)}const hex=createHash3("sha256").update(buf).digest("hex");const target=join5(this.dir,hex);await mkdir3(dirname3(target),{recursive:true});const tmp=`${target}.tmp.${createHash3("sha1").update(`${url2}${Date.now()}`).digest("hex").slice(0,8)}`;await writeFile4(tmp,buf);try{await rename2(tmp,target)}catch{}return buf}}import{isAbsolute as isAbsolute2}from"node:path";var ENV_VAR_RE=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function interpolateHeaders(headers,env=process.env){const out={};for(const[k3,v]of Object.entries(headers)){out[k3]=interpolate(v,env)}return out}function interpolate(template,env=process.env){return template.replace(ENV_VAR_RE,(_3,name)=>{const value=env[name];if(value===undefined){throw new MissingEnvVarError(name)}return value})}var DEFAULT_REGISTRY_URL="https://gamecn.dev/r/{name}.json";var BARE_NAME_RE=/^[a-z0-9][a-z0-9_-]{0,213}$/i;class DefaultRegistryResolver{config;cache;env;constructor(config2,cache,env=process.env){this.config=config2;this.cache=cache;this.env=env}canResolve(spec){if(spec.startsWith("@"))return false;if(spec.startsWith("http://")||spec.startsWith("https://"))return false;if(spec.startsWith("gh:")||spec.startsWith("github:"))return false;if(spec.startsWith("./")||spec.startsWith("../"))return false;if(isAbsolute2(spec))return false;if(spec.endsWith(".json"))return false;if(spec.includes("/")||spec.includes("\\"))return false;return BARE_NAME_RE.test(spec)}async resolve(spec,_ctx){const reg=this.config.registries?.["@main"];const urlTemplate=!reg?DEFAULT_REGISTRY_URL:typeof reg==="string"?reg:reg.url;const rawHeaders=typeof reg==="object"&®.headers?reg.headers:{};const headers=interpolateHeaders(rawHeaders,this.env);const url2=urlTemplate.replace(/\{name\}/g,spec);try{const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"@main",resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}catch(err){if(err instanceof HttpError&&err.status===404){throw new ItemNotFoundError(spec,`not found in the default @main registry (${url2}). Either configure 'registries["@main"]' in gamecn.json to point at a different registry, or use a fully-qualified spec (\`@scope/name\`, \`./local.json\`, \`gh:owner/repo/path\`, or \`https://...\`).`)}throw err}}}var GH_PREFIX_RE=/^(gh|github):/;function parseGitHubSpec(spec){if(!GH_PREFIX_RE.test(spec)){throw new ItemNotFoundError(spec,"not a GitHub spec")}const stripped=spec.replace(GH_PREFIX_RE,"");const hashIdx=stripped.indexOf("#");const pathPart=hashIdx===-1?stripped:stripped.slice(0,hashIdx);const ref=hashIdx===-1?"HEAD":stripped.slice(hashIdx+1)||"HEAD";const segs=pathPart.split("/").filter(Boolean);if(segs.length<3){throw new ItemNotFoundError(spec,"expected gh:owner/repo/path/to/item.json")}const[owner,repo,...rest]=segs;return{owner,repo,path:rest.join("/"),ref,hasExplicitRef:hashIdx!==-1}}function githubSpecToUrl(spec){const p2=parseGitHubSpec(spec);return`https://raw.githubusercontent.com/${p2.owner}/${p2.repo}/${p2.ref}/${p2.path}`}class GitHubResolver{cache;env;warn;constructor(cache,env=process.env,warn=(m2)=>console.warn(m2)){this.cache=cache;this.env=env;this.warn=warn}canResolve(spec){return GH_PREFIX_RE.test(spec)}async resolve(spec,_ctx){const parsed=parseGitHubSpec(spec);if(!parsed.hasExplicitRef){this.warn(`[gamecn] ${spec} has no ref; using HEAD (non-reproducible). Pin a ref with #v1.2.0 or #commit-sha.`)}const url2=githubSpecToUrl(spec);const headers={};const token=this.env["GITHUB_TOKEN"];if(token)headers["Authorization"]=`token ${token}`;const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"github",resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}}class HttpsResolver{cache;headers;constructor(cache,headers={}){this.cache=cache;this.headers=headers}canResolve(spec){return spec.startsWith("http://")||spec.startsWith("https://")}async resolve(spec,_ctx){const json=await this.cache.getOrFetch(spec,this.headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:"https",resolved:spec,headers:Object.keys(this.headers).length>0?this.headers:undefined}}}import{readFile as readFile5}from"node:fs/promises";import{dirname as dirname4,isAbsolute as isAbsolute3,resolve as resolve4}from"node:path";class LocalFileResolver{canResolve(spec){if(spec.startsWith("./")||spec.startsWith("../"))return true;if(spec.startsWith("/")||spec.startsWith("~/"))return true;if(/^[A-Za-z]:[\\/]/.test(spec))return true;if(spec.endsWith(".json"))return true;return false}async resolve(spec,ctx){const absSpec=isAbsolute3(spec)?spec:resolve4(ctx.cwd,spec);let raw;try{raw=await readFile5(absSpec,"utf8")}catch(err){const code=err.code;throw new ItemNotFoundError(spec,code==="ENOENT"?"file not found":`read failed: ${err.message}`)}let json;try{json=JSON.parse(raw)}catch(err){throw new ItemNotFoundError(spec,`JSON parse error: ${err.message}`)}const item=RegistryItemSchema.parse(json);return{item,spec,registry:"local",resolved:absSpec,baseDir:dirname4(absSpec)}}}var NAMESPACE_RE=/^(@[A-Za-z0-9_-]+)\/(.+)$/;class NamespaceResolver{config;cache;env;constructor(config2,cache,env=process.env){this.config=config2;this.cache=cache;this.env=env}canResolve(spec){return NAMESPACE_RE.test(spec)}async resolve(spec,_ctx){const m2=NAMESPACE_RE.exec(spec);if(!m2)throw new ItemNotFoundError(spec,"not a namespaced spec");const namespace=m2[1];const name=m2[2];const reg=this.config.registries?.[namespace];if(!reg){throw new ItemNotFoundError(spec,`unknown registry namespace "${namespace}". Add it to gamecn.json#registries.`)}const urlTemplate=typeof reg==="string"?reg:reg.url;const rawHeaders=typeof reg==="string"?{}:reg.headers??{};const headers=interpolateHeaders(rawHeaders,this.env);const url2=urlTemplate.replace(/\{name\}/g,name);const json=await this.cache.getOrFetch(url2,headers);const item=RegistryItemSchema.parse(json);return{item,spec,registry:namespace,resolved:url2,headers:Object.keys(headers).length>0?headers:undefined}}}function createResolver(config2,opts={}){const cacheDir=opts.cacheDir??defaultCacheDir();const fetcher=opts.fetcher??fetch;const env=opts.env??process.env;const manifestCache=new ManifestCache(cacheDir,fetcher);const resolvers=[new NamespaceResolver(config2,manifestCache,env),new GitHubResolver(manifestCache,env),new DefaultRegistryResolver(config2,manifestCache,env),new HttpsResolver(manifestCache),new LocalFileResolver];return{canResolve(spec){return resolvers.some((r2)=>r2.canResolve(spec))},async resolve(spec,ctx){for(const r2 of resolvers){if(r2.canResolve(spec))return r2.resolve(spec,ctx)}throw new ItemNotFoundError(spec,"no resolver matches this spec")}}}function createAssetFetcher(opts={}){const cacheDir=opts.cacheDir??defaultCacheDir();const fetcher=opts.fetcher??fetch;const cache=new AssetCache(cacheDir,fetcher);return{fetch:(url2,integrity,headers)=>cache.getOrFetch(url2,integrity,headers)}}var TEXT_EXTS=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]);var MAX_SCAN_BYTES=256*1024;var SKIP_DIRS=new Set(["node_modules",".git","dist",".turbo",".cache","registry-dist"]);var DEFAULT_ENDPOINT="https://api.gamecn.dev";var TIMEOUT_MS=2000;function isAnalyticsDisabled(){const env=process.env;return env.GAMECN_TELEMETRY==="0"||env.GAMECN_TELEMETRY==="false"||env.DO_NOT_TRACK==="1"||env.NODE_ENV==="test"}function resolveEndpoint(ctx){return ctx?.endpoint??process.env.GAMECN_ANALYTICS_ENDPOINT??DEFAULT_ENDPOINT}async function post(path,body,ctx){if(isAnalyticsDisabled())return;const url2=`${resolveEndpoint(ctx)}${path}`;const ctrl=new AbortController;const timer=setTimeout(()=>ctrl.abort(),TIMEOUT_MS);try{await fetch(url2,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(body),signal:ctrl.signal})}catch{}finally{clearTimeout(timer)}}async function trackTemplateInstall(event,ctx){await post("/analytics/install-template",{id:event.id,version:event.version,cliVersion:ctx?.cliVersion,packageManager:ctx?.packageManager},ctx)}async function trackProjectInit(event,ctx){await post("/analytics/project-init",{flow:event.flow,engine:event.engine,framework:event.framework,language:event.language,template:event.template,cliVersion:ctx?.cliVersion,packageManager:ctx?.packageManager},ctx)}var DEFAULT_REGISTRY="https://gamecn.dev/r/{name}.json";function detectPackageManager2(){const ua=process.env.npm_config_user_agent;if(ua){const name=ua.split(" ")[0]?.split("/")[0];if(name==="bun"||name==="pnpm"||name==="yarn"||name==="npm"){return name}}return"pnpm"}var NAME_RE=/^[a-z0-9][a-z0-9._-]{0,213}$/i;var RESERVED=new Set(["node_modules","favicon.ico"]);function validateProjectName(name){if(!NAME_RE.test(name)){throw new Error(`Invalid project name "${name}". Use lowercase letters, numbers, dot, underscore, or hyphen.`)}if(RESERVED.has(name)||name.startsWith(".")||name.startsWith("_")){throw new Error(`Reserved or invalid project name: "${name}".`)}}async function dirIsEmptyOrMissing(path){try{const entries=await readdir(path);return entries.length===0}catch(err){if(err.code==="ENOENT")return true;throw err}}function resolveTemplateSpec(template){if(template.startsWith("@")||template.startsWith("http://")||template.startsWith("https://")||template.startsWith("gh:")||template.startsWith("github:")||template.startsWith("./")||template.startsWith("/")||/^[A-Za-z]:[\\/]/.test(template)){return template}return`@main/${template}`}async function defaultInstallRunner(cwd,pm){await new Promise((res,rej)=>{const proc=spawn(pm,["install"],{cwd,stdio:"inherit",shell:process.platform==="win32"});proc.on("exit",(code)=>{if(code===0)res();else rej(new Error(`${pm} install exited with code ${code}`))});proc.on("error",rej)})}async function scaffold(opts){validateProjectName(opts.name);const parentDir=opts.parentDir??process.cwd();const cwd=resolve5(parentDir,opts.name);if(!await dirIsEmptyOrMissing(cwd)&&!opts.force){throw new Error(`Directory "${opts.name}" already exists and is not empty. Pass --force to overwrite.`)}await mkdir4(cwd,{recursive:true});const pm=opts.packageManager??detectPackageManager2();const config2={engine:"phaser",framework:"vanilla",language:"typescript",packageManager:pm,paths:{src:"src",assets:"public/assets"},registries:{"@main":opts.registry??DEFAULT_REGISTRY}};const resolverOpts=opts.cacheDir?{cacheDir:opts.cacheDir}:{};const resolver=createResolver(config2,resolverOpts);const fetcher=createAssetFetcher(resolverOpts);const spec=resolveTemplateSpec(opts.template);const resolved=await resolver.resolve(spec,{cwd,config:config2});if(resolved.item.type!=="registry:template"){throw new IncompatibleError(`"${spec}" is type ${resolved.item.type}, not registry:template.`)}const lock=await loadLockfile(cwd);const p2=await plan(resolved,config2,lock,cwd);const result=await executePlan(p2,lock,cwd,{force:opts.force??false},fetcher);await saveLockfile(cwd,lock);const pkgPath=resolve5(cwd,"package.json");try{const raw=await readFile6(pkgPath,"utf8");const pkg=JSON.parse(raw);pkg.name=opts.name;await writeFile5(pkgPath,JSON.stringify(pkg,null,2)+`
|
|
383
|
+
`,"utf8")}catch(err){if(err.code!=="ENOENT")throw err}const postScaffoldDeps=await installPostScaffoldDeps(cwd,opts.registry,opts.cacheDir,opts.force??false);const templateTags=resolved.item.tags??[];await reportScaffoldTelemetry({cwd,templateName:resolved.item.name,templateVersion:resolved.item.version,packageManager:pm,cliVersion:opts.cliVersion});if(opts.onAfterDeps){await opts.onAfterDeps({cwd,templateTags})}let installed=false;if(!opts.skipInstall){const runner=opts.installRunner??defaultInstallRunner;await runner(cwd,pm);installed=true}return{cwd,packageManager:pm,installed,templateName:resolved.item.name,templateTags,filesWritten:result.installed.length+postScaffoldDeps.length,postScaffoldDeps:postScaffoldDeps.map((d3)=>d3.spec)}}async function reportScaffoldTelemetry(info){const ctx={cliVersion:info.cliVersion,packageManager:info.packageManager};let project={};try{const raw=await readFile6(resolve5(info.cwd,"gamecn.json"),"utf8");const parsed=GamecnConfigSchema.parse(JSON.parse(raw));project={engine:parsed.engine,framework:parsed.framework,language:parsed.language}}catch{}await Promise.allSettled([trackTemplateInstall({id:info.templateName,version:info.templateVersion},ctx),trackProjectInit({flow:"scaffold",template:info.templateName,...project},ctx)])}async function installPostScaffoldDeps(cwd,registryOverride,cacheDir,force){const cfgPath=resolve5(cwd,"gamecn.json");let raw;try{raw=await readFile6(cfgPath,"utf8")}catch(err){if(err.code==="ENOENT")return[];throw err}const projectConfig=GamecnConfigSchema.parse(JSON.parse(raw));const deps=projectConfig.deps??[];if(deps.length===0)return[];const config2=registryOverride?{...projectConfig,registries:{...projectConfig.registries,"@main":registryOverride}}:projectConfig;const resolverOpts=cacheDir?{cacheDir}:{};const resolver=createResolver(config2,resolverOpts);const fetcher=createAssetFetcher(resolverOpts);const lock=await loadLockfile(cwd);const installed=[];for(const spec of deps){const resolvedDep=await resolver.resolve(spec,{cwd,config:config2});if(resolvedDep.item.type==="registry:template"){throw new IncompatibleError(`Template's gamecn.json#deps entry "${spec}" resolved to a registry:template — deps[] is for components/systems/assets, not templates.`)}const p2=await plan(resolvedDep,config2,lock,cwd);const r2=await executePlan(p2,lock,cwd,{force},fetcher);installed.push({spec,fileCount:r2.installed.length})}await saveLockfile(cwd,lock);return installed}var CLI_VERSION="0.0.4-1";var TEMPLATES=[{value:"phaser-endless-runner",label:"Phaser Endless Runner",hint:"Vite + TypeScript + Phaser 3"}];async function pickTemplate(opts){if(opts.template)return opts.template;if(opts.yes){throw new Error("--template is required when --yes is set.")}const choice=await ve({message:"Template?",options:TEMPLATES});if(pD(choice)){xe("Cancelled.");process.exit(1)}return choice}function parseSkillsFlag(value){if(!value)return;return value.split(",").map((s)=>s.trim()).filter((s)=>s.length>0)}async function readProjectContext(cwd){try{const raw=await readFile7(resolvePath(cwd,"gamecn.json"),"utf8");const parsed=GamecnConfigSchema.parse(JSON.parse(raw));return{engine:parsed.engine,framework:parsed.framework,language:parsed.language}}catch{return{engine:"vanilla",framework:"vanilla",language:"typescript"}}}var program2=new Command;program2.name("create-gamecn").description("Scaffold a new gamecn project from a template").version("0.0.1").argument("<name>","project directory name").option("--template <name>","template name or full spec").option("--registry <url>","registry URL with {name} placeholder",DEFAULT_REGISTRY).option("--package-manager <pm>","package manager (npm|pnpm|yarn|bun); defaults to the one that invoked this command").option("--yes","skip prompts; installs always-recommended skills").option("--force","overwrite a non-empty target directory").option("--no-install","skip dependency install").option("--skills <list>","comma-separated skill names to install; `--no-skills` to skip entirely").option("--no-skills","skip the skills install step entirely").action(async(name,opts)=>{try{if(!opts.yes)Ie(import_picocolors4.default.cyan(`create-gamecn ${name}`));const template=await pickTemplate(opts);const pm=opts.packageManager??detectPackageManager2();const preselected=typeof opts.skills==="string"?parseSkillsFlag(opts.skills):undefined;const scaffoldOpts={name,template,registry:opts.registry,packageManager:pm,skipInstall:opts.install===false,force:opts.force,cliVersion:CLI_VERSION,onAfterDeps:async({cwd,templateTags})=>{const projCtx=await readProjectContext(cwd);const ctx={...projCtx,templateTags,flow:"scaffold"};const promptResult=await promptSkillsInstall(ctx,{yes:!!opts.yes,skip:opts.skills===false,preselected,cwd});renderUnknownPreselected(promptResult.unknownPreselected);if(promptResult.recs.length===0)return;const installResult=await installSkills(promptResult.recs,{cwd});renderSkillsSummary(installResult)}};const result=await scaffold(scaffoldOpts);const next=result.installed?`cd ${name}
|
|
116
384
|
${result.packageManager} dev`:`cd ${name}
|
|
117
385
|
${result.packageManager} install
|
|
118
|
-
${result.packageManager} dev`;if(!opts.yes){Se(
|
|
386
|
+
${result.packageManager} dev`;if(!opts.yes){Se(import_picocolors4.default.green(`Done!
|
|
119
387
|
|
|
120
388
|
Next:
|
|
121
|
-
${next}`))}else{console.log(
|
|
389
|
+
${next}`))}else{console.log(import_picocolors4.default.green(`✓ scaffolded ${name} (${result.templateName})`));console.log(` next: ${next.replace(/\n/g," && ")}`)}}catch(err){console.error(import_picocolors4.default.red(err instanceof Error?err.message:String(err)));process.exit(1)}});program2.parseAsync().catch((err)=>{console.error(import_picocolors4.default.red(err instanceof Error?err.message:String(err)));process.exit(1)});
|