@visulima/vis 1.0.0-alpha.26 → 1.0.0-alpha.27
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/CHANGELOG.md +23 -0
- package/LICENSE.md +17 -17
- package/README.md +24 -22
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +176 -16
- package/dist/packem_chunks/bin.js +263 -263
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +12 -12
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +8 -9
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler30.js +3 -3
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler34.js +1 -1
- package/dist/packem_chunks/handler35.js +3 -22
- package/dist/packem_chunks/handler36.js +21 -60
- package/dist/packem_chunks/handler37.js +61 -6
- package/dist/packem_chunks/handler38.js +3 -24
- package/dist/packem_chunks/handler39.js +6 -153
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +24 -10
- package/dist/packem_chunks/handler41.js +153 -25
- package/dist/packem_chunks/handler42.js +10 -708
- package/dist/packem_chunks/handler43.js +25 -24
- package/dist/packem_chunks/handler44.js +659 -273
- package/dist/packem_chunks/handler45.js +24 -46
- package/dist/packem_chunks/handler46.js +322 -3
- package/dist/packem_chunks/handler47.js +48 -27
- package/dist/packem_chunks/handler48.js +3 -187
- package/dist/packem_chunks/handler49.js +23 -30
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +196 -0
- package/dist/packem_chunks/handler51.js +34 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-DS8JEB_g.js → advisories-xIOdLbAI.js} +1 -1
- package/dist/packem_shared/{cyclonedx-ja1cbU69.js → cyclonedx-B3ILsY74.js} +1 -1
- package/dist/packem_shared/{docker-Bw9gKo69.js → docker-BynKrOLe.js} +1 -1
- package/dist/packem_shared/{index-88UK-tt_.js → index-B_KtN1MB.js} +1 -1
- package/dist/packem_shared/{index-CS6a2wFB.js → index-efSniSRN.js} +1 -1
- package/dist/packem_shared/{lifecycle-ChCFTm5Q.js → lifecycle-CJRNbN3x.js} +2 -2
- package/dist/packem_shared/{min-release-age-heJgeP7o.js → min-release-age-aEn0x8Vy.js} +1 -1
- package/dist/packem_shared/{native-config-sync-BOeuyrBj.js → native-config-sync-DdhTLlKL.js} +1 -1
- package/dist/packem_shared/{osv-bloom-QSAn2Dcw.js → osv-bloom-BJhlc_I2.js} +2 -2
- package/dist/packem_shared/{pm-runner-BzGZmzYs.js → pm-runner-BwX5AL3W.js} +1 -1
- package/dist/packem_shared/{provenance-BsBn1f5S.js → provenance-BuiEsWbI.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CBPr617N.js → resolve-explicit-RgRrUDZv.js} +1 -1
- package/dist/packem_shared/{s1ngularity-j_ArCZAs.js → s1ngularity-Bs9fUf3q.js} +1 -1
- package/dist/packem_shared/{scan-progress-EbvmIh4i.js → scan-progress-DjPT66jy.js} +2 -2
- package/dist/packem_shared/{signatures-CaXzNuEn.js → signatures-LYMy8OR5.js} +1 -1
- package/dist/packem_shared/{typosquats-C1e6RNjF.js → typosquats-znskIR5j.js} +1 -1
- package/dist/packem_shared/watch-BSVsZ_1I.js +1 -0
- package/dist/packem_shared/watch-loop-DLlMLg_J.js +11 -0
- package/index.js +751 -567
- package/package.json +11 -11
- package/schemas/project.schema.json +86 -1
- package/schemas/vis-config.schema.json +255 -7
|
@@ -1,187 +1,3 @@
|
|
|
1
|
-
var io=Object.defineProperty;var w=(r,e)=>io(r,"name",{value:e,configurable:!0});import{createRequire as ao}from"node:module";import{M as Ee,Q as lo,C as hr,K as uo,z as fo,$ as ho}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{au as po,p as nt,w as _t,x as pr,b3 as mo,b4 as go,q as jt,b5 as vo,v as wo,C as yo,S as bo,b6 as $o,b7 as ko,s as It,b8 as So,b9 as To,ba as xo,bb as Co,bc as Io,bd as Mo,E as Ro,be as Eo}from"./bin.js";import{buildEnhancedPath as Oo,runConcurrently as At,TerminalBuffer as mr,readLastRunSummary as Po,getLastRunSummaryPath as Fo,enforceProjectConstraints as jo,expandTokensInString as cs,parsePartition as Ao,TaskScheduler as Lo,createTaskGraph as Do,reverseTaskGraph as Bo,generateRunSummary as ls,writeChromeTrace as No,resolveTurboEnvCompat as _o,CompositeLifeCycle as ds,defaultTaskRunner as us,createLogReporter as Go,writeRunSummary as qo}from"@visulima/task-runner";import{F as Ko}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as Jo}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as Yo,a as Qo,b as Xo,s as Zo,d as ei,c as ti,r as ri,H as si,f as ni,e as oi}from"../packem_shared/lifecycle-ChCFTm5Q.js";import{p as ii,r as ai,f as ci}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as we,render as ui}from"@visulima/tui";import{Text as d}from"@visulima/tui/components/text";import ee,{useSyncExternalStore as Ot,useCallback as Mt,useState as ft,useRef as ht,useEffect as Yt,useMemo as Qt}from"react";import{jsxs as m,jsx as h,Fragment as Gs}from"react/jsx-runtime";import{Box as b}from"@visulima/tui/components/box";import{StaticRender as fs}from"@visulima/tui/components/static-render";import{T as qs,C as gr,D as Gt,E as Us}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as fi}from"@visulima/tui/components/dialog";import{useApp as hi}from"@visulima/tui/hooks/use-app";import{useInput as hs}from"@visulima/tui/hooks/use-input";import{useWindowSize as pi}from"@visulima/tui/hooks/use-window-size";import{q as yi,j as bi,T as Xt,E as ms}from"../packem_shared/index.server-B7ETiT4C.js";import{ScrollView as zs}from"@visulima/tui/components/scroll-view";import{Spinner as Hs}from"@visulima/tui/components/spinner";import{B as Vs}from"./config.js";const co=ao(import.meta.url),ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=w(r=>{if(typeof ut<"u"&&ut.versions&&ut.versions.node){const[e,t]=ut.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ut.getBuiltinModule(r)}return co(r)},"__cjs_getBuiltinModule"),{existsSync:bt,statSync:Lt,readFileSync:nr,watch:Uo,openSync:Wo,readSync:zo,closeSync:Ho,mkdtempSync:Vo}=_e("node:fs"),{createInterface:li,emitKeypressEvents:di}=_e("node:readline"),{isAbsolute:mi,resolve:ps,dirname:gi,relative:vi}=_e("node:path"),{fileURLToPath:wi}=_e("node:url"),{createRequire:Ws}=_e("node:module"),{createHash:$i}=_e("node:crypto"),{appendFile:vr}=_e("node:fs/promises"),{platform:ki,homedir:wr,tmpdir:Si}=_e("node:os"),{execFileSync:Ti,spawn:xi}=_e("node:child_process");var Ci=Object.defineProperty,Ii=w((r,e)=>Ci(r,"name",{value:e,configurable:!0}),"u$5"),Mi=Object.defineProperty,Ri=Ii((r,e)=>Mi(r,"name",{value:e,configurable:!0}),"v"),Ei=Object.defineProperty,Oi=Ri((r,e)=>Ei(r,"name",{value:e,configurable:!0}),"D");const Pi=Oi((r,e,t,s,o,i,n,a,l,f,u,p,c,g)=>{const y={d:s,h:o,m:i,mo:e,ms:a,s:n,w:t,y:r};return l!==void 0&&(y.future=l),f!==void 0&&(y.past=f),u!==void 0&&(y.decimal=u),p!==void 0&&(y.unitMap=p),c!==void 0&&(y.groupSeparator=c),g!==void 0&&(y.placeholderSeparator=g),y},"createDurationLanguage"),Fi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},ji=Pi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",Fi,",","_");var Ai=Object.defineProperty,Li=w((r,e)=>Ai(r,"name",{value:e,configurable:!0}),"o$4"),Di=Object.defineProperty,Bi=Li((r,e)=>Di(r,"name",{value:e,configurable:!0}),"o"),Ni=Object.defineProperty,_i=Bi((r,e)=>Ni(r,"name",{value:e,configurable:!0}),"o");const Gi=_i(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var qi=Object.defineProperty,Ui=w((r,e)=>qi(r,"name",{value:e,configurable:!0}),"b$5"),Wi=Object.defineProperty,zi=Ui((r,e)=>Wi(r,"name",{value:e,configurable:!0}),"b"),Hi=Object.defineProperty,$t=zi((r,e)=>Hi(r,"name",{value:e,configurable:!0}),"g");const Ks=$t((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),gs=$t(({unitCount:r,unitName:e},t,s)=>{let{spacer:o}=s;const{maxDecimalPoints:i}=s;let n=".";s.decimal!==void 0?n=s.decimal:t.decimal!==void 0&&(n=t.decimal);let a;"digitReplacements"in s?a=s.digitReplacements:"_digitReplacements"in t&&(a=t._digitReplacements);let l,f=r;i!==void 0&&(f=Ks(r,i));const u=f.toString();if(!t._hideCountIf2||r!==2)if(a){l="";for(const g of u)l+=g==="."?n:a[g]}else l=u.replace(".",n);else l="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(o=""),t._numberFirst?c+o+l:l+o+c},"renderPiece"),Vi=$t((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,o=e.largest??Number.POSITIVE_INFINITY,i={};let n,a,l,f=r;for(a=0;a<t.length;a++){n=t[a];const p=s[n];l=a===t.length-1?f/p:Math.floor(f/p),i[n]=l,f-=l*p}if(e.round){let p=o;for(a=0;a<t.length;a++)if(n=t[a],l=i[n],l!==0&&(p--,p===0)){for(let c=a+1;c<t.length;c++){const g=t[c],y=i[g];i[n]=(i[n]??0)+y*s[g]/s[n],i[g]=0}break}for(a=t.length-1;a>=0;a--){if(n=t[a],l=i[n],l===0)continue;const c=Math.round(l);if(i[n]=c,a===0)break;const g=t[a-1],y=s[g],R=Math.floor(c*s[n]/y);if(R)i[g]=(i[g]??0)+R,i[n]=0;else break}}const u=[];for(a=0;a<t.length&&u.length<o;a++){if(n=t[a],l=i[n],l&&!e.round&&u.length===o-1){let p,c=0;for(p=a+1,t.length;p<t.length;p++){const g=t[p];c+=i[g]*(e.unitMeasures[g]/e.unitMeasures[n])}l+=c,e.maxDecimalPoints!==void 0&&(l=Ks(l,e.maxDecimalPoints))}l&&u.push({unitCount:l,unitName:n})}return u},"getPieces"),Ki=$t((r,e,t)=>{const{language:s,units:o}=e;if(r.length===0){const p=o.at(-1);return gs({unitCount:0,unitName:p},s,e)}const{conjunction:i,serialComma:n}=e;let a=", ";e.delimiter!==void 0?a=e.delimiter:s.delimiter!==void 0&&(a=s.delimiter);let l="";e.timeAdverb&&t!==0&&(l=s.future??"",t<0&&(l=s.past??""));const f=r.map(p=>gs(p,s,e));let u;return!i||r.length===1?u=f.join(a):r.length===2?u=f.join(i):u=f.slice(0,-1).join(a)+(n?",":"")+i+(f.at(-1)??""),l&&(u=l.replace("%s",u)),u},"formatPieces"),Js=$t((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:ji,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Gi(t.language);const s=Math.abs(r),o=Vi(s,t);return Ki(o,t,r)},"duration");var Ji=Object.defineProperty,Ys=w((r,e)=>Ji(r,"name",{value:e,configurable:!0}),"u$4"),Yi=Object.defineProperty,yr=Ys((r,e)=>Yi(r,"name",{value:e,configurable:!0}),"u"),Qi=Object.defineProperty,Xi=yr((r,e)=>Qi(r,"name",{value:e,configurable:!0}),"e");function qt({onlyFirst:r=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,r?void 0:"g")}w(qt,"n$2");Ys(qt,"a");yr(qt,"t");Xi(qt,"ansiRegex");var Zi=Object.defineProperty,ea=yr((r,e)=>Zi(r,"name",{value:e,configurable:!0}),"r");const ta=qt(),ra=/\u001B\]0;.*\u0007/,sa=ea(r=>r.replace(ra,"").replace(ta,""),"strip");var na=Object.defineProperty,Ut=w((r,e)=>na(r,"name",{value:e,configurable:!0}),"s$3");const oa={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},ia={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},aa={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},ca=1e3,la=Ut(r=>{for(const[e,t]of Object.entries(oa))for(const s of t)if(bt(Ee(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),da=Ut((r,e)=>{let t;for(const s of ia[e]){const o=Ee(r,s);if(!bt(o))continue;const{mtimeMs:i}=Lt(o);(!t||i>t.mtimeMs)&&(t={mtimeMs:i,path:s})}return t},"findFreshestMarker"),ua=Ut((r,e={})=>{const t=la(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:o}=t,i=Lt(Ee(r,s)).mtimeMs,n=da(r,o),a=aa[e.inCi?"ci":"tty"][o],l={installMarkerMtimeMs:n?.mtimeMs,lockfileMtimeMs:i,lockfilePath:s,marker:n?.path,packageManager:o};return n?i>n.mtimeMs+ca?{checked:!0,detail:l,failure:"stale-install",message:`${s} is newer than node_modules (${n.path}) — run \`${a}\` to sync.`}:{checked:!0,detail:l}:{checked:!0,detail:l,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${a}\` before \`vis run\`.`}},"checkLockfileFreshness"),fa=Ut((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=ua(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const i=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...o,formattedMessage:i,shouldContinue:!1}:(t.warn(i),{...o,formattedMessage:i,shouldContinue:!0})},"runLockfilePreflight");var ha=Object.defineProperty,Qs=w((r,e)=>ha(r,"name",{value:e,configurable:!0}),"f$9");const pa=Qs(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),ma=Qs((r,e,t)=>{const s=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:o};const i=[...t],n=new Set(i),a=new Map;for(const l of i){const f=l.lastIndexOf(":");if(f===-1)continue;const u=l.slice(f+1),p=a.get(u);p===void 0?a.set(u,[l]):p.push(l)}for(const l of pa(r)){if(l.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${l}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(n.has(l)){s.add(l);continue}const f=ii(l);if(!f){o.push(l);continue}let u=!1;switch(f.kind){case"all":{const p=a.get(f.target)??[];for(const c of p)s.add(c),u=!0;break}case"project":{const p=f.projects?.[0];if(p!==void 0){const c=`${p}:${f.target}`;n.has(c)&&(s.add(c),u=!0)}break}case"tag":{const{tag:p}=f;if(p!==void 0){const c=a.get(f.target)??[];for(const g of c){const y=g.slice(0,g.lastIndexOf(":"));e.projects[y]?.tags?.includes(p)===!0&&(s.add(g),u=!0)}}break}}u||o.push(l)}return{skipTaskIds:s,unmatchedPatterns:o}},"resolveSkipCachePatterns");var ga=Object.defineProperty,br=w((r,e)=>ga(r,"name",{value:e,configurable:!0}),"a$4");const va=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,wa=new Set(["0","!","#","$","*","-","?","@","_"]),ya=br(r=>{const e=new Map;for(const t of r.matchAll(va)){const s=t[1],o=t[3],i=t[2],n=s??o;if(n===void 0||wa.has(n))continue;const a=i!==void 0,l=e.get(n);l===void 0?e.set(n,a):l&&!a&&e.set(n,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),ba=br(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:o}=r,i=ya(e);if(i.length===0)return;const n=[];for(const{hasDefault:a,name:l}of i){if(a)continue;const f=s[l],u=t[l];f===void 0&&u===void 0&&n.push(l)}if(n.length!==0)return{missing:n.toSorted(),taskId:o}},"checkStrictEnv"),$a=br(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var ka=Object.defineProperty,Ke=w((r,e)=>ka(r,"name",{value:e,configurable:!0}),"i$4");const vs=Ke(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Sa=Ke(r=>{const e=new Map;for(const t of r.values())for(const[s,o]of Object.entries(t))for(const i of o.aliases??[])e.has(i)||e.set(i,s);return e},"buildAliasMap"),Ta=Ke((r,e)=>e.get(r)??r,"resolveTargetAlias"),xa=Ke((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=r.length;o++){const i=e[s-1]===r[o-1]?0:1;t[s][o]=Math.min(t[s-1][o]+1,t[s][o-1]+1,t[s-1][o-1]+i)}return t[e.length][r.length]},"levenshtein"),Ca=Ke((r,e,t=3)=>Xs(r,e,1,t)[0],"suggestTarget"),Xs=Ke((r,e,t=3,s=3)=>{const o=[];for(const i of e){const n=xa(r.toLowerCase(),i.toLowerCase());n<=s&&o.push({distance:n,name:i})}return o.sort((i,n)=>i.distance-n.distance||i.name.localeCompare(n.name)),o.slice(0,t).map(i=>i.name)},"suggestTargets"),Ia=Ke(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
|
-
`),"formatTargetList"),Ma=Ke(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=li({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
3
|
-
`);for(const[o,i]of r.entries())process.stdout.write(` ${String(o+1).padStart(2," ")}. ${i}
|
|
4
|
-
`);process.stdout.write(`
|
|
5
|
-
`);const t=(await new Promise(o=>{e.question("Select a target (number or name, blank to cancel): ",o)})).trim();if(t.length===0)return;const s=Number.parseInt(t,10);return Number.isFinite(s)&&s>=1&&s<=r.length?r[s-1]:r.includes(t)?t:Ca(t,r)}finally{e.close()}},"promptTargetInteractively");var Ra=Object.defineProperty,Pt=w((r,e)=>Ra(r,"name",{value:e,configurable:!0}),"n$1");const Ea=new RegExp("[\x1B]\\[[0-?]*[ -/]*[@-~]","g"),Zt=Pt(r=>r.replaceAll(Ea,"").replaceAll("\r",""),"sanitizeLogLine");class ws{static{w(this,"ServiceDockStore")}static{Pt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#n=new Map;constructor(e=[]){for(const t of e)this.#n.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#o()}getSnapshot=Pt(()=>this.#r,"getSnapshot");subscribe=Pt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,t=!1;for(const s of this.#n.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#n.has(e)||(this.#n.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#i())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,s=>({...s,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,s){const o=s?.message;this.#t(e,i=>({...i,errorMessage:Zt(o??t),status:"failed"}))}markCrashed(e,t){const s=t.slice(-256).map(o=>Zt(o));this.#t(e,o=>({...o,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,t){const s=t.split(`
|
|
6
|
-
`).map(o=>Zt(o)).filter(o=>o.length>0);s.length!==0&&this.#t(e,o=>{const i=[...o.tailLines,...s];for(;i.length>256;)i.shift();let n=0;for(let a=i.length-1;a>=0;a--)if(n+=i[a].length+1,n>65536){i.splice(0,a+1);break}return{...o,lastLine:s[s.length-1],tailLines:i}})}abortBoot(e){let t=!1;const s=new Map(this.#n);for(const[o,i]of s)(i.status==="pending"||i.status==="starting")&&(s.set(o,{...i,errorMessage:e,status:"failed"}),t=!0);t&&(this.#n=s,this.#o(),this.#i())}#t(e,t){const s=this.#n.get(e);s&&(this.#n.set(e,t(s)),this.#o(),this.#i())}#o(){this.#r=new Map(this.#n)}#i(){for(const e of this.#s)try{e()}catch{}}}var Oa=Object.defineProperty,$r=w((r,e)=>Oa(r,"name",{value:e,configurable:!0}),"i$3");const Pa=$r(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),Fa=$r((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${Pa(t)}`,"formatFlags"),kr=$r((r,e,t)=>{const s=new Set(new Set(t.map(c=>c.target.target))),o=new Set(new Set(t.map(c=>c.target.project))),i=e.filter(c=>s.has(c)),n=r.filter(c=>o.has(c)),a=t.length-n.length*i.length,l=i.length===1?"target":"targets",f=i.join(", "),u=n.length===1?`project ${n[0]}`:`${n.length} projects`;let p=`${l} ${f} for ${u}`;return a>0&&(p+=` and ${a} ${a===1?"task":"tasks"} ${a===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var ja=Object.defineProperty,Aa=w((r,e)=>ja(r,"name",{value:e,configurable:!0}),"c$6");const La={error:"red",info:"white",success:"green"},or=Aa(({children:r,title:e,variant:t})=>{const s=La[t];return m(b,{flexDirection:"column",children:[m(b,{gap:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{bold:!0,color:s,children:"•"}),h(d,{children:e})]}),r]})},"Header");var Da=Object.defineProperty,Ba=w((r,e)=>Da(r,"name",{value:e,configurable:!0}),"T$7");const Zs=Ba(({cached:r,failed:e,failedIds:t,projectNames:s,retriedIds:o,skippedIds:i,succeeded:n,targets:a,tasks:l,took:f})=>{const u=kr(s,a,l),p=o??[];if(e===0&&(!i||i.length===0)){const c=r>0?` (${r} read from cache)`:"";return h(fs,{children:w(()=>h(or,{title:`Successfully ran ${u}`,variant:"success",children:m(b,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[m(d,{children:[h(d,{color:"green",children:qs})," ",n+r," tasks completed",c?h(d,{dimColor:!0,children:c}):null,h(d,{dimColor:!0,children:` · Took ${f}`})]}),p.length>0&&m(b,{flexDirection:"column",marginTop:1,children:[m(d,{children:[h(d,{color:"yellow",children:"↻"})," ",h(d,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(g=>m(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",g]},g))]})]})}),"children")})}return h(fs,{children:w(()=>h(or,{title:`Ran ${u}`,variant:"error",children:m(b,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[i&&i.length>0&&m(b,{flexDirection:"column",children:[m(d,{dimColor:!0,children:[i.length," ","task",i.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),i.map(c=>m(d,{dimColor:!0,children:[" - ",c]},c)),h(d,{})]}),e>0&&m(b,{flexDirection:"column",children:[m(d,{children:[h(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(c=>m(d,{children:[" ",h(d,{color:"red",children:gr})," ",c]},c)),h(d,{})]}),p.length>0&&m(b,{flexDirection:"column",children:[m(d,{children:[h(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(c=>m(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",c]},c)),h(d,{})]}),h(d,{dimColor:!0,children:` Took ${f}`})]})}),"children")})},"CommandSummary");var Na=Object.defineProperty,er=w((r,e)=>Na(r,"name",{value:e,configurable:!0}),"o$2");class Dt{static{w(this,"TaskStore")}static{er(this,"TaskStore")}#e;#s=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(t=>({persistent:!!t.overrides.visOptions?.persistent,status:"pending",taskId:t.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=er(()=>this.#e,"getSnapshot");subscribe=er(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const s of e){const o=t.findIndex(i=>i.taskId===s.id);o!==-1&&(t[o]={...t[o],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:s,completed:o,failed:i,succeeded:n}=this.#e;const a=new Map(this.#e.outputs),l=[...this.#e.retriedIds];for(const u of e){const p=t.findIndex(c=>c.taskId===u.task.id);switch(p!==-1&&(t[p]={...t[p],duration:u.startTime&&u.endTime?u.endTime-u.startTime:void 0,retryAttempts:u.retryAttempts,status:u.status}),u.retryAttempts&&u.retryAttempts>0&&l.push(u.task.id),o++,u.status){case"failure":{i++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{n++;break}}u.terminalOutput&&!a.has(u.task.id)&&a.set(u.task.id,u.terminalOutput),this.#r.delete(u.task.id)}let{selectedIndex:f}=this.#e;if(i>this.#e.failed){const u=t.findIndex(p=>p.status==="failure");u!==-1&&(f=u)}this.#t({...this.#e,cached:s,completed:o,failed:i,outputs:a,retriedIds:l,rows:t,selectedIndex:f,succeeded:n})}static#n=256*1024;addOutput(e,t){if(!t.trim())return;let s=(this.#e.outputs.get(e)??"")+t;s.length>Dt.#n&&(s=s.slice(-Dt.#n)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const t=[...this.#e.rows];for(let s=0;s<t.length;s++){const o=t[s];if(o.status==="running"){const i=this.#r.get(o.taskId);if(i){const n=process.hrtime(i),a=n[0]*1e3+n[1]/1e6;t[s]={...o,elapsed:a},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const s=[...this.#e.pinnedTaskIds];s[e]=t,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],s=t.findIndex(a=>a.taskId===e);let{completed:o,failed:i,succeeded:n}=this.#e;if(s!==-1){const a=t[s].status;a==="failure"?(i=Math.max(0,i-1),o=Math.max(0,o-1)):a==="success"&&(n=Math.max(0,n-1),o=Math.max(0,o-1)),t[s]={...t[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:o,done:!1,endTime:null,failed:i,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(a=>a!==e),retryTaskId:e,rows:t,succeeded:n})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#s)try{t()}catch{}}}var _a=Object.defineProperty,Ga=w((r,e)=>_a(r,"name",{value:e,configurable:!0}),"A$3"),qa=Object.defineProperty,Sr=Ga((r,e)=>qa(r,"name",{value:e,configurable:!0}),"$"),Ua=Object.defineProperty,Wa=Sr((r,e)=>Ua(r,"name",{value:e,configurable:!0}),"r$1");const za=Wa(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
7
|
-
`),"normalizeLF"),Ha=globalThis.process??Object.create(null),ys={versions:{}},bs=new Proxy(Ha,{get(r,e){if(e in r)return r[e];if(e in ys)return ys[e]}});var Va=Object.defineProperty,Ka=Sr((r,e)=>Va(r,"name",{value:e,configurable:!0}),"b");const Ja=Ka((r,e,t,s)=>{const o={column:0,line:-1,...r.start},i={...o,...r.end},n=o.line,a=o.column,l=i.line,f=i.column;let u=Math.max(n-(t+1),0),p=Math.min(e.length,l+s);n===-1&&(u=0),l===-1&&(p=e.length);const c=l-n,g={};if(c)for(let y=0;y<=c;y++){const R=y+n;if(!a)g[R]=!0;else if(y===0){const L=e[R-1]?.length;g[R]=[a,(L??0)-a+1]}else if(y===c)g[R]=[0,f];else{const L=e[R-y]?.length;g[R]=[0,L]}}else a===f?g[n]=a?[a,0]:!0:g[n]=[a,(f??0)-(a??0)];return{end:p,markerLines:g,start:u}},"getMarkerLines");var Ya=Object.defineProperty,Rt=Sr((r,e)=>Ya(r,"name",{value:e,configurable:!0}),"t");const Qa=bs.platform==="win32"&&!bs.env?.WT_SESSION?">":"❯",Xa=Rt((r,e,t)=>{const s={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:Rt(y=>y,"gutter"),marker:Rt(y=>y,"marker"),message:Rt(y=>y,"message"),...t?.color}},o=typeof e.start.column=="number";let i=za(r).split(`
|
|
8
|
-
`);typeof s.tabWidth=="number"&&(i=i.map(y=>y.replaceAll(" "," ".repeat(s.tabWidth))));const{end:n,markerLines:a,start:l}=Ja(e,i,s.linesAbove,s.linesBelow),f=String(n).length,{gutter:u,marker:p,message:c}=s.color;let g=i.slice(l,n).map((y,R)=>{const L=l+1+R,S=a[L],k=` ${String(L)}`.slice(-f),E=!a[L+1],x=` ${k}${s.showGutter?" |":""}`;if(S){let M="";if(Array.isArray(S)){const v=y.replaceAll(/[^\t]/g," ").slice(0,Math.max(S[0]-1,0)),C=S[1]||1;M=[`
|
|
9
|
-
`,s.prefix+u(x.replaceAll(/\d/g," "))," ",v,p("^").repeat(C)].join(""),E&&s.message&&(M+=` ${c(s.message)}`)}return[s.prefix+p(Qa),u(x),y.length>0?` ${y}`:"",M].join("")}return`${s.prefix} ${u(x)}${y.length>0?` ${y}`:""}`}).join(`
|
|
10
|
-
`);return s.message&&!o&&(g=`${s.prefix+" ".repeat(f+1)+s.message}
|
|
11
|
-
${g}`),g},"codeFrame");var Za=Object.defineProperty,ec=w((r,e)=>Za(r,"name",{value:e,configurable:!0}),"x$3"),tc=Object.defineProperty,rc=ec((r,e)=>tc(r,"name",{value:e,configurable:!0}),"x"),sc=Object.defineProperty,Ge=rc((r,e)=>sc(r,"name",{value:e,configurable:!0}),"u");const Ze=Ge((r,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),et="<unknown>",nc=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oc=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ic=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ac=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,cc=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,lc=/in\s(.*)\s\(at\s(.+)\)\sat/,dc=/^(?:.*@)?(.*):(\d+):(\d+)$/,uc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hc=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,$s=/\(error: (.*)\)/,pc=/at\s/,mc=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,gc=/\S*(?:Error: |AggregateError:)/,en=/^Anonymous function$/,vc=/^\s*in\s.*/,wc=/^.*?\s*at\s.*/,yc=/^.*?\s*@.*|\[native code\]/,tn=Ge((r,e)=>{const t=r.includes("safari-extension"),s=r.includes("safari-web-extension");return t||s?[r.includes("@")?r.split("@")[0]:et,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),rn=Ge((r,e)=>{const t=ic.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),bc=Ge(r=>{const e=lc.exec(r);if(e){Ze(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const s=e[2].split(":");return{column:s[2]?+s[2]:void 0,file:s[0],line:s[1]?+s[1]:void 0,methodName:e[1]??et,raw:r,type:void 0}}const t=cc.exec(r);if(t){Ze(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const s={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(pc,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??et,raw:r,type:r.startsWith("internal")?"internal":void 0};return rn(s,`${t[2]}:${t[3]}:${t[4]}`),s}},"parseNode"),$c=Ge(r=>{const e=nc.exec(r);if(e){Ze(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),s=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,i;if(s){const f=oc.exec(r);if(f){const u=mc.exec(f[1]);u?(e[2]=u[4]??u[1],e[3]=u[5]??u[2],e[4]=u[3]):f[2]&&(e[2]=f[1]),f[2]&&(o={column:f[4]?+f[4]:void 0,file:f[2],line:f[3]?+f[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const u=ac.exec(r);u&&(i={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},o={column:u[6]?+u[6]:void 0,file:u[1],line:u[5]?+u[5]:void 0,methodName:"eval",raw:u[0],type:"eval"})}}const[n,a]=tn(e[1]?e[1].replace(en,"<anonymous>"):et,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:o,file:a,line:e[3]?+e[3]:void 0,methodName:n,raw:r,type:s?"eval":t?"native":void 0};return i?(l.column=i.column,l.file=i.file,l.line=i.line):rn(l,`${a}:${e[3]}:${e[4]}`),l}},"parseChromium"),kc=Ge((r,e)=>{const t=uc.exec(r);if(t){Ze(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const s=t[3]?.includes(" > eval"),o=s&&t[3]&&fc.exec(t[3]);let i;s&&o&&(t[3]=o[1],i={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=o[2]);const[n,a]=tn(t[1]?t[1].replace(en,"<anonymous>"):et,t[3]);let l;(e?.type==="safari"||!s&&e?.type==="firefox")&&e.column?l=e.column:!s&&t[5]&&(l=+t[5]);let f;return(e?.type==="safari"||!s&&e?.type==="firefox")&&e.line?f=e.line:t[4]&&(f=+t[4]),{column:l,evalOrigin:i,file:a,line:f,methodName:n,raw:r,type:s?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Sc=Ge((r,e)=>{const t=hc.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return Ze(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||et,raw:r,type:void 0}},"parseFirefox"),Tc=Ge(r=>{const e=dc.exec(r);if(e)return Ze(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:et,raw:r,type:void 0}},"parseReactAndroidNative"),xc=Ge((r,{filter:e,frameLimit:t=50}={})=>{const s=r;let o=(typeof s.stacktrace=="string"?s.stacktrace:r.stack??"").split(`
|
|
12
|
-
`).map(i=>($s.test(i)?i.replace($s,"$1"):i).trim()).filter(i=>!gc.test(i)&&i!=="eval code");return e&&(o=o.filter(i=>e(i))),o=o.slice(0,t),o.reduce((i,n,a)=>{if(!n||n.length>1024)return i;let l;if(vc.test(n))l=bc(n);else if(wc.test(n))l=$c(n);else if(yc.test(n)){let f;if(a===0){const u=r,p=u.columnNumber,c=u.lineNumber,g=u.line,y=u.column;p||c?f={column:p,line:c,type:"firefox"}:(g||y)&&(f={column:y,line:g,type:"safari"})}l=Sc(n,f)??kc(n,f)}else l=Tc(n);return l?i.push(l):Ze(`parse error stack line: "${n}"`,"not parser found"),i},[])},"parseStacktrace");var Cc=Object.defineProperty,de=w((r,e)=>Cc(r,"name",{value:e,configurable:!0}),"C$3"),at=44,sn=59,ks="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn=new Uint8Array(64),on=new Uint8Array(128);for(let r=0;r<ks.length;r++){const e=ks.charCodeAt(r);nn[r]=e,on[e]=r}function re(r,e){let t=0,s=0,o=0;do{const n=r.next();o=on[n],t|=(o&31)<<s,s+=5}while(o&32);const i=t&1;return t>>>=1,i&&(t=-2147483648|-t),e+t}w(re,"h$3");de(re,"decodeInteger");function Z(r,e,t){let s=e-t;s=s<0?-s<<1|1:s<<1;do{let o=s&31;s>>>=5,s>0&&(o|=32),r.write(nn[o])}while(s>0);return e}w(Z,"i$2");de(Z,"encodeInteger");function Ne(r,e){return r.pos>=e?!1:r.peek()!==at}w(Ne,"S$4");de(Ne,"hasMoreVlq");var Ss=1024*16,Ts=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(r){return Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString()}}:{decode(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e}},Tr=class{static{w(this,"T")}static{de(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ss)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ss&&(this.out+=Ts.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:s}=this;return s>0?t+Ts.decode(e.subarray(0,s)):t}},xr=class{static{w(this,"w")}static{de(this,"StringReader")}constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:t,pos:s}=this,o=t.indexOf(e,s);return o===-1?t.length:o}},an=[];function Ic(r){const{length:e}=r,t=new xr(r),s=[],o=[];let i=0;for(;t.pos<e;t.pos++){i=re(t,i);const n=re(t,0);if(!Ne(t,e)){const u=o.pop();u[2]=i,u[3]=n;continue}const a=re(t,0),l=re(t,0)&1?[i,n,0,0,a,re(t,0)]:[i,n,0,0,a];let f=an;if(Ne(t,e)){f=[];do{const u=re(t,0);f.push(u)}while(Ne(t,e))}l.vars=f,s.push(l),o.push(l)}return s}w(Ic,"z$1");de(Ic,"decodeOriginalScopes");function Mc(r){const e=new Tr;for(let t=0;t<r.length;)t=Cr(r,t,e,[0]);return e.flush()}w(Mc,"F$3");de(Mc,"encodeOriginalScopes");function Cr(r,e,t,s){const o=r[e],{0:i,1:n,2:a,3:l,4:f,vars:u}=o;e>0&&t.write(at),s[0]=Z(t,i,s[0]),Z(t,n,0),Z(t,f,0);const p=o.length===6?1:0;Z(t,p,0),o.length===6&&Z(t,o[5],0);for(const c of u)Z(t,c,0);for(e++;e<r.length;){const c=r[e],{0:g,1:y}=c;if(g>a||g===a&&y>=l)break;e=Cr(r,e,t,s)}return t.write(at),s[0]=Z(t,a,s[0]),Z(t,l,0),e}w(Cr,"P$4");de(Cr,"_encodeOriginalScopes");function Rc(r){const{length:e}=r,t=new xr(r),s=[],o=[];let i=0,n=0,a=0,l=0,f=0,u=0,p=0,c=0;do{const g=t.indexOf(";");let y=0;for(;t.pos<g;t.pos++){if(y=re(t,y),!Ne(t,g)){const v=o.pop();v[2]=i,v[3]=y;continue}const R=re(t,0),L=R&1,S=R&2,k=R&4;let E=null,x=an,M;if(L){const v=re(t,n);a=re(t,n===v?a:0),n=v,M=[i,y,0,0,v,a]}else M=[i,y,0,0];if(M.isScope=!!k,S){const v=l,C=f;l=re(t,l);const D=v===l;f=re(t,D?f:0),u=re(t,D&&C===f?u:0),E=[l,f,u]}if(M.callsite=E,Ne(t,g)){x=[];do{p=i,c=y;const v=re(t,0);let C;if(v<-1){C=[[re(t,0)]];for(let D=-1;D>v;D--){const j=p;p=re(t,p),c=re(t,p===j?c:0);const K=re(t,0);C.push([K,p,c])}}else C=[[v]];x.push(C)}while(Ne(t,g))}M.bindings=x,s.push(M),o.push(M)}i++,t.pos=g+1}while(t.pos<e);return s}w(Rc,"H$1");de(Rc,"decodeGeneratedRanges");function Ec(r){if(r.length===0)return"";const e=new Tr;for(let t=0;t<r.length;)t=Ir(r,t,e,[0,0,0,0,0,0,0]);return e.flush()}w(Ec,"J");de(Ec,"encodeGeneratedRanges");function Ir(r,e,t,s){const o=r[e],{0:i,1:n,2:a,3:l,isScope:f,callsite:u,bindings:p}=o;s[0]<i?(ir(t,s[0],i),s[0]=i,s[1]=0):e>0&&t.write(at),s[1]=Z(t,o[1],s[1]);const c=(o.length===6?1:0)|(u?2:0)|(f?4:0);if(Z(t,c,0),o.length===6){const{4:g,5:y}=o;g!==s[2]&&(s[3]=0),s[2]=Z(t,g,s[2]),s[3]=Z(t,y,s[3])}if(u){const{0:g,1:y,2:R}=o.callsite;g!==s[4]?(s[5]=0,s[6]=0):y!==s[5]&&(s[6]=0),s[4]=Z(t,g,s[4]),s[5]=Z(t,y,s[5]),s[6]=Z(t,R,s[6])}if(p)for(const g of p){g.length>1&&Z(t,-g.length,0);const y=g[0][0];Z(t,y,0);let R=i,L=n;for(let S=1;S<g.length;S++){const k=g[S];R=Z(t,k[1],R),L=Z(t,k[2],L),Z(t,k[0],0)}}for(e++;e<r.length;){const g=r[e],{0:y,1:R}=g;if(y>a||y===a&&R>=l)break;e=Ir(r,e,t,s)}return s[0]<a?(ir(t,s[0],a),s[0]=a,s[1]=0):t.write(at),s[1]=Z(t,l,s[1]),e}w(Ir,"V$1");de(Ir,"_encodeGeneratedRanges");function ir(r,e,t){do r.write(sn);while(++e<t)}w(ir,"U$4");de(ir,"catchupLine");function cn(r){const{length:e}=r,t=new xr(r),s=[];let o=0,i=0,n=0,a=0,l=0;do{const f=t.indexOf(";"),u=[];let p=!0,c=0;for(o=0;t.pos<f;){let g;o=re(t,o),o<c&&(p=!1),c=o,Ne(t,f)?(i=re(t,i),n=re(t,n),a=re(t,a),Ne(t,f)?(l=re(t,l),g=[o,i,n,a,l]):g=[o,i,n,a]):g=[o],u.push(g),t.pos++}p||ln(u),s.push(u),t.pos=f+1}while(t.pos<=e);return s}w(cn,"K");de(cn,"decode");function ln(r){r.sort(dn)}w(ln,"Q$1");de(ln,"sort");function dn(r,e){return r[0]-e[0]}w(dn,"X$3");de(dn,"sortComparator");function un(r){const e=new Tr;let t=0,s=0,o=0,i=0;for(let n=0;n<r.length;n++){const a=r[n];if(n>0&&e.write(sn),a.length===0)continue;let l=0;for(let f=0;f<a.length;f++){const u=a[f];f>0&&e.write(at),l=Z(e,u[0],l),u.length!==1&&(t=Z(e,u[1],t),s=Z(e,u[2],s),o=Z(e,u[3],o),u.length!==4&&(i=Z(e,u[4],i)))}}return e.flush()}w(un,"Z$1");de(un,"encode");var Oc=Object.defineProperty,ye=w((r,e)=>Oc(r,"name",{value:e,configurable:!0}),"c$5");const Pc=/^[\w+.-]+:\/\//,Fc=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,jc=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function fn(r){return Pc.test(r)}w(fn,"R$3");ye(fn,"isAbsoluteUrl");function hn(r){return r.startsWith("//")}w(hn,"q$1");ye(hn,"isSchemeRelativeUrl");function Mr(r){return r.startsWith("/")}w(Mr,"m$1");ye(Mr,"isAbsolutePath");function pn(r){return r.startsWith("file:")}w(pn,"v$4");ye(pn,"isFileUrl");function ar(r){return/^[.?#]/.test(r)}w(ar,"u$1");ye(ar,"isRelative");function gt(r){const e=Fc.exec(r);return Rr(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}w(gt,"f$6");ye(gt,"parseAbsoluteUrl");function mn(r){const e=jc.exec(r),t=e[2];return Rr("file:","",e[1]||"","",Mr(t)?t:"/"+t,e[3]||"",e[4]||"")}w(mn,"w$4");ye(mn,"parseFileUrl");function Rr(r,e,t,s,o,i,n){return{scheme:r,user:e,host:t,port:s,path:o,query:i,hash:n,type:7}}w(Rr,"y$5");ye(Rr,"makeUrl");function cr(r){if(hn(r)){const t=gt("http:"+r);return t.scheme="",t.type=6,t}if(Mr(r)){const t=gt("http://foo.com"+r);return t.scheme="",t.host="",t.type=5,t}if(pn(r))return mn(r);if(fn(r))return gt(r);const e=gt("http://foo.com/"+r);return e.scheme="",e.host="",e.type=r?r.startsWith("?")?3:r.startsWith("#")?2:4:1,e}w(cr,"p$3");ye(cr,"parseUrl");function gn(r){if(r.endsWith("/.."))return r;const e=r.lastIndexOf("/");return r.slice(0,e+1)}w(gn,"P$3");ye(gn,"stripPathFilename");function vn(r,e){Er(e,e.type),r.path==="/"?r.path=e.path:r.path=gn(e.path)+r.path}w(vn,"A$1");ye(vn,"mergePaths");function Er(r,e){const t=e<=4,s=r.path.split("/");let o=1,i=0,n=!1;for(let l=1;l<s.length;l++){const f=s[l];if(!f){n=!0;continue}if(n=!1,f!=="."){if(f===".."){i?(n=!0,i--,o--):t&&(s[o++]=f);continue}s[o++]=f,i++}}let a="";for(let l=1;l<o;l++)a+="/"+s[l];(!a||n&&!a.endsWith("/.."))&&(a+="/"),r.path=a}w(Er,"d$4");ye(Er,"normalizePath");function wn(r,e){if(!r&&!e)return"";const t=cr(r);let s=t.type;if(e&&s!==7){const i=cr(e),n=i.type;switch(s){case 1:t.hash=i.hash;case 2:t.query=i.query;case 3:case 4:vn(t,i);case 5:t.user=i.user,t.host=i.host,t.port=i.port;case 6:t.scheme=i.scheme}n>s&&(s=n)}Er(t,s);const o=t.query+t.hash;switch(s){case 2:case 3:return o;case 4:{const i=t.path.slice(1);return i?ar(e||r)&&!ar(i)?"./"+i+o:i+o:o||"."}case 5:return t.path+o;default:return t.scheme+"//"+t.user+t.host+t.port+t.path+o}}w(wn,"F$2");ye(wn,"resolve");var Ac=Object.defineProperty,V=w((r,e)=>Ac(r,"name",{value:e,configurable:!0}),"i$1");function yn(r){if(!r)return"";const e=r.lastIndexOf("/");return r.slice(0,e+1)}w(yn,"ae");V(yn,"stripFilename");function bn(r,e){const t=yn(r),s=e?e+"/":"";return o=>wn(s+(o||""),t)}w(bn,"ge");V(bn,"resolver");var Oe=0,Or=1,Pr=2,Fr=3,$n=4,kn=1,Sn=2;function Tn(r,e){const t=lr(r,0);if(t===r.length)return r;e||(r=r.slice());for(let s=t;s<r.length;s=lr(r,s+1))r[s]=Cn(r[s],e);return r}w(Tn,"he");V(Tn,"maybeSort");function lr(r,e){for(let t=e;t<r.length;t++)if(!xn(r[t]))return t;return r.length}w(lr,"X$2");V(lr,"nextUnsortedSegmentLine");function xn(r){for(let e=1;e<r.length;e++)if(r[e][Oe]<r[e-1][Oe])return!1;return!0}w(xn,"_e");V(xn,"isSorted");function Cn(r,e){return e||(r=r.slice()),r.sort(jr)}w(Cn,"ve");V(Cn,"sortSegments");function jr(r,e){return r[Oe]-e[Oe]}w(jr,"$$3");V(jr,"sortComparator");function In(r,e){const t=e.map(()=>[]);for(let s=0;s<r.length;s++){const o=r[s];for(let i=0;i<o.length;i++){const n=o[i];if(n.length===1)continue;const a=n[Or],l=n[Pr],f=n[Fr],u=t[a];(u[l]||(u[l]=[])).push([f,s,n[Oe]])}}for(let s=0;s<t.length;s++){const o=t[s];for(let i=0;i<o.length;i++){const n=o[i];n&&n.sort(jr)}}return t}w(In,"Se");V(In,"buildBySources");var Xe=!1;function Mn(r,e,t,s){for(;t<=s;){const o=t+(s-t>>1),i=r[o][Oe]-e;if(i===0)return Xe=!0,o;i<0?t=o+1:s=o-1}return Xe=!1,t-1}w(Mn,"Ee");V(Mn,"binarySearch");function Ar(r,e,t){for(let s=t+1;s<r.length&&r[s][Oe]===e;t=s++);return t}w(Ar,"H");V(Ar,"upperBound");function Lr(r,e,t){for(let s=t-1;s>=0&&r[s][Oe]===e;t=s--);return t}w(Lr,"Y");V(Lr,"lowerBound");function Dr(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}w(Dr,"k$2");V(Dr,"memoizedState");function Rn(r,e,t,s){const{lastKey:o,lastNeedle:i,lastIndex:n}=t;let a=0,l=r.length-1;if(s===o){if(e===i)return Xe=n!==-1&&r[n][Oe]===e,n;e>=i?a=n===-1?0:n:l=n}return t.lastKey=s,t.lastNeedle=e,t.lastIndex=Mn(r,e,a,l)}w(Rn,"Me");V(Rn,"memoizedBinarySearch");function Wt(r){return typeof r=="string"?JSON.parse(r):r}w(Wt,"j$3");V(Wt,"parse");var Lc=V(function(r,e){const t=Wt(r);if(!("sections"in t))return new Nr(t,e);const s=[],o=[],i=[],n=[],a=[];Br(t,e,s,o,i,n,a,0,0,1/0,1/0);const l={version:3,file:t.file,names:n,sources:o,sourcesContent:i,mappings:s,ignoreList:a};return Dn(l)},"FlattenMap");function Br(r,e,t,s,o,i,n,a,l,f,u){const{sections:p}=r;for(let c=0;c<p.length;c++){const{map:g,offset:y}=p[c];let R=f,L=u;if(c+1<p.length){const S=p[c+1].offset;R=Math.min(f,a+S.line),R===f?L=Math.min(u,l+S.column):R<f&&(L=l+S.column)}En(g,e,t,s,o,i,n,a+y.line,l+y.column,R,L)}}w(Br,"ee");V(Br,"recurse");function En(r,e,t,s,o,i,n,a,l,f,u){const p=Wt(r);if("sections"in p)return Br(...arguments);const c=new Nr(p,e),g=s.length,y=i.length,R=rt(c),{resolvedSources:L,sourcesContent:S,ignoreList:k}=c;if(Ft(s,L),Ft(i,c.names),S)Ft(o,S);else for(let E=0;E<L.length;E++)o.push(null);if(k)for(let E=0;E<k.length;E++)n.push(k[E]+g);for(let E=0;E<R.length;E++){const x=a+E;if(x>f)return;const M=On(t,x),v=E===0?l:0,C=R[E];for(let D=0;D<C.length;D++){const j=C[D],K=v+j[Oe];if(x===f&&K>=u)return;if(j.length===1){M.push([K]);continue}const ne=g+j[Or],G=j[Pr],_=j[Fr];M.push(j.length===4?[K,ne,G,_]:[K,ne,G,_,y+j[$n]])}}}w(En,"me");V(En,"addSection");function Ft(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}w(Ft,"G$1");V(Ft,"append");function On(r,e){for(let t=r.length;t<=e;t++)r[t]=[];return r[e]}w(On,"xe$1");V(On,"getLine");var Pn="`line` must be greater than 0 (lines start at line 1)",Fn="`column` must be greater than or equal to 0 (columns start at column 0)",Bt=-1,zt=1,Nr=class{static{w(this,"R")}static{V(this,"TraceMap")}constructor(e,t){const s=typeof e=="string";if(!s&&e._decodedMemo)return e;const o=Wt(e),{version:i,file:n,names:a,sourceRoot:l,sources:f,sourcesContent:u}=o;this.version=i,this.file=n,this.names=a||[],this.sourceRoot=l,this.sources=f,this.sourcesContent=u,this.ignoreList=o.ignoreList||o.x_google_ignoreList||void 0;const p=bn(t,l);this.resolvedSources=f.map(p);const{mappings:c}=o;if(typeof c=="string")this._encoded=c,this._decoded=void 0;else if(Array.isArray(c))this._encoded=void 0,this._decoded=Tn(c,s);else throw o.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(o)}`);this._decodedMemo=Dr(),this._bySources=void 0,this._bySourceMemos=void 0}};function jn(r){var e,t;return(t=(e=r)._encoded)!=null?t:e._encoded=un(r._decoded)}w(jn,"oe");V(jn,"encodedMappings");function rt(r){var e;return(e=r)._decoded||(e._decoded=cn(r._encoded))}w(rt,"O$2");V(rt,"decodedMappings");function Dc(r,e,t){const s=rt(r);if(e>=s.length)return null;const o=s[e],i=kt(o,r._decodedMemo,e,t,zt);return i===-1?null:o[i]}w(Dc,"Oe$2");V(Dc,"traceSegment");function An(r,e){let{line:t,column:s,bias:o}=e;if(t--,t<0)throw new Error(Pn);if(s<0)throw new Error(Fn);const i=rt(r);if(t>=i.length)return vt(null,null,null,null);const n=i[t],a=kt(n,r._decodedMemo,t,s,o||zt);if(a===-1)return vt(null,null,null,null);const l=n[a];if(l.length===1)return vt(null,null,null,null);const{names:f,resolvedSources:u}=r;return vt(u[l[Or]],l[Pr]+1,l[Fr],l.length===5?f[l[$n]]:null)}w(An,"Le$1");V(An,"originalPositionFor");function Bc(r,e){const{source:t,line:s,column:o,bias:i}=e;return Gr(r,t,s,o,i||zt,!1)}w(Bc,"ye");V(Bc,"generatedPositionFor");function Nc(r,e){const{source:t,line:s,column:o,bias:i}=e;return Gr(r,t,s,o,i||Bt,!0)}w(Nc,"Ce$1");V(Nc,"allGeneratedPositionsFor");function _c(r,e){const t=rt(r),{names:s,resolvedSources:o}=r;for(let i=0;i<t.length;i++){const n=t[i];for(let a=0;a<n.length;a++){const l=n[a],f=i+1,u=l[0];let p=null,c=null,g=null,y=null;l.length!==1&&(p=o[l[1]],c=l[2]+1,g=l[3]),l.length===5&&(y=s[l[4]]),e({generatedLine:f,generatedColumn:u,source:p,originalLine:c,originalColumn:g,name:y})}}}w(_c,"Ie");V(_c,"eachMapping");function _r(r,e){const{sources:t,resolvedSources:s}=r;let o=t.indexOf(e);return o===-1&&(o=s.indexOf(e)),o}w(_r,"re");V(_r,"sourceIndex");function Ln(r,e){const{sourcesContent:t}=r;if(t==null)return null;const s=_r(r,e);return s===-1?null:t[s]}w(Ln,"Ne");V(Ln,"sourceContentFor");function Gc(r,e){const{ignoreList:t}=r;if(t==null)return!1;const s=_r(r,e);return s===-1?!1:t.includes(s)}w(Gc,"be");V(Gc,"isIgnored");function Dn(r,e){const t=new Nr(Ht(r,[]),e);return t._decoded=r.mappings,t}w(Dn,"se");V(Dn,"presortedDecodedMap");function qc(r){return Ht(r,rt(r))}w(qc,"Re");V(qc,"decodedMap");function Uc(r){return Ht(r,jn(r))}w(Uc,"we$1");V(Uc,"encodedMap");function Ht(r,e){return{version:r.version,file:r.file,names:r.names,sourceRoot:r.sourceRoot,sources:r.sources,sourcesContent:r.sourcesContent,mappings:e,ignoreList:r.ignoreList||r.x_google_ignoreList}}w(Ht,"B$2");V(Ht,"clone");function vt(r,e,t,s){return{source:r,line:e,column:t,name:s}}w(vt,"b$2");V(vt,"OMapping");function ot(r,e){return{line:r,column:e}}w(ot,"y$4");V(ot,"GMapping");function kt(r,e,t,s,o){let i=Rn(r,s,e,t);return Xe?i=(o===Bt?Ar:Lr)(r,s,i):o===Bt&&i++,i===-1||i===r.length?-1:i}w(kt,"w$3");V(kt,"traceSegmentInternal");function Bn(r,e,t,s,o){let i=kt(r,e,t,s,zt);if(!Xe&&o===Bt&&i++,i===-1||i===r.length)return[];const n=Xe?s:r[i][Oe];Xe||(i=Lr(r,n,i));const a=Ar(r,n,i),l=[];for(;i<=a;i++){const f=r[i];l.push(ot(f[kn]+1,f[Sn]))}return l}w(Bn,"Ue");V(Bn,"sliceGeneratedPositions");function Gr(r,e,t,s,o,i){var n,a;if(t--,t<0)throw new Error(Pn);if(s<0)throw new Error(Fn);const{sources:l,resolvedSources:f}=r;let u=l.indexOf(e);if(u===-1&&(u=f.indexOf(e)),u===-1)return i?[]:ot(null,null);const p=(n=r)._bySourceMemos||(n._bySourceMemos=l.map(Dr)),c=((a=r)._bySources||(a._bySources=In(rt(r),p)))[u][t];if(c==null)return i?[]:ot(null,null);const g=p[u];if(i)return Bn(c,g,t,s,o);const y=kt(c,g,t,s,o);if(y===-1)return ot(null,null);const R=c[y];return ot(R[kn]+1,R[Sn])}w(Gr,"ie");V(Gr,"generatedPosition");var Wc=Object.defineProperty,zc=w((r,e)=>Wc(r,"name",{value:e,configurable:!0}),"f$5"),Hc=Object.defineProperty,Nn=zc((r,e)=>Hc(r,"name",{value:e,configurable:!0}),"a");const Vc=Ws(import.meta.url),pt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qr=Nn(r=>{if(typeof pt<"u"&&pt.versions&&pt.versions.node){const[e,t]=pt.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return pt.getBuiltinModule(r)}return Vc(r)},"__cjs_getBuiltinModule"),{readFileSync:xs}=qr("node:fs"),{resolve:Kc,toNamespacedPath:tr,dirname:Jc}=qr("node:path"),{pathToFileURL:Yc}=qr("node:url");var Qc=Object.defineProperty,St=Nn((r,e)=>Qc(r,"name",{value:e,configurable:!0}),"s");const Xc=/^data:application\/json[^,]+base64,/,Zc=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,el=/\r?\n/,dr=St(r=>Xc.test(r),"isInlineMap"),rr=St((r,e)=>{const t=r instanceof Error?r.message:String(r),s=`${e}:
|
|
13
|
-
${t}`;throw new Error(s)},"enhanceError"),tl=St((r,e)=>{const t=r.split(el);let s;for(let i=t.length-1;i>=0&&!s;i--)s=Zc.exec(t[i])??void 0;if(!s)return;const o=s[1]??s[2];if(o)return dr(o)?o:Kc(e,o)},"resolveSourceMapUrl"),rl=St(r=>{const e=r.slice(r.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),sl=St(r=>{let e;try{e=xs(r,{encoding:"utf8"})}catch(o){rr(o,`Error reading sourcemap for file "${tr(r)}"`)}const t=tl(e,Jc(r));if(!t)return;let s;if(dr(t))s=rl(t);else try{s=xs(t,{encoding:"utf8"})}catch(o){rr(o,`Error reading sourcemap for file "${tr(r)}"`)}try{const o=dr(t)?t:Yc(t).href;return new Lc(s,o)}catch(o){rr(o,`Error parsing sourcemap for file "${tr(r)}"`)}},"loadSourceMap");var nl=Object.defineProperty,Re=w((r,e)=>nl(r,"name",{value:e,configurable:!0}),"l$1");const ol=Re(r=>sa(r),"stripAnsi"),il=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,al=/^\s*at\s+/,cl=Re(r=>{const e=r.split(`
|
|
14
|
-
`);let t;for(let s=0;s<e.length;s++){const o=il.exec(e[s].trim());if(!o)continue;const i=[];for(let n=s+1;n<e.length&&n<=s+200;n++){const a=e[n];if(al.test(a))i.push(a.trim());else if(i.length>0||a.trim()!=="")break}if(i.length>0){const n=o.groups?.name??"Error",a=o.groups?.message??"";t={message:a,name:n,stack:`${n}: ${a}
|
|
15
|
-
${i.map(l=>` ${l}`).join(`
|
|
16
|
-
`)}`}}}return t},"extractErrorBlock"),_n=Re(r=>{if(r.startsWith("file://"))try{return wi(r)}catch{return r}return r},"normalizeFramePath"),ll=Re(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),dl=Re(r=>{try{return sl(r)}catch{return}},"tryLoadSourceMap"),ul=Re((r,e)=>{if(!r.file||r.line===void 0)return;const t=_n(r.file),s=mi(t)?t:ps(e,t);if(!ll(s)||!bt(s))return;const o=dl(s);if(o){const i=An(o,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(i.source&&i.line!=null){const n=ps(gi(s),i.source),a=Ln(o,i.source)??(bt(n)?nr(n,"utf8"):void 0);if(a!==void 0)return{column:i.column==null?void 0:i.column+1,file:n,line:i.line,source:a}}}return{column:r.column,file:s,line:r.line,source:nr(s,"utf8")}},"resolveFrame"),Cs=Re((r,e)=>{const t=vi(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),Gn=Re((r,e)=>{if(!r?.trim())return r;try{const t=cl(ol(r));if(!t)return r;const s=new Error(t.message);s.name=t.name,s.stack=t.stack;const o=xc(s);if(o.length===0)return r;const i=e.color,n={dim:Re(c=>i?ms(c):c,"dim"),head:Re(c=>i?bi(Xt(c)):c,"head"),loc:Re(c=>i?yi(c):c,"loc")};let a,l;for(const c of o){const g=ul(c,e.cwd);if(g){a=g,l=c;break}}const f=[n.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(a){const c=`${Cs(a.file,e.cwd)}:${a.line}${a.column?`:${a.column}`:""}`;f.push(` ${n.loc(c)}`,""),f.push(Xa(a.source,{start:{column:a.column,line:a.line}},{color:i?{gutter:ms,marker:Xt,message:Xt}:void 0,linesAbove:2,linesBelow:3}))}const u=o.filter(c=>c!==l).slice(0,8).map(c=>{const g=c.methodName??"<anonymous>",y=c.file?`${Cs(_n(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return n.dim(` at ${g}${y?` (${y})`:""}`)});u.length>0&&f.push("",...u);const p=n.dim("─".repeat(40));return`${f.join(`
|
|
17
|
-
`)}
|
|
18
|
-
${p}
|
|
19
|
-
${r}`}catch{return r}},"renderFailureOutput");var fl=Object.defineProperty,Ae=w((r,e)=>fl(r,"name",{value:e,configurable:!0}),"t");const qn={delimiter:" ",language:{d:Ae(()=>" d","d"),future:"in %s",h:Ae(()=>" h","h"),m:Ae(()=>" m","m"),mo:Ae(()=>" mo","mo"),ms:Ae(()=>" ms","ms"),past:"%s ago",s:Ae(()=>" s","s"),w:Ae(()=>" w","w"),y:Ae(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Ae(r=>{const e=r[0]*1e3+r[1]/1e6;return Js(e,qn)},"formatHrtime");const tt=Ae(r=>Js(r,qn),"formatMs");var hl=Object.defineProperty,st=w((r,e)=>hl(r,"name",{value:e,configurable:!0}),"s$1");const it=st(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Tt=st(r=>{switch(r){case"failure":return{color:"red",icon:gr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:qs};case"skipped":return{color:"gray",icon:Gt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=st(r=>{const{color:e,icon:t}=Tt(r);return we(ee.createElement(d,{color:e},t),{columns:10}).trim()},"getStatusIcon"),pl=st(r=>{const{color:e,icon:t}=Tt(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return we(ee.createElement(d,null,ee.createElement(d,{color:e},t)," ",ee.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return we(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},t)," ",ee.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return we(ee.createElement(d,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),ml=st(r=>r==="azure"||r==="buildkite"||r==="github"||r==="gitlab"||r==="off"?r:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),gl=st(r=>{const e=r.replaceAll(/\W+/g,"_"),t=$i("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),vl=st((r,e,t,s="auto")=>{const o=t.trim();if(!o)return;const i=`
|
|
20
|
-
`,n=ml(s);if(n==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${r}${i}`),process.stdout.write(o+i),process.stdout.write(`::endgroup::${i}`);return}if(n==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=gl(r),g="\x1B[0K";process.stdout.write(`${g}section_start:${String(p)}:${c}[collapsed=true]\r${g}${wt(e)} ${r}${i}`),process.stdout.write(o+i);const y=Math.floor(Date.now()/1e3);process.stdout.write(`${g}section_end:${String(y)}:${c}\r${g}${i}`);return}if(n==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${r}${i}`),process.stdout.write(o+i);return}if(n==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${r}${i}`),process.stdout.write(o+i),process.stdout.write(`##[endgroup]${i}`);return}const a=process.stdout.columns||80,l=we(ee.createElement(d,{dimColor:!0},Gt.repeat(a)),{columns:a}).trim(),f=pl(e),u=we(ee.createElement(d,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${l}${i}`),process.stdout.write(`${f} ${u}${i}`),process.stdout.write(o+i),process.stdout.write(`${l}${i}`)},"logCommandOutputCI");var wl=Object.defineProperty,Ur=w((r,e)=>wl(r,"name",{value:e,configurable:!0}),"d$2");const yl=Ur(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Tt(r),"getDisplayInfo"),bl=Ur(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:s,statusValue:o,supportsInteractive:i,taskId:n})=>{if(!n)return;if(t)return"Esc cancel | Enter send";const a=r?"":" PAUSED (f resume)",l=i?" i INPUT":"";return e&&o==="running"&&s?`⏎ FULLSCREEN${l} f FOLLOW${a}`:e&&o==="running"?`f FOLLOW${l}${a}`:e&&s?`<enter> full screen${a}`:e?a||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Is=Ur(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:s,output:o,scrollRef:i,showFullscreenHint:n,status:a,supportsInteractive:l=!0,taskId:f})=>{const u=a??"pending",{icon:p}=yl(u),c=t?"bold":"single",g=u==="failure"?"red":u==="success"||it(u)?t?"green":"gray":u==="running"?t?"white":"cyan":t?"white":"gray",y=f?`${p} ${f}`:void 0,R=e===void 0?void 0:tt(e),L=bl({autoScroll:r,focused:t,interactiveMode:s??!1,showFullscreenHint:n??!1,statusValue:u,supportsInteractive:l,taskId:f});if(!f)return m(b,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[h(d,{dimColor:!0,children:"Select a task to view output"}),h(d,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const S=[];if(o)for(const k of o.split(`
|
|
21
|
-
`))S.push(k.endsWith("\r")?k.slice(0,-1):k);return!o&&(u==="running"||u==="pending")?h(b,{borderBottomTitle:L,borderColor:g,borderStyle:c,borderTopRightTitle:R,borderTopTitle:y,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:h(b,{alignItems:"center",flexGrow:1,justifyContent:"center",children:h(d,{dimColor:!0,children:"Waiting for task output…"})})}):m(b,{borderBottomTitle:L,borderColor:s?"yellow":g,borderStyle:c,borderTopRightTitle:R,borderTopTitle:y,flexDirection:"column",flexGrow:1,children:[h(b,{flexGrow:1,flexShrink:1,paddingY:1,children:h(zs,{flexGrow:1,followOutput:r,paddingX:2,ref:i,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:h(d,{children:S.join(`
|
|
22
|
-
`)})})}),s&&h(b,{flexShrink:0,justifyContent:"center",paddingX:1,children:h(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var $l=Object.defineProperty,ct=w((r,e)=>$l(r,"name",{value:e,configurable:!0}),"d$1");const kl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Un=ct(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),Sl=ct(({status:r})=>r==="starting"?h(d,{color:"cyan",children:h(Hs,{type:"dots"})}):h(d,{bold:!0,color:Un(r),children:kl[r]}),"StatusGlyph"),Tl=ct(({active:r,focused:e,state:t})=>{const s=e&&r,o=s?">":" ",i=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return m(b,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[h(d,{children:o}),h(d,{children:" "}),h(b,{flexShrink:0,width:3,children:h(Sl,{status:t.status})}),h(b,{flexGrow:0,flexShrink:0,width:28,children:h(d,{bold:s,inverse:s,children:t.id})}),h(b,{flexGrow:1,flexShrink:1,overflow:"hidden",children:m(d,{color:Un(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",i]})})]})},"ServiceRow"),xl=ct(({states:r})=>{const e=[];for(const s of r)s.status==="ready"&&e.push(s.id);const t=e.join(", ");return m(b,{paddingX:1,children:[m(d,{bold:!0,color:"green",children:["● ","Services"]}),m(d,{children:[" ",String(e.length)," / ",String(r.length)," running"]}),t.length>0&&m(d,{dimColor:!0,children:[" ",t]}),h(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),Cl=ct(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?m(b,{flexDirection:"column",paddingX:1,children:[m(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,s)=>m(d,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(s)}`))]}):h(Gs,{})},"CrashHeader"),Il=ct(({activeIndex:r,focused:e,store:t})=>{const s=Ot(t.subscribe,t.getSnapshot),o=t.getIds();if(o.length===0)return h(Gs,{});const i=o.map(u=>s.get(u)).filter(u=>u!==void 0),n=t.getDockState(),a=n==="crash"?"red":n==="ready"?"gray":e?"white":"cyan";return n==="ready"&&!e?h(b,{borderColor:a,borderStyle:"single",flexDirection:"row",flexShrink:0,children:h(xl,{states:i})}):m(b,{borderBottomTitle:e?n==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:a,borderStyle:e?"bold":"single",borderTopTitle:n==="crash"?"Services (crashed)":n==="ready"?"Services":"Services (starting)",flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[n==="crash"&&h(Cl,{states:i}),i.map((u,p)=>h(Tl,{active:p===r,focused:e,state:u},u.id))]})},"ServiceDock");var Ml=Object.defineProperty,Vt=w((r,e)=>Ml(r,"name",{value:e,configurable:!0}),"T$2");const Wn=6,zn=8,Hn=12,Rl=Vt(r=>r==="running"||r==="pending"?Us:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":Gt,"getCacheLabel"),Ms=Vt((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),Rs=Vt(({compact:r,focused:e,isSelected:t,pinLabel:s,row:o})=>{const{persistent:i,status:n,taskId:a}=o,l=e&&t,f=l?">":" ",u=n==="running"&&i===!0;let p;if(u)p=h(d,{bold:!0,color:"green",children:" ● "});else if(n==="running")p=m(d,{bold:!0,color:"white",children:[" ",h(Hs,{type:"dots"})," "]});else if(n==="pending")p=h(d,{bold:!0,color:"gray",children:" · "});else{const{color:g,icon:y}=Tt(n);p=m(d,{bold:!0,color:g,children:[" ",y," "]})}let c=Us;return u?c="running":n!=="running"&&n!=="pending"?c=o.duration===void 0?Gt:tt(o.duration):n==="running"&&o.elapsed!==void 0&&(c=tt(o.elapsed)),m(b,{children:[h(d,{children:f}),h(b,{width:Wn,children:p}),m(b,{flexGrow:1,children:[h(d,{bold:l,inverse:l,children:a}),s?h(d,{dimColor:!0,children:` ${s}`}):null]}),!r&&h(b,{justifyContent:"flex-end",width:zn,children:h(d,{dimColor:!it(n),children:Rl(n)})}),!r&&h(b,{justifyContent:"flex-end",width:Hn,children:h(d,{color:u?"green":void 0,dimColor:n==="pending"||u,children:c})})]})},"TaskListRow"),Es=Vt(({compact:r,filterActive:e,filterText:t,focused:s,headerStatus:o,parallelSlots:i=3,pinnedTaskIds:n,rows:a,scrollRef:l,selectedIndex:f,title:u})=>{const p=o==="error"?"red":o==="success"?"green":s?"white":"gray",c=a[f]?.taskId,g=[];let y=0;for(const k of a)k.status==="running"?g.push(k):k.status==="pending"&&(y+=1);const R=Math.min(i,g.length+y),L=R>1,S=[];if(L)for(let k=0;k<R;k++){const E=g[k];E?S.push(h(Rs,{compact:r,focused:s,isSelected:E.taskId===c,pinLabel:Ms(E.taskId,n),row:E},`par-${E.taskId}`)):S.push(m(b,{children:[h(d,{children:" "}),h(b,{width:Wn,children:h(d,{bold:!0,color:"gray",children:" · "})}),h(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(k)}`))}return m(b,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[m(b,{flexShrink:0,paddingX:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{children:` ${u}`}),!r&&m(b,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[h(b,{justifyContent:"flex-end",width:zn,children:h(d,{dimColor:!0,children:"Cache"})}),h(b,{justifyContent:"flex-end",width:Hn,children:h(d,{dimColor:!0,children:"Duration"})})]})]}),h(zs,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:l,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.map(k=>h(Rs,{compact:r,focused:s,isSelected:k.taskId===c,pinLabel:Ms(k.taskId,n),row:k},k.taskId))}),L&&h(b,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:S}),e&&m(b,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[h(d,{bold:!0,color:"white",children:"/ "}),h(d,{children:t}),h(d,{inverse:!0,children:" "})]})]})},"TaskListPanel");var El=Object.defineProperty,Ol=w((r,e)=>El(r,"name",{value:e,configurable:!0}),"ue");const Os=40,Ps=10,Fs=100,Pl=Object.freeze([]),Fl=Ol(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:s,serviceDockStore:o,stdinRegistry:i,store:n,targets:a,tasks:l})=>{const{exit:f}=hi(),{columns:u,rows:p}=pi(),c=Ot(n.subscribe,n.getSnapshot),g=Mt(P=>o?o.subscribe(P):()=>{},[o]);Ot(g,()=>o?o.getDockState():"ready");const y=o?o.getIds():Pl,R=y.length>0,[L,S]=ft(0),[k,E]=ft(null),x=Ot(g,()=>k&&o?o.getState(k):void 0),[M,v]=ft(!1),C=ht(null),D=ht(null),j=ht(null),[K,ne]=ft(!1),[G,_]=ft(!0),se=ht({list:0,splitList:0,splitOutput:0}),le=Mt(()=>{c.viewMode==="list"?se.current.list=D.current?.getScrollOffset()??0:c.viewMode==="split"&&(se.current.splitList=D.current?.getScrollOffset()??0,se.current.splitOutput=j.current?.getScrollOffset()??0)},[c.viewMode]),q=Mt(P=>{setTimeout(()=>{if(P==="list"){const T=se.current.list;D.current?.scrollTo(T)}else if(P==="split"){const T=se.current.splitList;T>0?D.current?.scrollTo(T):D.current?.scrollTo(Math.max(0,n.getSnapshot().selectedIndex-2)),j.current?.scrollTo(se.current.splitOutput)}},0)},[n]),ue=ht(!1);Yt(()=>{c.done&&!ue.current&&(ue.current=!0,r>0&&ne(!0)),!c.done&&ue.current&&(ue.current=!1,ne(!1))},[c.done,r]);const pe=Qt(()=>{const P=y.length>0?new Set(y):null,T=c.filterText?c.filterText.toLowerCase():null,A=[];for(const oe of c.rows)P?.has(oe.taskId)||c.statusFilter==="failed"&&oe.status!=="failure"||c.statusFilter==="running"&&oe.status!=="running"&&oe.status!=="pending"||c.statusFilter==="passed"&&oe.status!=="success"&&!it(oe.status)||T&&!oe.taskId.toLowerCase().includes(T)||A.push(oe);return A},[c.rows,c.filterText,c.statusFilter,y]),qe=Qt(()=>{let P=0;for(const T of c.rows)T.status==="running"&&(P+=1);return P},[c.rows]),ce=(pe[c.selectedIndex]??null)?.taskId??null,W=k?null:c.pinnedTaskIds[0]??ce,z=W?c.rows.find(P=>P.taskId===W):null,Pe=x??null,Te=k?(Pe?.tailLines??[]).join(`
|
|
23
|
-
`):W?c.outputs.get(W)??"":"",be=Qt(()=>z?.status==="failure"&&Te?Gn(Te,{color:!process.env.NO_COLOR,cwd:process.cwd()}):Te,[z?.status,Te]),Fe=k??W,Le=k?Pe?.status==="crashed"||Pe?.status==="failed"?"failure":"running":z?.status,Ue=kr(s,a,l),We=c.done?`Completed ${Ue} (${tt((c.endTime??Date.now())-c.startTime)})`:`Running ${Ue}...`,xe=c.done?c.failed>0?"error":"success":"running",fe=Mt(P=>{D.current?.scrollTo(Math.max(0,P-2))},[]);if(Yt(()=>{c.interactiveMode&&z?.status!=="running"&&n.setInteractiveMode(!1)},[c.interactiveMode,z?.status,n]),Yt(()=>{if(!W)return;let P=u;c.viewMode==="split"&&u>=Fs?P=u-Math.floor(u*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(P=u-2);const T=Math.max(1,p-4);i.get(W)?.resize?.(P,T)},[u,p,c.viewMode,W]),hs((P,T)=>{if(T.escape){n.setInteractiveMode(!1);return}if(!W)return;const A=i.get(W);if(!A){n.setInteractiveMode(!1);return}if(T.return)A.write("\r");else if(T.upArrow)A.write("\x1B[A");else if(T.downArrow)A.write("\x1B[B");else if(T.rightArrow)A.write("\x1B[C");else if(T.leftArrow)A.write("\x1B[D");else if(T.backspace)A.write("");else if(T.delete)A.write("\x1B[3~");else if(T.tab)A.write(" ");else if(T.home)A.write("\x1B[H");else if(T.end)A.write("\x1B[F");else if(T.pageUp)A.write("\x1B[5~");else if(T.pageDown)A.write("\x1B[6~");else if(T.ctrl&&P){const oe=P.toUpperCase().codePointAt(0);oe!==void 0&&oe>=65&&oe<=90&&A.write(String.fromCodePoint(oe-64))}else P&&A.write(P)},{isActive:c.interactiveMode}),hs((P,T)=>{if(P==="c"&&T.ctrl){f();return}if(!K){if(M){T.escape||P==="?"?v(!1):P==="q"?(v(!1),ne(!0)):T.downArrow||P==="j"?C.current?.scrollBy(1):T.upArrow||P==="k"?C.current?.scrollBy(-1):T.pageDown?C.current?.scrollBy(5):T.pageUp?C.current?.scrollBy(-5):T.home?C.current?.scrollToTop():T.end&&C.current?.scrollToBottom();return}if(P==="?"){v(!0);return}if(P==="q"){ne(!0);return}if(P==="r"&&c.done){n.requestRerun();return}if(P==="R"&&c.done){const A=pe[c.selectedIndex];A?.status==="failure"&&n.requestRetry(A.taskId);return}if(P==="F"&&!c.filterActive){const A=["all","failed","running","passed"],oe=A.indexOf(c.statusFilter);n.setStatusFilter(A[(oe+1)%A.length]);return}if(c.filterActive){if(T.escape){n.setFilterActive(!1);return}if(T.return){n.setFilterActive(!1);return}if(T.backspace){n.setFilter(c.filterText.slice(0,-1));return}if(P&&!T.ctrl&&!T.meta){n.setFilter(c.filterText+P);return}return}if(P==="i"&&z?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){n.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(T.escape){n.setViewMode("split"),q("split");return}if(P==="f"){const A=!G;_(A),A&&j.current?.scrollToBottom();return}if(T.downArrow||P==="j"){_(!1),j.current?.scrollBy(1);return}if(T.upArrow||P==="k"){_(!1),j.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&P==="d"){_(!1),j.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&P==="u"){_(!1),j.current?.scrollBy(-12);return}if(T.home){_(!1),j.current?.scrollToTop();return}if(T.end){_(!0),j.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&R&&o){if(T.tab){E(null),n.setFocusedPanel("tasks");return}if(T.escape){n.setFocusedPanel("tasks"),E(null),c.viewMode==="split"&&(n.setViewMode("list"),q("list"));return}if(T.downArrow||P==="j"){S(A=>Math.min(A+1,y.length-1));return}if(T.upArrow||P==="k"){S(A=>Math.max(A-1,0));return}if(T.return){const A=y[L];A&&(E(A),_(!0),le(),se.current.splitList=0,se.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),q("split"));return}if((P==="r"||P==="R")&&e){const A=y[L],oe=A?o.getState(A)?.status:void 0;if(A&&(oe==="crashed"||oe==="failed")){const Ie=e(A);Ie instanceof Promise&&Ie.catch(()=>{})}return}return}if(c.viewMode==="split"){if(T.tab){c.focusedPanel==="tasks"?n.setFocusedPanel("output"):R?n.setFocusedPanel("dock"):(E(null),n.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(T.escape){if(k&&R){E(null),n.setViewMode("list"),n.setFocusedPanel("dock"),q("list");return}E(null),n.setFocusedPanel("tasks");return}if(T.return){le(),n.setViewMode("fullscreen");return}if(P==="f"){const A=!G;_(A),A&&j.current?.scrollToBottom();return}if(T.downArrow||P==="j"){_(!1),j.current?.scrollBy(1);return}if(T.upArrow||P==="k"){_(!1),j.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&P==="d"){_(!1),j.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&P==="u"){_(!1),j.current?.scrollBy(-12);return}if(T.home){_(!1),j.current?.scrollToTop();return}if(T.end){_(!0),j.current?.scrollToBottom();return}return}if(T.escape){n.setViewMode("list"),q("list");return}if(T.return){n.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(T.tab&&c.viewMode==="list"&&R){n.setFocusedPanel("dock");return}if(T.downArrow||P==="j"){const A=Math.min(c.selectedIndex+1,Math.max(0,pe.length-1));n.setSelectedIndex(A),fe(A);return}if(T.upArrow||P==="k"){const A=Math.max(c.selectedIndex-1,0);n.setSelectedIndex(A),fe(A);return}if(T.return&&c.viewMode==="list"){_(!0),le(),se.current.splitList=0,se.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),q("split");return}if(P==="/"){n.setFilterActive(!0);return}if(P==="1"&&ce){n.pinTask(0,ce);return}if(P==="2"&&ce){n.pinTask(1,ce);return}if(P==="0"){n.clearPins();return}T.escape&&c.filterText&&n.setFilter("")}}},{isActive:!c.interactiveMode}),u<Os||p<Ps)return h(b,{alignItems:"center",height:p,justifyContent:"center",width:u,children:m(d,{color:"yellow",children:["Terminal too small (",u,"x",p,"). Minimum:"," ",Os,"x",Ps]})});const ze=m(b,{gap:1,children:[c.succeeded>0&&m(d,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&m(d,{bold:!0,color:"red",children:["✗"," ",c.failed]}),qe>0&&m(d,{color:"cyan",children:["◷"," ",qe]}),m(d,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&m(d,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let Ce;if(c.viewMode==="fullscreen")Ce=[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"^u ^d"}),h(d,{dimColor:!0,children:"PAGE"})]},"page"),...z?.status==="running"?[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const P=pe[c.selectedIndex]?.status==="failure";Ce=[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"r"}),h(d,{dimColor:!0,children:"RERUN"})]},"r"),...P?[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"R"}),h(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"FILTER"})]},"F"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else c.viewMode==="split"&&c.focusedPanel==="output"?Ce=[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),...z?.status==="running"?[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?")]:Ce=[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"/"}),h(d,{dimColor:!0,children:"FILTER"})]},"/"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"STATUS"})]},"F"),m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[m(b,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const De=m(b,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[h(b,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Ce}),h(b,{flexShrink:0,paddingX:1,children:ze})]}),me=m(fi,{backgroundColor:"#1e1e1e",footer:m(d,{dimColor:!0,children:[h(d,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",h(d,{bold:!0,color:"white",children:"?"}),"/",h(d,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:C,title:"KEYBOARD SHORTCUTS",visible:M,width:52,children:[m(b,{flexDirection:"column",marginBottom:1,children:[m(b,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Move up"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Move down"})]})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Tab"]}),h(d,{dimColor:!0,children:" Switch panel (split)"})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Esc"]}),h(d,{dimColor:!0,children:" Back / close"})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Enter"]}),h(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),m(b,{flexDirection:"column",marginBottom:1,children:[m(b,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"VIEWS"})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Enter"]}),m(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Esc"]}),m(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),m(b,{flexDirection:"column",marginBottom:1,children:[m(b,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"ACTIONS"})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","/"]}),h(d,{dimColor:!0,children:" Filter by text"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","F"]}),h(d,{dimColor:!0,children:" Filter by status"})]})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","1"]}),h(d,{dimColor:!0,children:"/"}),h(d,{bold:!0,color:"white",children:"2"}),h(d,{dimColor:!0,children:" Pin to output pane"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","0"]}),h(d,{dimColor:!0,children:" Clear pins"})]})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","r"]}),h(d,{dimColor:!0,children:" Rerun all (done)"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","R"]}),h(d,{dimColor:!0,children:" Retry failed task"})]})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","i"]}),h(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),m(b,{flexDirection:"column",marginBottom:1,children:[m(b,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"SCROLLING"}),h(d,{dimColor:!0,children:" (output panel)"})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Scroll up"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Scroll down"})]})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","^u"]}),h(d,{dimColor:!0,children:" Page up"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","^d"]}),h(d,{dimColor:!0,children:" Page down"})]})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","Home"]}),h(d,{dimColor:!0,children:" Top"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","End"]}),h(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","f"]}),h(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),m(b,{flexDirection:"column",children:[m(b,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"GENERAL"})]}),m(b,{children:[h(b,{width:24,children:m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","q"]}),h(d,{dimColor:!0,children:" Quit"})]})}),m(d,{children:[m(d,{bold:!0,color:"white",children:[" ","?"]}),h(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Je=h(po,{autoExitSeconds:r>0?r:3,onCancel:w(()=>{ne(!1)},"onCancel"),visible:K}),je=R&&o?h(Il,{activeIndex:L,focused:c.focusedPanel==="dock",store:o}):null;if(c.viewMode==="fullscreen")return m(b,{flexDirection:"column",height:p,width:u,children:[h(b,{flexGrow:1,children:h(Is,{autoScroll:G,duration:z?.duration??z?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:be,scrollRef:j,status:Le,supportsInteractive:!k,taskId:Fe})}),je,De,Je,me]});if(c.viewMode==="split"){const P=u>=Fs,T=h(Es,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:xe,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:pe,scrollRef:D,selectedIndex:c.selectedIndex,title:We}),A=h(Is,{autoScroll:G,duration:z?.duration??z?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:be,scrollRef:j,showFullscreenHint:!0,status:Le,supportsInteractive:!k,taskId:Fe});if(P){const Ie=Math.floor(u*.4);return m(b,{flexDirection:"column",height:p,width:u,children:[m(b,{flexDirection:"row",flexGrow:1,children:[h(b,{width:Ie,children:T}),h(b,{flexGrow:1,children:A})]}),je,De,Je,me]})}const oe=Math.floor(p*.45);return m(b,{flexDirection:"column",height:p,width:u,children:[h(b,{height:oe,children:T}),h(b,{flexGrow:1,children:A}),je,De,Je,me]})}return m(b,{flexDirection:"column",height:p,width:u,children:[h(b,{flexGrow:1,children:h(Es,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:xe,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:pe,scrollRef:D,selectedIndex:c.selectedIndex,title:We})}),je,De,Je,me]})},"VisTaskRunnerApp");var jl=Object.defineProperty,Qe=w((r,e)=>jl(r,"name",{value:e,configurable:!0}),"r$2");const Al=Qe(r=>{const{args:e,autoExit:t=!1,onRetryService:s,outputStyle:o="normal",projectNames:i,serviceDockStore:n,stdinRegistry:a,tasks:l}=r,f=new Dt(l),u=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,g;const y=new Promise(C=>{g=C});let R;const L=Qe(()=>{R&&(clearInterval(R),R=void 0)},"cleanup"),S=Qe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),k=Qe(()=>{if(a){for(const C of a.values())C.kill?.();a.clear()}},"killAllPtyProcesses"),E=Qe(()=>{L(),v(),k(),S(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),x=Qe(()=>{const C=f.getSnapshot(),D=tt(Date.now()-C.startTime),j=C.rows.filter(G=>G.status==="failure").map(G=>G.taskId),K=process.stdout.columns||80;process.stdout.write(`
|
|
24
|
-
`);for(const G of C.rows){const{persistent:_,status:se,taskId:le}=G,q=se==="running"||se==="pending",ue=Tt(se),pe=q&&_?"■":ue.icon,qe=q&&_?"gray":ue.color;let ce="";switch(se){case"local-cache":case"local-cache-kept-existing":{ce=" [local cache]";break}case"remote-cache":{ce=" [remote cache]";break}case"skipped":{ce=" [skipped]";break}default:{q&&_?ce=" [stopped]":q&&(ce=" [skipped]");break}}const W=G.retryAttempts&&G.retryAttempts>0?` [retried ${G.retryAttempts}x]`:"",z=we(ee.createElement(d,null," ",ee.createElement(d,{color:qe},pe),` vis run ${le}`,ce?ee.createElement(d,{dimColor:!0},` ${ce}`):null,W?ee.createElement(d,{color:"yellow"},W):null),{columns:K});process.stdout.write(`${z}
|
|
25
|
-
`)}process.stdout.write(`
|
|
26
|
-
`);const ne=we(ee.createElement(Zs,{cached:C.cached,failed:C.failed,failedIds:j,projectNames:i,retriedIds:C.retriedIds.length>0?C.retriedIds:void 0,succeeded:C.succeeded,targets:e.targets,tasks:l,took:D}),{columns:K});if(process.stdout.write(`${ne}
|
|
27
|
-
`),j.length>0&&o!=="quiet")for(const G of j){const _=C.outputs.get(G);if(_?.trim()){const se=we(ee.createElement(d,null,`
|
|
28
|
-
`,ee.createElement(d,{bold:!0,color:"red"},` ${gr} vis run ${G}`)),{columns:K});process.stdout.write(`${se}
|
|
29
|
-
|
|
30
|
-
`);const le=_.trim().split(`
|
|
31
|
-
`).map(q=>` ${q}`).join(`
|
|
32
|
-
`);process.stdout.write(`${le}
|
|
33
|
-
`)}}},"printExitSummary");let M;const v=Qe(()=>{M&&(clearInterval(M),M=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){L(),f.markDone(),M||(M=setInterval(()=>{},1e3))},endTasks(C){f.endTasks(C)},printTaskTerminalOutput(C,D,j){f.getSnapshot().outputs.has(C.id)||f.addOutput(C.id,j)},startCommand(){process.on("SIGINT",E),process.on("SIGTERM",E),M||(M=setInterval(()=>{},1e3)),c=ui(ee.createElement(Fl,{autoExitSeconds:p,onRetryService:s,parallelSlots:u,projectNames:i,serviceDockStore:n,stdinRegistry:a??new Map,store:f,targets:e.targets,tasks:l}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{v(),k(),S(),process.removeListener("SIGINT",E),process.removeListener("SIGTERM",E),x(),g()}).catch(()=>{v(),k(),S(),process.removeListener("SIGINT",E),process.removeListener("SIGTERM",E),g()})},startTasks(C){f.startTasks(C),R||(R=setInterval(()=>{f.tick()},100))}},renderIsDone:y,store:f}},"createDynamicOutputRenderer");var Ll=Object.defineProperty,Wr=w((r,e)=>Ll(r,"name",{value:e,configurable:!0}),"c$3");const Dl=Wr(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),Bl=Wr((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class Nl{static{w(this,"StaticOutputLifeCycle")}static{Wr(this,"StaticOutputLifeCycle")}#e;#s;#r;#n=[];#t=[];#o=[];#i=new Map;#a;#c;#l;#d=0;constructor(e){this.#e=e.projectNames,this.#s=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#d=Date.now();const e=process.stdout.columns||80,t=`Running ${kr(this.#e,this.#s,this.#r)}`,s=we(ee.createElement(or,{title:t,variant:"info"}),{columns:e});process.stdout.write(s);const o=this.#r[0],i=o?.overrides?Object.entries(o.overrides).filter(([n])=>n!=="command"):[];if(i.length>0){process.stdout.write(`
|
|
34
|
-
With additional flags:
|
|
35
|
-
`);for(const[n,a]of i)process.stdout.write(`${Fa(" ",n,a)}
|
|
36
|
-
`)}process.stdout.write(`
|
|
37
|
-
`)}startTasks(e){const t=process.stdout.columns||80;for(const s of e){const o=we(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},">"),` ${s.id}`),{columns:t});process.stdout.write(`${o}
|
|
38
|
-
`)}}endTasks(e){const t=process.stdout.columns||80;for(const s of e){this.#i.set(s.task.id,s),s.status==="failure"?this.#n.push(s):it(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#o.push(s);const o=wt(s.status),i=s.startTime&&s.endTime?` (${tt(s.endTime-s.startTime)})`:"",n=it(s.status)?" [cache]":"",a=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",l=we(ee.createElement(d,null,o,` ${s.task.id}`,n?ee.createElement(d,{color:"cyan"},n):null,a?ee.createElement(d,{color:"yellow"},a):null,i?ee.createElement(d,{dimColor:!0},i):null),{columns:t});process.stdout.write(`${l}
|
|
39
|
-
`)}}printTaskTerminalOutput(e,t,s){if(Bl(e,this.#c)==="quiet"&&(t==="success"||it(t)))return;const o=t==="failure"?Gn(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,t,o);return}vl(e.id,t,o,this.#l)}endCommand(){const e=tt(Date.now()-this.#d),t=this.#r.filter(i=>!this.#i.has(i.id)).map(i=>i.id);process.stdout.write(`
|
|
40
|
-
`);const s=process.stdout.columns||80,o=we(ee.createElement(Zs,{cached:this.#t.length,failed:this.#n.length,failedIds:this.#n.map(i=>i.task.id),projectNames:this.#e,retriedIds:this.#o.length>0?this.#o.map(i=>i.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#i.size-this.#n.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${o}
|
|
41
|
-
`)}}var _l=Object.defineProperty,Kt=w((r,e)=>_l(r,"name",{value:e,configurable:!0}),"o");const Gl=Kt(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||ki()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=lo(e);try{if(t==="zsh"){await ql(r);return}if(t==="bash"){await Ul(r);return}t==="fish"&&await Wl(r)}catch{}},"appendToShellHistory"),ql=Kt(async r=>{const e=process.env.HISTFILE??Ee(process.env.ZDOTDIR??wr(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
|
|
42
|
-
`;await vr(e,t)},"writeZshHistory"),Ul=Kt(async r=>{const e=process.env.HISTFILE??Ee(wr(),".bash_history");await vr(e,`${r}
|
|
43
|
-
`)},"writeBashHistory"),Wl=Kt(async r=>{const e=Ee(wr(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
|
|
44
|
-
`,String.raw`\n`)}
|
|
45
|
-
when: ${Math.floor(Date.now()/1e3)}
|
|
46
|
-
`;await vr(e,t)},"writeFishHistory");var zl=Object.defineProperty,sr=w((r,e)=>zl(r,"name",{value:e,configurable:!0}),"e");const Hl=sr(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:s,timeoutMs:o}=r;if(o<=0)return{cancel:sr(()=>{},"cancel")};const i=Math.max(e,0);let n;const a=setTimeout(()=>{t?.(),s("SIGTERM"),i>0&&(n=setTimeout(()=>{s("SIGKILL")},i))},o);return{cancel:sr(()=>{clearTimeout(a),n&&clearTimeout(n)},"cancel")}},"scheduleTimeoutKill");var Vl=Object.defineProperty,ur=w((r,e)=>Vl(r,"name",{value:e,configurable:!0}),"r");const Vn=Ws(import.meta.url);let mt;const Kl=ur(()=>{if(mt!==void 0)return mt;try{Vn.resolve("fb-watchman")}catch{return mt=!1,!1}try{Ti("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return mt=!1,!1}return mt=!0,!0},"isWatchmanAvailable"),Jl=ur((r,e)=>{if(!Kl())return;let t;try{t=Vn("fb-watchman")}catch(o){nt.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${o.message}`);return}const s=new t.Client;s.on("error",o=>{nt.warn(`[vis watch] watchman error: ${o.message}`)}),s.on("subscription",o=>{const i=o;if(!i.is_fresh_instance)for(const n of i.files??[])e(n)});for(const[o,i]of r.entries()){const n=hr(i),a=`vis-watch-${o}-${process.pid}`;s.command(["watch-project",n],(l,f)=>{if(l){nt.warn(`[vis watch] watchman could not watch ${i}: ${l.message}`);return}const u={expression:["allof",["type","f"]],fields:["name"]};f.relative_path&&(u.relative_root=f.relative_path),s.command(["subscribe",f.watch,a,u],p=>{p&&nt.warn(`[vis watch] watchman subscribe failed for ${i}: ${p.message}`)})})}return{close:ur(()=>{try{s.end()}catch{}},"close")}},"startWatchmanWatcher");var Yl=Object.defineProperty,Ve=w((r,e)=>Yl(r,"name",{value:e,configurable:!0}),"c$1");const Ql=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],js=Ve((r,e)=>{const t=new Set,s=new Set;for(const[,n]of r){const a=n.task.hashDetails?.nodes;if(a)for(const l of Object.keys(a))t.add(l),s.add(uo(hr(e,l)))}const o=[...s].sort(),i=[];for(const n of o)i.some(a=>n===a||n.startsWith(`${a}/`))||i.push(n);return{directories:i,files:t}},"collectTrackedWatchTargets"),Xl=Ve((r,e,t)=>{const s=new Set;for(const o of r){const i=hr(e,o);for(const n of t)if(i===n||i.startsWith(`${n}/`)){const a=fo(n,i);a.length>0&&s.add(a)}}return o=>{const i=o.replaceAll("\\","/");return s.has(i)}},"createTrackedFileFilter"),Zl=Ve(r=>{const e=r.replaceAll("\\","/");return Ql.some(t=>t.test(e))},"shouldIgnore"),As=Ve(r=>{const{debounceMs:e=150,filter:t,onChange:s,paths:o}=r;let i=new Set,n;const a=Ve(()=>{n=void 0;const p=[...i];i=new Set,p.length!==0&&Promise.resolve(s(p)).catch(c=>{nt.error("[vis watch] onChange handler failed:",c)})},"flush"),l=Ve(p=>{Zl(p)||t&&!t(p)||(i.add(p),n&&clearTimeout(n),n=setTimeout(a,e))},"emit"),f=Jl(o,l);if(f)return{close:Ve(()=>{n&&clearTimeout(n),f.close()},"close")};const u=[];for(const p of o)try{const c=Uo(p,{recursive:!0},(g,y)=>{y&&l(y)});u.push(c)}catch(c){nt.warn(`[vis watch] unable to watch ${p}: ${c.message}`)}return{close:Ve(()=>{n&&clearTimeout(n);for(const p of u)try{p.close()}catch{}},"close")}},"startWatcher");var ed=Object.defineProperty,td=w((r,e)=>ed(r,"name",{value:e,configurable:!0}),"n");const rd=td((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const s=t.toLowerCase();return{filter:t,tasks:r.filter(o=>o.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var sd=Object.defineProperty,Be=w((r,e)=>sd(r,"name",{value:e,configurable:!0}),"a$1");const nd=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
|
|
47
|
-
`),od=Be(r=>{r.write(`${nd}
|
|
48
|
-
`)},"writeHelp"),id=Be(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,s=t.isRaw===!0;if(s)try{t.setRawMode?.(!1)}catch{}return await new Promise(o=>{let i="";const n=Be(a=>{i+=typeof a=="string"?a:a.toString("utf8");const l=i.indexOf(`
|
|
49
|
-
`);if(l===-1)return;const f=i.slice(0,l).replace(/\r$/,"").trim();if(r.off("data",n),s)try{t.setRawMode?.(!0)}catch{}o(f.length>0?f:void 0)},"onData");r.on("data",n)})},"defaultPromptFilter"),ad=Be(r=>{const{handlers:e}=r,t=r.input??process.stdin,s=r.output??process.stdout,o=r.promptFilter??id;if(!t||t.isTTY===!1)return{close:Be(()=>{},"close")};di(t);const i=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let n=!1;const a=Be(async u=>{if(u.ctrl===!0&&u.name==="c"){await e.onQuit();return}if(!n)switch(u.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{n=!0;try{const p=await o(t,s);p===void 0?s.write(`filter cancelled.
|
|
50
|
-
`):await e.onFilter(p)}finally{n=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),l=Be((u,p)=>{a(p).catch(c=>{s.write(`[vis watch] keybind handler failed: ${c.message}
|
|
51
|
-
`)})},"onKeypress"),f=t;return f.on("keypress",l),{close:Be(()=>{if(f.off("keypress",l),!i)try{t.setRawMode?.(!1)}catch{}const u=t;if(typeof u.pause=="function")try{u.pause()}catch{}},"close")}},"installKeybinds");var cd=Object.defineProperty,fr=w((r,e)=>cd(r,"name",{value:e,configurable:!0}),"y");const ld=fr(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),dd=fr(async r=>{const{initialTasks:e,probe:t,registeredEntries:s,taskGraph:o,visVersion:i}=r,n=new Map,a=new Map,l=new Map;for(const v of s)if(Yo(v.pid)){if(v.visVersion!==i){a.set(v.id,v);continue}n.set(v.id,v)}if(t){const v=[...n.values()],C=await Promise.all(v.map(async D=>{try{return[D.id,await t(D)]}catch{return[D.id,!1]}}));for(const[D,j]of C)if(!j){const K=n.get(D);n.delete(D),K&&l.set(D,K)}}const f=new Set(e.map(v=>v.id)),u=new Set,p=[],c=[],g=new Set;for(const v of Object.values(o.dependencies))for(const C of v)g.add(C);for(const[v,C]of Object.entries(o.tasks)){if(!ld(C)?.service)continue;if(n.has(v)){u.add(v),c.push(n.get(v));continue}if(f.has(v)||!g.has(v))continue;const D=a.get(v),j=l.get(v);let K;D?K=`Service ${v} is registered with vis ${D.visVersion}, but this invocation is vis ${i}. Restart with \`vis service restart ${v}\` to pick up the new version.`:j?K=`Service ${v} is registered (PID ${String(j.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${v}\` to recover.`:K=`Target depends on the service ${v}, which is not running. Run \`vis service start ${v}\` first, or invoke \`${v}\` directly.`,p.push({message:K,targetId:v})}if(u.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:o};const y=new Map,R=fr(v=>{const C=new Set,D=[...o.dependencies[v]??[]],j=new Set;for(;D.length>0;){const K=D.pop();if(!j.has(K)){j.add(K),u.has(K)&&C.add(K);for(const ne of o.dependencies[K]??[])j.has(ne)||D.push(ne)}}return[...C].sort()},"collectTransitiveServices"),L=new Map;for(const v of Object.keys(o.dependencies)){if(u.has(v))continue;const C=R(v);if(C.length===0)continue;const D={};for(const j of C){const K=n.get(j);if(!K)continue;Object.assign(D,K.env);const ne=L.get(j);ne?ne.push(v):L.set(j,[v])}Object.keys(D).length>0&&y.set(v,D)}for(const v of L.values())v.sort();const S={};for(const[v,C]of Object.entries(o.tasks))u.has(v)||(S[v]=C);const k={};for(const[v,C]of Object.entries(o.dependencies))u.has(v)||(k[v]=C.filter(D=>!u.has(D)));const E=new Map;for(const v of Object.keys(S))E.set(v,0);for(const v of Object.values(k))for(const C of v)E.has(C)&&E.set(C,(E.get(C)??0)+1);const x=[];for(const v of o.roots)!u.has(v)&&S[v]&&x.push(v);for(const[v,C]of E)C===0&&!x.includes(v)&&S[v]&&x.push(v);const M=e.filter(v=>!u.has(v.id));return{diagnostics:p,initialTasks:M,satisfiedServices:c,serviceDependentsByServiceId:L,serviceEnvByTaskId:y,taskGraph:{dependencies:k,roots:x,tasks:S}}},"applyServiceRegistry");var ud=Object.defineProperty,yt=w((r,e)=>ud(r,"name",{value:e,configurable:!0}),"c");const Et="[[VIS_BOOT]]",fd=250,hd=1e3,Ls=3,pd=yt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Ds=yt(r=>{try{const e=nr(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class md{static{w(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#s;#r;#n;#t=new Map;#o=new Map;#i=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#s=new Map(e.services),this.#r=e.sink,this.#n=e.workspaceRoot}onProcessEvent=yt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const t=this.#e.get(e.index);t===void 0||e.text===void 0||this.onTaskOutput(t,e.text)},"onProcessEvent");onTaskOutput(e,t){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+t).split(`
|
|
52
|
-
`),o=s.pop()??"";this.#t.set(e,o);for(const i of s)this.#l(e,i)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,t){this.#r.started(e,t)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:s});return}const o=await Qo(this.#n,e);if(!o){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:i}=o,n=i.readiness?.tcp?.port??i.port??0,a=i.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:a,logFile:o.logFile,pid:o.pid,port:n})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#f(e,t.logFile),t.pid!==null&&this.#h(e,t.pid)}notifyRegistryFailed(e,t,s){this.#r.failed(e,t,s)}async retry(e){const t=this.#s.get(e);if(t){if(this.#u(e),this.#t.delete(e),this.#o.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#y(e,t.registry);return}t.mode==="ephemeral"&&this.#w(e,t.ephemeral)}}async dispose(){for(const e of[...this.#i.keys(),...this.#a.keys()])this.#u(e);this.#c.size>0&&(await Promise.race([Promise.all(this.#c),new Promise(e=>{setTimeout(e,2e3)})]),this.#c.clear()),this.#t.clear(),this.#o.clear()}#l(e,t){if(t.startsWith(Et)){this.#d(e,t.slice(Et.length));return}const s=this.#o.get(e)??[];s.push(t),s.length>Ls&&s.shift(),this.#o.set(e,s),this.#r.log(e,`${t}
|
|
53
|
-
`)}#d(e,t){let s;try{s=JSON.parse(t)}catch{this.#r.log(e,`${Et+t}
|
|
54
|
-
`);return}switch(s.event){case"failed":{const o=typeof s.reason=="string"?s.reason:"unknown",i={};for(const[n,a]of Object.entries(s))n!=="event"&&n!=="id"&&n!=="reason"&&(i[n]=a);this.#r.failed(e,o,i);break}case"ready":{const o=typeof s.host=="string"?s.host:"127.0.0.1",i=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:o,port:i}),this.#m(e);break}case"started":{const o=typeof s.pid=="number"?s.pid:null;this.#r.started(e,o);break}default:this.#r.log(e,`${Et+t}
|
|
55
|
-
`)}}#m(e){const t=this.#s.get(e);if(t?.ephemeral===void 0)return;this.#f(e,t.ephemeral.logFile);const s=Ds(t.ephemeral.pidFile);s!==null&&this.#h(e,s)}#f(e,t){if(this.#i.has(e)||!bt(t))return;const s=Wo(t,"r"),o=(()=>{try{return Lt(t).size}catch{return 0}})(),i={fd:s,logFile:t,pollTimer:setInterval(()=>{this.#g(e)},fd),position:o};this.#i.set(e,i)}#g(e){const t=this.#i.get(e);if(t)try{const s=Lt(t.logFile);if(s.size<=t.position)return;const o=Buffer.alloc(s.size-t.position),i=zo(t.fd,o,0,o.length,t.position);if(i>0){t.position+=i;const n=o.subarray(0,i).toString("utf8");for(const a of n.split(`
|
|
56
|
-
`))a.length!==0&&this.#v(e,a);this.#r.log(e,n)}}catch{}}#v(e,t){const s=this.#o.get(e)??[];for(s.push(t);s.length>Ls;)s.shift();this.#o.set(e,s)}#h(e,t){if(this.#a.has(e))return;const s={pid:t,timer:setInterval(()=>{if(!pd(t)){const o=[...this.#o.get(e)??[]];this.#u(e),this.#r.crashed(e,o)}},hd)};this.#a.set(e,s)}#u(e){const t=this.#i.get(e);if(t){clearInterval(t.pollTimer);try{Ho(t.fd)}catch{}this.#i.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,t){if(t===void 0)return;const s=Ds(t.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const o=xi("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});o.stdout.on("data",n=>{this.#p(e,n)}),o.stderr.on("data",n=>{this.#p(e,n)}),o.on("error",n=>{this.#r.failed(e,"respawn-error",{message:n.message})});const i=new Promise(n=>{const a=yt(()=>{this.#c.delete(i),n()},"settle");o.once("exit",a),o.once("error",a)});this.#c.add(i)}#p(e,t){const s=((this.#t.get(e)??"")+t.toString("utf8")).split(`
|
|
57
|
-
`),o=s.pop()??"";this.#t.set(e,o);for(const i of s)this.#l(e,i)}async#y(e,t){if(t!==void 0){try{await Xo({id:e,workspaceRoot:this.#n})}catch{}try{const s=await Zo({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#n}),o=t.config.readiness?.tcp?.port??t.config.port??0,i=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:i,logFile:s.entry.logFile,pid:s.entry.pid,port:o})}catch(s){const o=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:o})}}}}var gd=Object.defineProperty,Se=w((r,e)=>gd(r,"name",{value:e,configurable:!0}),"f");const vd=Se(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Kn=Se((r,e,t)=>{const s=[],o=[];for(const i of e){const n=t.tasks[i];if(!n){o.push({id:i,reason:"task not in graph"});continue}const a=n.overrides.command;if(!a){o.push({id:i,reason:"no command resolved"});continue}const l=vd(n);if(!l?.service){o.push({id:i,reason:"no service config"});continue}const f=_t(r,n.projectRoot,!!l.runFromWorkspaceRoot),{envFile:u}=l,p=u===void 0||u===!1?{}:pr(f,u),c=l.service.env??{};s.push({command:a,config:l.service,cwd:f,env:{...p,...c},id:i})}return{services:s,skipped:o}},"extractPreflightTasks"),wd=Se((r,e)=>{const t=new Set(r),s=new Map;for(const n of r){const a=(e.dependencies[n]??[]).filter(l=>t.has(l));s.set(n,new Set(a))}const o=[],i=new Set;for(;s.size>0;){const n=[];for(const[a,l]of s){for(const f of l)i.has(f)&&l.delete(f);l.size===0&&n.push(a)}n.length===0&&n.push(...s.keys());for(const a of n)i.add(a),s.delete(a);n.sort(),o.push({ids:n})}return o},"planTopoLevels"),yd=Se((r,e)=>{const t=[];for(const s of wd(r,e))t.push(...s.ids);return t},"linearize"),bd=String.raw`import { spawn } from "node:child_process";
|
|
58
|
-
import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
59
|
-
import { createConnection } from "node:net";
|
|
60
|
-
|
|
61
|
-
const cfgPath = process.argv[2];
|
|
62
|
-
|
|
63
|
-
if (!cfgPath) {
|
|
64
|
-
console.error("[vis-service-bootstrap] missing config path");
|
|
65
|
-
process.exit(2);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const cfg = JSON.parse(readFileSync(cfgPath, "utf8"));
|
|
69
|
-
|
|
70
|
-
// Structured marker for service-event-bridge.ts to consume. Plain
|
|
71
|
-
// process.stdout.write keeps the line atomic and on the same stream
|
|
72
|
-
// as the tailed child log, so the parser sees one stream.
|
|
73
|
-
const emit = (event) => {
|
|
74
|
-
process.stdout.write("[[VIS_BOOT]]" + JSON.stringify({ ...event, id: cfg.id }) + "\n");
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Spawn the child with its stdio bound to a real file descriptor on
|
|
78
|
-
// disk — NOT inherited from the bootstrap. If the child inherited
|
|
79
|
-
// our stdio, it would inherit vis run's task pipes, and vis run would
|
|
80
|
-
// block waiting for those pipes to close even after this bootstrap
|
|
81
|
-
// exits. The logfile gives the grandchild a stable target it can keep
|
|
82
|
-
// writing to long after this bootstrap is gone.
|
|
83
|
-
const childLogFd = openSync(cfg.logFile, "a");
|
|
84
|
-
|
|
85
|
-
const child = spawn(cfg.command, {
|
|
86
|
-
cwd: cfg.cwd,
|
|
87
|
-
detached: true,
|
|
88
|
-
env: { ...process.env, ...cfg.env },
|
|
89
|
-
shell: true,
|
|
90
|
-
stdio: ["ignore", childLogFd, childLogFd],
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Close the bootstrap's copy of the fd; the child kept its own.
|
|
94
|
-
closeSync(childLogFd);
|
|
95
|
-
|
|
96
|
-
if (child.pid !== undefined) {
|
|
97
|
-
try {
|
|
98
|
-
writeFileSync(cfg.pidFile, String(child.pid));
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error("[vis] failed to write pid file: " + (error?.message ?? String(error)));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
emit({ event: "started", pid: child.pid ?? null });
|
|
105
|
-
|
|
106
|
-
let exitedEarly = false;
|
|
107
|
-
|
|
108
|
-
child.once("exit", (code, signal) => {
|
|
109
|
-
exitedEarly = true;
|
|
110
|
-
emit({ code, event: "failed", reason: "exited-before-ready", signal });
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Forward new bytes from the logfile to our stdout while we're alive.
|
|
114
|
-
// Polling-based tail; preflight is short, ~200ms per cycle is fine.
|
|
115
|
-
let tailPos = 0;
|
|
116
|
-
const tailFd = openSync(cfg.logFile, "r");
|
|
117
|
-
|
|
118
|
-
const flushTail = () => {
|
|
119
|
-
try {
|
|
120
|
-
const stat = statSync(cfg.logFile);
|
|
121
|
-
if (stat.size <= tailPos) return;
|
|
122
|
-
const remaining = stat.size - tailPos;
|
|
123
|
-
const buf = Buffer.alloc(remaining);
|
|
124
|
-
const n = readSync(tailFd, buf, 0, remaining, tailPos);
|
|
125
|
-
if (n > 0) {
|
|
126
|
-
process.stdout.write(buf.subarray(0, n));
|
|
127
|
-
tailPos += n;
|
|
128
|
-
}
|
|
129
|
-
} catch {}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const probeOnce = () => new Promise((resolve) => {
|
|
133
|
-
const socket = createConnection({ host: cfg.host || "127.0.0.1", port: cfg.port });
|
|
134
|
-
let settled = false;
|
|
135
|
-
const finish = (ok) => {
|
|
136
|
-
if (settled) return;
|
|
137
|
-
settled = true;
|
|
138
|
-
try { socket.destroy(); } catch {}
|
|
139
|
-
resolve(ok);
|
|
140
|
-
};
|
|
141
|
-
socket.once("connect", () => finish(true));
|
|
142
|
-
socket.once("error", () => finish(false));
|
|
143
|
-
socket.setTimeout(1000, () => finish(false));
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
147
|
-
|
|
148
|
-
(async () => {
|
|
149
|
-
const deadline = Date.now() + (cfg.timeoutMs ?? 30000);
|
|
150
|
-
while (Date.now() < deadline) {
|
|
151
|
-
flushTail();
|
|
152
|
-
if (exitedEarly) {
|
|
153
|
-
try { closeSync(tailFd); } catch {}
|
|
154
|
-
process.exit(1);
|
|
155
|
-
}
|
|
156
|
-
if (await probeOnce()) {
|
|
157
|
-
flushTail();
|
|
158
|
-
emit({ event: "ready", host: cfg.host || "127.0.0.1", port: cfg.port });
|
|
159
|
-
try { closeSync(tailFd); } catch {}
|
|
160
|
-
child.unref();
|
|
161
|
-
process.exit(0);
|
|
162
|
-
}
|
|
163
|
-
await sleep(200);
|
|
164
|
-
}
|
|
165
|
-
flushTail();
|
|
166
|
-
emit({ event: "failed", reason: "timeout", timeoutMs: cfg.timeoutMs ?? 30000 });
|
|
167
|
-
try { closeSync(tailFd); } catch {}
|
|
168
|
-
try { process.kill(-child.pid, "SIGTERM"); } catch {}
|
|
169
|
-
process.exit(1);
|
|
170
|
-
})();
|
|
171
|
-
`,$d=Se(()=>{const r=Vo(Ee(Si(),"vis-services-")),e=Ee(r,"bootstrap.mjs");return Vs(e,bd),{runDir:r,scriptPath:e}},"prepareBootstrap"),Jn=Se((r,e,t)=>{const s=t.replaceAll(/[^\w-]/g,"_");return{configFile:Ee(r,`${s}.json`),logFile:Ee(r,`${s}.log`),pidFile:Ee(r,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),kd=Se(r=>{const{paths:e,service:t}=r,s=t.config.readiness?.tcp?.port??t.config.port;if(typeof s!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const o={...t.env,PATH:Oo(t.cwd,t.env)};return{command:t.command,cwd:t.cwd,env:o,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),Sd=Se(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),Td=Se(r=>{const{id:e,visBin:t,workspaceRoot:s}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),xd=Se(r=>{const{missingServiceIds:e,mode:t,taskGraph:s,visBin:o,workspaceRoot:i}=r,{services:n,skipped:a}=Kn(i,e,s);if(n.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:a};const l=yd(n.map(S=>S.id),s),f=new Map(n.map(S=>[S.id,S])),u=[],p=[];if(t==="ephemeral")for(const S of l){const k=f.get(S);k&&p.push({id:S,payload:kd({paths:{logFile:"",pidFile:""},service:k})})}let c;t==="ephemeral"&&(c=$d());let g;for(const S of l){const k=f.get(S),E=s.tasks[S];if(!k||!E)continue;let x;if(t==="ephemeral"){const M=Jn(c.runDir,c.scriptPath,S),v={...p.find(C=>C.id===S).payload,logFile:M.logFile,pidFile:M.pidFile};Vs(M.configFile,JSON.stringify(v)),x=Sd(M),u.push(M.pidFile)}else x=Td({id:S,visBin:o,workspaceRoot:i});if(E.overrides={...E.overrides,command:x},E.cache=!1,s.tasks[S]=E,g!==void 0){const M=s.dependencies[S]??[];M.includes(g)||(s.dependencies[S]=[...M,g])}g=S}const y=new Set(l),R=new Map,L=Se(S=>{const k=new Set,E=[...s.dependencies[S]??[]],x=new Set;for(;E.length>0;){const M=E.pop();if(!x.has(M)){x.add(M),y.has(M)&&k.add(M);for(const v of s.dependencies[M]??[])x.has(v)||E.push(v)}}return[...k].sort()},"collectTransitive");for(const S of Object.keys(s.dependencies)){if(y.has(S))continue;const k=L(S);if(k.length===0)continue;const E={};for(const x of k){const M=f.get(x);M?.config.env&&Object.assign(E,M.config.env)}Object.keys(E).length>0&&R.set(S,E)}return{chain:l,ephemeralPidFiles:u,runDir:c?.runDir,serviceEnvByTaskId:R,skipped:a}},"injectServiceTasks"),Cd=new Set(["auto","ephemeral","off","persistent"]),Id=Se(r=>{const{cli:e,config:t,isCi:s,isPersistentTarget:o,isTty:i,target:n}=r;if(e!==void 0&&!Cd.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const a=e??t??(i&&!s?"auto":"off");return a==="off"?"off":a==="ephemeral"?"ephemeral":a==="persistent"?"registry":o||n==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var Md=Object.defineProperty,F=w((r,e)=>Md(r,"name",{value:e,configurable:!0}),"a");const zr="VIS_AFFECTED_FILES",Rd=2e3,Bs=F(async(r,e,t,s,o,i)=>{const n=r.map(x=>{const M=x.overrides.command;if(!M)return;const v=x.overrides.visOptions,C=_t(e,x.projectRoot,!!v?.runFromWorkspaceRoot),D=v?.envFile?pr(C,v.envFile):{},j=t&&(v?.affectedFiles==="env"||v?.affectedFiles==="both")?{[zr]:t.join(`
|
|
172
|
-
`)}:{},K=i?.get(x.id)??{},ne=!!o&&v?.pty!==!1;return{command:M,cwd:C,env:{INIT_CWD:s,...D,...K,...j},name:x.id,...ne?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(x=>x!==void 0);if(n.length===0)return;if(!o){await At(n,{killOthers:["failure"],onEvent:F(()=>{},"onEvent")});return}const{abortSignal:a,lifeCycle:l,stdinRegistry:f,store:u}=o,p=n.map(x=>r.find(M=>M.id===x.name)).filter(Boolean),c=F(x=>n[x]?.stdin==="pty","isPtyIndex"),g=new Map,y=F(x=>{if(!c(x))return;let M=g.get(x);return M||(M=new mr(Nt),g.set(x,M)),M},"getTermBuffer");u.unmarkDone(),l.startTasks?.(p);const R=new Map,L=new Map;let S;const k=F(()=>{for(const x of L.values())try{x("SIGTERM")}catch{}S||(S=setTimeout(()=>{for(const x of L.values())try{x("SIGKILL")}catch{}L.clear()},2e3),S.unref?.())},"killAll");let E;a&&(E=F(()=>{k()},"abortListener"),a.then(()=>{E?.()}).catch(()=>{E?.()}));try{await At(n,{killOthers:["failure"],onEvent:F(x=>{const M=p[x.index];if(M)switch(x.kind){case"close":{const v=R.get(M.id)??Date.now(),C=x.killed||x.exitCode===0?"success":"failure";l.endTasks?.([{code:x.exitCode??0,endTime:Date.now(),startTime:v,status:C,task:M,terminalOutput:u.getSnapshot().outputs.get(M.id)??""}]),L.delete(x.index),f?.delete(M.id);break}case"error":{if(x.message){const v=y(x.index);v?(v.write(`${x.message}
|
|
173
|
-
`),u.setOutput(M.id,v.toString())):u.addOutput(M.id,`${x.message}
|
|
174
|
-
`)}break}case"started":{R.set(M.id,Date.now()),x.kill&&L.set(x.index,x.kill),x.write&&f&&f.set(M.id,{kill:x.kill,resize:x.resize,write:x.write});break}case"stderr":case"stdout":{if(x.text){const v=y(x.index);v?(v.write(x.text),u.setOutput(M.id,v.toString())):u.addOutput(M.id,`${x.text}
|
|
175
|
-
`)}break}}},"onEvent")})}finally{S&&(clearTimeout(S),S=void 0),u.markDone()}},"runPersistentTasks"),Ns=F(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),Ed=F(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),Od=F(r=>{const{extraPids:e=[],pidFiles:t,runDir:s}=r,o=[],i=F(n=>{try{process.kill(-n,"SIGTERM")}catch{try{process.kill(n,"SIGTERM")}catch{}}},"sendSigterm");for(const n of t){let a;try{const l=ho(n),f=Number.parseInt(l.trim(),10);a=Number.isFinite(f)&&f>0?f:void 0}catch{continue}a!==void 0&&(o.push(a),i(a))}for(const n of e)!Number.isFinite(n)||n<=0||(o.push(n),i(n));if(o.length>0){const n=Date.now()+1500;for(;Date.now()<n;){let a=!0;for(const l of o)if(Ns(l)){a=!1;break}if(a)break;Ed(100)}for(const a of o)if(Ns(a))try{process.kill(-a,"SIGKILL")}catch{try{process.kill(a,"SIGKILL")}catch{}}}s&&mo(s)},"cleanupEphemeralServices"),Nt=256*1024;class Pd{static{w(this,"An")}static{F(this,"OutputRingBuffer")}#e;#s="";#r=!1;constructor(e){this.#e=e}append(e){this.#s+=e,this.#s.length>this.#e&&(this.#s=this.#s.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
|
|
176
|
-
${this.#s}`:this.#s}}const Yn=F(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),Qn=F(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Xn=F(r=>process.platform==="win32"?r.length>0&&!/[\s"&|<>^()%!]/.test(r)?r:`"${r.replaceAll('"','""')}"`:Qn(r),"shellQuote"),Fd=F((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const s=e.map(o=>Xn(o)).join(" ");return`${r} ${s}`}return r},"buildAffectedFilesArgs"),Zn="visForwardedArgs",jd=F((r,e)=>{const t=e.overrides[Zn];if(!Array.isArray(t)||t.length===0)return r;const s=t.map(o=>Xn(o)).join(" ");return`${r} ${s}`},"appendForwardedArgs"),Ad=F(async(r,e,t)=>{if(!e)return t();const s=r.get(e)??Promise.resolve();let o;const i=new Promise(a=>{o=a}),n=s.then(()=>i);r.set(e,n),await s;try{return await t()}finally{o(),r.get(e)===n&&r.delete(e)}},"withMutex"),Ld=F(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const s=Math.max(0,Math.min(t,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Dd=F((r,e,t)=>{const s=`${e}\0${typeof t=="string"?t:String(t)}`,o=r.get(s);if(o)return o;const i=pr(e,t);return r.set(s,i),i},"loadEnvFileCached"),_s=F(r=>{const e=new Map;return async(t,s)=>{const{affectedFiles:o,currentOs:i,hooks:n,initCwd:a,lifeCycle:l,mutexPool:f,onOutput:u,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:g,serviceEventBridge:y,stdinRegistry:R,strictEnv:L,workspaceRoot:S}=r,k=Yn(t),E=_t(S,s.cwd??t.projectRoot,k?.runFromWorkspaceRoot===!0),x=t.overrides.command;if(!x)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const M=jd(x,t),v=Fd(M,o,k?.affectedFiles),C=go(k,i),D=C?`${C} -c ${Qn(v)}`:v,j=k?.envFile?Dd(e,E,k.envFile):void 0,K={};o&&o.length>0&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")&&(K[zr]=o.join(`
|
|
177
|
-
`));const ne=g?.get(t.id),G={INIT_CWD:a,...j,...ne,...s.env,...K};if(k?.strictEnv??L??!1){const W=ba({command:v,processEnv:process.env,taskEnv:G,taskId:t.id});if(W){const z=$a(W);return l?.onTaskStderr?.(t,z),{code:1,terminalOutput:z}}}const _=k?.pty===!0,se=!!R,le=se||_;le&&(t.cache=!1);const q=le?void 0:new Pd(Nt),ue=le?new mr(Nt):void 0;let pe;const qe=F(W=>{if(W.kind==="started"&&(pe=W.kill,W.write&&R&&R.set(t.id,{kill:W.kill,resize:W.resize,write:W.write}),y?.onRegistryTaskStarted(t.id)),(W.kind==="stdout"||W.kind==="stderr")&&W.text!==void 0)if(W.kind==="stdout"?l?.onTaskStdout?.(t,W.text):l?.onTaskStderr?.(t,W.text),ue)ue.write(W.text),se&&p?.(t.id,ue.toString()),y&&y.onTaskOutput(t.id,W.text);else{const z=`${W.text}
|
|
178
|
-
`;q.append(z),u?.(t.id,z)}W.kind==="close"&&(R&&R.delete(t.id),y&&y.onRegistryTaskClosed(t.id,W.exitCode??0,!!W.killed).catch(()=>{}))},"onEvent"),ce=F(async()=>{const W=k?.retryCount??0,z=k?.retryDelay,Pe=c?c.claim(W):W,Te=typeof k?.timeout=="number"&&k.timeout>0?k.timeout:0,be=typeof k?.killGracePeriodMs=="number"&&k.killGracePeriodMs>=0?k.killGracePeriodMs:5e3;let Fe=!1,Le=0;const Ue=Hl({killGracePeriodMs:be,onTimeout:F(()=>{Fe=!0},"onTimeout"),sendSignal:F(ze=>{pe?.(ze)},"sendSignal"),timeoutMs:Te});let We;try{We=await At([{command:D,cwd:E,env:G,name:t.id,...le?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:qe,...Pe>0?{restart:{delay:z??"exponential",onRetry:F(async(ze,Ce,De)=>{Le=ze,n&&await n.callHook("task:retry",t,ze,De)},"onRetry"),tries:Pe}}:{}})}finally{Ue.cancel()}const xe=We.closeEvents[0],fe=ue?ue.toString():q.toString();return Fe?{code:124,retryAttempts:Le,terminalOutput:`${fe}
|
|
179
|
-
[timeout] Task "${t.id}" exceeded ${Te}ms budget.
|
|
180
|
-
`}:{code:xe?.exitCode??1,retryAttempts:Le,terminalOutput:fe}},"runOnce");return f?Ad(f,k?.mutex,ce):ce()}},"createConcurrentExecutor"),Bd=F(r=>{if(!r||r.trim().length===0)return;const e=Number.parseFloat(r);return!Number.isFinite(e)||e<=0?{invalid:r}:{value:Math.floor(e)}},"parseEnvConcurrency"),Nd=F(async(r,e)=>{const t=await Po(r,{dataDirectory:jt(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Fo(r,{dataDirectory:jt(r)})}.`);return}const s=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const i=t.tasks.filter(n=>n.exitCode!==void 0&&n.exitCode!==0);e.info("Failed tasks:");for(const n of i){const a=n.duration??0;e.info(` × ${n.taskId} (exit ${String(n.exitCode??-1)}, ${a}ms)`)}e.info("")}const o=[...t.tasks].filter(i=>typeof i.duration=="number").sort((i,n)=>(n.duration??0)-(i.duration??0)).slice(0,5);if(o.length>0){e.info("Slowest tasks:");for(const i of o)e.info(` ${i.taskId.padEnd(40)} ${String(i.duration??0).padStart(6)}ms [${i.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),_d=F(r=>{if(!(r===void 0||r==="")){if(r!=="read"&&r!=="write"&&r!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${r}")`);return r}},"parseCacheMode"),Gd=F(r=>{if(!(r===void 0||r==="")){if(r!=="http"&&r!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${r}")`);return r}},"parseCacheBackend"),mu=F(async({argument:r,logger:e,options:t,runtime:s,visConfig:o,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=i;if(vo(n),t.lastDetails===!0){await Nd(n,e);return}const a=process.cwd(),l=await wo(n),{config:f,packageJsons:u,projectOptions:p,workspace:c}=yo(n,o,l),g=bo(n,c,u);let y=r[0];if(!y){const $=vs(c);if(process.stdout.isTTY&&process.stdin.isTTY){const I=await Ma($);if(!I){e.info("No target selected.");return}y=I,await Gl(`vis run ${I}`)}else{e.info("Available targets:"),e.info(""),e.info(Ia($)),e.info(""),e.info("Usage: vis run <target>");return}}if(f.constraints&&!t.skipConstraints){const $=jo(g,f.constraints);if($.length>0){for(const I of $)e.error(`[${I.rule}] ${I.message}`);throw new Error(`${$.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const $=[y];t.parallel!==void 0&&$.push(`--parallel=${String(t.parallel)}`),t.cache||$.push("--no-cache"),t.query&&$.push(`--query=${String(t.query)}`),t.reverse&&$.push("--reverse"),typeof t.runnerTags=="string"&&t.runnerTags!==""&&$.push(`--runner-tags=${t.runnerTags}`),await s.runCommand("affected",{argv:$});return}const R=await ai(y,c,process.cwd(),n),L=Sa(p),S=Ta(R.target,L);S!==R.target&&e.debug?.(`Resolved alias "${R.target}" → "${S}"`);let k=R.projects;const E=r.slice(1).map(String);if(t.projects){const $=new Set(t.projects.split(",").map(I=>I.trim()));if(k=k.filter(I=>$.has(I)),k.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(k=ci(k,c,t.query),k.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const x=$o(),M=process.env[zr],v=M?M.split(`
|
|
181
|
-
`).filter(Boolean):void 0,C=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,D=C?new Set(C.split(",").map($=>$.trim()).filter(Boolean)):void 0,j=[],K=new Map;for(const $ of k){const I=p.get($)?.[S];if(!I)continue;const O=I.options;if(!O?.internal){if(!ko(O,!!It)){e.debug?.(`Skipping ${$}:${S} — runInCI filter`);continue}if(!So(O,D)){e.debug?.(`Skipping ${$}:${S} — runner-tags filter`);continue}j.push($),K.set($,I)}}if(j.length===0){const $=vs(c),I=Object.entries(c.projects).filter(([,O])=>O.targets?.[S]!==void 0).map(([O])=>O);if(e.error(`No projects have the "${S}" target.`),I.length>0){e.info(""),e.info(`Target "${S}" exists in these projects but was filtered out:`);for(const O of I.slice(0,5))e.info(` - ${O}`);I.length>5&&e.info(` …and ${I.length-5} more`)}else{const O=Xs(S,$,3);O.length>0&&(e.info(""),e.info(O.length===1?`Did you mean "${O[0]}"?`:`Did you mean one of: ${O.map(J=>`"${J}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ne=t.pty===!0;let G=j.map($=>{const I=c.projects[$],O=K.get($),J={project:$,target:S},Q=`${$}:${S}`,X=ne?{...O.options,pty:O.options?.pty??!0}:O.options,U=O.command?cs(O.command,{affectedFiles:v,projectRoot:I?.root}):O.command;return{cache:O.cache,id:Q,outputs:O.outputs??[],overrides:{command:U,...E.length>0?{[Zn]:E}:{},...X?{visOptions:X}:{}},parallelism:O.parallelism,projectRoot:I?.root,target:J}});const _=[],se=[];for(const $ of G)Yn($)?.persistent?($.cache=!1,_.push($)):se.push($);G=se;const le=Ao(t.partition);if(le&&(G=Lo.partitionTasks(G,le),e.info(`Partition ${le.index}/${le.total}: running ${G.length} task(s)`),G.length===0)){e.info("No tasks assigned to this partition.");return}let q=Do([...G,..._],{projectGraph:g,targetDefaults:f.tasks,workspace:c});for(const[$,I]of Object.entries(q.tasks)){const O=I.target.project,J=I.target.target,Q=p.get(O)?.[J];if(!Q)continue;const X=c.projects[O];let U=!1;const N={...I.overrides};N.visOptions===void 0&&Q.options&&(N.visOptions=Q.options,U=!0),N.command===void 0&&Q.command&&(N.command=cs(Q.command,{affectedFiles:v,projectRoot:X?.root}),U=!0),U&&(I.overrides=N,q.tasks[$]=I)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const $=ma(t.skipCache,c,Object.keys(q.tasks));for(const I of $.skipTaskIds){const O=q.tasks[I];O!==void 0&&(O.cache=!1)}$.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${$.unmatchedPatterns.map(I=>`"${I}"`).join(", ")}`),$.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String($.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await Jo(n,f.toolchain,{error:F($=>{e.error($)},"error"),info:F($=>{e.info($)},"info"),warn:F($=>{e.warn($)},"warn")},!!t.skipToolchain);const ue=t.preflight!==!1&&f.preflight?.lockfile!==!1,pe=fa(n,It,{warn:F($=>{e.warn($)},"warn")},{skip:!ue});if(!pe.shouldContinue)throw new Error(`${pe.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);const qe=process.env.VIS_VERSION??"0.0.0",ce=t.dryRun?void 0:async $=>{try{return await oi($.config,{timeoutMs:Rd}),!0}catch{return!1}},W=await ei(n),z=await dd({initialTasks:[...G,..._],probe:ce,registeredEntries:W,taskGraph:q,visVersion:qe}),Pe=[];let Te,be=0;const Fe=[],Le=new Map;let Ue=[];const We=new Set;let xe=null,fe=null;if(z.diagnostics.length>0){const $=!!(process.stdout.isTTY&&process.stdin.isTTY),I=t.dryRun?"off":Id({cli:t.services,config:f.run?.services,isCi:!!It,isPersistentTarget:_.length>0,isTty:$,target:S});if(I==="off"){for(const N of z.diagnostics)e.error(N.message);throw new Error(`${z.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const O=z.diagnostics.map(N=>N.targetId),J=I,Q=J==="registry"?Kn(n,O,q):void 0,X=process.argv[1]??"vis",U=xd({missingServiceIds:O,mode:J,taskGraph:q,visBin:X,workspaceRoot:n});if(U.skipped.length>0){for(const{id:N,reason:ie}of U.skipped)e.error(`Cannot auto-start ${N}: ${ie}`);throw new Error(`${U.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Pe.push(...U.ephemeralPidFiles),Te=U.runDir,Ue=U.chain;for(const N of U.chain)We.add(N);if(J==="registry"&&(be=U.chain.length,Fe.push(...U.chain)),U.chain.length>0){const N=new ws(U.chain),ie=new Map;if(J==="ephemeral"&&U.runDir)for(const B of U.chain){const Y=Jn(U.runDir,`${U.runDir}/bootstrap.mjs`,B);ie.set(B,{ephemeral:{configFile:Y.configFile,cwd:n,logFile:Y.logFile,pidFile:Y.pidFile,scriptPath:Y.scriptPath},mode:"ephemeral"})}else if(J==="registry"&&Q)for(const B of Q.services)ie.set(B.id,{mode:"registry",registry:{command:B.command,config:B.config,cwd:B.cwd,env:B.env}});if(ie.size>0){const B=new md({indexToId:new Map,services:ie,sink:{crashed:F((Y,H)=>{N.markCrashed(Y,H)},"crashed"),failed:F((Y,H,te)=>{N.markFailed(Y,H,te)},"failed"),log:F((Y,H)=>{N.appendLog(Y,H)},"log"),ready:F((Y,H)=>{N.markReady(Y,H)},"ready"),started:F((Y,H)=>{N.markStarted(Y,H),J==="registry"&&H!==null&&Le.set(Y,H)},"started"),starting:F(Y=>{N.markStarting(Y)},"starting")},workspaceRoot:n});xe=N,fe=B}}for(const[N,ie]of U.serviceEnvByTaskId){const B=z.serviceEnvByTaskId.get(N)??{};z.serviceEnvByTaskId.set(N,{...B,...ie})}}const ze=new Set(_.map($=>$.id));if(G=z.initialTasks.filter($=>!ze.has($.id)),q=z.taskGraph,Ue.length>0&&(G=[...Ue.map($=>q.tasks[$]).filter($=>$!==void 0),...G]),_.length>0){const $=new Set(_.map(X=>X.id)),I={};for(const[X,U]of Object.entries(q.tasks))$.has(X)||(I[X]=U);const O={};for(const[X,U]of Object.entries(q.dependencies))$.has(X)||(O[X]=U.filter(N=>!$.has(N)));const J=new Set;for(const X of Object.values(O))for(const U of X)J.add(U);const Q=Object.keys(I).filter(X=>!J.has(X));q={dependencies:O,roots:Q,tasks:I}}const{serviceEnvByTaskId:Ce}=z;if(z.satisfiedServices.length>0){const $=z.satisfiedServices.map(I=>I.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${$}`),xe)for(const I of z.satisfiedServices)xe.registerService(I.id);else xe=new ws(z.satisfiedServices.map(I=>I.id));for(const I of z.satisfiedServices){const O=I.config.readiness?.tcp?.port??I.config.port??0,J=I.config.readiness?.tcp?.host??"127.0.0.1";xe.markReady(I.id,{host:J,port:O})}}if(t.reverse&&(q=Bo(q),e.debug?.(`Reversed task graph: ${String(q.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const $=Object.keys(q.tasks).length,I=q.roots.length;e.info(`Execution plan (${String($)} task(s), ${String(I)} root(s)):`),e.info("");const O=new Set,J=F((Q,X)=>{if(O.has(Q))return;O.add(Q);for(const ie of q.dependencies[Q]??[])J(ie,X+1);const U=q.tasks[Q],N=" ".repeat(X+1);e.info(`${N}${Q}${U?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const Q of q.roots)J(Q,0);for(const Q of Object.keys(q.tasks))J(Q,0);_.length>0&&(e.info(""),e.info(` + ${String(_.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const De=Date.now(),me=ti(),Je=F(($,I)=>{const O=I instanceof Error?I.message:String(I);e.warn(`Plugin error in ${$}: ${O}`)},"onHookError");await ri(me,f.plugins);const je=typeof t.profile=="string"?t.profile:void 0,P=F(async $=>{if(!je)return;const I=ls($,q,De),O=je.startsWith("/")?je:`${n}/${je}`;await No(I,O),e.info(`Profile written to ${je}`)},"maybeWriteProfile"),T=f.taskRunner??{},A=To(n,t.cacheDir,T.cacheDirectory,f.sharedWorktreeCache),oe=xo(A,n,f.branchScopedCache),Ie=Bd(process.env.VIS_RUN_CONCURRENCY_LIMIT);Ie&&"invalid"in Ie&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${Ie.invalid} is not a positive number; falling back to default concurrency.`);const eo=Ie&&"value"in Ie?Ie.value:void 0,to=t.parallel??eo??3,Hr=t.strictEnv??f.strictEnv??!1,Ye={dryRun:t.dryRun??!1,parallel:to,skipNxCache:!t.cache,summarize:t.summarize??!1,...T,cacheDirectory:oe,dataDirectory:T.dataDirectory??jt(n),onFingerprint:F(async($,I)=>{await me.callHook("task:fingerprint",$,I)},"onFingerprint")},Vr=_o(T.remoteCache);if(Vr){const $=_d(t.cacheMode),I=Gd(t.cacheBackend);if(Ye.remoteCache={...Vr,...$?{mode:$}:{},...I?{backend:I}:{}},Ye.remoteCache.attestation){const{expectedIdentity:O,requireOnDownload:J}=Ye.remoteCache.attestation;if(!(O!==void 0&&("github"in O&&typeof O.github?.ref=="string"&&typeof O.github.repo=="string"&&typeof O.github.workflow=="string"||"oidcIssuer"in O&&typeof O.oidcIssuer=="string"&&(typeof O.san=="string"||typeof O.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in O&&(!O.sanRegex.startsWith("^")||!O.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:Q,isSigstoreInstalled:X}=await import("./loader.js");X()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
|
|
182
|
-
${Q(n)}`);const{buildCacheAttestationHooks:U}=await import("./cache-attestation.js");Ye.remoteCache.attestation=U({expectedIdentity:O,onReject:F((N,ie)=>{e.warn(`[vis run] remote cache entry ${N.slice(0,12)} rejected: attestation ${ie}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:F(N=>{e.warn(`[vis run] attestation verification failed: ${N}`)},"onVerifyFailure"),requireOnDownload:J,workspaceRoot:n})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ro=process.stdout.isTTY&&!It,so=f.tui?.autoExit??!1,Kr={args:{parallel:Ye.parallel,targets:[S]},autoExit:so,projectNames:j,tasks:[...G,..._]},Jr=typeof t.retryBudget=="number"?t.retryBudget:void 0,Yr=Jr===void 0?void 0:Ld(Jr),Qr=new si(me,Je),Xr=new Ko(n),Zr=Dl(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(z.satisfiedServices.length>0)for(const $ of z.satisfiedServices){const I=z.serviceDependentsByServiceId.get($.id)??[];try{await me.callHook("service:attach",$,I)}catch(O){Je("service:attach",O)}}await me.callHook("run:before",{tasks:G,workspaceRoot:n});const lt=t.stopServices===!0;let es=!1;const ts=F(()=>{if(es)return;es=!0,fe&&fe.dispose().catch(()=>{});const $=lt?[...Le.values()]:void 0;Od({extraPids:$,pidFiles:Pe,runDir:Te})},"runCleanupOnce"),xt=F(()=>{ts()},"onCleanupSignal"),rs=Pe.length>0||Te!==void 0||lt&&Fe.length>0;rs&&(process.on("SIGINT",xt),process.on("SIGTERM",xt));try{if(ro){const $=new Map,I=Al({...Kr,onRetryService:fe?B=>fe.retry(B):void 0,outputStyle:Zr,serviceDockStore:xe,stdinRegistry:$}),{lifeCycle:O,store:J}=I,Q=new ds([O,Qr,Xr]),X=_s({affectedFiles:v,currentOs:x,hooks:me,initCwd:a,lifeCycle:Q,mutexPool:new Map,onOutput:F((B,Y)=>{fe&&We.has(B)?fe.onTaskOutput(B,Y):J.addOutput(B,Y)},"onOutput"),onOutputReplace:F((B,Y)=>{J.setOutput(B,Y)},"onOutputReplace"),retryBudget:Yr,serviceEnvByTaskId:Ce,serviceEventBridge:fe??void 0,stdinRegistry:$,strictEnv:Hr,workspaceRoot:n});let U="rerun",N=null,ie=new Map;for(;U!=="quit";){if(U==="rerun"){if(ie=await us(G,Ye,{lifeCycle:Q,projectGraph:g,taskExecutor:X,taskGraph:q,workspaceRoot:n}),_.length>0&&!t.failFast){const B=new Promise(Y=>{const H=J.subscribe(()=>{const te=J.getSnapshot();(te.rerunRequested||te.retryTaskId)&&(H(),Y())});I.renderIsDone.then(()=>{H(),Y()}).catch(()=>{H(),Y()})});await Bs(_,n,v,a,{abortSignal:B,lifeCycle:Q,stdinRegistry:$,store:J},Ce)}}else if(U==="retry"&&N){const B=G.find(H=>H.id===N),Y=B?.overrides.command;if(B&&Y){const H=_t(n,B.projectRoot,!1);Q.startTasks?.([B]);const te=new mr(Nt),ge=(await At([{command:Y,cwd:H,name:B.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:F(ae=>{ae.kind==="started"&&ae.write&&$.set(B.id,{kill:ae.kill,resize:ae.resize,write:ae.write}),(ae.kind==="stdout"||ae.kind==="stderr")&&ae.text&&(te.write(ae.text),J.setOutput(B.id,te.toString())),ae.kind==="close"&&$.delete(B.id)},"onEvent")})).closeEvents[0];Q.endTasks?.([{code:ge?.exitCode??1,status:ge?.exitCode===0?"success":"failure",task:B,terminalOutput:J.getSnapshot().outputs.get(B.id)}])}else B&&Q.endTasks?.([{code:1,status:"failure",task:B,terminalOutput:`No command configured for ${B.id}`}]);N=null,J.markDone()}U=await new Promise(B=>{const Y=J.subscribe(()=>{const H=J.getSnapshot();H.rerunRequested&&(J.acknowledgeRerun(),Y(),B("rerun")),H.retryTaskId&&(N=J.acknowledgeRetry(),Y(),B("retry"))});I.renderIsDone.then(()=>{Y(),B("quit")}).catch(()=>{Y(),B("quit")})})}await I.renderIsDone,await me.callHook("run:after",ie),await P(ie),be>0&&(e.info(""),lt?e.info(`${String(be)} service(s) stopped (--stop-services).`):e.info(`${String(be)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const $=new Map,I=typeof t.log=="string"?t.log.toLowerCase():"",O=I==="labeled"||I==="grouped"||I==="interleaved"?I:void 0,J=O?Go(O):void 0,Q=new ds([new Nl({...Kr,ciGrouping:o?.run?.ciGrouping??"auto",logReporter:J,outputStyle:Zr}),Qr,Xr]),X=_s({affectedFiles:v,currentOs:x,hooks:me,initCwd:a,lifeCycle:Q,mutexPool:$,retryBudget:Yr,serviceEnvByTaskId:Ce,serviceEventBridge:fe??void 0,strictEnv:Hr,workspaceRoot:n}),U=F(async()=>{const H=Date.now(),te=await us(G,Ye,{lifeCycle:Q,projectGraph:g,taskExecutor:X,taskGraph:q,workspaceRoot:n}),ge=Date.now()-H;if(t.summarize){const ke=ls(te,q,De);await qo(ke,n,{dataDirectory:jt(n)})}let ae=!1;for(const[,ke]of te)ke.status==="failure"&&(ae=!0);const $e=Co(te,ge),Me=Io(n),He=Mo(n,ge,Me);return e.info(""),e.info(` ${$e}${He?` ${He}`:""}`),{hasFailure:ae,results:te,runHistory:Me}},"runOnce"),N=await U();await me.callHook("run:after",N.results),await P(N.results);const{hasFailure:ie}=N;if(t.watch){const H=j.map(he=>{const ve=c.projects[he]?.root;if(ve)return ve.startsWith("/")?ve:`${n}/${ve}`}).filter(he=>he!==void 0),te=G;let ge;const ae=F(he=>{const ve=rd(te,he);return ge=ve.filter,G=ve.tasks,ve.tasks.length},"applyFilter");let $e=!1,Me=N.results;const He=F(()=>{const he=js(Me,n);if(he.directories.length>0&&he.files.size>0){const ve=Xl(he.files,n,he.directories);return{handle:As({filter:ve,onChange:Ct,paths:he.directories}),mode:"tracked"}}return{handle:As({onChange:Ct,paths:H}),mode:"roots"}},"buildHandle");let ke;const Ct=F(async he=>{if(!$e){$e=!0;try{e.info(`Change detected in ${he.length} file(s), rerunning…`),Me=(await U()).results,ke?.close(),ke=He().handle}finally{$e=!1}}},"onChangeHandler"),ss=He();ke=ss.handle;const no=ss.mode==="tracked"?`Watching ${String(js(Me,n).files.size)} tracked file(s)`:`Watching ${String(H.length)} project root(s)`;e.info(`${no} — edit a file to rerun, press h for keybinds, q to quit.`);const Jt=F(async()=>{if(!$e){$e=!0;try{if(G.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Me=(await U()).results,ke?.close(),ke=He().handle}finally{$e=!1}}},"triggerRerun");await new Promise(he=>{let ve=!1,ns;const os=F(()=>{is()},"onSigint"),is=F(()=>{ve||(ve=!0,ns?.close(),process.off("SIGINT",os),ke?.close(),he())},"exit");process.on("SIGINT",os),ns=ad({handlers:{onClearFilter:F(async()=>{const dt=ae(void 0);e.info(`Filter cleared — running ${String(dt)} task(s).`),await Jt()},"onClearFilter"),onFilter:F(async dt=>{const oo=ge,as=ae(dt);if(as===0){e.info(`Filter "${dt}" matched no projects — keeping previous filter.`),ae(oo);return}e.info(`Filter "${dt}" matched ${String(as)} task(s).`),await Jt()},"onFilter"),onHelp:F(()=>{od(process.stdout)},"onHelp"),onQuit:F(()=>{is()},"onQuit"),onRerun:Jt}})});return}if(t.flaky!==!1){const H=Ro(n,{minRuns:2},N.runHistory);if(H.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const te of Eo(H))e.info(` ${te}`);e.info("")}}const B=[];for(const[H,te]of N.results)te.retryAttempts&&te.retryAttempts>0&&B.push(H);const Y=t.failOnRetry===!0&&B.length>0;if(Y){const H=B.slice(0,5),te=B.length-H.length,ge=te>0?`${H.join(", ")}, and ${String(te)} more`:H.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(B.length)} task(s) succeeded only after retry: ${ge}`)}if(ie||Y){const H=Y&&!ie?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",te=2e3,ge=[];for(const[ae,$e]of N.results){if($e.status!=="failure")continue;const Me=$e.terminalOutput??"",He=Me.length>te?`…${Me.slice(-te)}`:Me,ke=$e.code??"?";ge.push(` ${ae} (exit ${String(ke)}):
|
|
183
|
-
${He.split(`
|
|
184
|
-
`).map(Ct=>` ${Ct}`).join(`
|
|
185
|
-
`)}`)}throw new Error(ge.length>0?`${H}
|
|
186
|
-
${ge.join(`
|
|
187
|
-
`)}`:H)}_.length>0&&!t.failFast&&await Bs(_,n,v,a,void 0,Ce),be>0&&(e.info(""),lt?e.info(`${String(be)} service(s) stopped (--stop-services).`):e.info(`${String(be)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{ts(),rs&&(process.off("SIGINT",xt),process.off("SIGTERM",xt)),lt&&Fe.length>0&&await Promise.all(Fe.map(async $=>{try{await ni(n,$)}catch{}}))}},"execute");export{Ld as createRetryBudget,mu as default};
|
|
1
|
+
var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{render as Ye}from"@visulima/tui";import{au as Ke,s as Qe}from"./bin.js";import Ze,{useMemo as q,useSyncExternalStore as er,useState as C,useRef as Z,useEffect as ae,useCallback as rr}from"react";import{A as tr}from"../packem_shared/pm-runner-BwX5AL3W.js";import{b as nr}from"./config.js";import{o as ir,M as de,i as cr,$ as sr,K as ar}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{Box as c}from"@visulima/tui/components/box";import{Dialog as lr}from"@visulima/tui/components/dialog";import{Tab as dr}from"@visulima/tui/components/tab";import{Tabs as ur}from"@visulima/tui/components/tabs";import{Text as t}from"@visulima/tui/components/text";import{useApp as hr}from"@visulima/tui/hooks/use-app";import{useInput as H}from"@visulima/tui/hooks/use-input";import{useWindowSize as mr}from"@visulima/tui/hooks/use-window-size";import{TextInput as he}from"@visulima/tui/components/text-input";import{ScrollBar as je}from"@visulima/tui/components/scroll-bar";import{ScrollView as gr}from"@visulima/tui/components/scroll-view";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:or}=qe("node:fs");var fr=Object.defineProperty,pr=y((n,e)=>fr(n,"name",{value:e,configurable:!0}),"a$1"),vr=Object.defineProperty,yr=pr((n,e)=>vr(n,"name",{value:e,configurable:!0}),"r"),br=Object.defineProperty,wr=yr((n,e)=>br(n,"name",{value:e,configurable:!0}),"n");const xr=wr((n,{whitespace:e=!0}={})=>n.replace(ir,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:e?s.replaceAll(/\S/g," "):""),"stripJsonComments"),$=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var Cr=Object.defineProperty,Oe=y((n,e)=>Cr(n,"name",{value:e,configurable:!0}),"s$6");const kr=Oe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!cr(e))return null;const s=sr(e),l=xr(s),a=l!==s;let o;try{o=JSON.parse(l)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:a}},"readDevcontainerJson"),Sr=Oe((n,e,s)=>{const l=s?ar(s):de(n,".devcontainer"),a=s??de(l,"devcontainer.json");nr(l),or(a,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,"utf8")},"writeDevcontainerJson");var Er=Object.defineProperty,Ir=y((n,e)=>Er(n,"name",{value:e,configurable:!0}),"s$5");const Tr={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},Pr=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],xe=Ir((n,e,s)=>{const l=[],a=new Set(s.map(d=>typeof d=="string"?d:d.target));if(n)for(const d of Tr[n])a.has(d.target)||l.push(d);const o=Object.keys(e);for(const{featureMatch:d,mounts:g}of Pr)if(o.some(f=>f.includes(d)))for(const f of g)a.has(f.target)||l.push(f);return l},"getSuggestedMounts"),A=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Dr=Object.defineProperty,ee=y((n,e)=>Dr(n,"name",{value:e,configurable:!0}),"c$1");const J=ee(n=>structuredClone(n),"deepClone");class jr{static{y(this,"DevcontainerStore")}static{ee(this,"DevcontainerStore")}#o=new Set;#e;constructor(e,s,l=null){const a=e===null,o=e??{name:""},d=J(o);this.#e={config:d,detectedPm:l,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:s,isDirty:!1,mode:a?"create":"edit",originalConfig:a?null:J(o),section:"general",showTemplateSelector:a,suggestedMounts:xe(l,d.features??{},d.mounts??[]),templateIndex:0}}getSnapshot=ee(()=>this.#e,"getSnapshot");subscribe=ee(e=>(this.#o.add(e),()=>{this.#o.delete(e)}),"subscribe");setSection(e){e!==this.#e.section&&this.#r({...this.#e,fieldEditing:!1,fieldIndex:0,section:e})}nextSection(){const e=(A.indexOf(this.#e.section)+1)%A.length;this.setSection(A[e])}previousSection(){const e=(A.indexOf(this.#e.section)-1+A.length)%A.length;this.setSection(A[e])}setFieldIndex(e){e!==this.#e.fieldIndex&&this.#r({...this.#e,fieldIndex:Math.max(0,e)})}setFieldEditing(e){e!==this.#e.fieldEditing&&this.#r({...this.#e,fieldEditing:e})}setTemplateIndex(e){const s=Math.max(0,Math.min(e,$.length-1));s!==this.#e.templateIndex&&this.#r({...this.#e,templateIndex:s})}applyTemplate(e){const s=$.find(l=>l.id===e);s&&this.#r(this.#t({...this.#e,config:J(s.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#r({...this.#e,showTemplateSelector:!1})}updateConfig(e){this.#r({...this.#e,config:{...this.#e.config,...e},isDirty:!0})}toggleFeature(e){const s={...this.#e.config.features};s[e]===void 0?s[e]={}:delete s[e],this.#r(this.#t({...this.#e,config:{...this.#e.config,features:s},isDirty:!0}))}setFeatureSearch(e){this.#r({...this.#e,featureSearch:e,fieldIndex:0})}addPort(e){const s=this.#e.config.forwardPorts??[];if(s.includes(e))return;const l=[...s,e];this.#r({...this.#e,config:{...this.#e.config,forwardPorts:l},isDirty:!0})}removePort(e){const s=[...this.#e.config.forwardPorts??[]];s.splice(e,1),this.#r({...this.#e,config:{...this.#e.config,forwardPorts:s.length>0?s:void 0},isDirty:!0})}toggleExtension(e){const s={...this.#e.config.customizations},l={...s.vscode},a=[...l.extensions??[]],o=a.indexOf(e);o===-1?a.push(e):a.splice(o,1),l.extensions=a.length>0?a:void 0,s.vscode=l.extensions||l.settings?l:void 0,this.#r({...this.#e,config:{...this.#e.config,customizations:s.vscode||s.jetbrains?s:void 0},isDirty:!0})}setExtensionSearch(e){this.#r({...this.#e,extensionSearch:e,fieldIndex:0})}addEnvVar(e,s,l){const a=e==="container"?"containerEnv":"remoteEnv",o={...this.#e.config[a],[s]:l};this.#r({...this.#e,config:{...this.#e.config,[a]:o},isDirty:!0})}removeEnvVar(e,s){const l=e==="container"?"containerEnv":"remoteEnv",a={...this.#e.config[l]};delete a[s],this.#r({...this.#e,config:{...this.#e.config,[l]:Object.keys(a).length>0?a:void 0},isDirty:!0})}addMount(e){const s=[...this.#e.config.mounts??[],e];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s},isDirty:!0}))}removeMount(e){const s=[...this.#e.config.mounts??[]];s.splice(e,1),this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s.length>0?s:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const e=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:e},isDirty:!0}))}setLifecycleCommand(e,s){this.#r({...this.#e,config:{...this.#e.config,[e]:s||void 0},isDirty:!0})}markClean(){this.#r({...this.#e,isDirty:!1,originalConfig:J(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const e=J(this.#e.config);for(const[s,l]of Object.entries(e))(l===""||l===void 0)&&delete e[s];return e.build&&(e.build.dockerfile===""&&delete e.build.dockerfile,e.build.context===""&&delete e.build.context,e.build.args&&Object.keys(e.build.args).length===0&&delete e.build.args,Object.keys(e.build).length===0&&delete e.build),e.forwardPorts?.length===0&&delete e.forwardPorts,e.mounts?.length===0&&delete e.mounts,e.runServices?.length===0&&delete e.runServices,e.capAdd?.length===0&&delete e.capAdd,e.securityOpt?.length===0&&delete e.securityOpt,e.features&&Object.keys(e.features).length===0&&delete e.features,e.customizations?.vscode?.extensions?.length===0&&delete e.customizations.vscode.extensions,e.customizations?.vscode&&Object.keys(e.customizations.vscode).length===0&&delete e.customizations.vscode,e.customizations&&Object.keys(e.customizations).length===0&&delete e.customizations,e.containerEnv&&Object.keys(e.containerEnv).length===0&&delete e.containerEnv,e.remoteEnv&&Object.keys(e.remoteEnv).length===0&&delete e.remoteEnv,e}#t(e){return{...e,suggestedMounts:xe(e.detectedPm,e.config.features??{},e.config.mounts??[])}}#r(e){this.#e=e;for(const s of this.#o)try{s()}catch{}}}const Ce=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ke=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var Or=Object.defineProperty,Fe=y((n,e)=>Or(n,"name",{value:e,configurable:!0}),"r$1");const me=Fe(n=>{if(!n)return ke;const e=n.toLowerCase();return ke.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterFeatures"),ge=Fe(n=>{if(!n)return Ce;const e=n.toLowerCase();return Ce.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterExtensions");var Fr=Object.defineProperty,Ar=y((n,e)=>Fr(n,"name",{value:e,configurable:!0}),"l$1");const Ae=["dockerComposeFile","service"],Lr={dockerComposeFile:"Compose File",service:"Service"},Se={dockerComposeFile:"docker-compose.yml",service:"app"},Mr={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Br=Ar(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>{const a=!!n.dockerComposeFile,o=!!(n.image||n.build);return i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&a&&r(c,{marginBottom:1,children:r(t,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Ae.map((d,g)=>{const f=g===s,p=n[d]??"",x=Array.isArray(n[d])?n[d].join(", "):p;return i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{children:[r(c,{width:20,children:i(t,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",Lr[d],":"]})}),r(c,{flexGrow:1,children:f&&e?r(he,{defaultValue:x,onChange:y(v=>{l({[d]:v||void 0})},"onChange"),placeholder:Se[d]}):r(t,{color:x?"white":"gray",children:x||Se[d]})})]}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:Mr[d]})})]},d)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),Nr=Ae.length;var $r=Object.defineProperty,Le=y((n,e)=>$r(n,"name",{value:e,configurable:!0}),"h$2");const zr=Le(({config:n,fieldIndex:e})=>{const s=n.containerEnv??{},l=n.remoteEnv??{},a=Object.keys(s),o=Object.keys(l),d=a.length,g=a.length+1,f=g+o.length,p=e<=d,x=e>d;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{borderColor:p?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:a.length>0?1:0,children:[r(t,{bold:!0,color:p?"cyan":"white",children:"containerEnv"}),r(t,{dimColor:!0,children:" — baked into the container image"})]}),a.map((v,w)=>{const k=w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:s[v]})]})},v)}),r(c,{flexShrink:0,marginTop:a.length>0?1:0,children:i(t,{color:e===d?"cyan":"gray",inverse:e===d,children:[" ","+ Add variable..."]})})]}),i(c,{borderColor:x?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:o.length>0?1:0,children:[r(t,{bold:!0,color:x?"cyan":"white",children:"remoteEnv"}),r(t,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((v,w)=>{const k=g+w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:l[v]})]})},v)}),r(c,{flexShrink:0,marginTop:o.length>0?1:0,children:i(t,{color:e===f?"cyan":"gray",inverse:e===f,children:[" ","+ Add variable..."]})})]}),r(c,{flexShrink:0,marginTop:1,children:i(t,{dimColor:!0,wrap:"truncate",children:[r(t,{bold:!0,color:"white",children:"a"}),"/",r(t,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),Gr=Le(n=>{const e=Object.keys(n.containerEnv??{}).length,s=Object.keys(n.remoteEnv??{}).length;return e+1+s+1},"getEnvFieldCount");var Rr=Object.defineProperty,_r=y((n,e)=>Rr(n,"name",{value:e,configurable:!0}),"g$2");const Wr=_r(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(n.customizations?.vscode?.extensions),[n.customizations?.vscode?.extensions]),d=q(()=>ge(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.id]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var Ur=Object.defineProperty,Xr=y((n,e)=>Ur(n,"name",{value:e,configurable:!0}),"g$1");const Vr=Xr(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(Object.keys(n.features??{})),[n.features]),d=q(()=>me(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.description]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var Hr=Object.defineProperty,Jr=y((n,e)=>Hr(n,"name",{value:e,configurable:!0}),"u$1");const ue=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],qr={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ee={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},re=["privileged","overrideCommand"],Yr={overrideCommand:"Override Command",privileged:"Privileged"},Kr=ue.length+re.length,Qr=Jr(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"General Configuration"})}),ue.map((a,o)=>{const d=o===s,g=n[a]??"";return i(c,{marginBottom:1,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",qr[a],":"]})}),r(c,{flexGrow:1,children:d&&e?r(he,{defaultValue:g,onChange:y(f=>{l({[a]:f})},"onChange"),placeholder:Ee[a]}):r(t,{color:g?"white":"gray",children:g||Ee[a]})})]},a)}),re.map((a,o)=>{const d=ue.length+o===s,g=n[a]??!1;return i(c,{marginBottom:o<re.length-1?1:0,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Yr[a],":"]})}),r(c,{flexGrow:1,children:i(t,{color:g?"green":"gray",children:[g?"yes":"no",d&&r(t,{dimColor:!0,children:" (Space to toggle)"})]})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Me=Kr,le=re;var Zr=Object.defineProperty,et=y((n,e)=>Zr(n,"name",{value:e,configurable:!0}),"s$3");const Be=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],rt={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},tt={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},ot=et(({config:n,fieldEditing:e,fieldIndex:s,onSetCommand:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Be.map((a,o)=>{const d=o===s,g=n[a],f=Array.isArray(g)?g.join(" && "):g??"";return i(c,{flexDirection:"column",marginBottom:1,children:[r(c,{children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",rt[a]]})}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:tt[a]})}),r(c,{paddingLeft:4,children:d&&e?r(he,{defaultValue:f,onChange:y(p=>{l(a,p)},"onChange"),placeholder:"e.g. npm install"}):r(t,{color:f?"green":"gray",children:f||"(not set)"})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),nt=Be.length;var it=Object.defineProperty,Ne=y((n,e)=>it(n,"name",{value:e,configurable:!0}),"s$2");const Ie=Ne(n=>typeof n=="string"?n:`[${n.type}] ${n.source} → ${n.target}`,"formatMount"),ct=Ne(({addingMount:n,config:e,detectedPm:s,fieldIndex:l,mountPhase:a,mountSource:o,mountTarget:d,mountType:g,suggestedMounts:f})=>{const p=e.mounts??[];return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[p.length," ","mounts"]}),s&&i(t,{dimColor:!0,children:["— detected:"," ",r(t,{color:"white",children:s})]})]}),f.length>0&&!n&&i(c,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[i(c,{flexShrink:0,children:[r(t,{bold:!0,color:"yellow",children:"Suggested mounts"}),i(t,{dimColor:!0,children:[" ","— press"," ",r(t,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((x,v)=>r(c,{flexShrink:0,children:i(t,{dimColor:!0,wrap:"truncate",children:[" + ",Ie(x)]})},`suggestion-${String(v)}`))]}),p.length>0&&r(c,{flexDirection:"column",marginBottom:1,children:p.map((x,v)=>{const w=v===l;return i(c,{flexShrink:0,height:1,children:[r(t,{children:w?">":" "}),r(c,{flexGrow:1,children:i(t,{bold:w,inverse:w,wrap:"truncate",children:[" ",Ie(x)]})})]},`mount-${String(v)}`)})}),!n&&r(c,{flexShrink:0,children:i(t,{color:l===p.length?"cyan":"gray",inverse:l===p.length,children:[" ","+ Add mount..."]})}),n&&i(c,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[r(c,{flexShrink:0,marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"New Mount"})}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="source",color:a==="source"?"cyan":"white",children:[a==="source"?"❯ ":" ","Source:"]})}),r(t,{color:o?"yellow":"gray",children:o||(a==="source"?"_":"(type source, Enter to continue)")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="target",color:a==="target"?"cyan":"white",children:[a==="target"?"❯ ":" ","Target:"]})}),r(t,{color:d?"yellow":"gray",children:d||(a==="target"?"_":"/container/path")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="type",color:a==="type"?"cyan":"white",children:[a==="type"?"❯ ":" ","Type:"]})}),a==="type"?i(t,{children:[r(t,{bold:g==="volume",color:g==="volume"?"cyan":"gray",children:"[1] volume"})," ",r(t,{bold:g==="bind",color:g==="bind"?"cyan":"gray",children:"[2] bind"})," ",r(t,{bold:g==="tmpfs",color:g==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):r(t,{color:"gray",children:g})]}),r(c,{flexShrink:0,marginTop:1,children:r(t,{dimColor:!0,wrap:"truncate",children:a==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),p.length===0&&!n&&f.length===0&&r(c,{marginTop:1,children:r(t,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var st=Object.defineProperty,at=y((n,e)=>st(n,"name",{value:e,configurable:!0}),"s$1");const lt=at(({addingPort:n,addPortValue:e,config:s,fieldIndex:l})=>{const a=s.forwardPorts??[],o=l===a.length;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{marginBottom:1,children:[r(t,{bold:!0,color:"cyan",children:"Forwarded Ports"}),i(t,{dimColor:!0,children:[" ","(",a.length," ","ports)"]})]}),a.map((d,g)=>{const f=g===l;return r(c,{children:i(t,{color:f?"cyan":void 0,inverse:f,children:[" ",String(d)]})},`port-${String(d)}`)}),r(c,{marginTop:a.length>0?1:0,children:i(t,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&n?i(t,{children:["Enter port:"," ",r(t,{color:"yellow",children:e||"_"})]}):"+ Add port..."]})}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var dt=Object.defineProperty,ut=y((n,e)=>dt(n,"name",{value:e,configurable:!0}),"a");const ht=ut(({focused:n,hadComments:e,jsonPreview:s,mode:l,scrollRef:a})=>i(c,{borderColor:n?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,paddingX:1,children:[r(t,{bold:!0,color:n?"cyan":"white",children:"Preview"}),i(t,{dimColor:!0,children:[" ","(",l==="create"?"new":"edit",")"]})]}),e&&l==="edit"&&r(c,{flexShrink:0,paddingX:1,children:r(t,{color:"yellow",children:"Comments will not be preserved."})}),r(gr,{flexGrow:1,ref:a,scrollbar:!0,scrollbarColor:"gray",children:s.split(`
|
|
3
|
+
`).map((o,d)=>r(t,{color:"green",children:o},`line-${String(d)}`))})]}),"PreviewPanel");var mt=Object.defineProperty,gt=y((n,e)=>mt(n,"name",{value:e,configurable:!0}),"r");const ft=gt(n=>{const e=[],s=[],l=[];if(!n.image&&!n.build&&!n.dockerComposeFile&&e.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),n.build&&(n.image&&s.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),n.build.dockerfile||e.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),n.dockerComposeFile&&!n.service&&e.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),n.features!==void 0&&(typeof n.features!="object"||Array.isArray(n.features))&&e.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),n.forwardPorts)if(Array.isArray(n.forwardPorts))for(const[a,o]of n.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&e.push({field:"forwardPorts",message:`Invalid port ${String(o)} at index ${String(a)}`});else e.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return n.customizations?.vscode?.extensions&&!Array.isArray(n.customizations.vscode.extensions)&&e.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),n.customizations?.vscode?.settings&&typeof n.customizations.vscode.settings!="object"&&e.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),n.name||l.push({field:"name",message:"Consider adding a name for better identification"}),(!n.features||Object.keys(n.features).length===0)&&l.push({field:"features",message:"Consider adding features for common tools"}),(!n.customizations?.vscode?.extensions||n.customizations.vscode.extensions.length===0)&&l.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),n.privileged&&s.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:e,suggestions:l,valid:e.length===0,warnings:s}},"validateConfig");var pt=Object.defineProperty,$e=y((n,e)=>pt(n,"name",{value:e,configurable:!0}),"$");const Te=80,Pe=15,vt=120,ze=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],yt=new Map(ze.map(n=>[n.id,n.description])),bt=$e((n,e,s,l)=>{switch(n){case"compose":return Nr;case"environment":return Gr(e);case"extensions":return ge(l).length;case"features":return me(s).length;case"general":return Me;case"lifecycle":return nt;case"mounts":return(e.mounts?.length??0)+1;case"ports":return(e.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),wt=$e(({onSave:n,store:e})=>{const{exit:s}=hr(),{columns:l,rows:a}=mr(),o=er(e.subscribe,e.getSnapshot),[d,g]=C(!1),[f,p]=C(!1),[x,v]=C(!1),[w,k]=C(null),[S,D]=C("editor"),[Y,fe]=C(0),[te,oe]=C(!1),[pe,z]=C(""),[G,R]=C(null),[_,j]=C(""),[ve,O]=C(""),[W,L]=C("key"),[ne,K]=C(!1),[ie,M]=C(""),[ce,B]=C(""),[ye,U]=C("volume"),[I,N]=C("source"),se=Z(null),F=Z(null),P=Z(null),Q=Z(!0);ae(()=>(Q.current=!0,()=>{Q.current=!1,P.current&&clearTimeout(P.current)}),[]);const be=bt(o.section,o.config,o.featureSearch,o.extensionSearch),X=Math.max(1,a-9);ae(()=>{o.section!=="features"&&o.section!=="extensions"||fe(h=>o.fieldIndex>=h+X?o.fieldIndex-X+1:o.fieldIndex<h?o.fieldIndex:h)},[o.fieldIndex,o.section,X]),ae(()=>{fe(0)},[o.section,o.featureSearch,o.extensionSearch]);const Ge=rr(()=>{const h=e.cleanConfig(),m=ft(h);if(!m.valid){const b=m.errors[0];k(b?`Error: ${b.message}`:"Validation failed"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},3e3);return}n(h),e.markClean();const u=m.warnings.length;k(u>0?`Saved! (${String(u)} warning${u>1?"s":""})`:"Saved!"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},2e3)},[n,e]);H((h,m)=>{if(m.downArrow||h==="j")e.setTemplateIndex(o.templateIndex+1);else if(m.upArrow||h==="k")e.setTemplateIndex(o.templateIndex-1);else if(m.return){const u=$[o.templateIndex];u&&e.applyTemplate(u.id)}else m.escape&&e.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),H((h,m)=>{if(m.escape){oe(!1),z("");return}if(m.return){const u=Number.parseInt(pe,10);!Number.isNaN(u)&&u>0&&u<=65535&&e.addPort(u),oe(!1),z("");return}if(m.backspace){z(u=>u.slice(0,-1));return}h&&/^\d$/u.test(h)&&z(u=>u+h)},{isActive:te}),H((h,m)=>{if(m.escape){R(null),j(""),O(""),L("key");return}if(m.return){if(W==="key"&&_){L("value");return}if(W==="value"&&_){e.addEnvVar(G,_,ve),R(null),j(""),O(""),L("key");return}}if(m.backspace){W==="key"?j(u=>u.slice(0,-1)):O(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(W==="key"?j(u=>u+h):O(u=>u+h))},{isActive:G!==null}),H((h,m)=>{if(m.escape){K(!1),M(""),B(""),N("source");return}if(m.return){if(I==="source"&&ie){N("target");return}if(I==="target"&&ce){N("type");return}if(I==="type"){e.addMount({source:ie,target:ce,type:ye}),K(!1),M(""),B(""),N("source");return}}if(I==="type"){switch(h){case"1":{U("volume");break}case"2":{U("bind");break}case"3":{U("tmpfs");break}}return}if(m.backspace){I==="source"?M(u=>u.slice(0,-1)):I==="target"&&B(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(I==="source"?M(u=>u+h):I==="target"&&B(u=>u+h))},{isActive:ne}),H((h,m)=>{if(h==="c"&&m.ctrl){s();return}if(!f){if(d){m.escape||h==="?"?g(!1):m.downArrow||h==="j"?se.current?.scrollBy(1):m.upArrow||h==="k"?se.current?.scrollBy(-1):h==="q"&&(g(!1),p(!0));return}if(x){if(m.escape){v(!1),o.section==="features"?e.setFeatureSearch(""):e.setExtensionSearch("");return}if(m.return){v(!1);return}if(m.backspace){o.section==="features"?e.setFeatureSearch(o.featureSearch.slice(0,-1)):e.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(h&&!m.ctrl&&!m.meta){o.section==="features"?e.setFeatureSearch(o.featureSearch+h):e.setExtensionSearch(o.extensionSearch+h);return}return}if(o.fieldEditing){if(m.escape){e.setFieldEditing(!1);return}if(m.return){e.setFieldEditing(!1);return}return}if(h==="?"){g(!0);return}if(h==="q"){o.isDirty?p(!0):s();return}if(h==="s"){Ge();return}if(m.tab){D(u=>u==="editor"?"preview":"editor");return}if(S==="preview"){if(m.downArrow||h==="j"){F.current?.scrollBy(1);return}if(m.upArrow||h==="k"){F.current?.scrollBy(-1);return}if(m.pageDown){F.current?.scrollBy(10);return}if(m.pageUp){F.current?.scrollBy(-10);return}if(m.home){F.current?.scrollToTop();return}if(m.end){F.current?.scrollToBottom();return}m.escape&&D("editor");return}if(m.downArrow||h==="j"){be>0&&e.setFieldIndex(Math.min(o.fieldIndex+1,be-1));return}if(m.upArrow||h==="k"){e.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(m.return){switch(o.section){case"compose":case"general":case"lifecycle":{e.setFieldEditing(!0);break}case"environment":{const u=Object.keys(o.config.containerEnv??{}).length,b=u,T=u+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===b?(R("container"),j(""),O(""),L("key")):o.fieldIndex===T&&(R("remote"),j(""),O(""),L("key"));break}case"mounts":{const u=o.config.mounts??[];o.fieldIndex===u.length&&(K(!0),M(""),B(""),U("volume"),N("source"));break}case"ports":{const u=o.config.forwardPorts??[];o.fieldIndex===u.length&&(oe(!0),z(""));break}}return}if(h===" "){switch(o.section){case"extensions":{const u=ge(o.extensionSearch)[o.fieldIndex];u&&e.toggleExtension(u.id);break}case"features":{const u=me(o.featureSearch)[o.fieldIndex];u&&e.toggleFeature(u.id);break}case"general":{const u=Me-le.length,b=o.fieldIndex-u;if(b>=0&&b<le.length){const T=le[b];e.updateConfig({[T]:!o.config[T]})}break}}return}if(h==="/"){(o.section==="features"||o.section==="extensions")&&v(!0);return}if(h==="A"&&o.section==="mounts"){e.applySuggestedMounts();return}if(h==="a"){if(o.section==="environment"){const u=Object.keys(o.config.containerEnv??{}).length,b=o.fieldIndex<=u?"container":"remote";R(b),j(""),O(""),L("key")}else o.section==="mounts"&&(K(!0),M(""),B(""),U("volume"),N("source"));return}if(h==="d")switch(o.section){case"environment":{const u=Object.keys(o.config.containerEnv??{}),b=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<u.length)e.removeEnvVar("container",u[o.fieldIndex]),u.length===1||o.fieldIndex>=u.length-1&&e.setFieldIndex(u.length-2);else{const T=o.fieldIndex-u.length-1;T>=0&&T<b.length&&(e.removeEnvVar("remote",b[T]),b.length===1||T>=b.length-1&&e.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const u=o.config.mounts??[];if(o.fieldIndex<u.length){e.removeMount(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}case"ports":{const u=o.config.forwardPorts??[];if(o.fieldIndex<u.length){e.removePort(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}}}},{isActive:!o.showTemplateSelector&&!te&&G===null&&!ne});const Re=q(()=>e.getJsonPreview(),[o.config]);if(l<Te||a<Pe)return r(c,{alignItems:"center",height:a,justifyContent:"center",width:l,children:i(t,{color:"yellow",children:["Terminal too small (",l,"x",a,"), need"," ",Te,"x",Pe]})});if(o.showTemplateSelector)return r(c,{alignItems:"center",flexDirection:"column",height:a,justifyContent:"center",width:l,children:i(c,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[r(c,{justifyContent:"center",marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Select a Template"})}),$.map((h,m)=>{const u=m===o.templateIndex;return r(c,{children:i(t,{color:u?"cyan":void 0,inverse:u,children:[u?" ❯ ":" ",r(t,{bold:u,children:h.name}),i(t,{dimColor:!0,children:[" ","-",h.description]})]})},h.id)}),r(c,{justifyContent:"center",marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Enter"})," ","select"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let E;switch(o.section){case"compose":{E=r(Br,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"environment":{E=i(c,{flexDirection:"column",children:[r(zr,{config:o.config,fieldIndex:o.fieldIndex}),G!==null&&r(c,{marginTop:1,paddingX:1,children:i(t,{color:"cyan",children:["Add"," ",G," ","env:"," ",W==="key"?i(t,{children:["key=",r(t,{color:"yellow",children:_||"_"})," ","(Enter to set value)"]}):i(t,{children:[_,"=",r(t,{color:"yellow",children:ve||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{E=r(Wr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.extensionSearch,viewportHeight:X});break}case"features":{E=r(Vr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.featureSearch,viewportHeight:X});break}case"general":{E=r(Qr,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"lifecycle":{E=r(ot,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:y((h,m)=>{e.setLifecycleCommand(h,m)},"onSetCommand")});break}case"mounts":{E=r(ct,{addingMount:ne,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:I,mountSource:ie,mountTarget:ce,mountType:ye,suggestedMounts:o.suggestedMounts});break}case"ports":{E=r(lt,{addingPort:te,addPortValue:pe,config:o.config,fieldIndex:o.fieldIndex});break}default:E=r(t,{children:"Unknown section"})}const _e=i(c,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[i(c,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:"QUIT"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:"HELP"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"↑↓"}),r(t,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:"CHECK"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:"TABS"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:"FILTER"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:"SAVE"})]})]}),i(c,{paddingX:1,children:[w&&i(t,{color:w.startsWith("Error")?"red":"green",children:[w," "]}),o.isDirty&&r(t,{color:"yellow",children:"[modified]"}),!o.isDirty&&!w&&r(t,{dimColor:!0,children:"[saved]"})]})]}),We=i(lr,{footer:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(t,{bold:!0,color:"white",children:"?"}),"/",r(t,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:se,title:"KEYBOARD SHORTCUTS",visible:d,width:56,children:[i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"NAVIGATION"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:" Switch tabs"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"↑↓"}),"/",r(t,{bold:!0,color:"white",children:"j/k"}),r(t,{dimColor:!0,children:" Navigate within section"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:" Switch editor/preview panel"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Enter"}),r(t,{dimColor:!0,children:" Edit selected field"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Esc"}),r(t,{dimColor:!0,children:" Stop editing / cancel"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:" Toggle selection"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:" Search / filter"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"a"}),r(t,{dimColor:!0,children:" Add new entry"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"d"}),r(t,{dimColor:!0,children:" Delete selected entry"})]})]}),i(c,{flexDirection:"column",children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"ACTIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:" Save configuration"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:" Quit"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:" Toggle help"})]})]})]}),Ue=r(ht,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:Re,mode:o.mode,scrollRef:F}),we=l>=vt,Xe=we?Math.floor(l*.38):0;return i(c,{flexDirection:"column",height:a,width:l,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[r(t,{bold:!0,inverse:!0,children:" VIS "}),i(t,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),r(c,{flexShrink:0,paddingX:1,paddingY:1,children:r(ur,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:y(h=>{e.setSection(h),D("editor")},"onChange"),showIndex:!1,children:ze.map(({id:h,label:m})=>r(dr,{name:h,children:m},h))})}),r(c,{flexShrink:0,paddingRight:2,children:r(t,{dimColor:!0,wrap:"truncate",children:yt.get(o.section)??""})}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:E}),we&&r(c,{flexShrink:0,width:Xe,children:Ue})]}),_e,r(Ke,{autoExitSeconds:3,onCancel:y(()=>{p(!1)},"onCancel"),visible:f}),We]})},"VisDevcontainerApp");var xt=Object.defineProperty,De=y((n,e)=>xt(n,"name",{value:e,configurable:!0}),"c");const _t=De(async({logger:n,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const l=s,a=e.template,o=e.output,d=!!process.stdout.isTTY&&!Qe;let g=null;try{g=tr(l).name}catch{}const f=kr(l);let p=f?.config??null;const x=f?.hadComments??!1;if(a&&!f){const S=$.find(D=>D.id===a);if(!S){const D=$.map(Y=>Y.id).join(", ");throw new Error(`Unknown template "${a}". Valid templates: ${D}`)}p=S.config}if(!d){p?n.info(JSON.stringify(p,null,2)):(n.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const v=setInterval(()=>{},1e3),w=new jr(p,x,g);a&&!f&&w.dismissTemplateSelector();let k=null;if(await Ye(Ze.createElement(wt,{onSave:De(S=>{Sr(l,S,o),k=S},"onSave"),store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(v),k){const S=o??".devcontainer/devcontainer.json";n.info(`DevContainer config saved to ${S}`)}},"execute");export{_t as default};
|