nemar-cli 0.3.7-dev.84 → 0.3.7-dev.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -88,7 +88,7 @@ ${uN.default.cursorShow}`)}releaseCursor(){if(this.extraLinesUnderPrompt>0)XQ(th
|
|
|
88
88
|
${F}`,c1D=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),n1D=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),i1D=(D,F,$)=>{let B=$===""?"":`with ${$.trim()}() `,J=p1D.bind(null,B,F.toString());Object.defineProperty(J,"name",n1D);let{writable:Q,enumerable:Y,configurable:X}=c1D;Object.defineProperty(D,"toString",{value:J,writable:Q,enumerable:Y,configurable:X})};function z3(D,F,{ignoreNonConfigurable:$=!1}={}){let{name:B}=D;for(let J of Reflect.ownKeys(F))m1D(D,F,J,$);return d1D(D,F),i1D(D,F,B),D}var s9=new WeakMap,bR=(D,F={})=>{if(typeof D!=="function")throw TypeError("Expected a function");let $,B=0,J=D.displayName||D.name||"<anonymous>",Q=function(...Y){if(s9.set(Q,++B),B===1)$=D.apply(this,Y),D=void 0;else if(F.throw===!0)throw Error(`Function \`${J}\` can only be called once`);return $};return z3(Q,D),s9.set(Q,B),Q};bR.callCount=(D)=>{if(!s9.has(D))throw Error(`The given function \`${D.name}\` is not wrapped by the \`onetime\` package`);return s9.get(D)};var uR=bR;var A6=[];A6.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")A6.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")A6.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var r9=(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",QY=Symbol.for("signal-exit emitter"),YY=globalThis,a1D=Object.defineProperty.bind(Object);class mR{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(YY[QY])return YY[QY];a1D(YY,QY,{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 EY{}var o1D=(D)=>{return{onExit(F,$){return D.onExit(F,$)},load(){return D.load()},unload(){return D.unload()}}};class lR extends EY{onExit(){return()=>{}}load(){}unload(){}}class dR extends EY{#$=XY.platform==="win32"?"SIGINT":"SIGHUP";#F=new mR;#D;#J;#q;#B={};#Y=!1;constructor(D){super();this.#D=D,this.#B={};for(let F of A6)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),Y=F==="SIGHUP"?this.#$:F;if(!Q)D.kill(D.pid,Y)}};this.#q=D.reallyExit,this.#J=D.emit}onExit(D,F){if(!r9(this.#D))return()=>{};if(this.#Y===!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.#Y)return;this.#Y=!0,this.#F.count+=1;for(let D of A6)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.#Y)return;this.#Y=!1,A6.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.#q,this.#F.count-=1}#Q(D){if(!r9(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#q.call(this.#D,this.#D.exitCode)}#K(D,...F){let $=this.#J;if(D==="exit"&&r9(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 XY=globalThis.process,{onExit:pR,load:tVD,unload:eVD}=o1D(r9(XY)?new dR(XY):new lR);var cR=t9.stderr.isTTY?t9.stderr:t9.stdout.isTTY?t9.stdout:void 0,s1D=cR?uR(()=>{pR(()=>{cR.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},nR=s1D;var e9=!1,h4={};h4.show=(D=iR.stderr)=>{if(!D.isTTY)return;e9=!1,D.write("\x1B[?25h")};h4.hide=(D=iR.stderr)=>{if(!D.isTTY)return;nR(),e9=!0,D.write("\x1B[?25l")};h4.toggle=(D,F)=>{if(D!==void 0)e9=D;if(e9)h4.show(F);else h4.hide(F)};var GY=h4;var Z3=b(a5(),1);import o0 from"process";function HY(){if(o0.platform!=="win32")return o0.env.TERM!=="linux";return Boolean(o0.env.CI)||Boolean(o0.env.WT_SESSION)||Boolean(o0.env.TERMINUS_SUBLIME)||o0.env.ConEmuTask==="{cmd::Cmder}"||o0.env.TERM_PROGRAM==="Terminus-Sublime"||o0.env.TERM_PROGRAM==="vscode"||o0.env.TERM==="xterm-256color"||o0.env.TERM==="alacritty"||o0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var r1D={info:z.blue("\u2139"),success:z.green("\u2714"),warning:z.yellow("\u26A0"),error:z.red("\u2716")},t1D={info:z.blue("i"),success:z.green("\u221A"),warning:z.yellow("\u203C"),error:z.red("\xD7")},e1D=HY()?r1D:t1D,V3=e1D;function WY({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 D8D=WY();function A3(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(D8D,"")}function aR(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 oR(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function sR(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 F8D(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function rR(D,{ambiguousAsWide:F=!1}={}){if(F8D(D),oR(D)||sR(D)||F&&aR(D))return 2;return 1}var tR=()=>{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 $8D=new Intl.Segmenter,B8D=/^\p{Default_Ignorable_Code_Point}$/u;function qY(D,F={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:$=!0,countAnsiEscapeCodes:B=!1}=F;if(!B)D=A3(D);if(D.length===0)return 0;let J=0,Q={ambiguousAsWide:!$};for(let{segment:Y}of $8D.segment(D)){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159)continue;if(X>=8203&&X<=8207||X===65279)continue;if(X>=768&&X<=879||X>=6832&&X<=6911||X>=7616&&X<=7679||X>=8400&&X<=8447||X>=65056&&X<=65071)continue;if(X>=55296&&X<=57343)continue;if(X>=65024&&X<=65039)continue;if(B8D.test(Y))continue;if(tR().test(Y)){J+=2;continue}J+=rR(X,Q)}return J}function KY({stream:D=process.stdout}={}){return Boolean(D&&D.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import eR from"process";function zY(){let{env:D}=eR,{TERM:F,TERM_PROGRAM:$}=D;if(eR.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 P1 from"process";var J8D=3;class DI{#$=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(P1.platform==="win32"||!P1.stdin.isTTY)return;P1.stdin.setRawMode(!0),P1.stdin.on("data",this.#J),P1.stdin.resume()}#D(){if(!P1.stdin.isTTY)return;P1.stdin.off("data",this.#J),P1.stdin.pause(),P1.stdin.setRawMode(!1)}#J(D){if(D[0]===J8D)P1.emit("SIGINT")}}var Q8D=new DI,VY=Q8D;var Y8D=b(a5(),1);class FI{#$=0;#F=!1;#D=0;#J=-1;#q=0;#B;#Y;#Q;#K;#V;#G;#H;#W;#A;#X;#E;color;constructor(D){if(typeof D==="string")D={text:D};if(this.#B={color:"cyan",stream:D7.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.#G=typeof this.#B.isEnabled==="boolean"?this.#B.isEnabled:KY({stream:this.#Q}),this.#H=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,D7.env.NODE_ENV==="test")this._stream=this.#Q,this._isEnabled=this.#G,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.#W}set indent(D=0){if(!(D>=0&&Number.isInteger(D)))throw Error("The `indent` option must be an integer from 0 and up");this.#W=D,this.#z()}get interval(){return this.#V??this.#Y.interval??100}get spinner(){return this.#Y}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.#Y=D}else if(!zY())this.#Y=Z3.default.line;else if(D===void 0)this.#Y=Z3.default.dots;else if(D!=="default"&&Z3.default[D])this.#Y=Z3.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.#A}set text(D=""){this.#A=D,this.#z()}get prefixText(){return this.#X}set prefixText(D=""){this.#X=D,this.#z()}get suffixText(){return this.#E}set suffixText(D=""){this.#E=D,this.#z()}get isSpinning(){return this.#K!==void 0}#Z(D=this.#X,F=" "){if(typeof D==="string"&&D!=="")return D+F;if(typeof D==="function")return D()+F;return""}#U(D=this.#E,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.#Z(this.#X,"-"),$=this.#U(this.#E,"-"),B=" ".repeat(this.#W)+F+"--"+this.#A+"--"+$;this.#D=0;for(let J of A3(B).split(`
|
|
89
89
|
`))this.#D+=Math.max(1,Math.ceil(qY(J,{countAnsiEscapeCodes:!0})/D))}get isEnabled(){return this.#G&&!this.#H}set isEnabled(D){if(typeof D!=="boolean")throw TypeError("The `isEnabled` option must be a boolean");this.#G=D}get isSilent(){return this.#H}set isSilent(D){if(typeof D!=="boolean")throw TypeError("The `isSilent` option must be a boolean");this.#H=D}frame(){let D=Date.now();if(this.#J===-1||D-this.#q>=this.interval)this.#J=++this.#J%this.#Y.frames.length,this.#q=D;let{frames:F}=this.#Y,$=F[this.#J];if(this.color)$=z[this.color]($);let B=typeof this.#X==="string"&&this.#X!==""?this.#X+" ":"",J=typeof this.text==="string"?" "+this.text:"",Q=typeof this.#E==="string"&&this.#E!==""?" "+this.#E:"";return B+$+J+Q}clear(){if(!this.#G||!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.#W||this.lastIndent!==this.#W)this.#Q.cursorTo(this.#W);return this.lastIndent=this.#W,this.#$=0,this}render(){if(this.#H)return this;return this.clear(),this.#Q.write(this.frame()),this.#$=this.#D,this}start(D){if(D)this.text=D;if(this.#H)return this;if(!this.#G){if(this.text)this.#Q.write(`- ${this.text}
|
|
90
90
|
`);return this}if(this.isSpinning)return this;if(this.#B.hideCursor)GY.hide(this.#Q);if(this.#B.discardStdin&&D7.stdin.isTTY)this.#F=!0,VY.start();return this.render(),this.#K=setInterval(this.render.bind(this),this.interval),this}stop(){if(!this.#G)return this;if(clearInterval(this.#K),this.#K=void 0,this.#J=0,this.clear(),this.#B.hideCursor)GY.show(this.#Q);if(this.#B.discardStdin&&D7.stdin.isTTY&&this.#F)VY.stop(),this.#F=!1;return this}succeed(D){return this.stopAndPersist({symbol:V3.success,text:D})}fail(D){return this.stopAndPersist({symbol:V3.error,text:D})}warn(D){return this.stopAndPersist({symbol:V3.warning,text:D})}info(D){return this.stopAndPersist({symbol:V3.info,text:D})}stopAndPersist(D={}){if(this.#H)return this;let F=D.prefixText??this.#X,$=this.#Z(F," "),B=D.symbol??" ",J=D.text??this.text,Y=typeof J==="string"?(B?" ":"")+J:"",X=D.suffixText??this.#E,E=this.#U(X," "),G=$+B+Y+E+`
|
|
91
|
-
`;return this.stop(),this.#Q.write(G),this}}function k(D){return new FI(D)}import{isDeepStrictEqual as FXD}from"util";import kk from"process";import T6 from"fs";import vk from"path";import e3 from"crypto";import $XD from"assert";var Z6=(D)=>{let F=typeof D;return D!==null&&(F==="object"||F==="function")};var AY=new Set(["__proto__","prototype","constructor"]),X8D=new Set("0123456789");function F7(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(AY.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(AY.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"&&!X8D.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(AY.has($))return[];F.push($);break}case"index":throw Error("Index was not closed");case"start":{F.push("");break}}return F}function ZY(D,F){if(typeof F!=="number"&&Array.isArray(D)){let $=Number.parseInt(F,10);return Number.isInteger($)&&D[$]===D[F]}return!1}function $I(D,F){if(ZY(D,F))throw Error("Cannot use string index")}function BI(D,F,$){if(!Z6(D)||typeof F!=="string")return $===void 0?D:$;let B=F7(F);if(B.length===0)return $;for(let J=0;J<B.length;J++){let Q=B[J];if(ZY(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 UY(D,F,$){if(!Z6(D)||typeof F!=="string")return D;let B=D,J=F7(F);for(let Q=0;Q<J.length;Q++){let Y=J[Q];if($I(D,Y),Q===J.length-1)D[Y]=$;else if(!Z6(D[Y]))D[Y]=typeof J[Q+1]==="number"?[]:{};D=D[Y]}return B}function JI(D,F){if(!Z6(D)||typeof F!=="string")return!1;let $=F7(F);for(let B=0;B<$.length;B++){let J=$[B];if($I(D,J),B===$.length-1)return delete D[J],!0;if(D=D[J],!Z6(D))return!1}}function QI(D,F){if(!Z6(D)||typeof F!=="string")return!1;let $=F7(F);if($.length===0)return!1;for(let B of $){if(!Z6(D)||!(B in D)||ZY(D,B))return!1;D=D[B]}return!0}import OD from"path";import YI from"os";import LY from"process";var f8=YI.homedir(),MY=YI.tmpdir(),{env:b4}=LY,E8D=(D)=>{let F=OD.join(f8,"Library");return{data:OD.join(F,"Application Support",D),config:OD.join(F,"Preferences",D),cache:OD.join(F,"Caches",D),log:OD.join(F,"Logs",D),temp:OD.join(MY,D)}},G8D=(D)=>{let F=b4.APPDATA||OD.join(f8,"AppData","Roaming"),$=b4.LOCALAPPDATA||OD.join(f8,"AppData","Local");return{data:OD.join($,D,"Data"),config:OD.join(F,D,"Config"),cache:OD.join($,D,"Cache"),log:OD.join($,D,"Log"),temp:OD.join(MY,D)}},H8D=(D)=>{let F=OD.basename(f8);return{data:OD.join(b4.XDG_DATA_HOME||OD.join(f8,".local","share"),D),config:OD.join(b4.XDG_CONFIG_HOME||OD.join(f8,".config"),D),cache:OD.join(b4.XDG_CACHE_HOME||OD.join(f8,".cache"),D),log:OD.join(b4.XDG_STATE_HOME||OD.join(f8,".local","state"),D),temp:OD.join(MY,F,D)}};function NY(D,{suffix:F="nodejs"}={}){if(typeof D!=="string")throw TypeError(`Expected a string, got ${typeof D}`);if(F)D+=`-${F}`;if(LY.platform==="darwin")return E8D(D);if(LY.platform==="win32")return G8D(D);return H8D(D)}import U8D from"path";import ED from"fs";import{promisify as oD}from"util";var W8D=(D,F)=>{let{onError:$}=F;return function(...J){return D.apply(void 0,J).catch($)}},S1=W8D;var q8D=(D,F)=>{let{onError:$}=F;return function(...J){try{return D.apply(void 0,J)}catch(Q){return $(Q)}}},s0=q8D;var XI=250;var K8D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,Y=J.interval??XI,X=Date.now()+Q;return function E(...G){return D.apply(void 0,G).catch((H)=>{if(!$(H))throw H;if(Date.now()>=X)throw H;let q=Math.round(Y*Math.random());if(q>0)return new Promise((A)=>setTimeout(A,q)).then(()=>E.apply(void 0,G));else return E.apply(void 0,G)})}}},k1=K8D;var z8D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,Y=Date.now()+Q;return function(...E){while(!0)try{return D.apply(void 0,E)}catch(G){if(!$(G))throw G;if(Date.now()>=Y)throw G;continue}}}},v1=z8D;import GI from"process";var U3={isChangeErrorOk:(D)=>{if(!U3.isNodeError(D))return!1;let{code:F}=D;if(F==="ENOSYS")return!0;if(!EI&&(F==="EINVAL"||F==="EPERM"))return!0;return!1},isNodeError:(D)=>{return D instanceof Error},isRetriableError:(D)=>{if(!U3.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(!U3.isNodeError(D))throw D;if(U3.isChangeErrorOk(D))return;throw D}},CY=U3;var L3={onError:CY.onChangeError},H0={onError:()=>{return}},EI=GI.getuid?!GI.getuid():!1,pD={isRetriable:CY.isRetriableError};var V8D={attempt:{chmod:S1(oD(ED.chmod),L3),chown:S1(oD(ED.chown),L3),close:S1(oD(ED.close),H0),fsync:S1(oD(ED.fsync),H0),mkdir:S1(oD(ED.mkdir),H0),realpath:S1(oD(ED.realpath),H0),stat:S1(oD(ED.stat),H0),unlink:S1(oD(ED.unlink),H0),chmodSync:s0(ED.chmodSync,L3),chownSync:s0(ED.chownSync,L3),closeSync:s0(ED.closeSync,H0),existsSync:s0(ED.existsSync,H0),fsyncSync:s0(ED.fsync,H0),mkdirSync:s0(ED.mkdirSync,H0),realpathSync:s0(ED.realpathSync,H0),statSync:s0(ED.statSync,H0),unlinkSync:s0(ED.unlinkSync,H0)},retry:{close:k1(oD(ED.close),pD),fsync:k1(oD(ED.fsync),pD),open:k1(oD(ED.open),pD),readFile:k1(oD(ED.readFile),pD),rename:k1(oD(ED.rename),pD),stat:k1(oD(ED.stat),pD),write:k1(oD(ED.write),pD),writeFile:k1(oD(ED.writeFile),pD),closeSync:v1(ED.closeSync,pD),fsyncSync:v1(ED.fsyncSync,pD),openSync:v1(ED.openSync,pD),readFileSync:v1(ED.readFileSync,pD),renameSync:v1(ED.renameSync,pD),statSync:v1(ED.statSync,pD),writeSync:v1(ED.writeSync,pD),writeFileSync:v1(ED.writeFileSync,pD)}},fD=V8D;import U6 from"process";var HI="utf8",RY=438,WI=511;var qI={},KI=U6.geteuid?U6.geteuid():-1,zI=U6.getegid?U6.getegid():-1;var VI=1000,AI=!!U6.getuid,zZD=U6.getuid?!U6.getuid():!1,IY=128;var ZI=(D)=>{return D instanceof Error&&"code"in D};var wY=(D)=>{return typeof D==="string"},$7=(D)=>{return D===void 0};import Z8D from"path";import u4 from"process";import UI from"process";var LI=UI.platform==="linux",B7=UI.platform==="win32";var OY=["SIGHUP","SIGINT","SIGTERM"];if(!B7)OY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(LI)OY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var MI=OY;class NI{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(B7&&(D!=="SIGINT"&&D!=="SIGTERM"&&D!=="SIGKILL"))u4.kill(u4.pid,"SIGTERM");else u4.kill(u4.pid,D)},this.hook=()=>{u4.once("exit",()=>this.exit());for(let D of MI)try{u4.once(D,()=>this.exit(D))}catch{}},this.register=(D)=>{return this.callbacks.add(D),()=>{this.callbacks.delete(D)}},this.hook()}}var CI=new NI;var A8D=CI.register,RI=A8D;var N0={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=N0.truncate(F(D));if(B in N0.store)return N0.get(D,F,$);return N0.store[B]=$,[B,()=>delete N0.store[B]]},purge:(D)=>{if(!N0.store[D])return;delete N0.store[D],fD.attempt.unlink(D)},purgeSync:(D)=>{if(!N0.store[D])return;delete N0.store[D],fD.attempt.unlinkSync(D)},purgeSyncAll:()=>{for(let D in N0.store)N0.purgeSync(D)},truncate:(D)=>{let F=Z8D.basename(D);if(F.length<=IY)return D;let $=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(F);if(!$)return D;let B=F.length-IY;return`${D.slice(0,-F.length)}${$[1]}${$[2].slice(0,-B)}${$[3]}`}};RI(N0.purgeSyncAll);var M3=N0;function TY(D,F,$=qI){if(wY($))return TY(D,F,{encoding:$});let J={timeout:$.timeout??VI},Q=null,Y=null,X=null;try{let E=fD.attempt.realpathSync(D),G=!!E;D=E||D,[Y,Q]=M3.get(D,$.tmpCreate||M3.create,$.tmpPurge!==!1);let H=AI&&$7($.chown),q=$7($.mode);if(G&&(H||q)){let V=fD.attempt.statSync(D);if(V){if($={...$},H)$.chown={uid:V.uid,gid:V.gid};if(q)$.mode=V.mode}}if(!G){let V=U8D.dirname(D);fD.attempt.mkdirSync(V,{mode:WI,recursive:!0})}if(X=fD.retry.openSync(J)(Y,"w",$.mode||RY),$.tmpCreated)$.tmpCreated(Y);if(wY(F))fD.retry.writeSync(J)(X,F,0,$.encoding||HI);else if(!$7(F))fD.retry.writeSync(J)(X,F,0,F.length,0);if($.fsync!==!1)if($.fsyncWait!==!1)fD.retry.fsyncSync(J)(X);else fD.attempt.fsync(X);if(fD.retry.closeSync(J)(X),X=null,$.chown&&($.chown.uid!==KI||$.chown.gid!==zI))fD.attempt.chownSync(Y,$.chown.uid,$.chown.gid);if($.mode&&$.mode!==RY)fD.attempt.chmodSync(Y,$.mode);try{fD.retry.renameSync(J)(Y,D)}catch(V){if(!ZI(V))throw V;if(V.code!=="ENAMETOOLONG")throw V;fD.retry.renameSync(J)(Y,M3.truncate(D))}Q(),Y=null}finally{if(X)fD.attempt.closeSync(X);if(Y)M3.purge(Y)}}var xk=b(VP(),1),_k=b(gP(),1);var FJD=(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 Y,X,E,G=function(...H){let q=this,V=()=>{if(Y=void 0,X)clearTimeout(X),X=void 0;if(Q)E=D.apply(q,H)},A=()=>{if(X=void 0,Y)clearTimeout(Y),Y=void 0;if(Q)E=D.apply(q,H)},Z=J&&!Y;if(clearTimeout(Y),Y=setTimeout(V,$),B>0&&B!==Number.POSITIVE_INFINITY&&!X)X=setTimeout(A,B);if(Z)E=D.apply(q,H);return E};return z3(G,D),G.cancel=()=>{if(Y)clearTimeout(Y),Y=void 0;if(X)clearTimeout(X),X=void 0},G},lX=FJD;var j6=b(Tk(),1);var aYD=Object.prototype.toString;function Pk(D,F,$){if(!D)return!1;if(D.constructor===F)return!0;return aYD.call(D)===$}function Sk(D){return Pk(D,Uint8Array,"[object Uint8Array]")}function oYD(D){return Pk(D,ArrayBuffer,"[object ArrayBuffer]")}function sYD(D){return Sk(D)||oYD(D)}function rYD(D){if(!Sk(D))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof D}\``)}function tYD(D){if(!sYD(D))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof D}\``)}function J2(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)rYD(J),$.set(J,B),B+=J.length;return $}var jk={utf8:new globalThis.TextDecoder("utf8")};function Q2(D,F="utf8"){return tYD(D),jk[F]??=new globalThis.TextDecoder(F),jk[F].decode(D)}function eYD(D){if(typeof D!=="string")throw TypeError(`Expected \`string\`, got \`${typeof D}\``)}var DXD=new globalThis.TextEncoder;function F$(D){return eYD(D),DXD.encode(D)}var DND=Array.from({length:256},(D,F)=>F.toString(16).padStart(2,"0"));var BXD=_k.default.default,yk="aes-256-cbc",$F=()=>Object.create(null),JXD=(D)=>D!==void 0&&D!==null,QXD=(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`)},$$="__internal__",Y2=`${$$}.migrations.version`;class B${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=NY(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 xk.Ajv2020({allErrors:!0,useDefaults:!0,...F.ajvOptions});BXD(Q);let Y={...F.rootSchema,type:"object",properties:F.schema};this.#$=Q.compile(Y);for(let[X,E]of Object.entries(F.schema??{}))if(E?.default)this.#J[X]=E.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=vk.resolve(F.cwd,`${F.configName??"config"}${$}`);let B=this.store,J=Object.assign($F(),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{$XD.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 ${$$} key, as it's used to manage this module internal operations.`);let{store:$}=this,B=(J,Q)=>{if(QXD(J,Q),this.#D.accessPropertiesByDotNotation)UY($,J,Q);else $[J]=Q};if(typeof D==="object"){let J=D;for(let[Q,Y]of Object.entries(J))B(Q,Y)}else B(D,F);this.store=$}has(D){if(this.#D.accessPropertiesByDotNotation)return QI(this.store,D);return D in this.store}reset(...D){for(let F of D)if(JXD(this.#J[F]))this.set(F,this.#J[F])}delete(D){let{store:F}=this;if(this.#D.accessPropertiesByDotNotation)JI(F,D);else delete F[D];this.store=F}clear(){this.store=$F();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=T6.readFileSync(this.path,this.#F?null:"utf8"),F=this._encryptData(D),$=this._deserialize(F);return this._validate($),Object.assign($F(),$)}catch(D){if(D?.code==="ENOENT")return this._ensureDirectory(),$F();if(this.#D.clearInvalidConfig&&D.name==="SyntaxError")return $F();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:Q2(D);try{let F=D.slice(0,16),$=e3.pbkdf2Sync(this.#F,F.toString(),1e4,32,"sha512"),B=e3.createDecipheriv(yk,$,F),J=D.slice(17),Q=typeof J==="string"?F$(J):J;return Q2(J2([B.update(Q),B.final()]))}catch{}return D.toString()}_handleChange(D,F){let $=D(),B=()=>{let J=$,Q=D();if(FXD(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(){T6.mkdirSync(vk.dirname(this.path),{recursive:!0})}_write(D){let F=this._serialize(D);if(this.#F){let $=e3.randomBytes(16),B=e3.pbkdf2Sync(this.#F,$.toString(),1e4,32,"sha512"),J=e3.createCipheriv(yk,B,$);F=J2([$,F$(":"),J.update(F$(F)),J.final()])}if(kk.env.SNAP)T6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});else try{TY(this.path,F,{mode:this.#D.configFileMode})}catch($){if($?.code==="EXDEV"){T6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});return}throw $}}_watch(){if(this._ensureDirectory(),!T6.existsSync(this.path))this._write($F());if(kk.platform==="win32")T6.watch(this.path,{persistent:!1},lX(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else T6.watchFile(this.path,{persistent:!1},lX(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(D,F,$){let B=this._get(Y2,"0.0.0"),J=Object.keys(D).filter((Y)=>this._shouldPerformMigration(Y,B,F)),Q={...this.store};for(let Y of J)try{if($)$(this,{fromVersion:B,toVersion:Y,finalVersion:F,versions:J});let X=D[Y];X?.(this),this._set(Y2,Y),B=Y,Q={...this.store}}catch(X){throw this.store=Q,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${X}`)}if(this._isVersionInRangeFormat(B)||!j6.default.eq(B,F))this._set(Y2,F)}_containsReservedKey(D){if(typeof D==="object"){if(Object.keys(D)[0]===$$)return!0}if(typeof D!=="string")return!1;if(this.#D.accessPropertiesByDotNotation){if(D.startsWith(`${$$}.`))return!0;return!1}return!1}_isVersionInRangeFormat(D){return j6.default.clean(D)===null}_shouldPerformMigration(D,F,$){if(this._isVersionInRangeFormat(D)){if(F!=="0.0.0"&&j6.default.satisfies(F,D))return!1;return j6.default.satisfies($,D)}if(j6.default.lte(D,F))return!1;if(j6.default.gt(D,$))return!1;return!0}_get(D,F){return BI(this.store,D,F)}_set(D,F){let{store:$}=this;UY($,D,F),this.store=$}}var G1={};sv(G1,{void:()=>dXD,util:()=>DD,unknown:()=>mXD,union:()=>iXD,undefined:()=>hXD,tuple:()=>sXD,transformer:()=>Y2D,symbol:()=>gXD,string:()=>pk,strictObject:()=>nXD,setErrorMap:()=>EXD,set:()=>eXD,record:()=>rXD,quotelessJson:()=>YXD,promise:()=>Q2D,preprocess:()=>G2D,pipeline:()=>H2D,ostring:()=>W2D,optional:()=>X2D,onumber:()=>q2D,oboolean:()=>K2D,objectUtil:()=>X2,object:()=>cXD,number:()=>ck,nullable:()=>E2D,null:()=>bXD,never:()=>lXD,nativeEnum:()=>J2D,nan:()=>xXD,map:()=>tXD,makeIssue:()=>D5,literal:()=>$2D,lazy:()=>F2D,late:()=>vXD,isValid:()=>c8,isDirty:()=>Q$,isAsync:()=>JF,isAborted:()=>J$,intersection:()=>oXD,instanceof:()=>yXD,getParsedType:()=>g1,getErrorMap:()=>BF,function:()=>D2D,enum:()=>B2D,effect:()=>Y2D,discriminatedUnion:()=>aXD,defaultErrorMap:()=>F8,datetimeRegex:()=>mk,date:()=>fXD,custom:()=>dk,coerce:()=>z2D,boolean:()=>nk,bigint:()=>_XD,array:()=>pXD,any:()=>uXD,addIssueToContext:()=>w,ZodVoid:()=>$5,ZodUnknown:()=>n8,ZodUnion:()=>HF,ZodUndefined:()=>EF,ZodType:()=>r,ZodTuple:()=>b1,ZodTransformer:()=>E1,ZodSymbol:()=>F5,ZodString:()=>J1,ZodSet:()=>v6,ZodSchema:()=>r,ZodRecord:()=>B5,ZodReadonly:()=>ZF,ZodPromise:()=>y6,ZodPipeline:()=>Y5,ZodParsedType:()=>C,ZodOptional:()=>Y1,ZodObject:()=>TD,ZodNumber:()=>i8,ZodNullable:()=>B8,ZodNull:()=>GF,ZodNever:()=>h1,ZodNativeEnum:()=>zF,ZodNaN:()=>Q5,ZodMap:()=>J5,ZodLiteral:()=>KF,ZodLazy:()=>qF,ZodIssueCode:()=>N,ZodIntersection:()=>WF,ZodFunction:()=>YF,ZodFirstPartyTypeKind:()=>g,ZodError:()=>A0,ZodEnum:()=>o8,ZodEffects:()=>E1,ZodDiscriminatedUnion:()=>Y$,ZodDefault:()=>VF,ZodDate:()=>S6,ZodCatch:()=>AF,ZodBranded:()=>X$,ZodBoolean:()=>XF,ZodBigInt:()=>a8,ZodArray:()=>Q1,ZodAny:()=>k6,Schema:()=>r,ParseStatus:()=>nD,OK:()=>eD,NEVER:()=>V2D,INVALID:()=>f,EMPTY_PATH:()=>GXD,DIRTY:()=>P6,BRAND:()=>kXD});var DD;(function(D){D.assertEqual=(J)=>{};function F(J){}D.assertIs=F;function $(J){throw Error()}D.assertNever=$,D.arrayToEnum=(J)=>{let Q={};for(let Y of J)Q[Y]=Y;return Q},D.getValidEnumValues=(J)=>{let Q=D.objectKeys(J).filter((X)=>typeof J[J[X]]!=="number"),Y={};for(let X of Q)Y[X]=J[X];return D.objectValues(Y)},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 Y in J)if(Object.prototype.hasOwnProperty.call(J,Y))Q.push(Y);return Q},D.find=(J,Q)=>{for(let Y of J)if(Q(Y))return Y;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((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(Q)}D.joinValues=B,D.jsonStringifyReplacer=(J,Q)=>{if(typeof Q==="bigint")return Q.toString();return Q}})(DD||(DD={}));var X2;(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(X2||(X2={}));var C=DD.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),g1=(D)=>{switch(typeof D){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(D)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":if(Array.isArray(D))return C.array;if(D===null)return C.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return C.promise;if(typeof Map<"u"&&D instanceof Map)return C.map;if(typeof Set<"u"&&D instanceof Set)return C.set;if(typeof Date<"u"&&D instanceof Date)return C.date;return C.object;default:return C.unknown}};var N=DD.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"]),YXD=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class A0 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 Y=$,X=0;while(X<Q.path.length){let E=Q.path[X];if(X!==Q.path.length-1)Y[E]=Y[E]||{_errors:[]};else Y[E]=Y[E]||{_errors:[]},Y[E]._errors.push(F(Q));Y=Y[E],X++}}};return B(this),$}static assert(D){if(!(D instanceof A0))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,DD.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()}}A0.create=(D)=>{return new A0(D)};var XXD=(D,F)=>{let $;switch(D.code){case N.invalid_type:if(D.received===C.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case N.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,DD.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:$=`Unrecognized key(s) in object: ${DD.joinValues(D.keys,", ")}`;break;case N.invalid_union:$="Invalid input";break;case N.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${DD.joinValues(D.options)}`;break;case N.invalid_enum_value:$=`Invalid enum value. Expected ${DD.joinValues(D.options)}, received '${D.received}'`;break;case N.invalid_arguments:$="Invalid function arguments";break;case N.invalid_return_type:$="Invalid function return type";break;case N.invalid_date:$="Invalid date";break;case N.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 DD.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case N.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 N.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 N.custom:$="Invalid input";break;case N.invalid_intersection_types:$="Intersection results could not be merged";break;case N.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case N.not_finite:$="Number must be finite";break;default:$=F.defaultError,DD.assertNever(D)}return{message:$}},F8=XXD;var fk=F8;function EXD(D){fk=D}function BF(){return fk}var D5=(D)=>{let{data:F,path:$,errorMaps:B,issueData:J}=D,Q=[...$,...J.path||[]],Y={...J,path:Q};if(J.message!==void 0)return{...J,path:Q,message:J.message};let X="",E=B.filter((G)=>!!G).slice().reverse();for(let G of E)X=G(Y,{data:F,defaultError:X}).message;return{...J,path:Q,message:X}},GXD=[];function w(D,F){let $=BF(),B=D5({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===F8?void 0:F8].filter((J)=>!!J)});D.common.issues.push(B)}class nD{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 f;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 nD.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let B of F){let{key:J,value:Q}=B;if(J.status==="aborted")return f;if(Q.status==="aborted")return f;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 f=Object.freeze({status:"aborted"}),P6=(D)=>({status:"dirty",value:D}),eD=(D)=>({status:"valid",value:D}),J$=(D)=>D.status==="aborted",Q$=(D)=>D.status==="dirty",c8=(D)=>D.status==="valid",JF=(D)=>typeof Promise<"u"&&D instanceof Promise;var y;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(y||(y={}));class X1{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 gk=(D,F)=>{if(c8(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 A0(D.common.issues);return this._error=$,this._error}}}};function i(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:(Y,X)=>{let{message:E}=D;if(Y.code==="invalid_enum_value")return{message:E??X.defaultError};if(typeof X.data>"u")return{message:E??B??X.defaultError};if(Y.code!=="invalid_type")return{message:X.defaultError};return{message:E??$??X.defaultError}},description:J}}class r{get description(){return this._def.description}_getType(D){return g1(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:g1(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new nD,ctx:{common:D.parent.common,data:D.data,parsedType:g1(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(JF(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:g1(D)},B=this._parseSync({data:D,path:$.path,parent:$});return gk($,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:g1(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return c8($)?{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(($)=>c8($)?{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:g1(D)},B=this._parse({data:D,path:$.path,parent:$}),J=await(JF(B)?B:Promise.resolve(B));return gk($,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),Y=()=>J.addIssue({code:N.custom,...$(B)});if(typeof Promise<"u"&&Q instanceof Promise)return Q.then((X)=>{if(!X)return Y(),!1;else return!0});if(!Q)return Y(),!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 E1({schema:this,typeName:g.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 Y1.create(this,this._def)}nullable(){return B8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q1.create(this)}promise(){return y6.create(this,this._def)}or(D){return HF.create([this,D],this._def)}and(D){return WF.create(this,D,this._def)}transform(D){return new E1({...i(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new VF({...i(this._def),innerType:this,defaultValue:F,typeName:g.ZodDefault})}brand(){return new X$({typeName:g.ZodBranded,type:this,...i(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new AF({...i(this._def),innerType:this,catchValue:F,typeName:g.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return Y5.create(this,D)}readonly(){return ZF.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var HXD=/^c[^\s-]{8,}$/i,WXD=/^[0-9a-z]+$/,qXD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KXD=/^[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,zXD=/^[a-z0-9_-]{21}$/i,VXD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,AXD=/^[-+]?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)?)??$/,ZXD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UXD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",E2,LXD=/^(?:(?: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])$/,MXD=/^(?:(?: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])$/,NXD=/^(([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]))$/,CXD=/^(([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])$/,RXD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,IXD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bk="((\\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])))",wXD=new RegExp(`^${bk}$`);function uk(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 OXD(D){return new RegExp(`^${uk(D)}$`)}function mk(D){let F=`${bk}T${uk(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function TXD(D,F){if((F==="v4"||!F)&&LXD.test(D))return!0;if((F==="v6"||!F)&&NXD.test(D))return!0;return!1}function jXD(D,F){if(!VXD.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 PXD(D,F){if((F==="v4"||!F)&&MXD.test(D))return!0;if((F==="v6"||!F)&&CXD.test(D))return!0;return!1}class J1 extends r{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==C.string){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.string,received:J.parsedType}),f}let $=new nD,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),w(B,{code:N.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),w(B,{code:N.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,Y=D.data.length<J.value;if(Q||Y){if(B=this._getOrReturnCtx(D,B),Q)w(B,{code:N.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(Y)w(B,{code:N.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});$.dirty()}}else if(J.kind==="email"){if(!ZXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"email",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="emoji"){if(!E2)E2=new RegExp(UXD,"u");if(!E2.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"emoji",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="uuid"){if(!KXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"uuid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="nanoid"){if(!zXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"nanoid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid"){if(!HXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"cuid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid2"){if(!WXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"cuid2",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ulid"){if(!qXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"ulid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),w(B,{validation:"url",code:N.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),w(B,{validation:"regex",code:N.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),w(B,{code:N.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),w(B,{code:N.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),w(B,{code:N.invalid_string,validation:{endsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="datetime"){if(!mk(J).test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"datetime",message:J.message}),$.dirty()}else if(J.kind==="date"){if(!wXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"date",message:J.message}),$.dirty()}else if(J.kind==="time"){if(!OXD(J).test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"time",message:J.message}),$.dirty()}else if(J.kind==="duration"){if(!AXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"duration",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ip"){if(!TXD(D.data,J.version))B=this._getOrReturnCtx(D,B),w(B,{validation:"ip",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="jwt"){if(!jXD(D.data,J.alg))B=this._getOrReturnCtx(D,B),w(B,{validation:"jwt",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cidr"){if(!PXD(D.data,J.version))B=this._getOrReturnCtx(D,B),w(B,{validation:"cidr",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64"){if(!RXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"base64",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64url"){if(!IXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"base64url",code:N.invalid_string,message:J.message}),$.dirty()}else DD.assertNever(J);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((B)=>D.test(B),{validation:F,code:N.invalid_string,...y.errToObj($)})}_addCheck(D){return new J1({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...y.errToObj(D)})}url(D){return this._addCheck({kind:"url",...y.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...y.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...y.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...y.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...y.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...y.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...y.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...y.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...y.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...y.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...y.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...y.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,...y.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,...y.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...y.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...y.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...y.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...y.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...y.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...y.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...y.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...y.errToObj(F)})}nonempty(D){return this.min(1,y.errToObj(D))}trim(){return new J1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new J1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new J1({...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}}J1.create=(D)=>{return new J1({checks:[],typeName:g.ZodString,coerce:D?.coerce??!1,...i(D)})};function SXD(D,F){let $=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,J=$>B?$:B,Q=Number.parseInt(D.toFixed(J).replace(".","")),Y=Number.parseInt(F.toFixed(J).replace(".",""));return Q%Y/10**J}class i8 extends r{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)!==C.number){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.number,received:J.parsedType}),f}let $=void 0,B=new nD;for(let J of this._def.checks)if(J.kind==="int"){if(!DD.isInteger(D.data))$=this._getOrReturnCtx(D,$),w($,{code:N.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,$),w($,{code:N.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,$),w($,{code:N.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(SXD(D.data,J.value)!==0)$=this._getOrReturnCtx(D,$),w($,{code:N.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else if(J.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),w($,{code:N.not_finite,message:J.message}),B.dirty()}else DD.assertNever(J);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,y.toString(F))}gt(D,F){return this.setLimit("min",D,!1,y.toString(F))}lte(D,F){return this.setLimit("max",D,!0,y.toString(F))}lt(D,F){return this.setLimit("max",D,!1,y.toString(F))}setLimit(D,F,$,B){return new i8({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:y.toString(B)}]})}_addCheck(D){return new i8({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:y.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:y.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:y.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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"&&DD.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)}}i8.create=(D)=>{return new i8({checks:[],typeName:g.ZodNumber,coerce:D?.coerce||!1,...i(D)})};class a8 extends r{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)!==C.bigint)return this._getInvalidInput(D);let $=void 0,B=new nD;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,$),w($,{code:N.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,$),w($,{code:N.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,$),w($,{code:N.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else DD.assertNever(J);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return w(F,{code:N.invalid_type,expected:C.bigint,received:F.parsedType}),f}gte(D,F){return this.setLimit("min",D,!0,y.toString(F))}gt(D,F){return this.setLimit("min",D,!1,y.toString(F))}lte(D,F){return this.setLimit("max",D,!0,y.toString(F))}lt(D,F){return this.setLimit("max",D,!1,y.toString(F))}setLimit(D,F,$,B){return new a8({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:y.toString(B)}]})}_addCheck(D){return new a8({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:y.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}}a8.create=(D)=>{return new a8({checks:[],typeName:g.ZodBigInt,coerce:D?.coerce??!1,...i(D)})};class XF extends r{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==C.boolean){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.boolean,received:$.parsedType}),f}return eD(D.data)}}XF.create=(D)=>{return new XF({typeName:g.ZodBoolean,coerce:D?.coerce||!1,...i(D)})};class S6 extends r{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==C.date){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.date,received:J.parsedType}),f}if(Number.isNaN(D.data.getTime())){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_date}),f}let $=new nD,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),w(B,{code:N.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),w(B,{code:N.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),$.dirty()}else DD.assertNever(J);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new S6({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:y.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:y.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}}S6.create=(D)=>{return new S6({checks:[],coerce:D?.coerce||!1,typeName:g.ZodDate,...i(D)})};class F5 extends r{_parse(D){if(this._getType(D)!==C.symbol){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.symbol,received:$.parsedType}),f}return eD(D.data)}}F5.create=(D)=>{return new F5({typeName:g.ZodSymbol,...i(D)})};class EF extends r{_parse(D){if(this._getType(D)!==C.undefined){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.undefined,received:$.parsedType}),f}return eD(D.data)}}EF.create=(D)=>{return new EF({typeName:g.ZodUndefined,...i(D)})};class GF extends r{_parse(D){if(this._getType(D)!==C.null){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.null,received:$.parsedType}),f}return eD(D.data)}}GF.create=(D)=>{return new GF({typeName:g.ZodNull,...i(D)})};class k6 extends r{constructor(){super(...arguments);this._any=!0}_parse(D){return eD(D.data)}}k6.create=(D)=>{return new k6({typeName:g.ZodAny,...i(D)})};class n8 extends r{constructor(){super(...arguments);this._unknown=!0}_parse(D){return eD(D.data)}}n8.create=(D)=>{return new n8({typeName:g.ZodUnknown,...i(D)})};class h1 extends r{_parse(D){let F=this._getOrReturnCtx(D);return w(F,{code:N.invalid_type,expected:C.never,received:F.parsedType}),f}}h1.create=(D)=>{return new h1({typeName:g.ZodNever,...i(D)})};class $5 extends r{_parse(D){if(this._getType(D)!==C.undefined){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.void,received:$.parsedType}),f}return eD(D.data)}}$5.create=(D)=>{return new $5({typeName:g.ZodVoid,...i(D)})};class Q1 extends r{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),B=this._def;if(F.parsedType!==C.array)return w(F,{code:N.invalid_type,expected:C.array,received:F.parsedType}),f;if(B.exactLength!==null){let Q=F.data.length>B.exactLength.value,Y=F.data.length<B.exactLength.value;if(Q||Y)w(F,{code:Q?N.too_big:N.too_small,minimum:Y?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)w(F,{code:N.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)w(F,{code:N.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,Y)=>{return B.type._parseAsync(new X1(F,Q,F.path,Y))})).then((Q)=>{return nD.mergeArray($,Q)});let J=[...F.data].map((Q,Y)=>{return B.type._parseSync(new X1(F,Q,F.path,Y))});return nD.mergeArray($,J)}get element(){return this._def.type}min(D,F){return new Q1({...this._def,minLength:{value:D,message:y.toString(F)}})}max(D,F){return new Q1({...this._def,maxLength:{value:D,message:y.toString(F)}})}length(D,F){return new Q1({...this._def,exactLength:{value:D,message:y.toString(F)}})}nonempty(D){return this.min(1,D)}}Q1.create=(D,F)=>{return new Q1({type:D,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...i(F)})};function QF(D){if(D instanceof TD){let F={};for(let $ in D.shape){let B=D.shape[$];F[$]=Y1.create(QF(B))}return new TD({...D._def,shape:()=>F})}else if(D instanceof Q1)return new Q1({...D._def,type:QF(D.element)});else if(D instanceof Y1)return Y1.create(QF(D.unwrap()));else if(D instanceof B8)return B8.create(QF(D.unwrap()));else if(D instanceof b1)return b1.create(D.items.map((F)=>QF(F)));else return D}class TD extends r{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=DD.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==C.object){let E=this._getOrReturnCtx(D);return w(E,{code:N.invalid_type,expected:C.object,received:E.parsedType}),f}let{status:$,ctx:B}=this._processInputParams(D),{shape:J,keys:Q}=this._getCached(),Y=[];if(!(this._def.catchall instanceof h1&&this._def.unknownKeys==="strip")){for(let E in B.data)if(!Q.includes(E))Y.push(E)}let X=[];for(let E of Q){let G=J[E],H=B.data[E];X.push({key:{status:"valid",value:E},value:G._parse(new X1(B,H,B.path,E)),alwaysSet:E in B.data})}if(this._def.catchall instanceof h1){let E=this._def.unknownKeys;if(E==="passthrough")for(let G of Y)X.push({key:{status:"valid",value:G},value:{status:"valid",value:B.data[G]}});else if(E==="strict"){if(Y.length>0)w(B,{code:N.unrecognized_keys,keys:Y}),$.dirty()}else if(E==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let E=this._def.catchall;for(let G of Y){let H=B.data[G];X.push({key:{status:"valid",value:G},value:E._parse(new X1(B,H,B.path,G)),alwaysSet:G in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let E=[];for(let G of X){let H=await G.key,q=await G.value;E.push({key:H,value:q,alwaysSet:G.alwaysSet})}return E}).then((E)=>{return nD.mergeObjectSync($,E)});else return nD.mergeObjectSync($,X)}get shape(){return this._def.shape()}strict(D){return y.errToObj,new TD({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let B=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:y.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new TD({...this._def,unknownKeys:"strip"})}passthrough(){return new TD({...this._def,unknownKeys:"passthrough"})}extend(D){return new TD({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new TD({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:g.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new TD({...this._def,catchall:D})}pick(D){let F={};for(let $ of DD.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new TD({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of DD.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new TD({...this._def,shape:()=>F})}deepPartial(){return QF(this)}partial(D){let F={};for(let $ of DD.objectKeys(this.shape)){let B=this.shape[$];if(D&&!D[$])F[$]=B;else F[$]=B.optional()}return new TD({...this._def,shape:()=>F})}required(D){let F={};for(let $ of DD.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let J=this.shape[$];while(J instanceof Y1)J=J._def.innerType;F[$]=J}return new TD({...this._def,shape:()=>F})}keyof(){return lk(DD.objectKeys(this.shape))}}TD.create=(D,F)=>{return new TD({shape:()=>D,unknownKeys:"strip",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};TD.strictCreate=(D,F)=>{return new TD({shape:()=>D,unknownKeys:"strict",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};TD.lazycreate=(D,F)=>{return new TD({shape:D,unknownKeys:"strip",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};class HF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function B(J){for(let Y of J)if(Y.result.status==="valid")return Y.result;for(let Y of J)if(Y.result.status==="dirty")return F.common.issues.push(...Y.ctx.common.issues),Y.result;let Q=J.map((Y)=>new A0(Y.ctx.common.issues));return w(F,{code:N.invalid_union,unionErrors:Q}),f}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 X of $){let E={...F,common:{...F.common,issues:[]},parent:null},G=X._parseSync({data:F.data,path:F.path,parent:E});if(G.status==="valid")return G;else if(G.status==="dirty"&&!J)J={result:G,ctx:E};if(E.common.issues.length)Q.push(E.common.issues)}if(J)return F.common.issues.push(...J.ctx.common.issues),J.result;let Y=Q.map((X)=>new A0(X));return w(F,{code:N.invalid_union,unionErrors:Y}),f}}get options(){return this._def.options}}HF.create=(D,F)=>{return new HF({options:D,typeName:g.ZodUnion,...i(F)})};var $8=(D)=>{if(D instanceof qF)return $8(D.schema);else if(D instanceof E1)return $8(D.innerType());else if(D instanceof KF)return[D.value];else if(D instanceof o8)return D.options;else if(D instanceof zF)return DD.objectValues(D.enum);else if(D instanceof VF)return $8(D._def.innerType);else if(D instanceof EF)return[void 0];else if(D instanceof GF)return[null];else if(D instanceof Y1)return[void 0,...$8(D.unwrap())];else if(D instanceof B8)return[null,...$8(D.unwrap())];else if(D instanceof X$)return $8(D.unwrap());else if(D instanceof ZF)return $8(D.unwrap());else if(D instanceof AF)return $8(D._def.innerType);else return[]};class Y$ extends r{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.object)return w(F,{code:N.invalid_type,expected:C.object,received:F.parsedType}),f;let $=this.discriminator,B=F.data[$],J=this.optionsMap.get(B);if(!J)return w(F,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),f;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=$8(J.shape[D]);if(!Q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Y of Q){if(B.has(Y))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Y)}`);B.set(Y,J)}}return new Y$({typeName:g.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...i($)})}}function G2(D,F){let $=g1(D),B=g1(F);if(D===F)return{valid:!0,data:D};else if($===C.object&&B===C.object){let J=DD.objectKeys(F),Q=DD.objectKeys(D).filter((X)=>J.indexOf(X)!==-1),Y={...D,...F};for(let X of Q){let E=G2(D[X],F[X]);if(!E.valid)return{valid:!1};Y[X]=E.data}return{valid:!0,data:Y}}else if($===C.array&&B===C.array){if(D.length!==F.length)return{valid:!1};let J=[];for(let Q=0;Q<D.length;Q++){let Y=D[Q],X=F[Q],E=G2(Y,X);if(!E.valid)return{valid:!1};J.push(E.data)}return{valid:!0,data:J}}else if($===C.date&&B===C.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class WF extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=(J,Q)=>{if(J$(J)||J$(Q))return f;let Y=G2(J.value,Q.value);if(!Y.valid)return w($,{code:N.invalid_intersection_types}),f;if(Q$(J)||Q$(Q))F.dirty();return{status:F.value,value:Y.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:$}))}}WF.create=(D,F,$)=>{return new WF({left:D,right:F,typeName:g.ZodIntersection,...i($)})};class b1 extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.array)return w($,{code:N.invalid_type,expected:C.array,received:$.parsedType}),f;if($.data.length<this._def.items.length)return w($,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&$.data.length>this._def.items.length)w($,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let J=[...$.data].map((Q,Y)=>{let X=this._def.items[Y]||this._def.rest;if(!X)return null;return X._parse(new X1($,Q,$.path,Y))}).filter((Q)=>!!Q);if($.common.async)return Promise.all(J).then((Q)=>{return nD.mergeArray(F,Q)});else return nD.mergeArray(F,J)}get items(){return this._def.items}rest(D){return new b1({...this._def,rest:D})}}b1.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new b1({items:D,typeName:g.ZodTuple,rest:null,...i(F)})};class B5 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.object)return w($,{code:N.invalid_type,expected:C.object,received:$.parsedType}),f;let B=[],J=this._def.keyType,Q=this._def.valueType;for(let Y in $.data)B.push({key:J._parse(new X1($,Y,$.path,Y)),value:Q._parse(new X1($,$.data[Y],$.path,Y)),alwaysSet:Y in $.data});if($.common.async)return nD.mergeObjectAsync(F,B);else return nD.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof r)return new B5({keyType:D,valueType:F,typeName:g.ZodRecord,...i($)});return new B5({keyType:J1.create(),valueType:D,typeName:g.ZodRecord,...i(F)})}}class J5 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.map)return w($,{code:N.invalid_type,expected:C.map,received:$.parsedType}),f;let B=this._def.keyType,J=this._def.valueType,Q=[...$.data.entries()].map(([Y,X],E)=>{return{key:B._parse(new X1($,Y,$.path,[E,"key"])),value:J._parse(new X1($,X,$.path,[E,"value"]))}});if($.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let X of Q){let E=await X.key,G=await X.value;if(E.status==="aborted"||G.status==="aborted")return f;if(E.status==="dirty"||G.status==="dirty")F.dirty();Y.set(E.value,G.value)}return{status:F.value,value:Y}})}else{let Y=new Map;for(let X of Q){let{key:E,value:G}=X;if(E.status==="aborted"||G.status==="aborted")return f;if(E.status==="dirty"||G.status==="dirty")F.dirty();Y.set(E.value,G.value)}return{status:F.value,value:Y}}}}J5.create=(D,F,$)=>{return new J5({valueType:F,keyType:D,typeName:g.ZodMap,...i($)})};class v6 extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.set)return w($,{code:N.invalid_type,expected:C.set,received:$.parsedType}),f;let B=this._def;if(B.minSize!==null){if($.data.size<B.minSize.value)w($,{code:N.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)w($,{code:N.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(X){let E=new Set;for(let G of X){if(G.status==="aborted")return f;if(G.status==="dirty")F.dirty();E.add(G.value)}return{status:F.value,value:E}}let Y=[...$.data.values()].map((X,E)=>J._parse(new X1($,X,$.path,E)));if($.common.async)return Promise.all(Y).then((X)=>Q(X));else return Q(Y)}min(D,F){return new v6({...this._def,minSize:{value:D,message:y.toString(F)}})}max(D,F){return new v6({...this._def,maxSize:{value:D,message:y.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}v6.create=(D,F)=>{return new v6({valueType:D,minSize:null,maxSize:null,typeName:g.ZodSet,...i(F)})};class YF extends r{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.function)return w(F,{code:N.invalid_type,expected:C.function,received:F.parsedType}),f;function $(Y,X){return D5({data:Y,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,BF(),F8].filter((E)=>!!E),issueData:{code:N.invalid_arguments,argumentsError:X}})}function B(Y,X){return D5({data:Y,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,BF(),F8].filter((E)=>!!E),issueData:{code:N.invalid_return_type,returnTypeError:X}})}let J={errorMap:F.common.contextualErrorMap},Q=F.data;if(this._def.returns instanceof y6){let Y=this;return eD(async function(...X){let E=new A0([]),G=await Y._def.args.parseAsync(X,J).catch((V)=>{throw E.addIssue($(X,V)),E}),H=await Reflect.apply(Q,this,G);return await Y._def.returns._def.type.parseAsync(H,J).catch((V)=>{throw E.addIssue(B(H,V)),E})})}else{let Y=this;return eD(function(...X){let E=Y._def.args.safeParse(X,J);if(!E.success)throw new A0([$(X,E.error)]);let G=Reflect.apply(Q,this,E.data),H=Y._def.returns.safeParse(G,J);if(!H.success)throw new A0([B(G,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new YF({...this._def,args:b1.create(D).rest(n8.create())})}returns(D){return new YF({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new YF({args:D?D:b1.create([]).rest(n8.create()),returns:F||n8.create(),typeName:g.ZodFunction,...i($)})}}class qF extends r{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})}}qF.create=(D,F)=>{return new qF({getter:D,typeName:g.ZodLazy,...i(F)})};class KF extends r{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return w(F,{received:F.data,code:N.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:D.data}}get value(){return this._def.value}}KF.create=(D,F)=>{return new KF({value:D,typeName:g.ZodLiteral,...i(F)})};function lk(D,F){return new o8({values:D,typeName:g.ZodEnum,...i(F)})}class o8 extends r{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return w(F,{expected:DD.joinValues($),received:F.parsedType,code:N.invalid_type}),f}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 w(F,{received:F.data,code:N.invalid_enum_value,options:$}),f}return eD(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 o8.create(D,{...this._def,...F})}exclude(D,F=this._def){return o8.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}}o8.create=lk;class zF extends r{_parse(D){let F=DD.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==C.string&&$.parsedType!==C.number){let B=DD.objectValues(F);return w($,{expected:DD.joinValues(B),received:$.parsedType,code:N.invalid_type}),f}if(!this._cache)this._cache=new Set(DD.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=DD.objectValues(F);return w($,{received:$.data,code:N.invalid_enum_value,options:B}),f}return eD(D.data)}get enum(){return this._def.values}}zF.create=(D,F)=>{return new zF({values:D,typeName:g.ZodNativeEnum,...i(F)})};class y6 extends r{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.promise&&F.common.async===!1)return w(F,{code:N.invalid_type,expected:C.promise,received:F.parsedType}),f;let $=F.parsedType===C.promise?F.data:Promise.resolve(F.data);return eD($.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}y6.create=(D,F)=>{return new y6({type:D,typeName:g.ZodPromise,...i(F)})};class E1 extends r{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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(w($,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(Y)=>{if(F.value==="aborted")return f;let X=await this._def.schema._parseAsync({data:Y,path:$.path,parent:$});if(X.status==="aborted")return f;if(X.status==="dirty")return P6(X.value);if(F.value==="dirty")return P6(X.value);return X});else{if(F.value==="aborted")return f;let Y=this._def.schema._parseSync({data:Q,path:$.path,parent:$});if(Y.status==="aborted")return f;if(Y.status==="dirty")return P6(Y.value);if(F.value==="dirty")return P6(Y.value);return Y}}if(B.type==="refinement"){let Q=(Y)=>{let X=B.refinement(Y,J);if($.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if($.common.async===!1){let Y=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(Y.status==="aborted")return f;if(Y.status==="dirty")F.dirty();return Q(Y.value),{status:F.value,value:Y.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Y)=>{if(Y.status==="aborted")return f;if(Y.status==="dirty")F.dirty();return Q(Y.value).then(()=>{return{status:F.value,value:Y.value}})})}if(B.type==="transform")if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!c8(Q))return f;let Y=B.transform(Q.value,J);if(Y instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Y}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(!c8(Q))return f;return Promise.resolve(B.transform(Q.value,J)).then((Y)=>({status:F.value,value:Y}))});DD.assertNever(B)}}E1.create=(D,F,$)=>{return new E1({schema:D,typeName:g.ZodEffects,effect:F,...i($)})};E1.createWithPreprocess=(D,F,$)=>{return new E1({schema:F,effect:{type:"preprocess",transform:D},typeName:g.ZodEffects,...i($)})};class Y1 extends r{_parse(D){if(this._getType(D)===C.undefined)return eD(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}Y1.create=(D,F)=>{return new Y1({innerType:D,typeName:g.ZodOptional,...i(F)})};class B8 extends r{_parse(D){if(this._getType(D)===C.null)return eD(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}B8.create=(D,F)=>{return new B8({innerType:D,typeName:g.ZodNullable,...i(F)})};class VF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===C.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}VF.create=(D,F)=>{return new VF({innerType:D,typeName:g.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...i(F)})};class AF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(JF(B))return B.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new A0($.common.issues)},input:$.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new A0($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}AF.create=(D,F)=>{return new AF({innerType:D,typeName:g.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...i(F)})};class Q5 extends r{_parse(D){if(this._getType(D)!==C.nan){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.nan,received:$.parsedType}),f}return{status:"valid",value:D.data}}}Q5.create=(D)=>{return new Q5({typeName:g.ZodNaN,...i(D)})};var kXD=Symbol("zod_brand");class X$ extends r{_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 Y5 extends r{_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 f;if(J.status==="dirty")return F.dirty(),P6(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 f;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 Y5({in:D,out:F,typeName:g.ZodPipeline})}}class ZF extends r{_parse(D){let F=this._def.innerType._parse(D),$=(B)=>{if(c8(B))B.value=Object.freeze(B.value);return B};return JF(F)?F.then((B)=>$(B)):$(F)}unwrap(){return this._def.innerType}}ZF.create=(D,F)=>{return new ZF({innerType:D,typeName:g.ZodReadonly,...i(F)})};function hk(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function dk(D,F={},$){if(D)return k6.create().superRefine((B,J)=>{let Q=D(B);if(Q instanceof Promise)return Q.then((Y)=>{if(!Y){let X=hk(F,B),E=X.fatal??$??!0;J.addIssue({code:"custom",...X,fatal:E})}});if(!Q){let Y=hk(F,B),X=Y.fatal??$??!0;J.addIssue({code:"custom",...Y,fatal:X})}return});return k6.create()}var vXD={object:TD.lazycreate},g;(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"})(g||(g={}));var yXD=(D,F={message:`Input not instance of ${D.name}`})=>dk(($)=>$ instanceof D,F),pk=J1.create,ck=i8.create,xXD=Q5.create,_XD=a8.create,nk=XF.create,fXD=S6.create,gXD=F5.create,hXD=EF.create,bXD=GF.create,uXD=k6.create,mXD=n8.create,lXD=h1.create,dXD=$5.create,pXD=Q1.create,cXD=TD.create,nXD=TD.strictCreate,iXD=HF.create,aXD=Y$.create,oXD=WF.create,sXD=b1.create,rXD=B5.create,tXD=J5.create,eXD=v6.create,D2D=YF.create,F2D=qF.create,$2D=KF.create,B2D=o8.create,J2D=zF.create,Q2D=y6.create,Y2D=E1.create,X2D=Y1.create,E2D=B8.create,G2D=E1.createWithPreprocess,H2D=Y5.create,W2D=()=>pk().optional(),q2D=()=>ck().optional(),K2D=()=>nk().optional(),z2D={string:(D)=>J1.create({...D,coerce:!0}),number:(D)=>i8.create({...D,coerce:!0}),boolean:(D)=>XF.create({...D,coerce:!0}),bigint:(D)=>a8.create({...D,coerce:!0}),date:(D)=>S6.create({...D,coerce:!0})};var V2D=f;var lND=G1.object({apiKey:G1.string().optional(),apiUrl:G1.string().url().default("https://api.osc.earth/nemar"),username:G1.string().optional(),email:G1.string().email().optional(),githubUsername:G1.string().optional(),sandboxCompleted:G1.boolean().optional(),sandboxDatasetId:G1.string().optional()}),C0=new B$({projectName:"nemar",schema:{apiKey:{type:"string"},apiUrl:{type:"string",default:"https://api.osc.earth/nemar"},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 iD(){return{apiKey:C0.get("apiKey"),apiUrl:C0.get("apiUrl"),username:C0.get("username"),email:C0.get("email"),githubUsername:C0.get("githubUsername"),sandboxCompleted:C0.get("sandboxCompleted"),sandboxDatasetId:C0.get("sandboxDatasetId")}}function ik(){return!!C0.get("sandboxCompleted")}function Q0(D,F){C0.set(D,F)}function H2(D){C0.delete(D)}function ak(){C0.clear()}function gD(){return!!C0.get("apiKey")}function ok(){return C0.path}var A2D="https://api.osc.earth/nemar";class BD extends Error{statusCode;details;constructor(D,F,$){super(F);this.statusCode=D;this.details=$;this.name="ApiError"}}function sk(){return iD().apiUrl||A2D}async function jD(D,F={},$=!1){let B=`${sk()}${D}`,J={"Content-Type":"application/json",...F.headers};if($){let X=iD();if(!X.apiKey)throw new BD(401,"Not authenticated. Run 'nemar auth login' first.");J.Authorization=`Bearer ${X.apiKey}`}let Q;try{Q=await fetch(B,{...F,headers:J})}catch(X){throw new BD(0,`Network error: Could not connect to ${sk()}`,{originalError:X instanceof Error?X.message:String(X)})}let Y;try{Y=await Q.json()}catch{throw new BD(Q.status,`Invalid response from server (status ${Q.status})`)}if(!Q.ok)throw new BD(Q.status,Y.error||Y.message||"Request failed",Y.details);return Y}async function rk(D){return jD(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function tk(D){return jD(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function ek(D){return jD("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function Dv(D){return jD("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function Fv(D){return jD("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function $v(){return jD("/users/me",{},!0)}async function Bv(D){let F=D?`?status=${D}`:"";return jD(`/admin/users${F}`,{},!0)}async function Jv(D){return jD(`/admin/approve/${D}`,{method:"POST"},!0)}async function Qv(D){return jD(`/admin/revoke/${D}`,{method:"POST"},!0)}async function Yv(D){return jD(`/admin/regenerate-iam/${D}`,{method:"POST"},!0)}async function Xv(){return jD("/datasets")}async function x6(D){return(await jD(`/datasets/${D}`)).dataset}async function E$(D){return jD("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function G$(D){return jD(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function Ev(D,F){return jD(`/datasets/${D}/upload-urls`,{method:"POST",body:JSON.stringify({files:F})},!0)}async function Gv(D,F){return jD(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function W2(D){return jD(`/admin/datasets/${D}/doi`,{},!0)}async function Hv(D){return jD(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function Wv(D,F){return jD(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function qv(D){return jD(`/datasets/${D}/collaborators`,{},!0)}async function Kv(D){return jD("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function zv(){return jD("/sandbox/reset",{method:"POST"},!0)}async function Vv(){return jD("/sandbox/status",{},!0)}async function u0(D,F,$=!1){if(F.no)return"declined";if(F.yes)return"confirmed";try{let{confirmed:B}=await j1.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 Av(D,F,$){if($.no)return"declined";if($.yes)return"confirmed";try{let{input:B}=await j1.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 R0="-y, --yes",H1="-n, --no",I0="Skip confirmation and proceed",W1="Skip confirmation and decline";import{existsSync as Uv,statSync as Z2D}from"fs";import{join as q2}from"path";var{spawn:U2D}=globalThis.Bun;async function a(D,F={}){let $=U2D({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 Zv(D){return D.split(".").map((F)=>{let $=Number.parseInt(F.replace(/[^0-9]/g,""),10);return Number.isNaN($)?0:$})}function L2D(D,F){let $=Zv(D),B=Zv(F);for(let J=0;J<Math.max($.length,B.length);J++){let Q=$[J]||0,Y=B[J]||0;if(Q>Y)return!0;if(Q<Y)return!1}return!0}async function Lv(){try{let{stdout:F,exitCode:$,stderr:B}=await a(["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?L2D(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 M2D(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:D,stderr:F,exitCode:$}=await a(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","git@github.com"],{timeout:1e4}),B=D+F,J=B.match(/Hi ([^!]+)!/);if(J)return{accessible:!0,username:J[1]};if(B.includes("Permission denied"))return{accessible:!1};return{accessible:B.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 Mv(){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 H$(){let[D,F]=await Promise.all([Lv(),M2D()]),$=[];if(!D.installed)$.push(`git-annex is not installed. Install: ${Mv()}`);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 K2(D){if(!Uv(q2(D,".git")))return!1;try{let{exitCode:F}=await a(["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 W$(D,F={}){if(!F.force&&await K2(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 a(["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:Y}=await a(["git","annex","init"],{cwd:D,...Object.keys($).length>0?{env:$}:{}});if(Y!==0)return{success:!1,error:Q.trim()||"Failed to initialize git-annex"};return{success:!0}}catch($){return{success:!1,error:$.message}}}async function Nv(D){try{let{exitCode:F,stderr:$}=await a(["git","annex","info"],{cwd:D});if(F===0)return{success:!0};if($.includes("First run: git-annex init")){let{stderr:B,exitCode:J}=await a(["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 q$(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 a(["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 N2D(){try{let{exitCode:D,stderr:F}=await a(["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,200)});return{works:$,error:$?void 0:F.trim()}}catch(D){let F=D instanceof Error?D.message:String(D);return console.warn("SSH test exception:",F),{works:!1,error:F}}}async function C2D(){try{let{stdout:D,exitCode:F,stderr:$}=await a(["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 K$(D){try{let{stdout:F,exitCode:$,stderr:B}=await a(["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 z$(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 a(["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((G)=>G.repository.full_name===D)?.id??null}catch(X){let E=X instanceof Error?X.message:String(X);return console.error("Failed to parse GitHub invitations response:",E),console.error(" Raw response (first 500 chars):",(F||"").slice(0,500)),{accepted:!1,error:`Failed to parse GitHub API response: ${E}`}}if(!J){let{exitCode:X}=await a(["gh","api",`/repos/${D}`,"--silent"]);if(X===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:Y}=await a(["gh","api","--method","PATCH",`/user/repository_invitations/${J}`]);if(Q!==0)return{accepted:!1,error:`Failed to accept invitation: ${Y.trim()||"unknown error"}`};return{accepted:!0}}async function V$(D,F,$="origin"){let B=F;if(process.env.GH_TOKEN&&F.startsWith("git@github.com:")){let J=F.replace("git@github.com:","");B=`https://${process.env.GH_TOKEN}@github.com/${J}`}else if(F.startsWith("git@github.com:")){let J=F.replace("git@github.com:",""),Q=await N2D();if(Q.works)B=F;else{console.warn("GitHub SSH not available, falling back to HTTPS with gh CLI token...");let Y=await C2D();if(Y.token)B=`https://${Y.token}@github.com/${J}`;else return{success:!1,error:`GitHub authentication not configured.
|
|
91
|
+
`;return this.stop(),this.#Q.write(G),this}}function k(D){return new FI(D)}import{isDeepStrictEqual as FXD}from"util";import kk from"process";import T6 from"fs";import vk from"path";import e3 from"crypto";import $XD from"assert";var Z6=(D)=>{let F=typeof D;return D!==null&&(F==="object"||F==="function")};var AY=new Set(["__proto__","prototype","constructor"]),X8D=new Set("0123456789");function F7(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(AY.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(AY.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"&&!X8D.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(AY.has($))return[];F.push($);break}case"index":throw Error("Index was not closed");case"start":{F.push("");break}}return F}function ZY(D,F){if(typeof F!=="number"&&Array.isArray(D)){let $=Number.parseInt(F,10);return Number.isInteger($)&&D[$]===D[F]}return!1}function $I(D,F){if(ZY(D,F))throw Error("Cannot use string index")}function BI(D,F,$){if(!Z6(D)||typeof F!=="string")return $===void 0?D:$;let B=F7(F);if(B.length===0)return $;for(let J=0;J<B.length;J++){let Q=B[J];if(ZY(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 UY(D,F,$){if(!Z6(D)||typeof F!=="string")return D;let B=D,J=F7(F);for(let Q=0;Q<J.length;Q++){let Y=J[Q];if($I(D,Y),Q===J.length-1)D[Y]=$;else if(!Z6(D[Y]))D[Y]=typeof J[Q+1]==="number"?[]:{};D=D[Y]}return B}function JI(D,F){if(!Z6(D)||typeof F!=="string")return!1;let $=F7(F);for(let B=0;B<$.length;B++){let J=$[B];if($I(D,J),B===$.length-1)return delete D[J],!0;if(D=D[J],!Z6(D))return!1}}function QI(D,F){if(!Z6(D)||typeof F!=="string")return!1;let $=F7(F);if($.length===0)return!1;for(let B of $){if(!Z6(D)||!(B in D)||ZY(D,B))return!1;D=D[B]}return!0}import OD from"path";import YI from"os";import LY from"process";var f8=YI.homedir(),MY=YI.tmpdir(),{env:b4}=LY,E8D=(D)=>{let F=OD.join(f8,"Library");return{data:OD.join(F,"Application Support",D),config:OD.join(F,"Preferences",D),cache:OD.join(F,"Caches",D),log:OD.join(F,"Logs",D),temp:OD.join(MY,D)}},G8D=(D)=>{let F=b4.APPDATA||OD.join(f8,"AppData","Roaming"),$=b4.LOCALAPPDATA||OD.join(f8,"AppData","Local");return{data:OD.join($,D,"Data"),config:OD.join(F,D,"Config"),cache:OD.join($,D,"Cache"),log:OD.join($,D,"Log"),temp:OD.join(MY,D)}},H8D=(D)=>{let F=OD.basename(f8);return{data:OD.join(b4.XDG_DATA_HOME||OD.join(f8,".local","share"),D),config:OD.join(b4.XDG_CONFIG_HOME||OD.join(f8,".config"),D),cache:OD.join(b4.XDG_CACHE_HOME||OD.join(f8,".cache"),D),log:OD.join(b4.XDG_STATE_HOME||OD.join(f8,".local","state"),D),temp:OD.join(MY,F,D)}};function NY(D,{suffix:F="nodejs"}={}){if(typeof D!=="string")throw TypeError(`Expected a string, got ${typeof D}`);if(F)D+=`-${F}`;if(LY.platform==="darwin")return E8D(D);if(LY.platform==="win32")return G8D(D);return H8D(D)}import U8D from"path";import ED from"fs";import{promisify as oD}from"util";var W8D=(D,F)=>{let{onError:$}=F;return function(...J){return D.apply(void 0,J).catch($)}},S1=W8D;var q8D=(D,F)=>{let{onError:$}=F;return function(...J){try{return D.apply(void 0,J)}catch(Q){return $(Q)}}},s0=q8D;var XI=250;var K8D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,Y=J.interval??XI,X=Date.now()+Q;return function E(...G){return D.apply(void 0,G).catch((H)=>{if(!$(H))throw H;if(Date.now()>=X)throw H;let q=Math.round(Y*Math.random());if(q>0)return new Promise((A)=>setTimeout(A,q)).then(()=>E.apply(void 0,G));else return E.apply(void 0,G)})}}},k1=K8D;var z8D=(D,F)=>{let{isRetriable:$}=F;return function(J){let{timeout:Q}=J,Y=Date.now()+Q;return function(...E){while(!0)try{return D.apply(void 0,E)}catch(G){if(!$(G))throw G;if(Date.now()>=Y)throw G;continue}}}},v1=z8D;import GI from"process";var U3={isChangeErrorOk:(D)=>{if(!U3.isNodeError(D))return!1;let{code:F}=D;if(F==="ENOSYS")return!0;if(!EI&&(F==="EINVAL"||F==="EPERM"))return!0;return!1},isNodeError:(D)=>{return D instanceof Error},isRetriableError:(D)=>{if(!U3.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(!U3.isNodeError(D))throw D;if(U3.isChangeErrorOk(D))return;throw D}},CY=U3;var L3={onError:CY.onChangeError},H0={onError:()=>{return}},EI=GI.getuid?!GI.getuid():!1,pD={isRetriable:CY.isRetriableError};var V8D={attempt:{chmod:S1(oD(ED.chmod),L3),chown:S1(oD(ED.chown),L3),close:S1(oD(ED.close),H0),fsync:S1(oD(ED.fsync),H0),mkdir:S1(oD(ED.mkdir),H0),realpath:S1(oD(ED.realpath),H0),stat:S1(oD(ED.stat),H0),unlink:S1(oD(ED.unlink),H0),chmodSync:s0(ED.chmodSync,L3),chownSync:s0(ED.chownSync,L3),closeSync:s0(ED.closeSync,H0),existsSync:s0(ED.existsSync,H0),fsyncSync:s0(ED.fsync,H0),mkdirSync:s0(ED.mkdirSync,H0),realpathSync:s0(ED.realpathSync,H0),statSync:s0(ED.statSync,H0),unlinkSync:s0(ED.unlinkSync,H0)},retry:{close:k1(oD(ED.close),pD),fsync:k1(oD(ED.fsync),pD),open:k1(oD(ED.open),pD),readFile:k1(oD(ED.readFile),pD),rename:k1(oD(ED.rename),pD),stat:k1(oD(ED.stat),pD),write:k1(oD(ED.write),pD),writeFile:k1(oD(ED.writeFile),pD),closeSync:v1(ED.closeSync,pD),fsyncSync:v1(ED.fsyncSync,pD),openSync:v1(ED.openSync,pD),readFileSync:v1(ED.readFileSync,pD),renameSync:v1(ED.renameSync,pD),statSync:v1(ED.statSync,pD),writeSync:v1(ED.writeSync,pD),writeFileSync:v1(ED.writeFileSync,pD)}},fD=V8D;import U6 from"process";var HI="utf8",RY=438,WI=511;var qI={},KI=U6.geteuid?U6.geteuid():-1,zI=U6.getegid?U6.getegid():-1;var VI=1000,AI=!!U6.getuid,zZD=U6.getuid?!U6.getuid():!1,IY=128;var ZI=(D)=>{return D instanceof Error&&"code"in D};var wY=(D)=>{return typeof D==="string"},$7=(D)=>{return D===void 0};import Z8D from"path";import u4 from"process";import UI from"process";var LI=UI.platform==="linux",B7=UI.platform==="win32";var OY=["SIGHUP","SIGINT","SIGTERM"];if(!B7)OY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(LI)OY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var MI=OY;class NI{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(B7&&(D!=="SIGINT"&&D!=="SIGTERM"&&D!=="SIGKILL"))u4.kill(u4.pid,"SIGTERM");else u4.kill(u4.pid,D)},this.hook=()=>{u4.once("exit",()=>this.exit());for(let D of MI)try{u4.once(D,()=>this.exit(D))}catch{}},this.register=(D)=>{return this.callbacks.add(D),()=>{this.callbacks.delete(D)}},this.hook()}}var CI=new NI;var A8D=CI.register,RI=A8D;var N0={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=N0.truncate(F(D));if(B in N0.store)return N0.get(D,F,$);return N0.store[B]=$,[B,()=>delete N0.store[B]]},purge:(D)=>{if(!N0.store[D])return;delete N0.store[D],fD.attempt.unlink(D)},purgeSync:(D)=>{if(!N0.store[D])return;delete N0.store[D],fD.attempt.unlinkSync(D)},purgeSyncAll:()=>{for(let D in N0.store)N0.purgeSync(D)},truncate:(D)=>{let F=Z8D.basename(D);if(F.length<=IY)return D;let $=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(F);if(!$)return D;let B=F.length-IY;return`${D.slice(0,-F.length)}${$[1]}${$[2].slice(0,-B)}${$[3]}`}};RI(N0.purgeSyncAll);var M3=N0;function TY(D,F,$=qI){if(wY($))return TY(D,F,{encoding:$});let J={timeout:$.timeout??VI},Q=null,Y=null,X=null;try{let E=fD.attempt.realpathSync(D),G=!!E;D=E||D,[Y,Q]=M3.get(D,$.tmpCreate||M3.create,$.tmpPurge!==!1);let H=AI&&$7($.chown),q=$7($.mode);if(G&&(H||q)){let V=fD.attempt.statSync(D);if(V){if($={...$},H)$.chown={uid:V.uid,gid:V.gid};if(q)$.mode=V.mode}}if(!G){let V=U8D.dirname(D);fD.attempt.mkdirSync(V,{mode:WI,recursive:!0})}if(X=fD.retry.openSync(J)(Y,"w",$.mode||RY),$.tmpCreated)$.tmpCreated(Y);if(wY(F))fD.retry.writeSync(J)(X,F,0,$.encoding||HI);else if(!$7(F))fD.retry.writeSync(J)(X,F,0,F.length,0);if($.fsync!==!1)if($.fsyncWait!==!1)fD.retry.fsyncSync(J)(X);else fD.attempt.fsync(X);if(fD.retry.closeSync(J)(X),X=null,$.chown&&($.chown.uid!==KI||$.chown.gid!==zI))fD.attempt.chownSync(Y,$.chown.uid,$.chown.gid);if($.mode&&$.mode!==RY)fD.attempt.chmodSync(Y,$.mode);try{fD.retry.renameSync(J)(Y,D)}catch(V){if(!ZI(V))throw V;if(V.code!=="ENAMETOOLONG")throw V;fD.retry.renameSync(J)(Y,M3.truncate(D))}Q(),Y=null}finally{if(X)fD.attempt.closeSync(X);if(Y)M3.purge(Y)}}var xk=b(VP(),1),_k=b(gP(),1);var FJD=(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 Y,X,E,G=function(...H){let q=this,V=()=>{if(Y=void 0,X)clearTimeout(X),X=void 0;if(Q)E=D.apply(q,H)},A=()=>{if(X=void 0,Y)clearTimeout(Y),Y=void 0;if(Q)E=D.apply(q,H)},Z=J&&!Y;if(clearTimeout(Y),Y=setTimeout(V,$),B>0&&B!==Number.POSITIVE_INFINITY&&!X)X=setTimeout(A,B);if(Z)E=D.apply(q,H);return E};return z3(G,D),G.cancel=()=>{if(Y)clearTimeout(Y),Y=void 0;if(X)clearTimeout(X),X=void 0},G},lX=FJD;var j6=b(Tk(),1);var aYD=Object.prototype.toString;function Pk(D,F,$){if(!D)return!1;if(D.constructor===F)return!0;return aYD.call(D)===$}function Sk(D){return Pk(D,Uint8Array,"[object Uint8Array]")}function oYD(D){return Pk(D,ArrayBuffer,"[object ArrayBuffer]")}function sYD(D){return Sk(D)||oYD(D)}function rYD(D){if(!Sk(D))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof D}\``)}function tYD(D){if(!sYD(D))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof D}\``)}function J2(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)rYD(J),$.set(J,B),B+=J.length;return $}var jk={utf8:new globalThis.TextDecoder("utf8")};function Q2(D,F="utf8"){return tYD(D),jk[F]??=new globalThis.TextDecoder(F),jk[F].decode(D)}function eYD(D){if(typeof D!=="string")throw TypeError(`Expected \`string\`, got \`${typeof D}\``)}var DXD=new globalThis.TextEncoder;function F$(D){return eYD(D),DXD.encode(D)}var DND=Array.from({length:256},(D,F)=>F.toString(16).padStart(2,"0"));var BXD=_k.default.default,yk="aes-256-cbc",$F=()=>Object.create(null),JXD=(D)=>D!==void 0&&D!==null,QXD=(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`)},$$="__internal__",Y2=`${$$}.migrations.version`;class B${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=NY(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 xk.Ajv2020({allErrors:!0,useDefaults:!0,...F.ajvOptions});BXD(Q);let Y={...F.rootSchema,type:"object",properties:F.schema};this.#$=Q.compile(Y);for(let[X,E]of Object.entries(F.schema??{}))if(E?.default)this.#J[X]=E.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=vk.resolve(F.cwd,`${F.configName??"config"}${$}`);let B=this.store,J=Object.assign($F(),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{$XD.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 ${$$} key, as it's used to manage this module internal operations.`);let{store:$}=this,B=(J,Q)=>{if(QXD(J,Q),this.#D.accessPropertiesByDotNotation)UY($,J,Q);else $[J]=Q};if(typeof D==="object"){let J=D;for(let[Q,Y]of Object.entries(J))B(Q,Y)}else B(D,F);this.store=$}has(D){if(this.#D.accessPropertiesByDotNotation)return QI(this.store,D);return D in this.store}reset(...D){for(let F of D)if(JXD(this.#J[F]))this.set(F,this.#J[F])}delete(D){let{store:F}=this;if(this.#D.accessPropertiesByDotNotation)JI(F,D);else delete F[D];this.store=F}clear(){this.store=$F();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=T6.readFileSync(this.path,this.#F?null:"utf8"),F=this._encryptData(D),$=this._deserialize(F);return this._validate($),Object.assign($F(),$)}catch(D){if(D?.code==="ENOENT")return this._ensureDirectory(),$F();if(this.#D.clearInvalidConfig&&D.name==="SyntaxError")return $F();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:Q2(D);try{let F=D.slice(0,16),$=e3.pbkdf2Sync(this.#F,F.toString(),1e4,32,"sha512"),B=e3.createDecipheriv(yk,$,F),J=D.slice(17),Q=typeof J==="string"?F$(J):J;return Q2(J2([B.update(Q),B.final()]))}catch{}return D.toString()}_handleChange(D,F){let $=D(),B=()=>{let J=$,Q=D();if(FXD(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(){T6.mkdirSync(vk.dirname(this.path),{recursive:!0})}_write(D){let F=this._serialize(D);if(this.#F){let $=e3.randomBytes(16),B=e3.pbkdf2Sync(this.#F,$.toString(),1e4,32,"sha512"),J=e3.createCipheriv(yk,B,$);F=J2([$,F$(":"),J.update(F$(F)),J.final()])}if(kk.env.SNAP)T6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});else try{TY(this.path,F,{mode:this.#D.configFileMode})}catch($){if($?.code==="EXDEV"){T6.writeFileSync(this.path,F,{mode:this.#D.configFileMode});return}throw $}}_watch(){if(this._ensureDirectory(),!T6.existsSync(this.path))this._write($F());if(kk.platform==="win32")T6.watch(this.path,{persistent:!1},lX(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else T6.watchFile(this.path,{persistent:!1},lX(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(D,F,$){let B=this._get(Y2,"0.0.0"),J=Object.keys(D).filter((Y)=>this._shouldPerformMigration(Y,B,F)),Q={...this.store};for(let Y of J)try{if($)$(this,{fromVersion:B,toVersion:Y,finalVersion:F,versions:J});let X=D[Y];X?.(this),this._set(Y2,Y),B=Y,Q={...this.store}}catch(X){throw this.store=Q,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${X}`)}if(this._isVersionInRangeFormat(B)||!j6.default.eq(B,F))this._set(Y2,F)}_containsReservedKey(D){if(typeof D==="object"){if(Object.keys(D)[0]===$$)return!0}if(typeof D!=="string")return!1;if(this.#D.accessPropertiesByDotNotation){if(D.startsWith(`${$$}.`))return!0;return!1}return!1}_isVersionInRangeFormat(D){return j6.default.clean(D)===null}_shouldPerformMigration(D,F,$){if(this._isVersionInRangeFormat(D)){if(F!=="0.0.0"&&j6.default.satisfies(F,D))return!1;return j6.default.satisfies($,D)}if(j6.default.lte(D,F))return!1;if(j6.default.gt(D,$))return!1;return!0}_get(D,F){return BI(this.store,D,F)}_set(D,F){let{store:$}=this;UY($,D,F),this.store=$}}var G1={};sv(G1,{void:()=>dXD,util:()=>DD,unknown:()=>mXD,union:()=>iXD,undefined:()=>hXD,tuple:()=>sXD,transformer:()=>Y2D,symbol:()=>gXD,string:()=>pk,strictObject:()=>nXD,setErrorMap:()=>EXD,set:()=>eXD,record:()=>rXD,quotelessJson:()=>YXD,promise:()=>Q2D,preprocess:()=>G2D,pipeline:()=>H2D,ostring:()=>W2D,optional:()=>X2D,onumber:()=>q2D,oboolean:()=>K2D,objectUtil:()=>X2,object:()=>cXD,number:()=>ck,nullable:()=>E2D,null:()=>bXD,never:()=>lXD,nativeEnum:()=>J2D,nan:()=>xXD,map:()=>tXD,makeIssue:()=>D5,literal:()=>$2D,lazy:()=>F2D,late:()=>vXD,isValid:()=>c8,isDirty:()=>Q$,isAsync:()=>JF,isAborted:()=>J$,intersection:()=>oXD,instanceof:()=>yXD,getParsedType:()=>g1,getErrorMap:()=>BF,function:()=>D2D,enum:()=>B2D,effect:()=>Y2D,discriminatedUnion:()=>aXD,defaultErrorMap:()=>F8,datetimeRegex:()=>mk,date:()=>fXD,custom:()=>dk,coerce:()=>z2D,boolean:()=>nk,bigint:()=>_XD,array:()=>pXD,any:()=>uXD,addIssueToContext:()=>w,ZodVoid:()=>$5,ZodUnknown:()=>n8,ZodUnion:()=>HF,ZodUndefined:()=>EF,ZodType:()=>r,ZodTuple:()=>b1,ZodTransformer:()=>E1,ZodSymbol:()=>F5,ZodString:()=>J1,ZodSet:()=>v6,ZodSchema:()=>r,ZodRecord:()=>B5,ZodReadonly:()=>ZF,ZodPromise:()=>y6,ZodPipeline:()=>Y5,ZodParsedType:()=>C,ZodOptional:()=>Y1,ZodObject:()=>TD,ZodNumber:()=>i8,ZodNullable:()=>B8,ZodNull:()=>GF,ZodNever:()=>h1,ZodNativeEnum:()=>zF,ZodNaN:()=>Q5,ZodMap:()=>J5,ZodLiteral:()=>KF,ZodLazy:()=>qF,ZodIssueCode:()=>N,ZodIntersection:()=>WF,ZodFunction:()=>YF,ZodFirstPartyTypeKind:()=>g,ZodError:()=>A0,ZodEnum:()=>o8,ZodEffects:()=>E1,ZodDiscriminatedUnion:()=>Y$,ZodDefault:()=>VF,ZodDate:()=>S6,ZodCatch:()=>AF,ZodBranded:()=>X$,ZodBoolean:()=>XF,ZodBigInt:()=>a8,ZodArray:()=>Q1,ZodAny:()=>k6,Schema:()=>r,ParseStatus:()=>nD,OK:()=>eD,NEVER:()=>V2D,INVALID:()=>f,EMPTY_PATH:()=>GXD,DIRTY:()=>P6,BRAND:()=>kXD});var DD;(function(D){D.assertEqual=(J)=>{};function F(J){}D.assertIs=F;function $(J){throw Error()}D.assertNever=$,D.arrayToEnum=(J)=>{let Q={};for(let Y of J)Q[Y]=Y;return Q},D.getValidEnumValues=(J)=>{let Q=D.objectKeys(J).filter((X)=>typeof J[J[X]]!=="number"),Y={};for(let X of Q)Y[X]=J[X];return D.objectValues(Y)},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 Y in J)if(Object.prototype.hasOwnProperty.call(J,Y))Q.push(Y);return Q},D.find=(J,Q)=>{for(let Y of J)if(Q(Y))return Y;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((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(Q)}D.joinValues=B,D.jsonStringifyReplacer=(J,Q)=>{if(typeof Q==="bigint")return Q.toString();return Q}})(DD||(DD={}));var X2;(function(D){D.mergeShapes=(F,$)=>{return{...F,...$}}})(X2||(X2={}));var C=DD.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),g1=(D)=>{switch(typeof D){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(D)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":if(Array.isArray(D))return C.array;if(D===null)return C.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return C.promise;if(typeof Map<"u"&&D instanceof Map)return C.map;if(typeof Set<"u"&&D instanceof Set)return C.set;if(typeof Date<"u"&&D instanceof Date)return C.date;return C.object;default:return C.unknown}};var N=DD.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"]),YXD=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class A0 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 Y=$,X=0;while(X<Q.path.length){let E=Q.path[X];if(X!==Q.path.length-1)Y[E]=Y[E]||{_errors:[]};else Y[E]=Y[E]||{_errors:[]},Y[E]._errors.push(F(Q));Y=Y[E],X++}}};return B(this),$}static assert(D){if(!(D instanceof A0))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,DD.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()}}A0.create=(D)=>{return new A0(D)};var XXD=(D,F)=>{let $;switch(D.code){case N.invalid_type:if(D.received===C.undefined)$="Required";else $=`Expected ${D.expected}, received ${D.received}`;break;case N.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(D.expected,DD.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:$=`Unrecognized key(s) in object: ${DD.joinValues(D.keys,", ")}`;break;case N.invalid_union:$="Invalid input";break;case N.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${DD.joinValues(D.options)}`;break;case N.invalid_enum_value:$=`Invalid enum value. Expected ${DD.joinValues(D.options)}, received '${D.received}'`;break;case N.invalid_arguments:$="Invalid function arguments";break;case N.invalid_return_type:$="Invalid function return type";break;case N.invalid_date:$="Invalid date";break;case N.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 DD.assertNever(D.validation);else if(D.validation!=="regex")$=`Invalid ${D.validation}`;else $="Invalid";break;case N.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 N.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 N.custom:$="Invalid input";break;case N.invalid_intersection_types:$="Intersection results could not be merged";break;case N.not_multiple_of:$=`Number must be a multiple of ${D.multipleOf}`;break;case N.not_finite:$="Number must be finite";break;default:$=F.defaultError,DD.assertNever(D)}return{message:$}},F8=XXD;var fk=F8;function EXD(D){fk=D}function BF(){return fk}var D5=(D)=>{let{data:F,path:$,errorMaps:B,issueData:J}=D,Q=[...$,...J.path||[]],Y={...J,path:Q};if(J.message!==void 0)return{...J,path:Q,message:J.message};let X="",E=B.filter((G)=>!!G).slice().reverse();for(let G of E)X=G(Y,{data:F,defaultError:X}).message;return{...J,path:Q,message:X}},GXD=[];function w(D,F){let $=BF(),B=D5({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,$,$===F8?void 0:F8].filter((J)=>!!J)});D.common.issues.push(B)}class nD{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 f;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 nD.mergeObjectSync(D,$)}static mergeObjectSync(D,F){let $={};for(let B of F){let{key:J,value:Q}=B;if(J.status==="aborted")return f;if(Q.status==="aborted")return f;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 f=Object.freeze({status:"aborted"}),P6=(D)=>({status:"dirty",value:D}),eD=(D)=>({status:"valid",value:D}),J$=(D)=>D.status==="aborted",Q$=(D)=>D.status==="dirty",c8=(D)=>D.status==="valid",JF=(D)=>typeof Promise<"u"&&D instanceof Promise;var y;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(y||(y={}));class X1{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 gk=(D,F)=>{if(c8(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 A0(D.common.issues);return this._error=$,this._error}}}};function i(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:(Y,X)=>{let{message:E}=D;if(Y.code==="invalid_enum_value")return{message:E??X.defaultError};if(typeof X.data>"u")return{message:E??B??X.defaultError};if(Y.code!=="invalid_type")return{message:X.defaultError};return{message:E??$??X.defaultError}},description:J}}class r{get description(){return this._def.description}_getType(D){return g1(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:g1(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new nD,ctx:{common:D.parent.common,data:D.data,parsedType:g1(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(JF(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:g1(D)},B=this._parseSync({data:D,path:$.path,parent:$});return gk($,B)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:g1(D)};if(!this["~standard"].async)try{let $=this._parseSync({data:D,path:[],parent:F});return c8($)?{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(($)=>c8($)?{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:g1(D)},B=this._parse({data:D,path:$.path,parent:$}),J=await(JF(B)?B:Promise.resolve(B));return gk($,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),Y=()=>J.addIssue({code:N.custom,...$(B)});if(typeof Promise<"u"&&Q instanceof Promise)return Q.then((X)=>{if(!X)return Y(),!1;else return!0});if(!Q)return Y(),!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 E1({schema:this,typeName:g.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 Y1.create(this,this._def)}nullable(){return B8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q1.create(this)}promise(){return y6.create(this,this._def)}or(D){return HF.create([this,D],this._def)}and(D){return WF.create(this,D,this._def)}transform(D){return new E1({...i(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new VF({...i(this._def),innerType:this,defaultValue:F,typeName:g.ZodDefault})}brand(){return new X$({typeName:g.ZodBranded,type:this,...i(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new AF({...i(this._def),innerType:this,catchValue:F,typeName:g.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return Y5.create(this,D)}readonly(){return ZF.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var HXD=/^c[^\s-]{8,}$/i,WXD=/^[0-9a-z]+$/,qXD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KXD=/^[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,zXD=/^[a-z0-9_-]{21}$/i,VXD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,AXD=/^[-+]?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)?)??$/,ZXD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UXD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",E2,LXD=/^(?:(?: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])$/,MXD=/^(?:(?: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])$/,NXD=/^(([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]))$/,CXD=/^(([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])$/,RXD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,IXD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bk="((\\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])))",wXD=new RegExp(`^${bk}$`);function uk(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 OXD(D){return new RegExp(`^${uk(D)}$`)}function mk(D){let F=`${bk}T${uk(D)}`,$=[];if($.push(D.local?"Z?":"Z"),D.offset)$.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${$.join("|")})`,new RegExp(`^${F}$`)}function TXD(D,F){if((F==="v4"||!F)&&LXD.test(D))return!0;if((F==="v6"||!F)&&NXD.test(D))return!0;return!1}function jXD(D,F){if(!VXD.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 PXD(D,F){if((F==="v4"||!F)&&MXD.test(D))return!0;if((F==="v6"||!F)&&CXD.test(D))return!0;return!1}class J1 extends r{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==C.string){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.string,received:J.parsedType}),f}let $=new nD,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),w(B,{code:N.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),w(B,{code:N.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,Y=D.data.length<J.value;if(Q||Y){if(B=this._getOrReturnCtx(D,B),Q)w(B,{code:N.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(Y)w(B,{code:N.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});$.dirty()}}else if(J.kind==="email"){if(!ZXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"email",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="emoji"){if(!E2)E2=new RegExp(UXD,"u");if(!E2.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"emoji",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="uuid"){if(!KXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"uuid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="nanoid"){if(!zXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"nanoid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid"){if(!HXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"cuid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cuid2"){if(!WXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"cuid2",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ulid"){if(!qXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"ulid",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),w(B,{validation:"url",code:N.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),w(B,{validation:"regex",code:N.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),w(B,{code:N.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),w(B,{code:N.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),w(B,{code:N.invalid_string,validation:{endsWith:J.value},message:J.message}),$.dirty()}else if(J.kind==="datetime"){if(!mk(J).test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"datetime",message:J.message}),$.dirty()}else if(J.kind==="date"){if(!wXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"date",message:J.message}),$.dirty()}else if(J.kind==="time"){if(!OXD(J).test(D.data))B=this._getOrReturnCtx(D,B),w(B,{code:N.invalid_string,validation:"time",message:J.message}),$.dirty()}else if(J.kind==="duration"){if(!AXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"duration",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="ip"){if(!TXD(D.data,J.version))B=this._getOrReturnCtx(D,B),w(B,{validation:"ip",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="jwt"){if(!jXD(D.data,J.alg))B=this._getOrReturnCtx(D,B),w(B,{validation:"jwt",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="cidr"){if(!PXD(D.data,J.version))B=this._getOrReturnCtx(D,B),w(B,{validation:"cidr",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64"){if(!RXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"base64",code:N.invalid_string,message:J.message}),$.dirty()}else if(J.kind==="base64url"){if(!IXD.test(D.data))B=this._getOrReturnCtx(D,B),w(B,{validation:"base64url",code:N.invalid_string,message:J.message}),$.dirty()}else DD.assertNever(J);return{status:$.value,value:D.data}}_regex(D,F,$){return this.refinement((B)=>D.test(B),{validation:F,code:N.invalid_string,...y.errToObj($)})}_addCheck(D){return new J1({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...y.errToObj(D)})}url(D){return this._addCheck({kind:"url",...y.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...y.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...y.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...y.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...y.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...y.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...y.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...y.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...y.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...y.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...y.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...y.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,...y.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,...y.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...y.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...y.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...y.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...y.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...y.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...y.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...y.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...y.errToObj(F)})}nonempty(D){return this.min(1,y.errToObj(D))}trim(){return new J1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new J1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new J1({...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}}J1.create=(D)=>{return new J1({checks:[],typeName:g.ZodString,coerce:D?.coerce??!1,...i(D)})};function SXD(D,F){let $=(D.toString().split(".")[1]||"").length,B=(F.toString().split(".")[1]||"").length,J=$>B?$:B,Q=Number.parseInt(D.toFixed(J).replace(".","")),Y=Number.parseInt(F.toFixed(J).replace(".",""));return Q%Y/10**J}class i8 extends r{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)!==C.number){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.number,received:J.parsedType}),f}let $=void 0,B=new nD;for(let J of this._def.checks)if(J.kind==="int"){if(!DD.isInteger(D.data))$=this._getOrReturnCtx(D,$),w($,{code:N.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,$),w($,{code:N.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,$),w($,{code:N.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),B.dirty()}else if(J.kind==="multipleOf"){if(SXD(D.data,J.value)!==0)$=this._getOrReturnCtx(D,$),w($,{code:N.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else if(J.kind==="finite"){if(!Number.isFinite(D.data))$=this._getOrReturnCtx(D,$),w($,{code:N.not_finite,message:J.message}),B.dirty()}else DD.assertNever(J);return{status:B.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,y.toString(F))}gt(D,F){return this.setLimit("min",D,!1,y.toString(F))}lte(D,F){return this.setLimit("max",D,!0,y.toString(F))}lt(D,F){return this.setLimit("max",D,!1,y.toString(F))}setLimit(D,F,$,B){return new i8({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:y.toString(B)}]})}_addCheck(D){return new i8({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:y.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:y.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:y.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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"&&DD.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)}}i8.create=(D)=>{return new i8({checks:[],typeName:g.ZodNumber,coerce:D?.coerce||!1,...i(D)})};class a8 extends r{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)!==C.bigint)return this._getInvalidInput(D);let $=void 0,B=new nD;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,$),w($,{code:N.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,$),w($,{code:N.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,$),w($,{code:N.not_multiple_of,multipleOf:J.value,message:J.message}),B.dirty()}else DD.assertNever(J);return{status:B.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return w(F,{code:N.invalid_type,expected:C.bigint,received:F.parsedType}),f}gte(D,F){return this.setLimit("min",D,!0,y.toString(F))}gt(D,F){return this.setLimit("min",D,!1,y.toString(F))}lte(D,F){return this.setLimit("max",D,!0,y.toString(F))}lt(D,F){return this.setLimit("max",D,!1,y.toString(F))}setLimit(D,F,$,B){return new a8({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:$,message:y.toString(B)}]})}_addCheck(D){return new a8({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:y.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}}a8.create=(D)=>{return new a8({checks:[],typeName:g.ZodBigInt,coerce:D?.coerce??!1,...i(D)})};class XF extends r{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==C.boolean){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.boolean,received:$.parsedType}),f}return eD(D.data)}}XF.create=(D)=>{return new XF({typeName:g.ZodBoolean,coerce:D?.coerce||!1,...i(D)})};class S6 extends r{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==C.date){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_type,expected:C.date,received:J.parsedType}),f}if(Number.isNaN(D.data.getTime())){let J=this._getOrReturnCtx(D);return w(J,{code:N.invalid_date}),f}let $=new nD,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),w(B,{code:N.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),w(B,{code:N.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),$.dirty()}else DD.assertNever(J);return{status:$.value,value:new Date(D.data.getTime())}}_addCheck(D){return new S6({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:y.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:y.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}}S6.create=(D)=>{return new S6({checks:[],coerce:D?.coerce||!1,typeName:g.ZodDate,...i(D)})};class F5 extends r{_parse(D){if(this._getType(D)!==C.symbol){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.symbol,received:$.parsedType}),f}return eD(D.data)}}F5.create=(D)=>{return new F5({typeName:g.ZodSymbol,...i(D)})};class EF extends r{_parse(D){if(this._getType(D)!==C.undefined){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.undefined,received:$.parsedType}),f}return eD(D.data)}}EF.create=(D)=>{return new EF({typeName:g.ZodUndefined,...i(D)})};class GF extends r{_parse(D){if(this._getType(D)!==C.null){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.null,received:$.parsedType}),f}return eD(D.data)}}GF.create=(D)=>{return new GF({typeName:g.ZodNull,...i(D)})};class k6 extends r{constructor(){super(...arguments);this._any=!0}_parse(D){return eD(D.data)}}k6.create=(D)=>{return new k6({typeName:g.ZodAny,...i(D)})};class n8 extends r{constructor(){super(...arguments);this._unknown=!0}_parse(D){return eD(D.data)}}n8.create=(D)=>{return new n8({typeName:g.ZodUnknown,...i(D)})};class h1 extends r{_parse(D){let F=this._getOrReturnCtx(D);return w(F,{code:N.invalid_type,expected:C.never,received:F.parsedType}),f}}h1.create=(D)=>{return new h1({typeName:g.ZodNever,...i(D)})};class $5 extends r{_parse(D){if(this._getType(D)!==C.undefined){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.void,received:$.parsedType}),f}return eD(D.data)}}$5.create=(D)=>{return new $5({typeName:g.ZodVoid,...i(D)})};class Q1 extends r{_parse(D){let{ctx:F,status:$}=this._processInputParams(D),B=this._def;if(F.parsedType!==C.array)return w(F,{code:N.invalid_type,expected:C.array,received:F.parsedType}),f;if(B.exactLength!==null){let Q=F.data.length>B.exactLength.value,Y=F.data.length<B.exactLength.value;if(Q||Y)w(F,{code:Q?N.too_big:N.too_small,minimum:Y?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)w(F,{code:N.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)w(F,{code:N.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,Y)=>{return B.type._parseAsync(new X1(F,Q,F.path,Y))})).then((Q)=>{return nD.mergeArray($,Q)});let J=[...F.data].map((Q,Y)=>{return B.type._parseSync(new X1(F,Q,F.path,Y))});return nD.mergeArray($,J)}get element(){return this._def.type}min(D,F){return new Q1({...this._def,minLength:{value:D,message:y.toString(F)}})}max(D,F){return new Q1({...this._def,maxLength:{value:D,message:y.toString(F)}})}length(D,F){return new Q1({...this._def,exactLength:{value:D,message:y.toString(F)}})}nonempty(D){return this.min(1,D)}}Q1.create=(D,F)=>{return new Q1({type:D,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...i(F)})};function QF(D){if(D instanceof TD){let F={};for(let $ in D.shape){let B=D.shape[$];F[$]=Y1.create(QF(B))}return new TD({...D._def,shape:()=>F})}else if(D instanceof Q1)return new Q1({...D._def,type:QF(D.element)});else if(D instanceof Y1)return Y1.create(QF(D.unwrap()));else if(D instanceof B8)return B8.create(QF(D.unwrap()));else if(D instanceof b1)return b1.create(D.items.map((F)=>QF(F)));else return D}class TD extends r{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=DD.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==C.object){let E=this._getOrReturnCtx(D);return w(E,{code:N.invalid_type,expected:C.object,received:E.parsedType}),f}let{status:$,ctx:B}=this._processInputParams(D),{shape:J,keys:Q}=this._getCached(),Y=[];if(!(this._def.catchall instanceof h1&&this._def.unknownKeys==="strip")){for(let E in B.data)if(!Q.includes(E))Y.push(E)}let X=[];for(let E of Q){let G=J[E],H=B.data[E];X.push({key:{status:"valid",value:E},value:G._parse(new X1(B,H,B.path,E)),alwaysSet:E in B.data})}if(this._def.catchall instanceof h1){let E=this._def.unknownKeys;if(E==="passthrough")for(let G of Y)X.push({key:{status:"valid",value:G},value:{status:"valid",value:B.data[G]}});else if(E==="strict"){if(Y.length>0)w(B,{code:N.unrecognized_keys,keys:Y}),$.dirty()}else if(E==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let E=this._def.catchall;for(let G of Y){let H=B.data[G];X.push({key:{status:"valid",value:G},value:E._parse(new X1(B,H,B.path,G)),alwaysSet:G in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let E=[];for(let G of X){let H=await G.key,q=await G.value;E.push({key:H,value:q,alwaysSet:G.alwaysSet})}return E}).then((E)=>{return nD.mergeObjectSync($,E)});else return nD.mergeObjectSync($,X)}get shape(){return this._def.shape()}strict(D){return y.errToObj,new TD({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,$)=>{let B=this._def.errorMap?.(F,$).message??$.defaultError;if(F.code==="unrecognized_keys")return{message:y.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new TD({...this._def,unknownKeys:"strip"})}passthrough(){return new TD({...this._def,unknownKeys:"passthrough"})}extend(D){return new TD({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new TD({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:g.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new TD({...this._def,catchall:D})}pick(D){let F={};for(let $ of DD.objectKeys(D))if(D[$]&&this.shape[$])F[$]=this.shape[$];return new TD({...this._def,shape:()=>F})}omit(D){let F={};for(let $ of DD.objectKeys(this.shape))if(!D[$])F[$]=this.shape[$];return new TD({...this._def,shape:()=>F})}deepPartial(){return QF(this)}partial(D){let F={};for(let $ of DD.objectKeys(this.shape)){let B=this.shape[$];if(D&&!D[$])F[$]=B;else F[$]=B.optional()}return new TD({...this._def,shape:()=>F})}required(D){let F={};for(let $ of DD.objectKeys(this.shape))if(D&&!D[$])F[$]=this.shape[$];else{let J=this.shape[$];while(J instanceof Y1)J=J._def.innerType;F[$]=J}return new TD({...this._def,shape:()=>F})}keyof(){return lk(DD.objectKeys(this.shape))}}TD.create=(D,F)=>{return new TD({shape:()=>D,unknownKeys:"strip",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};TD.strictCreate=(D,F)=>{return new TD({shape:()=>D,unknownKeys:"strict",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};TD.lazycreate=(D,F)=>{return new TD({shape:D,unknownKeys:"strip",catchall:h1.create(),typeName:g.ZodObject,...i(F)})};class HF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$=this._def.options;function B(J){for(let Y of J)if(Y.result.status==="valid")return Y.result;for(let Y of J)if(Y.result.status==="dirty")return F.common.issues.push(...Y.ctx.common.issues),Y.result;let Q=J.map((Y)=>new A0(Y.ctx.common.issues));return w(F,{code:N.invalid_union,unionErrors:Q}),f}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 X of $){let E={...F,common:{...F.common,issues:[]},parent:null},G=X._parseSync({data:F.data,path:F.path,parent:E});if(G.status==="valid")return G;else if(G.status==="dirty"&&!J)J={result:G,ctx:E};if(E.common.issues.length)Q.push(E.common.issues)}if(J)return F.common.issues.push(...J.ctx.common.issues),J.result;let Y=Q.map((X)=>new A0(X));return w(F,{code:N.invalid_union,unionErrors:Y}),f}}get options(){return this._def.options}}HF.create=(D,F)=>{return new HF({options:D,typeName:g.ZodUnion,...i(F)})};var $8=(D)=>{if(D instanceof qF)return $8(D.schema);else if(D instanceof E1)return $8(D.innerType());else if(D instanceof KF)return[D.value];else if(D instanceof o8)return D.options;else if(D instanceof zF)return DD.objectValues(D.enum);else if(D instanceof VF)return $8(D._def.innerType);else if(D instanceof EF)return[void 0];else if(D instanceof GF)return[null];else if(D instanceof Y1)return[void 0,...$8(D.unwrap())];else if(D instanceof B8)return[null,...$8(D.unwrap())];else if(D instanceof X$)return $8(D.unwrap());else if(D instanceof ZF)return $8(D.unwrap());else if(D instanceof AF)return $8(D._def.innerType);else return[]};class Y$ extends r{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.object)return w(F,{code:N.invalid_type,expected:C.object,received:F.parsedType}),f;let $=this.discriminator,B=F.data[$],J=this.optionsMap.get(B);if(!J)return w(F,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),f;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=$8(J.shape[D]);if(!Q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let Y of Q){if(B.has(Y))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(Y)}`);B.set(Y,J)}}return new Y$({typeName:g.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:B,...i($)})}}function G2(D,F){let $=g1(D),B=g1(F);if(D===F)return{valid:!0,data:D};else if($===C.object&&B===C.object){let J=DD.objectKeys(F),Q=DD.objectKeys(D).filter((X)=>J.indexOf(X)!==-1),Y={...D,...F};for(let X of Q){let E=G2(D[X],F[X]);if(!E.valid)return{valid:!1};Y[X]=E.data}return{valid:!0,data:Y}}else if($===C.array&&B===C.array){if(D.length!==F.length)return{valid:!1};let J=[];for(let Q=0;Q<D.length;Q++){let Y=D[Q],X=F[Q],E=G2(Y,X);if(!E.valid)return{valid:!1};J.push(E.data)}return{valid:!0,data:J}}else if($===C.date&&B===C.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class WF extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D),B=(J,Q)=>{if(J$(J)||J$(Q))return f;let Y=G2(J.value,Q.value);if(!Y.valid)return w($,{code:N.invalid_intersection_types}),f;if(Q$(J)||Q$(Q))F.dirty();return{status:F.value,value:Y.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:$}))}}WF.create=(D,F,$)=>{return new WF({left:D,right:F,typeName:g.ZodIntersection,...i($)})};class b1 extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.array)return w($,{code:N.invalid_type,expected:C.array,received:$.parsedType}),f;if($.data.length<this._def.items.length)return w($,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&$.data.length>this._def.items.length)w($,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let J=[...$.data].map((Q,Y)=>{let X=this._def.items[Y]||this._def.rest;if(!X)return null;return X._parse(new X1($,Q,$.path,Y))}).filter((Q)=>!!Q);if($.common.async)return Promise.all(J).then((Q)=>{return nD.mergeArray(F,Q)});else return nD.mergeArray(F,J)}get items(){return this._def.items}rest(D){return new b1({...this._def,rest:D})}}b1.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new b1({items:D,typeName:g.ZodTuple,rest:null,...i(F)})};class B5 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.object)return w($,{code:N.invalid_type,expected:C.object,received:$.parsedType}),f;let B=[],J=this._def.keyType,Q=this._def.valueType;for(let Y in $.data)B.push({key:J._parse(new X1($,Y,$.path,Y)),value:Q._parse(new X1($,$.data[Y],$.path,Y)),alwaysSet:Y in $.data});if($.common.async)return nD.mergeObjectAsync(F,B);else return nD.mergeObjectSync(F,B)}get element(){return this._def.valueType}static create(D,F,$){if(F instanceof r)return new B5({keyType:D,valueType:F,typeName:g.ZodRecord,...i($)});return new B5({keyType:J1.create(),valueType:D,typeName:g.ZodRecord,...i(F)})}}class J5 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.map)return w($,{code:N.invalid_type,expected:C.map,received:$.parsedType}),f;let B=this._def.keyType,J=this._def.valueType,Q=[...$.data.entries()].map(([Y,X],E)=>{return{key:B._parse(new X1($,Y,$.path,[E,"key"])),value:J._parse(new X1($,X,$.path,[E,"value"]))}});if($.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let X of Q){let E=await X.key,G=await X.value;if(E.status==="aborted"||G.status==="aborted")return f;if(E.status==="dirty"||G.status==="dirty")F.dirty();Y.set(E.value,G.value)}return{status:F.value,value:Y}})}else{let Y=new Map;for(let X of Q){let{key:E,value:G}=X;if(E.status==="aborted"||G.status==="aborted")return f;if(E.status==="dirty"||G.status==="dirty")F.dirty();Y.set(E.value,G.value)}return{status:F.value,value:Y}}}}J5.create=(D,F,$)=>{return new J5({valueType:F,keyType:D,typeName:g.ZodMap,...i($)})};class v6 extends r{_parse(D){let{status:F,ctx:$}=this._processInputParams(D);if($.parsedType!==C.set)return w($,{code:N.invalid_type,expected:C.set,received:$.parsedType}),f;let B=this._def;if(B.minSize!==null){if($.data.size<B.minSize.value)w($,{code:N.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)w($,{code:N.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(X){let E=new Set;for(let G of X){if(G.status==="aborted")return f;if(G.status==="dirty")F.dirty();E.add(G.value)}return{status:F.value,value:E}}let Y=[...$.data.values()].map((X,E)=>J._parse(new X1($,X,$.path,E)));if($.common.async)return Promise.all(Y).then((X)=>Q(X));else return Q(Y)}min(D,F){return new v6({...this._def,minSize:{value:D,message:y.toString(F)}})}max(D,F){return new v6({...this._def,maxSize:{value:D,message:y.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}v6.create=(D,F)=>{return new v6({valueType:D,minSize:null,maxSize:null,typeName:g.ZodSet,...i(F)})};class YF extends r{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.function)return w(F,{code:N.invalid_type,expected:C.function,received:F.parsedType}),f;function $(Y,X){return D5({data:Y,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,BF(),F8].filter((E)=>!!E),issueData:{code:N.invalid_arguments,argumentsError:X}})}function B(Y,X){return D5({data:Y,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,BF(),F8].filter((E)=>!!E),issueData:{code:N.invalid_return_type,returnTypeError:X}})}let J={errorMap:F.common.contextualErrorMap},Q=F.data;if(this._def.returns instanceof y6){let Y=this;return eD(async function(...X){let E=new A0([]),G=await Y._def.args.parseAsync(X,J).catch((V)=>{throw E.addIssue($(X,V)),E}),H=await Reflect.apply(Q,this,G);return await Y._def.returns._def.type.parseAsync(H,J).catch((V)=>{throw E.addIssue(B(H,V)),E})})}else{let Y=this;return eD(function(...X){let E=Y._def.args.safeParse(X,J);if(!E.success)throw new A0([$(X,E.error)]);let G=Reflect.apply(Q,this,E.data),H=Y._def.returns.safeParse(G,J);if(!H.success)throw new A0([B(G,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new YF({...this._def,args:b1.create(D).rest(n8.create())})}returns(D){return new YF({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,$){return new YF({args:D?D:b1.create([]).rest(n8.create()),returns:F||n8.create(),typeName:g.ZodFunction,...i($)})}}class qF extends r{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})}}qF.create=(D,F)=>{return new qF({getter:D,typeName:g.ZodLazy,...i(F)})};class KF extends r{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return w(F,{received:F.data,code:N.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:D.data}}get value(){return this._def.value}}KF.create=(D,F)=>{return new KF({value:D,typeName:g.ZodLiteral,...i(F)})};function lk(D,F){return new o8({values:D,typeName:g.ZodEnum,...i(F)})}class o8 extends r{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),$=this._def.values;return w(F,{expected:DD.joinValues($),received:F.parsedType,code:N.invalid_type}),f}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 w(F,{received:F.data,code:N.invalid_enum_value,options:$}),f}return eD(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 o8.create(D,{...this._def,...F})}exclude(D,F=this._def){return o8.create(this.options.filter(($)=>!D.includes($)),{...this._def,...F})}}o8.create=lk;class zF extends r{_parse(D){let F=DD.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(D);if($.parsedType!==C.string&&$.parsedType!==C.number){let B=DD.objectValues(F);return w($,{expected:DD.joinValues(B),received:$.parsedType,code:N.invalid_type}),f}if(!this._cache)this._cache=new Set(DD.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=DD.objectValues(F);return w($,{received:$.data,code:N.invalid_enum_value,options:B}),f}return eD(D.data)}get enum(){return this._def.values}}zF.create=(D,F)=>{return new zF({values:D,typeName:g.ZodNativeEnum,...i(F)})};class y6 extends r{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==C.promise&&F.common.async===!1)return w(F,{code:N.invalid_type,expected:C.promise,received:F.parsedType}),f;let $=F.parsedType===C.promise?F.data:Promise.resolve(F.data);return eD($.then((B)=>{return this._def.type.parseAsync(B,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}y6.create=(D,F)=>{return new y6({type:D,typeName:g.ZodPromise,...i(F)})};class E1 extends r{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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(w($,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(Y)=>{if(F.value==="aborted")return f;let X=await this._def.schema._parseAsync({data:Y,path:$.path,parent:$});if(X.status==="aborted")return f;if(X.status==="dirty")return P6(X.value);if(F.value==="dirty")return P6(X.value);return X});else{if(F.value==="aborted")return f;let Y=this._def.schema._parseSync({data:Q,path:$.path,parent:$});if(Y.status==="aborted")return f;if(Y.status==="dirty")return P6(Y.value);if(F.value==="dirty")return P6(Y.value);return Y}}if(B.type==="refinement"){let Q=(Y)=>{let X=B.refinement(Y,J);if($.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if($.common.async===!1){let Y=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(Y.status==="aborted")return f;if(Y.status==="dirty")F.dirty();return Q(Y.value),{status:F.value,value:Y.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Y)=>{if(Y.status==="aborted")return f;if(Y.status==="dirty")F.dirty();return Q(Y.value).then(()=>{return{status:F.value,value:Y.value}})})}if(B.type==="transform")if($.common.async===!1){let Q=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!c8(Q))return f;let Y=B.transform(Q.value,J);if(Y instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:Y}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((Q)=>{if(!c8(Q))return f;return Promise.resolve(B.transform(Q.value,J)).then((Y)=>({status:F.value,value:Y}))});DD.assertNever(B)}}E1.create=(D,F,$)=>{return new E1({schema:D,typeName:g.ZodEffects,effect:F,...i($)})};E1.createWithPreprocess=(D,F,$)=>{return new E1({schema:F,effect:{type:"preprocess",transform:D},typeName:g.ZodEffects,...i($)})};class Y1 extends r{_parse(D){if(this._getType(D)===C.undefined)return eD(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}Y1.create=(D,F)=>{return new Y1({innerType:D,typeName:g.ZodOptional,...i(F)})};class B8 extends r{_parse(D){if(this._getType(D)===C.null)return eD(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}B8.create=(D,F)=>{return new B8({innerType:D,typeName:g.ZodNullable,...i(F)})};class VF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$=F.data;if(F.parsedType===C.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}VF.create=(D,F)=>{return new VF({innerType:D,typeName:g.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...i(F)})};class AF extends r{_parse(D){let{ctx:F}=this._processInputParams(D),$={...F,common:{...F.common,issues:[]}},B=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(JF(B))return B.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new A0($.common.issues)},input:$.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new A0($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}AF.create=(D,F)=>{return new AF({innerType:D,typeName:g.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...i(F)})};class Q5 extends r{_parse(D){if(this._getType(D)!==C.nan){let $=this._getOrReturnCtx(D);return w($,{code:N.invalid_type,expected:C.nan,received:$.parsedType}),f}return{status:"valid",value:D.data}}}Q5.create=(D)=>{return new Q5({typeName:g.ZodNaN,...i(D)})};var kXD=Symbol("zod_brand");class X$ extends r{_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 Y5 extends r{_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 f;if(J.status==="dirty")return F.dirty(),P6(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 f;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 Y5({in:D,out:F,typeName:g.ZodPipeline})}}class ZF extends r{_parse(D){let F=this._def.innerType._parse(D),$=(B)=>{if(c8(B))B.value=Object.freeze(B.value);return B};return JF(F)?F.then((B)=>$(B)):$(F)}unwrap(){return this._def.innerType}}ZF.create=(D,F)=>{return new ZF({innerType:D,typeName:g.ZodReadonly,...i(F)})};function hk(D,F){let $=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof $==="string"?{message:$}:$}function dk(D,F={},$){if(D)return k6.create().superRefine((B,J)=>{let Q=D(B);if(Q instanceof Promise)return Q.then((Y)=>{if(!Y){let X=hk(F,B),E=X.fatal??$??!0;J.addIssue({code:"custom",...X,fatal:E})}});if(!Q){let Y=hk(F,B),X=Y.fatal??$??!0;J.addIssue({code:"custom",...Y,fatal:X})}return});return k6.create()}var vXD={object:TD.lazycreate},g;(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"})(g||(g={}));var yXD=(D,F={message:`Input not instance of ${D.name}`})=>dk(($)=>$ instanceof D,F),pk=J1.create,ck=i8.create,xXD=Q5.create,_XD=a8.create,nk=XF.create,fXD=S6.create,gXD=F5.create,hXD=EF.create,bXD=GF.create,uXD=k6.create,mXD=n8.create,lXD=h1.create,dXD=$5.create,pXD=Q1.create,cXD=TD.create,nXD=TD.strictCreate,iXD=HF.create,aXD=Y$.create,oXD=WF.create,sXD=b1.create,rXD=B5.create,tXD=J5.create,eXD=v6.create,D2D=YF.create,F2D=qF.create,$2D=KF.create,B2D=o8.create,J2D=zF.create,Q2D=y6.create,Y2D=E1.create,X2D=Y1.create,E2D=B8.create,G2D=E1.createWithPreprocess,H2D=Y5.create,W2D=()=>pk().optional(),q2D=()=>ck().optional(),K2D=()=>nk().optional(),z2D={string:(D)=>J1.create({...D,coerce:!0}),number:(D)=>i8.create({...D,coerce:!0}),boolean:(D)=>XF.create({...D,coerce:!0}),bigint:(D)=>a8.create({...D,coerce:!0}),date:(D)=>S6.create({...D,coerce:!0})};var V2D=f;var lND=G1.object({apiKey:G1.string().optional(),apiUrl:G1.string().url().default("https://api.osc.earth/nemar"),username:G1.string().optional(),email:G1.string().email().optional(),githubUsername:G1.string().optional(),sandboxCompleted:G1.boolean().optional(),sandboxDatasetId:G1.string().optional()}),C0=new B$({projectName:"nemar",schema:{apiKey:{type:"string"},apiUrl:{type:"string",default:"https://api.osc.earth/nemar"},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 iD(){return{apiKey:C0.get("apiKey"),apiUrl:C0.get("apiUrl"),username:C0.get("username"),email:C0.get("email"),githubUsername:C0.get("githubUsername"),sandboxCompleted:C0.get("sandboxCompleted"),sandboxDatasetId:C0.get("sandboxDatasetId")}}function ik(){return!!C0.get("sandboxCompleted")}function Q0(D,F){C0.set(D,F)}function H2(D){C0.delete(D)}function ak(){C0.clear()}function gD(){return!!C0.get("apiKey")}function ok(){return C0.path}var A2D="https://api.osc.earth/nemar";class BD extends Error{statusCode;details;constructor(D,F,$){super(F);this.statusCode=D;this.details=$;this.name="ApiError"}}function sk(){return iD().apiUrl||A2D}async function jD(D,F={},$=!1){let B=`${sk()}${D}`,J={"Content-Type":"application/json",...F.headers};if($){let X=iD();if(!X.apiKey)throw new BD(401,"Not authenticated. Run 'nemar auth login' first.");J.Authorization=`Bearer ${X.apiKey}`}let Q;try{Q=await fetch(B,{...F,headers:J})}catch(X){throw new BD(0,`Network error: Could not connect to ${sk()}`,{originalError:X instanceof Error?X.message:String(X)})}let Y;try{Y=await Q.json()}catch{throw new BD(Q.status,`Invalid response from server (status ${Q.status})`)}if(!Q.ok)throw new BD(Q.status,Y.error||Y.message||"Request failed",Y.details);return Y}async function rk(D){return jD(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function tk(D){return jD(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function ek(D){return jD("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function Dv(D){return jD("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function Fv(D){return jD("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function $v(){return jD("/users/me",{},!0)}async function Bv(D){let F=D?`?status=${D}`:"";return jD(`/admin/users${F}`,{},!0)}async function Jv(D){return jD(`/admin/approve/${D}`,{method:"POST"},!0)}async function Qv(D){return jD(`/admin/revoke/${D}`,{method:"POST"},!0)}async function Yv(D){return jD(`/admin/regenerate-iam/${D}`,{method:"POST"},!0)}async function Xv(){return jD("/datasets")}async function x6(D){return(await jD(`/datasets/${D}`)).dataset}async function E$(D){return jD("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function G$(D){return jD(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function Ev(D,F){return jD(`/datasets/${D}/upload-urls`,{method:"POST",body:JSON.stringify({files:F})},!0)}async function Gv(D,F){return jD(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function W2(D){return jD(`/admin/datasets/${D}/doi`,{},!0)}async function Hv(D){return jD(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function Wv(D,F){return jD(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function qv(D){return jD(`/datasets/${D}/collaborators`,{},!0)}async function Kv(D){return jD("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function zv(){return jD("/sandbox/reset",{method:"POST"},!0)}async function Vv(){return jD("/sandbox/status",{},!0)}async function u0(D,F,$=!1){if(F.no)return"declined";if(F.yes)return"confirmed";try{let{confirmed:B}=await j1.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 Av(D,F,$){if($.no)return"declined";if($.yes)return"confirmed";try{let{input:B}=await j1.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 R0="-y, --yes",H1="-n, --no",I0="Skip confirmation and proceed",W1="Skip confirmation and decline";import{existsSync as Uv,statSync as Z2D}from"fs";import{join as q2}from"path";var{spawn:U2D}=globalThis.Bun;async function a(D,F={}){let $=U2D({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 Zv(D){return D.split(".").map((F)=>{let $=Number.parseInt(F.replace(/[^0-9]/g,""),10);return Number.isNaN($)?0:$})}function L2D(D,F){let $=Zv(D),B=Zv(F);for(let J=0;J<Math.max($.length,B.length);J++){let Q=$[J]||0,Y=B[J]||0;if(Q>Y)return!0;if(Q<Y)return!1}return!0}async function Lv(){try{let{stdout:F,exitCode:$,stderr:B}=await a(["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?L2D(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 M2D(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:D,stderr:F,exitCode:$}=await a(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","git@github.com"],{timeout:1e4}),B=D+F,J=B.match(/Hi ([^!]+)!/);if(J)return{accessible:!0,username:J[1]};if(B.includes("Permission denied"))return{accessible:!1};return{accessible:B.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 Mv(){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 H$(){let[D,F]=await Promise.all([Lv(),M2D()]),$=[];if(!D.installed)$.push(`git-annex is not installed. Install: ${Mv()}`);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 K2(D){if(!Uv(q2(D,".git")))return!1;try{let{exitCode:F}=await a(["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 W$(D,F={}){if(!F.force&&await K2(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 a(["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:Y}=await a(["git","annex","init"],{cwd:D,...Object.keys($).length>0?{env:$}:{}});if(Y!==0)return{success:!1,error:Q.trim()||"Failed to initialize git-annex"};return{success:!0}}catch($){return{success:!1,error:$.message}}}async function Nv(D){try{let{exitCode:F,stderr:$}=await a(["git","annex","info"],{cwd:D});if(F===0)return{success:!0};if($.includes("First run: git-annex init")){let{stderr:B,exitCode:J}=await a(["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 q$(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 a(["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 N2D(){try{let{exitCode:D,stderr:F}=await a(["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 C2D(){try{let{stdout:D,exitCode:F,stderr:$}=await a(["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 K$(D){try{let{stdout:F,exitCode:$,stderr:B}=await a(["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 z$(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 a(["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((G)=>G.repository.full_name===D)?.id??null}catch(X){let E=X instanceof Error?X.message:String(X);return console.error("Failed to parse GitHub invitations response:",E),console.error(" Raw response (first 500 chars):",(F||"").slice(0,500)),{accepted:!1,error:`Failed to parse GitHub API response: ${E}`}}if(!J){let{exitCode:X}=await a(["gh","api",`/repos/${D}`,"--silent"]);if(X===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:Y}=await a(["gh","api","--method","PATCH",`/user/repository_invitations/${J}`]);if(Q!==0)return{accepted:!1,error:`Failed to accept invitation: ${Y.trim()||"unknown error"}`};return{accepted:!0}}async function V$(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 N2D();if(Q.works)B=F;else{console.warn("GitHub SSH not available, falling back to HTTPS with gh CLI token...");let Y=await C2D();if(Y.token)B=`https://${Y.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.
|
|
92
92
|
|
|
93
93
|
SSH failed: ${Q.error||"could not connect"}
|
|
94
94
|
gh CLI failed: ${Y.error||"could not get token"}
|
|
@@ -100,7 +100,7 @@ Fix one of these:
|
|
|
100
100
|
Test with: ssh -T git@github.com
|
|
101
101
|
|
|
102
102
|
2. Install and authenticate gh CLI:
|
|
103
|
-
gh auth login`}}}try{let{stdout:J}=await a(["git","remote","get-url",$],{cwd:D});if(J.trim()){let{stderr:Q,exitCode:Y}=await a(["git","remote","set-url",$,B],{cwd:D});if(Y!==0)return{success:!1,error:Q.trim()}}else{let{stderr:Q,exitCode:Y}=await a(["git","remote","add",$,B],{cwd:D});if(Y!==0)return{success:!1,error:Q.trim()}}return{success:!0}}catch(J){return{success:!1,error:J.message}}}async function A$(D,F,$){try{let B={};if($)B.GIT_AUTHOR_NAME=$.name,B.GIT_AUTHOR_EMAIL=$.email,B.GIT_COMMITTER_NAME=$.name,B.GIT_COMMITTER_EMAIL=$.email;let{stderr:J,exitCode:Q}=await a(["git","add","-A"],{cwd:D,...Object.keys(B).length>0?{env:B}:{}});if(Q!==0)return{success:!1,error:J.trim()||"Failed to stage changes"};let{stdout:Y,exitCode:X,stderr:E}=await a(["git","status","--porcelain"],{cwd:D});if(X!==0)return{success:!1,error:E.trim()||"Failed to check git status"};if(!Y.trim())return{success:!0};let{stderr:G,exitCode:H}=await a(["git","commit","-m",F],{cwd:D,...Object.keys(B).length>0?{env:B}:{}});if(H!==0){if(G.includes("nothing to commit"))return{success:!0};return{success:!1,error:G.trim()||"Failed to commit changes"}}return{success:!0}}catch(B){return{success:!1,error:B.message}}}async function Z$(D,F="origin",$){try{let B=$;if(!B){let E=await w2D(D);if(!E||E==="HEAD"){let{exitCode:G}=await a(["git","log","-1","--oneline"],{cwd:D});if(G!==0)return{success:!1,error:"No commits found. The repository may not have been initialized correctly, or no changes were saved before pushing."};if(E==="HEAD")B="HEAD:main";else return{success:!1,error:"Could not detect current branch"}}else B=E}let{stderr:J,exitCode:Q}=await a(["git","push","-u",F,B],{cwd:D});if(Q!==0)return{success:!1,error:J.trim()||"Failed to push to GitHub"};let{stderr:Y,exitCode:X}=await a(["git","push",F,"git-annex"],{cwd:D});if(X!==0)return{success:!0,warning:`Main branch pushed, but git-annex branch failed: ${Y.trim()}. Clone operations may have issues.`};return{success:!0}}catch(B){return{success:!1,error:B.message}}}function U$(D){if(D===0)return"0 B";let F=1024,$=["B","KB","MB","GB","TB"],B=Math.floor(Math.log(D)/Math.log(F));return`${Number.parseFloat((D/F**B).toFixed(2))} ${$[B]}`}async function R2D(D,F,$,B){let J=B?.maxRetries??4,Q=B?.initialDelayMs??1e4;try{let Y=await Bun.file(D).arrayBuffer(),X=Y.byteLength,E="";for(let G=0;G<=J;G++){let H=await fetch(F,{method:"PUT",body:Y,headers:{"Content-Length":X.toString()}});if(H.ok)return $?.(X,X),{success:!0};let q=await H.text();E=`Upload failed: ${H.status} ${q}`;let V=H.status===403&&q.includes("AccessDenied"),A=H.status===503&&q.includes("SlowDown");if(!
|
|
103
|
+
gh auth login`}}}try{let{stdout:J}=await a(["git","remote","get-url",$],{cwd:D});if(J.trim()){let{stderr:Q,exitCode:Y}=await a(["git","remote","set-url",$,B],{cwd:D});if(Y!==0)return{success:!1,error:Q.trim()}}else{let{stderr:Q,exitCode:Y}=await a(["git","remote","add",$,B],{cwd:D});if(Y!==0)return{success:!1,error:Q.trim()}}return{success:!0}}catch(J){return{success:!1,error:J.message}}}async function A$(D,F,$){try{let B={};if($)B.GIT_AUTHOR_NAME=$.name,B.GIT_AUTHOR_EMAIL=$.email,B.GIT_COMMITTER_NAME=$.name,B.GIT_COMMITTER_EMAIL=$.email;let{stderr:J,exitCode:Q}=await a(["git","add","-A"],{cwd:D,...Object.keys(B).length>0?{env:B}:{}});if(Q!==0)return{success:!1,error:J.trim()||"Failed to stage changes"};let{stdout:Y,exitCode:X,stderr:E}=await a(["git","status","--porcelain"],{cwd:D});if(X!==0)return{success:!1,error:E.trim()||"Failed to check git status"};if(!Y.trim())return{success:!0};let{stderr:G,exitCode:H}=await a(["git","commit","-m",F],{cwd:D,...Object.keys(B).length>0?{env:B}:{}});if(H!==0){if(G.includes("nothing to commit"))return{success:!0};return{success:!1,error:G.trim()||"Failed to commit changes"}}return{success:!0}}catch(B){return{success:!1,error:B.message}}}async function Z$(D,F="origin",$){try{let B=$;if(!B){let E=await w2D(D);if(!E||E==="HEAD"){let{exitCode:G}=await a(["git","log","-1","--oneline"],{cwd:D});if(G!==0)return{success:!1,error:"No commits found. The repository may not have been initialized correctly, or no changes were saved before pushing."};if(E==="HEAD")B="HEAD:main";else return{success:!1,error:"Could not detect current branch"}}else B=E}let{stderr:J,exitCode:Q}=await a(["git","push","-u",F,B],{cwd:D});if(Q!==0)return{success:!1,error:J.trim()||"Failed to push to GitHub"};let{stderr:Y,exitCode:X}=await a(["git","push",F,"git-annex"],{cwd:D});if(X!==0)return{success:!0,warning:`Main branch pushed, but git-annex branch failed: ${Y.trim()}. Clone operations may have issues.`};return{success:!0}}catch(B){return{success:!1,error:B.message}}}function U$(D){if(D===0)return"0 B";let F=1024,$=["B","KB","MB","GB","TB"],B=Math.floor(Math.log(D)/Math.log(F));return`${Number.parseFloat((D/F**B).toFixed(2))} ${$[B]}`}async function R2D(D,F,$,B){let J=B?.maxRetries??4,Q=B?.initialDelayMs??1e4;try{let Y=await Bun.file(D).arrayBuffer(),X=Y.byteLength,E="";for(let G=0;G<=J;G++){let H=await fetch(F,{method:"PUT",body:Y,headers:{"Content-Length":X.toString()}});if(H.ok)return $?.(X,X),{success:!0};let q=await H.text();E=`Upload failed: ${H.status} ${q}`;let V=H.status===403&&q.includes("AccessDenied"),A=H.status===503&&q.includes("SlowDown"),Z=V||A;if(!Z||G===J){if(Z&&G===J)console.warn(`Upload failed after ${J} retries: ${D}`);return{success:!1,error:E}}let U=A?Math.min(4000*2**G,30000):Q+G*5000;if(A)console.warn(`S3 rate limit hit, retrying in ${U/1000}s (attempt ${G+1}/${J})...`);else if(V)console.warn(`Waiting for S3 permissions to propagate, retrying in ${U/1000}s (attempt ${G+1}/${J})...`);await new Promise((L)=>setTimeout(L,U))}return{success:!1,error:E}}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return{success:!1,error:`Failed to upload ${D}: ${X}`}}}async function L$(D,F,$={}){let B=$.jobs||4,J=Object.entries(F),Q=[],Y=0;for(let X=0;X<J.length;X+=B){let E=J.slice(X,X+B);await Promise.all(E.map(async([G,H])=>{let q=q2(D,G);$.onProgress?.({file:G,uploaded:0,total:0,status:"uploading"});let V=await R2D(q,H);if(V.success)Y++,$.onProgress?.({file:G,uploaded:1,total:1,status:"completed"});else Q.push(`${G}: ${V.error||"Unknown error"}`),$.onProgress?.({file:G,uploaded:0,total:1,status:"failed",error:V.error})}))}return{success:Q.length===0,uploaded:Y,failed:Q,error:Q.length>0?`${Q.length} files failed to upload`:void 0}}async function I2D(D,F,$){try{if((await a(["git","annex","add",F],{cwd:D})).exitCode!==0);let J=await a(["git","annex","lookupkey",F],{cwd:D});if(J.exitCode!==0||!J.stdout.trim())return{success:!1,error:`Could not get git-annex key for ${F}`};let Q=J.stdout.trim(),Y=await a(["git","annex","registerurl",Q,$],{cwd:D});if(Y.exitCode!==0)return{success:!1,error:`Failed to register URL: ${Y.stderr}`};return{success:!0}}catch(B){return{success:!1,error:B.message}}}async function M$(D,F,$){let B=0,J=[];for(let[Q,Y]of Object.entries(F))if((await I2D(D,Q,Y)).success)B++,$?.(Q,!0);else J.push(Q),$?.(Q,!1);return{success:J.length===0,registered:B,failed:J}}async function N$(){let D=await Lv(),F=[];if(!D.installed)F.push(`git-annex is not installed. Install: ${Mv()}`);else if(D.compatible===!1)F.push(`git-annex version ${D.version} is too old. Required: >= ${D.minVersion}`);return{gitAnnex:D,allPassed:F.length===0,errors:F}}async function C$(D,F){try{let{stderr:$,exitCode:B}=await a(["git","clone",D,F]);if(B!==0)return{success:!1,error:$.trim()||"Failed to clone dataset"};let{stderr:J,exitCode:Q}=await a(["git","annex","init"],{cwd:F});if(Q!==0){let{exitCode:Y}=await a(["git","annex","info"],{cwd:F});if(Y!==0)return{success:!1,error:`Cloned repository but git-annex initialization failed: ${J.trim()}`};console.warn("git annex init returned non-zero but annex is initialized")}return{success:!0}}catch($){return{success:!1,error:$.message}}}async function Cv(D,F={}){let $=F.jobs||4,B=F.paths&&F.paths.length>0?F.paths:["."];try{let J=["git","annex","get","-J",$.toString(),...B],{stdout:Q,stderr:Y,exitCode:X}=await a(J,{cwd:D});if(X!==0)return{success:!1,error:Y.trim()||"Failed to get dataset data"};let E=Q.match(/^get .+ ok$/gm);return{success:!0,filesDownloaded:E?E.length:0}}catch(J){return{success:!1,error:J.message}}}async function Rv(D){if(!Uv(D))return null;try{let{stdout:F,exitCode:$}=await a(["git","annex","info","--json"],{cwd:D});if($===0){let B=JSON.parse(F),J=0,Q=B["local annex size"]||"0 bytes",Y=Q.match(/([\d.]+)\s*(bytes?|KB|MB|GB|TB)/i);if(Y){let G=Number.parseFloat(Y[1]),H=Y[2].toLowerCase();J=G*({byte:1,bytes:1,kb:1024,mb:1048576,gb:1073741824,tb:1099511627776}[H]||1)}let X=B["annexed files in working tree"]||0,E=B["local annex keys"]||0;return{files:X,size:Q,sizeBytes:J,annexedFiles:X,presentFiles:E,missingFiles:X-E}}}catch(F){let $=F instanceof Error?F.message:String(F);console.warn(`Failed to get git-annex info for ${D}: ${$}`)}try{let{stdout:F}=await a(["find",".","-type","f","-not","-path","./.git/*"],{cwd:D}),$=F.trim().split(`
|
|
104
104
|
`).filter(Boolean).length;return{files:$,size:"unknown",sizeBytes:0,annexedFiles:0,presentFiles:$,missingFiles:0}}catch(F){let $=F instanceof Error?F.message:String(F);return console.warn(`Failed to count files in ${D}: ${$}`),null}}async function Iv(D){try{let{stdout:F,exitCode:$}=await a(["git","tag","-l","--sort=-version:refname","--format=%(refname:short)|%(creatordate:short)|%(objectname:short)"],{cwd:D});if($!==0||!F.trim())return[];return F.trim().split(`
|
|
105
105
|
`).map((B)=>{let[J,Q,Y]=B.split("|");return{version:J,date:Q,commit:Y}})}catch{return[]}}async function wv(D,F){try{let $=F.startsWith("v")?F:`v${F}`,{stdout:B,exitCode:J}=await a(["git","rev-parse",$],{cwd:D});if(J!==0)return null;return B.trim()}catch{return null}}async function Ov(D,F,$){try{let{stderr:B,exitCode:J}=await a(["git","checkout","-b",$],{cwd:D});if(J!==0)return{success:!1,error:B.trim()||"Failed to create branch"};let Q=F.startsWith("v")?F:`v${F}`,{stderr:Y,exitCode:X}=await a(["git","checkout",Q,"--","."],{cwd:D});if(X!==0)return{success:!1,error:Y.trim()||"Failed to checkout files from target version"};return{success:!0}}catch(B){return{success:!1,error:B.message}}}async function Tv(D,F,$){let B=$||`Revert to ${F}`;try{let{exitCode:J}=await a(["git","add","-A"],{cwd:D});if(J!==0)return{success:!1,error:"Failed to stage changes"};let{stdout:Q}=await a(["git","status","--porcelain"],{cwd:D});if(!Q.trim())return{success:!1,error:"No changes to revert (already at target version)"};let{stderr:Y,exitCode:X}=await a(["git","commit","-m",B],{cwd:D});if(X!==0)return{success:!1,error:Y.trim()||"Failed to commit"};return{success:!0}}catch(J){return{success:!1,error:J.message}}}async function jv(D,F,$="origin"){try{let{stderr:B,exitCode:J}=await a(["git","push","-u",$,F],{cwd:D});if(J!==0)return{success:!1,error:B.trim()||"Failed to push branch"};return{success:!0}}catch(B){return{success:!1,error:B.message}}}async function w2D(D){try{let{stdout:F,exitCode:$}=await a(["git","rev-parse","--abbrev-ref","HEAD"],{cwd:D});if($!==0)return null;return F.trim()}catch{return null}}var O2D=102400,T2D=new Set([".edf",".bdf",".eeg",".vhdr",".vmrk",".set",".fdt",".cnt",".mff",".fif",".nii",".nii.gz",".mat",".bin"]);async function Pv(D){let F=[],$=0,B=0,J=0,{stdout:Q,exitCode:Y}=await a(["find",".","-type","f","-not","-path","./.git/*","-not","-name",".gitattributes"],{cwd:D});if(Y!==0)return{files:F,totalSize:$,dataFiles:B,metadataFiles:J};let X=Q.trim().split(`
|
|
106
106
|
`).filter(Boolean);for(let E of X){let G=E.startsWith("./")?E.slice(2):E,H=q2(D,G);try{let V=Z2D(H).size;$+=V;let A=G.toLowerCase().match(/\.[^.]+$/)?.[0]||"",Z=T2D.has(A)||V>O2D,U=Z?"data":"metadata";if(Z)B++;else J++;F.push({path:G,size:V,type:U})}catch{}}return{files:F,totalSize:$,dataFiles:B,metadataFiles:J}}var s8=new m0("admin").description("Admin commands (requires admin privileges)").addHelpText("after",`
|
|
@@ -344,7 +344,7 @@ Examples:
|
|
|
344
344
|
$ nemar sandbox # Run sandbox training
|
|
345
345
|
$ nemar sandbox status # Check if training is completed
|
|
346
346
|
$ nemar sandbox reset # Reset for re-training
|
|
347
|
-
`).action(a2D);async function a2D(){if(console.log(),console.log(z.bold("NEMAR Sandbox Training")),console.log(z.gray("Verify your setup and learn the upload workflow")),console.log(),!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}let D=iD();if(D.sandboxCompleted){console.log(z.green("Sandbox training already completed!")),console.log(z.gray(`Dataset ID: ${D.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(z.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(z.gray("To re-run training, use: nemar sandbox reset"));return}console.log(z.bold("Step 1/6: Checking prerequisites..."));let F=k("Checking git-annex and SSH...").start(),$=await H$();if(!$.allPassed){F.fail("Prerequisites check failed"),console.log(),console.log(z.red("Missing requirements:"));for(let j of $.errors)console.log(z.yellow(` - ${j}`));if(!$.githubSSH.accessible)console.log(z.gray(" Run 'nemar auth setup-ssh' to configure SSH"));return}F.succeed("All prerequisites met");let B=k("Verifying GitHub CLI authentication...").start(),J=await K$(D.githubUsername);if(!J.authenticated){B.fail("GitHub CLI not authenticated"),console.log(z.red(` ${J.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(z.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(z.cyan(" gh auth login"));return}if(D.githubUsername&&!J.matches)B.warn("GitHub CLI user mismatch"),console.log(z.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(z.cyan(` gh auth login # Login as ${D.githubUsername}`)),console.log(),console.log(z.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(z.bold("Step 2/6: Generating test dataset..."));let Q=k("Creating minimal BIDS structure...").start(),Y;try{let j=lv();Y=j.root;let KD=dv(j);Q.succeed(`Test dataset created (${U$(KD)})`),console.log(z.gray(` Location: ${Y}`))}catch(j){Q.fail("Failed to generate test dataset"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`));return}console.log(),console.log(z.bold("Step 3/6: Registering sandbox dataset..."));let X=k("Creating dataset on NEMAR...").start(),E,G,H,q,V,A;try{let j=await E$({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});E=j.dataset.dataset_id,G=j.dataset.ssh_url,H=j.dataset.github_url,q=j.s3_config,V=j.dataset.s3_prefix,A=j.upload_urls||{},X.succeed(`Sandbox dataset created: ${z.cyan(E)}`),console.log(z.gray(` GitHub: ${H}`)),await new Promise((KD)=>setTimeout(KD,1e4))}catch(j){if(X.fail("Failed to create sandbox dataset"),j instanceof BD)console.log(z.red(` ${j.message}`));else console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`));K1(Y);return}let Z=k("Accepting GitHub repository invitation...").start(),U=H?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),L=U?U[1].replace(/\.git$/,""):null;if(!L){Z.fail("Invalid GitHub repository URL from backend"),console.log(z.red(` Received: ${H||"(empty)"}`)),console.log(z.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),K1(Y);return}let M=await z$(L);if(M.accepted)if(M.alreadyCollaborator)Z.succeed("Already a collaborator on this repository");else Z.succeed("GitHub invitation accepted");else Z.warn("Could not auto-accept invitation"),console.log(z.yellow(` ${M.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(z.cyan(` https://github.com/${L}/invitations`)),console.log();console.log(),console.log(z.bold("Step 4/6: Initializing repository..."));let R=k("Setting up git-annex...").start(),T=D.username&&D.email?{name:D.username,email:D.email}:void 0;try{await W$(Y,{author:T}),await q$(Y),await V$(Y,G),R.succeed("Repository initialized")}catch(j){R.fail("Failed to initialize repository"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}if(console.log(),console.log(z.bold("Step 5/6: Uploading to S3...")),Object.keys(A).length===0)console.log(z.yellow(" No data files to upload (metadata only)"));else{let j=k("Uploading test data...").start();try{let vD=0,d=Object.keys(A).length,zD=await L$(Y,A,{jobs:4,onProgress:(GD)=>{if(GD.status==="completed"||GD.status==="failed")vD++,j.text=`Uploading... ${vD}/${d} files`}});if(zD.failed.length>0){j.fail(`Upload failed for ${zD.failed.length} file(s)`);for(let GD of zD.failed)console.log(z.red(` Failed: ${GD}`));if(zD.error)console.log(z.red(` Error: ${zD.error}`));console.log(),console.log(z.yellow("Sandbox training aborted due to upload failures.")),console.log(z.gray("Please check your network connection and try again.")),K1(Y);return}j.succeed(`Uploaded ${zD.uploaded} file(s)`)}catch(vD){j.fail("Upload failed"),console.log(z.red(` ${vD instanceof Error?vD.message:"Unknown error"}`)),K1(Y);return}let KD=k("Registering file URLs...").start();try{let vD={};for(let zD of Object.keys(A))vD[zD]=`${q.public_url}/${V}/${zD}`;let d=await M$(Y,vD);if(!d.success){KD.fail(`URL registration failed for ${d.failed.length} file(s)`);for(let zD of d.failed)console.log(z.red(` Failed: ${zD}`));console.log(),console.log(z.yellow("Sandbox training aborted due to URL registration failures.")),console.log(z.gray("This may indicate a git-annex configuration issue.")),K1(Y);return}KD.succeed(`Registered ${d.registered} file URLs`)}catch(vD){KD.fail("Failed to register URLs"),console.log(z.red(` ${vD instanceof Error?vD.message:"Unknown error"}`)),K1(Y);return}}console.log(),console.log(z.bold("Step 6/6: Pushing to GitHub..."));let h=k("Saving and pushing...").start();try{await A$(Y,"Initial sandbox training upload",T),await Z$(Y),h.succeed("Pushed to GitHub")}catch(j){h.fail("Failed to push to GitHub"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}let I=k("Finalizing...").start();try{await G$(E),await Kv(E),Q0("sandboxCompleted",!0),Q0("sandboxDatasetId",E),I.succeed("Sandbox training complete!")}catch(j){I.fail("Failed to finalize"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}K1(Y),console.log(),console.log(z.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(z.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(z.gray(`Sandbox dataset: ${E}`))}j$.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(D)=>{if(!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}if(D.refresh){let F=k("Checking status...").start();try{let $=await Vv();if(Q0("sandboxCompleted",$.sandbox_completed),$.sandbox_dataset_id)Q0("sandboxDatasetId",$.sandbox_dataset_id);if(F.stop(),$.sandbox_completed){if(console.log(z.green("Sandbox training: Completed")),console.log(z.gray(` Dataset ID: ${$.sandbox_dataset_id}`)),$.sandbox_completed_at)console.log(z.gray(` Completed: ${$.sandbox_completed_at}`))}else console.log(z.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(z.cyan(" nemar sandbox"))}catch($){if(F.fail("Failed to check status"),$ instanceof BD)console.log(z.red(` ${$.message}`))}}else{let F=iD();if(F.sandboxCompleted)console.log(z.green("Sandbox training: Completed")),console.log(z.gray(` Dataset ID: ${F.sandboxDatasetId}`));else console.log(z.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(z.cyan(" nemar sandbox"))}});j$.command("reset").description("Reset sandbox training status for re-training").option(R0,I0).option(H1,W1).action(async(D)=>{if(!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}if(!iD().sandboxCompleted){console.log(z.yellow("Sandbox training not yet completed")),console.log(z.gray("Nothing to reset"));return}let $=await u0("Reset sandbox training status? You will need to complete training again.",D);if($!=="confirmed"){console.log(z.gray($==="declined"?"Skipped":"Cancelled"));return}let B=k("Resetting sandbox status...").start();try{await zv(),H2("sandboxCompleted"),H2("sandboxDatasetId"),B.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(z.cyan(" nemar sandbox"))}catch(J){if(B.fail("Failed to reset"),J instanceof BD)console.log(z.red(` ${J.message}`));else console.log(z.red(` ${J instanceof Error?J.message:"Unknown error"}`))}});var pv={name:"nemar-cli",version:"0.3.7-dev.84",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/nemarDatasets/nemar-cli.git"},bugs:{url:"https://github.com/nemarDatasets/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 cv=pv.version;var z1=new m0;z1.name("nemar").description(`CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource)
|
|
347
|
+
`).action(a2D);async function a2D(){if(console.log(),console.log(z.bold("NEMAR Sandbox Training")),console.log(z.gray("Verify your setup and learn the upload workflow")),console.log(),!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}let D=iD();if(D.sandboxCompleted){console.log(z.green("Sandbox training already completed!")),console.log(z.gray(`Dataset ID: ${D.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(z.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(z.gray("To re-run training, use: nemar sandbox reset"));return}console.log(z.bold("Step 1/6: Checking prerequisites..."));let F=k("Checking git-annex and SSH...").start(),$=await H$();if(!$.allPassed){F.fail("Prerequisites check failed"),console.log(),console.log(z.red("Missing requirements:"));for(let j of $.errors)console.log(z.yellow(` - ${j}`));if(!$.githubSSH.accessible)console.log(z.gray(" Run 'nemar auth setup-ssh' to configure SSH"));return}F.succeed("All prerequisites met");let B=k("Verifying GitHub CLI authentication...").start(),J=await K$(D.githubUsername);if(!J.authenticated){B.fail("GitHub CLI not authenticated"),console.log(z.red(` ${J.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(z.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(z.cyan(" gh auth login"));return}if(D.githubUsername&&!J.matches)B.warn("GitHub CLI user mismatch"),console.log(z.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(z.cyan(` gh auth login # Login as ${D.githubUsername}`)),console.log(),console.log(z.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(z.bold("Step 2/6: Generating test dataset..."));let Q=k("Creating minimal BIDS structure...").start(),Y;try{let j=lv();Y=j.root;let KD=dv(j);Q.succeed(`Test dataset created (${U$(KD)})`),console.log(z.gray(` Location: ${Y}`))}catch(j){Q.fail("Failed to generate test dataset"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`));return}console.log(),console.log(z.bold("Step 3/6: Registering sandbox dataset..."));let X=k("Creating dataset on NEMAR...").start(),E,G,H,q,V,A;try{let j=await E$({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});E=j.dataset.dataset_id,G=j.dataset.ssh_url,H=j.dataset.github_url,q=j.s3_config,V=j.dataset.s3_prefix,A=j.upload_urls||{},X.succeed(`Sandbox dataset created: ${z.cyan(E)}`),console.log(z.gray(` GitHub: ${H}`)),await new Promise((KD)=>setTimeout(KD,1e4))}catch(j){if(X.fail("Failed to create sandbox dataset"),j instanceof BD)console.log(z.red(` ${j.message}`));else console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`));K1(Y);return}let Z=k("Accepting GitHub repository invitation...").start(),U=H?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),L=U?U[1].replace(/\.git$/,""):null;if(!L){Z.fail("Invalid GitHub repository URL from backend"),console.log(z.red(` Received: ${H||"(empty)"}`)),console.log(z.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),K1(Y);return}let M=await z$(L);if(M.accepted)if(M.alreadyCollaborator)Z.succeed("Already a collaborator on this repository");else Z.succeed("GitHub invitation accepted");else Z.warn("Could not auto-accept invitation"),console.log(z.yellow(` ${M.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(z.cyan(` https://github.com/${L}/invitations`)),console.log();console.log(),console.log(z.bold("Step 4/6: Initializing repository..."));let R=k("Setting up git-annex...").start(),T=D.username&&D.email?{name:D.username,email:D.email}:void 0;try{await W$(Y,{author:T}),await q$(Y),await V$(Y,G),R.succeed("Repository initialized")}catch(j){R.fail("Failed to initialize repository"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}if(console.log(),console.log(z.bold("Step 5/6: Uploading to S3...")),Object.keys(A).length===0)console.log(z.yellow(" No data files to upload (metadata only)"));else{let j=k("Uploading test data...").start();try{let vD=0,d=Object.keys(A).length,zD=await L$(Y,A,{jobs:4,onProgress:(GD)=>{if(GD.status==="completed"||GD.status==="failed")vD++,j.text=`Uploading... ${vD}/${d} files`}});if(zD.failed.length>0){j.fail(`Upload failed for ${zD.failed.length} file(s)`);for(let GD of zD.failed)console.log(z.red(` Failed: ${GD}`));if(zD.error)console.log(z.red(` Error: ${zD.error}`));console.log(),console.log(z.yellow("Sandbox training aborted due to upload failures.")),console.log(z.gray("Please check your network connection and try again.")),K1(Y);return}j.succeed(`Uploaded ${zD.uploaded} file(s)`)}catch(vD){j.fail("Upload failed"),console.log(z.red(` ${vD instanceof Error?vD.message:"Unknown error"}`)),K1(Y);return}let KD=k("Registering file URLs...").start();try{let vD={};for(let zD of Object.keys(A))vD[zD]=`${q.public_url}/${V}/${zD}`;let d=await M$(Y,vD);if(!d.success){KD.fail(`URL registration failed for ${d.failed.length} file(s)`);for(let zD of d.failed)console.log(z.red(` Failed: ${zD}`));console.log(),console.log(z.yellow("Sandbox training aborted due to URL registration failures.")),console.log(z.gray("This may indicate a git-annex configuration issue.")),K1(Y);return}KD.succeed(`Registered ${d.registered} file URLs`)}catch(vD){KD.fail("Failed to register URLs"),console.log(z.red(` ${vD instanceof Error?vD.message:"Unknown error"}`)),K1(Y);return}}console.log(),console.log(z.bold("Step 6/6: Pushing to GitHub..."));let h=k("Saving and pushing...").start();try{await A$(Y,"Initial sandbox training upload",T),await Z$(Y),h.succeed("Pushed to GitHub")}catch(j){h.fail("Failed to push to GitHub"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}let I=k("Finalizing...").start();try{await G$(E),await Kv(E),Q0("sandboxCompleted",!0),Q0("sandboxDatasetId",E),I.succeed("Sandbox training complete!")}catch(j){I.fail("Failed to finalize"),console.log(z.red(` ${j instanceof Error?j.message:"Unknown error"}`)),K1(Y);return}K1(Y),console.log(),console.log(z.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(z.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(z.gray(`Sandbox dataset: ${E}`))}j$.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(D)=>{if(!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}if(D.refresh){let F=k("Checking status...").start();try{let $=await Vv();if(Q0("sandboxCompleted",$.sandbox_completed),$.sandbox_dataset_id)Q0("sandboxDatasetId",$.sandbox_dataset_id);if(F.stop(),$.sandbox_completed){if(console.log(z.green("Sandbox training: Completed")),console.log(z.gray(` Dataset ID: ${$.sandbox_dataset_id}`)),$.sandbox_completed_at)console.log(z.gray(` Completed: ${$.sandbox_completed_at}`))}else console.log(z.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(z.cyan(" nemar sandbox"))}catch($){if(F.fail("Failed to check status"),$ instanceof BD)console.log(z.red(` ${$.message}`))}}else{let F=iD();if(F.sandboxCompleted)console.log(z.green("Sandbox training: Completed")),console.log(z.gray(` Dataset ID: ${F.sandboxDatasetId}`));else console.log(z.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(z.cyan(" nemar sandbox"))}});j$.command("reset").description("Reset sandbox training status for re-training").option(R0,I0).option(H1,W1).action(async(D)=>{if(!gD()){console.log(z.red("Not authenticated")),console.log(z.gray("Run 'nemar auth login' first"));return}if(!iD().sandboxCompleted){console.log(z.yellow("Sandbox training not yet completed")),console.log(z.gray("Nothing to reset"));return}let $=await u0("Reset sandbox training status? You will need to complete training again.",D);if($!=="confirmed"){console.log(z.gray($==="declined"?"Skipped":"Cancelled"));return}let B=k("Resetting sandbox status...").start();try{await zv(),H2("sandboxCompleted"),H2("sandboxDatasetId"),B.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(z.cyan(" nemar sandbox"))}catch(J){if(B.fail("Failed to reset"),J instanceof BD)console.log(z.red(` ${J.message}`));else console.log(z.red(` ${J instanceof Error?J.message:"Unknown error"}`))}});var pv={name:"nemar-cli",version:"0.3.7-dev.85",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/nemarDatasets/nemar-cli.git"},bugs:{url:"https://github.com/nemarDatasets/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 cv=pv.version;var z1=new m0;z1.name("nemar").description(`CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource)
|
|
348
348
|
|
|
349
349
|
NEMAR is a curated repository for neurophysiology data in BIDS format.
|
|
350
350
|
This CLI provides tools for uploading, downloading, and managing datasets.`).version(cv,"-v, --version","Output the current version").option("--no-color","Disable colored output").option("--verbose","Enable verbose output").addHelpText("after",`
|