nemar-cli 0.5.0-dev.250 → 0.5.0-dev.252

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +30 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -116,7 +116,7 @@ ${RC.default.cursorShow}`)}releaseCursor(){if(this.extraLinesUnderPrompt>0)_Q(th
116
116
  ${F}`,X6D=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Y6D=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),G6D=(D,F,$)=>{let B=$===""?"":`with ${$.trim()}() `,J=Q6D.bind(null,B,F.toString());Object.defineProperty(J,"name",Y6D);let{writable:Q,enumerable:X,configurable:Y}=X6D;Object.defineProperty(D,"toString",{value:J,writable:Q,enumerable:X,configurable:Y})};function SF(D,F,{ignoreNonConfigurable:$=!1}={}){let{name:B}=D;for(let J of Reflect.ownKeys(F))$6D(D,F,J,$);return J6D(D,F),G6D(D,F,B),D}var C7=new WeakMap,Cj=(D,F={})=>{if(typeof D!=="function")throw TypeError("Expected a function");let $,B=0,J=D.displayName||D.name||"<anonymous>",Q=function(...X){if(C7.set(Q,++B),B===1)$=D.apply(this,X),D=void 0;else if(F.throw===!0)throw Error(`Function \`${J}\` can only be called once`);return $};return SF(Q,D),C7.set(Q,B),Q};Cj.callCount=(D)=>{if(!C7.has(D))throw Error(`The given function \`${D.name}\` is not wrapped by the \`onetime\` package`);return C7.get(D)};var Rj=Cj;var y6=[];y6.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")y6.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")y6.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var R7=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",yX=Symbol.for("signal-exit emitter"),xX=globalThis,H6D=Object.defineProperty.bind(Object);class jj{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xX[yX])return xX[yX];H6D(xX,yX,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let $=this.listeners[D],B=$.indexOf(F);if(B===-1)return;if(B===0&&$.length===1)$.length=0;else $.splice(B,1)}emit(D,F,$){if(this.emitted[D])return!1;this.emitted[D]=!0;let B=!1;for(let J of this.listeners[D])B=J(F,$)===!0||B;if(D==="exit")B=this.emit("afterExit",F,$)||B;return B}}class fX{}var W6D=(D)=>{return{onExit(F,$){return D.onExit(F,$)},load(){return D.load()},unload(){return D.unload()}}};class Tj extends fX{onExit(){return()=>{}}load(){}unload(){}}class Oj extends fX{#$=_X.platform==="win32"?"SIGINT":"SIGHUP";#F=new jj;#D;#J;#E;#B={};#X=!1;constructor(D){super();this.#D=D,this.#B={};for(let F of y6)this.#B[F]=()=>{let $=this.#D.listeners(F),{count:B}=this.#F,J=D;if(typeof J.__signal_exit_emitter__==="object"&&typeof J.__signal_exit_emitter__.count==="number")B+=J.__signal_exit_emitter__.count;if($.length===B){this.unload();let Q=this.#F.emit("exit",null,F),X=F==="SIGHUP"?this.#$:F;if(!Q)D.kill(D.pid,X)}};this.#E=D.reallyExit,this.#J=D.emit}onExit(D,F){if(!R7(this.#D))return()=>{};if(this.#X===!1)this.load();let $=F?.alwaysLast?"afterExit":"exit";return this.#F.on($,D),()=>{if(this.#F.removeListener($,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#X)return;this.#X=!0,this.#F.count+=1;for(let D of y6)try{let F=this.#B[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#K(D,...F)},this.#D.reallyExit=(D)=>{return this.#Q(D)}}unload(){if(!this.#X)return;this.#X=!1,y6.forEach((D)=>{let F=this.#B[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch($){}}),this.#D.emit=this.#J,this.#D.reallyExit=this.#E,this.#F.count-=1}#Q(D){if(!R7(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#E.call(this.#D,this.#D.exitCode)}#K(D,...F){let $=this.#J;if(D==="exit"&&R7(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let B=$.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),B}else return $.call(this.#D,D,...F)}}var _X=globalThis.process,{onExit:wj,load:CAD,unload:RAD}=W6D(R7(_X)?new Oj(_X):new Tj);var Ij=j7.stderr.isTTY?j7.stderr:j7.stdout.isTTY?j7.stdout:void 0,q6D=Ij?Rj(()=>{wj(()=>{Ij.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Pj=q6D;var T7=!1,t4={};t4.show=(D=Sj.stderr)=>{if(!D.isTTY)return;T7=!1,D.write("\x1B[?25h")};t4.hide=(D=Sj.stderr)=>{if(!D.isTTY)return;Pj(),T7=!0,D.write("\x1B[?25l")};t4.toggle=(D,F)=>{if(D!==void 0)T7=D;if(T7)t4.show(F);else t4.hide(F)};var gX=t4;var yF=n(M9(),1);import Z1 from"process";function hX(){if(Z1.platform!=="win32")return Z1.env.TERM!=="linux";return Boolean(Z1.env.CI)||Boolean(Z1.env.WT_SESSION)||Boolean(Z1.env.TERMINUS_SUBLIME)||Z1.env.ConEmuTask==="{cmd::Cmder}"||Z1.env.TERM_PROGRAM==="Terminus-Sublime"||Z1.env.TERM_PROGRAM==="vscode"||Z1.env.TERM==="xterm-256color"||Z1.env.TERM==="alacritty"||Z1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var E6D={info:W.blue("\u2139"),success:W.green("\u2714"),warning:W.yellow("\u26A0"),error:W.red("\u2716")},K6D={info:W.blue("i"),success:W.green("\u221A"),warning:W.yellow("\u203C"),error:W.red("\xD7")},z6D=hX()?E6D:K6D,kF=z6D;function bX({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var V6D=bX();function vF(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(V6D,"")}function kj(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||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||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function vj(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function yj(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function Z6D(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function xj(D,{ambiguousAsWide:F=!1}={}){if(Z6D(D),vj(D)||yj(D)||F&&kj(D))return 2;return 1}var _j=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var A6D=new Intl.Segmenter,U6D=/^\p{Default_Ignorable_Code_Point}$/u;function uX(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:$=!0,countAnsiEscapeCodes:B=!1}=F;if(!B)D=vF(D);if(D.length===0)return 0;let J=0,Q={ambiguousAsWide:!$};for(let{segment:X}of A6D.segment(D)){let Y=X.codePointAt(0);if(Y<=31||Y>=127&&Y<=159)continue;if(Y>=8203&&Y<=8207||Y===65279)continue;if(Y>=768&&Y<=879||Y>=6832&&Y<=6911||Y>=7616&&Y<=7679||Y>=8400&&Y<=8447||Y>=65056&&Y<=65071)continue;if(Y>=55296&&Y<=57343)continue;if(Y>=65024&&Y<=65039)continue;if(U6D.test(X))continue;if(_j().test(X)){J+=2;continue}J+=xj(Y,Q)}return J}function mX({stream:D=process.stdout}={}){return Boolean(D&&D.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import fj from"process";function lX(){let{env:D}=fj,{TERM:F,TERM_PROGRAM:$}=D;if(fj.platform!=="win32")return F!=="linux";return Boolean(D.WT_SESSION)||Boolean(D.TERMINUS_SUBLIME)||D.ConEmuTask==="{cmd::Cmder}"||$==="Terminus-Sublime"||$==="vscode"||F==="xterm-256color"||F==="alacritty"||F==="rxvt-unicode"||F==="rxvt-unicode-256color"||D.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import i1 from"process";var L6D=3;class gj{#$=0;start(){if(this.#$++,this.#$===1)this.#F()}stop(){if(this.#$<=0)throw Error("`stop` called more times than `start`");if(this.#$--,this.#$===0)this.#D()}#F(){if(i1.platform==="win32"||!i1.stdin.isTTY)return;i1.stdin.setRawMode(!0),i1.stdin.on("data",this.#J),i1.stdin.resume()}#D(){if(!i1.stdin.isTTY)return;i1.stdin.off("data",this.#J),i1.stdin.pause(),i1.stdin.setRawMode(!1)}#J(D){if(D[0]===L6D)i1.emit("SIGINT")}}var M6D=new gj,dX=M6D;var N6D=n(M9(),1);class hj{#$=0;#F=!1;#D=0;#J=-1;#E=0;#B;#X;#Q;#K;#V;#H;#W;#q;#Z;#Y;#G;color;constructor(D){if(typeof D==="string")D={text:D};if(this.#B={color:"cyan",stream:O7.stderr,discardStdin:!0,hideCursor:!0,...D},this.color=this.#B.color,this.spinner=this.#B.spinner,this.#V=this.#B.interval,this.#Q=this.#B.stream,this.#H=typeof this.#B.isEnabled==="boolean"?this.#B.isEnabled:mX({stream:this.#Q}),this.#W=typeof this.#B.isSilent==="boolean"?this.#B.isSilent:!1,this.text=this.#B.text,this.prefixText=this.#B.prefixText,this.suffixText=this.#B.suffixText,this.indent=this.#B.indent,O7.env.NODE_ENV==="test")this._stream=this.#Q,this._isEnabled=this.#H,Object.defineProperty(this,"_linesToClear",{get(){return this.#$},set(F){this.#$=F}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#J}}),Object.defineProperty(this,"_lineCount",{get(){return this.#D}})}get indent(){return this.#q}set indent(D=0){if(!(D>=0&&Number.isInteger(D)))throw Error("The `indent` option must be an integer from 0 and up");this.#q=D,this.#z()}get interval(){return this.#V??this.#X.interval??100}get spinner(){return this.#X}set spinner(D){if(this.#J=-1,this.#V=void 0,typeof D==="object"){if(D.frames===void 0)throw Error("The given spinner must have a `frames` property");this.#X=D}else if(!lX())this.#X=yF.default.line;else if(D===void 0)this.#X=yF.default.dots;else if(D!=="default"&&yF.default[D])this.#X=yF.default[D];else throw Error(`There is no built-in spinner named '${D}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#Z}set text(D=""){this.#Z=D,this.#z()}get prefixText(){return this.#Y}set prefixText(D=""){this.#Y=D,this.#z()}get suffixText(){return this.#G}set suffixText(D=""){this.#G=D,this.#z()}get isSpinning(){return this.#K!==void 0}#A(D=this.#Y,F=" "){if(typeof D==="string"&&D!=="")return D+F;if(typeof D==="function")return D()+F;return""}#U(D=this.#G,F=" "){if(typeof D==="string"&&D!=="")return F+D;if(typeof D==="function")return F+D();return""}#z(){let D=this.#Q.columns??80,F=this.#A(this.#Y,"-"),$=this.#U(this.#G,"-"),B=" ".repeat(this.#q)+F+"--"+this.#Z+"--"+$;this.#D=0;for(let J of vF(B).split(`
117
117
  `))this.#D+=Math.max(1,Math.ceil(uX(J,{countAnsiEscapeCodes:!0})/D))}get isEnabled(){return this.#H&&!this.#W}set isEnabled(D){if(typeof D!=="boolean")throw TypeError("The `isEnabled` option must be a boolean");this.#H=D}get isSilent(){return this.#W}set isSilent(D){if(typeof D!=="boolean")throw TypeError("The `isSilent` option must be a boolean");this.#W=D}frame(){let D=Date.now();if(this.#J===-1||D-this.#E>=this.interval)this.#J=++this.#J%this.#X.frames.length,this.#E=D;let{frames:F}=this.#X,$=F[this.#J];if(this.color)$=W[this.color]($);let B=typeof this.#Y==="string"&&this.#Y!==""?this.#Y+" ":"",J=typeof this.text==="string"?" "+this.text:"",Q=typeof this.#G==="string"&&this.#G!==""?" "+this.#G:"";return B+$+J+Q}clear(){if(!this.#H||!this.#Q.isTTY)return this;this.#Q.cursorTo(0);for(let D=0;D<this.#$;D++){if(D>0)this.#Q.moveCursor(0,-1);this.#Q.clearLine(1)}if(this.#q||this.lastIndent!==this.#q)this.#Q.cursorTo(this.#q);return this.lastIndent=this.#q,this.#$=0,this}render(){if(this.#W)return this;return this.clear(),this.#Q.write(this.frame()),this.#$=this.#D,this}start(D){if(D)this.text=D;if(this.#W)return this;if(!this.#H){if(this.text)this.#Q.write(`- ${this.text}
118
118
  `);return this}if(this.isSpinning)return this;if(this.#B.hideCursor)gX.hide(this.#Q);if(this.#B.discardStdin&&O7.stdin.isTTY)this.#F=!0,dX.start();return this.render(),this.#K=setInterval(this.render.bind(this),this.interval),this}stop(){if(!this.#H)return this;if(clearInterval(this.#K),this.#K=void 0,this.#J=0,this.clear(),this.#B.hideCursor)gX.show(this.#Q);if(this.#B.discardStdin&&O7.stdin.isTTY&&this.#F)dX.stop(),this.#F=!1;return this}succeed(D){return this.stopAndPersist({symbol:kF.success,text:D})}fail(D){return this.stopAndPersist({symbol:kF.error,text:D})}warn(D){return this.stopAndPersist({symbol:kF.warning,text:D})}info(D){return this.stopAndPersist({symbol:kF.info,text:D})}stopAndPersist(D={}){if(this.#W)return this;let F=D.prefixText??this.#Y,$=this.#A(F," "),B=D.symbol??" ",J=D.text??this.text,X=typeof J==="string"?(B?" ":"")+J:"",Y=D.suffixText??this.#G,G=this.#U(Y," "),H=$+B+X+G+`
119
- `;return this.stop(),this.#Q.write(H),this}}function C(D){return new hj(D)}import{isDeepStrictEqual as Z2D}from"util";import zv from"process";import p6 from"fs";import Vv from"path";import V5 from"crypto";import A2D from"assert";var x6=(D)=>{let F=typeof D;return D!==null&&(F==="object"||F==="function")};var pX=new Set(["__proto__","prototype","constructor"]),C6D=new Set("0123456789");function w7(D){let F=[],$="",B="start",J=!1;for(let Q of D)switch(Q){case"\\":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd")throw Error("Invalid character after an index");if(J)$+=Q;B="property",J=!J;break}case".":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd"){B="property";break}if(J){J=!1,$+=Q;break}if(pX.has($))return[];F.push($),$="",B="property";break}case"[":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd"){B="index";break}if(J){J=!1,$+=Q;break}if(B==="property"){if(pX.has($))return[];F.push($),$=""}B="index";break}case"]":{if(B==="index"){F.push(Number.parseInt($,10)),$="",B="indexEnd";break}if(B==="indexEnd")throw Error("Invalid character after an index")}default:{if(B==="index"&&!C6D.has(Q))throw Error("Invalid character in an index");if(B==="indexEnd")throw Error("Invalid character after an index");if(B==="start")B="property";if(J)J=!1,$+="\\";$+=Q}}if(J)$+="\\";switch(B){case"property":{if(pX.has($))return[];F.push($);break}case"index":throw Error("Index was not closed");case"start":{F.push("");break}}return F}function cX(D,F){if(typeof F!=="number"&&Array.isArray(D)){let $=Number.parseInt(F,10);return Number.isInteger($)&&D[$]===D[F]}return!1}function bj(D,F){if(cX(D,F))throw Error("Cannot use string index")}function uj(D,F,$){if(!x6(D)||typeof F!=="string")return $===void 0?D:$;let B=w7(F);if(B.length===0)return $;for(let J=0;J<B.length;J++){let Q=B[J];if(cX(D,Q))D=J===B.length-1?void 0:null;else D=D[Q];if(D===void 0||D===null){if(J!==B.length-1)return $;break}}return D===void 0?$:D}function nX(D,F,$){if(!x6(D)||typeof F!=="string")return D;let B=D,J=w7(F);for(let Q=0;Q<J.length;Q++){let X=J[Q];if(bj(D,X),Q===J.length-1)D[X]=$;else if(!x6(D[X]))D[X]=typeof J[Q+1]==="number"?[]:{};D=D[X]}return B}function mj(D,F){if(!x6(D)||typeof F!=="string")return!1;let $=w7(F);for(let B=0;B<$.length;B++){let J=$[B];if(bj(D,J),B===$.length-1)return delete D[J],!0;if(D=D[J],!x6(D))return!1}}function lj(D,F){if(!x6(D)||typeof F!=="string")return!1;let $=w7(F);if($.length===0)return!1;for(let B of $){if(!x6(D)||!(B in D)||cX(D,B))return!1;D=D[B]}return!0}import fD from"path";import dj from"os";import iX from"process";var D6=dj.homedir(),aX=dj.tmpdir(),{env:e4}=iX,R6D=(D)=>{let F=fD.join(D6,"Library");return{data:fD.join(F,"Application Support",D),config:fD.join(F,"Preferences",D),cache:fD.join(F,"Caches",D),log:fD.join(F,"Logs",D),temp:fD.join(aX,D)}},j6D=(D)=>{let F=e4.APPDATA||fD.join(D6,"AppData","Roaming"),$=e4.LOCALAPPDATA||fD.join(D6,"AppData","Local");return{data:fD.join($,D,"Data"),config:fD.join(F,D,"Config"),cache:fD.join($,D,"Cache"),log:fD.join($,D,"Log"),temp:fD.join(aX,D)}},T6D=(D)=>{let F=fD.basename(D6);return{data:fD.join(e4.XDG_DATA_HOME||fD.join(D6,".local","share"),D),config:fD.join(e4.XDG_CONFIG_HOME||fD.join(D6,".config"),D),cache:fD.join(e4.XDG_CACHE_HOME||fD.join(D6,".cache"),D),log:fD.join(e4.XDG_STATE_HOME||fD.join(D6,".local","state"),D),temp:fD.join(aX,F,D)}};function oX(D,{suffix:F="nodejs"}={}){if(typeof D!=="string")throw TypeError(`Expected a string, got ${typeof D}`);if(F)D+=`-${F}`;if(iX.platform==="darwin")return R6D(D);if(iX.platform==="win32")return j6D(D);return T6D(D)}import y6D from"path";import VD from"fs";import{promisify as q0}from"util";var O6D=(D,F)=>{let{onError:$}=F;return function(...J){return D.apply(void 0,J).catch($)}},a1=O6D;var w6D=(D,F)=>{let{onError:$}=F;return function(...J){try{return D.apply(void 0,J)}catch(Q){return $(Q)}}},A1=w6D;var pj=250;var I6D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,X=J.interval??pj,Y=Date.now()+Q;return function G(...H){return D.apply(void 0,H).catch((q)=>{if(!$(q))throw q;if(Date.now()>=Y)throw q;let K=Math.round(X*Math.random());if(K>0)return new Promise((Z)=>setTimeout(Z,K)).then(()=>G.apply(void 0,H));else return G.apply(void 0,H)})}}},o1=I6D;var P6D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,X=Date.now()+Q;return function(...G){while(!0)try{return D.apply(void 0,G)}catch(H){if(!$(H))throw H;if(Date.now()>=X)throw H;continue}}}},s1=P6D;import nj from"process";var xF={isChangeErrorOk:(D)=>{if(!xF.isNodeError(D))return!1;let{code:F}=D;if(F==="ENOSYS")return!0;if(!cj&&(F==="EINVAL"||F==="EPERM"))return!0;return!1},isNodeError:(D)=>{return D instanceof Error},isRetriableError:(D)=>{if(!xF.isNodeError(D))return!1;let{code:F}=D;if(F==="EMFILE"||F==="ENFILE"||F==="EAGAIN"||F==="EBUSY"||F==="EACCESS"||F==="EACCES"||F==="EACCS"||F==="EPERM")return!0;return!1},onChangeError:(D)=>{if(!xF.isNodeError(D))throw D;if(xF.isChangeErrorOk(D))return;throw D}},sX=xF;var _F={onError:sX.onChangeError},P0={onError:()=>{return}},cj=nj.getuid?!nj.getuid():!1,J0={isRetriable:sX.isRetriableError};var S6D={attempt:{chmod:a1(q0(VD.chmod),_F),chown:a1(q0(VD.chown),_F),close:a1(q0(VD.close),P0),fsync:a1(q0(VD.fsync),P0),mkdir:a1(q0(VD.mkdir),P0),realpath:a1(q0(VD.realpath),P0),stat:a1(q0(VD.stat),P0),unlink:a1(q0(VD.unlink),P0),chmodSync:A1(VD.chmodSync,_F),chownSync:A1(VD.chownSync,_F),closeSync:A1(VD.closeSync,P0),existsSync:A1(VD.existsSync,P0),fsyncSync:A1(VD.fsync,P0),mkdirSync:A1(VD.mkdirSync,P0),realpathSync:A1(VD.realpathSync,P0),statSync:A1(VD.statSync,P0),unlinkSync:A1(VD.unlinkSync,P0)},retry:{close:o1(q0(VD.close),J0),fsync:o1(q0(VD.fsync),J0),open:o1(q0(VD.open),J0),readFile:o1(q0(VD.readFile),J0),rename:o1(q0(VD.rename),J0),stat:o1(q0(VD.stat),J0),write:o1(q0(VD.write),J0),writeFile:o1(q0(VD.writeFile),J0),closeSync:s1(VD.closeSync,J0),fsyncSync:s1(VD.fsyncSync,J0),openSync:s1(VD.openSync,J0),readFileSync:s1(VD.readFileSync,J0),renameSync:s1(VD.renameSync,J0),statSync:s1(VD.statSync,J0),writeSync:s1(VD.writeSync,J0),writeFileSync:s1(VD.writeFileSync,J0)}},rD=S6D;import _6 from"process";var ij="utf8",rX=438,aj=511;var oj={},sj=_6.geteuid?_6.geteuid():-1,rj=_6.getegid?_6.getegid():-1;var tj=1000,ej=!!_6.getuid,hUD=_6.getuid?!_6.getuid():!1,tX=128;var DT=(D)=>{return D instanceof Error&&"code"in D};var eX=(D)=>{return typeof D==="string"},I7=(D)=>{return D===void 0};import v6D from"path";import D3 from"process";import FT from"process";var $T=FT.platform==="linux",P7=FT.platform==="win32";var DY=["SIGHUP","SIGINT","SIGTERM"];if(!P7)DY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if($T)DY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var BT=DY;class JT{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(D)=>{if(this.exited)return;this.exited=!0;for(let F of this.callbacks)F();if(D)if(P7&&(D!=="SIGINT"&&D!=="SIGTERM"&&D!=="SIGKILL"))D3.kill(D3.pid,"SIGTERM");else D3.kill(D3.pid,D)},this.hook=()=>{D3.once("exit",()=>this.exit());for(let D of BT)try{D3.once(D,()=>this.exit(D))}catch{}},this.register=(D)=>{return this.callbacks.add(D),()=>{this.callbacks.delete(D)}},this.hook()}}var QT=new JT;var k6D=QT.register,XT=k6D;var m0={store:{},create:(D)=>{let F=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),$=Date.now().toString().slice(-10),B="tmp-",J=`.tmp-${$}${F}`;return`${D}${J}`},get:(D,F,$=!0)=>{let B=m0.truncate(F(D));if(B in m0.store)return m0.get(D,F,$);return m0.store[B]=$,[B,()=>delete m0.store[B]]},purge:(D)=>{if(!m0.store[D])return;delete m0.store[D],rD.attempt.unlink(D)},purgeSync:(D)=>{if(!m0.store[D])return;delete m0.store[D],rD.attempt.unlinkSync(D)},purgeSyncAll:()=>{for(let D in m0.store)m0.purgeSync(D)},truncate:(D)=>{let F=v6D.basename(D);if(F.length<=tX)return D;let $=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(F);if(!$)return D;let B=F.length-tX;return`${D.slice(0,-F.length)}${$[1]}${$[2].slice(0,-B)}${$[3]}`}};XT(m0.purgeSyncAll);var fF=m0;function FY(D,F,$=oj){if(eX($))return FY(D,F,{encoding:$});let J={timeout:$.timeout??tj},Q=null,X=null,Y=null;try{let G=rD.attempt.realpathSync(D),H=!!G;D=G||D,[X,Q]=fF.get(D,$.tmpCreate||fF.create,$.tmpPurge!==!1);let q=ej&&I7($.chown),K=I7($.mode);if(H&&(q||K)){let V=rD.attempt.statSync(D);if(V){if($={...$},q)$.chown={uid:V.uid,gid:V.gid};if(K)$.mode=V.mode}}if(!H){let V=y6D.dirname(D);rD.attempt.mkdirSync(V,{mode:aj,recursive:!0})}if(Y=rD.retry.openSync(J)(X,"w",$.mode||rX),$.tmpCreated)$.tmpCreated(X);if(eX(F))rD.retry.writeSync(J)(Y,F,0,$.encoding||ij);else if(!I7(F))rD.retry.writeSync(J)(Y,F,0,F.length,0);if($.fsync!==!1)if($.fsyncWait!==!1)rD.retry.fsyncSync(J)(Y);else rD.attempt.fsync(Y);if(rD.retry.closeSync(J)(Y),Y=null,$.chown&&($.chown.uid!==sj||$.chown.gid!==rj))rD.attempt.chownSync(X,$.chown.uid,$.chown.gid);if($.mode&&$.mode!==rX)rD.attempt.chmodSync(X,$.mode);try{rD.retry.renameSync(J)(X,D)}catch(V){if(!DT(V))throw V;if(V.code!=="ENAMETOOLONG")throw V;rD.retry.renameSync(J)(X,fF.truncate(D))}Q(),X=null}finally{if(Y)rD.attempt.closeSync(Y);if(X)fF.purge(X)}}var Av=n(tP(),1),Uv=n(MS(),1);var ZQD=(D,F={})=>{if(typeof D!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof D}\``);let{wait:$=0,maxWait:B=Number.POSITIVE_INFINITY,before:J=!1,after:Q=!0}=F;if($<0||B<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!J&&!Q)throw Error("Both `before` and `after` are false, function wouldn't be called.");let X,Y,G,H=function(...q){let K=this,V=()=>{if(X=void 0,Y)clearTimeout(Y),Y=void 0;if(Q)G=D.apply(K,q)},Z=()=>{if(Y=void 0,X)clearTimeout(X),X=void 0;if(Q)G=D.apply(K,q)},A=J&&!X;if(clearTimeout(X),X=setTimeout(V,$),B>0&&B!==Number.POSITIVE_INFINITY&&!Y)Y=setTimeout(Z,B);if(A)G=D.apply(K,q);return G};return SF(H,D),H.cancel=()=>{if(X)clearTimeout(X),X=void 0;if(Y)clearTimeout(Y),Y=void 0},H},Z2=ZQD;var c6=n(Wv(),1);var H2D=Object.prototype.toString;function Ev(D,F,$){if(!D)return!1;if(D.constructor===F)return!0;return H2D.call(D)===$}function Kv(D){return Ev(D,Uint8Array,"[object Uint8Array]")}function W2D(D){return Ev(D,ArrayBuffer,"[object ArrayBuffer]")}function q2D(D){return Kv(D)||W2D(D)}function E2D(D){if(!Kv(D))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof D}\``)}function K2D(D){if(!q2D(D))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof D}\``)}function v2(D,F){if(D.length===0)return new Uint8Array(0);F??=D.reduce((J,Q)=>J+Q.length,0);let $=new Uint8Array(F),B=0;for(let J of D)E2D(J),$.set(J,B),B+=J.length;return $}var qv={utf8:new globalThis.TextDecoder("utf8")};function y2(D,F="utf8"){return K2D(D),qv[F]??=new globalThis.TextDecoder(F),qv[F].decode(D)}function z2D(D){if(typeof D!=="string")throw TypeError(`Expected \`string\`, got \`${typeof D}\``)}var V2D=new globalThis.TextEncoder;function w$(D){return z2D(D),V2D.encode(D)}var jCD=Array.from({length:256},(D,F)=>F.toString(16).padStart(2,"0"));var U2D=Uv.default.default,Zv="aes-256-cbc",Z3=()=>Object.create(null),L2D=(D)=>D!==void 0&&D!==null,M2D=(D,F)=>{let $=new Set(["undefined","symbol","function"]),B=typeof F;if($.has(B))throw TypeError(`Setting a value of type \`${B}\` for key \`${D}\` is not allowed as it's not supported by JSON`)},I$="__internal__",x2=`${I$}.migrations.version`;class P${path;events;#$;#F;#D;#J={};constructor(D={}){let F={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...D};if(!F.cwd){if(!F.projectName)throw Error("Please specify the `projectName` option.");F.cwd=oX(F.projectName,{suffix:F.projectSuffix}).config}if(this.#D=F,F.schema??F.ajvOptions??F.rootSchema){if(F.schema&&typeof F.schema!=="object")throw TypeError("The `schema` option must be an object.");let Q=new Av.Ajv2020({allErrors:!0,useDefaults:!0,...F.ajvOptions});U2D(Q);let X={...F.rootSchema,type:"object",properties:F.schema};this.#$=Q.compile(X);for(let[Y,G]of Object.entries(F.schema??{}))if(G?.default)this.#J[Y]=G.default}if(F.defaults)this.#J={...this.#J,...F.defaults};if(F.serialize)this._serialize=F.serialize;if(F.deserialize)this._deserialize=F.deserialize;this.events=new EventTarget,this.#F=F.encryptionKey;let $=F.fileExtension?`.${F.fileExtension}`:"";this.path=Vv.resolve(F.cwd,`${F.configName??"config"}${$}`);let B=this.store,J=Object.assign(Z3(),F.defaults,B);if(F.migrations){if(!F.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(F.migrations,F.projectVersion,F.beforeEachMigration)}this._validate(J);try{A2D.deepEqual(B,J)}catch{this.store=J}if(F.watch)this._watch()}get(D,F){if(this.#D.accessPropertiesByDotNotation)return this._get(D,F);let{store:$}=this;return D in $?$[D]:F}set(D,F){if(typeof D!=="string"&&typeof D!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof D}`);if(typeof D!=="object"&&F===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(D))throw TypeError(`Please don't use the ${I$} key, as it's used to manage this module internal operations.`);let{store:$}=this,B=(J,Q)=>{if(M2D(J,Q),this.#D.accessPropertiesByDotNotation)nX($,J,Q);else $[J]=Q};if(typeof D==="object"){let J=D;for(let[Q,X]of Object.entries(J))B(Q,X)}else B(D,F);this.store=$}has(D){if(this.#D.accessPropertiesByDotNotation)return lj(this.store,D);return D in this.store}reset(...D){for(let F of D)if(L2D(this.#J[F]))this.set(F,this.#J[F])}delete(D){let{store:F}=this;if(this.#D.accessPropertiesByDotNotation)mj(F,D);else delete F[D];this.store=F}clear(){this.store=Z3();for(let D of Object.keys(this.#J))this.reset(D)}onDidChange(D,F){if(typeof D!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof D}`);if(typeof F!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof F}`);return this._handleChange(()=>this.get(D),F)}onDidAnyChange(D){if(typeof D!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof D}`);return this._handleChange(()=>this.store,D)}get size(){return Object.keys(this.store).length}get store(){try{let D=p6.readFileSync(this.path,this.#F?null:"utf8"),F=this._encryptData(D),$=this._deserialize(F);return this._validate($),Object.assign(Z3(),$)}catch(D){if(D?.code==="ENOENT")return this._ensureDirectory(),Z3();if(this.#D.clearInvalidConfig&&D.name==="SyntaxError")return Z3();throw D}}set store(D){this._ensureDirectory(),this._validate(D),this._write(D),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[D,F]of Object.entries(this.store))yield[D,F]}_encryptData(D){if(!this.#F)return typeof D==="string"?D:y2(D);try{let F=D.slice(0,16),$=V5.pbkdf2Sync(this.#F,F.toString(),1e4,32,"sha512"),B=V5.createDecipheriv(Zv,$,F),J=D.slice(17),Q=typeof J==="string"?w$(J):J;return y2(v2([B.update(Q),B.final()]))}catch{}return D.toString()}_handleChange(D,F){let $=D(),B=()=>{let J=$,Q=D();if(Z2D(Q,J))return;$=Q,F.call(this,Q,J)};return this.events.addEventListener("change",B),()=>{this.events.removeEventListener("change",B)}}_deserialize=(D)=>JSON.parse(D);_serialize=(D)=>JSON.stringify(D,void 0,"\t");_validate(D){if(!this.#$)return;if(this.#$(D)||!this.#$.errors)return;let $=this.#$.errors.map(({instancePath:B,message:J=""})=>`\`${B.slice(1)}\` ${J}`);throw Error("Config schema violation: "+$.join("; "))}_ensureDirectory(){p6.mkdirSync(Vv.dirname(this.path),{recursive:!0})}_write(D){let F=this._serialize(D);if(this.#F){let $=V5.randomBytes(16),B=V5.pbkdf2Sync(this.#F,$.toString(),1e4,32,"sha512"),J=V5.createCipheriv(Zv,B,$);F=v2([$,w$(":"),J.update(w$(F)),J.final()])}if(zv.env.SNAP)p6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});else try{FY(this.path,F,{mode:this.#D.configFileMode})}catch($){if($?.code==="EXDEV"){p6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});return}throw $}}_watch(){if(this._ensureDirectory(),!p6.existsSync(this.path))this._write(Z3());if(zv.platform==="win32")p6.watch(this.path,{persistent:!1},Z2(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else p6.watchFile(this.path,{persistent:!1},Z2(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(D,F,$){let B=this._get(x2,"0.0.0"),J=Object.keys(D).filter((X)=>this._shouldPerformMigration(X,B,F)),Q={...this.store};for(let X of J)try{if($)$(this,{fromVersion:B,toVersion:X,finalVersion:F,versions:J});let Y=D[X];Y?.(this),this._set(x2,X),B=X,Q={...this.store}}catch(Y){throw this.store=Q,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${Y}`)}if(this._isVersionInRangeFormat(B)||!c6.default.eq(B,F))this._set(x2,F)}_containsReservedKey(D){if(typeof D==="object"){if(Object.keys(D)[0]===I$)return!0}if(typeof D!=="string")return!1;if(this.#D.accessPropertiesByDotNotation){if(D.startsWith(`${I$}.`))return!0;return!1}return!1}_isVersionInRangeFormat(D){return c6.default.clean(D)===null}_shouldPerformMigration(D,F,$){if(this._isVersionInRangeFormat(D)){if(F!=="0.0.0"&&c6.default.satisfies(F,D))return!1;return c6.default.satisfies($,D)}if(c6.default.lte(D,F))return!1;if(c6.default.gt(D,$))return!1;return!0}_get(D,F){return uj(this.store,D,F)}_set(D,F){let{store:$}=this;nX($,D,F),this.store=$}}var S1={};QG(S1,{void:()=>JGD,util:()=>YD,unknown:()=>$GD,union:()=>GGD,undefined:()=>e2D,tuple:()=>qGD,transformer:()=>NGD,symbol:()=>t2D,string:()=>wv,strictObject:()=>YGD,setErrorMap:()=>R2D,set:()=>zGD,record:()=>EGD,quotelessJson:()=>N2D,promise:()=>MGD,preprocess:()=>jGD,pipeline:()=>TGD,ostring:()=>OGD,optional:()=>CGD,onumber:()=>wGD,oboolean:()=>IGD,objectUtil:()=>_2,object:()=>XGD,number:()=>Iv,nullable:()=>RGD,null:()=>DGD,never:()=>BGD,nativeEnum:()=>LGD,nan:()=>o2D,map:()=>KGD,makeIssue:()=>Z5,literal:()=>AGD,lazy:()=>ZGD,late:()=>i2D,isValid:()=>H6,isDirty:()=>k$,isAsync:()=>U3,isAborted:()=>S$,intersection:()=>WGD,instanceof:()=>a2D,getParsedType:()=>F8,getErrorMap:()=>A3,function:()=>VGD,enum:()=>UGD,effect:()=>NGD,discriminatedUnion:()=>HGD,defaultErrorMap:()=>L8,datetimeRegex:()=>jv,date:()=>r2D,custom:()=>Ov,coerce:()=>PGD,boolean:()=>Pv,bigint:()=>s2D,array:()=>QGD,any:()=>FGD,addIssueToContext:()=>P,ZodVoid:()=>U5,ZodUnknown:()=>W6,ZodUnion:()=>j3,ZodUndefined:()=>C3,ZodType:()=>$D,ZodTuple:()=>B8,ZodTransformer:()=>P1,ZodSymbol:()=>A5,ZodString:()=>T1,ZodSet:()=>o6,ZodSchema:()=>$D,ZodRecord:()=>L5,ZodReadonly:()=>k3,ZodPromise:()=>s6,ZodPipeline:()=>C5,ZodParsedType:()=>T,ZodOptional:()=>w1,ZodObject:()=>gD,ZodNumber:()=>q6,ZodNullable:()=>N8,ZodNull:()=>R3,ZodNever:()=>$8,ZodNativeEnum:()=>I3,ZodNaN:()=>N5,ZodMap:()=>M5,ZodLiteral:()=>w3,ZodLazy:()=>O3,ZodIssueCode:()=>R,ZodIntersection:()=>T3,ZodFunction:()=>M3,ZodFirstPartyTypeKind:()=>m,ZodError:()=>_0,ZodEnum:()=>K6,ZodEffects:()=>P1,ZodDiscriminatedUnion:()=>v$,ZodDefault:()=>P3,ZodDate:()=>i6,ZodCatch:()=>S3,ZodBranded:()=>y$,ZodBoolean:()=>N3,ZodBigInt:()=>E6,ZodArray:()=>O1,ZodAny:()=>a6,Schema:()=>$D,ParseStatus:()=>X0,OK:()=>V0,NEVER:()=>SGD,INVALID:()=>b,EMPTY_PATH:()=>j2D,DIRTY:()=>n6,BRAND:()=>n2D});var YD;(function(D){D.assertEqual=(J)=>{};function F(J){}D.assertIs=F;function $(J){throw Error()}D.assertNever=$,D.arrayToEnum=(J)=>{let Q={};for(let X of J)Q[X]=X;return Q},D.getValidEnumValues=(J)=>{let Q=D.objectKeys(J).filter((Y)=>typeof J[J[Y]]!=="number"),X={};for(let Y of Q)X[Y]=J[Y];return D.objectValues(X)},D.objectValues=(J)=>{return D.objectKeys(J).map(function(Q){return J[Q]})},D.objectKeys=typeof Object.keys==="function"?(J)=>Object.keys(J):(J)=>{let Q=[];for(let X in J)if(Object.prototype.hasOwnProperty.call(J,X))Q.push(X);return Q},D.find=(J,Q)=>{for(let X of J)if(Q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(J)=>Number.isInteger(J):(J)=>typeof J==="number"&&Number.isFinite(J)&&Math.floor(J)===J;function B(J,Q=" | "){return J.map((X)=>typeof X==="string"?`'${X}'`:X).join(Q)}D.joinValues=B,D.jsonStringifyReplacer=(J,Q)=>{if(typeof Q==="bigint")return Q.toString();return Q}})(YD||(YD={}));var _2;(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(_2||(_2={}));var T=YD.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),F8=(D)=>{switch(typeof D){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(D)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":if(Array.isArray(D))return T.array;if(D===null)return T.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return T.promise;if(typeof Map<"u"&&D instanceof Map)return T.map;if(typeof Set<"u"&&D instanceof Set)return T.set;if(typeof Date<"u"&&D instanceof Date)return T.date;return T.object;default:return T.unknown}};var R=YD.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N2D=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class _0 extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function(J){return J.message},$={_errors:[]},B=(J)=>{for(let Q of J.issues)if(Q.code==="invalid_union")Q.unionErrors.map(B);else if(Q.code==="invalid_return_type")B(Q.returnTypeError);else if(Q.code==="invalid_arguments")B(Q.argumentsError);else if(Q.path.length===0)$._errors.push(F(Q));else{let X=$,Y=0;while(Y<Q.path.length){let G=Q.path[Y];if(Y!==Q.path.length-1)X[G]=X[G]||{_errors:[]};else X[G]=X[G]||{_errors:[]},X[G]._errors.push(F(Q));X=X[G],Y++}}};return B(this),$}static assert(D){if(!(D instanceof _0))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,YD.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},$=[];for(let B of this.issues)if(B.path.length>0){let J=B.path[0];F[J]=F[J]||[],F[J].push(D(B))}else $.push(D(B));return{formErrors:$,fieldErrors:F}}get formErrors(){return this.flatten()}}_0.create=(D)=>{return new _0(D)};var C2D=(D,F)=>{let $;switch(D.code){case R.invalid_type:if(D.received===T.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case R.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,YD.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:$=`Unrecognized key(s) in object: ${YD.joinValues(D.keys,", ")}`;break;case R.invalid_union:$="Invalid input";break;case R.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${YD.joinValues(D.options)}`;break;case R.invalid_enum_value:$=`Invalid enum value. Expected ${YD.joinValues(D.options)}, received '${D.received}'`;break;case R.invalid_arguments:$="Invalid function arguments";break;case R.invalid_return_type:$="Invalid function return type";break;case R.invalid_date:$="Invalid date";break;case R.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if($=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)$=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)$=`Invalid input: must end with "${D.validation.endsWith}"`;else YD.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case R.too_small:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else $="Invalid input";break;case R.too_big:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")$=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else $="Invalid input";break;case R.custom:$="Invalid input";break;case R.invalid_intersection_types:$="Intersection results could not be merged";break;case R.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case R.not_finite:$="Number must be finite";break;default:$=F.defaultError,YD.assertNever(D)}return{message:$}},L8=C2D;var Lv=L8;function R2D(D){Lv=D}function A3(){return Lv}var Z5=(D)=>{let{data:F,path:$,errorMaps:B,issueData:J}=D,Q=[...$,...J.path||[]],X={...J,path:Q};if(J.message!==void 0)return{...J,path:Q,message:J.message};let Y="",G=B.filter((H)=>!!H).slice().reverse();for(let H of G)Y=H(X,{data:F,defaultError:Y}).message;return{...J,path:Q,message:Y}},j2D=[];function P(D,F){let $=A3(),B=Z5({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===L8?void 0:L8].filter((J)=>!!J)});D.common.issues.push(B)}class X0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let $=[];for(let B of F){if(B.status==="aborted")return b;if(B.status==="dirty")D.dirty();$.push(B.value)}return{status:D.value,value:$}}static async mergeObjectAsync(D,F){let $=[];for(let B of F){let J=await B.key,Q=await B.value;$.push({key:J,value:Q})}return X0.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let B of F){let{key:J,value:Q}=B;if(J.status==="aborted")return b;if(Q.status==="aborted")return b;if(J.status==="dirty")D.dirty();if(Q.status==="dirty")D.dirty();if(J.value!=="__proto__"&&(typeof Q.value<"u"||B.alwaysSet))$[J.value]=Q.value}return{status:D.value,value:$}}}var b=Object.freeze({status:"aborted"}),n6=(D)=>({status:"dirty",value:D}),V0=(D)=>({status:"valid",value:D}),S$=(D)=>D.status==="aborted",k$=(D)=>D.status==="dirty",H6=(D)=>D.status==="valid",U3=(D)=>typeof Promise<"u"&&D instanceof Promise;var _;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(_||(_={}));class I1{constructor(D,F,$,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=$,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Mv=(D,F)=>{if(H6(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let $=new _0(D.common.issues);return this._error=$,this._error}}}};function e(D){if(!D)return{};let{errorMap:F,invalid_type_error:$,required_error:B,description:J}=D;if(F&&($||B))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:J};return{errorMap:(X,Y)=>{let{message:G}=D;if(X.code==="invalid_enum_value")return{message:G??Y.defaultError};if(typeof Y.data>"u")return{message:G??B??Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:G??$??Y.defaultError}},description:J}}class $D{get description(){return this._def.description}_getType(D){return F8(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:F8(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new X0,ctx:{common:D.parent.common,data:D.data,parsedType:F8(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(U3(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let $=this.safeParse(D,F);if($.success)return $.data;throw $.error}safeParse(D,F){let $={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)},B=this._parseSync({data:D,path:$.path,parent:$});return Mv($,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return H6($)?{value:$.value}:{issues:F.common.issues}}catch($){if($?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then(($)=>H6($)?{value:$.value}:{issues:F.common.issues})}async parseAsync(D,F){let $=await this.safeParseAsync(D,F);if($.success)return $.data;throw $.error}async safeParseAsync(D,F){let $={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)},B=this._parse({data:D,path:$.path,parent:$}),J=await(U3(B)?B:Promise.resolve(B));return Mv($,J)}refine(D,F){let $=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,J)=>{let Q=D(B),X=()=>J.addIssue({code:R.custom,...$(B)});if(typeof Promise<"u"&&Q instanceof Promise)return Q.then((Y)=>{if(!Y)return X(),!1;else return!0});if(!Q)return X(),!1;else return!0})}refinement(D,F){return this._refinement(($,B)=>{if(!D($))return B.addIssue(typeof F==="function"?F($,B):F),!1;else return!0})}_refinement(D){return new P1({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(F)=>this["~validate"](F)}}optional(){return w1.create(this,this._def)}nullable(){return N8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return O1.create(this)}promise(){return s6.create(this,this._def)}or(D){return j3.create([this,D],this._def)}and(D){return T3.create(this,D,this._def)}transform(D){return new P1({...e(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new P3({...e(this._def),innerType:this,defaultValue:F,typeName:m.ZodDefault})}brand(){return new y$({typeName:m.ZodBranded,type:this,...e(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new S3({...e(this._def),innerType:this,catchValue:F,typeName:m.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return C5.create(this,D)}readonly(){return k3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var T2D=/^c[^\s-]{8,}$/i,O2D=/^[0-9a-z]+$/,w2D=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I2D=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,P2D=/^[a-z0-9_-]{21}$/i,S2D=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k2D=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,v2D=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,y2D="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",f2,x2D=/^(?:(?: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])$/,_2D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,f2D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,g2D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h2D=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,b2D=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cv="((\\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])))",u2D=new RegExp(`^${Cv}$`);function Rv(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let $=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${$}`}function m2D(D){return new RegExp(`^${Rv(D)}$`)}function jv(D){let F=`${Cv}T${Rv(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function l2D(D,F){if((F==="v4"||!F)&&x2D.test(D))return!0;if((F==="v6"||!F)&&f2D.test(D))return!0;return!1}function d2D(D,F){if(!S2D.test(D))return!1;try{let[$]=D.split(".");if(!$)return!1;let B=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),J=JSON.parse(atob(B));if(typeof J!=="object"||J===null)return!1;if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(F&&J.alg!==F)return!1;return!0}catch{return!1}}function p2D(D,F){if((F==="v4"||!F)&&_2D.test(D))return!0;if((F==="v6"||!F)&&g2D.test(D))return!0;return!1}class T1 extends $D{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==T.string){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.string,received:J.parsedType}),b}let $=new X0,B=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(D.data.length<J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),$.dirty()}else if(J.kind==="max"){if(D.data.length>J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),$.dirty()}else if(J.kind==="length"){let Q=D.data.length>J.value,X=D.data.length<J.value;if(Q||X){if(B=this._getOrReturnCtx(D,B),Q)P(B,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(X)P(B,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});$.dirty()}}else if(J.kind==="email"){if(!v2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"email",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="emoji"){if(!f2)f2=new RegExp(y2D,"u");if(!f2.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"emoji",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="uuid"){if(!I2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"uuid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="nanoid"){if(!P2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"nanoid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid"){if(!T2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"cuid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid2"){if(!O2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"cuid2",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ulid"){if(!w2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"ulid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),P(B,{validation:"url",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="regex"){if(J.regex.lastIndex=0,!J.regex.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"regex",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="trim")D.data=D.data.trim();else if(J.kind==="includes"){if(!D.data.includes(J.value,J.position))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{includes:J.value,position:J.position},message:J.message}),$.dirty()}else if(J.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(J.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(J.kind==="startsWith"){if(!D.data.startsWith(J.value))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{startsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="endsWith"){if(!D.data.endsWith(J.value))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{endsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="datetime"){if(!jv(J).test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"datetime",message:J.message}),$.dirty()}else if(J.kind==="date"){if(!u2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"date",message:J.message}),$.dirty()}else if(J.kind==="time"){if(!m2D(J).test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"time",message:J.message}),$.dirty()}else if(J.kind==="duration"){if(!k2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"duration",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ip"){if(!l2D(D.data,J.version))B=this._getOrReturnCtx(D,B),P(B,{validation:"ip",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="jwt"){if(!d2D(D.data,J.alg))B=this._getOrReturnCtx(D,B),P(B,{validation:"jwt",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cidr"){if(!p2D(D.data,J.version))B=this._getOrReturnCtx(D,B),P(B,{validation:"cidr",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64"){if(!h2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"base64",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64url"){if(!b2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"base64url",code:R.invalid_string,message:J.message}),$.dirty()}else YD.assertNever(J);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((B)=>D.test(B),{validation:F,code:R.invalid_string,..._.errToObj($)})}_addCheck(D){return new T1({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",..._.errToObj(D)})}url(D){return this._addCheck({kind:"url",..._.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",..._.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",..._.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",..._.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",..._.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",..._.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",..._.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",..._.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",..._.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",..._.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",..._.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",..._.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,..._.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,..._.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",..._.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,..._.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,..._.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,..._.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,..._.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,..._.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,..._.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,..._.errToObj(F)})}nonempty(D){return this.min(1,_.errToObj(D))}trim(){return new T1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new T1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new T1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}T1.create=(D)=>{return new T1({checks:[],typeName:m.ZodString,coerce:D?.coerce??!1,...e(D)})};function c2D(D,F){let $=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,J=$>B?$:B,Q=Number.parseInt(D.toFixed(J).replace(".","")),X=Number.parseInt(F.toFixed(J).replace(".",""));return Q%X/10**J}class q6 extends $D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==T.number){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.number,received:J.parsedType}),b}let $=void 0,B=new X0;for(let J of this._def.checks)if(J.kind==="int"){if(!YD.isInteger(D.data))$=this._getOrReturnCtx(D,$),P($,{code:R.invalid_type,expected:"integer",received:"float",message:J.message}),B.dirty()}else if(J.kind==="min"){if(J.inclusive?D.data<J.value:D.data<=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_small,minimum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="max"){if(J.inclusive?D.data>J.value:D.data>=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(c2D(D.data,J.value)!==0)$=this._getOrReturnCtx(D,$),P($,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else if(J.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),P($,{code:R.not_finite,message:J.message}),B.dirty()}else YD.assertNever(J);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,_.toString(F))}gt(D,F){return this.setLimit("min",D,!1,_.toString(F))}lte(D,F){return this.setLimit("max",D,!0,_.toString(F))}lt(D,F){return this.setLimit("max",D,!1,_.toString(F))}setLimit(D,F,$,B){return new q6({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:_.toString(B)}]})}_addCheck(D){return new q6({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:_.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:_.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:_.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&YD.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(F===null||$.value>F)F=$.value}else if($.kind==="max"){if(D===null||$.value<D)D=$.value}return Number.isFinite(F)&&Number.isFinite(D)}}q6.create=(D)=>{return new q6({checks:[],typeName:m.ZodNumber,coerce:D?.coerce||!1,...e(D)})};class E6 extends $D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==T.bigint)return this._getInvalidInput(D);let $=void 0,B=new X0;for(let J of this._def.checks)if(J.kind==="min"){if(J.inclusive?D.data<J.value:D.data<=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_small,type:"bigint",minimum:J.value,inclusive:J.inclusive,message:J.message}),B.dirty()}else if(J.kind==="max"){if(J.inclusive?D.data>J.value:D.data>=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_big,type:"bigint",maximum:J.value,inclusive:J.inclusive,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(D.data%J.value!==BigInt(0))$=this._getOrReturnCtx(D,$),P($,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else YD.assertNever(J);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return P(F,{code:R.invalid_type,expected:T.bigint,received:F.parsedType}),b}gte(D,F){return this.setLimit("min",D,!0,_.toString(F))}gt(D,F){return this.setLimit("min",D,!1,_.toString(F))}lte(D,F){return this.setLimit("max",D,!0,_.toString(F))}lt(D,F){return this.setLimit("max",D,!1,_.toString(F))}setLimit(D,F,$,B){return new E6({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:_.toString(B)}]})}_addCheck(D){return new E6({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:_.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}E6.create=(D)=>{return new E6({checks:[],typeName:m.ZodBigInt,coerce:D?.coerce??!1,...e(D)})};class N3 extends $D{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==T.boolean){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.boolean,received:$.parsedType}),b}return V0(D.data)}}N3.create=(D)=>{return new N3({typeName:m.ZodBoolean,coerce:D?.coerce||!1,...e(D)})};class i6 extends $D{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==T.date){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.date,received:J.parsedType}),b}if(Number.isNaN(D.data.getTime())){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_date}),b}let $=new X0,B=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(D.data.getTime()<J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_small,message:J.message,inclusive:!0,exact:!1,minimum:J.value,type:"date"}),$.dirty()}else if(J.kind==="max"){if(D.data.getTime()>J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),$.dirty()}else YD.assertNever(J);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new i6({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:_.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:_.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}}i6.create=(D)=>{return new i6({checks:[],coerce:D?.coerce||!1,typeName:m.ZodDate,...e(D)})};class A5 extends $D{_parse(D){if(this._getType(D)!==T.symbol){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.symbol,received:$.parsedType}),b}return V0(D.data)}}A5.create=(D)=>{return new A5({typeName:m.ZodSymbol,...e(D)})};class C3 extends $D{_parse(D){if(this._getType(D)!==T.undefined){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.undefined,received:$.parsedType}),b}return V0(D.data)}}C3.create=(D)=>{return new C3({typeName:m.ZodUndefined,...e(D)})};class R3 extends $D{_parse(D){if(this._getType(D)!==T.null){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.null,received:$.parsedType}),b}return V0(D.data)}}R3.create=(D)=>{return new R3({typeName:m.ZodNull,...e(D)})};class a6 extends $D{constructor(){super(...arguments);this._any=!0}_parse(D){return V0(D.data)}}a6.create=(D)=>{return new a6({typeName:m.ZodAny,...e(D)})};class W6 extends $D{constructor(){super(...arguments);this._unknown=!0}_parse(D){return V0(D.data)}}W6.create=(D)=>{return new W6({typeName:m.ZodUnknown,...e(D)})};class $8 extends $D{_parse(D){let F=this._getOrReturnCtx(D);return P(F,{code:R.invalid_type,expected:T.never,received:F.parsedType}),b}}$8.create=(D)=>{return new $8({typeName:m.ZodNever,...e(D)})};class U5 extends $D{_parse(D){if(this._getType(D)!==T.undefined){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.void,received:$.parsedType}),b}return V0(D.data)}}U5.create=(D)=>{return new U5({typeName:m.ZodVoid,...e(D)})};class O1 extends $D{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),B=this._def;if(F.parsedType!==T.array)return P(F,{code:R.invalid_type,expected:T.array,received:F.parsedType}),b;if(B.exactLength!==null){let Q=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(Q||X)P(F,{code:Q?R.too_big:R.too_small,minimum:X?B.exactLength.value:void 0,maximum:Q?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),$.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)P(F,{code:R.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),$.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)P(F,{code:R.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),$.dirty()}if(F.common.async)return Promise.all([...F.data].map((Q,X)=>{return B.type._parseAsync(new I1(F,Q,F.path,X))})).then((Q)=>{return X0.mergeArray($,Q)});let J=[...F.data].map((Q,X)=>{return B.type._parseSync(new I1(F,Q,F.path,X))});return X0.mergeArray($,J)}get element(){return this._def.type}min(D,F){return new O1({...this._def,minLength:{value:D,message:_.toString(F)}})}max(D,F){return new O1({...this._def,maxLength:{value:D,message:_.toString(F)}})}length(D,F){return new O1({...this._def,exactLength:{value:D,message:_.toString(F)}})}nonempty(D){return this.min(1,D)}}O1.create=(D,F)=>{return new O1({type:D,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...e(F)})};function L3(D){if(D instanceof gD){let F={};for(let $ in D.shape){let B=D.shape[$];F[$]=w1.create(L3(B))}return new gD({...D._def,shape:()=>F})}else if(D instanceof O1)return new O1({...D._def,type:L3(D.element)});else if(D instanceof w1)return w1.create(L3(D.unwrap()));else if(D instanceof N8)return N8.create(L3(D.unwrap()));else if(D instanceof B8)return B8.create(D.items.map((F)=>L3(F)));else return D}class gD extends $D{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=YD.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==T.object){let G=this._getOrReturnCtx(D);return P(G,{code:R.invalid_type,expected:T.object,received:G.parsedType}),b}let{status:$,ctx:B}=this._processInputParams(D),{shape:J,keys:Q}=this._getCached(),X=[];if(!(this._def.catchall instanceof $8&&this._def.unknownKeys==="strip")){for(let G in B.data)if(!Q.includes(G))X.push(G)}let Y=[];for(let G of Q){let H=J[G],q=B.data[G];Y.push({key:{status:"valid",value:G},value:H._parse(new I1(B,q,B.path,G)),alwaysSet:G in B.data})}if(this._def.catchall instanceof $8){let G=this._def.unknownKeys;if(G==="passthrough")for(let H of X)Y.push({key:{status:"valid",value:H},value:{status:"valid",value:B.data[H]}});else if(G==="strict"){if(X.length>0)P(B,{code:R.unrecognized_keys,keys:X}),$.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let H of X){let q=B.data[H];Y.push({key:{status:"valid",value:H},value:G._parse(new I1(B,q,B.path,H)),alwaysSet:H in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let G=[];for(let H of Y){let q=await H.key,K=await H.value;G.push({key:q,value:K,alwaysSet:H.alwaysSet})}return G}).then((G)=>{return X0.mergeObjectSync($,G)});else return X0.mergeObjectSync($,Y)}get shape(){return this._def.shape()}strict(D){return _.errToObj,new gD({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let B=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:_.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new gD({...this._def,unknownKeys:"strip"})}passthrough(){return new gD({...this._def,unknownKeys:"passthrough"})}extend(D){return new gD({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new gD({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:m.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new gD({...this._def,catchall:D})}pick(D){let F={};for(let $ of YD.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new gD({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of YD.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new gD({...this._def,shape:()=>F})}deepPartial(){return L3(this)}partial(D){let F={};for(let $ of YD.objectKeys(this.shape)){let B=this.shape[$];if(D&&!D[$])F[$]=B;else F[$]=B.optional()}return new gD({...this._def,shape:()=>F})}required(D){let F={};for(let $ of YD.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let J=this.shape[$];while(J instanceof w1)J=J._def.innerType;F[$]=J}return new gD({...this._def,shape:()=>F})}keyof(){return Tv(YD.objectKeys(this.shape))}}gD.create=(D,F)=>{return new gD({shape:()=>D,unknownKeys:"strip",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};gD.strictCreate=(D,F)=>{return new gD({shape:()=>D,unknownKeys:"strict",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};gD.lazycreate=(D,F)=>{return new gD({shape:D,unknownKeys:"strip",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};class j3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function B(J){for(let X of J)if(X.result.status==="valid")return X.result;for(let X of J)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let Q=J.map((X)=>new _0(X.ctx.common.issues));return P(F,{code:R.invalid_union,unionErrors:Q}),b}if(F.common.async)return Promise.all($.map(async(J)=>{let Q={...F,common:{...F.common,issues:[]},parent:null};return{result:await J._parseAsync({data:F.data,path:F.path,parent:Q}),ctx:Q}})).then(B);else{let J=void 0,Q=[];for(let Y of $){let G={...F,common:{...F.common,issues:[]},parent:null},H=Y._parseSync({data:F.data,path:F.path,parent:G});if(H.status==="valid")return H;else if(H.status==="dirty"&&!J)J={result:H,ctx:G};if(G.common.issues.length)Q.push(G.common.issues)}if(J)return F.common.issues.push(...J.ctx.common.issues),J.result;let X=Q.map((Y)=>new _0(Y));return P(F,{code:R.invalid_union,unionErrors:X}),b}}get options(){return this._def.options}}j3.create=(D,F)=>{return new j3({options:D,typeName:m.ZodUnion,...e(F)})};var M8=(D)=>{if(D instanceof O3)return M8(D.schema);else if(D instanceof P1)return M8(D.innerType());else if(D instanceof w3)return[D.value];else if(D instanceof K6)return D.options;else if(D instanceof I3)return YD.objectValues(D.enum);else if(D instanceof P3)return M8(D._def.innerType);else if(D instanceof C3)return[void 0];else if(D instanceof R3)return[null];else if(D instanceof w1)return[void 0,...M8(D.unwrap())];else if(D instanceof N8)return[null,...M8(D.unwrap())];else if(D instanceof y$)return M8(D.unwrap());else if(D instanceof k3)return M8(D.unwrap());else if(D instanceof S3)return M8(D._def.innerType);else return[]};class v$ extends $D{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.object)return P(F,{code:R.invalid_type,expected:T.object,received:F.parsedType}),b;let $=this.discriminator,B=F.data[$],J=this.optionsMap.get(B);if(!J)return P(F,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),b;if(F.common.async)return J._parseAsync({data:F.data,path:F.path,parent:F});else return J._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,$){let B=new Map;for(let J of F){let Q=M8(J.shape[D]);if(!Q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of Q){if(B.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,J)}}return new v$({typeName:m.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...e($)})}}function g2(D,F){let $=F8(D),B=F8(F);if(D===F)return{valid:!0,data:D};else if($===T.object&&B===T.object){let J=YD.objectKeys(F),Q=YD.objectKeys(D).filter((Y)=>J.indexOf(Y)!==-1),X={...D,...F};for(let Y of Q){let G=g2(D[Y],F[Y]);if(!G.valid)return{valid:!1};X[Y]=G.data}return{valid:!0,data:X}}else if($===T.array&&B===T.array){if(D.length!==F.length)return{valid:!1};let J=[];for(let Q=0;Q<D.length;Q++){let X=D[Q],Y=F[Q],G=g2(X,Y);if(!G.valid)return{valid:!1};J.push(G.data)}return{valid:!0,data:J}}else if($===T.date&&B===T.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class T3 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=(J,Q)=>{if(S$(J)||S$(Q))return b;let X=g2(J.value,Q.value);if(!X.valid)return P($,{code:R.invalid_intersection_types}),b;if(k$(J)||k$(Q))F.dirty();return{status:F.value,value:X.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([J,Q])=>B(J,Q));else return B(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}}T3.create=(D,F,$)=>{return new T3({left:D,right:F,typeName:m.ZodIntersection,...e($)})};class B8 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.array)return P($,{code:R.invalid_type,expected:T.array,received:$.parsedType}),b;if($.data.length<this._def.items.length)return P($,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&$.data.length>this._def.items.length)P($,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let J=[...$.data].map((Q,X)=>{let Y=this._def.items[X]||this._def.rest;if(!Y)return null;return Y._parse(new I1($,Q,$.path,X))}).filter((Q)=>!!Q);if($.common.async)return Promise.all(J).then((Q)=>{return X0.mergeArray(F,Q)});else return X0.mergeArray(F,J)}get items(){return this._def.items}rest(D){return new B8({...this._def,rest:D})}}B8.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new B8({items:D,typeName:m.ZodTuple,rest:null,...e(F)})};class L5 extends $D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.object)return P($,{code:R.invalid_type,expected:T.object,received:$.parsedType}),b;let B=[],J=this._def.keyType,Q=this._def.valueType;for(let X in $.data)B.push({key:J._parse(new I1($,X,$.path,X)),value:Q._parse(new I1($,$.data[X],$.path,X)),alwaysSet:X in $.data});if($.common.async)return X0.mergeObjectAsync(F,B);else return X0.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof $D)return new L5({keyType:D,valueType:F,typeName:m.ZodRecord,...e($)});return new L5({keyType:T1.create(),valueType:D,typeName:m.ZodRecord,...e(F)})}}class M5 extends $D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.map)return P($,{code:R.invalid_type,expected:T.map,received:$.parsedType}),b;let B=this._def.keyType,J=this._def.valueType,Q=[...$.data.entries()].map(([X,Y],G)=>{return{key:B._parse(new I1($,X,$.path,[G,"key"])),value:J._parse(new I1($,Y,$.path,[G,"value"]))}});if($.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Y of Q){let G=await Y.key,H=await Y.value;if(G.status==="aborted"||H.status==="aborted")return b;if(G.status==="dirty"||H.status==="dirty")F.dirty();X.set(G.value,H.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Y of Q){let{key:G,value:H}=Y;if(G.status==="aborted"||H.status==="aborted")return b;if(G.status==="dirty"||H.status==="dirty")F.dirty();X.set(G.value,H.value)}return{status:F.value,value:X}}}}M5.create=(D,F,$)=>{return new M5({valueType:F,keyType:D,typeName:m.ZodMap,...e($)})};class o6 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.set)return P($,{code:R.invalid_type,expected:T.set,received:$.parsedType}),b;let B=this._def;if(B.minSize!==null){if($.data.size<B.minSize.value)P($,{code:R.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if($.data.size>B.maxSize.value)P($,{code:R.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let J=this._def.valueType;function Q(Y){let G=new Set;for(let H of Y){if(H.status==="aborted")return b;if(H.status==="dirty")F.dirty();G.add(H.value)}return{status:F.value,value:G}}let X=[...$.data.values()].map((Y,G)=>J._parse(new I1($,Y,$.path,G)));if($.common.async)return Promise.all(X).then((Y)=>Q(Y));else return Q(X)}min(D,F){return new o6({...this._def,minSize:{value:D,message:_.toString(F)}})}max(D,F){return new o6({...this._def,maxSize:{value:D,message:_.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}o6.create=(D,F)=>{return new o6({valueType:D,minSize:null,maxSize:null,typeName:m.ZodSet,...e(F)})};class M3 extends $D{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.function)return P(F,{code:R.invalid_type,expected:T.function,received:F.parsedType}),b;function $(X,Y){return Z5({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,A3(),L8].filter((G)=>!!G),issueData:{code:R.invalid_arguments,argumentsError:Y}})}function B(X,Y){return Z5({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,A3(),L8].filter((G)=>!!G),issueData:{code:R.invalid_return_type,returnTypeError:Y}})}let J={errorMap:F.common.contextualErrorMap},Q=F.data;if(this._def.returns instanceof s6){let X=this;return V0(async function(...Y){let G=new _0([]),H=await X._def.args.parseAsync(Y,J).catch((V)=>{throw G.addIssue($(Y,V)),G}),q=await Reflect.apply(Q,this,H);return await X._def.returns._def.type.parseAsync(q,J).catch((V)=>{throw G.addIssue(B(q,V)),G})})}else{let X=this;return V0(function(...Y){let G=X._def.args.safeParse(Y,J);if(!G.success)throw new _0([$(Y,G.error)]);let H=Reflect.apply(Q,this,G.data),q=X._def.returns.safeParse(H,J);if(!q.success)throw new _0([B(H,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new M3({...this._def,args:B8.create(D).rest(W6.create())})}returns(D){return new M3({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new M3({args:D?D:B8.create([]).rest(W6.create()),returns:F||W6.create(),typeName:m.ZodFunction,...e($)})}}class O3 extends $D{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}O3.create=(D,F)=>{return new O3({getter:D,typeName:m.ZodLazy,...e(F)})};class w3 extends $D{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return P(F,{received:F.data,code:R.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:D.data}}get value(){return this._def.value}}w3.create=(D,F)=>{return new w3({value:D,typeName:m.ZodLiteral,...e(F)})};function Tv(D,F){return new K6({values:D,typeName:m.ZodEnum,...e(F)})}class K6 extends $D{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return P(F,{expected:YD.joinValues($),received:F.parsedType,code:R.invalid_type}),b}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),$=this._def.values;return P(F,{received:F.data,code:R.invalid_enum_value,options:$}),b}return V0(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return K6.create(D,{...this._def,...F})}exclude(D,F=this._def){return K6.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}}K6.create=Tv;class I3 extends $D{_parse(D){let F=YD.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==T.string&&$.parsedType!==T.number){let B=YD.objectValues(F);return P($,{expected:YD.joinValues(B),received:$.parsedType,code:R.invalid_type}),b}if(!this._cache)this._cache=new Set(YD.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=YD.objectValues(F);return P($,{received:$.data,code:R.invalid_enum_value,options:B}),b}return V0(D.data)}get enum(){return this._def.values}}I3.create=(D,F)=>{return new I3({values:D,typeName:m.ZodNativeEnum,...e(F)})};class s6 extends $D{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.promise&&F.common.async===!1)return P(F,{code:R.invalid_type,expected:T.promise,received:F.parsedType}),b;let $=F.parsedType===T.promise?F.data:Promise.resolve(F.data);return V0($.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}s6.create=(D,F)=>{return new s6({type:D,typeName:m.ZodPromise,...e(F)})};class P1 extends $D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=this._def.effect||null,J={addIssue:(Q)=>{if(P($,Q),Q.fatal)F.abort();else F.dirty()},get path(){return $.path}};if(J.addIssue=J.addIssue.bind(J),B.type==="preprocess"){let Q=B.transform($.data,J);if($.common.async)return Promise.resolve(Q).then(async(X)=>{if(F.value==="aborted")return b;let Y=await this._def.schema._parseAsync({data:X,path:$.path,parent:$});if(Y.status==="aborted")return b;if(Y.status==="dirty")return n6(Y.value);if(F.value==="dirty")return n6(Y.value);return Y});else{if(F.value==="aborted")return b;let X=this._def.schema._parseSync({data:Q,path:$.path,parent:$});if(X.status==="aborted")return b;if(X.status==="dirty")return n6(X.value);if(F.value==="dirty")return n6(X.value);return X}}if(B.type==="refinement"){let Q=(X)=>{let Y=B.refinement(X,J);if($.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if($.common.async===!1){let X=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(X.status==="aborted")return b;if(X.status==="dirty")F.dirty();return Q(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((X)=>{if(X.status==="aborted")return b;if(X.status==="dirty")F.dirty();return Q(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!H6(Q))return b;let X=B.transform(Q.value,J);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(!H6(Q))return b;return Promise.resolve(B.transform(Q.value,J)).then((X)=>({status:F.value,value:X}))});YD.assertNever(B)}}P1.create=(D,F,$)=>{return new P1({schema:D,typeName:m.ZodEffects,effect:F,...e($)})};P1.createWithPreprocess=(D,F,$)=>{return new P1({schema:F,effect:{type:"preprocess",transform:D},typeName:m.ZodEffects,...e($)})};class w1 extends $D{_parse(D){if(this._getType(D)===T.undefined)return V0(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}w1.create=(D,F)=>{return new w1({innerType:D,typeName:m.ZodOptional,...e(F)})};class N8 extends $D{_parse(D){if(this._getType(D)===T.null)return V0(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}N8.create=(D,F)=>{return new N8({innerType:D,typeName:m.ZodNullable,...e(F)})};class P3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===T.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}P3.create=(D,F)=>{return new P3({innerType:D,typeName:m.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...e(F)})};class S3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(U3(B))return B.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new _0($.common.issues)},input:$.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new _0($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}S3.create=(D,F)=>{return new S3({innerType:D,typeName:m.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...e(F)})};class N5 extends $D{_parse(D){if(this._getType(D)!==T.nan){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.nan,received:$.parsedType}),b}return{status:"valid",value:D.data}}}N5.create=(D)=>{return new N5({typeName:m.ZodNaN,...e(D)})};var n2D=Symbol("zod_brand");class y$ extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;return this._def.type._parse({data:$,path:F.path,parent:F})}unwrap(){return this._def.type}}class C5 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.common.async)return(async()=>{let J=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(J.status==="aborted")return b;if(J.status==="dirty")return F.dirty(),n6(J.value);else return this._def.out._parseAsync({data:J.value,path:$.path,parent:$})})();else{let B=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(B.status==="aborted")return b;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:$.path,parent:$})}}static create(D,F){return new C5({in:D,out:F,typeName:m.ZodPipeline})}}class k3 extends $D{_parse(D){let F=this._def.innerType._parse(D),$=(B)=>{if(H6(B))B.value=Object.freeze(B.value);return B};return U3(F)?F.then((B)=>$(B)):$(F)}unwrap(){return this._def.innerType}}k3.create=(D,F)=>{return new k3({innerType:D,typeName:m.ZodReadonly,...e(F)})};function Nv(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function Ov(D,F={},$){if(D)return a6.create().superRefine((B,J)=>{let Q=D(B);if(Q instanceof Promise)return Q.then((X)=>{if(!X){let Y=Nv(F,B),G=Y.fatal??$??!0;J.addIssue({code:"custom",...Y,fatal:G})}});if(!Q){let X=Nv(F,B),Y=X.fatal??$??!0;J.addIssue({code:"custom",...X,fatal:Y})}return});return a6.create()}var i2D={object:gD.lazycreate},m;(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(m||(m={}));var a2D=(D,F={message:`Input not instance of ${D.name}`})=>Ov(($)=>$ instanceof D,F),wv=T1.create,Iv=q6.create,o2D=N5.create,s2D=E6.create,Pv=N3.create,r2D=i6.create,t2D=A5.create,e2D=C3.create,DGD=R3.create,FGD=a6.create,$GD=W6.create,BGD=$8.create,JGD=U5.create,QGD=O1.create,XGD=gD.create,YGD=gD.strictCreate,GGD=j3.create,HGD=v$.create,WGD=T3.create,qGD=B8.create,EGD=L5.create,KGD=M5.create,zGD=o6.create,VGD=M3.create,ZGD=O3.create,AGD=w3.create,UGD=K6.create,LGD=I3.create,MGD=s6.create,NGD=P1.create,CGD=w1.create,RGD=N8.create,jGD=P1.createWithPreprocess,TGD=C5.create,OGD=()=>wv().optional(),wGD=()=>Iv().optional(),IGD=()=>Pv().optional(),PGD={string:(D)=>T1.create({...D,coerce:!0}),number:(D)=>q6.create({...D,coerce:!0}),boolean:(D)=>N3.create({...D,coerce:!0}),bigint:(D)=>E6.create({...D,coerce:!0}),date:(D)=>i6.create({...D,coerce:!0})};var SGD=b;var ERD=S1.object({apiKey:S1.string().optional(),apiUrl:S1.string().url().default("https://nemar-api-dev.shirazi-10f.workers.dev"),username:S1.string().optional(),email:S1.string().email().optional(),githubUsername:S1.string().optional(),sandboxCompleted:S1.boolean().optional(),sandboxDatasetId:S1.string().optional()}),l0=new P$({projectName:"nemar",schema:{apiKey:{type:"string"},apiUrl:{type:"string",default:"https://nemar-api-dev.shirazi-10f.workers.dev"},username:{type:"string"},email:{type:"string"},githubUsername:{type:"string"},sandboxCompleted:{type:"boolean"},sandboxDatasetId:{type:"string"}},...process.env.NEMAR_CONFIG_DIR?{cwd:process.env.NEMAR_CONFIG_DIR}:{}});function Y0(){return{apiKey:l0.get("apiKey"),apiUrl:l0.get("apiUrl"),username:l0.get("username"),email:l0.get("email"),githubUsername:l0.get("githubUsername"),sandboxCompleted:l0.get("sandboxCompleted"),sandboxDatasetId:l0.get("sandboxDatasetId")}}function Sv(){return!!l0.get("sandboxCompleted")}function R0(D,F){l0.set(D,F)}function h2(D){l0.delete(D)}function kv(){l0.clear()}function vD(){return!!l0.get("apiKey")}function vv(){return l0.path}var b2="https://nemar-api-dev.shirazi-10f.workers.dev",x$=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/;function f0(D){if(D instanceof Error)return D.message;return String(D)}class u extends Error{statusCode;details;constructor(D,F,$){super(F);this.statusCode=D;this.details=$;this.name="ApiError"}}var kGD=b2.includes("workers.dev");function yv(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(kGD)return b2;return Y0().apiUrl||b2}async function o(D,F={},$=!1){let B=`${yv()}${D}`,J={"Content-Type":"application/json",...F.headers};if($){let Y=Y0();if(!Y.apiKey&&$===!0)throw new u(401,"Not authenticated. Run 'nemar auth login' first.");if(Y.apiKey)J.Authorization=`Bearer ${Y.apiKey}`}let Q;try{Q=await fetch(B,{...F,headers:J})}catch(Y){throw new u(0,`Network error: Could not connect to ${yv()}`,{originalError:Y instanceof Error?Y.message:String(Y)})}let X;try{X=await Q.json()}catch{throw new u(Q.status,`Invalid response from server (status ${Q.status})`)}if(!Q.ok)throw new u(Q.status,X.error||X.message||"Request failed",X.details);return X}async function xv(D){return o(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function _v(D){return o(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function fv(D){return o("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function gv(D){return o("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function hv(D){return o("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function bv(D,F){return o("/auth/retrieve-key",{method:"POST",body:JSON.stringify({email:D,password:F})})}async function uv(D){return o("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:D})})}async function _$(){return o("/users/me",{},!0)}async function mv(D){let F=D?`?status=${D}`:"";return o(`/admin/users${F}`,{},!0)}async function lv(D){return o(`/admin/approve/${D}`,{method:"POST"},!0)}async function dv(D){return o(`/admin/revoke/${D}`,{method:"POST"},!0)}async function pv(D,F){return o(`/admin/users/${D}/role`,{method:"POST",body:JSON.stringify({role:F})},!0)}async function cv(D){return o(`/admin/regenerate-iam/${D}`,{method:"POST"},!0)}async function u2(D,F){return o(`/admin/datasets/${D}/visibility`,{method:"PATCH",body:JSON.stringify({visibility:F})},!0)}async function nv(D){return o(`/datasets/${D}/publish`,{method:"POST"},!0)}async function iv(D){return o(`/admin/datasets/${D}/ci`,{},!0)}async function f$(D){return o(`/admin/datasets/${D}/ci`,{method:"POST"},!0)}async function av(D){return o(`/datasets/${D}/ci/status`,{},!0)}async function ov(D){return o(`/datasets/${D}/manifest`,{},!0)}async function sv(D,F){return o(`/datasets/${D}/manifest/${F}`,{},!0)}function rv(D){let F=D;if(!["active","archived","deleted"].includes(F.status))throw Error(`Invalid dataset status: ${F.status}`);if(!F.visibility)F.visibility="private";else if(!["public","private"].includes(F.visibility))throw Error(`Invalid dataset visibility: ${F.visibility}`);return F}async function tv(D=!1){let $=await o(`/datasets${D?"?mine=true":""}`,{},D?!0:"optional");return $.datasets=$.datasets.map(rv),$}async function d0(D){let F=await o(`/datasets/${D}`,{},"optional");return rv(F.dataset)}async function ev(D){return o(`/datasets/${D}/versions`,{},!0)}async function g$(D){return o("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function h$(D){return o(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function Dy(D,F){return o(`/datasets/${D}/upload-urls`,{method:"POST",body:JSON.stringify({files:F})},!0)}async function Fy(D,F){return o(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function R5(D){return o(`/admin/datasets/${D}/doi`,{},!0)}async function m2(D,F){return o(`/admin/datasets/${D}/doi/update`,{method:"POST",body:JSON.stringify(F)},!0)}async function $y(D){return o(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function By(D,F){return o(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function Jy(D){return o(`/datasets/${D}/collaborators`,{},!0)}async function Qy(D){return o("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function Xy(){return o("/sandbox/reset",{method:"POST"},!0)}async function Yy(){return o("/sandbox/status",{},!0)}async function Gy(D){return o(`/datasets/${D}/publish/request`,{method:"POST"},!0)}async function Hy(D){return o(`/datasets/${D}/publish/status`,{},!0)}async function Wy(D){return o(`/datasets/${D}/publish/resend`,{method:"POST"},!0)}async function qy(D){let F=D?`?status=${D}`:"";return o(`/admin/publish/requests${F}`,{},!0)}async function Ey(D,F){return o(`/admin/publish/${D}/deny`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:F})},!0)}async function Ky(D,F=!1,$=!1){let B,J;do if(J=await o(`/admin/publish/${D}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resume:F,sandbox:$,s3_lock_offset:B})},!0),J.hasMore&&J.s3_lock_offset!==void 0)B=J.s3_lock_offset;else break;while(J.hasMore);return J}async function zy(D,F){return o(`/admin/datasets/${D}/enrichment`,{method:"POST",body:JSON.stringify(F)},!0)}async function Vy(D){return o(`/admin/datasets/${D}/files`,{},!0)}async function Zy(D){let F=0,$=0,B=[],J=0,Q=!0;while(Q){let X=await o(`/admin/datasets/${D}/s3-lock`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({offset:F})},!0);if($+=X.locked,B.push(...X.failed),J=X.total,Q=X.hasMore,Q)F+=40}return{locked:$,total:J,failed:B}}async function Ay(D,F=!1){return o(`/admin/datasets/${D}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:F})},!0)}async function OD(D,F,$=!1){if(F.no)return"declined";if(F.yes)return"confirmed";try{let{confirmed:B}=await MD.prompt([{type:"confirm",name:"confirmed",message:D,default:$}]);return B?"confirmed":"cancelled"}catch(B){let J=B instanceof Error?B.message:String(B);if(J.includes("closed")||J.includes("TTY")||J.includes("SIGINT")||J.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",J);return"cancelled"}}async function Uy(D,F,$){if($.no)return"declined";if($.yes)return"confirmed";try{let{input:B}=await MD.prompt([{type:"input",name:"input",message:D,validate:(J)=>{if(J!==F)return`Input does not match. Expected: ${F}`;return!0}}]);return B===F?"confirmed":"cancelled"}catch(B){let J=B instanceof Error?B.message:String(B);if(J.includes("closed")||J.includes("TTY")||J.includes("SIGINT")||J.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",J);return"cancelled"}}var yD="-y, --yes",lD="-n, --no",xD="Skip confirmation and proceed",dD="Skip confirmation and decline";import{existsSync as Ny,statSync as vGD}from"fs";import{join as l2}from"path";var{spawn:yGD}=globalThis.Bun;async function l(D,F={}){let $=yGD({cmd:D,cwd:F.cwd,stdout:"pipe",stderr:"pipe",env:{...process.env,...F.env}}),B=await new Response($.stdout).text(),J=await new Response($.stderr).text(),Q=await $.exited;return{stdout:B,stderr:J,exitCode:Q}}function Ly(D){return D.split(".").map((F)=>{let $=Number.parseInt(F.replace(/[^0-9]/g,""),10);return Number.isNaN($)?0:$})}function xGD(D,F){let $=Ly(D),B=Ly(F);for(let J=0;J<Math.max($.length,B.length);J++){let Q=$[J]||0,X=B[J]||0;if(Q>X)return!0;if(Q<X)return!1}return!0}async function Cy(){try{let{stdout:F,exitCode:$,stderr:B}=await l(["git-annex","version"]);if($!==0)return console.warn("git-annex version returned non-zero exit code:",$),console.warn("stderr:",B),{installed:!1,minVersion:"10.0",error:`Version check failed: ${B.trim()}`};let J=F.match(/version:\s*(\d+\.\d+)/),Q=J?J[1]:void 0;if(!Q)console.warn("Could not parse git-annex version from output:",F);return{installed:!0,version:Q,minVersion:"10.0",compatible:Q?xGD(Q,"10.0"):void 0}}catch(F){let $=F instanceof Error?F.message:String(F);if($.includes("ENOENT")||$.includes("not found"))return console.info("git-annex not found in PATH"),{installed:!1,minVersion:"10.0"};return console.error("Error checking git-annex installation:",$),{installed:!1,minVersion:"10.0",error:$}}}async function _GD(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:D,stderr:F}=await l(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"]),$=D+F,B=$.match(/Hi ([^!]+)!/);if(B)return{accessible:!0,username:B[1]};if($.includes("Permission denied"))return{accessible:!1};return{accessible:$.includes("successfully authenticated")}}catch(D){let F=D instanceof Error?D.message:String(D);if(F.includes("ENOENT")||F.includes("not found"))console.info("SSH command not found");else console.error("Error checking GitHub SSH access:",F);return{accessible:!1}}}function Ry(){let D=process.platform;if(D==="darwin")return"brew install git-annex";if(D==="linux")return"apt install git-annex (Debian/Ubuntu)";return"See https://git-annex.branchable.com/install/"}async function b$(){let[D,F]=await Promise.all([Cy(),_GD()]),$=[];if(!D.installed)$.push(`git-annex is not installed. Install: ${Ry()}`);else if(D.compatible===!1)$.push(`git-annex version ${D.version} is too old. Required: >= ${D.minVersion}`);if(!F.accessible)$.push("GitHub SSH access not configured. Run 'nemar auth setup-ssh' to configure automatically.");return{gitAnnex:D,githubSSH:F,allPassed:$.length===0,errors:$}}async function C8(D){if(!Ny(l2(D,".git")))return!1;try{let{exitCode:F}=await l(["git","annex","info"],{cwd:D});return F===0}catch(F){let $=F instanceof Error?F.message:String(F);if(!$.includes("ENOENT")&&!$.includes("not found"))console.error(`Error checking if ${D} is a git-annex dataset:`,$);return!1}}async function u$(D,F={}){if(!F.force&&await C8(D))return{success:!0};try{let $={};if(F.author)$.GIT_AUTHOR_NAME=F.author.name,$.GIT_AUTHOR_EMAIL=F.author.email,$.GIT_COMMITTER_NAME=F.author.name,$.GIT_COMMITTER_EMAIL=F.author.email;let{stderr:B,exitCode:J}=await l(["git","init",D],{...Object.keys($).length>0?{env:$}:{}});if(J!==0)return{success:!1,error:B.trim()||"Failed to initialize git repository"};let{stderr:Q,exitCode:X}=await l(["git","annex","init"],{cwd:D,...Object.keys($).length>0?{env:$}:{}});if(X!==0)return{success:!1,error:Q.trim()||"Failed to initialize git-annex"};return{success:!0}}catch($){return{success:!1,error:$.message}}}async function jy(D){try{let{exitCode:F,stderr:$}=await l(["git","annex","info"],{cwd:D});if(F===0)return{success:!0};if($.includes("First run: git-annex init")){let{stderr:B,exitCode:J}=await l(["git","annex","init"],{cwd:D});if(J!==0)return{success:!1,error:B.trim()||"Failed to initialize git-annex"};return{success:!0}}return{success:!1,error:$.trim()||"Failed to check git-annex status"}}catch(F){return{success:!1,error:F.message}}}async function m$(D,F){let B=F||"include=*.edf or include=*.bdf or include=*.set or include=*.fif or include=*.vhdr or include=*.eeg or include=*.cnt or include=*.fdt or largerthan=100kb";try{let{stderr:J,exitCode:Q}=await l(["git","annex","config","--set","annex.largefiles",B],{cwd:D});if(Q!==0)return{success:!1,error:J.trim()||"Failed to configure largefiles"};return{success:!0}}catch(J){return{success:!1,error:J.message}}}async function fGD(){try{let{exitCode:D,stderr:F}=await l(["ssh","-T","-o","BatchMode=yes","-o","ConnectTimeout=5","git@github.com"]),$=F.includes("successfully authenticated");if(!$)console.warn("SSH test to github.com failed:",{exitCode:D,stderr:F.trim().slice(0,500)});return{works:$,error:$?void 0:F.trim().slice(0,500)}}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn("SSH test exception:",F),{works:!1,error:F}}}async function gGD(){try{let{stdout:D,exitCode:F,stderr:$}=await l(["gh","auth","token"]);if(F!==0)return console.warn("gh CLI returned non-zero exit code:",F),console.warn("stderr:",$),{token:null,error:`gh auth token failed: ${$.trim()||"unknown error"}`};if(!D.trim())return console.warn("gh auth token returned empty output"),{token:null,error:"gh CLI returned empty token"};return{token:D.trim()}}catch(D){let F=D instanceof Error?D.message:String(D);if(console.error("Failed to get GitHub token from gh CLI:",F),F.includes("ENOENT")||F.includes("not found"))return{token:null,error:"gh CLI not installed (command not found)"};return{token:null,error:`gh CLI error: ${F}`}}}async function l$(D){try{let{stdout:F,exitCode:$,stderr:B}=await l(["gh","api","user","--jq",".login"]);if($!==0){if(B.includes("not logged in")||B.includes("auth login"))return{authenticated:!1,error:"gh CLI not authenticated. Run 'gh auth login' to authenticate."};return{authenticated:!1,error:`gh CLI error: ${B.trim()||"unknown error"}`}}let J=F.trim();if(!J)return{authenticated:!1,error:"gh CLI returned empty username"};if(D){let Q=J.toLowerCase()===D.toLowerCase();return{authenticated:!0,username:J,matches:Q,error:Q?void 0:`gh CLI authenticated as '${J}', expected '${D}'`}}return{authenticated:!0,username:J}}catch(F){let $=F instanceof Error?F.message:String(F);if($.includes("ENOENT")||$.includes("not found"))return{authenticated:!1,error:"gh CLI not installed. Install from https://cli.github.com/"};return{authenticated:!1,error:`Failed to verify gh CLI: ${$}`}}}async function d$(D){if(!/^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(D))return{accepted:!1,error:`Invalid repository format: ${D}`};let{stdout:F,exitCode:$,stderr:B}=await l(["gh","api","/user/repository_invitations"]);if($!==0){if(B.includes("not logged in")||B.includes("auth login"))return{accepted:!1,error:"gh CLI not authenticated. Run 'gh auth login' to authenticate."};if(B.includes("API rate limit")||B.includes("403"))return{accepted:!1,error:"GitHub API rate limit exceeded. Please try again in a few minutes."};if(B.includes("ENOENT")||B.includes("not found"))return{accepted:!1,error:"gh CLI not installed. Install from https://cli.github.com/"};return{accepted:!1,error:`Failed to list invitations: ${B.trim()||"unknown error"}`}}let J=null;try{J=JSON.parse(F||"[]").find((H)=>H.repository.full_name===D)?.id??null}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return console.error("Failed to parse GitHub invitations response:",G),console.error(" Raw response (first 500 chars):",(F||"").slice(0,500)),{accepted:!1,error:`Failed to parse GitHub API response: ${G}`}}if(!J){let{exitCode:Y}=await l(["gh","api",`/repos/${D}`,"--silent"]);if(Y===0)return{accepted:!0,alreadyCollaborator:!0};return{accepted:!1,error:`No pending invitation found for ${D}. You may need to accept it manually via GitHub.`}}let{exitCode:Q,stderr:X}=await l(["gh","api","--method","PATCH",`/user/repository_invitations/${J}`]);if(Q!==0)return{accepted:!1,error:`Failed to accept invitation: ${X.trim()||"unknown error"}`};return{accepted:!0}}async function p$(D,F,$="origin"){let B=F;if(process.env.GH_TOKEN&&F.startsWith("git@github.com:")){let J=process.env.GH_TOKEN.trim();if(!J||/\s/.test(J))return{success:!1,error:"GH_TOKEN environment variable is set but appears malformed (empty or contains whitespace)"};let Q=F.replace("git@github.com:","");B=`https://${J}@github.com/${Q}`}else if(F.startsWith("git@github.com:")){let J=F.replace("git@github.com:",""),Q=await fGD();if(Q.works)B=F;else{console.warn("GitHub SSH not available, falling back to HTTPS with gh CLI token...");let X=await gGD();if(X.token)B=`https://${X.token}@github.com/${J}`,console.warn("Note: using HTTPS with gh CLI token. If the token expires, re-run 'gh auth login'.");else return{success:!1,error:`GitHub authentication not configured.
119
+ `;return this.stop(),this.#Q.write(H),this}}function C(D){return new hj(D)}import{isDeepStrictEqual as Z2D}from"util";import zv from"process";import p6 from"fs";import Vv from"path";import V5 from"crypto";import A2D from"assert";var x6=(D)=>{let F=typeof D;return D!==null&&(F==="object"||F==="function")};var pX=new Set(["__proto__","prototype","constructor"]),C6D=new Set("0123456789");function w7(D){let F=[],$="",B="start",J=!1;for(let Q of D)switch(Q){case"\\":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd")throw Error("Invalid character after an index");if(J)$+=Q;B="property",J=!J;break}case".":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd"){B="property";break}if(J){J=!1,$+=Q;break}if(pX.has($))return[];F.push($),$="",B="property";break}case"[":{if(B==="index")throw Error("Invalid character in an index");if(B==="indexEnd"){B="index";break}if(J){J=!1,$+=Q;break}if(B==="property"){if(pX.has($))return[];F.push($),$=""}B="index";break}case"]":{if(B==="index"){F.push(Number.parseInt($,10)),$="",B="indexEnd";break}if(B==="indexEnd")throw Error("Invalid character after an index")}default:{if(B==="index"&&!C6D.has(Q))throw Error("Invalid character in an index");if(B==="indexEnd")throw Error("Invalid character after an index");if(B==="start")B="property";if(J)J=!1,$+="\\";$+=Q}}if(J)$+="\\";switch(B){case"property":{if(pX.has($))return[];F.push($);break}case"index":throw Error("Index was not closed");case"start":{F.push("");break}}return F}function cX(D,F){if(typeof F!=="number"&&Array.isArray(D)){let $=Number.parseInt(F,10);return Number.isInteger($)&&D[$]===D[F]}return!1}function bj(D,F){if(cX(D,F))throw Error("Cannot use string index")}function uj(D,F,$){if(!x6(D)||typeof F!=="string")return $===void 0?D:$;let B=w7(F);if(B.length===0)return $;for(let J=0;J<B.length;J++){let Q=B[J];if(cX(D,Q))D=J===B.length-1?void 0:null;else D=D[Q];if(D===void 0||D===null){if(J!==B.length-1)return $;break}}return D===void 0?$:D}function nX(D,F,$){if(!x6(D)||typeof F!=="string")return D;let B=D,J=w7(F);for(let Q=0;Q<J.length;Q++){let X=J[Q];if(bj(D,X),Q===J.length-1)D[X]=$;else if(!x6(D[X]))D[X]=typeof J[Q+1]==="number"?[]:{};D=D[X]}return B}function mj(D,F){if(!x6(D)||typeof F!=="string")return!1;let $=w7(F);for(let B=0;B<$.length;B++){let J=$[B];if(bj(D,J),B===$.length-1)return delete D[J],!0;if(D=D[J],!x6(D))return!1}}function lj(D,F){if(!x6(D)||typeof F!=="string")return!1;let $=w7(F);if($.length===0)return!1;for(let B of $){if(!x6(D)||!(B in D)||cX(D,B))return!1;D=D[B]}return!0}import fD from"path";import dj from"os";import iX from"process";var D6=dj.homedir(),aX=dj.tmpdir(),{env:e4}=iX,R6D=(D)=>{let F=fD.join(D6,"Library");return{data:fD.join(F,"Application Support",D),config:fD.join(F,"Preferences",D),cache:fD.join(F,"Caches",D),log:fD.join(F,"Logs",D),temp:fD.join(aX,D)}},j6D=(D)=>{let F=e4.APPDATA||fD.join(D6,"AppData","Roaming"),$=e4.LOCALAPPDATA||fD.join(D6,"AppData","Local");return{data:fD.join($,D,"Data"),config:fD.join(F,D,"Config"),cache:fD.join($,D,"Cache"),log:fD.join($,D,"Log"),temp:fD.join(aX,D)}},T6D=(D)=>{let F=fD.basename(D6);return{data:fD.join(e4.XDG_DATA_HOME||fD.join(D6,".local","share"),D),config:fD.join(e4.XDG_CONFIG_HOME||fD.join(D6,".config"),D),cache:fD.join(e4.XDG_CACHE_HOME||fD.join(D6,".cache"),D),log:fD.join(e4.XDG_STATE_HOME||fD.join(D6,".local","state"),D),temp:fD.join(aX,F,D)}};function oX(D,{suffix:F="nodejs"}={}){if(typeof D!=="string")throw TypeError(`Expected a string, got ${typeof D}`);if(F)D+=`-${F}`;if(iX.platform==="darwin")return R6D(D);if(iX.platform==="win32")return j6D(D);return T6D(D)}import y6D from"path";import VD from"fs";import{promisify as q0}from"util";var O6D=(D,F)=>{let{onError:$}=F;return function(...J){return D.apply(void 0,J).catch($)}},a1=O6D;var w6D=(D,F)=>{let{onError:$}=F;return function(...J){try{return D.apply(void 0,J)}catch(Q){return $(Q)}}},A1=w6D;var pj=250;var I6D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,X=J.interval??pj,Y=Date.now()+Q;return function G(...H){return D.apply(void 0,H).catch((q)=>{if(!$(q))throw q;if(Date.now()>=Y)throw q;let K=Math.round(X*Math.random());if(K>0)return new Promise((Z)=>setTimeout(Z,K)).then(()=>G.apply(void 0,H));else return G.apply(void 0,H)})}}},o1=I6D;var P6D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,X=Date.now()+Q;return function(...G){while(!0)try{return D.apply(void 0,G)}catch(H){if(!$(H))throw H;if(Date.now()>=X)throw H;continue}}}},s1=P6D;import nj from"process";var xF={isChangeErrorOk:(D)=>{if(!xF.isNodeError(D))return!1;let{code:F}=D;if(F==="ENOSYS")return!0;if(!cj&&(F==="EINVAL"||F==="EPERM"))return!0;return!1},isNodeError:(D)=>{return D instanceof Error},isRetriableError:(D)=>{if(!xF.isNodeError(D))return!1;let{code:F}=D;if(F==="EMFILE"||F==="ENFILE"||F==="EAGAIN"||F==="EBUSY"||F==="EACCESS"||F==="EACCES"||F==="EACCS"||F==="EPERM")return!0;return!1},onChangeError:(D)=>{if(!xF.isNodeError(D))throw D;if(xF.isChangeErrorOk(D))return;throw D}},sX=xF;var _F={onError:sX.onChangeError},P0={onError:()=>{return}},cj=nj.getuid?!nj.getuid():!1,J0={isRetriable:sX.isRetriableError};var S6D={attempt:{chmod:a1(q0(VD.chmod),_F),chown:a1(q0(VD.chown),_F),close:a1(q0(VD.close),P0),fsync:a1(q0(VD.fsync),P0),mkdir:a1(q0(VD.mkdir),P0),realpath:a1(q0(VD.realpath),P0),stat:a1(q0(VD.stat),P0),unlink:a1(q0(VD.unlink),P0),chmodSync:A1(VD.chmodSync,_F),chownSync:A1(VD.chownSync,_F),closeSync:A1(VD.closeSync,P0),existsSync:A1(VD.existsSync,P0),fsyncSync:A1(VD.fsync,P0),mkdirSync:A1(VD.mkdirSync,P0),realpathSync:A1(VD.realpathSync,P0),statSync:A1(VD.statSync,P0),unlinkSync:A1(VD.unlinkSync,P0)},retry:{close:o1(q0(VD.close),J0),fsync:o1(q0(VD.fsync),J0),open:o1(q0(VD.open),J0),readFile:o1(q0(VD.readFile),J0),rename:o1(q0(VD.rename),J0),stat:o1(q0(VD.stat),J0),write:o1(q0(VD.write),J0),writeFile:o1(q0(VD.writeFile),J0),closeSync:s1(VD.closeSync,J0),fsyncSync:s1(VD.fsyncSync,J0),openSync:s1(VD.openSync,J0),readFileSync:s1(VD.readFileSync,J0),renameSync:s1(VD.renameSync,J0),statSync:s1(VD.statSync,J0),writeSync:s1(VD.writeSync,J0),writeFileSync:s1(VD.writeFileSync,J0)}},rD=S6D;import _6 from"process";var ij="utf8",rX=438,aj=511;var oj={},sj=_6.geteuid?_6.geteuid():-1,rj=_6.getegid?_6.getegid():-1;var tj=1000,ej=!!_6.getuid,hUD=_6.getuid?!_6.getuid():!1,tX=128;var DT=(D)=>{return D instanceof Error&&"code"in D};var eX=(D)=>{return typeof D==="string"},I7=(D)=>{return D===void 0};import v6D from"path";import D3 from"process";import FT from"process";var $T=FT.platform==="linux",P7=FT.platform==="win32";var DY=["SIGHUP","SIGINT","SIGTERM"];if(!P7)DY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if($T)DY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var BT=DY;class JT{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(D)=>{if(this.exited)return;this.exited=!0;for(let F of this.callbacks)F();if(D)if(P7&&(D!=="SIGINT"&&D!=="SIGTERM"&&D!=="SIGKILL"))D3.kill(D3.pid,"SIGTERM");else D3.kill(D3.pid,D)},this.hook=()=>{D3.once("exit",()=>this.exit());for(let D of BT)try{D3.once(D,()=>this.exit(D))}catch{}},this.register=(D)=>{return this.callbacks.add(D),()=>{this.callbacks.delete(D)}},this.hook()}}var QT=new JT;var k6D=QT.register,XT=k6D;var m0={store:{},create:(D)=>{let F=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),$=Date.now().toString().slice(-10),B="tmp-",J=`.tmp-${$}${F}`;return`${D}${J}`},get:(D,F,$=!0)=>{let B=m0.truncate(F(D));if(B in m0.store)return m0.get(D,F,$);return m0.store[B]=$,[B,()=>delete m0.store[B]]},purge:(D)=>{if(!m0.store[D])return;delete m0.store[D],rD.attempt.unlink(D)},purgeSync:(D)=>{if(!m0.store[D])return;delete m0.store[D],rD.attempt.unlinkSync(D)},purgeSyncAll:()=>{for(let D in m0.store)m0.purgeSync(D)},truncate:(D)=>{let F=v6D.basename(D);if(F.length<=tX)return D;let $=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(F);if(!$)return D;let B=F.length-tX;return`${D.slice(0,-F.length)}${$[1]}${$[2].slice(0,-B)}${$[3]}`}};XT(m0.purgeSyncAll);var fF=m0;function FY(D,F,$=oj){if(eX($))return FY(D,F,{encoding:$});let J={timeout:$.timeout??tj},Q=null,X=null,Y=null;try{let G=rD.attempt.realpathSync(D),H=!!G;D=G||D,[X,Q]=fF.get(D,$.tmpCreate||fF.create,$.tmpPurge!==!1);let q=ej&&I7($.chown),K=I7($.mode);if(H&&(q||K)){let V=rD.attempt.statSync(D);if(V){if($={...$},q)$.chown={uid:V.uid,gid:V.gid};if(K)$.mode=V.mode}}if(!H){let V=y6D.dirname(D);rD.attempt.mkdirSync(V,{mode:aj,recursive:!0})}if(Y=rD.retry.openSync(J)(X,"w",$.mode||rX),$.tmpCreated)$.tmpCreated(X);if(eX(F))rD.retry.writeSync(J)(Y,F,0,$.encoding||ij);else if(!I7(F))rD.retry.writeSync(J)(Y,F,0,F.length,0);if($.fsync!==!1)if($.fsyncWait!==!1)rD.retry.fsyncSync(J)(Y);else rD.attempt.fsync(Y);if(rD.retry.closeSync(J)(Y),Y=null,$.chown&&($.chown.uid!==sj||$.chown.gid!==rj))rD.attempt.chownSync(X,$.chown.uid,$.chown.gid);if($.mode&&$.mode!==rX)rD.attempt.chmodSync(X,$.mode);try{rD.retry.renameSync(J)(X,D)}catch(V){if(!DT(V))throw V;if(V.code!=="ENAMETOOLONG")throw V;rD.retry.renameSync(J)(X,fF.truncate(D))}Q(),X=null}finally{if(Y)rD.attempt.closeSync(Y);if(X)fF.purge(X)}}var Av=n(tP(),1),Uv=n(MS(),1);var ZQD=(D,F={})=>{if(typeof D!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof D}\``);let{wait:$=0,maxWait:B=Number.POSITIVE_INFINITY,before:J=!1,after:Q=!0}=F;if($<0||B<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!J&&!Q)throw Error("Both `before` and `after` are false, function wouldn't be called.");let X,Y,G,H=function(...q){let K=this,V=()=>{if(X=void 0,Y)clearTimeout(Y),Y=void 0;if(Q)G=D.apply(K,q)},Z=()=>{if(Y=void 0,X)clearTimeout(X),X=void 0;if(Q)G=D.apply(K,q)},A=J&&!X;if(clearTimeout(X),X=setTimeout(V,$),B>0&&B!==Number.POSITIVE_INFINITY&&!Y)Y=setTimeout(Z,B);if(A)G=D.apply(K,q);return G};return SF(H,D),H.cancel=()=>{if(X)clearTimeout(X),X=void 0;if(Y)clearTimeout(Y),Y=void 0},H},Z2=ZQD;var c6=n(Wv(),1);var H2D=Object.prototype.toString;function Ev(D,F,$){if(!D)return!1;if(D.constructor===F)return!0;return H2D.call(D)===$}function Kv(D){return Ev(D,Uint8Array,"[object Uint8Array]")}function W2D(D){return Ev(D,ArrayBuffer,"[object ArrayBuffer]")}function q2D(D){return Kv(D)||W2D(D)}function E2D(D){if(!Kv(D))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof D}\``)}function K2D(D){if(!q2D(D))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof D}\``)}function v2(D,F){if(D.length===0)return new Uint8Array(0);F??=D.reduce((J,Q)=>J+Q.length,0);let $=new Uint8Array(F),B=0;for(let J of D)E2D(J),$.set(J,B),B+=J.length;return $}var qv={utf8:new globalThis.TextDecoder("utf8")};function y2(D,F="utf8"){return K2D(D),qv[F]??=new globalThis.TextDecoder(F),qv[F].decode(D)}function z2D(D){if(typeof D!=="string")throw TypeError(`Expected \`string\`, got \`${typeof D}\``)}var V2D=new globalThis.TextEncoder;function w$(D){return z2D(D),V2D.encode(D)}var jCD=Array.from({length:256},(D,F)=>F.toString(16).padStart(2,"0"));var U2D=Uv.default.default,Zv="aes-256-cbc",Z3=()=>Object.create(null),L2D=(D)=>D!==void 0&&D!==null,M2D=(D,F)=>{let $=new Set(["undefined","symbol","function"]),B=typeof F;if($.has(B))throw TypeError(`Setting a value of type \`${B}\` for key \`${D}\` is not allowed as it's not supported by JSON`)},I$="__internal__",x2=`${I$}.migrations.version`;class P${path;events;#$;#F;#D;#J={};constructor(D={}){let F={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...D};if(!F.cwd){if(!F.projectName)throw Error("Please specify the `projectName` option.");F.cwd=oX(F.projectName,{suffix:F.projectSuffix}).config}if(this.#D=F,F.schema??F.ajvOptions??F.rootSchema){if(F.schema&&typeof F.schema!=="object")throw TypeError("The `schema` option must be an object.");let Q=new Av.Ajv2020({allErrors:!0,useDefaults:!0,...F.ajvOptions});U2D(Q);let X={...F.rootSchema,type:"object",properties:F.schema};this.#$=Q.compile(X);for(let[Y,G]of Object.entries(F.schema??{}))if(G?.default)this.#J[Y]=G.default}if(F.defaults)this.#J={...this.#J,...F.defaults};if(F.serialize)this._serialize=F.serialize;if(F.deserialize)this._deserialize=F.deserialize;this.events=new EventTarget,this.#F=F.encryptionKey;let $=F.fileExtension?`.${F.fileExtension}`:"";this.path=Vv.resolve(F.cwd,`${F.configName??"config"}${$}`);let B=this.store,J=Object.assign(Z3(),F.defaults,B);if(F.migrations){if(!F.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(F.migrations,F.projectVersion,F.beforeEachMigration)}this._validate(J);try{A2D.deepEqual(B,J)}catch{this.store=J}if(F.watch)this._watch()}get(D,F){if(this.#D.accessPropertiesByDotNotation)return this._get(D,F);let{store:$}=this;return D in $?$[D]:F}set(D,F){if(typeof D!=="string"&&typeof D!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof D}`);if(typeof D!=="object"&&F===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(D))throw TypeError(`Please don't use the ${I$} key, as it's used to manage this module internal operations.`);let{store:$}=this,B=(J,Q)=>{if(M2D(J,Q),this.#D.accessPropertiesByDotNotation)nX($,J,Q);else $[J]=Q};if(typeof D==="object"){let J=D;for(let[Q,X]of Object.entries(J))B(Q,X)}else B(D,F);this.store=$}has(D){if(this.#D.accessPropertiesByDotNotation)return lj(this.store,D);return D in this.store}reset(...D){for(let F of D)if(L2D(this.#J[F]))this.set(F,this.#J[F])}delete(D){let{store:F}=this;if(this.#D.accessPropertiesByDotNotation)mj(F,D);else delete F[D];this.store=F}clear(){this.store=Z3();for(let D of Object.keys(this.#J))this.reset(D)}onDidChange(D,F){if(typeof D!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof D}`);if(typeof F!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof F}`);return this._handleChange(()=>this.get(D),F)}onDidAnyChange(D){if(typeof D!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof D}`);return this._handleChange(()=>this.store,D)}get size(){return Object.keys(this.store).length}get store(){try{let D=p6.readFileSync(this.path,this.#F?null:"utf8"),F=this._encryptData(D),$=this._deserialize(F);return this._validate($),Object.assign(Z3(),$)}catch(D){if(D?.code==="ENOENT")return this._ensureDirectory(),Z3();if(this.#D.clearInvalidConfig&&D.name==="SyntaxError")return Z3();throw D}}set store(D){this._ensureDirectory(),this._validate(D),this._write(D),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[D,F]of Object.entries(this.store))yield[D,F]}_encryptData(D){if(!this.#F)return typeof D==="string"?D:y2(D);try{let F=D.slice(0,16),$=V5.pbkdf2Sync(this.#F,F.toString(),1e4,32,"sha512"),B=V5.createDecipheriv(Zv,$,F),J=D.slice(17),Q=typeof J==="string"?w$(J):J;return y2(v2([B.update(Q),B.final()]))}catch{}return D.toString()}_handleChange(D,F){let $=D(),B=()=>{let J=$,Q=D();if(Z2D(Q,J))return;$=Q,F.call(this,Q,J)};return this.events.addEventListener("change",B),()=>{this.events.removeEventListener("change",B)}}_deserialize=(D)=>JSON.parse(D);_serialize=(D)=>JSON.stringify(D,void 0,"\t");_validate(D){if(!this.#$)return;if(this.#$(D)||!this.#$.errors)return;let $=this.#$.errors.map(({instancePath:B,message:J=""})=>`\`${B.slice(1)}\` ${J}`);throw Error("Config schema violation: "+$.join("; "))}_ensureDirectory(){p6.mkdirSync(Vv.dirname(this.path),{recursive:!0})}_write(D){let F=this._serialize(D);if(this.#F){let $=V5.randomBytes(16),B=V5.pbkdf2Sync(this.#F,$.toString(),1e4,32,"sha512"),J=V5.createCipheriv(Zv,B,$);F=v2([$,w$(":"),J.update(w$(F)),J.final()])}if(zv.env.SNAP)p6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});else try{FY(this.path,F,{mode:this.#D.configFileMode})}catch($){if($?.code==="EXDEV"){p6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});return}throw $}}_watch(){if(this._ensureDirectory(),!p6.existsSync(this.path))this._write(Z3());if(zv.platform==="win32")p6.watch(this.path,{persistent:!1},Z2(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else p6.watchFile(this.path,{persistent:!1},Z2(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(D,F,$){let B=this._get(x2,"0.0.0"),J=Object.keys(D).filter((X)=>this._shouldPerformMigration(X,B,F)),Q={...this.store};for(let X of J)try{if($)$(this,{fromVersion:B,toVersion:X,finalVersion:F,versions:J});let Y=D[X];Y?.(this),this._set(x2,X),B=X,Q={...this.store}}catch(Y){throw this.store=Q,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${Y}`)}if(this._isVersionInRangeFormat(B)||!c6.default.eq(B,F))this._set(x2,F)}_containsReservedKey(D){if(typeof D==="object"){if(Object.keys(D)[0]===I$)return!0}if(typeof D!=="string")return!1;if(this.#D.accessPropertiesByDotNotation){if(D.startsWith(`${I$}.`))return!0;return!1}return!1}_isVersionInRangeFormat(D){return c6.default.clean(D)===null}_shouldPerformMigration(D,F,$){if(this._isVersionInRangeFormat(D)){if(F!=="0.0.0"&&c6.default.satisfies(F,D))return!1;return c6.default.satisfies($,D)}if(c6.default.lte(D,F))return!1;if(c6.default.gt(D,$))return!1;return!0}_get(D,F){return uj(this.store,D,F)}_set(D,F){let{store:$}=this;nX($,D,F),this.store=$}}var S1={};QG(S1,{void:()=>JGD,util:()=>YD,unknown:()=>$GD,union:()=>GGD,undefined:()=>e2D,tuple:()=>qGD,transformer:()=>NGD,symbol:()=>t2D,string:()=>wv,strictObject:()=>YGD,setErrorMap:()=>R2D,set:()=>zGD,record:()=>EGD,quotelessJson:()=>N2D,promise:()=>MGD,preprocess:()=>jGD,pipeline:()=>TGD,ostring:()=>OGD,optional:()=>CGD,onumber:()=>wGD,oboolean:()=>IGD,objectUtil:()=>_2,object:()=>XGD,number:()=>Iv,nullable:()=>RGD,null:()=>DGD,never:()=>BGD,nativeEnum:()=>LGD,nan:()=>o2D,map:()=>KGD,makeIssue:()=>Z5,literal:()=>AGD,lazy:()=>ZGD,late:()=>i2D,isValid:()=>H6,isDirty:()=>k$,isAsync:()=>U3,isAborted:()=>S$,intersection:()=>WGD,instanceof:()=>a2D,getParsedType:()=>F8,getErrorMap:()=>A3,function:()=>VGD,enum:()=>UGD,effect:()=>NGD,discriminatedUnion:()=>HGD,defaultErrorMap:()=>L8,datetimeRegex:()=>jv,date:()=>r2D,custom:()=>Ov,coerce:()=>PGD,boolean:()=>Pv,bigint:()=>s2D,array:()=>QGD,any:()=>FGD,addIssueToContext:()=>P,ZodVoid:()=>U5,ZodUnknown:()=>W6,ZodUnion:()=>j3,ZodUndefined:()=>C3,ZodType:()=>$D,ZodTuple:()=>B8,ZodTransformer:()=>P1,ZodSymbol:()=>A5,ZodString:()=>T1,ZodSet:()=>o6,ZodSchema:()=>$D,ZodRecord:()=>L5,ZodReadonly:()=>k3,ZodPromise:()=>s6,ZodPipeline:()=>C5,ZodParsedType:()=>T,ZodOptional:()=>w1,ZodObject:()=>gD,ZodNumber:()=>q6,ZodNullable:()=>N8,ZodNull:()=>R3,ZodNever:()=>$8,ZodNativeEnum:()=>I3,ZodNaN:()=>N5,ZodMap:()=>M5,ZodLiteral:()=>w3,ZodLazy:()=>O3,ZodIssueCode:()=>R,ZodIntersection:()=>T3,ZodFunction:()=>M3,ZodFirstPartyTypeKind:()=>m,ZodError:()=>_0,ZodEnum:()=>K6,ZodEffects:()=>P1,ZodDiscriminatedUnion:()=>v$,ZodDefault:()=>P3,ZodDate:()=>i6,ZodCatch:()=>S3,ZodBranded:()=>y$,ZodBoolean:()=>N3,ZodBigInt:()=>E6,ZodArray:()=>O1,ZodAny:()=>a6,Schema:()=>$D,ParseStatus:()=>X0,OK:()=>V0,NEVER:()=>SGD,INVALID:()=>b,EMPTY_PATH:()=>j2D,DIRTY:()=>n6,BRAND:()=>n2D});var YD;(function(D){D.assertEqual=(J)=>{};function F(J){}D.assertIs=F;function $(J){throw Error()}D.assertNever=$,D.arrayToEnum=(J)=>{let Q={};for(let X of J)Q[X]=X;return Q},D.getValidEnumValues=(J)=>{let Q=D.objectKeys(J).filter((Y)=>typeof J[J[Y]]!=="number"),X={};for(let Y of Q)X[Y]=J[Y];return D.objectValues(X)},D.objectValues=(J)=>{return D.objectKeys(J).map(function(Q){return J[Q]})},D.objectKeys=typeof Object.keys==="function"?(J)=>Object.keys(J):(J)=>{let Q=[];for(let X in J)if(Object.prototype.hasOwnProperty.call(J,X))Q.push(X);return Q},D.find=(J,Q)=>{for(let X of J)if(Q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(J)=>Number.isInteger(J):(J)=>typeof J==="number"&&Number.isFinite(J)&&Math.floor(J)===J;function B(J,Q=" | "){return J.map((X)=>typeof X==="string"?`'${X}'`:X).join(Q)}D.joinValues=B,D.jsonStringifyReplacer=(J,Q)=>{if(typeof Q==="bigint")return Q.toString();return Q}})(YD||(YD={}));var _2;(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(_2||(_2={}));var T=YD.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),F8=(D)=>{switch(typeof D){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(D)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":if(Array.isArray(D))return T.array;if(D===null)return T.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return T.promise;if(typeof Map<"u"&&D instanceof Map)return T.map;if(typeof Set<"u"&&D instanceof Set)return T.set;if(typeof Date<"u"&&D instanceof Date)return T.date;return T.object;default:return T.unknown}};var R=YD.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N2D=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class _0 extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function(J){return J.message},$={_errors:[]},B=(J)=>{for(let Q of J.issues)if(Q.code==="invalid_union")Q.unionErrors.map(B);else if(Q.code==="invalid_return_type")B(Q.returnTypeError);else if(Q.code==="invalid_arguments")B(Q.argumentsError);else if(Q.path.length===0)$._errors.push(F(Q));else{let X=$,Y=0;while(Y<Q.path.length){let G=Q.path[Y];if(Y!==Q.path.length-1)X[G]=X[G]||{_errors:[]};else X[G]=X[G]||{_errors:[]},X[G]._errors.push(F(Q));X=X[G],Y++}}};return B(this),$}static assert(D){if(!(D instanceof _0))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,YD.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},$=[];for(let B of this.issues)if(B.path.length>0){let J=B.path[0];F[J]=F[J]||[],F[J].push(D(B))}else $.push(D(B));return{formErrors:$,fieldErrors:F}}get formErrors(){return this.flatten()}}_0.create=(D)=>{return new _0(D)};var C2D=(D,F)=>{let $;switch(D.code){case R.invalid_type:if(D.received===T.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case R.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,YD.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:$=`Unrecognized key(s) in object: ${YD.joinValues(D.keys,", ")}`;break;case R.invalid_union:$="Invalid input";break;case R.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${YD.joinValues(D.options)}`;break;case R.invalid_enum_value:$=`Invalid enum value. Expected ${YD.joinValues(D.options)}, received '${D.received}'`;break;case R.invalid_arguments:$="Invalid function arguments";break;case R.invalid_return_type:$="Invalid function return type";break;case R.invalid_date:$="Invalid date";break;case R.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if($=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)$=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)$=`Invalid input: must end with "${D.validation.endsWith}"`;else YD.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case R.too_small:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")$=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else $="Invalid input";break;case R.too_big:if(D.type==="array")$=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")$=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")$=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")$=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")$=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else $="Invalid input";break;case R.custom:$="Invalid input";break;case R.invalid_intersection_types:$="Intersection results could not be merged";break;case R.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case R.not_finite:$="Number must be finite";break;default:$=F.defaultError,YD.assertNever(D)}return{message:$}},L8=C2D;var Lv=L8;function R2D(D){Lv=D}function A3(){return Lv}var Z5=(D)=>{let{data:F,path:$,errorMaps:B,issueData:J}=D,Q=[...$,...J.path||[]],X={...J,path:Q};if(J.message!==void 0)return{...J,path:Q,message:J.message};let Y="",G=B.filter((H)=>!!H).slice().reverse();for(let H of G)Y=H(X,{data:F,defaultError:Y}).message;return{...J,path:Q,message:Y}},j2D=[];function P(D,F){let $=A3(),B=Z5({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===L8?void 0:L8].filter((J)=>!!J)});D.common.issues.push(B)}class X0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let $=[];for(let B of F){if(B.status==="aborted")return b;if(B.status==="dirty")D.dirty();$.push(B.value)}return{status:D.value,value:$}}static async mergeObjectAsync(D,F){let $=[];for(let B of F){let J=await B.key,Q=await B.value;$.push({key:J,value:Q})}return X0.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let B of F){let{key:J,value:Q}=B;if(J.status==="aborted")return b;if(Q.status==="aborted")return b;if(J.status==="dirty")D.dirty();if(Q.status==="dirty")D.dirty();if(J.value!=="__proto__"&&(typeof Q.value<"u"||B.alwaysSet))$[J.value]=Q.value}return{status:D.value,value:$}}}var b=Object.freeze({status:"aborted"}),n6=(D)=>({status:"dirty",value:D}),V0=(D)=>({status:"valid",value:D}),S$=(D)=>D.status==="aborted",k$=(D)=>D.status==="dirty",H6=(D)=>D.status==="valid",U3=(D)=>typeof Promise<"u"&&D instanceof Promise;var _;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(_||(_={}));class I1{constructor(D,F,$,B){this._cachedPath=[],this.parent=D,this.data=F,this._path=$,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Mv=(D,F)=>{if(H6(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let $=new _0(D.common.issues);return this._error=$,this._error}}}};function e(D){if(!D)return{};let{errorMap:F,invalid_type_error:$,required_error:B,description:J}=D;if(F&&($||B))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:J};return{errorMap:(X,Y)=>{let{message:G}=D;if(X.code==="invalid_enum_value")return{message:G??Y.defaultError};if(typeof Y.data>"u")return{message:G??B??Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:G??$??Y.defaultError}},description:J}}class $D{get description(){return this._def.description}_getType(D){return F8(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:F8(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new X0,ctx:{common:D.parent.common,data:D.data,parsedType:F8(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(U3(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let $=this.safeParse(D,F);if($.success)return $.data;throw $.error}safeParse(D,F){let $={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)},B=this._parseSync({data:D,path:$.path,parent:$});return Mv($,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return H6($)?{value:$.value}:{issues:F.common.issues}}catch($){if($?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then(($)=>H6($)?{value:$.value}:{issues:F.common.issues})}async parseAsync(D,F){let $=await this.safeParseAsync(D,F);if($.success)return $.data;throw $.error}async safeParseAsync(D,F){let $={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:F8(D)},B=this._parse({data:D,path:$.path,parent:$}),J=await(U3(B)?B:Promise.resolve(B));return Mv($,J)}refine(D,F){let $=(B)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(B);else return F};return this._refinement((B,J)=>{let Q=D(B),X=()=>J.addIssue({code:R.custom,...$(B)});if(typeof Promise<"u"&&Q instanceof Promise)return Q.then((Y)=>{if(!Y)return X(),!1;else return!0});if(!Q)return X(),!1;else return!0})}refinement(D,F){return this._refinement(($,B)=>{if(!D($))return B.addIssue(typeof F==="function"?F($,B):F),!1;else return!0})}_refinement(D){return new P1({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(F)=>this["~validate"](F)}}optional(){return w1.create(this,this._def)}nullable(){return N8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return O1.create(this)}promise(){return s6.create(this,this._def)}or(D){return j3.create([this,D],this._def)}and(D){return T3.create(this,D,this._def)}transform(D){return new P1({...e(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new P3({...e(this._def),innerType:this,defaultValue:F,typeName:m.ZodDefault})}brand(){return new y$({typeName:m.ZodBranded,type:this,...e(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new S3({...e(this._def),innerType:this,catchValue:F,typeName:m.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return C5.create(this,D)}readonly(){return k3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var T2D=/^c[^\s-]{8,}$/i,O2D=/^[0-9a-z]+$/,w2D=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I2D=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,P2D=/^[a-z0-9_-]{21}$/i,S2D=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k2D=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,v2D=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,y2D="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",f2,x2D=/^(?:(?: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])$/,_2D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,f2D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,g2D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h2D=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,b2D=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cv="((\\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])))",u2D=new RegExp(`^${Cv}$`);function Rv(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let $=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${$}`}function m2D(D){return new RegExp(`^${Rv(D)}$`)}function jv(D){let F=`${Cv}T${Rv(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function l2D(D,F){if((F==="v4"||!F)&&x2D.test(D))return!0;if((F==="v6"||!F)&&f2D.test(D))return!0;return!1}function d2D(D,F){if(!S2D.test(D))return!1;try{let[$]=D.split(".");if(!$)return!1;let B=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),J=JSON.parse(atob(B));if(typeof J!=="object"||J===null)return!1;if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(F&&J.alg!==F)return!1;return!0}catch{return!1}}function p2D(D,F){if((F==="v4"||!F)&&_2D.test(D))return!0;if((F==="v6"||!F)&&g2D.test(D))return!0;return!1}class T1 extends $D{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==T.string){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.string,received:J.parsedType}),b}let $=new X0,B=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(D.data.length<J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),$.dirty()}else if(J.kind==="max"){if(D.data.length>J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),$.dirty()}else if(J.kind==="length"){let Q=D.data.length>J.value,X=D.data.length<J.value;if(Q||X){if(B=this._getOrReturnCtx(D,B),Q)P(B,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(X)P(B,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});$.dirty()}}else if(J.kind==="email"){if(!v2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"email",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="emoji"){if(!f2)f2=new RegExp(y2D,"u");if(!f2.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"emoji",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="uuid"){if(!I2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"uuid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="nanoid"){if(!P2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"nanoid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid"){if(!T2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"cuid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid2"){if(!O2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"cuid2",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ulid"){if(!w2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"ulid",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),P(B,{validation:"url",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="regex"){if(J.regex.lastIndex=0,!J.regex.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"regex",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="trim")D.data=D.data.trim();else if(J.kind==="includes"){if(!D.data.includes(J.value,J.position))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{includes:J.value,position:J.position},message:J.message}),$.dirty()}else if(J.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(J.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(J.kind==="startsWith"){if(!D.data.startsWith(J.value))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{startsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="endsWith"){if(!D.data.endsWith(J.value))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:{endsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="datetime"){if(!jv(J).test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"datetime",message:J.message}),$.dirty()}else if(J.kind==="date"){if(!u2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"date",message:J.message}),$.dirty()}else if(J.kind==="time"){if(!m2D(J).test(D.data))B=this._getOrReturnCtx(D,B),P(B,{code:R.invalid_string,validation:"time",message:J.message}),$.dirty()}else if(J.kind==="duration"){if(!k2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"duration",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ip"){if(!l2D(D.data,J.version))B=this._getOrReturnCtx(D,B),P(B,{validation:"ip",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="jwt"){if(!d2D(D.data,J.alg))B=this._getOrReturnCtx(D,B),P(B,{validation:"jwt",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cidr"){if(!p2D(D.data,J.version))B=this._getOrReturnCtx(D,B),P(B,{validation:"cidr",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64"){if(!h2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"base64",code:R.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64url"){if(!b2D.test(D.data))B=this._getOrReturnCtx(D,B),P(B,{validation:"base64url",code:R.invalid_string,message:J.message}),$.dirty()}else YD.assertNever(J);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((B)=>D.test(B),{validation:F,code:R.invalid_string,..._.errToObj($)})}_addCheck(D){return new T1({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",..._.errToObj(D)})}url(D){return this._addCheck({kind:"url",..._.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",..._.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",..._.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",..._.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",..._.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",..._.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",..._.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",..._.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",..._.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",..._.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",..._.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",..._.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,..._.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,..._.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",..._.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,..._.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,..._.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,..._.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,..._.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,..._.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,..._.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,..._.errToObj(F)})}nonempty(D){return this.min(1,_.errToObj(D))}trim(){return new T1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new T1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new T1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}T1.create=(D)=>{return new T1({checks:[],typeName:m.ZodString,coerce:D?.coerce??!1,...e(D)})};function c2D(D,F){let $=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,J=$>B?$:B,Q=Number.parseInt(D.toFixed(J).replace(".","")),X=Number.parseInt(F.toFixed(J).replace(".",""));return Q%X/10**J}class q6 extends $D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==T.number){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.number,received:J.parsedType}),b}let $=void 0,B=new X0;for(let J of this._def.checks)if(J.kind==="int"){if(!YD.isInteger(D.data))$=this._getOrReturnCtx(D,$),P($,{code:R.invalid_type,expected:"integer",received:"float",message:J.message}),B.dirty()}else if(J.kind==="min"){if(J.inclusive?D.data<J.value:D.data<=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_small,minimum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="max"){if(J.inclusive?D.data>J.value:D.data>=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(c2D(D.data,J.value)!==0)$=this._getOrReturnCtx(D,$),P($,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else if(J.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),P($,{code:R.not_finite,message:J.message}),B.dirty()}else YD.assertNever(J);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,_.toString(F))}gt(D,F){return this.setLimit("min",D,!1,_.toString(F))}lte(D,F){return this.setLimit("max",D,!0,_.toString(F))}lt(D,F){return this.setLimit("max",D,!1,_.toString(F))}setLimit(D,F,$,B){return new q6({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:_.toString(B)}]})}_addCheck(D){return new q6({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:_.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:_.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:_.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&YD.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(F===null||$.value>F)F=$.value}else if($.kind==="max"){if(D===null||$.value<D)D=$.value}return Number.isFinite(F)&&Number.isFinite(D)}}q6.create=(D)=>{return new q6({checks:[],typeName:m.ZodNumber,coerce:D?.coerce||!1,...e(D)})};class E6 extends $D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==T.bigint)return this._getInvalidInput(D);let $=void 0,B=new X0;for(let J of this._def.checks)if(J.kind==="min"){if(J.inclusive?D.data<J.value:D.data<=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_small,type:"bigint",minimum:J.value,inclusive:J.inclusive,message:J.message}),B.dirty()}else if(J.kind==="max"){if(J.inclusive?D.data>J.value:D.data>=J.value)$=this._getOrReturnCtx(D,$),P($,{code:R.too_big,type:"bigint",maximum:J.value,inclusive:J.inclusive,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(D.data%J.value!==BigInt(0))$=this._getOrReturnCtx(D,$),P($,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else YD.assertNever(J);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return P(F,{code:R.invalid_type,expected:T.bigint,received:F.parsedType}),b}gte(D,F){return this.setLimit("min",D,!0,_.toString(F))}gt(D,F){return this.setLimit("min",D,!1,_.toString(F))}lte(D,F){return this.setLimit("max",D,!0,_.toString(F))}lt(D,F){return this.setLimit("max",D,!1,_.toString(F))}setLimit(D,F,$,B){return new E6({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:_.toString(B)}]})}_addCheck(D){return new E6({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:_.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}E6.create=(D)=>{return new E6({checks:[],typeName:m.ZodBigInt,coerce:D?.coerce??!1,...e(D)})};class N3 extends $D{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==T.boolean){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.boolean,received:$.parsedType}),b}return V0(D.data)}}N3.create=(D)=>{return new N3({typeName:m.ZodBoolean,coerce:D?.coerce||!1,...e(D)})};class i6 extends $D{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==T.date){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_type,expected:T.date,received:J.parsedType}),b}if(Number.isNaN(D.data.getTime())){let J=this._getOrReturnCtx(D);return P(J,{code:R.invalid_date}),b}let $=new X0,B=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(D.data.getTime()<J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_small,message:J.message,inclusive:!0,exact:!1,minimum:J.value,type:"date"}),$.dirty()}else if(J.kind==="max"){if(D.data.getTime()>J.value)B=this._getOrReturnCtx(D,B),P(B,{code:R.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),$.dirty()}else YD.assertNever(J);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new i6({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:_.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:_.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}}i6.create=(D)=>{return new i6({checks:[],coerce:D?.coerce||!1,typeName:m.ZodDate,...e(D)})};class A5 extends $D{_parse(D){if(this._getType(D)!==T.symbol){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.symbol,received:$.parsedType}),b}return V0(D.data)}}A5.create=(D)=>{return new A5({typeName:m.ZodSymbol,...e(D)})};class C3 extends $D{_parse(D){if(this._getType(D)!==T.undefined){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.undefined,received:$.parsedType}),b}return V0(D.data)}}C3.create=(D)=>{return new C3({typeName:m.ZodUndefined,...e(D)})};class R3 extends $D{_parse(D){if(this._getType(D)!==T.null){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.null,received:$.parsedType}),b}return V0(D.data)}}R3.create=(D)=>{return new R3({typeName:m.ZodNull,...e(D)})};class a6 extends $D{constructor(){super(...arguments);this._any=!0}_parse(D){return V0(D.data)}}a6.create=(D)=>{return new a6({typeName:m.ZodAny,...e(D)})};class W6 extends $D{constructor(){super(...arguments);this._unknown=!0}_parse(D){return V0(D.data)}}W6.create=(D)=>{return new W6({typeName:m.ZodUnknown,...e(D)})};class $8 extends $D{_parse(D){let F=this._getOrReturnCtx(D);return P(F,{code:R.invalid_type,expected:T.never,received:F.parsedType}),b}}$8.create=(D)=>{return new $8({typeName:m.ZodNever,...e(D)})};class U5 extends $D{_parse(D){if(this._getType(D)!==T.undefined){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.void,received:$.parsedType}),b}return V0(D.data)}}U5.create=(D)=>{return new U5({typeName:m.ZodVoid,...e(D)})};class O1 extends $D{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),B=this._def;if(F.parsedType!==T.array)return P(F,{code:R.invalid_type,expected:T.array,received:F.parsedType}),b;if(B.exactLength!==null){let Q=F.data.length>B.exactLength.value,X=F.data.length<B.exactLength.value;if(Q||X)P(F,{code:Q?R.too_big:R.too_small,minimum:X?B.exactLength.value:void 0,maximum:Q?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),$.dirty()}if(B.minLength!==null){if(F.data.length<B.minLength.value)P(F,{code:R.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),$.dirty()}if(B.maxLength!==null){if(F.data.length>B.maxLength.value)P(F,{code:R.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),$.dirty()}if(F.common.async)return Promise.all([...F.data].map((Q,X)=>{return B.type._parseAsync(new I1(F,Q,F.path,X))})).then((Q)=>{return X0.mergeArray($,Q)});let J=[...F.data].map((Q,X)=>{return B.type._parseSync(new I1(F,Q,F.path,X))});return X0.mergeArray($,J)}get element(){return this._def.type}min(D,F){return new O1({...this._def,minLength:{value:D,message:_.toString(F)}})}max(D,F){return new O1({...this._def,maxLength:{value:D,message:_.toString(F)}})}length(D,F){return new O1({...this._def,exactLength:{value:D,message:_.toString(F)}})}nonempty(D){return this.min(1,D)}}O1.create=(D,F)=>{return new O1({type:D,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...e(F)})};function L3(D){if(D instanceof gD){let F={};for(let $ in D.shape){let B=D.shape[$];F[$]=w1.create(L3(B))}return new gD({...D._def,shape:()=>F})}else if(D instanceof O1)return new O1({...D._def,type:L3(D.element)});else if(D instanceof w1)return w1.create(L3(D.unwrap()));else if(D instanceof N8)return N8.create(L3(D.unwrap()));else if(D instanceof B8)return B8.create(D.items.map((F)=>L3(F)));else return D}class gD extends $D{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=YD.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==T.object){let G=this._getOrReturnCtx(D);return P(G,{code:R.invalid_type,expected:T.object,received:G.parsedType}),b}let{status:$,ctx:B}=this._processInputParams(D),{shape:J,keys:Q}=this._getCached(),X=[];if(!(this._def.catchall instanceof $8&&this._def.unknownKeys==="strip")){for(let G in B.data)if(!Q.includes(G))X.push(G)}let Y=[];for(let G of Q){let H=J[G],q=B.data[G];Y.push({key:{status:"valid",value:G},value:H._parse(new I1(B,q,B.path,G)),alwaysSet:G in B.data})}if(this._def.catchall instanceof $8){let G=this._def.unknownKeys;if(G==="passthrough")for(let H of X)Y.push({key:{status:"valid",value:H},value:{status:"valid",value:B.data[H]}});else if(G==="strict"){if(X.length>0)P(B,{code:R.unrecognized_keys,keys:X}),$.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let H of X){let q=B.data[H];Y.push({key:{status:"valid",value:H},value:G._parse(new I1(B,q,B.path,H)),alwaysSet:H in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let G=[];for(let H of Y){let q=await H.key,K=await H.value;G.push({key:q,value:K,alwaysSet:H.alwaysSet})}return G}).then((G)=>{return X0.mergeObjectSync($,G)});else return X0.mergeObjectSync($,Y)}get shape(){return this._def.shape()}strict(D){return _.errToObj,new gD({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let B=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:_.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new gD({...this._def,unknownKeys:"strip"})}passthrough(){return new gD({...this._def,unknownKeys:"passthrough"})}extend(D){return new gD({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new gD({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:m.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new gD({...this._def,catchall:D})}pick(D){let F={};for(let $ of YD.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new gD({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of YD.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new gD({...this._def,shape:()=>F})}deepPartial(){return L3(this)}partial(D){let F={};for(let $ of YD.objectKeys(this.shape)){let B=this.shape[$];if(D&&!D[$])F[$]=B;else F[$]=B.optional()}return new gD({...this._def,shape:()=>F})}required(D){let F={};for(let $ of YD.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let J=this.shape[$];while(J instanceof w1)J=J._def.innerType;F[$]=J}return new gD({...this._def,shape:()=>F})}keyof(){return Tv(YD.objectKeys(this.shape))}}gD.create=(D,F)=>{return new gD({shape:()=>D,unknownKeys:"strip",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};gD.strictCreate=(D,F)=>{return new gD({shape:()=>D,unknownKeys:"strict",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};gD.lazycreate=(D,F)=>{return new gD({shape:D,unknownKeys:"strip",catchall:$8.create(),typeName:m.ZodObject,...e(F)})};class j3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function B(J){for(let X of J)if(X.result.status==="valid")return X.result;for(let X of J)if(X.result.status==="dirty")return F.common.issues.push(...X.ctx.common.issues),X.result;let Q=J.map((X)=>new _0(X.ctx.common.issues));return P(F,{code:R.invalid_union,unionErrors:Q}),b}if(F.common.async)return Promise.all($.map(async(J)=>{let Q={...F,common:{...F.common,issues:[]},parent:null};return{result:await J._parseAsync({data:F.data,path:F.path,parent:Q}),ctx:Q}})).then(B);else{let J=void 0,Q=[];for(let Y of $){let G={...F,common:{...F.common,issues:[]},parent:null},H=Y._parseSync({data:F.data,path:F.path,parent:G});if(H.status==="valid")return H;else if(H.status==="dirty"&&!J)J={result:H,ctx:G};if(G.common.issues.length)Q.push(G.common.issues)}if(J)return F.common.issues.push(...J.ctx.common.issues),J.result;let X=Q.map((Y)=>new _0(Y));return P(F,{code:R.invalid_union,unionErrors:X}),b}}get options(){return this._def.options}}j3.create=(D,F)=>{return new j3({options:D,typeName:m.ZodUnion,...e(F)})};var M8=(D)=>{if(D instanceof O3)return M8(D.schema);else if(D instanceof P1)return M8(D.innerType());else if(D instanceof w3)return[D.value];else if(D instanceof K6)return D.options;else if(D instanceof I3)return YD.objectValues(D.enum);else if(D instanceof P3)return M8(D._def.innerType);else if(D instanceof C3)return[void 0];else if(D instanceof R3)return[null];else if(D instanceof w1)return[void 0,...M8(D.unwrap())];else if(D instanceof N8)return[null,...M8(D.unwrap())];else if(D instanceof y$)return M8(D.unwrap());else if(D instanceof k3)return M8(D.unwrap());else if(D instanceof S3)return M8(D._def.innerType);else return[]};class v$ extends $D{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.object)return P(F,{code:R.invalid_type,expected:T.object,received:F.parsedType}),b;let $=this.discriminator,B=F.data[$],J=this.optionsMap.get(B);if(!J)return P(F,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),b;if(F.common.async)return J._parseAsync({data:F.data,path:F.path,parent:F});else return J._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,$){let B=new Map;for(let J of F){let Q=M8(J.shape[D]);if(!Q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of Q){if(B.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,J)}}return new v$({typeName:m.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...e($)})}}function g2(D,F){let $=F8(D),B=F8(F);if(D===F)return{valid:!0,data:D};else if($===T.object&&B===T.object){let J=YD.objectKeys(F),Q=YD.objectKeys(D).filter((Y)=>J.indexOf(Y)!==-1),X={...D,...F};for(let Y of Q){let G=g2(D[Y],F[Y]);if(!G.valid)return{valid:!1};X[Y]=G.data}return{valid:!0,data:X}}else if($===T.array&&B===T.array){if(D.length!==F.length)return{valid:!1};let J=[];for(let Q=0;Q<D.length;Q++){let X=D[Q],Y=F[Q],G=g2(X,Y);if(!G.valid)return{valid:!1};J.push(G.data)}return{valid:!0,data:J}}else if($===T.date&&B===T.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class T3 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=(J,Q)=>{if(S$(J)||S$(Q))return b;let X=g2(J.value,Q.value);if(!X.valid)return P($,{code:R.invalid_intersection_types}),b;if(k$(J)||k$(Q))F.dirty();return{status:F.value,value:X.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([J,Q])=>B(J,Q));else return B(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}}T3.create=(D,F,$)=>{return new T3({left:D,right:F,typeName:m.ZodIntersection,...e($)})};class B8 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.array)return P($,{code:R.invalid_type,expected:T.array,received:$.parsedType}),b;if($.data.length<this._def.items.length)return P($,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&$.data.length>this._def.items.length)P($,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let J=[...$.data].map((Q,X)=>{let Y=this._def.items[X]||this._def.rest;if(!Y)return null;return Y._parse(new I1($,Q,$.path,X))}).filter((Q)=>!!Q);if($.common.async)return Promise.all(J).then((Q)=>{return X0.mergeArray(F,Q)});else return X0.mergeArray(F,J)}get items(){return this._def.items}rest(D){return new B8({...this._def,rest:D})}}B8.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new B8({items:D,typeName:m.ZodTuple,rest:null,...e(F)})};class L5 extends $D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.object)return P($,{code:R.invalid_type,expected:T.object,received:$.parsedType}),b;let B=[],J=this._def.keyType,Q=this._def.valueType;for(let X in $.data)B.push({key:J._parse(new I1($,X,$.path,X)),value:Q._parse(new I1($,$.data[X],$.path,X)),alwaysSet:X in $.data});if($.common.async)return X0.mergeObjectAsync(F,B);else return X0.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof $D)return new L5({keyType:D,valueType:F,typeName:m.ZodRecord,...e($)});return new L5({keyType:T1.create(),valueType:D,typeName:m.ZodRecord,...e(F)})}}class M5 extends $D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.map)return P($,{code:R.invalid_type,expected:T.map,received:$.parsedType}),b;let B=this._def.keyType,J=this._def.valueType,Q=[...$.data.entries()].map(([X,Y],G)=>{return{key:B._parse(new I1($,X,$.path,[G,"key"])),value:J._parse(new I1($,Y,$.path,[G,"value"]))}});if($.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Y of Q){let G=await Y.key,H=await Y.value;if(G.status==="aborted"||H.status==="aborted")return b;if(G.status==="dirty"||H.status==="dirty")F.dirty();X.set(G.value,H.value)}return{status:F.value,value:X}})}else{let X=new Map;for(let Y of Q){let{key:G,value:H}=Y;if(G.status==="aborted"||H.status==="aborted")return b;if(G.status==="dirty"||H.status==="dirty")F.dirty();X.set(G.value,H.value)}return{status:F.value,value:X}}}}M5.create=(D,F,$)=>{return new M5({valueType:F,keyType:D,typeName:m.ZodMap,...e($)})};class o6 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==T.set)return P($,{code:R.invalid_type,expected:T.set,received:$.parsedType}),b;let B=this._def;if(B.minSize!==null){if($.data.size<B.minSize.value)P($,{code:R.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),F.dirty()}if(B.maxSize!==null){if($.data.size>B.maxSize.value)P($,{code:R.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),F.dirty()}let J=this._def.valueType;function Q(Y){let G=new Set;for(let H of Y){if(H.status==="aborted")return b;if(H.status==="dirty")F.dirty();G.add(H.value)}return{status:F.value,value:G}}let X=[...$.data.values()].map((Y,G)=>J._parse(new I1($,Y,$.path,G)));if($.common.async)return Promise.all(X).then((Y)=>Q(Y));else return Q(X)}min(D,F){return new o6({...this._def,minSize:{value:D,message:_.toString(F)}})}max(D,F){return new o6({...this._def,maxSize:{value:D,message:_.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}o6.create=(D,F)=>{return new o6({valueType:D,minSize:null,maxSize:null,typeName:m.ZodSet,...e(F)})};class M3 extends $D{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.function)return P(F,{code:R.invalid_type,expected:T.function,received:F.parsedType}),b;function $(X,Y){return Z5({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,A3(),L8].filter((G)=>!!G),issueData:{code:R.invalid_arguments,argumentsError:Y}})}function B(X,Y){return Z5({data:X,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,A3(),L8].filter((G)=>!!G),issueData:{code:R.invalid_return_type,returnTypeError:Y}})}let J={errorMap:F.common.contextualErrorMap},Q=F.data;if(this._def.returns instanceof s6){let X=this;return V0(async function(...Y){let G=new _0([]),H=await X._def.args.parseAsync(Y,J).catch((V)=>{throw G.addIssue($(Y,V)),G}),q=await Reflect.apply(Q,this,H);return await X._def.returns._def.type.parseAsync(q,J).catch((V)=>{throw G.addIssue(B(q,V)),G})})}else{let X=this;return V0(function(...Y){let G=X._def.args.safeParse(Y,J);if(!G.success)throw new _0([$(Y,G.error)]);let H=Reflect.apply(Q,this,G.data),q=X._def.returns.safeParse(H,J);if(!q.success)throw new _0([B(H,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new M3({...this._def,args:B8.create(D).rest(W6.create())})}returns(D){return new M3({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new M3({args:D?D:B8.create([]).rest(W6.create()),returns:F||W6.create(),typeName:m.ZodFunction,...e($)})}}class O3 extends $D{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}O3.create=(D,F)=>{return new O3({getter:D,typeName:m.ZodLazy,...e(F)})};class w3 extends $D{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return P(F,{received:F.data,code:R.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:D.data}}get value(){return this._def.value}}w3.create=(D,F)=>{return new w3({value:D,typeName:m.ZodLiteral,...e(F)})};function Tv(D,F){return new K6({values:D,typeName:m.ZodEnum,...e(F)})}class K6 extends $D{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return P(F,{expected:YD.joinValues($),received:F.parsedType,code:R.invalid_type}),b}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),$=this._def.values;return P(F,{received:F.data,code:R.invalid_enum_value,options:$}),b}return V0(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return K6.create(D,{...this._def,...F})}exclude(D,F=this._def){return K6.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}}K6.create=Tv;class I3 extends $D{_parse(D){let F=YD.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==T.string&&$.parsedType!==T.number){let B=YD.objectValues(F);return P($,{expected:YD.joinValues(B),received:$.parsedType,code:R.invalid_type}),b}if(!this._cache)this._cache=new Set(YD.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=YD.objectValues(F);return P($,{received:$.data,code:R.invalid_enum_value,options:B}),b}return V0(D.data)}get enum(){return this._def.values}}I3.create=(D,F)=>{return new I3({values:D,typeName:m.ZodNativeEnum,...e(F)})};class s6 extends $D{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==T.promise&&F.common.async===!1)return P(F,{code:R.invalid_type,expected:T.promise,received:F.parsedType}),b;let $=F.parsedType===T.promise?F.data:Promise.resolve(F.data);return V0($.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}s6.create=(D,F)=>{return new s6({type:D,typeName:m.ZodPromise,...e(F)})};class P1 extends $D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=this._def.effect||null,J={addIssue:(Q)=>{if(P($,Q),Q.fatal)F.abort();else F.dirty()},get path(){return $.path}};if(J.addIssue=J.addIssue.bind(J),B.type==="preprocess"){let Q=B.transform($.data,J);if($.common.async)return Promise.resolve(Q).then(async(X)=>{if(F.value==="aborted")return b;let Y=await this._def.schema._parseAsync({data:X,path:$.path,parent:$});if(Y.status==="aborted")return b;if(Y.status==="dirty")return n6(Y.value);if(F.value==="dirty")return n6(Y.value);return Y});else{if(F.value==="aborted")return b;let X=this._def.schema._parseSync({data:Q,path:$.path,parent:$});if(X.status==="aborted")return b;if(X.status==="dirty")return n6(X.value);if(F.value==="dirty")return n6(X.value);return X}}if(B.type==="refinement"){let Q=(X)=>{let Y=B.refinement(X,J);if($.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if($.common.async===!1){let X=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(X.status==="aborted")return b;if(X.status==="dirty")F.dirty();return Q(X.value),{status:F.value,value:X.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((X)=>{if(X.status==="aborted")return b;if(X.status==="dirty")F.dirty();return Q(X.value).then(()=>{return{status:F.value,value:X.value}})})}if(B.type==="transform")if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!H6(Q))return b;let X=B.transform(Q.value,J);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:X}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(!H6(Q))return b;return Promise.resolve(B.transform(Q.value,J)).then((X)=>({status:F.value,value:X}))});YD.assertNever(B)}}P1.create=(D,F,$)=>{return new P1({schema:D,typeName:m.ZodEffects,effect:F,...e($)})};P1.createWithPreprocess=(D,F,$)=>{return new P1({schema:F,effect:{type:"preprocess",transform:D},typeName:m.ZodEffects,...e($)})};class w1 extends $D{_parse(D){if(this._getType(D)===T.undefined)return V0(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}w1.create=(D,F)=>{return new w1({innerType:D,typeName:m.ZodOptional,...e(F)})};class N8 extends $D{_parse(D){if(this._getType(D)===T.null)return V0(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}N8.create=(D,F)=>{return new N8({innerType:D,typeName:m.ZodNullable,...e(F)})};class P3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===T.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}P3.create=(D,F)=>{return new P3({innerType:D,typeName:m.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...e(F)})};class S3 extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(U3(B))return B.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new _0($.common.issues)},input:$.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new _0($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}S3.create=(D,F)=>{return new S3({innerType:D,typeName:m.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...e(F)})};class N5 extends $D{_parse(D){if(this._getType(D)!==T.nan){let $=this._getOrReturnCtx(D);return P($,{code:R.invalid_type,expected:T.nan,received:$.parsedType}),b}return{status:"valid",value:D.data}}}N5.create=(D)=>{return new N5({typeName:m.ZodNaN,...e(D)})};var n2D=Symbol("zod_brand");class y$ extends $D{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;return this._def.type._parse({data:$,path:F.path,parent:F})}unwrap(){return this._def.type}}class C5 extends $D{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.common.async)return(async()=>{let J=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(J.status==="aborted")return b;if(J.status==="dirty")return F.dirty(),n6(J.value);else return this._def.out._parseAsync({data:J.value,path:$.path,parent:$})})();else{let B=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(B.status==="aborted")return b;if(B.status==="dirty")return F.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:$.path,parent:$})}}static create(D,F){return new C5({in:D,out:F,typeName:m.ZodPipeline})}}class k3 extends $D{_parse(D){let F=this._def.innerType._parse(D),$=(B)=>{if(H6(B))B.value=Object.freeze(B.value);return B};return U3(F)?F.then((B)=>$(B)):$(F)}unwrap(){return this._def.innerType}}k3.create=(D,F)=>{return new k3({innerType:D,typeName:m.ZodReadonly,...e(F)})};function Nv(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function Ov(D,F={},$){if(D)return a6.create().superRefine((B,J)=>{let Q=D(B);if(Q instanceof Promise)return Q.then((X)=>{if(!X){let Y=Nv(F,B),G=Y.fatal??$??!0;J.addIssue({code:"custom",...Y,fatal:G})}});if(!Q){let X=Nv(F,B),Y=X.fatal??$??!0;J.addIssue({code:"custom",...X,fatal:Y})}return});return a6.create()}var i2D={object:gD.lazycreate},m;(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(m||(m={}));var a2D=(D,F={message:`Input not instance of ${D.name}`})=>Ov(($)=>$ instanceof D,F),wv=T1.create,Iv=q6.create,o2D=N5.create,s2D=E6.create,Pv=N3.create,r2D=i6.create,t2D=A5.create,e2D=C3.create,DGD=R3.create,FGD=a6.create,$GD=W6.create,BGD=$8.create,JGD=U5.create,QGD=O1.create,XGD=gD.create,YGD=gD.strictCreate,GGD=j3.create,HGD=v$.create,WGD=T3.create,qGD=B8.create,EGD=L5.create,KGD=M5.create,zGD=o6.create,VGD=M3.create,ZGD=O3.create,AGD=w3.create,UGD=K6.create,LGD=I3.create,MGD=s6.create,NGD=P1.create,CGD=w1.create,RGD=N8.create,jGD=P1.createWithPreprocess,TGD=C5.create,OGD=()=>wv().optional(),wGD=()=>Iv().optional(),IGD=()=>Pv().optional(),PGD={string:(D)=>T1.create({...D,coerce:!0}),number:(D)=>q6.create({...D,coerce:!0}),boolean:(D)=>N3.create({...D,coerce:!0}),bigint:(D)=>E6.create({...D,coerce:!0}),date:(D)=>i6.create({...D,coerce:!0})};var SGD=b;var ERD=S1.object({apiKey:S1.string().optional(),apiUrl:S1.string().url().default("https://nemar-api-dev.shirazi-10f.workers.dev"),username:S1.string().optional(),email:S1.string().email().optional(),githubUsername:S1.string().optional(),sandboxCompleted:S1.boolean().optional(),sandboxDatasetId:S1.string().optional()}),l0=new P$({projectName:"nemar",schema:{apiKey:{type:"string"},apiUrl:{type:"string",default:"https://nemar-api-dev.shirazi-10f.workers.dev"},username:{type:"string"},email:{type:"string"},githubUsername:{type:"string"},sandboxCompleted:{type:"boolean"},sandboxDatasetId:{type:"string"}},...process.env.NEMAR_CONFIG_DIR?{cwd:process.env.NEMAR_CONFIG_DIR}:{}});function Y0(){return{apiKey:l0.get("apiKey"),apiUrl:l0.get("apiUrl"),username:l0.get("username"),email:l0.get("email"),githubUsername:l0.get("githubUsername"),sandboxCompleted:l0.get("sandboxCompleted"),sandboxDatasetId:l0.get("sandboxDatasetId")}}function Sv(){return!!l0.get("sandboxCompleted")}function R0(D,F){l0.set(D,F)}function h2(D){l0.delete(D)}function kv(){l0.clear()}function vD(){return!!l0.get("apiKey")}function vv(){return l0.path}var b2="https://nemar-api-dev.shirazi-10f.workers.dev",x$=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/;function f0(D){if(D instanceof Error)return D.message;return String(D)}class u extends Error{statusCode;details;constructor(D,F,$){super(F);this.statusCode=D;this.details=$;this.name="ApiError"}}var kGD=b2.includes("workers.dev");function yv(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(kGD)return b2;return Y0().apiUrl||b2}async function o(D,F={},$=!1){let B=`${yv()}${D}`,J={"Content-Type":"application/json",...F.headers};if($){let Y=Y0();if(!Y.apiKey&&$===!0)throw new u(401,"Not authenticated. Run 'nemar auth login' first.");if(Y.apiKey)J.Authorization=`Bearer ${Y.apiKey}`}let Q;try{Q=await fetch(B,{...F,headers:J})}catch(Y){throw new u(0,`Network error: Could not connect to ${yv()}`,{originalError:Y instanceof Error?Y.message:String(Y)})}let X;try{X=await Q.json()}catch{throw new u(Q.status,`Invalid response from server (status ${Q.status})`)}if(!Q.ok)throw new u(Q.status,X.error||X.message||"Request failed",X.details);return X}async function xv(D){return o(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function _v(D){return o(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function fv(D){return o("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function gv(D){return o("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function hv(D){return o("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function bv(D,F){return o("/auth/retrieve-key",{method:"POST",body:JSON.stringify({email:D,password:F})})}async function uv(D){return o("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:D})})}async function _$(){return o("/users/me",{},!0)}async function mv(D,F){let $=new URLSearchParams;if(D)$.set("status",D);if(F)$.set("role",F);let B=$.toString()?`?${$.toString()}`:"";return o(`/admin/users${B}`,{},!0)}async function lv(D){return o(`/admin/approve/${D}`,{method:"POST"},!0)}async function dv(D){return o(`/admin/revoke/${D}`,{method:"POST"},!0)}async function pv(D,F){return o(`/admin/users/${D}/role`,{method:"POST",body:JSON.stringify({role:F})},!0)}async function cv(D){return o(`/admin/regenerate-iam/${D}`,{method:"POST"},!0)}async function u2(D,F){return o(`/admin/datasets/${D}/visibility`,{method:"PATCH",body:JSON.stringify({visibility:F})},!0)}async function nv(D){return o(`/datasets/${D}/publish`,{method:"POST"},!0)}async function iv(D){return o(`/admin/datasets/${D}/ci`,{},!0)}async function f$(D){return o(`/admin/datasets/${D}/ci`,{method:"POST"},!0)}async function av(D){return o(`/datasets/${D}/ci/status`,{},!0)}async function ov(D){return o(`/datasets/${D}/manifest`,{},!0)}async function sv(D,F){return o(`/datasets/${D}/manifest/${F}`,{},!0)}function rv(D){let F=D;if(!["active","archived","deleted"].includes(F.status))throw Error(`Invalid dataset status: ${F.status}`);if(!F.visibility)F.visibility="private";else if(!["public","private"].includes(F.visibility))throw Error(`Invalid dataset visibility: ${F.visibility}`);return F}async function tv(D=!1){let $=await o(`/datasets${D?"?mine=true":""}`,{},D?!0:"optional");return $.datasets=$.datasets.map(rv),$}async function d0(D){let F=await o(`/datasets/${D}`,{},"optional");return rv(F.dataset)}async function ev(D){return o(`/datasets/${D}/versions`,{},!0)}async function g$(D){return o("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function h$(D){return o(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function Dy(D,F){return o(`/datasets/${D}/upload-urls`,{method:"POST",body:JSON.stringify({files:F})},!0)}async function Fy(D,F){return o(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function R5(D){return o(`/admin/datasets/${D}/doi`,{},!0)}async function m2(D,F){return o(`/admin/datasets/${D}/doi/update`,{method:"POST",body:JSON.stringify(F)},!0)}async function $y(D){return o(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function By(D,F){return o(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function Jy(D){return o(`/datasets/${D}/collaborators`,{},!0)}async function Qy(D){return o("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function Xy(){return o("/sandbox/reset",{method:"POST"},!0)}async function Yy(){return o("/sandbox/status",{},!0)}async function Gy(D){return o(`/datasets/${D}/publish/request`,{method:"POST"},!0)}async function Hy(D){return o(`/datasets/${D}/publish/status`,{},!0)}async function Wy(D){return o(`/datasets/${D}/publish/resend`,{method:"POST"},!0)}async function qy(D){let F=D?`?status=${D}`:"";return o(`/admin/publish/requests${F}`,{},!0)}async function Ey(D,F){return o(`/admin/publish/${D}/deny`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:F})},!0)}async function Ky(D,F=!1,$=!1){let B,J;do if(J=await o(`/admin/publish/${D}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resume:F,sandbox:$,s3_lock_offset:B})},!0),J.hasMore&&J.s3_lock_offset!==void 0)B=J.s3_lock_offset;else break;while(J.hasMore);return J}async function zy(D,F){return o(`/admin/datasets/${D}/enrichment`,{method:"POST",body:JSON.stringify(F)},!0)}async function Vy(D){return o(`/admin/datasets/${D}/files`,{},!0)}async function Zy(D){let F=0,$=0,B=[],J=0,Q=!0;while(Q){let X=await o(`/admin/datasets/${D}/s3-lock`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({offset:F})},!0);if($+=X.locked,B.push(...X.failed),J=X.total,Q=X.hasMore,Q)F+=40}return{locked:$,total:J,failed:B}}async function Ay(D,F=!1){return o(`/admin/datasets/${D}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:F})},!0)}async function OD(D,F,$=!1){if(F.no)return"declined";if(F.yes)return"confirmed";try{let{confirmed:B}=await MD.prompt([{type:"confirm",name:"confirmed",message:D,default:$}]);return B?"confirmed":"cancelled"}catch(B){let J=B instanceof Error?B.message:String(B);if(J.includes("closed")||J.includes("TTY")||J.includes("SIGINT")||J.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",J);return"cancelled"}}async function Uy(D,F,$){if($.no)return"declined";if($.yes)return"confirmed";try{let{input:B}=await MD.prompt([{type:"input",name:"input",message:D,validate:(J)=>{if(J!==F)return`Input does not match. Expected: ${F}`;return!0}}]);return B===F?"confirmed":"cancelled"}catch(B){let J=B instanceof Error?B.message:String(B);if(J.includes("closed")||J.includes("TTY")||J.includes("SIGINT")||J.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",J);return"cancelled"}}var yD="-y, --yes",lD="-n, --no",xD="Skip confirmation and proceed",dD="Skip confirmation and decline";import{existsSync as Ny,statSync as vGD}from"fs";import{join as l2}from"path";var{spawn:yGD}=globalThis.Bun;async function l(D,F={}){let $=yGD({cmd:D,cwd:F.cwd,stdout:"pipe",stderr:"pipe",env:{...process.env,...F.env}}),B=await new Response($.stdout).text(),J=await new Response($.stderr).text(),Q=await $.exited;return{stdout:B,stderr:J,exitCode:Q}}function Ly(D){return D.split(".").map((F)=>{let $=Number.parseInt(F.replace(/[^0-9]/g,""),10);return Number.isNaN($)?0:$})}function xGD(D,F){let $=Ly(D),B=Ly(F);for(let J=0;J<Math.max($.length,B.length);J++){let Q=$[J]||0,X=B[J]||0;if(Q>X)return!0;if(Q<X)return!1}return!0}async function Cy(){try{let{stdout:F,exitCode:$,stderr:B}=await l(["git-annex","version"]);if($!==0)return console.warn("git-annex version returned non-zero exit code:",$),console.warn("stderr:",B),{installed:!1,minVersion:"10.0",error:`Version check failed: ${B.trim()}`};let J=F.match(/version:\s*(\d+\.\d+)/),Q=J?J[1]:void 0;if(!Q)console.warn("Could not parse git-annex version from output:",F);return{installed:!0,version:Q,minVersion:"10.0",compatible:Q?xGD(Q,"10.0"):void 0}}catch(F){let $=F instanceof Error?F.message:String(F);if($.includes("ENOENT")||$.includes("not found"))return console.info("git-annex not found in PATH"),{installed:!1,minVersion:"10.0"};return console.error("Error checking git-annex installation:",$),{installed:!1,minVersion:"10.0",error:$}}}async function _GD(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:D,stderr:F}=await l(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"]),$=D+F,B=$.match(/Hi ([^!]+)!/);if(B)return{accessible:!0,username:B[1]};if($.includes("Permission denied"))return{accessible:!1};return{accessible:$.includes("successfully authenticated")}}catch(D){let F=D instanceof Error?D.message:String(D);if(F.includes("ENOENT")||F.includes("not found"))console.info("SSH command not found");else console.error("Error checking GitHub SSH access:",F);return{accessible:!1}}}function Ry(){let D=process.platform;if(D==="darwin")return"brew install git-annex";if(D==="linux")return"apt install git-annex (Debian/Ubuntu)";return"See https://git-annex.branchable.com/install/"}async function b$(){let[D,F]=await Promise.all([Cy(),_GD()]),$=[];if(!D.installed)$.push(`git-annex is not installed. Install: ${Ry()}`);else if(D.compatible===!1)$.push(`git-annex version ${D.version} is too old. Required: >= ${D.minVersion}`);if(!F.accessible)$.push("GitHub SSH access not configured. Run 'nemar auth setup-ssh' to configure automatically.");return{gitAnnex:D,githubSSH:F,allPassed:$.length===0,errors:$}}async function C8(D){if(!Ny(l2(D,".git")))return!1;try{let{exitCode:F}=await l(["git","annex","info"],{cwd:D});return F===0}catch(F){let $=F instanceof Error?F.message:String(F);if(!$.includes("ENOENT")&&!$.includes("not found"))console.error(`Error checking if ${D} is a git-annex dataset:`,$);return!1}}async function u$(D,F={}){if(!F.force&&await C8(D))return{success:!0};try{let $={};if(F.author)$.GIT_AUTHOR_NAME=F.author.name,$.GIT_AUTHOR_EMAIL=F.author.email,$.GIT_COMMITTER_NAME=F.author.name,$.GIT_COMMITTER_EMAIL=F.author.email;let{stderr:B,exitCode:J}=await l(["git","init",D],{...Object.keys($).length>0?{env:$}:{}});if(J!==0)return{success:!1,error:B.trim()||"Failed to initialize git repository"};let{stderr:Q,exitCode:X}=await l(["git","annex","init"],{cwd:D,...Object.keys($).length>0?{env:$}:{}});if(X!==0)return{success:!1,error:Q.trim()||"Failed to initialize git-annex"};return{success:!0}}catch($){return{success:!1,error:$.message}}}async function jy(D){try{let{exitCode:F,stderr:$}=await l(["git","annex","info"],{cwd:D});if(F===0)return{success:!0};if($.includes("First run: git-annex init")){let{stderr:B,exitCode:J}=await l(["git","annex","init"],{cwd:D});if(J!==0)return{success:!1,error:B.trim()||"Failed to initialize git-annex"};return{success:!0}}return{success:!1,error:$.trim()||"Failed to check git-annex status"}}catch(F){return{success:!1,error:F.message}}}async function m$(D,F){let B=F||"include=*.edf or include=*.bdf or include=*.set or include=*.fif or include=*.vhdr or include=*.eeg or include=*.cnt or include=*.fdt or largerthan=100kb";try{let{stderr:J,exitCode:Q}=await l(["git","annex","config","--set","annex.largefiles",B],{cwd:D});if(Q!==0)return{success:!1,error:J.trim()||"Failed to configure largefiles"};return{success:!0}}catch(J){return{success:!1,error:J.message}}}async function fGD(){try{let{exitCode:D,stderr:F}=await l(["ssh","-T","-o","BatchMode=yes","-o","ConnectTimeout=5","git@github.com"]),$=F.includes("successfully authenticated");if(!$)console.warn("SSH test to github.com failed:",{exitCode:D,stderr:F.trim().slice(0,500)});return{works:$,error:$?void 0:F.trim().slice(0,500)}}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn("SSH test exception:",F),{works:!1,error:F}}}async function gGD(){try{let{stdout:D,exitCode:F,stderr:$}=await l(["gh","auth","token"]);if(F!==0)return console.warn("gh CLI returned non-zero exit code:",F),console.warn("stderr:",$),{token:null,error:`gh auth token failed: ${$.trim()||"unknown error"}`};if(!D.trim())return console.warn("gh auth token returned empty output"),{token:null,error:"gh CLI returned empty token"};return{token:D.trim()}}catch(D){let F=D instanceof Error?D.message:String(D);if(console.error("Failed to get GitHub token from gh CLI:",F),F.includes("ENOENT")||F.includes("not found"))return{token:null,error:"gh CLI not installed (command not found)"};return{token:null,error:`gh CLI error: ${F}`}}}async function l$(D){try{let{stdout:F,exitCode:$,stderr:B}=await l(["gh","api","user","--jq",".login"]);if($!==0){if(B.includes("not logged in")||B.includes("auth login"))return{authenticated:!1,error:"gh CLI not authenticated. Run 'gh auth login' to authenticate."};return{authenticated:!1,error:`gh CLI error: ${B.trim()||"unknown error"}`}}let J=F.trim();if(!J)return{authenticated:!1,error:"gh CLI returned empty username"};if(D){let Q=J.toLowerCase()===D.toLowerCase();return{authenticated:!0,username:J,matches:Q,error:Q?void 0:`gh CLI authenticated as '${J}', expected '${D}'`}}return{authenticated:!0,username:J}}catch(F){let $=F instanceof Error?F.message:String(F);if($.includes("ENOENT")||$.includes("not found"))return{authenticated:!1,error:"gh CLI not installed. Install from https://cli.github.com/"};return{authenticated:!1,error:`Failed to verify gh CLI: ${$}`}}}async function d$(D){if(!/^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(D))return{accepted:!1,error:`Invalid repository format: ${D}`};let{stdout:F,exitCode:$,stderr:B}=await l(["gh","api","/user/repository_invitations"]);if($!==0){if(B.includes("not logged in")||B.includes("auth login"))return{accepted:!1,error:"gh CLI not authenticated. Run 'gh auth login' to authenticate."};if(B.includes("API rate limit")||B.includes("403"))return{accepted:!1,error:"GitHub API rate limit exceeded. Please try again in a few minutes."};if(B.includes("ENOENT")||B.includes("not found"))return{accepted:!1,error:"gh CLI not installed. Install from https://cli.github.com/"};return{accepted:!1,error:`Failed to list invitations: ${B.trim()||"unknown error"}`}}let J=null;try{J=JSON.parse(F||"[]").find((H)=>H.repository.full_name===D)?.id??null}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return console.error("Failed to parse GitHub invitations response:",G),console.error(" Raw response (first 500 chars):",(F||"").slice(0,500)),{accepted:!1,error:`Failed to parse GitHub API response: ${G}`}}if(!J){let{exitCode:Y}=await l(["gh","api",`/repos/${D}`,"--silent"]);if(Y===0)return{accepted:!0,alreadyCollaborator:!0};return{accepted:!1,error:`No pending invitation found for ${D}. You may need to accept it manually via GitHub.`}}let{exitCode:Q,stderr:X}=await l(["gh","api","--method","PATCH",`/user/repository_invitations/${J}`]);if(Q!==0)return{accepted:!1,error:`Failed to accept invitation: ${X.trim()||"unknown error"}`};return{accepted:!0}}async function p$(D,F,$="origin"){let B=F;if(process.env.GH_TOKEN&&F.startsWith("git@github.com:")){let J=process.env.GH_TOKEN.trim();if(!J||/\s/.test(J))return{success:!1,error:"GH_TOKEN environment variable is set but appears malformed (empty or contains whitespace)"};let Q=F.replace("git@github.com:","");B=`https://${J}@github.com/${Q}`}else if(F.startsWith("git@github.com:")){let J=F.replace("git@github.com:",""),Q=await fGD();if(Q.works)B=F;else{console.warn("GitHub SSH not available, falling back to HTTPS with gh CLI token...");let X=await gGD();if(X.token)B=`https://${X.token}@github.com/${J}`,console.warn("Note: using HTTPS with gh CLI token. If the token expires, re-run 'gh auth login'.");else return{success:!1,error:`GitHub authentication not configured.
120
120
 
121
121
  SSH failed: ${Q.error||"could not connect"}
122
122
  gh CLI failed: ${X.error||"could not get token"}
@@ -142,6 +142,7 @@ User Management:
142
142
  users - List users and their status
143
143
  approve - Approve a pending user registration
144
144
  revoke - Revoke user access
145
+ role - Change a user's role (owner only: owner > admin > member)
145
146
 
146
147
  Dataset Management:
147
148
  repo - Manage repository visibility (public/private)
@@ -152,17 +153,40 @@ Dataset Management:
152
153
 
153
154
  Examples:
154
155
  $ nemar admin users --verified # List users awaiting approval
156
+ $ nemar admin users --role admin # List all admins
155
157
  $ nemar admin approve john_doe # Approve a user
158
+ $ nemar admin role john_doe admin # Promote user to admin (owner only)
156
159
  $ nemar admin repo public nm000104 # Make dataset repo public
157
160
  $ nemar admin ci check nm000104 # Check CI status
158
161
  $ nemar admin s3 regenerate-iam john_doe # Regenerate AWS credentials
159
- $ nemar admin doi create nm000104 # Create concept DOI`);function pD(){if(!vD())return console.log(W.red("Error: Not authenticated")),console.log(W.gray(" Run 'nemar auth login' first")),!1;return!0}j0.command("users").description("List NEMAR users").option("--pending","Show only pending approval").option("--verified","Show only verified (awaiting approval)").option("--approved","Show only approved users").option("--revoked","Show only revoked users").action(async(D)=>{if(!pD())return;let F;if(D.pending)F="pending";else if(D.verified)F="verified";else if(D.approved)F="approved";else if(D.revoked)F="revoked";let $=C("Fetching users...").start();try{let B=await mv(F);if($.stop(),B.users.length===0){console.log(W.yellow("No users found"));return}console.log(`
160
- ${W.cyan("NEMAR Users")} (${B.count} total)
161
- `);for(let J of B.users){let Q={pending:W.gray,verified:W.yellow,approved:W.green,revoked:W.red}[J.status]||W.white,X=J.role==="owner"?W.red(" [owner]"):J.role==="admin"?W.magenta(" [admin]"):"",Y=J.email_verified?"":W.gray(" (unverified)");console.log(` ${W.cyan(J.username)}${X}`),console.log(` Email: ${J.email}${Y}`),console.log(` GitHub: @${J.github_username}`),console.log(` Status: ${Q(J.status)}`),console.log(` Created: ${new Date(J.created_at).toLocaleDateString()}`),console.log()}}catch(B){p0(B,$,"Failed to fetch users")}});j0.command("approve").description("Approve a pending user").argument("<username>","Username to approve").option(yD,xD).option(lD,dD).action(async(D,F)=>{if(!pD())return;console.log(W.cyan(`
162
+ $ nemar admin doi create nm000104 # Create concept DOI`);function pD(){if(!vD())return console.log(W.red("Error: Not authenticated")),console.log(W.gray(" Run 'nemar auth login' first")),!1;return!0}j0.command("users").description("List NEMAR users").option("--pending","Show only pending approval").option("--verified","Show only verified (awaiting approval)").option("--approved","Show only approved users").option("--revoked","Show only revoked users").option("--role <role>","Filter by role: owner, admin, or member").addHelpText("after",`
163
+ Examples:
164
+ $ nemar admin users # List all users
165
+ $ nemar admin users --verified # Users awaiting approval
166
+ $ nemar admin users --role admin # List all admins
167
+ $ nemar admin users --role owner # List all owners
168
+ $ nemar admin users --approved --role member # Approved regular users`).action(async(D)=>{if(!pD())return;let F;if(D.pending)F="pending";else if(D.verified)F="verified";else if(D.approved)F="approved";else if(D.revoked)F="revoked";let $=D.role;if($&&!["owner","admin","member"].includes($))console.error(W.red(`Invalid role '${$}'. Must be: owner, admin, or member`)),process.exit(1);let B=C("Fetching users...").start();try{let J=await mv(F,$);if(B.stop(),J.users.length===0){let X=[F,$].filter(Boolean).join(", ");console.log(W.yellow(`No users found${X?` (filter: ${X})`:""}`));return}let Q=[F,$?`role=${$}`:""].filter(Boolean).join(", ");console.log(`
169
+ ${W.cyan("NEMAR Users")} (${J.count} total${Q?`, filter: ${Q}`:""})
170
+ `);for(let X of J.users){let Y={pending:W.gray,verified:W.yellow,approved:W.green,revoked:W.red}[X.status]||W.white,G=X.role||"member",H=G==="owner"?W.red(" [owner]"):G==="admin"?W.magenta(" [admin]"):W.gray(" [member]"),q=X.email_verified?"":W.gray(" (unverified)");console.log(` ${W.cyan(X.username)}${H}`),console.log(` Email: ${X.email}${q}`),console.log(` GitHub: @${X.github_username}`),console.log(` Status: ${Y(X.status)}`),console.log(` Created: ${new Date(X.created_at).toLocaleDateString()}`),console.log()}}catch(J){p0(J,B,"Failed to fetch users")}});j0.command("approve").description("Approve a pending user").argument("<username>","Username to approve").option(yD,xD).option(lD,dD).action(async(D,F)=>{if(!pD())return;console.log(W.cyan(`
162
171
  Approving user: ${D}
163
172
  `)),console.log("This will:"),console.log(" 1. Set up S3 access for the user"),console.log(" 2. Notify them to retrieve their API key via CLI"),console.log();let $=await OD(`Approve ${D}?`,F,!0);if($!=="confirmed"){console.log(W.gray($==="declined"?"Skipped":"Cancelled"));return}let B=C(`Approving ${D}...`).start();try{let J=await lv(D);if(B.succeed(`Approved ${D}`),console.log(),console.log(` Email: ${J.user.email}`),console.log(` Status: ${W.green(J.user.status)}`),J.iam_setup===!0)console.log(` S3 Access: ${W.green("configured")}`);else if(J.iam_setup===!1)console.log(` S3 Access: ${W.red("NOT configured")}`);if(console.log(),console.log(W.green("User notified to retrieve their API key via 'nemar auth retrieve-key'")),J.warning)console.log(),console.log(W.yellow(`Warning: ${J.warning}`))}catch(J){p0(J,B,"Failed to approve user",{404:"User not found or not in 'verified' status"})}});j0.command("revoke").description("Revoke user access").argument("<username>","Username to revoke").option(yD,xD).option(lD,dD).action(async(D,F)=>{if(!pD())return;if(Y0().username===D){console.log(W.red("Error: Cannot revoke your own access"));return}console.log(W.red(`
164
173
  Revoking access for: ${D}
165
- `)),console.log(W.yellow("This will:")),console.log(" 1. Invalidate all API keys for this user"),console.log(" 2. Remove them from datasets they have access to"),console.log(" 3. Send them a notification email"),console.log();let B=await Uy(`Type '${D}' to confirm revocation:`,D,F);if(B!=="confirmed"){console.log(W.gray(B==="declined"?"Skipped":"Cancelled"));return}let J=C(`Revoking ${D}...`).start();try{await dv(D),J.succeed(`Revoked access for ${D}`)}catch(Q){p0(Q,J,"Failed to revoke user",{404:"User not found"})}});j0.command("role").description("Change a user's role (owner only)").argument("<username>","Username to change role for").argument("<role>","New role: owner, admin, or member").option("-y, --yes","Skip confirmation prompt").action(async(D,F,$)=>{if(!pD())return;if(!["owner","admin","member"].includes(F))console.error(W.red(`Invalid role '${F}'. Must be: owner, admin, or member`)),process.exit(1);if(!$.yes){let{confirmed:J}=await MD.prompt([{type:"confirm",name:"confirmed",message:`Change ${D}'s role to '${F}'?`,default:!1}]);if(!J){console.log(W.gray("Cancelled"));return}}let B=C(`Changing ${D}'s role to '${F}'...`).start();try{let J=await pv(D,F);if(B.succeed(J.message),J.tokens_revoked!==void 0&&J.tokens_revoked>0)console.log(W.yellow(` ${J.tokens_revoked} token(s) revoked (user must re-login)`))}catch(J){p0(J,B,"Failed to change role",{400:"Invalid request (check if you are an owner)",403:"Owner access required",404:"User not found",409:"User already has that role"})}});var p2=new H0("s3").description("S3 and IAM credential management");p2.command("regenerate-iam").description("Regenerate AWS IAM credentials for a user").argument("<username>","Username to regenerate credentials for").option(yD,xD).option(lD,dD).action(uy);p2.command("lock").description("Apply S3 Object Lock (Governance mode) to a dataset").argument("<dataset-id>","Dataset ID to lock").option(yD,xD).option(lD,dD).action(async(D,F)=>{if(!pD())return;console.log(W.cyan(`
174
+ `)),console.log(W.yellow("This will:")),console.log(" 1. Invalidate all API keys for this user"),console.log(" 2. Remove them from datasets they have access to"),console.log(" 3. Send them a notification email"),console.log();let B=await Uy(`Type '${D}' to confirm revocation:`,D,F);if(B!=="confirmed"){console.log(W.gray(B==="declined"?"Skipped":"Cancelled"));return}let J=C(`Revoking ${D}...`).start();try{await dv(D),J.succeed(`Revoked access for ${D}`)}catch(Q){p0(Q,J,"Failed to revoke user",{404:"User not found"})}});j0.command("role").description("Change a user's role (owner only)").argument("<username>","Username to change role for").argument("<role>","New role: owner, admin, or member").option("-y, --yes","Skip confirmation prompt").addHelpText("after",`
175
+ Permission Model:
176
+ owner - Full access: can manage users, roles, datasets, DOIs, and system settings
177
+ admin - Can approve/revoke users, manage datasets and DOIs
178
+ member - Can upload and manage their own datasets only
179
+
180
+ Rules:
181
+ - Only owners can change roles
182
+ - You cannot change your own role (prevents self-lockout)
183
+ - The last owner cannot be demoted (prevents total lockout)
184
+ - Demoting a user revokes their tokens (they must re-login)
185
+
186
+ Examples:
187
+ $ nemar admin role john_doe admin # Promote to admin
188
+ $ nemar admin role john_doe member # Demote to member
189
+ $ nemar admin role jane_doe owner -y # Promote to owner (skip confirm)`).action(async(D,F,$)=>{if(!pD())return;if(!["owner","admin","member"].includes(F))console.error(W.red(`Invalid role '${F}'. Must be: owner, admin, or member`)),process.exit(1);if(!$.yes){let{confirmed:J}=await MD.prompt([{type:"confirm",name:"confirmed",message:`Change ${D}'s role to '${F}'?`,default:!1}]);if(!J){console.log(W.gray("Cancelled"));return}}let B=C(`Changing ${D}'s role to '${F}'...`).start();try{let J=await pv(D,F);if(B.succeed(J.message),J.tokens_revoked!==void 0&&J.tokens_revoked>0)console.log(W.yellow(` ${J.tokens_revoked} token(s) revoked (user must re-login)`))}catch(J){p0(J,B,"Failed to change role",{400:"Invalid request (check if you are an owner)",403:"Owner access required",404:"User not found",409:"User already has that role"})}});var p2=new H0("s3").description("S3 and IAM credential management");p2.command("regenerate-iam").description("Regenerate AWS IAM credentials for a user").argument("<username>","Username to regenerate credentials for").option(yD,xD).option(lD,dD).action(uy);p2.command("lock").description("Apply S3 Object Lock (Governance mode) to a dataset").argument("<dataset-id>","Dataset ID to lock").option(yD,xD).option(lD,dD).action(async(D,F)=>{if(!pD())return;console.log(W.cyan(`
166
190
  Apply S3 Object Lock to ${D}
167
191
  `)),console.log("This will:"),console.log(" \u2022 Set GOVERNANCE mode Object Lock on all objects"),console.log(" \u2022 Retention period: 100 years"),console.log(" \u2022 Objects cannot be deleted or modified without bypass"),console.log();let $=await OD(`Apply S3 Object Lock to ${D}?`,F);if($!=="confirmed"){console.log(W.gray($==="declined"?"Skipped":"Cancelled"));return}let B=C("Applying S3 Object Lock...").start();try{let J=await Zy(D);if(J.failed.length>0){B.fail(`Partial lock: ${J.locked}/${J.total} locked, ${J.failed.length} failed`),console.log(W.yellow(`
168
192
  Failed objects:`));for(let Q of J.failed.slice(0,10))console.log(` \u2022 ${Q}`);if(J.failed.length>10)console.log(` ... and ${J.failed.length-10} more`)}else B.succeed(`All ${J.locked} objects locked successfully`)}catch(J){B.fail("S3 lock failed"),console.log(W.gray(` ${f0(J)}`))}});j0.addCommand(p2);j0.command("regenerate-iam",{hidden:!0}).argument("<username>").option(yD,xD).option(lD,dD).action(uy);async function uy(D,F){if(!pD())return;console.log(W.yellow(`
@@ -715,7 +739,7 @@ Examples:
715
739
  $ nemar sandbox # Run sandbox training
716
740
  $ nemar sandbox status # Check if training is completed
717
741
  $ nemar sandbox reset # Reset for re-training
718
- `).action(UHD);async function UHD(){if(console.log(),console.log(W.bold("NEMAR Sandbox Training")),console.log(W.gray("Verify your setup and learn the upload workflow")),console.log(),!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}let D=Y0();if(D.sandboxCompleted){console.log(W.green("Sandbox training already completed!")),console.log(W.gray(`Dataset ID: ${D.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(W.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(W.gray("To re-run training, use: nemar sandbox reset"));return}console.log(W.bold("Step 1/6: Checking prerequisites..."));let F=C("Checking git-annex and SSH...").start(),$=await b$();if(!$.allPassed){F.fail("Prerequisites check failed"),console.log(),console.log(W.red("Missing requirements:"));for(let I of $.errors)console.log(W.yellow(` - ${I}`));if(!$.githubSSH.accessible)console.log(W.gray(" Run 'nemar auth setup-ssh' to configure SSH"));return}F.succeed("All prerequisites met");let B=C("Verifying GitHub CLI authentication...").start(),J=await l$(D.githubUsername);if(!J.authenticated){B.fail("GitHub CLI not authenticated"),console.log(W.red(` ${J.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(W.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(W.cyan(" gh auth login"));return}if(D.githubUsername&&!J.matches)B.warn("GitHub CLI user mismatch"),console.log(W.yellow(` ${J.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(W.cyan(` gh auth login # Login as ${D.githubUsername}`)),console.log(),console.log(W.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else B.succeed(`GitHub CLI authenticated as ${J.username}`);console.log(),console.log(W.bold("Step 2/6: Generating test dataset..."));let Q=C("Creating minimal BIDS structure...").start(),X;try{let I=Bx();X=I.root;let w=Jx(I);Q.succeed(`Test dataset created (${v3(w)})`),console.log(W.gray(` Location: ${X}`))}catch(I){Q.fail("Failed to generate test dataset"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`));return}console.log(),console.log(W.bold("Step 3/6: Registering sandbox dataset..."));let Y=C("Creating dataset on NEMAR...").start(),G,H,q,K,V,Z;try{let I=await g$({name:"Sandbox Training Dataset",description:"Placeholder dataset for sandbox training",files:[{path:"sub-01/eeg/sub-01_task-rest_eeg.edf",size:512000,type:"data"},{path:"dataset_description.json",size:200,type:"metadata"},{path:"participants.tsv",size:50,type:"metadata"},{path:"README",size:500,type:"metadata"},{path:"sub-01/eeg/sub-01_task-rest_eeg.json",size:300,type:"metadata"}],sandbox:!0});G=I.dataset.dataset_id,H=I.dataset.ssh_url,q=I.dataset.github_url,K=I.s3_config,V=I.dataset.s3_prefix,Z=I.upload_urls||{},Y.succeed(`Sandbox dataset created: ${W.cyan(G)}`),console.log(W.gray(` GitHub: ${q}`)),await new Promise((w)=>setTimeout(w,1e4))}catch(I){if(Y.fail("Failed to create sandbox dataset"),I instanceof u)console.log(W.red(` ${I.message}`));else console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`));v1(X);return}let A=C("Accepting GitHub repository invitation...").start(),U=q?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),L=U?U[1].replace(/\.git$/,""):null;if(!L){A.fail("Invalid GitHub repository URL from backend"),console.log(W.red(` Received: ${q||"(empty)"}`)),console.log(W.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),v1(X);return}let M=await d$(L);if(M.accepted)if(M.alreadyCollaborator)A.succeed("Already a collaborator on this repository");else A.succeed("GitHub invitation accepted");else A.warn("Could not auto-accept invitation"),console.log(W.yellow(` ${M.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(W.cyan(` https://github.com/${L}/invitations`)),console.log();console.log(),console.log(W.bold("Step 4/6: Initializing repository..."));let N=C("Setting up git-annex...").start(),O=D.username&&D.email?{name:D.username,email:D.email}:void 0;try{await u$(X,{author:O}),await m$(X),await p$(X,H),N.succeed("Repository initialized")}catch(I){N.fail("Failed to initialize repository"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}if(console.log(),console.log(W.bold("Step 5/6: Uploading to S3...")),Object.keys(Z).length===0)console.log(W.yellow(" No data files to upload (metadata only)"));else{let I=C("Uploading test data...").start();try{let c=0,GD=Object.keys(Z).length,S=await c$(X,Z,{jobs:4,onProgress:(JD)=>{if(JD.status==="completed"||JD.status==="failed")c++,I.text=`Uploading... ${c}/${GD} files`}});if(S.failed.length>0){I.fail(`Upload failed for ${S.failed.length} file(s)`);for(let JD of S.failed)console.log(W.red(` Failed: ${JD}`));if(S.error)console.log(W.red(` Error: ${S.error}`));console.log(),console.log(W.yellow("Sandbox training aborted due to upload failures.")),console.log(W.gray("Please check your network connection and try again.")),v1(X);return}I.succeed(`Uploaded ${S.uploaded} file(s)`)}catch(c){I.fail("Upload failed"),console.log(W.red(` ${c instanceof Error?c.message:"Unknown error"}`)),v1(X);return}let w=C("Registering file URLs...").start();try{let c={};for(let S of Object.keys(Z))c[S]=`${K.public_url}/${V}/objects/${S}`;let GD=await n$(X,c);if(!GD.success){w.fail(`URL registration failed for ${GD.failed.length} file(s)`);for(let S of GD.failed)console.log(W.red(` Failed: ${S}`));console.log(),console.log(W.yellow("Sandbox training aborted due to URL registration failures.")),console.log(W.gray("This may indicate a git-annex configuration issue.")),v1(X);return}w.succeed(`Registered ${GD.registered} file URLs`)}catch(c){w.fail("Failed to register URLs"),console.log(W.red(` ${c instanceof Error?c.message:"Unknown error"}`)),v1(X);return}}console.log(),console.log(W.bold("Step 6/6: Pushing to GitHub..."));let g=C("Saving and pushing...").start();try{await j5(X,"Initial sandbox training upload",O),await T5(X),g.succeed("Pushed to GitHub")}catch(I){g.fail("Failed to push to GitHub"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}let j=C("Finalizing...").start();try{await h$(G),await Qy(G),R0("sandboxCompleted",!0),R0("sandboxDatasetId",G),j.succeed("Sandbox training complete!")}catch(I){j.fail("Failed to finalize"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}v1(X),console.log(),console.log(W.green.bold("Congratulations! Sandbox training completed successfully.")),console.log(),console.log("Your setup is verified and you're ready to upload real datasets:"),console.log(W.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(W.gray(`Sandbox dataset: ${G}`))}BB.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(D)=>{if(!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}if(D.refresh){let F=C("Checking status...").start();try{let $=await Yy();if(R0("sandboxCompleted",$.sandbox_completed),$.sandbox_dataset_id)R0("sandboxDatasetId",$.sandbox_dataset_id);if(F.stop(),$.sandbox_completed){if(console.log(W.green("Sandbox training: Completed")),console.log(W.gray(` Dataset ID: ${$.sandbox_dataset_id}`)),$.sandbox_completed_at)console.log(W.gray(` Completed: ${$.sandbox_completed_at}`))}else console.log(W.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(W.cyan(" nemar sandbox"))}catch($){if(F.fail("Failed to check status"),$ instanceof u)console.log(W.red(` ${$.message}`))}}else{let F=Y0();if(F.sandboxCompleted)console.log(W.green("Sandbox training: Completed")),console.log(W.gray(` Dataset ID: ${F.sandboxDatasetId}`));else console.log(W.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(W.cyan(" nemar sandbox"))}});BB.command("reset").description("Reset sandbox training status for re-training").option(yD,xD).option(lD,dD).action(async(D)=>{if(!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}if(!Y0().sandboxCompleted){console.log(W.yellow("Sandbox training not yet completed")),console.log(W.gray("Nothing to reset"));return}let $=await OD("Reset sandbox training status? You will need to complete training again.",D);if($!=="confirmed"){console.log(W.gray($==="declined"?"Skipped":"Cancelled"));return}let B=C("Resetting sandbox status...").start();try{await Xy(),h2("sandboxCompleted"),h2("sandboxDatasetId"),B.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(W.cyan(" nemar sandbox"))}catch(J){if(B.fail("Failed to reset"),J instanceof u)console.log(W.red(` ${J.message}`));else console.log(W.red(` ${J instanceof Error?J.message:"Unknown error"}`))}});var Qx={name:"nemar-cli",version:"0.5.0-dev.250",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit",prepublishOnly:"bun run build","docs:generate":"bun run scripts/generate-docs.ts","docs:serve":"mkdocs serve","docs:build":"mkdocs build"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"MIT",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://nemar-cli.pages.dev",engines:{bun:">=1.0.0"},files:["dist","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1",inquirer:"^9.2.15",ora:"^8.0.1",zod:"^3.23.8"},devDependencies:{"@biomejs/biome":"1.9.4","@types/bcryptjs":"^3.0.0","@types/bun":"latest","@types/inquirer":"^9.0.7",bcryptjs:"^3.0.3",typescript:"^5.5.4"}};var Xx=Qx.version;var y1=new H0;y1.name("nemar").description(`CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource)
742
+ `).action(UHD);async function UHD(){if(console.log(),console.log(W.bold("NEMAR Sandbox Training")),console.log(W.gray("Verify your setup and learn the upload workflow")),console.log(),!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}let D=Y0();if(D.sandboxCompleted){console.log(W.green("Sandbox training already completed!")),console.log(W.gray(`Dataset ID: ${D.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(W.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(W.gray("To re-run training, use: nemar sandbox reset"));return}console.log(W.bold("Step 1/6: Checking prerequisites..."));let F=C("Checking git-annex and SSH...").start(),$=await b$();if(!$.allPassed){F.fail("Prerequisites check failed"),console.log(),console.log(W.red("Missing requirements:"));for(let I of $.errors)console.log(W.yellow(` - ${I}`));if(!$.githubSSH.accessible)console.log(W.gray(" Run 'nemar auth setup-ssh' to configure SSH"));return}F.succeed("All prerequisites met");let B=C("Verifying GitHub CLI authentication...").start(),J=await l$(D.githubUsername);if(!J.authenticated){B.fail("GitHub CLI not authenticated"),console.log(W.red(` ${J.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(W.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(W.cyan(" gh auth login"));return}if(D.githubUsername&&!J.matches)B.warn("GitHub CLI user mismatch"),console.log(W.yellow(` ${J.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(W.cyan(` gh auth login # Login as ${D.githubUsername}`)),console.log(),console.log(W.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else B.succeed(`GitHub CLI authenticated as ${J.username}`);console.log(),console.log(W.bold("Step 2/6: Generating test dataset..."));let Q=C("Creating minimal BIDS structure...").start(),X;try{let I=Bx();X=I.root;let w=Jx(I);Q.succeed(`Test dataset created (${v3(w)})`),console.log(W.gray(` Location: ${X}`))}catch(I){Q.fail("Failed to generate test dataset"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`));return}console.log(),console.log(W.bold("Step 3/6: Registering sandbox dataset..."));let Y=C("Creating dataset on NEMAR...").start(),G,H,q,K,V,Z;try{let I=await g$({name:"Sandbox Training Dataset",description:"Placeholder dataset for sandbox training",files:[{path:"sub-01/eeg/sub-01_task-rest_eeg.edf",size:512000,type:"data"},{path:"dataset_description.json",size:200,type:"metadata"},{path:"participants.tsv",size:50,type:"metadata"},{path:"README",size:500,type:"metadata"},{path:"sub-01/eeg/sub-01_task-rest_eeg.json",size:300,type:"metadata"}],sandbox:!0});G=I.dataset.dataset_id,H=I.dataset.ssh_url,q=I.dataset.github_url,K=I.s3_config,V=I.dataset.s3_prefix,Z=I.upload_urls||{},Y.succeed(`Sandbox dataset created: ${W.cyan(G)}`),console.log(W.gray(` GitHub: ${q}`)),await new Promise((w)=>setTimeout(w,1e4))}catch(I){if(Y.fail("Failed to create sandbox dataset"),I instanceof u)console.log(W.red(` ${I.message}`));else console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`));v1(X);return}let A=C("Accepting GitHub repository invitation...").start(),U=q?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),L=U?U[1].replace(/\.git$/,""):null;if(!L){A.fail("Invalid GitHub repository URL from backend"),console.log(W.red(` Received: ${q||"(empty)"}`)),console.log(W.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),v1(X);return}let M=await d$(L);if(M.accepted)if(M.alreadyCollaborator)A.succeed("Already a collaborator on this repository");else A.succeed("GitHub invitation accepted");else A.warn("Could not auto-accept invitation"),console.log(W.yellow(` ${M.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(W.cyan(` https://github.com/${L}/invitations`)),console.log();console.log(),console.log(W.bold("Step 4/6: Initializing repository..."));let N=C("Setting up git-annex...").start(),O=D.username&&D.email?{name:D.username,email:D.email}:void 0;try{await u$(X,{author:O}),await m$(X),await p$(X,H),N.succeed("Repository initialized")}catch(I){N.fail("Failed to initialize repository"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}if(console.log(),console.log(W.bold("Step 5/6: Uploading to S3...")),Object.keys(Z).length===0)console.log(W.yellow(" No data files to upload (metadata only)"));else{let I=C("Uploading test data...").start();try{let c=0,GD=Object.keys(Z).length,S=await c$(X,Z,{jobs:4,onProgress:(JD)=>{if(JD.status==="completed"||JD.status==="failed")c++,I.text=`Uploading... ${c}/${GD} files`}});if(S.failed.length>0){I.fail(`Upload failed for ${S.failed.length} file(s)`);for(let JD of S.failed)console.log(W.red(` Failed: ${JD}`));if(S.error)console.log(W.red(` Error: ${S.error}`));console.log(),console.log(W.yellow("Sandbox training aborted due to upload failures.")),console.log(W.gray("Please check your network connection and try again.")),v1(X);return}I.succeed(`Uploaded ${S.uploaded} file(s)`)}catch(c){I.fail("Upload failed"),console.log(W.red(` ${c instanceof Error?c.message:"Unknown error"}`)),v1(X);return}let w=C("Registering file URLs...").start();try{let c={};for(let S of Object.keys(Z))c[S]=`${K.public_url}/${V}/objects/${S}`;let GD=await n$(X,c);if(!GD.success){w.fail(`URL registration failed for ${GD.failed.length} file(s)`);for(let S of GD.failed)console.log(W.red(` Failed: ${S}`));console.log(),console.log(W.yellow("Sandbox training aborted due to URL registration failures.")),console.log(W.gray("This may indicate a git-annex configuration issue.")),v1(X);return}w.succeed(`Registered ${GD.registered} file URLs`)}catch(c){w.fail("Failed to register URLs"),console.log(W.red(` ${c instanceof Error?c.message:"Unknown error"}`)),v1(X);return}}console.log(),console.log(W.bold("Step 6/6: Pushing to GitHub..."));let g=C("Saving and pushing...").start();try{await j5(X,"Initial sandbox training upload",O),await T5(X),g.succeed("Pushed to GitHub")}catch(I){g.fail("Failed to push to GitHub"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}let j=C("Finalizing...").start();try{await h$(G),await Qy(G),R0("sandboxCompleted",!0),R0("sandboxDatasetId",G),j.succeed("Sandbox training complete!")}catch(I){j.fail("Failed to finalize"),console.log(W.red(` ${I instanceof Error?I.message:"Unknown error"}`)),v1(X);return}v1(X),console.log(),console.log(W.green.bold("Congratulations! Sandbox training completed successfully.")),console.log(),console.log("Your setup is verified and you're ready to upload real datasets:"),console.log(W.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(W.gray(`Sandbox dataset: ${G}`))}BB.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(D)=>{if(!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}if(D.refresh){let F=C("Checking status...").start();try{let $=await Yy();if(R0("sandboxCompleted",$.sandbox_completed),$.sandbox_dataset_id)R0("sandboxDatasetId",$.sandbox_dataset_id);if(F.stop(),$.sandbox_completed){if(console.log(W.green("Sandbox training: Completed")),console.log(W.gray(` Dataset ID: ${$.sandbox_dataset_id}`)),$.sandbox_completed_at)console.log(W.gray(` Completed: ${$.sandbox_completed_at}`))}else console.log(W.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(W.cyan(" nemar sandbox"))}catch($){if(F.fail("Failed to check status"),$ instanceof u)console.log(W.red(` ${$.message}`))}}else{let F=Y0();if(F.sandboxCompleted)console.log(W.green("Sandbox training: Completed")),console.log(W.gray(` Dataset ID: ${F.sandboxDatasetId}`));else console.log(W.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(W.cyan(" nemar sandbox"))}});BB.command("reset").description("Reset sandbox training status for re-training").option(yD,xD).option(lD,dD).action(async(D)=>{if(!vD()){console.log(W.red("Not authenticated")),console.log(W.gray("Run 'nemar auth login' first"));return}if(!Y0().sandboxCompleted){console.log(W.yellow("Sandbox training not yet completed")),console.log(W.gray("Nothing to reset"));return}let $=await OD("Reset sandbox training status? You will need to complete training again.",D);if($!=="confirmed"){console.log(W.gray($==="declined"?"Skipped":"Cancelled"));return}let B=C("Resetting sandbox status...").start();try{await Xy(),h2("sandboxCompleted"),h2("sandboxDatasetId"),B.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(W.cyan(" nemar sandbox"))}catch(J){if(B.fail("Failed to reset"),J instanceof u)console.log(W.red(` ${J.message}`));else console.log(W.red(` ${J instanceof Error?J.message:"Unknown error"}`))}});var Qx={name:"nemar-cli",version:"0.5.0-dev.252",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit",prepublishOnly:"bun run build","docs:generate":"bun run scripts/generate-docs.ts","docs:serve":"mkdocs serve","docs:build":"mkdocs build"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"MIT",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://nemar-cli.pages.dev",engines:{bun:">=1.0.0"},files:["dist","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1",inquirer:"^9.2.15",ora:"^8.0.1",zod:"^3.23.8"},devDependencies:{"@biomejs/biome":"1.9.4","@types/bcryptjs":"^3.0.0","@types/bun":"latest","@types/inquirer":"^9.0.7",bcryptjs:"^3.0.3",typescript:"^5.5.4"}};var Xx=Qx.version;var y1=new H0;y1.name("nemar").description(`CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource)
719
743
 
720
744
  NEMAR is a curated repository for neurophysiology data in BIDS format.
721
745
  This CLI provides tools for uploading, downloading, and managing datasets.`).version(Xx,"-v, --version","Output the current version").option("--no-color","Disable colored output").option("--verbose","Enable verbose output").addHelpText("after",`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nemar-cli",
3
- "version": "0.5.0-dev.250",
3
+ "version": "0.5.0-dev.252",
4
4
  "description": "CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",