@capgo/cli
Version:
A CLI to upload to capgo servers
67 lines (66 loc) • 2.12 MB
JavaScript
import{createRequire as BL0}from"node:module";var module={exports:{}};var VL0=Object.create;var{getPrototypeOf:OL0,defineProperty:CZ,getOwnPropertyNames:ck}=Object;var uM=Object.prototype.hasOwnProperty;function fM($){return this[$]}var q0=($,D,J)=>{var Q=ck(D);for(let X of Q)if(!uM.call($,X)&&X!=="default")CZ($,X,{get:fM.bind(D,X),enumerable:!0});if(J){for(let X of Q)if(!uM.call(J,X)&&X!=="default")CZ(J,X,{get:fM.bind(D,X),enumerable:!0});return J}},NL0,ML0,A1=($,D,J)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=D?NL0??=new WeakMap:ML0??=new WeakMap,Y=X.get($);if(Y)return Y}J=$!=null?VL0(OL0($)):{};let Z=D||!$||!$.__esModule?CZ(J,"default",{value:$,enumerable:!0}):J;for(let F of ck($))if(!uM.call(Z,F))CZ(Z,F,{get:fM.bind($,F),enumerable:!0});if(Q)X.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var LL0=($)=>$;function wL0($,D){this[$]=LL0.bind(null,D)}var mD=($,D)=>{for(var J in D)CZ($,J,{get:D[J],enumerable:!0,configurable:!0,set:wL0.bind(D,J)})};var t=($,D)=>()=>($&&(D=$($=0)),D);var e=BL0(import.meta.url);var lk,nk=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},pk=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var ik=t(()=>{lk=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let J=0;$.lastIndex=0;while($.test(D))J+=1;return D.length-J}})()});var RL0,EL0,rk,AL0,ok,jL0,IL0,TL0,ak=($,D={},J={})=>{let Q=D.limit??1/0,X=D.ellipsis??"",Y=D?.ellipsisWidth??(X?ak(X,TL0,J).width:0),Z=0,F=J.controlWidth??0,G=J.tabWidth??8,U=J.emojiWidth??2,q=2,W=J.regularWidth??1,z=J.wideWidth??2,H=[[jL0,W],[RL0,0],[EL0,F],[AL0,G],[ok,U],[rk,z]],K=0,V=0,O=$.length,L=0,B=!1,N=O,M=Math.max(0,Q-Y),w=0,R=0,S=0,v=0;$:while(!0){if(R>w||V>=O&&V>K){let A=$.slice(w,R)||$.slice(K,V);L=0;for(let _ of A.replaceAll(IL0,"")){let x=_.codePointAt(0)||0;if(nk(x))v=2;else if(pk(x))v=z;else v=W;if(S+v>M)N=Math.min(N,Math.max(w,K)+L);if(S+v>Q){B=!0;break $}L+=_.length,S+=v}w=R=0}if(V>=O)break $;for(let A=0,_=H.length;A<_;A++){let[x,g]=H[A];if(x.lastIndex=V,x.test($)){if(L=x===rk?lk($.slice(V,x.lastIndex)):x===ok?1:x.lastIndex-V,v=L*g,S+v>M)N=Math.min(N,V+Math.floor((M-S)/g));if(S+v>Q){B=!0;break $}S+=v,w=K,R=V,V=K=x.lastIndex;continue $}}V+=1}return{width:B?M:S,index:B?N:O,truncated:B,ellipsed:B&&Q>=Y}},tk;var sk=t(()=>{ik();RL0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,EL0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,rk=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,AL0=/\t{1,1000}/y,ok=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,jL0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,IL0=/\p{M}+/gu,TL0={limit:1/0,ellipsis:""},tk=ak});var CL0,PL0=($,D={})=>{return tk($,CL0,D).width},e4;var hM=t(()=>{sk();CL0={limit:1/0,ellipsis:"",ellipsisWidth:0},e4=PL0});function g9($,D,J){return String($).normalize().split(kL0).map((Q)=>_L0(Q,D,J)).join(`
`)}var Qq="\x1B",Qy="",SL0=39,gM="\x07",Xy="[",xL0="]",Yy="m",mM,ek,$y=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},Dy=($)=>`${Qq}${Xy}${$}${Yy}`,Jy=($)=>`${Qq}${mM}${$}${gM}`,bM=($,D,J)=>{let Q=D[Symbol.iterator](),X=!1,Y=!1,Z=$.at(-1),F=Z===void 0?0:e4(Z),G=Q.next(),U=Q.next(),q=0;while(!G.done){let W=G.value,z=e4(W);if(F+z<=J)$[$.length-1]+=W;else $.push(W),F=0;if(W===Qq||W===Qy)X=!0,Y=D.startsWith(mM,q+1);if(X){if(Y){if(W===gM)X=!1,Y=!1}else if(W===Yy)X=!1}else if(F+=z,F===J&&!U.done)$.push(""),F=0;G=U,U=Q.next(),q+=W.length}if(Z=$.at(-1),!F&&Z!==void 0&&Z.length&&$.length>1)$[$.length-2]+=$.pop()},vL0=($)=>{let D=$.split(" "),J=D.length;while(J){if(e4(D[J-1]))break;J--}if(J===D.length)return $;return D.slice(0,J).join(" ")+D.slice(J).join("")},_L0=($,D,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let Q="",X,Y,Z=$.split(" "),F=[""],G=0;for(let W=0;W<Z.length;W++){let z=Z[W];if(J.trim!==!1){let K=F.at(-1)??"",V=K.trimStart();if(K.length!==V.length)F[F.length-1]=V,G=e4(V)}if(W!==0){if(G>=D&&(J.wordWrap===!1||J.trim===!1))F.push(""),G=0;if(G||J.trim===!1)F[F.length-1]+=" ",G++}let H=e4(z);if(J.hard&&H>D){let K=D-G,V=1+Math.floor((H-K-1)/D);if(Math.floor((H-1)/D)<V)F.push("");bM(F,z,D),G=e4(F.at(-1)??"");continue}if(G+H>D&&G&&H){if(J.wordWrap===!1&&G<D){bM(F,z,D),G=e4(F.at(-1)??"");continue}F.push(""),G=0}if(G+H>D&&J.wordWrap===!1){bM(F,z,D),G=e4(F.at(-1)??"");continue}F[F.length-1]+=z,G+=H}if(J.trim!==!1)F=F.map((W)=>vL0(W));let U=F.join(`
`),q=!1;for(let W=0;W<U.length;W++){let z=U[W];if(Q+=z,!q){if(q=z>="\uD800"&&z<="\uDBFF",q)continue}else q=!1;if(z===Qq||z===Qy){ek.lastIndex=W+1;let K=ek.exec(U)?.groups;if(K?.code!==void 0){let V=Number.parseFloat(K.code);X=V===SL0?void 0:V}else if(K?.uri!==void 0)Y=K.uri.length===0?void 0:K.uri}if(U[W+1]===`
`){if(Y)Q+=Jy("");let H=X?$y(X):void 0;if(X&&H)Q+=Dy(H)}else if(z===`
`){if(X&&$y(X))Q+=Dy(X);if(Y)Q+=Jy(Y)}}return Q},kL0;var dM=t(()=>{hM();mM=`${xL0}8;;`,ek=new RegExp(`(?:\\${Xy}(?<code>\\d+)m|\\${mM}(?<uri>.*)${gM})`,"y"),kL0=/\r?\n/});var M$=E((wL1,Zy)=>{var cM={to($,D){if(!D)return`\x1B[${$+1}G`;return`\x1B[${D+1};${$+1}H`},move($,D){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(D<0)J+=`\x1B[${-D}A`;else if(D>0)J+=`\x1B[${D}B`;return J},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},yL0={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},uL0={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let D="";for(let J=0;J<$;J++)D+=this.line+(J<$-1?cM.up():"");if($)D+=cM.left;return D}};Zy.exports={cursor:cM,scroll:yL0,erase:uL0,beep:"\x07"}});import{styleText as $Q}from"node:util";import{stdout as iM,stdin as qy}from"node:process";import*as m9 from"node:readline";import fL0 from"node:readline";import{ReadStream as Fy}from"node:tty";function e5($,D,J){if(!J.some((Z)=>!Z.disabled))return $;let Q=$+D,X=Math.max(J.length-1,0),Y=Q<0?X:Q>X?0:Q;return J[Y]?.disabled?e5(Y,D<0?-1:1,J):Y}function Xq($,D,J,Q){let X=Q.split(`
`),Y=0,Z=$;for(let G of X){if(Z<=G.length)break;Z-=G.length+1,Y++}for(Y=Math.max(0,Math.min(X.length-1,Y+J)),Z=Math.min(Z,X[Y].length)+D;Z<0&&Y>0;)Y--,Z+=X[Y].length+1;for(;Z>X[Y].length&&Y<X.length-1;)Z-=X[Y].length+1,Y++;Z=Math.max(0,Math.min(X[Y].length,Z));let F=0;for(let G=0;G<Y;G++)F+=X[G].length+1;return F+Z}function rM($,D){if(typeof $=="string")return GD.aliases.get($)===D;for(let J of $)if(J!==void 0&&rM(J,D))return!0;return!1}function gL0($,D){if($===D)return;let J=$.split(`
`),Q=D.split(`
`),X=Math.max(J.length,Q.length),Y=[];for(let Z=0;Z<X;Z++)J[Z]!==Q[Z]&&Y.push(Z);return{lines:Y,numLinesBefore:J.length,numLinesAfter:Q.length,numLines:X}}function w1($){return $===nM}function Yq($,D){let J=$;J.isTTY&&J.setRawMode(D)}function Wy({input:$=qy,output:D=iM,overwrite:J=!0,hideCursor:Q=!0}={}){let X=m9.createInterface({input:$,output:D,prompt:"",tabSize:1});m9.emitKeypressEvents($,X),$ instanceof Fy&&$.isTTY&&$.setRawMode(!0);let Y=(Z,{name:F,sequence:G})=>{let U=String(Z);if(rM([U,F,G],"cancel")){Q&&D.write(_D.cursor.show),process.exit(0);return}if(!J)return;m9.moveCursor(D,F==="return"?0:-1,F==="return"?-1:0,()=>{m9.clearLine(D,1,()=>{$.once("keypress",Y)})})};return Q&&D.write(_D.cursor.hide),$.once("keypress",Y),()=>{$.off("keypress",Y),Q&&D.write(_D.cursor.show),$ instanceof Fy&&$.isTTY&&!mL0&&$.setRawMode(!1),X.terminal=!1,X.close()}}function PZ($,D,J,Q=J,X=J,Y){let Z=Fq($??iM);return g9(D,Z-J.length,{hard:!0,trim:!1}).split(`
`).map((F,G,U)=>{let q=Y?Y(F,G):F;return G===0?`${Q}${q}`:G===U.length-1?`${X}${q}`:`${J}${q}`}).join(`
`)}function zy($,D){if("~standard"in $){let J=$["~standard"].validate(D);if(J instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return J.issues?.at(0)?.message}return $(D)}class t8{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor($,D=!0){let{input:J=qy,output:Q=iM,render:X,signal:Y,...Z}=$;this.opts=Z,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=X.bind(this),this._track=D,this._abortSignal=Y,this.input=J,this.output=Q}unsubscribe(){this._subscribers.clear()}setSubscriber($,D){let J=this._subscribers.get($)??[];J.push(D),this._subscribers.set($,J)}on($,D){this.setSubscriber($,{cb:D})}once($,D){this.setSubscriber($,{cb:D,once:!0})}emit($,...D){let J=this._subscribers.get($)??[],Q=[];for(let X of J)X.cb(...D),X.once&&Q.push(()=>J.splice(J.indexOf(X),1));for(let X of Q)X()}prompt(){return new Promise(($)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(nM);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=fL0.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Yq(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(_D.cursor.show),this.output.off("resize",this.render),Yq(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(_D.cursor.show),this.output.off("resize",this.render),Yq(this.input,!1),$(nM)})})}_isActionKey($,D){return $==="\t"}_shouldSubmit($,D){return!0}_setValue($){this.value=$,this.emit("value",this.value)}_setUserInput($,D){this.userInput=$??"",this.emit("userInput",this.userInput),D&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress($,D){if(this._track&&D.name!=="return"&&(D.name&&this._isActionKey($,D)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),D?.name&&(!this._track&&GD.aliases.has(D.name)&&this.emit("cursor",GD.aliases.get(D.name)),GD.actions.has(D.name)&&this.emit("cursor",D.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),this.emit("key",$,D),D?.name==="return"&&this._shouldSubmit($,D)){if(this.opts.validate){let J=zy(this.opts.validate,this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}rM([$,D?.name,D?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
`),Yq(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=g9(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
`).length-1;this.output.write(_D.cursor.move(-999,$*-1))}render(){let $=g9(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if($!==this._prevFrame){if(this.state==="initial")this.output.write(_D.cursor.hide);else{let D=gL0(this._prevFrame,$),J=oM(this.output);if(this.restoreCursor(),D){let Q=Math.max(0,D.numLinesAfter-J),X=Math.max(0,D.numLinesBefore-J),Y=D.lines.find((Z)=>Z>=Q);if(Y===void 0){this._prevFrame=$;return}if(D.lines.length===1){this.output.write(_D.cursor.move(0,Y-X)),this.output.write(_D.erase.lines(1));let Z=$.split(`
`);this.output.write(Z[Y]),this._prevFrame=$,this.output.write(_D.cursor.move(0,Z.length-Y-1));return}else if(D.lines.length>1){if(Q<X)Y=Q;else{let F=Y-X;F>0&&this.output.write(_D.cursor.move(0,F))}this.output.write(_D.erase.down());let Z=$.split(`
`).slice(Y);this.output.write(Z.join(`
`)),this._prevFrame=$;return}}this.output.write(_D.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function dL0($,D){if($===void 0||D.length===0)return 0;let J=D.findIndex((Q)=>Q.value===$);return J!==-1?J:0}function cL0($,D){return(D.label??String(D.value)).toLowerCase().includes($.toLowerCase())}function lL0($,D){if(D)return $?D:D[0]}function Gy($){return[...$].map((D)=>pL0[D])}function iL0($){let D=new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2000,0,15)),J=[],Q="/";for(let X of D)X.type==="literal"?Q=X.value.trim()||X.value:(X.type==="year"||X.type==="month"||X.type==="day")&&J.push({type:X.type,len:X.type==="year"?4:2});return{segments:J,separator:Q}}function lM($){return Number.parseInt(($||"0").replace(/_/g,"0"),10)||0}function Zq($){return{year:lM($.year),month:lM($.month),day:lM($.day)}}function pM($,D){return new Date($||2001,D||1,0).getDate()}function Hy($){let{year:D,month:J,day:Q}=Zq($);if(!D||D<0||D>9999||!J||J<1||J>12||!Q||Q<1)return;let X=new Date(Date.UTC(D,J-1,Q));if(!(X.getUTCFullYear()!==D||X.getUTCMonth()!==J-1||X.getUTCDate()!==Q))return{year:D,month:J,day:Q}}function Uy($){let D=Hy($);return D?new Date(Date.UTC(D.year,D.month-1,D.day)):void 0}function rL0($,D,J,Q){let X=J?{year:J.getUTCFullYear(),month:J.getUTCMonth()+1,day:J.getUTCDate()}:null,Y=Q?{year:Q.getUTCFullYear(),month:Q.getUTCMonth()+1,day:Q.getUTCDate()}:null;return $==="year"?{min:X?.year??1,max:Y?.year??9999}:$==="month"?{min:X&&D.year===X.year?X.month:1,max:Y&&D.year===Y.year?Y.month:12}:{min:X&&D.year===X.year&&D.month===X.month?X.day:1,max:Y&&D.year===Y.year&&D.month===Y.month?Y.day:pM(D.year,D.month)}}var _D,hL0,bL0,GD,mL0,nM,Fq=($)=>("columns"in $)&&typeof $.columns=="number"?$.columns:80,oM=($)=>("rows"in $)&&typeof $.rows=="number"?$.rows:20,nL0,aM,pL0,Ky,oL0,aL0,Vy,Oy,Ny,tM;var sM=t(()=>{dM();_D=A1(M$(),1);hL0=["up","down","left","right","space","enter","cancel"],bL0=["January","February","March","April","May","June","July","August","September","October","November","December"],GD={actions:new Set(hL0),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...bL0],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:($,D)=>`There are only ${$} days in ${D}`,afterMin:($)=>`Date must be on or after ${$.toISOString().slice(0,10)}`,beforeMax:($)=>`Date must be on or before ${$.toISOString().slice(0,10)}`}}};mL0=globalThis.process.platform.startsWith("win"),nM=Symbol("clack:cancel");nL0=class extends t8{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#D=0;#X="";#$;#Y;#F;get cursor(){return this.#D}get userInputWithCursor(){if(!this.userInput)return $Q(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let D=this.userInput.slice(0,this.cursor),J=this.userInput.slice(this.cursor,this.cursor+1),Q=this.userInput.slice(this.cursor+1);return`${D}${$Q("inverse",J)}${Q}`}get options(){return typeof this.#Y=="function"?this.#Y():this.#Y}constructor(D){super(D),this.#Y=D.options,this.#F=D.placeholder;let J=this.options;this.filteredOptions=[...J],this.multiple=D.multiple===!0,this.#$=typeof D.options=="function"?D.filter:D.filter??cL0;let Q;if(D.initialValue&&Array.isArray(D.initialValue)?this.multiple?Q=D.initialValue:Q=D.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(Q=[this.options[0]?.value]),Q)for(let X of Q){let Y=J.findIndex((Z)=>Z.value===X);Y!==-1&&(this.toggleSelected(X),this.#D=Y)}this.focusedValue=this.options[this.#D]?.value,this.on("key",(X,Y)=>this.#J(X,Y)),this.on("userInput",(X)=>this.#Q(X))}_isActionKey(D,J){return D==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&D!==void 0&&D!==""}#J(D,J){let Q=J.name==="up",X=J.name==="down",Y=J.name==="return",Z=this.userInput===""||this.userInput==="\t",F=this.#F,G=this.options,U=F!==void 0&&F!==""&&G.some((q)=>!q.disabled&&(this.#$?this.#$(F,q):!0));if(J.name==="tab"&&Z&&U){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(F,!0),this.isNavigating=!1;return}Q||X?(this.#D=e5(this.#D,Q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#D]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):Y?this.value=lL0(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(D){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(D)?this.selectedValues=this.selectedValues.filter((J)=>J!==D):this.selectedValues=[...this.selectedValues,D]:this.selectedValues=[D])}#Q(D){if(D!==this.#X){this.#X=D;let J=this.options;D&&this.#$?this.filteredOptions=J.filter((Y)=>this.#$?.(D,Y)):this.filteredOptions=[...J];let Q=dL0(this.focusedValue,this.filteredOptions);this.#D=e5(Q,0,this.filteredOptions);let X=this.filteredOptions[this.#D];X&&!X.disabled?this.focusedValue=X.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};aM=class aM extends t8{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(D)=>{this.output.write(_D.cursor.move(0,-1)),this.value=D,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};pL0={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};Ky=class Ky extends t8{#D;#X;#$;#Y;#F;#J={segmentIndex:0,positionInSegment:0};#Q=!0;#Z=null;inlineError="";get segmentCursor(){return{...this.#J}}get segmentValues(){return{...this.#$}}get segments(){return this.#D}get separator(){return this.#X}get formattedValue(){return this.#W(this.#$)}#W($){return this.#D.map((D)=>$[D.type]).join(this.#X)}#G(){this._setUserInput(this.#W(this.#$)),this._setValue(Uy(this.#$)??void 0)}constructor($){let D=$.format?{segments:Gy($.format),separator:$.separator??"/"}:iL0($.locale),J=$.separator??D.separator,Q=$.format?Gy($.format):D.segments,X=$.initialValue??$.defaultValue,Y=X?{year:String(X.getUTCFullYear()).padStart(4,"0"),month:String(X.getUTCMonth()+1).padStart(2,"0"),day:String(X.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},Z=Q.map((F)=>Y[F.type]).join(J);super({...$,initialUserInput:Z},!1),this.#D=Q,this.#X=J,this.#$=Y,this.#Y=$.minDate,this.#F=$.maxDate,this.#G(),this.on("cursor",(F)=>this.#K(F)),this.on("key",(F,G)=>this.#V(F,G)),this.on("finalize",()=>this.#O($))}#U(){let $=Math.max(0,Math.min(this.#J.segmentIndex,this.#D.length-1)),D=this.#D[$];if(D)return this.#J.positionInSegment=Math.max(0,Math.min(this.#J.positionInSegment,D.len-1)),{segment:D,index:$}}#q($){this.inlineError="",this.#Z=null;let D=this.#U();D&&(this.#J.segmentIndex=Math.max(0,Math.min(this.#D.length-1,D.index+$)),this.#J.positionInSegment=0,this.#Q=!0)}#z($){let D=this.#U();if(!D)return;let{segment:J}=D,Q=this.#$[J.type],X=!Q||Q.replace(/_/g,"")==="",Y=Number.parseInt((Q||"0").replace(/_/g,"0"),10)||0,Z=rL0(J.type,Zq(this.#$),this.#Y,this.#F),F;X?F=$===1?Z.min:Z.max:F=Math.max(Math.min(Z.max,Y+$),Z.min),this.#$={...this.#$,[J.type]:F.toString().padStart(J.len,"0")},this.#Q=!0,this.#Z=null,this.#G()}#K($){if($)switch($){case"right":return this.#q(1);case"left":return this.#q(-1);case"up":return this.#z(1);case"down":return this.#z(-1)}}#V($,D){if(D?.name==="backspace"||D?.sequence===""||D?.sequence==="\b"||$===""||$==="\b"){this.inlineError="";let J=this.#U();if(!J)return;if(!this.#$[J.segment.type].replace(/_/g,"")){this.#q(-1);return}this.#$[J.segment.type]="_".repeat(J.segment.len),this.#Q=!0,this.#J.positionInSegment=0,this.#G();return}if(D?.name==="tab"){this.inlineError="";let J=this.#U();if(!J)return;let Q=D.shift?-1:1,X=J.index+Q;X>=0&&X<this.#D.length&&(this.#J.segmentIndex=X,this.#J.positionInSegment=0,this.#Q=!0);return}if($&&/^[0-9]$/.test($)){let J=this.#U();if(!J)return;let{segment:Q}=J,X=!this.#$[Q.type].replace(/_/g,"");if(this.#Q&&this.#Z!==null&&!X){let z=this.#Z+$,H={...this.#$,[Q.type]:z},K=this.#H(H,Q);if(K){this.inlineError=K,this.#Z=null,this.#Q=!1;return}this.inlineError="",this.#$[Q.type]=z,this.#Z=null,this.#Q=!1,this.#G(),J.index<this.#D.length-1&&(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#Q=!0);return}this.#Q&&!X&&(this.#$[Q.type]="_".repeat(Q.len),this.#J.positionInSegment=0),this.#Q=!1,this.#Z=null;let Y=this.#$[Q.type],Z=Y.indexOf("_"),F=Z>=0?Z:Math.min(this.#J.positionInSegment,Q.len-1);if(F<0||F>=Q.len)return;let G=Y.slice(0,F)+$+Y.slice(F+1),U=!1;if(F===0&&Y==="__"&&(Q.type==="month"||Q.type==="day")){let z=Number.parseInt($,10);G=`0${$}`,U=z<=(Q.type==="month"?1:2)}if(Q.type==="year"&&(G=(Y.replace(/_/g,"")+$).padStart(Q.len,"_")),!G.includes("_")){let z={...this.#$,[Q.type]:G},H=this.#H(z,Q);if(H){this.inlineError=H;return}}this.inlineError="",this.#$[Q.type]=G;let q=G.includes("_")?void 0:Hy(this.#$);if(q){let{year:z,month:H}=q,K=pM(z,H);this.#$={year:String(Math.max(0,Math.min(9999,z))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,H))).padStart(2,"0"),day:String(Math.max(1,Math.min(K,q.day))).padStart(2,"0")}}this.#G();let W=G.indexOf("_");U?(this.#Q=!0,this.#Z=$):W>=0?this.#J.positionInSegment=W:Z>=0&&J.index<this.#D.length-1?(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#Q=!0):this.#J.positionInSegment=Math.min(F+1,Q.len-1)}}#H($,D){let{month:J,day:Q}=Zq($);if(D.type==="month"&&(J<0||J>12))return GD.date.messages.invalidMonth;if(D.type==="day"&&(Q<0||Q>31))return GD.date.messages.invalidDay(31,"any month")}#O($){let{year:D,month:J,day:Q}=Zq(this.#$);if(D&&J&&Q){let X=pM(D,J);this.#$={...this.#$,day:String(Math.min(Q,X)).padStart(2,"0")}}this.value=Uy(this.#$)??$.defaultValue??void 0}};oL0=class extends t8{options;cursor=0;#D;getGroupItems(D){return this.options.filter((J)=>J.group===D)}isGroupSelected(D){let J=this.getGroupItems(D),Q=this.value;return Q===void 0?!1:J.every((X)=>Q.includes(X.value))}toggleValue(){let D=this.options[this.cursor];if(D!==void 0)if(this.value===void 0&&(this.value=[]),D.group===!0){let J=D.value,Q=this.getGroupItems(J);this.isGroupSelected(J)?this.value=this.value.filter((X)=>Q.findIndex((Y)=>Y.value===X)===-1):this.value=[...this.value,...Q.map((X)=>X.value)],this.value=Array.from(new Set(this.value))}else{let J=this.value.includes(D.value);this.value=J?this.value.filter((Q)=>Q!==D.value):[...this.value,D.value]}}constructor(D){super(D,!1);let{options:J}=D;this.#D=D.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([Q,X])=>[{value:Q,group:!0,label:Q},...X.map((Y)=>({...Y,group:Q}))]),this.value=[...D.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===D.cursorAt),this.#D?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let X=this.options[this.cursor]?.group===!0;!this.#D&&X&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let X=this.options[this.cursor]?.group===!0;!this.#D&&X&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},aL0=new Set(["up","down","left","right"]);Vy=class Vy extends t8{#D=!1;#X;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${$}█`;let D=$.slice(0,this.cursor),J=$.slice(this.cursor,this.cursor+1),Q=$.slice(this.cursor+1);return J===`
`?`${D}█
${Q}`:`${D}${$Q("inverse",J)}${Q}`}get cursor(){return this._cursor}#$($){if(this.userInput.length===0){this._setUserInput($);return}this._setUserInput(this.userInput.slice(0,this.cursor)+$+this.userInput.slice(this.cursor))}#Y($){let D=this.value??"";switch($){case"up":this._cursor=Xq(this._cursor,0,-1,D);return;case"down":this._cursor=Xq(this._cursor,0,1,D);return;case"left":this._cursor=Xq(this._cursor,-1,0,D);return;case"right":this._cursor=Xq(this._cursor,1,0,D);return}}_shouldSubmit($,D){if(this.#X)return this.focused==="submit"?!0:(this.#$(`
`),this._cursor++,!1);let J=this.#D;return this.#D=!0,J&&this.cursor===this.userInput.length?(this.userInput[this.cursor-1]===`
`&&(this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--),!0):(this.#$(`
`),this._cursor++,!1)}constructor($){let D=$.initialUserInput??$.initialValue;super({...$,initialUserInput:D},!1),D!==void 0&&(this._cursor=D.length),this.#X=$.showSubmit??!1,this.on("key",(J,Q)=>{if(Q?.name&&aL0.has(Q.name)){this.#D=!1,this.#Y(Q.name);return}if(J==="\t"&&this.#X){this.focused=this.focused==="editor"?"submit":"editor";return}if(Q?.name!=="return"){if(this.#D=!1,Q?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(Q?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}J&&(this.#X&&this.focused==="submit"&&(this.focused="editor"),this.#$(J??""),this._cursor++)}}),this.on("userInput",(J)=>{this._setValue(J)}),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.value===void 0&&(this.value="")})}};Oy=class extends t8{_mask="•";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let D=this.userInput;if(this.cursor>=D.length)return`${this.masked}${$Q(["inverse","hidden"],"_")}`;let J=this.masked,Q=J.slice(0,this.cursor),X=J.slice(this.cursor,this.cursor+1),Y=J.slice(this.cursor+1);return`${Q}${$Q("inverse",X)}${Y}`}clear(){this._clearUserInput()}constructor({mask:D,...J}){super(J),this._mask=D??"•",this.on("userInput",(Q)=>{this._setValue(Q)}),this.on("finalize",()=>{this.value===void 0&&(this.value="")})}},Ny=class extends t8{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let D=this._selectedValue;this.value=D===void 0?void 0:D.value}constructor(D){super(D,!1),this.options=D.options;let J=this.options.findIndex(({value:X})=>X===D.initialValue),Q=J===-1?0:J;this.cursor=this.options[Q]?.disabled?e5(Q,1,this.options):Q,this.changeValue(),this.on("cursor",(X)=>{switch(X){case"left":case"up":this.cursor=e5(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=e5(this.cursor,1,this.options);break}this.changeValue()})}};tM=class tM extends t8{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${this.userInput}█`;let D=$.slice(0,this.cursor),J=$.slice(this.cursor,this.cursor+1),Q=$.slice(this.cursor+1);return`${D}${$Q("inverse",J)}${Q}`}get cursor(){return this._cursor}constructor($){super({...$,initialUserInput:$.initialUserInput??$.initialValue}),this.on("userInput",(D)=>{this._setValue(D)}),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.value===void 0&&(this.value="")})}}});import{styleText as w0,stripVTControlCharacters as vL1}from"node:util";import C4 from"node:process";function tL0(){if(C4.platform!=="win32")return C4.env.TERM!=="linux";return Boolean(C4.env.CI)||Boolean(C4.env.WT_SESSION)||Boolean(C4.env.TERMINUS_SUBLIME)||C4.env.ConEmuTask==="{cmd::Cmder}"||C4.env.TERM_PROGRAM==="Terminus-Sublime"||C4.env.TERM_PROGRAM==="vscode"||C4.env.TERM==="xterm-256color"||C4.env.TERM==="alacritty"||C4.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function Fw0($,D){let J=[`${D?`${w0("cyan",u1)} `:""}${$.join(" • ")}`];return D&&J.push(w0("cyan",d9)),J}var SZ,eM,sL0=()=>process.env.CI==="true",$$=($,D)=>eM?$:D,eL0,Ly,wy,DL,$w0,u1,d9,uL1,fL1,$L,Uq,hL1,bL1,gL1,Dw0,mL1,dL1,cL1,lL1,nL1,pL1,Jw0,Qw0,Xw0,Yw0,qq=($)=>{switch($){case"initial":case"active":return w0("cyan",eL0);case"cancel":return w0("red",Ly);case"error":return w0("yellow",wy);case"submit":return w0("green",DL)}},Zw0=($)=>{switch($){case"initial":case"active":return w0("cyan",u1);case"cancel":return w0("red",u1);case"error":return w0("yellow",u1);case"submit":return w0("green",u1)}},My=($,D,J,Q,X,Y=!1)=>{let Z=D,F=0;if(Y)for(let G=Q-1;G>=J;G--){let U=$[G];if(U&&(Z-=U.length),F++,Z<=X)break}else for(let G=J;G<Q;G++){let U=$[G];if(U&&(Z-=U.length),F++,Z<=X)break}return{lineCount:Z,removals:F}},Gw0=({cursor:$,options:D,style:J,output:Q=process.stdout,maxItems:X=Number.POSITIVE_INFINITY,columnPadding:Y=0,rowPadding:Z=4})=>{let F=Fq(Q)-Y,G=oM(Q),U=w0("dim","..."),q=Math.max(G-Z,0),W=Math.max(Math.min(X,q),5),z=0;$>=W-3&&(z=Math.max(Math.min($-W+3,D.length-W),0));let H=W<D.length&&z>0,K=W<D.length&&z+W<D.length,V=Math.min(z+W,D.length),O=[],L=0;H&&L++,K&&L++;let B=z+(H?1:0),N=V-(K?1:0);for(let w=B;w<N;w++){let R=D[w],S=R?J(R,w===$):"",v=g9(S,F,{hard:!0,trim:!1}).split(`
`);O.push(v),L+=v.length}if(L>q){let w=0,R=0,S=L,v=$-B,A=q,_=()=>My(O,S,0,v,A),x=()=>My(O,S,v+1,O.length,A,!0);H?({lineCount:S,removals:w}=_(),S>A&&(K||(A-=1),{lineCount:S,removals:R}=x())):(K||(A-=1),{lineCount:S,removals:R}=x(),S>A&&(A-=1,{lineCount:S,removals:w}=_())),w>0&&(H=!0,O.splice(0,w)),R>0&&(K=!0,O.splice(O.length-R,R))}let M=[];H&&M.push(U);for(let w of O)for(let R of w)M.push(R);return K&&M.push(U),M},L$=($)=>{let D=$.active??"Yes",J=$.inactive??"No";return new aM({active:D,inactive:J,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue??!0,render(){let Q=$.withGuide??GD.withGuide,X=`${qq(this.state)} `,Y=Q?`${w0("gray",u1)} `:"",Z=PZ($.output,$.message,Y,X),F=`${Q?`${w0("gray",u1)}
`:""}${Z}
`,G=this.value?D:J;switch(this.state){case"submit":{let U=Q?`${w0("gray",u1)} `:"";return`${F}${U}${w0("dim",G)}`}case"cancel":{let U=Q?`${w0("gray",u1)} `:"";return`${F}${U}${w0(["strikethrough","dim"],G)}${Q?`
${w0("gray",u1)}`:""}`}default:{let U=Q?`${w0("cyan",u1)} `:"",q=Q?w0("cyan",d9):"";return`${F}${U}${this.value?`${w0("green",$L)} ${D}`:`${w0("dim",Uq)} ${w0("dim",D)}`}${$.vertical?Q?`
${w0("cyan",u1)} `:`
`:` ${w0("dim","/")} `}${this.value?`${w0("dim",Uq)} ${w0("dim",J)}`:`${w0("green",$L)} ${J}`}
${q}
`}}}}).prompt()},iL1,P,c0=($="",D)=>{let J=D?.output??process.stdout,Q=D?.withGuide??GD.withGuide?`${w0("gray",$w0)} `:"";J.write(`${Q}${$}
`)},o0=($="",D)=>{let J=D?.output??process.stdout,Q=D?.withGuide??GD.withGuide?`${w0("gray",u1)}
${w0("gray",d9)} `:"";J.write(`${Q}${$}
`)},By=($)=>new Oy({validate:$.validate,mask:$.mask??Dw0,signal:$.signal,input:$.input,output:$.output,render(){let D=$.withGuide??GD.withGuide,J=`${D?`${w0("gray",u1)}
`:""}${qq(this.state)} ${$.message}
`,Q=this.userInputWithCursor,X=this.masked;switch(this.state){case"error":{let Y=D?`${w0("yellow",u1)} `:"",Z=D?`${w0("yellow",d9)} `:"",F=X??"";return $.clearOnError&&this.clear(),`${J.trim()}
${Y}${F}
${Z}${w0("yellow",this.error)}
`}case"submit":{let Y=D?`${w0("gray",u1)} `:"",Z=X?w0("dim",X):"";return`${J}${Y}${Z}`}case"cancel":{let Y=D?`${w0("gray",u1)} `:"",Z=X?w0(["strikethrough","dim"],X):"";return`${J}${Y}${Z}${X&&D?`
${w0("gray",u1)}`:""}`}default:{let Y=D?`${w0("cyan",u1)} `:"",Z=D?w0("cyan",d9):"";return`${J}${Y}${Q}
${Z}
`}}}}).prompt(),Uw0=($)=>w0("magenta",$),S$=({indicator:$="dots",onCancel:D,output:J=process.stdout,cancelMessage:Q,errorMessage:X,frames:Y=eM?["◒","◐","◓","◑"]:["•","o","O","0"],delay:Z=eM?80:120,signal:F,...G}={})=>{let U=sL0(),q,W,z=!1,H=!1,K="",V,O=performance.now(),L=Fq(J),B=G?.styleFrame??Uw0,N=(J0)=>{let b=J0>1?X??GD.messages.error:Q??GD.messages.cancel;H=J0===1,z&&(d(b,J0),H&&typeof D=="function"&&D())},M=()=>N(2),w=()=>N(1),R=()=>{process.on("uncaughtExceptionMonitor",M),process.on("unhandledRejection",M),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",N),F&&F.addEventListener("abort",w)},S=()=>{process.removeListener("uncaughtExceptionMonitor",M),process.removeListener("unhandledRejection",M),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",N),F&&F.removeEventListener("abort",w)},v=()=>{if(V===void 0)return;U&&J.write(`
`);let J0=g9(V,L,{hard:!0,trim:!1}).split(`
`);J0.length>1&&J.write(SZ.cursor.up(J0.length-1)),J.write(SZ.cursor.to(0)),J.write(SZ.erase.down())},A=(J0)=>J0.replace(/\.+$/,""),_=(J0)=>{let b=(performance.now()-J0)/1000,j=Math.floor(b/60),T=Math.floor(b%60);return j>0?`[${j}m ${T}s]`:`[${T}s]`},x=G.withGuide??GD.withGuide,g=(J0="")=>{z=!0,q=Wy({output:J}),K=A(J0),O=performance.now(),x&&J.write(`${w0("gray",u1)}
`);let b=0,j=0;R(),W=setInterval(()=>{if(U&&K===V)return;v(),V=K;let T=B(Y[b]),k;if(U)k=`${T} ${K}...`;else if($==="timer")k=`${T} ${K} ${_(O)}`;else{let c=".".repeat(Math.floor(j)).slice(0,3);k=`${T} ${K}${c}`}let l=g9(k,L,{hard:!0,trim:!1});J.write(l),b=b+1<Y.length?b+1:0,j=j<4?j+0.125:0},Z)},d=(J0="",b=0,j=!1)=>{if(!z)return;z=!1,clearInterval(W),v();let T=b===0?w0("green",DL):b===1?w0("red",Ly):w0("red",wy);K=J0??K,j||($==="timer"?J.write(`${T} ${K} ${_(O)}
`):J.write(`${T} ${K}
`)),S(),q()};return{start:g,stop:(J0="")=>d(J0,0),message:(J0="")=>{K=A(J0??K)},cancel:(J0="")=>d(J0,1),error:(J0="")=>d(J0,2),clear:()=>d("",0,!0),get isCancelled(){return H}}},rL1,qw0,Gq=($,D)=>$.includes(`
`)?$.split(`
`).map((J)=>D(J)).join(`
`):D($),LD=($)=>{let D=(Q,X)=>{if(Q===void 0)return"";let Y=Q.label??String(Q.value);switch(X){case"disabled":return`${w0("gray",Uq)} ${Gq(Y,(Z)=>w0("gray",Z))}${Q.hint?` ${w0("dim",`(${Q.hint??"disabled"})`)}`:""}`;case"selected":return`${Gq(Y,(Z)=>w0("dim",Z))}`;case"active":return`${w0("green",$L)} ${Y}${Q.hint?` ${w0("dim",`(${Q.hint})`)}`:""}`;case"cancelled":return`${Gq(Y,(Z)=>w0(["strikethrough","dim"],Z))}`;default:return`${w0("dim",Uq)} ${Gq(Y,(Z)=>w0("dim",Z))}`}},J=$.showInstructions??!0;return new Ny({options:$.options,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue,render(){let Q=$.withGuide??GD.withGuide,X=`${qq(this.state)} `,Y=`${Zw0(this.state)} `,Z=PZ($.output,$.message,Y,X),F=`${Q?`${w0("gray",u1)}
`:""}${Z}
`;switch(this.state){case"submit":{let G=Q?`${w0("gray",u1)} `:"",U=PZ($.output,D(this.options[this.cursor],"selected"),G);return`${F}${U}`}case"cancel":{let G=Q?`${w0("gray",u1)} `:"",U=PZ($.output,D(this.options[this.cursor],"cancelled"),G);return`${F}${U}${Q?`
${w0("gray",u1)}`:""}`}default:{let G=Q?`${w0("cyan",u1)} `:"",U=F.split(`
`).length,q=J?Fw0(qw0,Q):Q?[w0("cyan",d9)]:[],W=q.join(`
`),z=q.length+1;return`${F}${G}${Gw0({output:$.output,cursor:this.cursor,options:this.options,maxItems:$.maxItems,columnPadding:G.length,rowPadding:U+z,style:(H,K)=>D(H,H.disabled?"disabled":K?"active":"inactive")}).join(`
${G}`)}
${W}
`}}}}).prompt()},oL1,c9=($)=>new tM({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,output:$.output,signal:$.signal,input:$.input,render(){let D=$?.withGuide??GD.withGuide,J=`${`${D?`${w0("gray",u1)}
`:""}${qq(this.state)} `}${$.message}
`,Q=$.placeholder&&$.placeholder.length>0?w0("inverse",$.placeholder[0])+w0("dim",$.placeholder.slice(1)):w0(["inverse","hidden"],"_"),X=this.userInput?this.userInputWithCursor:Q,Y=this.value??"";switch(this.state){case"error":{let Z=this.error?` ${w0("yellow",this.error)}`:"",F=D?`${w0("yellow",u1)} `:"",G=D?w0("yellow",d9):"";return`${J.trim()}
${F}${X}
${G}${Z}
`}case"submit":{let Z=Y?` ${w0("dim",Y)}`:"",F=D?w0("gray",u1):"";return`${J}${F}${Z}`}case"cancel":{let Z=Y?` ${w0(["strikethrough","dim"],Y)}`:"",F=D?w0("gray",u1):"";return`${J}${F}${Z}${Y.trim()?`
${F}`:""}`}default:{let Z=D?`${w0("cyan",u1)} `:"",F=D?w0("cyan",d9):"";return`${J}${Z}${X}
${F}
`}}}}).prompt();var Z1=t(()=>{sM();sM();dM();hM();SZ=A1(M$(),1);eM=tL0(),eL0=$$("◆","*"),Ly=$$("■","x"),wy=$$("▲","x"),DL=$$("◇","o"),$w0=$$("┌","T"),u1=$$("│","|"),d9=$$("└","—"),uL1=$$("┐","T"),fL1=$$("┘","—"),$L=$$("●",">"),Uq=$$("○"," "),hL1=$$("◻","[•]"),bL1=$$("◼","[+]"),gL1=$$("◻","[ ]"),Dw0=$$("▪","•"),mL1=$$("─","-"),dL1=$$("╮","+"),cL1=$$("├","+"),lL1=$$("╯","+"),nL1=$$("╰","+"),pL1=$$("╭","+"),Jw0=$$("●","•"),Qw0=$$("◆","*"),Xw0=$$("▲","!"),Yw0=$$("■","x");iL1=[`${w0("dim","↑/↓")} to navigate`,`${w0("dim","Space:")} select`,`${w0("dim","Enter:")} confirm`],P={message:($=[],{symbol:D=w0("gray",u1),secondarySymbol:J=w0("gray",u1),output:Q=process.stdout,spacing:X=1,withGuide:Y}={})=>{let Z=[],F=Y??GD.withGuide,G=F?J:"",U=F?`${D} `:"",q=F?`${J} `:"";for(let z=0;z<X;z++)Z.push(G);let W=Array.isArray($)?$:$.split(`
`);if(W.length>0){let[z,...H]=W;z.length>0?Z.push(`${U}${z}`):Z.push(F?D:"");for(let K of H)K.length>0?Z.push(`${q}${K}`):Z.push(F?J:"")}Q.write(`${Z.join(`
`)}
`)},info:($,D)=>{P.message($,{...D,symbol:w0("blue",Jw0)})},success:($,D)=>{P.message($,{...D,symbol:w0("green",Qw0)})},step:($,D)=>{P.message($,{...D,symbol:w0("green",DL)})},warn:($,D)=>{P.message($,{...D,symbol:w0("yellow",Xw0)})},warning:($,D)=>{P.warn($,D)},error:($,D)=>{P.message($,{...D,symbol:w0("red",Yw0)})}},rL1={light:$$("─","-"),heavy:$$("━","="),block:$$("█","#")},qw0=[`${w0("dim","↑/↓")} to navigate`,`${w0("dim","Enter:")} confirm`],oL1=`${w0("gray",u1)} `});var JD;var $8=t(()=>{JD={name:"@capgo/cli",type:"module",version:"8.33.2",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:init-replay && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:platform-flow-contract && bun run test:tail-engin