@visulima/vis 1.0.0-alpha.27 → 1.0.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +3228 -110
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/packem_chunks/bin.js +468 -364
  6. package/dist/packem_chunks/bloom-status.js +1 -1
  7. package/dist/packem_chunks/bloom-sync.js +1 -1
  8. package/dist/packem_chunks/config.js +15 -15
  9. package/dist/packem_chunks/devtools.js +82 -0
  10. package/dist/packem_chunks/doctor-probe.js +1 -1
  11. package/dist/packem_chunks/fix.js +1 -1
  12. package/dist/packem_chunks/handler10.js +1 -1
  13. package/dist/packem_chunks/handler11.js +1 -1
  14. package/dist/packem_chunks/handler12.js +1 -1
  15. package/dist/packem_chunks/handler13.js +1 -1
  16. package/dist/packem_chunks/handler14.js +1 -1
  17. package/dist/packem_chunks/handler15.js +1 -1
  18. package/dist/packem_chunks/handler16.js +1 -1
  19. package/dist/packem_chunks/handler17.js +1 -1
  20. package/dist/packem_chunks/handler18.js +1 -1
  21. package/dist/packem_chunks/handler19.js +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -1
  23. package/dist/packem_chunks/handler21.js +3 -3
  24. package/dist/packem_chunks/handler22.js +1 -1
  25. package/dist/packem_chunks/handler23.js +2 -2
  26. package/dist/packem_chunks/handler24.js +1 -1
  27. package/dist/packem_chunks/handler26.js +1 -1
  28. package/dist/packem_chunks/handler27.js +1 -1
  29. package/dist/packem_chunks/handler28.js +1 -1
  30. package/dist/packem_chunks/handler29.js +1 -1
  31. package/dist/packem_chunks/handler3.js +1 -1
  32. package/dist/packem_chunks/handler30.js +6 -6
  33. package/dist/packem_chunks/handler31.js +2 -2
  34. package/dist/packem_chunks/handler33.js +1 -1
  35. package/dist/packem_chunks/handler34.js +4 -4
  36. package/dist/packem_chunks/handler35.js +2 -2
  37. package/dist/packem_chunks/handler36.js +1 -1
  38. package/dist/packem_chunks/handler37.js +4 -4
  39. package/dist/packem_chunks/handler38.js +2 -2
  40. package/dist/packem_chunks/handler39.js +5 -5
  41. package/dist/packem_chunks/handler4.js +5 -5
  42. package/dist/packem_chunks/handler40.js +18 -18
  43. package/dist/packem_chunks/handler41.js +1 -1
  44. package/dist/packem_chunks/handler42.js +25 -10
  45. package/dist/packem_chunks/handler43.js +10 -25
  46. package/dist/packem_chunks/handler44.js +11 -11
  47. package/dist/packem_chunks/handler45.js +15 -15
  48. package/dist/packem_chunks/handler46.js +19 -19
  49. package/dist/packem_chunks/handler47.js +16 -16
  50. package/dist/packem_chunks/handler48.js +3 -3
  51. package/dist/packem_chunks/handler49.js +12 -12
  52. package/dist/packem_chunks/handler5.js +7 -7
  53. package/dist/packem_chunks/handler50.js +70 -71
  54. package/dist/packem_chunks/handler51.js +23 -23
  55. package/dist/packem_chunks/handler8.js +1 -1
  56. package/dist/packem_chunks/handler9.js +1 -1
  57. package/dist/packem_chunks/heal-accept.js +1 -1
  58. package/dist/packem_chunks/heal.js +1 -1
  59. package/dist/packem_chunks/help-command.js +7 -17
  60. package/dist/packem_chunks/index.js +3 -3
  61. package/dist/packem_chunks/keys-refresh.js +1 -1
  62. package/dist/packem_chunks/list.js +2 -2
  63. package/dist/packem_chunks/loader.js +1 -1
  64. package/dist/packem_chunks/prune.js +1 -1
  65. package/dist/packem_chunks/run.js +1 -1
  66. package/dist/packem_chunks/status.js +1 -1
  67. package/dist/packem_chunks/sync.js +1 -1
  68. package/dist/packem_chunks/sync2.js +1 -1
  69. package/dist/packem_chunks/tripwire.js +1 -1
  70. package/dist/packem_chunks/verify-lockfile.js +1 -1
  71. package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +12 -0
  72. package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
  73. package/dist/packem_shared/{advisories-xIOdLbAI.js → advisories-BxXiKFbL.js} +1 -1
  74. package/dist/packem_shared/{ai-analysis-Csn82p17.js → ai-analysis-BnmDFqc8.js} +5 -5
  75. package/dist/packem_shared/{ai-fix-BlYyz5bI.js → ai-fix-BGbnrWCz.js} +7 -7
  76. package/dist/packem_shared/{cyclonedx-B3ILsY74.js → cyclonedx-C2k2HmvI.js} +1 -1
  77. package/dist/packem_shared/{dependency-scan-s2MD0vi-.js → dependency-scan-Bki15Yi-.js} +1 -1
  78. package/dist/packem_shared/{docker-BynKrOLe.js → docker-k-Sl8b-w.js} +1 -1
  79. package/dist/packem_shared/{failure-log-B0Uh-65U.js → failure-log-C3bG1bCA.js} +1 -1
  80. package/dist/packem_shared/index-2r730kXY.js +29 -0
  81. package/dist/packem_shared/{index-B_KtN1MB.js → index-DBq4TVu5.js} +1 -1
  82. package/dist/packem_shared/{lifecycle-CJRNbN3x.js → lifecycle-B91p_ra8.js} +2 -2
  83. package/dist/packem_shared/{lockfile-BG1HvBzH.js → lockfile-DmDfgKaT.js} +1 -1
  84. package/dist/packem_shared/{min-release-age-aEn0x8Vy.js → min-release-age-B1Jm1_JY.js} +1 -1
  85. package/dist/packem_shared/{native-config-sync-DdhTLlKL.js → native-config-sync-Cnpj2xcn.js} +6 -6
  86. package/dist/packem_shared/{osv-bloom-BJhlc_I2.js → osv-bloom-ep8GlDGT.js} +2 -2
  87. package/dist/packem_shared/pm-runner-COoPLGKi.js +1 -0
  88. package/dist/packem_shared/{provenance-BuiEsWbI.js → provenance-DbkJRDqt.js} +1 -1
  89. package/dist/packem_shared/{registry-keys-pemEkRM9.js → registry-keys-SylX07bs.js} +1 -1
  90. package/dist/packem_shared/{resolve-explicit-RgRrUDZv.js → resolve-explicit-CJ_5wYSu.js} +1 -1
  91. package/dist/packem_shared/s1ngularity-DlS-4a6K.js +1 -0
  92. package/dist/packem_shared/scan-progress-CU4ttEHQ.js +2 -0
  93. package/dist/packem_shared/{signatures-LYMy8OR5.js → signatures-B-1u4t-c.js} +1 -1
  94. package/dist/packem_shared/spinner-B9ZPv1iT.js +1 -0
  95. package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
  96. package/dist/packem_shared/tabs-C-qFIoUv.js +1 -0
  97. package/dist/packem_shared/typosquats-BxCOUvTJ.js +1 -0
  98. package/dist/packem_shared/use-measured-height-kIDCuc76.js +1 -0
  99. package/dist/packem_shared/vis-update-app-COYmjGKv.js +1 -0
  100. package/dist/packem_shared/{watch-loop-DLlMLg_J.js → watch-loop-CP318TfG.js} +2 -2
  101. package/index.js +26 -26
  102. package/package.json +9 -9
  103. package/dist/packem_shared/index-efSniSRN.js +0 -29
  104. package/dist/packem_shared/index.server-B7ETiT4C.js +0 -2
  105. package/dist/packem_shared/pm-runner-BwX5AL3W.js +0 -1
  106. package/dist/packem_shared/s1ngularity-Bs9fUf3q.js +0 -1
  107. package/dist/packem_shared/scan-progress-DjPT66jy.js +0 -2
  108. package/dist/packem_shared/typosquats-znskIR5j.js +0 -1
  109. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
  110. package/dist/packem_shared/vis-update-app-qhQPV97i.js +0 -1
@@ -1,67 +1,66 @@
1
- var ki=Object.defineProperty;var v=(r,e)=>ki(r,"name",{value:e,configurable:!0});import{createRequire as bi}from"node:module";import{M as de,K as Ti,Q as xi,$ as Ci}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{b5 as Zn,au as Ii,w as Ht,x as yr,b6 as Oi,b7 as Mi,q as Bt,b8 as Ei,v as Ri,C as ji,S as Pi,b9 as Fi,ba as Ai,s as vt,bb as Li,aw as Di,bc as Bi,bd as Ni,be as _i,bf as Gi,E as qi,bg as Ui}from"./bin.js";import{buildEnhancedPath as Wi,runConcurrently as Nt,TerminalBuffer as wr,readLastRunSummary as zi,getLastRunSummaryPath as Hi,enforceProjectConstraints as Vi,expandTokensInString as yn,parsePartition as Ki,TaskScheduler as Ji,createTaskGraph as Yi,reverseTaskGraph as Qi,generateRunSummary as wn,writeChromeTrace as Xi,resolveTurboEnvCompat as Zi,CompositeLifeCycle as $n,defaultTaskRunner as kn,createLogReporter as eo,writeRunSummary as to}from"@visulima/task-runner";import{F as co}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as lo}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as uo,a as fo,b as ho,s as po,d as go,c as mo,r as vo,H as yo,f as wo,e as $o}from"../packem_shared/lifecycle-CJRNbN3x.js";import{p as ko,r as bo,f as So}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as $e,render as To}from"@visulima/tui";import{Text as d}from"@visulima/tui/components/text";import te,{useSyncExternalStore as At,useCallback as jt,useState as yt,useRef as wt,useEffect as rr,useMemo as nr}from"react";import{jsxs as g,jsx as h,Fragment as ts}from"react/jsx-runtime";import{Box as k}from"@visulima/tui/components/box";import{StaticRender as bn}from"@visulima/tui/components/static-render";import{T as rs,C as kr,D as Vt,E as ns}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as xo}from"@visulima/tui/components/dialog";import{useApp as Co}from"@visulima/tui/hooks/use-app";import{useInput as Sn}from"@visulima/tui/hooks/use-input";import{useWindowSize as Io}from"@visulima/tui/hooks/use-window-size";import{q as jo,j as Po,T as sr,E as xn}from"../packem_shared/index.server-B7ETiT4C.js";import{ScrollView as ss}from"@visulima/tui/components/scroll-view";import{Spinner as is}from"@visulima/tui/components/spinner";import{c as Cn,a as Bo,s as In}from"../packem_shared/watch-BSVsZ_1I.js";import{d as os}from"./config.js";const Si=bi(import.meta.url),mt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=v(r=>{if(typeof mt<"u"&&mt.versions&&mt.versions.node){const[e,t]=mt.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return mt.getBuiltinModule(r)}return Si(r)},"__cjs_getBuiltinModule"),{existsSync:_e,statSync:_t,readFileSync:dt,writeFileSync:$r,mkdirSync:ro,openSync:no,readSync:so,closeSync:io,mkdtempSync:oo}=Ge("node:fs"),{createInterface:es,emitKeypressEvents:ao}=Ge("node:readline"),{isAbsolute:Oo,resolve:Tn,dirname:Mo,relative:Eo}=Ge("node:path"),{fileURLToPath:Ro}=Ge("node:url"),{createRequire:Fo}=Ge("node:module"),{createHash:Ao}=Ge("node:crypto"),{appendFile:br}=Ge("node:fs/promises"),{platform:Lo,homedir:Sr,tmpdir:Do}=Ge("node:os"),{spawn:No}=Ge("node:child_process");var _o=Object.defineProperty,Go=v((r,e)=>_o(r,"name",{value:e,configurable:!0}),"u$6"),qo=Object.defineProperty,Uo=Go((r,e)=>qo(r,"name",{value:e,configurable:!0}),"v"),Wo=Object.defineProperty,zo=Uo((r,e)=>Wo(r,"name",{value:e,configurable:!0}),"D");const Ho=zo((r,e,t,n,s,o,i,a,l,f,u,p,c,m)=>{const y={d:n,h:s,m:o,mo:e,ms:a,s:i,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),m!==void 0&&(y.placeholderSeparator=m),y},"createDurationLanguage"),Vo={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"},Ko=Ho(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",".",Vo,",","_");var Jo=Object.defineProperty,Yo=v((r,e)=>Jo(r,"name",{value:e,configurable:!0}),"o$4"),Qo=Object.defineProperty,Xo=Yo((r,e)=>Qo(r,"name",{value:e,configurable:!0}),"o"),Zo=Object.defineProperty,ea=Xo((r,e)=>Zo(r,"name",{value:e,configurable:!0}),"o");const ta=ea(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const n of e)if(!Object.hasOwn(r,n))throw new TypeError(`Missing required property: ${n}`);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 n of t)if(typeof r[n]!="string"&&typeof r[n]!="function")throw new TypeError(`Property ${n} 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(n=>typeof n!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var ra=Object.defineProperty,na=v((r,e)=>ra(r,"name",{value:e,configurable:!0}),"b$6"),sa=Object.defineProperty,ia=na((r,e)=>sa(r,"name",{value:e,configurable:!0}),"b"),oa=Object.defineProperty,xt=ia((r,e)=>oa(r,"name",{value:e,configurable:!0}),"g");const as=xt((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"),On=xt(({unitCount:r,unitName:e},t,n)=>{let{spacer:s}=n;const{maxDecimalPoints:o}=n;let i=".";n.decimal!==void 0?i=n.decimal:t.decimal!==void 0&&(i=t.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in t&&(a=t._digitReplacements);let l,f=r;o!==void 0&&(f=as(r,o));const u=f.toString();if(!t._hideCountIf2||r!==2)if(a){l="";for(const m of u)l+=m==="."?i:a[m]}else l=u.replace(".",i);else l="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(s=""),t._numberFirst?c+s+l:l+s+c},"renderPiece"),aa=xt((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:n}=e,s=e.largest??Number.POSITIVE_INFINITY,o={};let i,a,l,f=r;for(a=0;a<t.length;a++){i=t[a];const p=n[i];l=a===t.length-1?f/p:Math.floor(f/p),o[i]=l,f-=l*p}if(e.round){let p=s;for(a=0;a<t.length;a++)if(i=t[a],l=o[i],l!==0&&(p--,p===0)){for(let c=a+1;c<t.length;c++){const m=t[c],y=o[m];o[i]=(o[i]??0)+y*n[m]/n[i],o[m]=0}break}for(a=t.length-1;a>=0;a--){if(i=t[a],l=o[i],l===0)continue;const c=Math.round(l);if(o[i]=c,a===0)break;const m=t[a-1],y=n[m],M=Math.floor(c*n[i]/y);if(M)o[m]=(o[m]??0)+M,o[i]=0;else break}}const u=[];for(a=0;a<t.length&&u.length<s;a++){if(i=t[a],l=o[i],l&&!e.round&&u.length===s-1){let p,c=0;for(p=a+1,t.length;p<t.length;p++){const m=t[p];c+=o[m]*(e.unitMeasures[m]/e.unitMeasures[i])}l+=c,e.maxDecimalPoints!==void 0&&(l=as(l,e.maxDecimalPoints))}l&&u.push({unitCount:l,unitName:i})}return u},"getPieces"),ca=xt((r,e,t)=>{const{language:n,units:s}=e;if(r.length===0){const p=s.at(-1);return On({unitCount:0,unitName:p},n,e)}const{conjunction:o,serialComma:i}=e;let a=", ";e.delimiter!==void 0?a=e.delimiter:n.delimiter!==void 0&&(a=n.delimiter);let l="";e.timeAdverb&&t!==0&&(l=n.future??"",t<0&&(l=n.past??""));const f=r.map(p=>On(p,n,e));let u;return!o||r.length===1?u=f.join(a):r.length===2?u=f.join(o):u=f.slice(0,-1).join(a)+(i?",":"")+o+(f.at(-1)??""),l&&(u=l.replace("%s",u)),u},"formatPieces"),cs=xt((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:Ko,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};ta(t.language);const n=Math.abs(r),s=aa(n,t);return ca(s,t,r)},"duration");var la=Object.defineProperty,ls=v((r,e)=>la(r,"name",{value:e,configurable:!0}),"u$5"),da=Object.defineProperty,Tr=ls((r,e)=>da(r,"name",{value:e,configurable:!0}),"u"),ua=Object.defineProperty,fa=Tr((r,e)=>ua(r,"name",{value:e,configurable:!0}),"e");function Kt({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")}v(Kt,"n$2");ls(Kt,"a");Tr(Kt,"t");fa(Kt,"ansiRegex");var ha=Object.defineProperty,pa=Tr((r,e)=>ha(r,"name",{value:e,configurable:!0}),"r");const ga=Kt(),ma=/\u001B\]0;.*\u0007/,va=pa(r=>r.replace(ma,"").replace(ga,""),"strip");var ya=Object.defineProperty,Jt=v((r,e)=>ya(r,"name",{value:e,configurable:!0}),"s$3");const wa={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},$a={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"]},ka={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"}},ba=1e3,ds=Jt(r=>{for(const[e,t]of Object.entries(wa))for(const n of t)if(_e(de(r,n)))return{lockfileFile:n,manager:e}},"detectPackageManager"),Sa=Jt((r,e)=>{let t;for(const n of $a[e]){const s=de(r,n);if(!_e(s))continue;const{mtimeMs:o}=_t(s);(!t||o>t.mtimeMs)&&(t={mtimeMs:o,path:n})}return t},"findFreshestMarker"),Ta=Jt((r,e={})=>{const t=ds(r);if(!t)return{checked:!1};const{lockfileFile:n,manager:s}=t,o=_t(de(r,n)).mtimeMs,i=Sa(r,s),a=ka[e.inCi?"ci":"tty"][s],l={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:o,lockfilePath:n,marker:i?.path,packageManager:s};return i?o>i.mtimeMs+ba?{checked:!0,detail:l,failure:"stale-install",message:`${n} is newer than node_modules (${i.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"),xa=Jt((r,e,t,n={})=>{if(n.skip)return{checked:!1,shouldContinue:!0};const s=Ta(r,{inCi:e});if(!s.failure)return{...s,shouldContinue:!0};const o=`preflight: ${s.message??"lockfile drift detected"}`;return e&&!n.ciAsWarning?{...s,formattedMessage:o,shouldContinue:!1}:(t.warn(o),{...s,formattedMessage:o,shouldContinue:!0})},"runLockfilePreflight");var Ca=Object.defineProperty,De=v((r,e)=>Ca(r,"name",{value:e,configurable:!0}),"t$2");const je="@voidzero-dev/vite-task-client",xr="@visulima/task-runner-client",Gt=`npm:${xr}@^1`,us=de(".vis",".vite-client-override-declined"),qt="pnpm-workspace.yaml",Ia=["dependencies","devDependencies","optionalDependencies","peerDependencies"],fs=De(r=>{try{return JSON.parse(dt(r,"utf8"))}catch{return}},"readPackageJson"),Oa=De(r=>{const e=de(r,qt);if(_e(e))try{return Zn(dt(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),Ma=De(r=>r==="pnpm"||r==="aube"?"pnpm.overrides":r==="yarn"?"resolutions":"overrides","overrideFieldFor"),Ea=De(r=>{const e=de(r,qt);try{const t=Zn(dt(e,"utf8"));return t.setIn(["overrides",je],Gt),$r(e,t.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),Mn=De(r=>r!==void 0&&Ia.some(e=>r[e]?.[je]!==void 0),"isDependency"),Ra=De((r,e)=>r!==void 0&&(r.pnpm?.overrides?.[je]!==void 0||r.overrides?.[je]!==void 0||r.resolutions?.[je]!==void 0)||e?.[je]!==void 0,"isAlreadyOverridden"),ja=De((r,e=[])=>{const t=fs(de(r,"package.json")),n=_e(de(r,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:Ra(t,Oa(r)),declined:_e(de(r,us)),manager:ds(r)?.manager,present:Mn(t)||n||e.some(s=>Mn(s))}},"detectViteClientOverride"),Pa=De(r=>{try{const e=de(r,us);ro(Ti(e),{recursive:!0}),$r(e,`Declined adding the ${je} → ${xr} override.
1
+ var ci=Object.defineProperty;var m=(t,e)=>ci(t,"name",{value:e,configurable:!0});import{createRequire as li}from"node:module";import{M as ue,K as di,Q as fi,$ as hi}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{bR as qs,r as K,a5 as a,a6 as $,n as u,bS as pi,c as $e,d as te,aG as Us,aI as gi,aF as mi,af as cs,aJ as vi,aK as wi,v as yi,L as _t,M as lr,bT as $i,bU as bi,x as Ot,bV as ki,I as xi,C as ji,S as Si,bW as Ti,bX as Ci,s as pt,bY as Ii,aM as Mi,bZ as Ri,b_ as Oi,b$ as Ei,c0 as Pi,X as Fi,c1 as Ai}from"./bin.js";import{buildEnhancedPath as Li,runConcurrently as Et,TerminalBuffer as ur,readLastRunSummary as Di,getLastRunSummaryPath as Bi,enforceProjectConstraints as _i,expandTokensInString as ls,parsePartition as Ni,TaskScheduler as Gi,createTaskGraph as qi,reverseTaskGraph as Ui,generateRunSummary as us,writeChromeTrace as zi,resolveTurboEnvCompat as Hi,CompositeLifeCycle as ds,defaultTaskRunner as fs,createLogReporter as Wi,writeRunSummary as Vi}from"@visulima/task-runner";import{F as eo}from"../packem_shared/failure-log-C3bG1bCA.js";import{r as to}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as ro,a as so,b as no,s as io,d as oo,c as ao,r as co,H as lo,f as uo,e as fo}from"../packem_shared/lifecycle-B91p_ra8.js";import{p as ho,r as po,f as go}from"../packem_shared/selectors-BE2BCnTR.js";import{T as Hs,C as fr,D as Nt,E as Ws}from"../packem_shared/symbols-CQmER5MT.js";import{q as $o,j as bo,T as Yt,E as ps}from"../packem_shared/Table-CwC2kW07-EjFLNV0q.js";import{n as Vs}from"../packem_shared/spinner-B9ZPv1iT.js";import{c as gs,a as To,s as ms}from"../packem_shared/watch-BSVsZ_1I.js";import{B as Ks}from"./config.js";const ui=li(import.meta.url),ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=m(t=>{if(typeof ht<"u"&&ht.versions&&ht.versions.node){const[e,r]=ht.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ht.getBuiltinModule(t)}return ui(t)},"__cjs_getBuiltinModule"),{existsSync:Ne,statSync:Pt,readFileSync:at,writeFileSync:dr,mkdirSync:Ki,openSync:Yi,readSync:Ji,closeSync:Xi,mkdtempSync:Qi}=Ge("node:fs"),{createInterface:zs,emitKeypressEvents:Zi}=Ge("node:readline"),{isAbsolute:mo,resolve:hs,dirname:vo,relative:wo}=Ge("node:path"),{fileURLToPath:yo}=Ge("node:url"),{createRequire:ko}=Ge("node:module"),{createHash:xo}=Ge("node:crypto"),{appendFile:hr}=Ge("node:fs/promises"),{platform:jo,homedir:pr,tmpdir:So}=Ge("node:os"),{spawn:Co}=Ge("node:child_process");var Io=Object.defineProperty,Mo=m((t,e)=>Io(t,"name",{value:e,configurable:!0}),"u$5"),Ro=Object.defineProperty,Oo=Mo((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"v"),Eo=Object.defineProperty,Po=Oo((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"D");const Fo=Po((t,e,r,s,n,o,i,c,d,h,f,p,l,g)=>{const w={d:s,h:n,m:o,mo:e,ms:c,s:i,w:r,y:t};return d!==void 0&&(w.future=d),h!==void 0&&(w.past=h),f!==void 0&&(w.decimal=f),p!==void 0&&(w.unitMap=p),l!==void 0&&(w.groupSeparator=l),g!==void 0&&(w.placeholderSeparator=g),w},"createDurationLanguage"),Ao={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"},Lo=Fo(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",Ao,",","_");var Do=Object.defineProperty,Bo=m((t,e)=>Do(t,"name",{value:e,configurable:!0}),"o$4"),_o=Object.defineProperty,No=Bo((t,e)=>_o(t,"name",{value:e,configurable:!0}),"o"),Go=Object.defineProperty,qo=No((t,e)=>Go(t,"name",{value:e,configurable:!0}),"o");const Uo=qo(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(t,s))throw new TypeError(`Missing required property: ${s}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const s of r)if(typeof t[s]!="string"&&typeof t[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var zo=Object.defineProperty,Ho=m((t,e)=>zo(t,"name",{value:e,configurable:!0}),"b$6"),Wo=Object.defineProperty,Vo=Ho((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"b"),Ko=Object.defineProperty,$t=Vo((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"g");const Ys=$t((t,e)=>{e=e||-1;const r=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(t.toString());return r===null?t:Number.parseFloat(r[0])},"toFixed"),vs=$t(({unitCount:t,unitName:e},r,s)=>{let{spacer:n}=s;const{maxDecimalPoints:o}=s;let i=".";s.decimal!==void 0?i=s.decimal:r.decimal!==void 0&&(i=r.decimal);let c;"digitReplacements"in s?c=s.digitReplacements:"_digitReplacements"in r&&(c=r._digitReplacements);let d,h=t;o!==void 0&&(h=Ys(t,o));const f=h.toString();if(!r._hideCountIf2||t!==2)if(c){d="";for(const g of f)d+=g==="."?i:c[g]}else d=f.replace(".",i);else d="";const p=r[e];let l=p;return typeof p=="function"&&(l=p(t)),r._hideCountIf2&&t===2&&(n=""),r._numberFirst?l+n+d:d+n+l},"renderPiece"),Yo=$t((t,e)=>{const{units:r}=e;if(r.length===0)return[];const{unitMeasures:s}=e,n=e.largest??Number.POSITIVE_INFINITY,o={};let i,c,d,h=t;for(c=0;c<r.length;c++){i=r[c];const p=s[i];d=c===r.length-1?h/p:Math.floor(h/p),o[i]=d,h-=d*p}if(e.round){let p=n;for(c=0;c<r.length;c++)if(i=r[c],d=o[i],d!==0&&(p--,p===0)){for(let l=c+1;l<r.length;l++){const g=r[l],w=o[g];o[i]=(o[i]??0)+w*s[g]/s[i],o[g]=0}break}for(c=r.length-1;c>=0;c--){if(i=r[c],d=o[i],d===0)continue;const l=Math.round(d);if(o[i]=l,c===0)break;const g=r[c-1],w=s[g],I=Math.floor(l*s[i]/w);if(I)o[g]=(o[g]??0)+I,o[i]=0;else break}}const f=[];for(c=0;c<r.length&&f.length<n;c++){if(i=r[c],d=o[i],d&&!e.round&&f.length===n-1){let p,l=0;for(p=c+1,r.length;p<r.length;p++){const g=r[p];l+=o[g]*(e.unitMeasures[g]/e.unitMeasures[i])}d+=l,e.maxDecimalPoints!==void 0&&(d=Ys(d,e.maxDecimalPoints))}d&&f.push({unitCount:d,unitName:i})}return f},"getPieces"),Jo=$t((t,e,r)=>{const{language:s,units:n}=e;if(t.length===0){const p=n.at(-1);return vs({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:i}=e;let c=", ";e.delimiter!==void 0?c=e.delimiter:s.delimiter!==void 0&&(c=s.delimiter);let d="";e.timeAdverb&&r!==0&&(d=s.future??"",r<0&&(d=s.past??""));const h=t.map(p=>vs(p,s,e));let f;return!o||t.length===1?f=h.join(c):t.length===2?f=h.join(o):f=h.slice(0,-1).join(c)+(i?",":"")+o+(h.at(-1)??""),d&&(f=d.replace("%s",f)),f},"formatPieces"),Js=$t((t,e)=>{if(Number.isNaN(t))throw new TypeError("Expected a valid number");if(typeof t!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Lo,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};Uo(r.language);const s=Math.abs(t),n=Yo(s,r);return Jo(n,r,t)},"duration");var Xo=Object.defineProperty,Xs=m((t,e)=>Xo(t,"name",{value:e,configurable:!0}),"u$4"),Qo=Object.defineProperty,gr=Xs((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"u"),Zo=Object.defineProperty,ea=gr((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"e");function Gt({onlyFirst:t=!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,t?void 0:"g")}m(Gt,"n$2");Xs(Gt,"a");gr(Gt,"t");ea(Gt,"ansiRegex");var ta=Object.defineProperty,ra=gr((t,e)=>ta(t,"name",{value:e,configurable:!0}),"r");const sa=Gt(),na=/\u001B\]0;.*\u0007/,ia=ra(t=>t.replace(na,"").replace(sa,""),"strip");var oa=Object.defineProperty,qt=m((t,e)=>oa(t,"name",{value:e,configurable:!0}),"s$3");const aa={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},ca={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"]},la={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"}},ua=1e3,Qs=qt(t=>{for(const[e,r]of Object.entries(aa))for(const s of r)if(Ne(ue(t,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),da=qt((t,e)=>{let r;for(const s of ca[e]){const n=ue(t,s);if(!Ne(n))continue;const{mtimeMs:o}=Pt(n);(!r||o>r.mtimeMs)&&(r={mtimeMs:o,path:s})}return r},"findFreshestMarker"),fa=qt((t,e={})=>{const r=Qs(t);if(!r)return{checked:!1};const{lockfileFile:s,manager:n}=r,o=Pt(ue(t,s)).mtimeMs,i=da(t,n),c=la[e.inCi?"ci":"tty"][n],d={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:o,lockfilePath:s,marker:i?.path,packageManager:n};return i?o>i.mtimeMs+ua?{checked:!0,detail:d,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${c}\` to sync.`}:{checked:!0,detail:d}:{checked:!0,detail:d,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${c}\` before \`vis run\`.`}},"checkLockfileFreshness"),ha=qt((t,e,r,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const n=fa(t,{inCi:e});if(!n.failure)return{...n,shouldContinue:!0};const o=`preflight: ${n.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...n,formattedMessage:o,shouldContinue:!1}:(r.warn(o),{...n,formattedMessage:o,shouldContinue:!0})},"runLockfilePreflight");var pa=Object.defineProperty,De=m((t,e)=>pa(t,"name",{value:e,configurable:!0}),"t$2");const Ee="@voidzero-dev/vite-task-client",mr="@visulima/task-runner-client",Ft=`npm:${mr}@^1`,Zs=ue(".vis",".vite-client-override-declined"),At="pnpm-workspace.yaml",ga=["dependencies","devDependencies","optionalDependencies","peerDependencies"],en=De(t=>{try{return JSON.parse(at(t,"utf8"))}catch{return}},"readPackageJson"),ma=De(t=>{const e=ue(t,At);if(Ne(e))try{return qs(at(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),va=De(t=>t==="pnpm"||t==="aube"?"pnpm.overrides":t==="yarn"?"resolutions":"overrides","overrideFieldFor"),wa=De(t=>{const e=ue(t,At);try{const r=qs(at(e,"utf8"));return r.setIn(["overrides",Ee],Ft),dr(e,r.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),ws=De(t=>t!==void 0&&ga.some(e=>t[e]?.[Ee]!==void 0),"isDependency"),ya=De((t,e)=>t!==void 0&&(t.pnpm?.overrides?.[Ee]!==void 0||t.overrides?.[Ee]!==void 0||t.resolutions?.[Ee]!==void 0)||e?.[Ee]!==void 0,"isAlreadyOverridden"),$a=De((t,e=[])=>{const r=en(ue(t,"package.json")),s=Ne(ue(t,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ya(r,ma(t)),declined:Ne(ue(t,Zs)),manager:Qs(t)?.manager,present:ws(r)||s||e.some(n=>ws(n))}},"detectViteClientOverride"),ba=De(t=>{try{const e=ue(t,Zs);Ki(di(e),{recursive:!0}),dr(e,`Declined adding the ${Ee} → ${mr} override.
2
2
  Delete this file to be asked again.
3
- `)}catch{}},"recordDecline"),Fa=De((r,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&_e(de(r,qt))&&Ea(r))return{file:qt,installCommand:t};const n=de(r,"package.json"),s=fs(n);if(!s)return;const o=Ma(e);o==="pnpm.overrides"?(s.pnpm??={},s.pnpm.overrides??={},s.pnpm.overrides[je]=Gt):(s[o]??={},s[o][je]=Gt);try{$r(n,`${JSON.stringify(s,void 0,4)}
4
- `)}catch{return}return{file:"package.json",installCommand:t}},"applyViteClientOverride"),Aa=De(async(r,e)=>{const t=ja(r,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined||!e.interactive)return!1;const n=es({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${je}. Its cache hints no-op under @visulima/task-runner unless aliased to ${xr} (a drop-in replacement).`);const s=await new Promise(i=>{n.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(s.trim()))return Pa(r),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=Fa(r,t.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${je}": "${Gt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{n.close()}},"maybePromptViteClientOverride");var La=Object.defineProperty,Da=v((r,e)=>La(r,"name",{value:e,configurable:!0}),"t$1");const Ba=Da(({interactive:r,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:r&&t!==!1,"decidePty");var Na=Object.defineProperty,hs=v((r,e)=>Na(r,"name",{value:e,configurable:!0}),"f$8");const _a=hs(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),Ga=hs((r,e,t)=>{const n=new Set,s=[];if(r===void 0||r.trim()==="")return{skipTaskIds:n,unmatchedPatterns:s};const o=[...t],i=new Set(o),a=new Map;for(const l of o){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 _a(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(i.has(l)){n.add(l);continue}const f=ko(l);if(!f){s.push(l);continue}let u=!1;switch(f.kind){case"all":{const p=a.get(f.target)??[];for(const c of p)n.add(c),u=!0;break}case"project":{const p=f.projects?.[0];if(p!==void 0){const c=`${p}:${f.target}`;i.has(c)&&(n.add(c),u=!0)}break}case"tag":{const{tag:p}=f;if(p!==void 0){const c=a.get(f.target)??[];for(const m of c){const y=m.slice(0,m.lastIndexOf(":"));e.projects[y]?.tags?.includes(p)===!0&&(n.add(m),u=!0)}}break}}u||s.push(l)}return{skipTaskIds:n,unmatchedPatterns:s}},"resolveSkipCachePatterns");var qa=Object.defineProperty,Cr=v((r,e)=>qa(r,"name",{value:e,configurable:!0}),"a$3");const Ua=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Wa=new Set(["0","!","#","$","*","-","?","@","_"]),za=Cr(r=>{const e=new Map;for(const t of r.matchAll(Ua)){const n=t[1],s=t[3],o=t[2],i=n??s;if(i===void 0||Wa.has(i))continue;const a=o!==void 0,l=e.get(i);l===void 0?e.set(i,a):l&&!a&&e.set(i,!1)}return[...e.entries()].map(([t,n])=>({hasDefault:n,name:t}))},"extractEnvReferences"),Ha=Cr(r=>{const{command:e,processEnv:t,taskEnv:n,taskId:s}=r,o=za(e);if(o.length===0)return;const i=[];for(const{hasDefault:a,name:l}of o){if(a)continue;const f=n[l],u=t[l];f===void 0&&u===void 0&&i.push(l)}if(i.length!==0)return{missing:i.toSorted(),taskId:s}},"checkStrictEnv"),Va=Cr(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=v((r,e)=>Ka(r,"name",{value:e,configurable:!0}),"i$4");const En=Ke(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const n of Object.keys(t.targets??{}))e.add(n);return[...e].sort()},"collectAvailableTargets"),Ja=Ke(r=>{const e=new Map;for(const t of r.values())for(const[n,s]of Object.entries(t))for(const o of s.aliases??[])e.has(o)||e.set(o,n);return e},"buildAliasMap"),Ya=Ke((r,e)=>e.get(r)??r,"resolveTargetAlias"),Qa=Ke((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let n=0;n<=e.length;n++)t[n]=[n];for(let n=0;n<=r.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let s=1;s<=r.length;s++){const o=e[n-1]===r[s-1]?0:1;t[n][s]=Math.min(t[n-1][s]+1,t[n][s-1]+1,t[n-1][s-1]+o)}return t[e.length][r.length]},"levenshtein"),Xa=Ke((r,e,t=3)=>ps(r,e,1,t)[0],"suggestTarget"),ps=Ke((r,e,t=3,n=3)=>{const s=[];for(const o of e){const i=Qa(r.toLowerCase(),o.toLowerCase());i<=n&&s.push({distance:i,name:o})}return s.sort((o,i)=>o.distance-i.distance||o.name.localeCompare(i.name)),s.slice(0,t).map(o=>o.name)},"suggestTargets"),Za=Ke(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
5
- `),"formatTargetList"),ec=Ke(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=es({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
6
- `);for(const[s,o]of r.entries())process.stdout.write(` ${String(s+1).padStart(2," ")}. ${o}
3
+ `)}catch{}},"recordDecline"),ka=De((t,e="npm")=>{const r=`${e} install`;if((e==="pnpm"||e==="aube")&&Ne(ue(t,At))&&wa(t))return{file:At,installCommand:r};const s=ue(t,"package.json"),n=en(s);if(!n)return;const o=va(e);o==="pnpm.overrides"?(n.pnpm??={},n.pnpm.overrides??={},n.pnpm.overrides[Ee]=Ft):(n[o]??={},n[o][Ee]=Ft);try{dr(s,`${JSON.stringify(n,void 0,4)}
4
+ `)}catch{return}return{file:"package.json",installCommand:r}},"applyViteClientOverride"),xa=De(async(t,e)=>{const r=$a(t,e.projectManifests);if(!r.present||r.alreadyOverridden||r.declined||!e.interactive)return!1;const s=zs({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${Ee}. Its cache hints no-op under @visulima/task-runner unless aliased to ${mr} (a drop-in replacement).`);const n=await new Promise(i=>{s.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(n.trim()))return ba(t),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=ka(t,r.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${Ee}": "${Ft}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{s.close()}},"maybePromptViteClientOverride");var ja=Object.defineProperty,Sa=m((t,e)=>ja(t,"name",{value:e,configurable:!0}),"t$1");const Ta=Sa(({interactive:t,taskPty:e,workspacePty:r})=>e===!0?!0:e===!1?!1:t&&r!==!1,"decidePty");var Ca=Object.defineProperty,tn=m((t,e)=>Ca(t,"name",{value:e,configurable:!0}),"f$8");const Ia=tn(t=>t.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),Ma=tn((t,e,r)=>{const s=new Set,n=[];if(t===void 0||t.trim()==="")return{skipTaskIds:s,unmatchedPatterns:n};const o=[...r],i=new Set(o),c=new Map;for(const d of o){const h=d.lastIndexOf(":");if(h===-1)continue;const f=d.slice(h+1),p=c.get(f);p===void 0?c.set(f,[d]):p.push(d)}for(const d of Ia(t)){if(d.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${d}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(d)){s.add(d);continue}const h=ho(d);if(!h){n.push(d);continue}let f=!1;switch(h.kind){case"all":{const p=c.get(h.target)??[];for(const l of p)s.add(l),f=!0;break}case"project":{const p=h.projects?.[0];if(p!==void 0){const l=`${p}:${h.target}`;i.has(l)&&(s.add(l),f=!0)}break}case"tag":{const{tag:p}=h;if(p!==void 0){const l=c.get(h.target)??[];for(const g of l){const w=g.slice(0,g.lastIndexOf(":"));e.projects[w]?.tags?.includes(p)===!0&&(s.add(g),f=!0)}}break}}f||n.push(d)}return{skipTaskIds:s,unmatchedPatterns:n}},"resolveSkipCachePatterns");var Ra=Object.defineProperty,vr=m((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"a$3");const Oa=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Ea=new Set(["0","!","#","$","*","-","?","@","_"]),Pa=vr(t=>{const e=new Map;for(const r of t.matchAll(Oa)){const s=r[1],n=r[3],o=r[2],i=s??n;if(i===void 0||Ea.has(i))continue;const c=o!==void 0,d=e.get(i);d===void 0?e.set(i,c):d&&!c&&e.set(i,!1)}return[...e.entries()].map(([r,s])=>({hasDefault:s,name:r}))},"extractEnvReferences"),Fa=vr(t=>{const{command:e,processEnv:r,taskEnv:s,taskId:n}=t,o=Pa(e);if(o.length===0)return;const i=[];for(const{hasDefault:c,name:d}of o){if(c)continue;const h=s[d],f=r[d];h===void 0&&f===void 0&&i.push(d)}if(i.length!==0)return{missing:i.toSorted(),taskId:n}},"checkStrictEnv"),Aa=vr(t=>{const e=t.missing.map(r=>`$${r}`).join(", ");return`Strict env: ${t.taskId} references unset variable${t.missing.length===1?"":"s"} ${e}. Set ${t.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var La=Object.defineProperty,Ve=m((t,e)=>La(t,"name",{value:e,configurable:!0}),"i$4");const ys=Ve(t=>{const e=new Set;for(const r of Object.values(t.projects))for(const s of Object.keys(r.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Da=Ve(t=>{const e=new Map;for(const r of t.values())for(const[s,n]of Object.entries(r))for(const o of n.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),Ba=Ve((t,e)=>e.get(t)??t,"resolveTargetAlias"),_a=Ve((t,e)=>{if(t.length===0)return e.length;if(e.length===0)return t.length;const r=[];for(let s=0;s<=e.length;s++)r[s]=[s];for(let s=0;s<=t.length;s++)r[0][s]=s;for(let s=1;s<=e.length;s++)for(let n=1;n<=t.length;n++){const o=e[s-1]===t[n-1]?0:1;r[s][n]=Math.min(r[s-1][n]+1,r[s][n-1]+1,r[s-1][n-1]+o)}return r[e.length][t.length]},"levenshtein"),Na=Ve((t,e,r=3)=>rn(t,e,1,r)[0],"suggestTarget"),rn=Ve((t,e,r=3,s=3)=>{const n=[];for(const o of e){const i=_a(t.toLowerCase(),o.toLowerCase());i<=s&&n.push({distance:i,name:o})}return n.sort((o,i)=>o.distance-i.distance||o.name.localeCompare(i.name)),n.slice(0,r).map(o=>o.name)},"suggestTargets"),Ga=Ve(t=>t.length===0?" (no targets found)":t.map(e=>` - ${e}`).join(`
5
+ `),"formatTargetList"),qa=Ve(async t=>{if(t.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=zs({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
6
+ `);for(const[n,o]of t.entries())process.stdout.write(` ${String(n+1).padStart(2," ")}. ${o}
7
7
  `);process.stdout.write(`
8
- `);const t=(await new Promise(s=>{e.question("Select a target (number or name, blank to cancel): ",s)})).trim();if(t.length===0)return;const n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=1&&n<=r.length?r[n-1]:r.includes(t)?t:Xa(t,r)}finally{e.close()}},"promptTargetInteractively");var tc=Object.defineProperty,Lt=v((r,e)=>tc(r,"name",{value:e,configurable:!0}),"n$1");const rc=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),ir=Lt(r=>r.replaceAll(rc,"").replaceAll("\r",""),"sanitizeLogLine");class Rn{static{v(this,"ServiceDockStore")}static{Lt(this,"ServiceDockStore")}#e=[];#n=new Set;#r=new Map;#s=new Map;constructor(e=[]){for(const t of e)this.#s.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=Lt(()=>this.#r,"getSnapshot");subscribe=Lt(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#s.get(e)}getDockState(){let e=!1,t=!1;for(const n of this.#s.values())n.status==="crashed"||n.status==="failed"?e=!0:(n.status==="pending"||n.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#s.has(e)||(this.#s.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,n=>({...n,startedAt:n.startedAt??Date.now(),status:n.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,n=>({...n,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,n){const s=n?.message;this.#t(e,o=>({...o,errorMessage:ir(s??t),status:"failed"}))}markCrashed(e,t){const n=t.slice(-256).map(s=>ir(s));this.#t(e,s=>({...s,errorMessage:n.length>0?n[n.length-1]:"process exited",status:"crashed",tailLines:n}))}appendLog(e,t){const n=t.split(`
9
- `).map(s=>ir(s)).filter(s=>s.length>0);n.length!==0&&this.#t(e,s=>{const o=[...s.tailLines,...n];for(;o.length>256;)o.shift();let i=0;for(let a=o.length-1;a>=0;a--)if(i+=o[a].length+1,i>65536){o.splice(0,a+1);break}return{...s,lastLine:n[n.length-1],tailLines:o}})}abortBoot(e){let t=!1;const n=new Map(this.#s);for(const[s,o]of n)(o.status==="pending"||o.status==="starting")&&(n.set(s,{...o,errorMessage:e,status:"failed"}),t=!0);t&&(this.#s=n,this.#i(),this.#o())}#t(e,t){const n=this.#s.get(e);n&&(this.#s.set(e,t(n)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#s)}#o(){for(const e of this.#n)try{e()}catch{}}}var nc=Object.defineProperty,Ir=v((r,e)=>nc(r,"name",{value:e,configurable:!0}),"i$3");const sc=Ir(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),ic=Ir((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${sc(t)}`,"formatFlags"),Or=Ir((r,e,t)=>{const n=new Set(new Set(t.map(c=>c.target.target))),s=new Set(new Set(t.map(c=>c.target.project))),o=e.filter(c=>n.has(c)),i=r.filter(c=>s.has(c)),a=t.length-i.length*o.length,l=o.length===1?"target":"targets",f=o.join(", "),u=i.length===1?`project ${i[0]}`:`${i.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 oc=Object.defineProperty,ac=v((r,e)=>oc(r,"name",{value:e,configurable:!0}),"c$4");const cc={error:"red",info:"white",success:"green"},ur=ac(({children:r,title:e,variant:t})=>{const n=cc[t];return g(k,{flexDirection:"column",children:[g(k,{gap:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{bold:!0,color:n,children:"•"}),h(d,{children:e})]}),r]})},"Header");var lc=Object.defineProperty,dc=v((r,e)=>lc(r,"name",{value:e,configurable:!0}),"T$7");const gs=dc(({cached:r,failed:e,failedIds:t,projectNames:n,retriedIds:s,skippedIds:o,succeeded:i,targets:a,tasks:l,took:f})=>{const u=Or(n,a,l),p=s??[];if(e===0&&(!o||o.length===0)){const c=r>0?` (${r} read from cache)`:"";return h(bn,{children:v(()=>h(ur,{title:`Successfully ran ${u}`,variant:"success",children:g(k,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[g(d,{children:[h(d,{color:"green",children:rs})," ",i+r," tasks completed",c?h(d,{dimColor:!0,children:c}):null,h(d,{dimColor:!0,children:` · Took ${f}`})]}),p.length>0&&g(k,{flexDirection:"column",marginTop:1,children:[g(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(m=>g(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",m]},m))]})]})}),"children")})}return h(bn,{children:v(()=>h(ur,{title:`Ran ${u}`,variant:"error",children:g(k,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&g(k,{flexDirection:"column",children:[g(d,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(c=>g(d,{dimColor:!0,children:[" - ",c]},c)),h(d,{})]}),e>0&&g(k,{flexDirection:"column",children:[g(d,{children:[h(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(c=>g(d,{children:[" ",h(d,{color:"red",children:kr})," ",c]},c)),h(d,{})]}),p.length>0&&g(k,{flexDirection:"column",children:[g(d,{children:[h(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(c=>g(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",c]},c)),h(d,{})]}),h(d,{dimColor:!0,children:` Took ${f}`})]})}),"children")})},"CommandSummary");var uc=Object.defineProperty,or=v((r,e)=>uc(r,"name",{value:e,configurable:!0}),"o$2");class Ut{static{v(this,"TaskStore")}static{or(this,"TaskStore")}#e;#n=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=or(()=>this.#e,"getSnapshot");subscribe=or(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const n of e){const s=t.findIndex(o=>o.taskId===n.id);s!==-1&&(t[s]={...t[s],elapsed:0,status:"running"},this.#r.set(n.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:n,completed:s,failed:o,succeeded:i}=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),s++,u.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{n++;break}case"success":{i++;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(o>this.#e.failed){const u=t.findIndex(p=>p.status==="failure");u!==-1&&(f=u)}this.#t({...this.#e,cached:n,completed:s,failed:o,outputs:a,retriedIds:l,rows:t,selectedIndex:f,succeeded:i})}static#s=256*1024;addOutput(e,t){if(!t.trim())return;let n=(this.#e.outputs.get(e)??"")+t;n.length>Ut.#s&&(n=n.slice(-Ut.#s)),this.#e.outputs.set(e,n),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 n=0;n<t.length;n++){const s=t[n];if(s.status==="running"){const o=this.#r.get(s.taskId);if(o){const i=process.hrtime(o),a=i[0]*1e3+i[1]/1e6;t[n]={...s,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 n=[...this.#e.pinnedTaskIds];n[e]=t,this.#t({...this.#e,pinnedTaskIds:n})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],n=t.findIndex(a=>a.taskId===e);let{completed:s,failed:o,succeeded:i}=this.#e;if(n!==-1){const a=t[n].status;a==="failure"?(o=Math.max(0,o-1),s=Math.max(0,s-1)):a==="success"&&(i=Math.max(0,i-1),s=Math.max(0,s-1)),t[n]={...t[n],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:s,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(a=>a!==e),retryTaskId:e,rows:t,succeeded:i})}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.#n)try{t()}catch{}}}var fc=Object.defineProperty,hc=v((r,e)=>fc(r,"name",{value:e,configurable:!0}),"A$4"),pc=Object.defineProperty,Mr=hc((r,e)=>pc(r,"name",{value:e,configurable:!0}),"$"),gc=Object.defineProperty,mc=Mr((r,e)=>gc(r,"name",{value:e,configurable:!0}),"r$1");const vc=mc(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
10
- `),"normalizeLF"),yc=globalThis.process??Object.create(null),jn={versions:{}},Pn=new Proxy(yc,{get(r,e){if(e in r)return r[e];if(e in jn)return jn[e]}});var wc=Object.defineProperty,$c=Mr((r,e)=>wc(r,"name",{value:e,configurable:!0}),"b");const kc=$c((r,e,t,n)=>{const s={column:0,line:-1,...r.start},o={...s,...r.end},i=s.line,a=s.column,l=o.line,f=o.column;let u=Math.max(i-(t+1),0),p=Math.min(e.length,l+n);i===-1&&(u=0),l===-1&&(p=e.length);const c=l-i,m={};if(c)for(let y=0;y<=c;y++){const M=y+i;if(!a)m[M]=!0;else if(y===0){const D=e[M-1]?.length;m[M]=[a,(D??0)-a+1]}else if(y===c)m[M]=[0,f];else{const D=e[M-y]?.length;m[M]=[0,D]}}else a===f?m[i]=a?[a,0]:!0:m[i]=[a,(f??0)-(a??0)];return{end:p,markerLines:m,start:u}},"getMarkerLines");var bc=Object.defineProperty,Pt=Mr((r,e)=>bc(r,"name",{value:e,configurable:!0}),"t");const Sc=Pn.platform==="win32"&&!Pn.env?.WT_SESSION?">":"❯",Tc=Pt((r,e,t)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:Pt(y=>y,"gutter"),marker:Pt(y=>y,"marker"),message:Pt(y=>y,"message"),...t?.color}},s=typeof e.start.column=="number";let o=vc(r).split(`
11
- `);typeof n.tabWidth=="number"&&(o=o.map(y=>y.replaceAll(" "," ".repeat(n.tabWidth))));const{end:i,markerLines:a,start:l}=kc(e,o,n.linesAbove,n.linesBelow),f=String(i).length,{gutter:u,marker:p,message:c}=n.color;let m=o.slice(l,i).map((y,M)=>{const D=l+1+M,b=a[D],S=` ${String(D)}`.slice(-f),R=!a[D+1],x=` ${S}${n.showGutter?" |":""}`;if(b){let O="";if(Array.isArray(b)){const w=y.replaceAll(/[^\t]/g," ").slice(0,Math.max(b[0]-1,0)),T=b[1]||1;O=[`
12
- `,n.prefix+u(x.replaceAll(/\d/g," "))," ",w,p("^").repeat(T)].join(""),R&&n.message&&(O+=` ${c(n.message)}`)}return[n.prefix+p(Sc),u(x),y.length>0?` ${y}`:"",O].join("")}return`${n.prefix} ${u(x)}${y.length>0?` ${y}`:""}`}).join(`
13
- `);return n.message&&!s&&(m=`${n.prefix+" ".repeat(f+1)+n.message}
14
- ${m}`),m},"codeFrame");var xc=Object.defineProperty,Cc=v((r,e)=>xc(r,"name",{value:e,configurable:!0}),"x$3"),Ic=Object.defineProperty,Oc=Cc((r,e)=>Ic(r,"name",{value:e,configurable:!0}),"x"),Mc=Object.defineProperty,qe=Oc((r,e)=>Mc(r,"name",{value:e,configurable:!0}),"u");const tt=qe((r,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),rt="<unknown>",Ec=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rc=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,jc=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Pc=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Fc=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Ac=/in\s(.*)\s\(at\s(.+)\)\sat/,Lc=/^(?:.*@)?(.*):(\d+):(\d+)$/,Dc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Bc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Nc=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Fn=/\(error: (.*)\)/,_c=/at\s/,Gc=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,qc=/\S*(?:Error: |AggregateError:)/,ms=/^Anonymous function$/,Uc=/^\s*in\s.*/,Wc=/^.*?\s*at\s.*/,zc=/^.*?\s*@.*|\[native code\]/,vs=qe((r,e)=>{const t=r.includes("safari-extension"),n=r.includes("safari-web-extension");return t||n?[r.includes("@")?r.split("@")[0]:rt,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),ys=qe((r,e)=>{const t=jc.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),Hc=qe(r=>{const e=Ac.exec(r);if(e){tt(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const n=e[2].split(":");return{column:n[2]?+n[2]:void 0,file:n[0],line:n[1]?+n[1]:void 0,methodName:e[1]??rt,raw:r,type:void 0}}const t=Fc.exec(r);if(t){tt(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const n={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(_c,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??rt,raw:r,type:r.startsWith("internal")?"internal":void 0};return ys(n,`${t[2]}:${t[3]}:${t[4]}`),n}},"parseNode"),Vc=qe(r=>{const e=Ec.exec(r);if(e){tt(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),n=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,o;if(n){const f=Rc.exec(r);if(f){const u=Gc.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]&&(s={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=Pc.exec(r);u&&(o={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},s={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[i,a]=vs(e[1]?e[1].replace(ms,"<anonymous>"):rt,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:i,raw:r,type:n?"eval":t?"native":void 0};return o?(l.column=o.column,l.file=o.file,l.line=o.line):ys(l,`${a}:${e[3]}:${e[4]}`),l}},"parseChromium"),Kc=qe((r,e)=>{const t=Dc.exec(r);if(t){tt(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const n=t[3]?.includes(" > eval"),s=n&&t[3]&&Bc.exec(t[3]);let o;n&&s&&(t[3]=s[1],o={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]=s[2]);const[i,a]=vs(t[1]?t[1].replace(ms,"<anonymous>"):rt,t[3]);let l;(e?.type==="safari"||!n&&e?.type==="firefox")&&e.column?l=e.column:!n&&t[5]&&(l=+t[5]);let f;return(e?.type==="safari"||!n&&e?.type==="firefox")&&e.line?f=e.line:t[4]&&(f=+t[4]),{column:l,evalOrigin:o,file:a,line:f,methodName:i,raw:r,type:n?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Jc=qe((r,e)=>{const t=Nc.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return tt(`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]||rt,raw:r,type:void 0}},"parseFirefox"),Yc=qe(r=>{const e=Lc.exec(r);if(e)return tt(`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:rt,raw:r,type:void 0}},"parseReactAndroidNative"),Qc=qe((r,{filter:e,frameLimit:t=50}={})=>{const n=r;let s=(typeof n.stacktrace=="string"?n.stacktrace:r.stack??"").split(`
15
- `).map(o=>(Fn.test(o)?o.replace(Fn,"$1"):o).trim()).filter(o=>!qc.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,t),s.reduce((o,i,a)=>{if(!i||i.length>1024)return o;let l;if(Uc.test(i))l=Hc(i);else if(Wc.test(i))l=Vc(i);else if(zc.test(i)){let f;if(a===0){const u=r,p=u.columnNumber,c=u.lineNumber,m=u.line,y=u.column;p||c?f={column:p,line:c,type:"firefox"}:(m||y)&&(f={column:y,line:m,type:"safari"})}l=Jc(i,f)??Kc(i,f)}else l=Yc(i);return l?o.push(l):tt(`parse error stack line: "${i}"`,"not parser found"),o},[])},"parseStacktrace");var Xc=Object.defineProperty,pe=v((r,e)=>Xc(r,"name",{value:e,configurable:!0}),"C$3"),ut=44,ws=59,An="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$s=new Uint8Array(64),ks=new Uint8Array(128);for(let r=0;r<An.length;r++){const e=An.charCodeAt(r);$s[r]=e,ks[e]=r}function se(r,e){let t=0,n=0,s=0;do{const i=r.next();s=ks[i],t|=(s&31)<<n,n+=5}while(s&32);const o=t&1;return t>>>=1,o&&(t=-2147483648|-t),e+t}v(se,"h$4");pe(se,"decodeInteger");function ee(r,e,t){let n=e-t;n=n<0?-n<<1|1:n<<1;do{let s=n&31;n>>>=5,n>0&&(s|=32),r.write($s[s])}while(n>0);return e}v(ee,"i$2");pe(ee,"encodeInteger");function Ne(r,e){return r.pos>=e?!1:r.peek()!==ut}v(Ne,"S$3");pe(Ne,"hasMoreVlq");var Ln=1024*16,Dn=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}},Er=class{static{v(this,"T")}static{pe(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ln)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ln&&(this.out+=Dn.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:n}=this;return n>0?t+Dn.decode(e.subarray(0,n)):t}},Rr=class{static{v(this,"w")}static{pe(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:n}=this,s=t.indexOf(e,n);return s===-1?t.length:s}},bs=[];function Zc(r){const{length:e}=r,t=new Rr(r),n=[],s=[];let o=0;for(;t.pos<e;t.pos++){o=se(t,o);const i=se(t,0);if(!Ne(t,e)){const u=s.pop();u[2]=o,u[3]=i;continue}const a=se(t,0),l=se(t,0)&1?[o,i,0,0,a,se(t,0)]:[o,i,0,0,a];let f=bs;if(Ne(t,e)){f=[];do{const u=se(t,0);f.push(u)}while(Ne(t,e))}l.vars=f,n.push(l),s.push(l)}return n}v(Zc,"z$1");pe(Zc,"decodeOriginalScopes");function el(r){const e=new Er;for(let t=0;t<r.length;)t=jr(r,t,e,[0]);return e.flush()}v(el,"F$3");pe(el,"encodeOriginalScopes");function jr(r,e,t,n){const s=r[e],{0:o,1:i,2:a,3:l,4:f,vars:u}=s;e>0&&t.write(ut),n[0]=ee(t,o,n[0]),ee(t,i,0),ee(t,f,0);const p=s.length===6?1:0;ee(t,p,0),s.length===6&&ee(t,s[5],0);for(const c of u)ee(t,c,0);for(e++;e<r.length;){const c=r[e],{0:m,1:y}=c;if(m>a||m===a&&y>=l)break;e=jr(r,e,t,n)}return t.write(ut),n[0]=ee(t,a,n[0]),ee(t,l,0),e}v(jr,"P$4");pe(jr,"_encodeOriginalScopes");function tl(r){const{length:e}=r,t=new Rr(r),n=[],s=[];let o=0,i=0,a=0,l=0,f=0,u=0,p=0,c=0;do{const m=t.indexOf(";");let y=0;for(;t.pos<m;t.pos++){if(y=se(t,y),!Ne(t,m)){const w=s.pop();w[2]=o,w[3]=y;continue}const M=se(t,0),D=M&1,b=M&2,S=M&4;let R=null,x=bs,O;if(D){const w=se(t,i);a=se(t,i===w?a:0),i=w,O=[o,y,0,0,w,a]}else O=[o,y,0,0];if(O.isScope=!!S,b){const w=l,T=f;l=se(t,l);const A=w===l;f=se(t,A?f:0),u=se(t,A&&T===f?u:0),R=[l,f,u]}if(O.callsite=R,Ne(t,m)){x=[];do{p=o,c=y;const w=se(t,0);let T;if(w<-1){T=[[se(t,0)]];for(let A=-1;A>w;A--){const F=p;p=se(t,p),c=se(t,p===F?c:0);const U=se(t,0);T.push([U,p,c])}}else T=[[w]];x.push(T)}while(Ne(t,m))}O.bindings=x,n.push(O),s.push(O)}o++,t.pos=m+1}while(t.pos<e);return n}v(tl,"H$1");pe(tl,"decodeGeneratedRanges");function rl(r){if(r.length===0)return"";const e=new Er;for(let t=0;t<r.length;)t=Pr(r,t,e,[0,0,0,0,0,0,0]);return e.flush()}v(rl,"J");pe(rl,"encodeGeneratedRanges");function Pr(r,e,t,n){const s=r[e],{0:o,1:i,2:a,3:l,isScope:f,callsite:u,bindings:p}=s;n[0]<o?(fr(t,n[0],o),n[0]=o,n[1]=0):e>0&&t.write(ut),n[1]=ee(t,s[1],n[1]);const c=(s.length===6?1:0)|(u?2:0)|(f?4:0);if(ee(t,c,0),s.length===6){const{4:m,5:y}=s;m!==n[2]&&(n[3]=0),n[2]=ee(t,m,n[2]),n[3]=ee(t,y,n[3])}if(u){const{0:m,1:y,2:M}=s.callsite;m!==n[4]?(n[5]=0,n[6]=0):y!==n[5]&&(n[6]=0),n[4]=ee(t,m,n[4]),n[5]=ee(t,y,n[5]),n[6]=ee(t,M,n[6])}if(p)for(const m of p){m.length>1&&ee(t,-m.length,0);const y=m[0][0];ee(t,y,0);let M=o,D=i;for(let b=1;b<m.length;b++){const S=m[b];M=ee(t,S[1],M),D=ee(t,S[2],D),ee(t,S[0],0)}}for(e++;e<r.length;){const m=r[e],{0:y,1:M}=m;if(y>a||y===a&&M>=l)break;e=Pr(r,e,t,n)}return n[0]<a?(fr(t,n[0],a),n[0]=a,n[1]=0):t.write(ut),n[1]=ee(t,l,n[1]),e}v(Pr,"V$1");pe(Pr,"_encodeGeneratedRanges");function fr(r,e,t){do r.write(ws);while(++e<t)}v(fr,"U$4");pe(fr,"catchupLine");function Ss(r){const{length:e}=r,t=new Rr(r),n=[];let s=0,o=0,i=0,a=0,l=0;do{const f=t.indexOf(";"),u=[];let p=!0,c=0;for(s=0;t.pos<f;){let m;s=se(t,s),s<c&&(p=!1),c=s,Ne(t,f)?(o=se(t,o),i=se(t,i),a=se(t,a),Ne(t,f)?(l=se(t,l),m=[s,o,i,a,l]):m=[s,o,i,a]):m=[s],u.push(m),t.pos++}p||Ts(u),n.push(u),t.pos=f+1}while(t.pos<=e);return n}v(Ss,"K");pe(Ss,"decode");function Ts(r){r.sort(xs)}v(Ts,"Q$1");pe(Ts,"sort");function xs(r,e){return r[0]-e[0]}v(xs,"X$3");pe(xs,"sortComparator");function Cs(r){const e=new Er;let t=0,n=0,s=0,o=0;for(let i=0;i<r.length;i++){const a=r[i];if(i>0&&e.write(ws),a.length===0)continue;let l=0;for(let f=0;f<a.length;f++){const u=a[f];f>0&&e.write(ut),l=ee(e,u[0],l),u.length!==1&&(t=ee(e,u[1],t),n=ee(e,u[2],n),s=ee(e,u[3],s),u.length!==4&&(o=ee(e,u[4],o)))}}return e.flush()}v(Cs,"Z$1");pe(Cs,"encode");var nl=Object.defineProperty,xe=v((r,e)=>nl(r,"name",{value:e,configurable:!0}),"c$3");const sl=/^[\w+.-]+:\/\//,il=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,ol=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function Is(r){return sl.test(r)}v(Is,"R$3");xe(Is,"isAbsoluteUrl");function Os(r){return r.startsWith("//")}v(Os,"q$1");xe(Os,"isSchemeRelativeUrl");function Fr(r){return r.startsWith("/")}v(Fr,"m$1");xe(Fr,"isAbsolutePath");function Ms(r){return r.startsWith("file:")}v(Ms,"v$3");xe(Ms,"isFileUrl");function hr(r){return/^[.?#]/.test(r)}v(hr,"u$1");xe(hr,"isRelative");function kt(r){const e=il.exec(r);return Ar(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}v(kt,"f$5");xe(kt,"parseAbsoluteUrl");function Es(r){const e=ol.exec(r),t=e[2];return Ar("file:","",e[1]||"","",Fr(t)?t:"/"+t,e[3]||"",e[4]||"")}v(Es,"w$4");xe(Es,"parseFileUrl");function Ar(r,e,t,n,s,o,i){return{scheme:r,user:e,host:t,port:n,path:s,query:o,hash:i,type:7}}v(Ar,"y$5");xe(Ar,"makeUrl");function pr(r){if(Os(r)){const t=kt("http:"+r);return t.scheme="",t.type=6,t}if(Fr(r)){const t=kt("http://foo.com"+r);return t.scheme="",t.host="",t.type=5,t}if(Ms(r))return Es(r);if(Is(r))return kt(r);const e=kt("http://foo.com/"+r);return e.scheme="",e.host="",e.type=r?r.startsWith("?")?3:r.startsWith("#")?2:4:1,e}v(pr,"p$4");xe(pr,"parseUrl");function Rs(r){if(r.endsWith("/.."))return r;const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(Rs,"P$3");xe(Rs,"stripPathFilename");function js(r,e){Lr(e,e.type),r.path==="/"?r.path=e.path:r.path=Rs(e.path)+r.path}v(js,"A$2");xe(js,"mergePaths");function Lr(r,e){const t=e<=4,n=r.path.split("/");let s=1,o=0,i=!1;for(let l=1;l<n.length;l++){const f=n[l];if(!f){i=!0;continue}if(i=!1,f!=="."){if(f===".."){o?(i=!0,o--,s--):t&&(n[s++]=f);continue}n[s++]=f,o++}}let a="";for(let l=1;l<s;l++)a+="/"+n[l];(!a||i&&!a.endsWith("/.."))&&(a+="/"),r.path=a}v(Lr,"d$3");xe(Lr,"normalizePath");function Ps(r,e){if(!r&&!e)return"";const t=pr(r);let n=t.type;if(e&&n!==7){const o=pr(e),i=o.type;switch(n){case 1:t.hash=o.hash;case 2:t.query=o.query;case 3:case 4:js(t,o);case 5:t.user=o.user,t.host=o.host,t.port=o.port;case 6:t.scheme=o.scheme}i>n&&(n=i)}Lr(t,n);const s=t.query+t.hash;switch(n){case 2:case 3:return s;case 4:{const o=t.path.slice(1);return o?hr(e||r)&&!hr(o)?"./"+o+s:o+s:s||"."}case 5:return t.path+s;default:return t.scheme+"//"+t.user+t.host+t.port+t.path+s}}v(Ps,"F$2");xe(Ps,"resolve");var al=Object.defineProperty,z=v((r,e)=>al(r,"name",{value:e,configurable:!0}),"i$1");function Fs(r){if(!r)return"";const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(Fs,"ae");z(Fs,"stripFilename");function As(r,e){const t=Fs(r),n=e?e+"/":"";return s=>Ps(n+(s||""),t)}v(As,"ge");z(As,"resolver");var Fe=0,Dr=1,Br=2,Nr=3,Ls=4,Ds=1,Bs=2;function Ns(r,e){const t=gr(r,0);if(t===r.length)return r;e||(r=r.slice());for(let n=t;n<r.length;n=gr(r,n+1))r[n]=Gs(r[n],e);return r}v(Ns,"he");z(Ns,"maybeSort");function gr(r,e){for(let t=e;t<r.length;t++)if(!_s(r[t]))return t;return r.length}v(gr,"X$2");z(gr,"nextUnsortedSegmentLine");function _s(r){for(let e=1;e<r.length;e++)if(r[e][Fe]<r[e-1][Fe])return!1;return!0}v(_s,"_e$1");z(_s,"isSorted");function Gs(r,e){return e||(r=r.slice()),r.sort(_r)}v(Gs,"ve");z(Gs,"sortSegments");function _r(r,e){return r[Fe]-e[Fe]}v(_r,"$$4");z(_r,"sortComparator");function qs(r,e){const t=e.map(()=>[]);for(let n=0;n<r.length;n++){const s=r[n];for(let o=0;o<s.length;o++){const i=s[o];if(i.length===1)continue;const a=i[Dr],l=i[Br],f=i[Nr],u=t[a];(u[l]||(u[l]=[])).push([f,n,i[Fe]])}}for(let n=0;n<t.length;n++){const s=t[n];for(let o=0;o<s.length;o++){const i=s[o];i&&i.sort(_r)}}return t}v(qs,"Se");z(qs,"buildBySources");var et=!1;function Us(r,e,t,n){for(;t<=n;){const s=t+(n-t>>1),o=r[s][Fe]-e;if(o===0)return et=!0,s;o<0?t=s+1:n=s-1}return et=!1,t-1}v(Us,"Ee");z(Us,"binarySearch");function Gr(r,e,t){for(let n=t+1;n<r.length&&r[n][Fe]===e;t=n++);return t}v(Gr,"H");z(Gr,"upperBound");function qr(r,e,t){for(let n=t-1;n>=0&&r[n][Fe]===e;t=n--);return t}v(qr,"Y");z(qr,"lowerBound");function Ur(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}v(Ur,"k$4");z(Ur,"memoizedState");function Ws(r,e,t,n){const{lastKey:s,lastNeedle:o,lastIndex:i}=t;let a=0,l=r.length-1;if(n===s){if(e===o)return et=i!==-1&&r[i][Fe]===e,i;e>=o?a=i===-1?0:i:l=i}return t.lastKey=n,t.lastNeedle=e,t.lastIndex=Us(r,e,a,l)}v(Ws,"Me$1");z(Ws,"memoizedBinarySearch");function Yt(r){return typeof r=="string"?JSON.parse(r):r}v(Yt,"j$3");z(Yt,"parse");var cl=z(function(r,e){const t=Yt(r);if(!("sections"in t))return new zr(t,e);const n=[],s=[],o=[],i=[],a=[];Wr(t,e,n,s,o,i,a,0,0,1/0,1/0);const l={version:3,file:t.file,names:i,sources:s,sourcesContent:o,mappings:n,ignoreList:a};return Xs(l)},"FlattenMap");function Wr(r,e,t,n,s,o,i,a,l,f,u){const{sections:p}=r;for(let c=0;c<p.length;c++){const{map:m,offset:y}=p[c];let M=f,D=u;if(c+1<p.length){const b=p[c+1].offset;M=Math.min(f,a+b.line),M===f?D=Math.min(u,l+b.column):M<f&&(D=l+b.column)}zs(m,e,t,n,s,o,i,a+y.line,l+y.column,M,D)}}v(Wr,"ee");z(Wr,"recurse");function zs(r,e,t,n,s,o,i,a,l,f,u){const p=Yt(r);if("sections"in p)return Wr(...arguments);const c=new zr(p,e),m=n.length,y=o.length,M=st(c),{resolvedSources:D,sourcesContent:b,ignoreList:S}=c;if(Dt(n,D),Dt(o,c.names),b)Dt(s,b);else for(let R=0;R<D.length;R++)s.push(null);if(S)for(let R=0;R<S.length;R++)i.push(S[R]+m);for(let R=0;R<M.length;R++){const x=a+R;if(x>f)return;const O=Hs(t,x),w=R===0?l:0,T=M[R];for(let A=0;A<T.length;A++){const F=T[A],U=w+F[Fe];if(x===f&&U>=u)return;if(F.length===1){O.push([U]);continue}const ae=m+F[Dr],X=F[Br],K=F[Nr];O.push(F.length===4?[U,ae,X,K]:[U,ae,X,K,y+F[Ls]])}}}v(zs,"me");z(zs,"addSection");function Dt(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}v(Dt,"G$1");z(Dt,"append");function Hs(r,e){for(let t=r.length;t<=e;t++)r[t]=[];return r[e]}v(Hs,"xe$1");z(Hs,"getLine");var Vs="`line` must be greater than 0 (lines start at line 1)",Ks="`column` must be greater than or equal to 0 (columns start at column 0)",Wt=-1,Qt=1,zr=class{static{v(this,"R")}static{z(this,"TraceMap")}constructor(e,t){const n=typeof e=="string";if(!n&&e._decodedMemo)return e;const s=Yt(e),{version:o,file:i,names:a,sourceRoot:l,sources:f,sourcesContent:u}=s;this.version=o,this.file=i,this.names=a||[],this.sourceRoot=l,this.sources=f,this.sourcesContent=u,this.ignoreList=s.ignoreList||s.x_google_ignoreList||void 0;const p=As(t,l);this.resolvedSources=f.map(p);const{mappings:c}=s;if(typeof c=="string")this._encoded=c,this._decoded=void 0;else if(Array.isArray(c))this._encoded=void 0,this._decoded=Ns(c,n);else throw s.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(s)}`);this._decodedMemo=Ur(),this._bySources=void 0,this._bySourceMemos=void 0}};function Js(r){var e,t;return(t=(e=r)._encoded)!=null?t:e._encoded=Cs(r._decoded)}v(Js,"oe");z(Js,"encodedMappings");function st(r){var e;return(e=r)._decoded||(e._decoded=Ss(r._encoded))}v(st,"O$2");z(st,"decodedMappings");function ll(r,e,t){const n=st(r);if(e>=n.length)return null;const s=n[e],o=Ct(s,r._decodedMemo,e,t,Qt);return o===-1?null:s[o]}v(ll,"Oe$1");z(ll,"traceSegment");function Ys(r,e){let{line:t,column:n,bias:s}=e;if(t--,t<0)throw new Error(Vs);if(n<0)throw new Error(Ks);const o=st(r);if(t>=o.length)return bt(null,null,null,null);const i=o[t],a=Ct(i,r._decodedMemo,t,n,s||Qt);if(a===-1)return bt(null,null,null,null);const l=i[a];if(l.length===1)return bt(null,null,null,null);const{names:f,resolvedSources:u}=r;return bt(u[l[Dr]],l[Br]+1,l[Nr],l.length===5?f[l[Ls]]:null)}v(Ys,"Le$1");z(Ys,"originalPositionFor");function dl(r,e){const{source:t,line:n,column:s,bias:o}=e;return Vr(r,t,n,s,o||Qt,!1)}v(dl,"ye");z(dl,"generatedPositionFor");function ul(r,e){const{source:t,line:n,column:s,bias:o}=e;return Vr(r,t,n,s,o||Wt,!0)}v(ul,"Ce$1");z(ul,"allGeneratedPositionsFor");function fl(r,e){const t=st(r),{names:n,resolvedSources:s}=r;for(let o=0;o<t.length;o++){const i=t[o];for(let a=0;a<i.length;a++){const l=i[a],f=o+1,u=l[0];let p=null,c=null,m=null,y=null;l.length!==1&&(p=s[l[1]],c=l[2]+1,m=l[3]),l.length===5&&(y=n[l[4]]),e({generatedLine:f,generatedColumn:u,source:p,originalLine:c,originalColumn:m,name:y})}}}v(fl,"Ie");z(fl,"eachMapping");function Hr(r,e){const{sources:t,resolvedSources:n}=r;let s=t.indexOf(e);return s===-1&&(s=n.indexOf(e)),s}v(Hr,"re");z(Hr,"sourceIndex");function Qs(r,e){const{sourcesContent:t}=r;if(t==null)return null;const n=Hr(r,e);return n===-1?null:t[n]}v(Qs,"Ne$1");z(Qs,"sourceContentFor");function hl(r,e){const{ignoreList:t}=r;if(t==null)return!1;const n=Hr(r,e);return n===-1?!1:t.includes(n)}v(hl,"be");z(hl,"isIgnored");function Xs(r,e){const t=new zr(Xt(r,[]),e);return t._decoded=r.mappings,t}v(Xs,"se");z(Xs,"presortedDecodedMap");function pl(r){return Xt(r,st(r))}v(pl,"Re");z(pl,"decodedMap");function gl(r){return Xt(r,Js(r))}v(gl,"we$1");z(gl,"encodedMap");function Xt(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}}v(Xt,"B$2");z(Xt,"clone");function bt(r,e,t,n){return{source:r,line:e,column:t,name:n}}v(bt,"b$2");z(bt,"OMapping");function ct(r,e){return{line:r,column:e}}v(ct,"y$4");z(ct,"GMapping");function Ct(r,e,t,n,s){let o=Ws(r,n,e,t);return et?o=(s===Wt?Gr:qr)(r,n,o):s===Wt&&o++,o===-1||o===r.length?-1:o}v(Ct,"w$3");z(Ct,"traceSegmentInternal");function Zs(r,e,t,n,s){let o=Ct(r,e,t,n,Qt);if(!et&&s===Wt&&o++,o===-1||o===r.length)return[];const i=et?n:r[o][Fe];et||(o=qr(r,i,o));const a=Gr(r,i,o),l=[];for(;o<=a;o++){const f=r[o];l.push(ct(f[Ds]+1,f[Bs]))}return l}v(Zs,"Ue");z(Zs,"sliceGeneratedPositions");function Vr(r,e,t,n,s,o){var i,a;if(t--,t<0)throw new Error(Vs);if(n<0)throw new Error(Ks);const{sources:l,resolvedSources:f}=r;let u=l.indexOf(e);if(u===-1&&(u=f.indexOf(e)),u===-1)return o?[]:ct(null,null);const p=(i=r)._bySourceMemos||(i._bySourceMemos=l.map(Ur)),c=((a=r)._bySources||(a._bySources=qs(st(r),p)))[u][t];if(c==null)return o?[]:ct(null,null);const m=p[u];if(o)return Zs(c,m,t,n,s);const y=Ct(c,m,t,n,s);if(y===-1)return ct(null,null);const M=c[y];return ct(M[Ds]+1,M[Bs])}v(Vr,"ie");z(Vr,"generatedPosition");var ml=Object.defineProperty,vl=v((r,e)=>ml(r,"name",{value:e,configurable:!0}),"f$4"),yl=Object.defineProperty,ei=vl((r,e)=>yl(r,"name",{value:e,configurable:!0}),"a");const wl=Fo(import.meta.url),$t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kr=ei(r=>{if(typeof $t<"u"&&$t.versions&&$t.versions.node){const[e,t]=$t.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return $t.getBuiltinModule(r)}return wl(r)},"__cjs_getBuiltinModule"),{readFileSync:Bn}=Kr("node:fs"),{resolve:$l,toNamespacedPath:ar,dirname:kl}=Kr("node:path"),{pathToFileURL:bl}=Kr("node:url");var Sl=Object.defineProperty,It=ei((r,e)=>Sl(r,"name",{value:e,configurable:!0}),"s");const Tl=/^data:application\/json[^,]+base64,/,xl=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,Cl=/\r?\n/,mr=It(r=>Tl.test(r),"isInlineMap"),cr=It((r,e)=>{const t=r instanceof Error?r.message:String(r),n=`${e}:
16
- ${t}`;throw new Error(n)},"enhanceError"),Il=It((r,e)=>{const t=r.split(Cl);let n;for(let o=t.length-1;o>=0&&!n;o--)n=xl.exec(t[o])??void 0;if(!n)return;const s=n[1]??n[2];if(s)return mr(s)?s:$l(e,s)},"resolveSourceMapUrl"),Ol=It(r=>{const e=r.slice(r.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Ml=It(r=>{let e;try{e=Bn(r,{encoding:"utf8"})}catch(s){cr(s,`Error reading sourcemap for file "${ar(r)}"`)}const t=Il(e,kl(r));if(!t)return;let n;if(mr(t))n=Ol(t);else try{n=Bn(t,{encoding:"utf8"})}catch(s){cr(s,`Error reading sourcemap for file "${ar(r)}"`)}try{const s=mr(t)?t:bl(t).href;return new cl(n,s)}catch(s){cr(s,`Error parsing sourcemap for file "${ar(r)}"`)}},"loadSourceMap");var El=Object.defineProperty,Pe=v((r,e)=>El(r,"name",{value:e,configurable:!0}),"l$3");const Rl=Pe(r=>va(r),"stripAnsi"),jl=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Pl=/^\s*at\s+/,Fl=Pe(r=>{const e=r.split(`
17
- `);let t;for(let n=0;n<e.length;n++){const s=jl.exec(e[n].trim());if(!s)continue;const o=[];for(let i=n+1;i<e.length&&i<=n+200;i++){const a=e[i];if(Pl.test(a))o.push(a.trim());else if(o.length>0||a.trim()!=="")break}if(o.length>0){const i=s.groups?.name??"Error",a=s.groups?.message??"";t={message:a,name:i,stack:`${i}: ${a}
18
- ${o.map(l=>` ${l}`).join(`
19
- `)}`}}}return t},"extractErrorBlock"),ti=Pe(r=>{if(r.startsWith("file://"))try{return Ro(r)}catch{return r}return r},"normalizeFramePath"),Al=Pe(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),Ll=Pe(r=>{try{return Ml(r)}catch{return}},"tryLoadSourceMap"),Dl=Pe((r,e)=>{if(!r.file||r.line===void 0)return;const t=ti(r.file),n=Oo(t)?t:Tn(e,t);if(!Al(n)||!_e(n))return;const s=Ll(n);if(s){const o=Ys(s,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(o.source&&o.line!=null){const i=Tn(Mo(n),o.source),a=Qs(s,o.source)??(_e(i)?dt(i,"utf8"):void 0);if(a!==void 0)return{column:o.column==null?void 0:o.column+1,file:i,line:o.line,source:a}}}return{column:r.column,file:n,line:r.line,source:dt(n,"utf8")}},"resolveFrame"),Nn=Pe((r,e)=>{const t=Eo(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),ri=Pe((r,e)=>{if(!r?.trim())return r;try{const t=Fl(Rl(r));if(!t)return r;const n=new Error(t.message);n.name=t.name,n.stack=t.stack;const s=Qc(n);if(s.length===0)return r;const o=e.color,i={dim:Pe(c=>o?xn(c):c,"dim"),head:Pe(c=>o?Po(sr(c)):c,"head"),loc:Pe(c=>o?jo(c):c,"loc")};let a,l;for(const c of s){const m=Dl(c,e.cwd);if(m){a=m,l=c;break}}const f=[i.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(a){const c=`${Nn(a.file,e.cwd)}:${a.line}${a.column?`:${a.column}`:""}`;f.push(` ${i.loc(c)}`,""),f.push(Tc(a.source,{start:{column:a.column,line:a.line}},{color:o?{gutter:xn,marker:sr,message:sr}:void 0,linesAbove:2,linesBelow:3}))}const u=s.filter(c=>c!==l).slice(0,8).map(c=>{const m=c.methodName??"<anonymous>",y=c.file?`${Nn(ti(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return i.dim(` at ${m}${y?` (${y})`:""}`)});u.length>0&&f.push("",...u);const p=i.dim("─".repeat(40));return`${f.join(`
8
+ `);const r=(await new Promise(n=>{e.question("Select a target (number or name, blank to cancel): ",n)})).trim();if(r.length===0)return;const s=Number.parseInt(r,10);return Number.isFinite(s)&&s>=1&&s<=t.length?t[s-1]:t.includes(r)?r:Na(r,t)}finally{e.close()}},"promptTargetInteractively");var Ua=Object.defineProperty,Mt=m((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"n$1");const za=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),Jt=Mt(t=>t.replaceAll(za,"").replaceAll("\r",""),"sanitizeLogLine");class $s{static{m(this,"ServiceDockStore")}static{Mt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#n=new Map;constructor(e=[]){for(const r of e)this.#n.set(r,{id:r,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=Mt(()=>this.#r,"getSnapshot");subscribe=Mt(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,r=!1;for(const s of this.#n.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(r=!0);return e?"crash":r?"boot":"ready"}registerService(e){this.#n.has(e)||(this.#n.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,r=>({...r,errorMessage:void 0,startedAt:r.startedAt??Date.now(),status:"starting"}))}markStarted(e,r){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,r){this.#t(e,s=>({...s,errorMessage:void 0,port:r.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,r,s){const n=s?.message;this.#t(e,o=>({...o,errorMessage:Jt(n??r),status:"failed"}))}markCrashed(e,r){const s=r.slice(-256).map(n=>Jt(n));this.#t(e,n=>({...n,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,r){const s=r.split(`
9
+ `).map(n=>Jt(n)).filter(n=>n.length>0);s.length!==0&&this.#t(e,n=>{const o=[...n.tailLines,...s];for(;o.length>256;)o.shift();let i=0;for(let c=o.length-1;c>=0;c--)if(i+=o[c].length+1,i>65536){o.splice(0,c+1);break}return{...n,lastLine:s[s.length-1],tailLines:o}})}abortBoot(e){let r=!1;const s=new Map(this.#n);for(const[n,o]of s)(o.status==="pending"||o.status==="starting")&&(s.set(n,{...o,errorMessage:e,status:"failed"}),r=!0);r&&(this.#n=s,this.#i(),this.#o())}#t(e,r){const s=this.#n.get(e);s&&(this.#n.set(e,r(s)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#n)}#o(){for(const e of this.#s)try{e()}catch{}}}var Ha=Object.defineProperty,Wa=m((t,e)=>Ha(t,"name",{value:e,configurable:!0}),"v$5"),Va=Object.defineProperty,Ka=Wa((t,e)=>Va(t,"name",{value:e,configurable:!0}),"R"),Ya=Object.defineProperty,sn=Ka((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"u");const Ja=sn((t,e)=>{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(const[r,s]of t.entries())if(!Object.is(s,e[r]))return!1;return!0},"areDepsEqual"),bs=sn(({children:t,deps:e,onRender:r,style:s,width:n})=>{const o=K.useRef(null),i=K.useRef(!1),c=K.useRef(e),d=K.useRef(t),h=K.useRef(r);h.current=r;let f=!1;e!==void 0?Ja(c.current,e)||(f=!0,c.current=e):t!==d.current&&(f=!0,d.current=t),f&&(i.current=!1,o.current&&(o.current.cachedRender=void 0)),K.useLayoutEffect(()=>{const l=o.current;l&&(l.internal_onRendered=()=>{i.current=!0,h.current?.(l)})}),K.useEffect(()=>()=>{const l=o.current;l&&(l.cachedRender=void 0,l.internal_onRendered=void 0)},[]);const p=K.useMemo(()=>({...s,width:n}),[s,n]);return a.jsx("ink-static-render",{ref:o,style:p,children:i.current?null:t()})},"StaticRender");var Xa=Object.defineProperty,wr=m((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"i$3");const Qa=wr(t=>Array.isArray(t)?`[${t.join(",")}]`:typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"formatValue"),Za=wr((t,e,r)=>e==="_"?`${t}${Array.isArray(r)?r.join(" "):String(r)}`:`${t}--${e}=${Qa(r)}`,"formatFlags"),yr=wr((t,e,r)=>{const s=new Set(new Set(r.map(l=>l.target.target))),n=new Set(new Set(r.map(l=>l.target.project))),o=e.filter(l=>s.has(l)),i=t.filter(l=>n.has(l)),c=r.length-i.length*o.length,d=o.length===1?"target":"targets",h=o.join(", "),f=i.length===1?`project ${i[0]}`:`${i.length} projects`;let p=`${d} ${h} for ${f}`;return c>0&&(p+=` and ${c} ${c===1?"task":"tasks"} ${c===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var ec=Object.defineProperty,tc=m((t,e)=>ec(t,"name",{value:e,configurable:!0}),"c$4");const rc={error:"red",info:"white",success:"green"},rr=tc(({children:t,title:e,variant:r})=>{const s=rc[r];return a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(u,{bold:!0,color:s,children:"•"}),a.jsx(u,{children:e})]}),t]})},"Header");var sc=Object.defineProperty,nc=m((t,e)=>sc(t,"name",{value:e,configurable:!0}),"T$7");const nn=nc(({cached:t,failed:e,failedIds:r,projectNames:s,retriedIds:n,skippedIds:o,succeeded:i,targets:c,tasks:d,took:h})=>{const f=yr(s,c,d),p=n??[];if(e===0&&(!o||o.length===0)){const l=t>0?` (${t} read from cache)`:"";return a.jsx(bs,{children:m(()=>a.jsx(rr,{title:`Successfully ran ${f}`,variant:"success",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[a.jsxs(u,{children:[a.jsx(u,{color:"green",children:Hs})," ",i+t," tasks completed",l?a.jsx(u,{dimColor:!0,children:l}):null,a.jsx(u,{dimColor:!0,children:` · Took ${h}`})]}),p.length>0&&a.jsxs($,{flexDirection:"column",marginTop:1,children:[a.jsxs(u,{children:[a.jsx(u,{color:"yellow",children:"↻"})," ",a.jsx(u,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(g=>a.jsxs(u,{children:[" ",a.jsx(u,{color:"yellow",children:"↻"})," ",g]},g))]})]})}),"children")})}return a.jsx(bs,{children:m(()=>a.jsx(rr,{title:`Ran ${f}`,variant:"error",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(u,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(l=>a.jsxs(u,{dimColor:!0,children:[" - ",l]},l)),a.jsx(u,{})]}),e>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(u,{children:[a.jsx(u,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),r.map(l=>a.jsxs(u,{children:[" ",a.jsx(u,{color:"red",children:fr})," ",l]},l)),a.jsx(u,{})]}),p.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(u,{children:[a.jsx(u,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(l=>a.jsxs(u,{children:[" ",a.jsx(u,{color:"yellow",children:"↻"})," ",l]},l)),a.jsx(u,{})]}),a.jsx(u,{dimColor:!0,children:` Took ${h}`})]})}),"children")})},"CommandSummary");var ic=Object.defineProperty,Xt=m((t,e)=>ic(t,"name",{value:e,configurable:!0}),"o$2");class Lt{static{m(this,"TaskStore")}static{Xt(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(r=>({persistent:!!r.overrides.visOptions?.persistent,status:"pending",taskId:r.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Xt(()=>this.#e,"getSnapshot");subscribe=Xt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const r=[...this.#e.rows];for(const s of e){const n=r.findIndex(o=>o.taskId===s.id);n!==-1&&(r[n]={...r[n],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:r})}endTasks(e){const r=[...this.#e.rows];let{cached:s,completed:n,failed:o,succeeded:i}=this.#e;const c=new Map(this.#e.outputs),d=[...this.#e.retriedIds];for(const f of e){const p=r.findIndex(l=>l.taskId===f.task.id);switch(p!==-1&&(r[p]={...r[p],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,retryAttempts:f.retryAttempts,status:f.status}),f.retryAttempts&&f.retryAttempts>0&&d.push(f.task.id),n++,f.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{i++;break}}f.terminalOutput&&!c.has(f.task.id)&&c.set(f.task.id,f.terminalOutput),this.#r.delete(f.task.id)}let{selectedIndex:h}=this.#e;if(o>this.#e.failed){const f=r.findIndex(p=>p.status==="failure");f!==-1&&(h=f)}this.#t({...this.#e,cached:s,completed:n,failed:o,outputs:c,retriedIds:d,rows:r,selectedIndex:h,succeeded:i})}static#n=256*1024;addOutput(e,r){if(!r.trim())return;let s=(this.#e.outputs.get(e)??"")+r;s.length>Lt.#n&&(s=s.slice(-Lt.#n)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,r){this.#e.outputs.set(e,r),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 r=[...this.#e.rows];for(let s=0;s<r.length;s++){const n=r[s];if(n.status==="running"){const o=this.#r.get(n.taskId);if(o){const i=process.hrtime(o),c=i[0]*1e3+i[1]/1e6;r[s]={...n,elapsed:c},e=!0}}}e&&this.#t({...this.#e,rows:r})}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,r){const s=[...this.#e.pinnedTaskIds];s[e]=r,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const r=[...this.#e.rows],s=r.findIndex(c=>c.taskId===e);let{completed:n,failed:o,succeeded:i}=this.#e;if(s!==-1){const c=r[s].status;c==="failure"?(o=Math.max(0,o-1),n=Math.max(0,n-1)):c==="success"&&(i=Math.max(0,i-1),n=Math.max(0,n-1)),r[s]={...r[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:n,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(c=>c!==e),retryTaskId:e,rows:r,succeeded:i})}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 r of this.#s)try{r()}catch{}}}var oc=Object.defineProperty,ac=m((t,e)=>oc(t,"name",{value:e,configurable:!0}),"A$3"),cc=Object.defineProperty,$r=ac((t,e)=>cc(t,"name",{value:e,configurable:!0}),"$"),lc=Object.defineProperty,uc=$r((t,e)=>lc(t,"name",{value:e,configurable:!0}),"r$1");const dc=uc(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
10
+ `),"normalizeLF"),fc=globalThis.process??Object.create(null),ks={versions:{}},xs=new Proxy(fc,{get(t,e){if(e in t)return t[e];if(e in ks)return ks[e]}});var hc=Object.defineProperty,pc=$r((t,e)=>hc(t,"name",{value:e,configurable:!0}),"b");const gc=pc((t,e,r,s)=>{const n={column:0,line:-1,...t.start},o={...n,...t.end},i=n.line,c=n.column,d=o.line,h=o.column;let f=Math.max(i-(r+1),0),p=Math.min(e.length,d+s);i===-1&&(f=0),d===-1&&(p=e.length);const l=d-i,g={};if(l)for(let w=0;w<=l;w++){const I=w+i;if(!c)g[I]=!0;else if(w===0){const L=e[I-1]?.length;g[I]=[c,(L??0)-c+1]}else if(w===l)g[I]=[0,h];else{const L=e[I-w]?.length;g[I]=[0,L]}}else c===h?g[i]=c?[c,0]:!0:g[i]=[c,(h??0)-(c??0)];return{end:p,markerLines:g,start:f}},"getMarkerLines");var mc=Object.defineProperty,Ct=$r((t,e)=>mc(t,"name",{value:e,configurable:!0}),"t");const vc=xs.platform==="win32"&&!xs.env?.WT_SESSION?">":"❯",wc=Ct((t,e,r)=>{const s={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:Ct(w=>w,"gutter"),marker:Ct(w=>w,"marker"),message:Ct(w=>w,"message"),...r?.color}},n=typeof e.start.column=="number";let o=dc(t).split(`
11
+ `);typeof s.tabWidth=="number"&&(o=o.map(w=>w.replaceAll(" "," ".repeat(s.tabWidth))));const{end:i,markerLines:c,start:d}=gc(e,o,s.linesAbove,s.linesBelow),h=String(i).length,{gutter:f,marker:p,message:l}=s.color;let g=o.slice(d,i).map((w,I)=>{const L=d+1+I,b=c[L],k=` ${String(L)}`.slice(-h),R=!c[L+1],j=` ${k}${s.showGutter?" |":""}`;if(b){let C="";if(Array.isArray(b)){const v=w.replaceAll(/[^\t]/g," ").slice(0,Math.max(b[0]-1,0)),x=b[1]||1;C=[`
12
+ `,s.prefix+f(j.replaceAll(/\d/g," "))," ",v,p("^").repeat(x)].join(""),R&&s.message&&(C+=` ${l(s.message)}`)}return[s.prefix+p(vc),f(j),w.length>0?` ${w}`:"",C].join("")}return`${s.prefix} ${f(j)}${w.length>0?` ${w}`:""}`}).join(`
13
+ `);return s.message&&!n&&(g=`${s.prefix+" ".repeat(h+1)+s.message}
14
+ ${g}`),g},"codeFrame");var yc=Object.defineProperty,pe=m((t,e)=>yc(t,"name",{value:e,configurable:!0}),"C$3"),ct=44,on=59,js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",an=new Uint8Array(64),cn=new Uint8Array(128);for(let t=0;t<js.length;t++){const e=js.charCodeAt(t);an[t]=e,cn[e]=t}function ne(t,e){let r=0,s=0,n=0;do{const i=t.next();n=cn[i],r|=(n&31)<<s,s+=5}while(n&32);const o=r&1;return r>>>=1,o&&(r=-2147483648|-r),e+r}m(ne,"h$4");pe(ne,"decodeInteger");function ee(t,e,r){let s=e-r;s=s<0?-s<<1|1:s<<1;do{let n=s&31;s>>>=5,s>0&&(n|=32),t.write(an[n])}while(s>0);return e}m(ee,"i$2");pe(ee,"encodeInteger");function _e(t,e){return t.pos>=e?!1:t.peek()!==ct}m(_e,"S$3");pe(_e,"hasMoreVlq");var Ss=1024*16,Ts=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},br=class{static{m(this,"T")}static{pe(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ss)}write(e){const{buffer:r}=this;r[this.pos++]=e,this.pos===Ss&&(this.out+=Ts.decode(r),this.pos=0)}flush(){const{buffer:e,out:r,pos:s}=this;return s>0?r+Ts.decode(e.subarray(0,s)):r}},kr=class{static{m(this,"w")}static{pe(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:r,pos:s}=this,n=r.indexOf(e,s);return n===-1?r.length:n}},ln=[];function $c(t){const{length:e}=t,r=new kr(t),s=[],n=[];let o=0;for(;r.pos<e;r.pos++){o=ne(r,o);const i=ne(r,0);if(!_e(r,e)){const f=n.pop();f[2]=o,f[3]=i;continue}const c=ne(r,0),d=ne(r,0)&1?[o,i,0,0,c,ne(r,0)]:[o,i,0,0,c];let h=ln;if(_e(r,e)){h=[];do{const f=ne(r,0);h.push(f)}while(_e(r,e))}d.vars=h,s.push(d),n.push(d)}return s}m($c,"z$1");pe($c,"decodeOriginalScopes");function bc(t){const e=new br;for(let r=0;r<t.length;)r=xr(t,r,e,[0]);return e.flush()}m(bc,"F$3");pe(bc,"encodeOriginalScopes");function xr(t,e,r,s){const n=t[e],{0:o,1:i,2:c,3:d,4:h,vars:f}=n;e>0&&r.write(ct),s[0]=ee(r,o,s[0]),ee(r,i,0),ee(r,h,0);const p=n.length===6?1:0;ee(r,p,0),n.length===6&&ee(r,n[5],0);for(const l of f)ee(r,l,0);for(e++;e<t.length;){const l=t[e],{0:g,1:w}=l;if(g>c||g===c&&w>=d)break;e=xr(t,e,r,s)}return r.write(ct),s[0]=ee(r,c,s[0]),ee(r,d,0),e}m(xr,"P$4");pe(xr,"_encodeOriginalScopes");function kc(t){const{length:e}=t,r=new kr(t),s=[],n=[];let o=0,i=0,c=0,d=0,h=0,f=0,p=0,l=0;do{const g=r.indexOf(";");let w=0;for(;r.pos<g;r.pos++){if(w=ne(r,w),!_e(r,g)){const v=n.pop();v[2]=o,v[3]=w;continue}const I=ne(r,0),L=I&1,b=I&2,k=I&4;let R=null,j=ln,C;if(L){const v=ne(r,i);c=ne(r,i===v?c:0),i=v,C=[o,w,0,0,v,c]}else C=[o,w,0,0];if(C.isScope=!!k,b){const v=d,x=h;d=ne(r,d);const F=v===d;h=ne(r,F?h:0),f=ne(r,F&&x===h?f:0),R=[d,h,f]}if(C.callsite=R,_e(r,g)){j=[];do{p=o,l=w;const v=ne(r,0);let x;if(v<-1){x=[[ne(r,0)]];for(let F=-1;F>v;F--){const P=p;p=ne(r,p),l=ne(r,p===P?l:0);const q=ne(r,0);x.push([q,p,l])}}else x=[[v]];j.push(x)}while(_e(r,g))}C.bindings=j,s.push(C),n.push(C)}o++,r.pos=g+1}while(r.pos<e);return s}m(kc,"H$1");pe(kc,"decodeGeneratedRanges");function xc(t){if(t.length===0)return"";const e=new br;for(let r=0;r<t.length;)r=jr(t,r,e,[0,0,0,0,0,0,0]);return e.flush()}m(xc,"J");pe(xc,"encodeGeneratedRanges");function jr(t,e,r,s){const n=t[e],{0:o,1:i,2:c,3:d,isScope:h,callsite:f,bindings:p}=n;s[0]<o?(sr(r,s[0],o),s[0]=o,s[1]=0):e>0&&r.write(ct),s[1]=ee(r,n[1],s[1]);const l=(n.length===6?1:0)|(f?2:0)|(h?4:0);if(ee(r,l,0),n.length===6){const{4:g,5:w}=n;g!==s[2]&&(s[3]=0),s[2]=ee(r,g,s[2]),s[3]=ee(r,w,s[3])}if(f){const{0:g,1:w,2:I}=n.callsite;g!==s[4]?(s[5]=0,s[6]=0):w!==s[5]&&(s[6]=0),s[4]=ee(r,g,s[4]),s[5]=ee(r,w,s[5]),s[6]=ee(r,I,s[6])}if(p)for(const g of p){g.length>1&&ee(r,-g.length,0);const w=g[0][0];ee(r,w,0);let I=o,L=i;for(let b=1;b<g.length;b++){const k=g[b];I=ee(r,k[1],I),L=ee(r,k[2],L),ee(r,k[0],0)}}for(e++;e<t.length;){const g=t[e],{0:w,1:I}=g;if(w>c||w===c&&I>=d)break;e=jr(t,e,r,s)}return s[0]<c?(sr(r,s[0],c),s[0]=c,s[1]=0):r.write(ct),s[1]=ee(r,d,s[1]),e}m(jr,"V$1");pe(jr,"_encodeGeneratedRanges");function sr(t,e,r){do t.write(on);while(++e<r)}m(sr,"U$4");pe(sr,"catchupLine");function un(t){const{length:e}=t,r=new kr(t),s=[];let n=0,o=0,i=0,c=0,d=0;do{const h=r.indexOf(";"),f=[];let p=!0,l=0;for(n=0;r.pos<h;){let g;n=ne(r,n),n<l&&(p=!1),l=n,_e(r,h)?(o=ne(r,o),i=ne(r,i),c=ne(r,c),_e(r,h)?(d=ne(r,d),g=[n,o,i,c,d]):g=[n,o,i,c]):g=[n],f.push(g),r.pos++}p||dn(f),s.push(f),r.pos=h+1}while(r.pos<=e);return s}m(un,"K");pe(un,"decode");function dn(t){t.sort(fn)}m(dn,"Q$1");pe(dn,"sort");function fn(t,e){return t[0]-e[0]}m(fn,"X$3");pe(fn,"sortComparator");function hn(t){const e=new br;let r=0,s=0,n=0,o=0;for(let i=0;i<t.length;i++){const c=t[i];if(i>0&&e.write(on),c.length===0)continue;let d=0;for(let h=0;h<c.length;h++){const f=c[h];h>0&&e.write(ct),d=ee(e,f[0],d),f.length!==1&&(r=ee(e,f[1],r),s=ee(e,f[2],s),n=ee(e,f[3],n),f.length!==4&&(o=ee(e,f[4],o)))}}return e.flush()}m(hn,"Z$1");pe(hn,"encode");var jc=Object.defineProperty,Se=m((t,e)=>jc(t,"name",{value:e,configurable:!0}),"c$3");const Sc=/^[\w+.-]+:\/\//,Tc=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,Cc=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function pn(t){return Sc.test(t)}m(pn,"R$3");Se(pn,"isAbsoluteUrl");function gn(t){return t.startsWith("//")}m(gn,"q$1");Se(gn,"isSchemeRelativeUrl");function Sr(t){return t.startsWith("/")}m(Sr,"m$1");Se(Sr,"isAbsolutePath");function mn(t){return t.startsWith("file:")}m(mn,"v$3");Se(mn,"isFileUrl");function nr(t){return/^[.?#]/.test(t)}m(nr,"u$1");Se(nr,"isRelative");function mt(t){const e=Tc.exec(t);return Tr(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}m(mt,"f$5");Se(mt,"parseAbsoluteUrl");function vn(t){const e=Cc.exec(t),r=e[2];return Tr("file:","",e[1]||"","",Sr(r)?r:"/"+r,e[3]||"",e[4]||"")}m(vn,"w$4");Se(vn,"parseFileUrl");function Tr(t,e,r,s,n,o,i){return{scheme:t,user:e,host:r,port:s,path:n,query:o,hash:i,type:7}}m(Tr,"y$5");Se(Tr,"makeUrl");function ir(t){if(gn(t)){const r=mt("http:"+t);return r.scheme="",r.type=6,r}if(Sr(t)){const r=mt("http://foo.com"+t);return r.scheme="",r.host="",r.type=5,r}if(mn(t))return vn(t);if(pn(t))return mt(t);const e=mt("http://foo.com/"+t);return e.scheme="",e.host="",e.type=t?t.startsWith("?")?3:t.startsWith("#")?2:4:1,e}m(ir,"p$4");Se(ir,"parseUrl");function wn(t){if(t.endsWith("/.."))return t;const e=t.lastIndexOf("/");return t.slice(0,e+1)}m(wn,"P$3");Se(wn,"stripPathFilename");function yn(t,e){Cr(e,e.type),t.path==="/"?t.path=e.path:t.path=wn(e.path)+t.path}m(yn,"A$2");Se(yn,"mergePaths");function Cr(t,e){const r=e<=4,s=t.path.split("/");let n=1,o=0,i=!1;for(let d=1;d<s.length;d++){const h=s[d];if(!h){i=!0;continue}if(i=!1,h!=="."){if(h===".."){o?(i=!0,o--,n--):r&&(s[n++]=h);continue}s[n++]=h,o++}}let c="";for(let d=1;d<n;d++)c+="/"+s[d];(!c||i&&!c.endsWith("/.."))&&(c+="/"),t.path=c}m(Cr,"d$3");Se(Cr,"normalizePath");function $n(t,e){if(!t&&!e)return"";const r=ir(t);let s=r.type;if(e&&s!==7){const o=ir(e),i=o.type;switch(s){case 1:r.hash=o.hash;case 2:r.query=o.query;case 3:case 4:yn(r,o);case 5:r.user=o.user,r.host=o.host,r.port=o.port;case 6:r.scheme=o.scheme}i>s&&(s=i)}Cr(r,s);const n=r.query+r.hash;switch(s){case 2:case 3:return n;case 4:{const o=r.path.slice(1);return o?nr(e||t)&&!nr(o)?"./"+o+n:o+n:n||"."}case 5:return r.path+n;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+n}}m($n,"F$2");Se($n,"resolve");var Ic=Object.defineProperty,z=m((t,e)=>Ic(t,"name",{value:e,configurable:!0}),"i$1");function bn(t){if(!t)return"";const e=t.lastIndexOf("/");return t.slice(0,e+1)}m(bn,"ae");z(bn,"stripFilename");function kn(t,e){const r=bn(t),s=e?e+"/":"";return n=>$n(s+(n||""),r)}m(kn,"ge");z(kn,"resolver");var Fe=0,Ir=1,Mr=2,Rr=3,xn=4,jn=1,Sn=2;function Tn(t,e){const r=or(t,0);if(r===t.length)return t;e||(t=t.slice());for(let s=r;s<t.length;s=or(t,s+1))t[s]=In(t[s],e);return t}m(Tn,"he");z(Tn,"maybeSort");function or(t,e){for(let r=e;r<t.length;r++)if(!Cn(t[r]))return r;return t.length}m(or,"X$2");z(or,"nextUnsortedSegmentLine");function Cn(t){for(let e=1;e<t.length;e++)if(t[e][Fe]<t[e-1][Fe])return!1;return!0}m(Cn,"_e$1");z(Cn,"isSorted");function In(t,e){return e||(t=t.slice()),t.sort(Or)}m(In,"ve");z(In,"sortSegments");function Or(t,e){return t[Fe]-e[Fe]}m(Or,"$$4");z(Or,"sortComparator");function Mn(t,e){const r=e.map(()=>[]);for(let s=0;s<t.length;s++){const n=t[s];for(let o=0;o<n.length;o++){const i=n[o];if(i.length===1)continue;const c=i[Ir],d=i[Mr],h=i[Rr],f=r[c];(f[d]||(f[d]=[])).push([h,s,i[Fe]])}}for(let s=0;s<r.length;s++){const n=r[s];for(let o=0;o<n.length;o++){const i=n[o];i&&i.sort(Or)}}return r}m(Mn,"Se");z(Mn,"buildBySources");var Ze=!1;function Rn(t,e,r,s){for(;r<=s;){const n=r+(s-r>>1),o=t[n][Fe]-e;if(o===0)return Ze=!0,n;o<0?r=n+1:s=n-1}return Ze=!1,r-1}m(Rn,"Ee");z(Rn,"binarySearch");function Er(t,e,r){for(let s=r+1;s<t.length&&t[s][Fe]===e;r=s++);return r}m(Er,"H");z(Er,"upperBound");function Pr(t,e,r){for(let s=r-1;s>=0&&t[s][Fe]===e;r=s--);return r}m(Pr,"Y");z(Pr,"lowerBound");function Fr(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}m(Fr,"k$4");z(Fr,"memoizedState");function On(t,e,r,s){const{lastKey:n,lastNeedle:o,lastIndex:i}=r;let c=0,d=t.length-1;if(s===n){if(e===o)return Ze=i!==-1&&t[i][Fe]===e,i;e>=o?c=i===-1?0:i:d=i}return r.lastKey=s,r.lastNeedle=e,r.lastIndex=Rn(t,e,c,d)}m(On,"Me$1");z(On,"memoizedBinarySearch");function Ut(t){return typeof t=="string"?JSON.parse(t):t}m(Ut,"j$3");z(Ut,"parse");var Mc=z(function(t,e){const r=Ut(t);if(!("sections"in r))return new Lr(r,e);const s=[],n=[],o=[],i=[],c=[];Ar(r,e,s,n,o,i,c,0,0,1/0,1/0);const d={version:3,file:r.file,names:i,sources:n,sourcesContent:o,mappings:s,ignoreList:c};return _n(d)},"FlattenMap");function Ar(t,e,r,s,n,o,i,c,d,h,f){const{sections:p}=t;for(let l=0;l<p.length;l++){const{map:g,offset:w}=p[l];let I=h,L=f;if(l+1<p.length){const b=p[l+1].offset;I=Math.min(h,c+b.line),I===h?L=Math.min(f,d+b.column):I<h&&(L=d+b.column)}En(g,e,r,s,n,o,i,c+w.line,d+w.column,I,L)}}m(Ar,"ee");z(Ar,"recurse");function En(t,e,r,s,n,o,i,c,d,h,f){const p=Ut(t);if("sections"in p)return Ar(...arguments);const l=new Lr(p,e),g=s.length,w=o.length,I=tt(l),{resolvedSources:L,sourcesContent:b,ignoreList:k}=l;if(Rt(s,L),Rt(o,l.names),b)Rt(n,b);else for(let R=0;R<L.length;R++)n.push(null);if(k)for(let R=0;R<k.length;R++)i.push(k[R]+g);for(let R=0;R<I.length;R++){const j=c+R;if(j>h)return;const C=Pn(r,j),v=R===0?d:0,x=I[R];for(let F=0;F<x.length;F++){const P=x[F],q=v+P[Fe];if(j===h&&q>=f)return;if(P.length===1){C.push([q]);continue}const ae=g+P[Ir],Q=P[Mr],V=P[Rr];C.push(P.length===4?[q,ae,Q,V]:[q,ae,Q,V,w+P[xn]])}}}m(En,"me");z(En,"addSection");function Rt(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}m(Rt,"G$1");z(Rt,"append");function Pn(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}m(Pn,"xe$1");z(Pn,"getLine");var Fn="`line` must be greater than 0 (lines start at line 1)",An="`column` must be greater than or equal to 0 (columns start at column 0)",Dt=-1,zt=1,Lr=class{static{m(this,"R")}static{z(this,"TraceMap")}constructor(e,r){const s=typeof e=="string";if(!s&&e._decodedMemo)return e;const n=Ut(e),{version:o,file:i,names:c,sourceRoot:d,sources:h,sourcesContent:f}=n;this.version=o,this.file=i,this.names=c||[],this.sourceRoot=d,this.sources=h,this.sourcesContent=f,this.ignoreList=n.ignoreList||n.x_google_ignoreList||void 0;const p=kn(r,d);this.resolvedSources=h.map(p);const{mappings:l}=n;if(typeof l=="string")this._encoded=l,this._decoded=void 0;else if(Array.isArray(l))this._encoded=void 0,this._decoded=Tn(l,s);else throw n.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(n)}`);this._decodedMemo=Fr(),this._bySources=void 0,this._bySourceMemos=void 0}};function Ln(t){var e,r;return(r=(e=t)._encoded)!=null?r:e._encoded=hn(t._decoded)}m(Ln,"oe");z(Ln,"encodedMappings");function tt(t){var e;return(e=t)._decoded||(e._decoded=un(t._encoded))}m(tt,"O$2");z(tt,"decodedMappings");function Rc(t,e,r){const s=tt(t);if(e>=s.length)return null;const n=s[e],o=bt(n,t._decodedMemo,e,r,zt);return o===-1?null:n[o]}m(Rc,"Oe$1");z(Rc,"traceSegment");function Dn(t,e){let{line:r,column:s,bias:n}=e;if(r--,r<0)throw new Error(Fn);if(s<0)throw new Error(An);const o=tt(t);if(r>=o.length)return vt(null,null,null,null);const i=o[r],c=bt(i,t._decodedMemo,r,s,n||zt);if(c===-1)return vt(null,null,null,null);const d=i[c];if(d.length===1)return vt(null,null,null,null);const{names:h,resolvedSources:f}=t;return vt(f[d[Ir]],d[Mr]+1,d[Rr],d.length===5?h[d[xn]]:null)}m(Dn,"Le$1");z(Dn,"originalPositionFor");function Oc(t,e){const{source:r,line:s,column:n,bias:o}=e;return Br(t,r,s,n,o||zt,!1)}m(Oc,"ye");z(Oc,"generatedPositionFor");function Ec(t,e){const{source:r,line:s,column:n,bias:o}=e;return Br(t,r,s,n,o||Dt,!0)}m(Ec,"Ce$1");z(Ec,"allGeneratedPositionsFor");function Pc(t,e){const r=tt(t),{names:s,resolvedSources:n}=t;for(let o=0;o<r.length;o++){const i=r[o];for(let c=0;c<i.length;c++){const d=i[c],h=o+1,f=d[0];let p=null,l=null,g=null,w=null;d.length!==1&&(p=n[d[1]],l=d[2]+1,g=d[3]),d.length===5&&(w=s[d[4]]),e({generatedLine:h,generatedColumn:f,source:p,originalLine:l,originalColumn:g,name:w})}}}m(Pc,"Ie");z(Pc,"eachMapping");function Dr(t,e){const{sources:r,resolvedSources:s}=t;let n=r.indexOf(e);return n===-1&&(n=s.indexOf(e)),n}m(Dr,"re");z(Dr,"sourceIndex");function Bn(t,e){const{sourcesContent:r}=t;if(r==null)return null;const s=Dr(t,e);return s===-1?null:r[s]}m(Bn,"Ne$1");z(Bn,"sourceContentFor");function Fc(t,e){const{ignoreList:r}=t;if(r==null)return!1;const s=Dr(t,e);return s===-1?!1:r.includes(s)}m(Fc,"be");z(Fc,"isIgnored");function _n(t,e){const r=new Lr(Ht(t,[]),e);return r._decoded=t.mappings,r}m(_n,"se");z(_n,"presortedDecodedMap");function Ac(t){return Ht(t,tt(t))}m(Ac,"Re");z(Ac,"decodedMap");function Lc(t){return Ht(t,Ln(t))}m(Lc,"we$1");z(Lc,"encodedMap");function Ht(t,e){return{version:t.version,file:t.file,names:t.names,sourceRoot:t.sourceRoot,sources:t.sources,sourcesContent:t.sourcesContent,mappings:e,ignoreList:t.ignoreList||t.x_google_ignoreList}}m(Ht,"B$2");z(Ht,"clone");function vt(t,e,r,s){return{source:t,line:e,column:r,name:s}}m(vt,"b$2");z(vt,"OMapping");function it(t,e){return{line:t,column:e}}m(it,"y$4");z(it,"GMapping");function bt(t,e,r,s,n){let o=On(t,s,e,r);return Ze?o=(n===Dt?Er:Pr)(t,s,o):n===Dt&&o++,o===-1||o===t.length?-1:o}m(bt,"w$3");z(bt,"traceSegmentInternal");function Nn(t,e,r,s,n){let o=bt(t,e,r,s,zt);if(!Ze&&n===Dt&&o++,o===-1||o===t.length)return[];const i=Ze?s:t[o][Fe];Ze||(o=Pr(t,i,o));const c=Er(t,i,o),d=[];for(;o<=c;o++){const h=t[o];d.push(it(h[jn]+1,h[Sn]))}return d}m(Nn,"Ue");z(Nn,"sliceGeneratedPositions");function Br(t,e,r,s,n,o){var i,c;if(r--,r<0)throw new Error(Fn);if(s<0)throw new Error(An);const{sources:d,resolvedSources:h}=t;let f=d.indexOf(e);if(f===-1&&(f=h.indexOf(e)),f===-1)return o?[]:it(null,null);const p=(i=t)._bySourceMemos||(i._bySourceMemos=d.map(Fr)),l=((c=t)._bySources||(c._bySources=Mn(tt(t),p)))[f][r];if(l==null)return o?[]:it(null,null);const g=p[f];if(o)return Nn(l,g,r,s,n);const w=bt(l,g,r,s,n);if(w===-1)return it(null,null);const I=l[w];return it(I[jn]+1,I[Sn])}m(Br,"ie");z(Br,"generatedPosition");var Dc=Object.defineProperty,Bc=m((t,e)=>Dc(t,"name",{value:e,configurable:!0}),"f$4"),_c=Object.defineProperty,Gn=Bc((t,e)=>_c(t,"name",{value:e,configurable:!0}),"a");const Nc=ko(import.meta.url),gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_r=Gn(t=>{if(typeof gt<"u"&&gt.versions&&gt.versions.node){const[e,r]=gt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return gt.getBuiltinModule(t)}return Nc(t)},"__cjs_getBuiltinModule"),{readFileSync:Cs}=_r("node:fs"),{resolve:Gc,toNamespacedPath:Qt,dirname:qc}=_r("node:path"),{pathToFileURL:Uc}=_r("node:url");var zc=Object.defineProperty,kt=Gn((t,e)=>zc(t,"name",{value:e,configurable:!0}),"s");const Hc=/^data:application\/json[^,]+base64,/,Wc=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,Vc=/\r?\n/,ar=kt(t=>Hc.test(t),"isInlineMap"),Zt=kt((t,e)=>{const r=t instanceof Error?t.message:String(t),s=`${e}:
15
+ ${r}`;throw new Error(s)},"enhanceError"),Kc=kt((t,e)=>{const r=t.split(Vc);let s;for(let o=r.length-1;o>=0&&!s;o--)s=Wc.exec(r[o])??void 0;if(!s)return;const n=s[1]??s[2];if(n)return ar(n)?n:Gc(e,n)},"resolveSourceMapUrl"),Yc=kt(t=>{const e=t.slice(t.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Jc=kt(t=>{let e;try{e=Cs(t,{encoding:"utf8"})}catch(n){Zt(n,`Error reading sourcemap for file "${Qt(t)}"`)}const r=Kc(e,qc(t));if(!r)return;let s;if(ar(r))s=Yc(r);else try{s=Cs(r,{encoding:"utf8"})}catch(n){Zt(n,`Error reading sourcemap for file "${Qt(t)}"`)}try{const n=ar(r)?r:Uc(r).href;return new Mc(s,n)}catch(n){Zt(n,`Error parsing sourcemap for file "${Qt(t)}"`)}},"loadSourceMap");var Xc=Object.defineProperty,Pe=m((t,e)=>Xc(t,"name",{value:e,configurable:!0}),"l$3");const Qc=Pe(t=>ia(t),"stripAnsi"),Zc=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,el=/^\s*at\s+/,tl=Pe(t=>{const e=t.split(`
16
+ `);let r;for(let s=0;s<e.length;s++){const n=Zc.exec(e[s].trim());if(!n)continue;const o=[];for(let i=s+1;i<e.length&&i<=s+200;i++){const c=e[i];if(el.test(c))o.push(c.trim());else if(o.length>0||c.trim()!=="")break}if(o.length>0){const i=n.groups?.name??"Error",c=n.groups?.message??"";r={message:c,name:i,stack:`${i}: ${c}
17
+ ${o.map(d=>` ${d}`).join(`
18
+ `)}`}}}return r},"extractErrorBlock"),qn=Pe(t=>{if(t.startsWith("file://"))try{return yo(t)}catch{return t}return t},"normalizeFramePath"),rl=Pe(t=>!t.includes("node_modules")&&!t.startsWith("node:")&&!t.startsWith("internal/"),"isUserFrame"),sl=Pe(t=>{try{return Jc(t)}catch{return}},"tryLoadSourceMap"),nl=Pe((t,e)=>{if(!t.file||t.line===void 0)return;const r=qn(t.file),s=mo(r)?r:hs(e,r);if(!rl(s)||!Ne(s))return;const n=sl(s);if(n){const o=Dn(n,{column:t.column===void 0?0:Math.max(0,t.column-1),line:t.line});if(o.source&&o.line!=null){const i=hs(vo(s),o.source),c=Bn(n,o.source)??(Ne(i)?at(i,"utf8"):void 0);if(c!==void 0)return{column:o.column==null?void 0:o.column+1,file:i,line:o.line,source:c}}}return{column:t.column,file:s,line:t.line,source:at(s,"utf8")}},"resolveFrame"),Is=Pe((t,e)=>{const r=wo(e,t);return r&&!r.startsWith("..")?r:t},"shortPath"),Un=Pe((t,e)=>{if(!t?.trim())return t;try{const r=tl(Qc(t));if(!r)return t;const s=new Error(r.message);s.name=r.name,s.stack=r.stack;const n=pi(s);if(n.length===0)return t;const o=e.color,i={dim:Pe(l=>o?ps(l):l,"dim"),head:Pe(l=>o?bo(Yt(l)):l,"head"),loc:Pe(l=>o?$o(l):l,"loc")};let c,d;for(const l of n){const g=nl(l,e.cwd);if(g){c=g,d=l;break}}const h=[i.head(`✖ ${r.name}${r.message?`: ${r.message}`:""}`)];if(c){const l=`${Is(c.file,e.cwd)}:${c.line}${c.column?`:${c.column}`:""}`;h.push(` ${i.loc(l)}`,""),h.push(wc(c.source,{start:{column:c.column,line:c.line}},{color:o?{gutter:ps,marker:Yt,message:Yt}:void 0,linesAbove:2,linesBelow:3}))}const f=n.filter(l=>l!==d).slice(0,8).map(l=>{const g=l.methodName??"<anonymous>",w=l.file?`${Is(qn(l.file),e.cwd)}${l.line?`:${l.line}`:""}`:"";return i.dim(` at ${g}${w?` (${w})`:""}`)});f.length>0&&h.push("",...f);const p=i.dim("─".repeat(40));return`${h.join(`
20
19
  `)}
21
20
  ${p}
22
- ${r}`}catch{return r}},"renderFailureOutput");var Bl=Object.defineProperty,Le=v((r,e)=>Bl(r,"name",{value:e,configurable:!0}),"t");const ni={delimiter:" ",language:{d:Le(()=>" d","d"),future:"in %s",h:Le(()=>" h","h"),m:Le(()=>" m","m"),mo:Le(()=>" mo","mo"),ms:Le(()=>" ms","ms"),past:"%s ago",s:Le(()=>" s","s"),w:Le(()=>" w","w"),y:Le(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Le(r=>{const e=r[0]*1e3+r[1]/1e6;return cs(e,ni)},"formatHrtime");const nt=Le(r=>cs(r,ni),"formatMs");var Nl=Object.defineProperty,it=v((r,e)=>Nl(r,"name",{value:e,configurable:!0}),"s$1");const lt=it(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Ot=it(r=>{switch(r){case"failure":return{color:"red",icon:kr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:rs};case"skipped":return{color:"gray",icon:Vt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),St=it(r=>{const{color:e,icon:t}=Ot(r);return $e(te.createElement(d,{color:e},t),{columns:10}).trim()},"getStatusIcon"),_l=it(r=>{const{color:e,icon:t}=Ot(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return $e(te.createElement(d,null,te.createElement(d,{color:e},t)," ",te.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return $e(te.createElement(d,null,te.createElement(d,{dimColor:!0},t)," ",te.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return $e(te.createElement(d,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),Gl=it(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"),ql=it(r=>{const e=r.replaceAll(/\W+/g,"_"),t=Ao("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),Ul=it((r,e,t,n="auto")=>{const s=t.trim();if(!s)return;const o=`
23
- `,i=Gl(n);if(i==="github"&&e!=="failure"){process.stdout.write(`::group::${St(e)} ${r}${o}`),process.stdout.write(s+o),process.stdout.write(`::endgroup::${o}`);return}if(i==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=ql(r),m="\x1B[0K";process.stdout.write(`${m}section_start:${String(p)}:${c}[collapsed=true]\r${m}${St(e)} ${r}${o}`),process.stdout.write(s+o);const y=Math.floor(Date.now()/1e3);process.stdout.write(`${m}section_end:${String(y)}:${c}\r${m}${o}`);return}if(i==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${St(e)} ${r}${o}`),process.stdout.write(s+o);return}if(i==="azure"&&e!=="failure"){process.stdout.write(`##[group]${St(e)} ${r}${o}`),process.stdout.write(s+o),process.stdout.write(`##[endgroup]${o}`);return}const a=process.stdout.columns||80,l=$e(te.createElement(d,{dimColor:!0},Vt.repeat(a)),{columns:a}).trim(),f=_l(e),u=$e(te.createElement(d,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${l}${o}`),process.stdout.write(`${f} ${u}${o}`),process.stdout.write(s+o),process.stdout.write(`${l}${o}`)},"logCommandOutputCI");var Wl=Object.defineProperty,Jr=v((r,e)=>Wl(r,"name",{value:e,configurable:!0}),"d$1");const zl=Jr(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Ot(r),"getDisplayInfo"),Hl=Jr(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:n,statusValue:s,supportsInteractive:o,taskId:i})=>{if(!i)return;if(t)return"Esc cancel | Enter send";const a=r?"":" PAUSED (f resume)",l=o?" i INPUT":"";return e&&s==="running"&&n?`⏎ FULLSCREEN${l} f FOLLOW${a}`:e&&s==="running"?`f FOLLOW${l}${a}`:e&&n?`<enter> full screen${a}`:e?a||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),_n=Jr(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:n,output:s,scrollRef:o,showFullscreenHint:i,status:a,supportsInteractive:l=!0,taskId:f})=>{const u=a??"pending",{icon:p}=zl(u),c=t?"bold":"single",m=u==="failure"?"red":u==="success"||lt(u)?t?"green":"gray":u==="running"?t?"white":"cyan":t?"white":"gray",y=f?`${p} ${f}`:void 0,M=e===void 0?void 0:nt(e),D=Hl({autoScroll:r,focused:t,interactiveMode:n??!1,showFullscreenHint:i??!1,statusValue:u,supportsInteractive:l,taskId:f});if(!f)return g(k,{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 b=[];if(s)for(const S of s.split(`
24
- `))b.push(S.endsWith("\r")?S.slice(0,-1):S);return!s&&(u==="running"||u==="pending")?h(k,{borderBottomTitle:D,borderColor:m,borderStyle:c,borderTopRightTitle:M,borderTopTitle:y,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:h(k,{alignItems:"center",flexGrow:1,justifyContent:"center",children:h(d,{dimColor:!0,children:"Waiting for task output…"})})}):g(k,{borderBottomTitle:D,borderColor:n?"yellow":m,borderStyle:c,borderTopRightTitle:M,borderTopTitle:y,flexDirection:"column",flexGrow:1,children:[h(k,{flexGrow:1,flexShrink:1,paddingY:1,children:h(ss,{flexGrow:1,followOutput:r,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:h(d,{children:b.join(`
25
- `)})})}),n&&h(k,{flexShrink:0,justifyContent:"center",paddingX:1,children:h(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var Vl=Object.defineProperty,ft=v((r,e)=>Vl(r,"name",{value:e,configurable:!0}),"d");const Kl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},si=ft(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),Jl=ft(({status:r})=>r==="starting"?h(d,{color:"cyan",children:h(is,{type:"dots"})}):h(d,{bold:!0,color:si(r),children:Kl[r]}),"StatusGlyph"),Yl=ft(({active:r,focused:e,state:t})=>{const n=e&&r,s=n?">":" ",o=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return g(k,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[h(d,{children:s}),h(d,{children:" "}),h(k,{flexShrink:0,width:3,children:h(Jl,{status:t.status})}),h(k,{flexGrow:0,flexShrink:0,width:28,children:h(d,{bold:n,inverse:n,children:t.id})}),h(k,{flexGrow:1,flexShrink:1,overflow:"hidden",children:g(d,{color:si(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),Ql=ft(({states:r})=>{const e=[];for(const n of r)n.status==="ready"&&e.push(n.id);const t=e.join(", ");return g(k,{paddingX:1,children:[g(d,{bold:!0,color:"green",children:["● ","Services"]}),g(d,{children:[" ",String(e.length)," / ",String(r.length)," running"]}),t.length>0&&g(d,{dimColor:!0,children:[" ",t]}),h(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),Xl=ft(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?g(k,{flexDirection:"column",paddingX:1,children:[g(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,n)=>g(d,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(n)}`))]}):h(ts,{})},"CrashHeader"),Zl=ft(({activeIndex:r,focused:e,store:t})=>{const n=At(t.subscribe,t.getSnapshot),s=t.getIds();if(s.length===0)return h(ts,{});const o=s.map(u=>n.get(u)).filter(u=>u!==void 0),i=t.getDockState(),a=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan";return i==="ready"&&!e?h(k,{borderColor:a,borderStyle:"single",flexDirection:"row",flexShrink:0,children:h(Ql,{states:o})}):g(k,{borderBottomTitle:e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:a,borderStyle:e?"bold":"single",borderTopTitle:i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&h(Xl,{states:o}),o.map((u,p)=>h(Yl,{active:p===r,focused:e,state:u},u.id))]})},"ServiceDock");var ed=Object.defineProperty,Zt=v((r,e)=>ed(r,"name",{value:e,configurable:!0}),"T$2");const ii=6,oi=8,ai=12,td=Zt(r=>r==="running"||r==="pending"?ns:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":Vt,"getCacheLabel"),Gn=Zt((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),qn=Zt(({compact:r,focused:e,isSelected:t,pinLabel:n,row:s})=>{const{persistent:o,status:i,taskId:a}=s,l=e&&t,f=l?">":" ",u=i==="running"&&o===!0;let p;if(u)p=h(d,{bold:!0,color:"green",children:" ● "});else if(i==="running")p=g(d,{bold:!0,color:"white",children:[" ",h(is,{type:"dots"})," "]});else if(i==="pending")p=h(d,{bold:!0,color:"gray",children:" · "});else{const{color:m,icon:y}=Ot(i);p=g(d,{bold:!0,color:m,children:[" ",y," "]})}let c=ns;return u?c="running":i!=="running"&&i!=="pending"?c=s.duration===void 0?Vt:nt(s.duration):i==="running"&&s.elapsed!==void 0&&(c=nt(s.elapsed)),g(k,{children:[h(d,{children:f}),h(k,{width:ii,children:p}),g(k,{flexGrow:1,children:[h(d,{bold:l,inverse:l,children:a}),n?h(d,{dimColor:!0,children:` ${n}`}):null]}),!r&&h(k,{justifyContent:"flex-end",width:oi,children:h(d,{dimColor:!lt(i),children:td(i)})}),!r&&h(k,{justifyContent:"flex-end",width:ai,children:h(d,{color:u?"green":void 0,dimColor:i==="pending"||u,children:c})})]})},"TaskListRow"),Un=Zt(({compact:r,filterActive:e,filterText:t,focused:n,headerStatus:s,parallelSlots:o=3,pinnedTaskIds:i,rows:a,scrollRef:l,selectedIndex:f,title:u})=>{const p=s==="error"?"red":s==="success"?"green":n?"white":"gray",c=a[f]?.taskId,m=[];let y=0;for(const S of a)S.status==="running"?m.push(S):S.status==="pending"&&(y+=1);const M=Math.min(o,m.length+y),D=M>1,b=[];if(D)for(let S=0;S<M;S++){const R=m[S];R?b.push(h(qn,{compact:r,focused:n,isSelected:R.taskId===c,pinLabel:Gn(R.taskId,i),row:R},`par-${R.taskId}`)):b.push(g(k,{children:[h(d,{children:" "}),h(k,{width:ii,children:h(d,{bold:!0,color:"gray",children:" · "})}),h(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(S)}`))}return g(k,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[g(k,{flexShrink:0,paddingX:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{children:` ${u}`}),!r&&g(k,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[h(k,{justifyContent:"flex-end",width:oi,children:h(d,{dimColor:!0,children:"Cache"})}),h(k,{justifyContent:"flex-end",width:ai,children:h(d,{dimColor:!0,children:"Duration"})})]})]}),h(ss,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:l,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.map(S=>h(qn,{compact:r,focused:n,isSelected:S.taskId===c,pinLabel:Gn(S.taskId,i),row:S},S.taskId))}),D&&h(k,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:b}),e&&g(k,{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 rd=Object.defineProperty,nd=v((r,e)=>rd(r,"name",{value:e,configurable:!0}),"ue");const Wn=40,zn=10,Hn=100,sd=Object.freeze([]),id=nd(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:n,serviceDockStore:s,stdinRegistry:o,store:i,targets:a,tasks:l})=>{const{exit:f}=Co(),{columns:u,rows:p}=Io(),c=At(i.subscribe,i.getSnapshot),m=jt(P=>s?s.subscribe(P):()=>{},[s]);At(m,()=>s?s.getDockState():"ready");const y=s?s.getIds():sd,M=y.length>0,[D,b]=yt(0),[S,R]=yt(null),x=At(m,()=>S&&s?s.getState(S):void 0),[O,w]=yt(!1),T=wt(null),A=wt(null),F=wt(null),[U,ae]=yt(!1),[X,K]=yt(!0),ce=wt({list:0,splitList:0,splitOutput:0}),Me=jt(()=>{c.viewMode==="list"?ce.current.list=A.current?.getScrollOffset()??0:c.viewMode==="split"&&(ce.current.splitList=A.current?.getScrollOffset()??0,ce.current.splitOutput=F.current?.getScrollOffset()??0)},[c.viewMode]),ie=jt(P=>{setTimeout(()=>{if(P==="list"){const C=ce.current.list;A.current?.scrollTo(C)}else if(P==="split"){const C=ce.current.splitList;C>0?A.current?.scrollTo(C):A.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),F.current?.scrollTo(ce.current.splitOutput)}},0)},[i]),ge=wt(!1);rr(()=>{c.done&&!ge.current&&(ge.current=!0,r>0&&ae(!0)),!c.done&&ge.current&&(ge.current=!1,ae(!1))},[c.done,r]);const J=nr(()=>{const P=y.length>0?new Set(y):null,C=c.filterText?c.filterText.toLowerCase():null,L=[];for(const Q of c.rows)P?.has(Q.taskId)||c.statusFilter==="failed"&&Q.status!=="failure"||c.statusFilter==="running"&&Q.status!=="running"&&Q.status!=="pending"||c.statusFilter==="passed"&&Q.status!=="success"&&!lt(Q.status)||C&&!Q.taskId.toLowerCase().includes(C)||L.push(Q);return L},[c.rows,c.filterText,c.statusFilter,y]),re=nr(()=>{let P=0;for(const C of c.rows)C.status==="running"&&(P+=1);return P},[c.rows]),ue=(J[c.selectedIndex]??null)?.taskId??null,le=S?null:c.pinnedTaskIds[0]??ue,_=le?c.rows.find(P=>P.taskId===le):null,Y=x??null,me=S?(Y?.tailLines??[]).join(`
26
- `):le?c.outputs.get(le)??"":"",Je=nr(()=>_?.status==="failure"&&me?ri(me,{color:!process.env.NO_COLOR,cwd:process.cwd()}):me,[_?.status,me]),Ye=S??le,ot=S?Y?.status==="crashed"||Y?.status==="failed"?"failure":"running":_?.status,oe=Or(n,a,l),Ae=c.done?`Completed ${oe} (${nt((c.endTime??Date.now())-c.startTime)})`:`Running ${oe}...`,We=c.done?c.failed>0?"error":"success":"running",ke=jt(P=>{A.current?.scrollTo(Math.max(0,P-2))},[]);if(rr(()=>{c.interactiveMode&&_?.status!=="running"&&i.setInteractiveMode(!1)},[c.interactiveMode,_?.status,i]),rr(()=>{if(!le)return;let P=u;c.viewMode==="split"&&u>=Hn?P=u-Math.floor(u*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(P=u-2);const C=Math.max(1,p-4);o.get(le)?.resize?.(P,C)},[u,p,c.viewMode,le]),Sn((P,C)=>{if(C.escape){i.setInteractiveMode(!1);return}if(!le)return;const L=o.get(le);if(!L){i.setInteractiveMode(!1);return}if(C.return)L.write("\r");else if(C.upArrow)L.write("\x1B[A");else if(C.downArrow)L.write("\x1B[B");else if(C.rightArrow)L.write("\x1B[C");else if(C.leftArrow)L.write("\x1B[D");else if(C.backspace)L.write("");else if(C.delete)L.write("\x1B[3~");else if(C.tab)L.write(" ");else if(C.home)L.write("\x1B[H");else if(C.end)L.write("\x1B[F");else if(C.pageUp)L.write("\x1B[5~");else if(C.pageDown)L.write("\x1B[6~");else if(C.ctrl&&P){const Q=P.toUpperCase().codePointAt(0);Q!==void 0&&Q>=65&&Q<=90&&L.write(String.fromCodePoint(Q-64))}else P&&L.write(P)},{isActive:c.interactiveMode}),Sn((P,C)=>{if(P==="c"&&C.ctrl){f();return}if(!U){if(O){C.escape||P==="?"?w(!1):P==="q"?(w(!1),ae(!0)):C.downArrow||P==="j"?T.current?.scrollBy(1):C.upArrow||P==="k"?T.current?.scrollBy(-1):C.pageDown?T.current?.scrollBy(5):C.pageUp?T.current?.scrollBy(-5):C.home?T.current?.scrollToTop():C.end&&T.current?.scrollToBottom();return}if(P==="?"){w(!0);return}if(P==="q"){ae(!0);return}if(P==="r"&&c.done){i.requestRerun();return}if(P==="R"&&c.done){const L=J[c.selectedIndex];L?.status==="failure"&&i.requestRetry(L.taskId);return}if(P==="F"&&!c.filterActive){const L=["all","failed","running","passed"],Q=L.indexOf(c.statusFilter);i.setStatusFilter(L[(Q+1)%L.length]);return}if(c.filterActive){if(C.escape){i.setFilterActive(!1);return}if(C.return){i.setFilterActive(!1);return}if(C.backspace){i.setFilter(c.filterText.slice(0,-1));return}if(P&&!C.ctrl&&!C.meta){i.setFilter(c.filterText+P);return}return}if(P==="i"&&_?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(C.escape){i.setViewMode("split"),ie("split");return}if(P==="f"){const L=!X;K(L),L&&F.current?.scrollToBottom();return}if(C.downArrow||P==="j"){K(!1),F.current?.scrollBy(1);return}if(C.upArrow||P==="k"){K(!1),F.current?.scrollBy(-1);return}if(C.pageDown||C.ctrl&&P==="d"){K(!1),F.current?.scrollBy(12);return}if(C.pageUp||C.ctrl&&P==="u"){K(!1),F.current?.scrollBy(-12);return}if(C.home){K(!1),F.current?.scrollToTop();return}if(C.end){K(!0),F.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&M&&s){if(C.tab){R(null),i.setFocusedPanel("tasks");return}if(C.escape){i.setFocusedPanel("tasks"),R(null),c.viewMode==="split"&&(i.setViewMode("list"),ie("list"));return}if(C.downArrow||P==="j"){b(L=>Math.min(L+1,y.length-1));return}if(C.upArrow||P==="k"){b(L=>Math.max(L-1,0));return}if(C.return){const L=y[D];L&&(R(L),K(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split"));return}if((P==="r"||P==="R")&&e){const L=y[D],Q=L?s.getState(L)?.status:void 0;if(L&&(Q==="crashed"||Q==="failed")){const Qe=e(L);Qe instanceof Promise&&Qe.catch(()=>{})}return}return}if(c.viewMode==="split"){if(C.tab){c.focusedPanel==="tasks"?i.setFocusedPanel("output"):M?i.setFocusedPanel("dock"):(R(null),i.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(C.escape){if(S&&M){R(null),i.setViewMode("list"),i.setFocusedPanel("dock"),ie("list");return}R(null),i.setFocusedPanel("tasks");return}if(C.return){Me(),i.setViewMode("fullscreen");return}if(P==="f"){const L=!X;K(L),L&&F.current?.scrollToBottom();return}if(C.downArrow||P==="j"){K(!1),F.current?.scrollBy(1);return}if(C.upArrow||P==="k"){K(!1),F.current?.scrollBy(-1);return}if(C.pageDown||C.ctrl&&P==="d"){K(!1),F.current?.scrollBy(12);return}if(C.pageUp||C.ctrl&&P==="u"){K(!1),F.current?.scrollBy(-12);return}if(C.home){K(!1),F.current?.scrollToTop();return}if(C.end){K(!0),F.current?.scrollToBottom();return}return}if(C.escape){i.setViewMode("list"),ie("list");return}if(C.return){i.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(C.tab&&c.viewMode==="list"&&M){i.setFocusedPanel("dock");return}if(C.downArrow||P==="j"){const L=Math.min(c.selectedIndex+1,Math.max(0,J.length-1));i.setSelectedIndex(L),ke(L);return}if(C.upArrow||P==="k"){const L=Math.max(c.selectedIndex-1,0);i.setSelectedIndex(L),ke(L);return}if(C.return&&c.viewMode==="list"){K(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split");return}if(P==="/"){i.setFilterActive(!0);return}if(P==="1"&&ue){i.pinTask(0,ue);return}if(P==="2"&&ue){i.pinTask(1,ue);return}if(P==="0"){i.clearPins();return}C.escape&&c.filterText&&i.setFilter("")}}},{isActive:!c.interactiveMode}),u<Wn||p<zn)return h(k,{alignItems:"center",height:p,justifyContent:"center",width:u,children:g(d,{color:"yellow",children:["Terminal too small (",u,"x",p,"). Minimum:"," ",Wn,"x",zn]})});const ze=g(k,{gap:1,children:[c.succeeded>0&&g(d,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&g(d,{bold:!0,color:"red",children:["✗"," ",c.failed]}),re>0&&g(d,{color:"cyan",children:["◷"," ",re]}),g(d,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&g(d,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let Ee;if(c.viewMode==="fullscreen")Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"^u ^d"}),h(d,{dimColor:!0,children:"PAGE"})]},"page"),..._?.status==="running"?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const P=J[c.selectedIndex]?.status==="failure";Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"r"}),h(d,{dimColor:!0,children:"RERUN"})]},"r"),...P?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"R"}),h(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"FILTER"})]},"F"),g(k,{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"?Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),..._?.status==="running"?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?")]:Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"/"}),h(d,{dimColor:!0,children:"FILTER"})]},"/"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"STATUS"})]},"F"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const be=g(k,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[h(k,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Ee}),h(k,{flexShrink:0,paddingX:1,children:ze})]}),He=g(xo,{backgroundColor:"#1e1e1e",footer:g(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:T,title:"KEYBOARD SHORTCUTS",visible:O,width:52,children:[g(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Move up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Move down"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Tab"]}),h(d,{dimColor:!0,children:" Switch panel (split)"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Esc"]}),h(d,{dimColor:!0,children:" Back / close"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Enter"]}),h(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),g(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"VIEWS"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Enter"]}),g(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Esc"]}),g(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),g(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"ACTIONS"})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","/"]}),h(d,{dimColor:!0,children:" Filter by text"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","F"]}),h(d,{dimColor:!0,children:" Filter by status"})]})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(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"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","0"]}),h(d,{dimColor:!0,children:" Clear pins"})]})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","r"]}),h(d,{dimColor:!0,children:" Rerun all (done)"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","R"]}),h(d,{dimColor:!0,children:" Retry failed task"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","i"]}),h(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),g(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"SCROLLING"}),h(d,{dimColor:!0,children:" (output panel)"})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Scroll up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Scroll down"})]})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","^u"]}),h(d,{dimColor:!0,children:" Page up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","^d"]}),h(d,{dimColor:!0,children:" Page down"})]})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Home"]}),h(d,{dimColor:!0,children:" Top"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","End"]}),h(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","f"]}),h(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),g(k,{flexDirection:"column",children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"GENERAL"})]}),g(k,{children:[h(k,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","q"]}),h(d,{dimColor:!0,children:" Quit"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","?"]}),h(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Se=h(Ii,{autoExitSeconds:r>0?r:3,onCancel:v(()=>{ae(!1)},"onCancel"),visible:U}),ye=M&&s?h(Zl,{activeIndex:D,focused:c.focusedPanel==="dock",store:s}):null;if(c.viewMode==="fullscreen")return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{flexGrow:1,children:h(_n,{autoScroll:X,duration:_?.duration??_?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:Je,scrollRef:F,status:ot,supportsInteractive:!S,taskId:Ye})}),ye,be,Se,He]});if(c.viewMode==="split"){const P=u>=Hn,C=h(Un,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:We,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:J,scrollRef:A,selectedIndex:c.selectedIndex,title:Ae}),L=h(_n,{autoScroll:X,duration:_?.duration??_?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:Je,scrollRef:F,showFullscreenHint:!0,status:ot,supportsInteractive:!S,taskId:Ye});if(P){const Qe=Math.floor(u*.4);return g(k,{flexDirection:"column",height:p,width:u,children:[g(k,{flexDirection:"row",flexGrow:1,children:[h(k,{width:Qe,children:C}),h(k,{flexGrow:1,children:L})]}),ye,be,Se,He]})}const Q=Math.floor(p*.45);return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{height:Q,children:C}),h(k,{flexGrow:1,children:L}),ye,be,Se,He]})}return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{flexGrow:1,children:h(Un,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:We,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:J,scrollRef:A,selectedIndex:c.selectedIndex,title:Ae})}),ye,be,Se,He]})},"VisTaskRunnerApp");var od=Object.defineProperty,Ze=v((r,e)=>od(r,"name",{value:e,configurable:!0}),"r$1");const ad=Ze(r=>{const{args:e,autoExit:t=!1,onRetryService:n,outputStyle:s="normal",projectNames:o,serviceDockStore:i,stdinRegistry:a,tasks:l}=r,f=new Ut(l),u=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,m;const y=new Promise(T=>{m=T});let M;const D=Ze(()=>{M&&(clearInterval(M),M=void 0)},"cleanup"),b=Ze(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),S=Ze(()=>{if(a){for(const T of a.values())T.kill?.();a.clear()}},"killAllPtyProcesses"),R=Ze(()=>{D(),w(),S(),b(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),x=Ze(()=>{const T=f.getSnapshot(),A=nt(Date.now()-T.startTime),F=T.rows.filter(X=>X.status==="failure").map(X=>X.taskId),U=process.stdout.columns||80;process.stdout.write(`
27
- `);for(const X of T.rows){const{persistent:K,status:ce,taskId:Me}=X,ie=ce==="running"||ce==="pending",ge=Ot(ce),J=ie&&K?"■":ge.icon,re=ie&&K?"gray":ge.color;let ue="";switch(ce){case"local-cache":case"local-cache-kept-existing":{ue=" [local cache]";break}case"remote-cache":{ue=" [remote cache]";break}case"skipped":{ue=" [skipped]";break}default:{ie&&K?ue=" [stopped]":ie&&(ue=" [skipped]");break}}const le=X.retryAttempts&&X.retryAttempts>0?` [retried ${X.retryAttempts}x]`:"",_=$e(te.createElement(d,null," ",te.createElement(d,{color:re},J),` vis run ${Me}`,ue?te.createElement(d,{dimColor:!0},` ${ue}`):null,le?te.createElement(d,{color:"yellow"},le):null),{columns:U});process.stdout.write(`${_}
21
+ ${t}`}catch{return t}},"renderFailureOutput");var il=Object.defineProperty,Le=m((t,e)=>il(t,"name",{value:e,configurable:!0}),"t");const zn={delimiter:" ",language:{d:Le(()=>" d","d"),future:"in %s",h:Le(()=>" h","h"),m:Le(()=>" m","m"),mo:Le(()=>" mo","mo"),ms:Le(()=>" ms","ms"),past:"%s ago",s:Le(()=>" s","s"),w:Le(()=>" w","w"),y:Le(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Le(t=>{const e=t[0]*1e3+t[1]/1e6;return Js(e,zn)},"formatHrtime");const et=Le(t=>Js(t,zn),"formatMs");var ol=Object.defineProperty,rt=m((t,e)=>ol(t,"name",{value:e,configurable:!0}),"s$1");const ot=rt(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus"),xt=rt(t=>{switch(t){case"failure":return{color:"red",icon:fr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Hs};case"skipped":return{color:"gray",icon:Nt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=rt(t=>{const{color:e,icon:r}=xt(t);return $e(te.createElement(u,{color:e},r),{columns:10}).trim()},"getStatusIcon"),al=rt(t=>{const{color:e,icon:r}=xt(t);switch(t){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return $e(te.createElement(u,null,te.createElement(u,{color:e},r)," ",te.createElement(u,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return $e(te.createElement(u,null,te.createElement(u,{dimColor:!0},r)," ",te.createElement(u,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return $e(te.createElement(u,{color:e},r),{columns:10}).trim()}},"getStatusPrefix"),cl=rt(t=>t==="azure"||t==="buildkite"||t==="github"||t==="gitlab"||t==="off"?t: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"),ll=rt(t=>{const e=t.replaceAll(/\W+/g,"_"),r=xo("sha256").update(t).digest("hex").slice(0,6);return`${e}_${r}`},"toGitLabSectionKey"),ul=rt((t,e,r,s="auto")=>{const n=r.trim();if(!n)return;const o=`
22
+ `,i=cl(s);if(i==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${t}${o}`),process.stdout.write(n+o),process.stdout.write(`::endgroup::${o}`);return}if(i==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),l=ll(t),g="\x1B[0K";process.stdout.write(`${g}section_start:${String(p)}:${l}[collapsed=true]\r${g}${wt(e)} ${t}${o}`),process.stdout.write(n+o);const w=Math.floor(Date.now()/1e3);process.stdout.write(`${g}section_end:${String(w)}:${l}\r${g}${o}`);return}if(i==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${t}${o}`),process.stdout.write(n+o);return}if(i==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${t}${o}`),process.stdout.write(n+o),process.stdout.write(`##[endgroup]${o}`);return}const c=process.stdout.columns||80,d=$e(te.createElement(u,{dimColor:!0},Nt.repeat(c)),{columns:c}).trim(),h=al(e),f=$e(te.createElement(u,{bold:!0},t),{columns:c}).trim();process.stdout.write(`${d}${o}`),process.stdout.write(`${h} ${f}${o}`),process.stdout.write(n+o),process.stdout.write(`${d}${o}`)},"logCommandOutputCI");var dl=Object.defineProperty,Nr=m((t,e)=>dl(t,"name",{value:e,configurable:!0}),"d$1");const fl=Nr(t=>t==="running"?{color:"white",icon:"•"}:t==="pending"?{color:"gray",icon:"·"}:xt(t),"getDisplayInfo"),hl=Nr(({autoScroll:t,focused:e,interactiveMode:r,showFullscreenHint:s,statusValue:n,supportsInteractive:o,taskId:i})=>{if(!i)return;if(r)return"Esc cancel | Enter send";const c=t?"":" PAUSED (f resume)",d=o?" i INPUT":"";return e&&n==="running"&&s?`⏎ FULLSCREEN${d} f FOLLOW${c}`:e&&n==="running"?`f FOLLOW${d}${c}`:e&&s?`<enter> full screen${c}`:e?c||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Ms=Nr(({autoScroll:t=!0,duration:e,focused:r,interactiveMode:s,output:n,scrollRef:o,showFullscreenHint:i,status:c,supportsInteractive:d=!0,taskId:h})=>{const f=c??"pending",{icon:p}=fl(f),l=r?"bold":"single",g=f==="failure"?"red":f==="success"||ot(f)?r?"green":"gray":f==="running"?r?"white":"cyan":r?"white":"gray",w=h?`${p} ${h}`:void 0,I=e===void 0?void 0:et(e),L=hl({autoScroll:t,focused:r,interactiveMode:s??!1,showFullscreenHint:i??!1,statusValue:f,supportsInteractive:d,taskId:h});if(!h)return a.jsxs($,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[a.jsx(u,{dimColor:!0,children:"Select a task to view output"}),a.jsx(u,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const b=[];if(n)for(const k of n.split(`
23
+ `))b.push(k.endsWith("\r")?k.slice(0,-1):k);return!n&&(f==="running"||f==="pending")?a.jsx($,{borderBottomTitle:L,borderColor:g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:w,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:a.jsx($,{alignItems:"center",flexGrow:1,justifyContent:"center",children:a.jsx(u,{dimColor:!0,children:"Waiting for task output…"})})}):a.jsxs($,{borderBottomTitle:L,borderColor:s?"yellow":g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:w,flexDirection:"column",flexGrow:1,children:[a.jsx($,{flexGrow:1,flexShrink:1,paddingY:1,children:a.jsx(Us,{flexGrow:1,followOutput:t,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.jsx(u,{children:b.join(`
24
+ `)})})}),s&&a.jsx($,{flexShrink:0,justifyContent:"center",paddingX:1,children:a.jsx(u,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var pl=Object.defineProperty,lt=m((t,e)=>pl(t,"name",{value:e,configurable:!0}),"d");const gl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Hn=lt(t=>t==="ready"?"green":t==="crashed"||t==="failed"?"red":t==="starting"?"cyan":"gray","statusColor"),ml=lt(({status:t})=>t==="starting"?a.jsx(u,{color:"cyan",children:a.jsx(Vs,{type:"dots"})}):a.jsx(u,{bold:!0,color:Hn(t),children:gl[t]}),"StatusGlyph"),vl=lt(({active:t,focused:e,state:r})=>{const s=e&&t,n=s?">":" ",o=r.status==="ready"?r.port?`running, port ${String(r.port)}`:"running":r.status==="failed"||r.status==="crashed"?r.errorMessage??"exited":r.lastLine??"booting…";return a.jsxs($,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[a.jsx(u,{children:n}),a.jsx(u,{children:" "}),a.jsx($,{flexShrink:0,width:3,children:a.jsx(ml,{status:r.status})}),a.jsx($,{flexGrow:0,flexShrink:0,width:28,children:a.jsx(u,{bold:s,inverse:s,children:r.id})}),a.jsx($,{flexGrow:1,flexShrink:1,overflow:"hidden",children:a.jsxs(u,{color:Hn(r.status),dimColor:r.status!=="crashed"&&r.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),wl=lt(({states:t})=>{const e=[];for(const s of t)s.status==="ready"&&e.push(s.id);const r=e.join(", ");return a.jsxs($,{paddingX:1,children:[a.jsxs(u,{bold:!0,color:"green",children:["● ","Services"]}),a.jsxs(u,{children:[" ",String(e.length)," / ",String(t.length)," running"]}),r.length>0&&a.jsxs(u,{dimColor:!0,children:[" ",r]}),a.jsx(u,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),yl=lt(({states:t})=>{const e=t.find(r=>r.status==="crashed"||r.status==="failed");return e?a.jsxs($,{flexDirection:"column",paddingX:1,children:[a.jsxs(u,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((r,s)=>a.jsxs(u,{color:"red",dimColor:!0,children:[" ",r]},`crash-${String(s)}`))]}):a.jsx(a.Fragment,{})},"CrashHeader"),$l=lt(({activeIndex:t,focused:e,store:r})=>{const s=K.useSyncExternalStore(r.subscribe,r.getSnapshot),n=r.getIds();if(n.length===0)return a.jsx(a.Fragment,{});const o=n.map(f=>s.get(f)).filter(f=>f!==void 0),i=r.getDockState(),c=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan",d=i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",h=e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return i==="ready"&&!e?a.jsx($,{borderColor:c,borderStyle:"single",flexDirection:"row",flexShrink:0,children:a.jsx(wl,{states:o})}):a.jsxs($,{borderBottomTitle:h,borderColor:c,borderStyle:e?"bold":"single",borderTopTitle:d,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&a.jsx(yl,{states:o}),o.map((f,p)=>a.jsx(vl,{active:p===t,focused:e,state:f},f.id))]})},"ServiceDock");var bl=Object.defineProperty,Wt=m((t,e)=>bl(t,"name",{value:e,configurable:!0}),"T$2");const Wn=6,Vn=8,Kn=12,kl=Wt(t=>t==="running"||t==="pending"?Ws:t==="local-cache"||t==="local-cache-kept-existing"?"Local":t==="remote-cache"?"Remote":Nt,"getCacheLabel"),Rs=Wt((t,e)=>e[0]===t?"[1]":e[1]===t?"[2]":"","getPinLabel"),Os=Wt(({compact:t,focused:e,isSelected:r,pinLabel:s,row:n})=>{const{persistent:o,status:i,taskId:c}=n,d=e&&r,h=d?">":" ",f=i==="running"&&o===!0;let p;if(f)p=a.jsx(u,{bold:!0,color:"green",children:" ● "});else if(i==="running")p=a.jsxs(u,{bold:!0,color:"white",children:[" ",a.jsx(Vs,{type:"dots"})," "]});else if(i==="pending")p=a.jsx(u,{bold:!0,color:"gray",children:" · "});else{const{color:g,icon:w}=xt(i);p=a.jsxs(u,{bold:!0,color:g,children:[" ",w," "]})}let l=Ws;return f?l="running":i!=="running"&&i!=="pending"?l=n.duration===void 0?Nt:et(n.duration):i==="running"&&n.elapsed!==void 0&&(l=et(n.elapsed)),a.jsxs($,{children:[a.jsx(u,{children:h}),a.jsx($,{width:Wn,children:p}),a.jsxs($,{flexGrow:1,children:[a.jsx(u,{bold:d,inverse:d,children:c}),s?a.jsx(u,{dimColor:!0,children:` ${s}`}):null]}),!t&&a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(u,{dimColor:!ot(i),children:kl(i)})}),!t&&a.jsx($,{justifyContent:"flex-end",width:Kn,children:a.jsx(u,{color:f?"green":void 0,dimColor:i==="pending"||f,children:l})})]})},"TaskListRow"),Es=Wt(({compact:t,filterActive:e,filterText:r,focused:s,headerStatus:n,parallelSlots:o=3,pinnedTaskIds:i,rows:c,scrollRef:d,selectedIndex:h,title:f})=>{const p=n==="error"?"red":n==="success"?"green":s?"white":"gray",l=c[h]?.taskId,g=[];let w=0;for(const k of c)k.status==="running"?g.push(k):k.status==="pending"&&(w+=1);const I=Math.min(o,g.length+w),L=I>1,b=[];if(L)for(let k=0;k<I;k++){const R=g[k];R?b.push(a.jsx(Os,{compact:t,focused:s,isSelected:R.taskId===l,pinLabel:Rs(R.taskId,i),row:R},`par-${R.taskId}`)):b.push(a.jsxs($,{children:[a.jsx(u,{children:" "}),a.jsx($,{width:Wn,children:a.jsx(u,{bold:!0,color:"gray",children:" · "})}),a.jsx(u,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(k)}`))}return a.jsxs($,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a.jsxs($,{flexShrink:0,paddingX:1,children:[a.jsx(u,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(u,{children:` ${f}`}),!t&&a.jsxs($,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(u,{dimColor:!0,children:"Cache"})}),a.jsx($,{justifyContent:"flex-end",width:Kn,children:a.jsx(u,{dimColor:!0,children:"Duration"})})]})]}),a.jsx(Us,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:c.map(k=>a.jsx(Os,{compact:t,focused:s,isSelected:k.taskId===l,pinLabel:Rs(k.taskId,i),row:k},k.taskId))}),L&&a.jsx($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:b}),e&&a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[a.jsx(u,{bold:!0,color:"white",children:"/ "}),a.jsx(u,{children:r}),a.jsx(u,{inverse:!0,children:" "})]})]})},"TaskListPanel");var xl=Object.defineProperty,jl=m((t,e)=>xl(t,"name",{value:e,configurable:!0}),"ue");const Ps=40,Fs=10,As=100,Sl=Object.freeze([]),Tl=jl(({autoExitSeconds:t,onRetryService:e,parallelSlots:r,projectNames:s,serviceDockStore:n,stdinRegistry:o,store:i,targets:c,tasks:d})=>{const{exit:h}=gi(),{columns:f,rows:p}=mi(),l=K.useSyncExternalStore(i.subscribe,i.getSnapshot),g=K.useCallback(E=>n?n.subscribe(E):()=>{},[n]);K.useSyncExternalStore(g,()=>n?n.getDockState():"ready");const w=n?n.getIds():Sl,I=w.length>0,[L,b]=K.useState(0),[k,R]=K.useState(null),j=K.useSyncExternalStore(g,()=>k&&n?n.getState(k):void 0),[C,v]=K.useState(!1),x=K.useRef(null),F=K.useRef(null),P=K.useRef(null),[q,ae]=K.useState(!1),[Q,V]=K.useState(!0),ce=K.useRef({list:0,splitList:0,splitOutput:0}),Me=K.useCallback(()=>{l.viewMode==="list"?ce.current.list=F.current?.getScrollOffset()??0:l.viewMode==="split"&&(ce.current.splitList=F.current?.getScrollOffset()??0,ce.current.splitOutput=P.current?.getScrollOffset()??0)},[l.viewMode]),ie=K.useCallback(E=>{setTimeout(()=>{if(E==="list"){const S=ce.current.list;F.current?.scrollTo(S)}else if(E==="split"){const S=ce.current.splitList;S>0?F.current?.scrollTo(S):F.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),P.current?.scrollTo(ce.current.splitOutput)}},0)},[i]),ge=K.useRef(!1);K.useEffect(()=>{l.done&&!ge.current&&(ge.current=!0,t>0&&ae(!0)),!l.done&&ge.current&&(ge.current=!1,ae(!1))},[l.done,t]);const Y=K.useMemo(()=>{const E=w.length>0?new Set(w):null,S=l.filterText?l.filterText.toLowerCase():null,A=[];for(const X of l.rows)E?.has(X.taskId)||l.statusFilter==="failed"&&X.status!=="failure"||l.statusFilter==="running"&&X.status!=="running"&&X.status!=="pending"||l.statusFilter==="passed"&&X.status!=="success"&&!ot(X.status)||S&&!X.taskId.toLowerCase().includes(S)||A.push(X);return A},[l.rows,l.filterText,l.statusFilter,w]),re=K.useMemo(()=>{let E=0;for(const S of l.rows)S.status==="running"&&(E+=1);return E},[l.rows]),de=(Y[l.selectedIndex]??null)?.taskId??null,le=k?null:l.pinnedTaskIds[0]??de,_=le?l.rows.find(E=>E.taskId===le):null,J=j??null,me=k?(J?.tailLines??[]).join(`
25
+ `):le?l.outputs.get(le)??"":"",Ke=K.useMemo(()=>_?.status==="failure"&&me?Un(me,{color:!process.env.NO_COLOR,cwd:process.cwd()}):me,[_?.status,me]),Ye=k??le,st=k?J?.status==="crashed"||J?.status==="failed"?"failure":"running":_?.status,oe=yr(s,c,d),Ae=l.done?`Completed ${oe} (${et((l.endTime??Date.now())-l.startTime)})`:`Running ${oe}...`,Ue=l.done?l.failed>0?"error":"success":"running",be=K.useCallback(E=>{F.current?.scrollTo(Math.max(0,E-2))},[]);if(K.useEffect(()=>{l.interactiveMode&&_?.status!=="running"&&i.setInteractiveMode(!1)},[l.interactiveMode,_?.status,i]),K.useEffect(()=>{if(!le)return;let E=f;l.viewMode==="split"&&f>=As?E=f-Math.floor(f*.4)-2:(l.viewMode==="split"||l.viewMode==="fullscreen")&&(E=f-2);const S=Math.max(1,p-4);o.get(le)?.resize?.(E,S)},[f,p,l.viewMode,le]),cs((E,S)=>{if(S.escape){i.setInteractiveMode(!1);return}if(!le)return;const A=o.get(le);if(!A){i.setInteractiveMode(!1);return}if(S.return)A.write("\r");else if(S.upArrow)A.write("\x1B[A");else if(S.downArrow)A.write("\x1B[B");else if(S.rightArrow)A.write("\x1B[C");else if(S.leftArrow)A.write("\x1B[D");else if(S.backspace)A.write("");else if(S.delete)A.write("\x1B[3~");else if(S.tab)A.write(" ");else if(S.home)A.write("\x1B[H");else if(S.end)A.write("\x1B[F");else if(S.pageUp)A.write("\x1B[5~");else if(S.pageDown)A.write("\x1B[6~");else if(S.ctrl&&E){const X=E.toUpperCase().codePointAt(0);X!==void 0&&X>=65&&X<=90&&A.write(String.fromCodePoint(X-64))}else E&&A.write(E)},{isActive:l.interactiveMode}),cs((E,S)=>{if(E==="c"&&S.ctrl){h();return}if(!q){if(C){S.escape||E==="?"?v(!1):E==="q"?(v(!1),ae(!0)):S.downArrow||E==="j"?x.current?.scrollBy(1):S.upArrow||E==="k"?x.current?.scrollBy(-1):S.pageDown?x.current?.scrollBy(5):S.pageUp?x.current?.scrollBy(-5):S.home?x.current?.scrollToTop():S.end&&x.current?.scrollToBottom();return}if(E==="?"){v(!0);return}if(E==="q"){ae(!0);return}if(E==="r"&&l.done){i.requestRerun();return}if(E==="R"&&l.done){const A=Y[l.selectedIndex];A?.status==="failure"&&i.requestRetry(A.taskId);return}if(E==="F"&&!l.filterActive){const A=["all","failed","running","passed"],X=A.indexOf(l.statusFilter);i.setStatusFilter(A[(X+1)%A.length]);return}if(l.filterActive){if(S.escape){i.setFilterActive(!1);return}if(S.return){i.setFilterActive(!1);return}if(S.backspace){i.setFilter(l.filterText.slice(0,-1));return}if(E&&!S.ctrl&&!S.meta){i.setFilter(l.filterText+E);return}return}if(E==="i"&&_?.status==="running"&&(l.viewMode==="fullscreen"||l.viewMode==="split"&&l.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(l.viewMode==="fullscreen"){if(S.escape){i.setViewMode("split"),ie("split");return}if(E==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(S.downArrow||E==="j"){V(!1),P.current?.scrollBy(1);return}if(S.upArrow||E==="k"){V(!1),P.current?.scrollBy(-1);return}if(S.pageDown||S.ctrl&&E==="d"){V(!1),P.current?.scrollBy(12);return}if(S.pageUp||S.ctrl&&E==="u"){V(!1),P.current?.scrollBy(-12);return}if(S.home){V(!1),P.current?.scrollToTop();return}if(S.end){V(!0),P.current?.scrollToBottom();return}return}if(l.focusedPanel==="dock"&&I&&n){if(S.tab){R(null),i.setFocusedPanel("tasks");return}if(S.escape){i.setFocusedPanel("tasks"),R(null),l.viewMode==="split"&&(i.setViewMode("list"),ie("list"));return}if(S.downArrow||E==="j"){b(A=>Math.min(A+1,w.length-1));return}if(S.upArrow||E==="k"){b(A=>Math.max(A-1,0));return}if(S.return){const A=w[L];A&&(R(A),V(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split"));return}if((E==="r"||E==="R")&&e){const A=w[L],X=A?n.getState(A)?.status:void 0;if(A&&(X==="crashed"||X==="failed")){const Je=e(A);Je instanceof Promise&&Je.catch(()=>{})}return}return}if(l.viewMode==="split"){if(S.tab){l.focusedPanel==="tasks"?i.setFocusedPanel("output"):I?i.setFocusedPanel("dock"):(R(null),i.setFocusedPanel("tasks"));return}if(l.focusedPanel==="output"){if(S.escape){if(k&&I){R(null),i.setViewMode("list"),i.setFocusedPanel("dock"),ie("list");return}R(null),i.setFocusedPanel("tasks");return}if(S.return){Me(),i.setViewMode("fullscreen");return}if(E==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(S.downArrow||E==="j"){V(!1),P.current?.scrollBy(1);return}if(S.upArrow||E==="k"){V(!1),P.current?.scrollBy(-1);return}if(S.pageDown||S.ctrl&&E==="d"){V(!1),P.current?.scrollBy(12);return}if(S.pageUp||S.ctrl&&E==="u"){V(!1),P.current?.scrollBy(-12);return}if(S.home){V(!1),P.current?.scrollToTop();return}if(S.end){V(!0),P.current?.scrollToBottom();return}return}if(S.escape){i.setViewMode("list"),ie("list");return}if(S.return){i.setFocusedPanel("output");return}}if(l.viewMode==="list"||l.viewMode==="split"&&l.focusedPanel==="tasks"){if(S.tab&&l.viewMode==="list"&&I){i.setFocusedPanel("dock");return}if(S.downArrow||E==="j"){const A=Math.min(l.selectedIndex+1,Math.max(0,Y.length-1));i.setSelectedIndex(A),be(A);return}if(S.upArrow||E==="k"){const A=Math.max(l.selectedIndex-1,0);i.setSelectedIndex(A),be(A);return}if(S.return&&l.viewMode==="list"){V(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split");return}if(E==="/"){i.setFilterActive(!0);return}if(E==="1"&&de){i.pinTask(0,de);return}if(E==="2"&&de){i.pinTask(1,de);return}if(E==="0"){i.clearPins();return}S.escape&&l.filterText&&i.setFilter("")}}},{isActive:!l.interactiveMode}),f<Ps||p<Fs)return a.jsx($,{alignItems:"center",height:p,justifyContent:"center",width:f,children:a.jsxs(u,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",Ps,"x",Fs]})});const ze=a.jsxs($,{gap:1,children:[l.succeeded>0&&a.jsxs(u,{bold:!0,color:"green",children:["✓"," ",l.succeeded]}),l.failed>0&&a.jsxs(u,{bold:!0,color:"red",children:["✗"," ",l.failed]}),re>0&&a.jsxs(u,{color:"cyan",children:["◷"," ",re]}),a.jsxs(u,{dimColor:!0,children:[l.rows.length," ","total"]}),l.statusFilter!=="all"&&a.jsxs(u,{color:"yellow",children:["[",l.statusFilter,"]"]})]});let Re;if(l.viewMode==="fullscreen")Re=[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"Esc"}),a.jsx(u,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"↑↓"}),a.jsx(u,{dimColor:!0,children:"SCROLL"})]},"scroll"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"^u ^d"}),a.jsx(u,{dimColor:!0,children:"PAGE"})]},"page"),..._?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"i"}),a.jsx(u,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"q"}),a.jsx(u,{dimColor:!0,children:"QUIT"})]},"q")];else if(l.done){const E=Y[l.selectedIndex]?.status==="failure";Re=[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"q"}),a.jsx(u,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"r"}),a.jsx(u,{dimColor:!0,children:"RERUN"})]},"r"),...E?[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"R"}),a.jsx(u,{dimColor:!0,children:"RETRY"})]},"R")]:[],a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"?"}),a.jsx(u,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"↑↓"}),a.jsx(u,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"F"}),a.jsx(u,{dimColor:!0,children:"FILTER"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"⏎"}),a.jsx(u,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else l.viewMode==="split"&&l.focusedPanel==="output"?Re=[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"q"}),a.jsx(u,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"Esc"}),a.jsx(u,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"↑↓"}),a.jsx(u,{dimColor:!0,children:"SCROLL"})]},"scroll"),..._?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"i"}),a.jsx(u,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"⏎"}),a.jsx(u,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"Tab"}),a.jsx(u,{dimColor:!0,children:"PANEL"})]},"tab"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"?"}),a.jsx(u,{dimColor:!0,children:"HELP"})]},"?")]:Re=[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"q"}),a.jsx(u,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"?"}),a.jsx(u,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"↑↓"}),a.jsx(u,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"/"}),a.jsx(u,{dimColor:!0,children:"FILTER"})]},"/"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"F"}),a.jsx(u,{dimColor:!0,children:"STATUS"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"⏎"}),a.jsx(u,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...l.viewMode==="split"?[a.jsxs($,{gap:1,children:[a.jsx(u,{bold:!0,color:"white",children:"Tab"}),a.jsx(u,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const ke=a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[a.jsx($,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Re}),a.jsx($,{flexShrink:0,paddingX:1,children:ze})]}),He=a.jsxs(vi,{backgroundColor:"#1e1e1e",footer:a.jsxs(u,{dimColor:!0,children:[a.jsx(u,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",a.jsx(u,{bold:!0,color:"white",children:"?"}),"/",a.jsx(u,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:x,title:"KEYBOARD SHORTCUTS",visible:C,width:52,children:[a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(u,{dimColor:!0,children:"── "}),a.jsx(u,{bold:!0,color:"white",children:"NAVIGATION"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(u,{dimColor:!0,children:" Move up"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(u,{dimColor:!0,children:" Move down"})]})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Tab"]}),a.jsx(u,{dimColor:!0,children:" Switch panel (split)"})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsx(u,{dimColor:!0,children:" Back / close"})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsx(u,{dimColor:!0,children:" Show output / fullscreen"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(u,{dimColor:!0,children:"── "}),a.jsx(u,{bold:!0,color:"white",children:"VIEWS"})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsxs(u,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsxs(u,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(u,{dimColor:!0,children:"── "}),a.jsx(u,{bold:!0,color:"white",children:"ACTIONS"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","/"]}),a.jsx(u,{dimColor:!0,children:" Filter by text"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","F"]}),a.jsx(u,{dimColor:!0,children:" Filter by status"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","1"]}),a.jsx(u,{dimColor:!0,children:"/"}),a.jsx(u,{bold:!0,color:"white",children:"2"}),a.jsx(u,{dimColor:!0,children:" Pin to output pane"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","0"]}),a.jsx(u,{dimColor:!0,children:" Clear pins"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","r"]}),a.jsx(u,{dimColor:!0,children:" Rerun all (done)"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","R"]}),a.jsx(u,{dimColor:!0,children:" Retry failed task"})]})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","i"]}),a.jsx(u,{dimColor:!0,children:" Interactive input (running task)"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(u,{dimColor:!0,children:"── "}),a.jsx(u,{bold:!0,color:"white",children:"SCROLLING"}),a.jsx(u,{dimColor:!0,children:" (output panel)"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(u,{dimColor:!0,children:" Scroll up"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(u,{dimColor:!0,children:" Scroll down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","^u"]}),a.jsx(u,{dimColor:!0,children:" Page up"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","^d"]}),a.jsx(u,{dimColor:!0,children:" Page down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","Home"]}),a.jsx(u,{dimColor:!0,children:" Top"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","End"]}),a.jsx(u,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","f"]}),a.jsx(u,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{marginBottom:1,children:[a.jsx(u,{dimColor:!0,children:"── "}),a.jsx(u,{bold:!0,color:"white",children:"GENERAL"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","q"]}),a.jsx(u,{dimColor:!0,children:" Quit"})]})}),a.jsxs(u,{children:[a.jsxs(u,{bold:!0,color:"white",children:[" ","?"]}),a.jsx(u,{dimColor:!0,children:" Toggle help"})]})]})]})]}),xe=a.jsx(wi,{autoExitSeconds:t>0?t:3,onCancel:m(()=>{ae(!1)},"onCancel"),visible:q}),we=I&&n?a.jsx($l,{activeIndex:L,focused:l.focusedPanel==="dock",store:n}):null;if(l.viewMode==="fullscreen")return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Ms,{autoScroll:Q,duration:_?.duration??_?.elapsed,focused:!0,interactiveMode:l.interactiveMode,output:Ke,scrollRef:P,status:st,supportsInteractive:!k,taskId:Ye})}),we,ke,xe,He]});if(l.viewMode==="split"){const E=f>=As,S=a.jsx(Es,{compact:!0,filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel==="tasks",headerStatus:Ue,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae}),A=a.jsx(Ms,{autoScroll:Q,duration:_?.duration??_?.elapsed,focused:l.focusedPanel==="output",interactiveMode:l.interactiveMode,output:Ke,scrollRef:P,showFullscreenHint:!0,status:st,supportsInteractive:!k,taskId:Ye});if(E){const Je=Math.floor(f*.4);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsxs($,{flexDirection:"row",flexGrow:1,children:[a.jsx($,{width:Je,children:S}),a.jsx($,{flexGrow:1,children:A})]}),we,ke,xe,He]})}const X=Math.floor(p*.45);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{height:X,children:S}),a.jsx($,{flexGrow:1,children:A}),we,ke,xe,He]})}return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Es,{filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel!=="dock",headerStatus:Ue,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae})}),we,ke,xe,He]})},"VisTaskRunnerApp");var Cl=Object.defineProperty,Qe=m((t,e)=>Cl(t,"name",{value:e,configurable:!0}),"r$1");const Il=Qe(t=>{const{args:e,autoExit:r=!1,onRetryService:s,outputStyle:n="normal",projectNames:o,serviceDockStore:i,stdinRegistry:c,tasks:d}=t,h=new Lt(d),f=typeof e.parallel=="number"?e.parallel:3,p=r===!0?3:typeof r=="number"?r:0;let l,g;const w=new Promise(x=>{g=x});let I;const L=Qe(()=>{I&&(clearInterval(I),I=void 0)},"cleanup"),b=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(c){for(const x of c.values())x.kill?.();c.clear()}},"killAllPtyProcesses"),R=Qe(()=>{L(),v(),k(),b(),process.stdout.write("\x1B[?1049l\x1B[?25h"),l?.cleanup(),process.exit(1)},"onSignal"),j=Qe(()=>{const x=h.getSnapshot(),F=et(Date.now()-x.startTime),P=x.rows.filter(Q=>Q.status==="failure").map(Q=>Q.taskId),q=process.stdout.columns||80;process.stdout.write(`
26
+ `);for(const Q of x.rows){const{persistent:V,status:ce,taskId:Me}=Q,ie=ce==="running"||ce==="pending",ge=xt(ce),Y=ie&&V?"■":ge.icon,re=ie&&V?"gray":ge.color;let de="";switch(ce){case"local-cache":case"local-cache-kept-existing":{de=" [local cache]";break}case"remote-cache":{de=" [remote cache]";break}case"skipped":{de=" [skipped]";break}default:{ie&&V?de=" [stopped]":ie&&(de=" [skipped]");break}}const le=Q.retryAttempts&&Q.retryAttempts>0?` [retried ${Q.retryAttempts}x]`:"",_=$e(te.createElement(u,null," ",te.createElement(u,{color:re},Y),` vis run ${Me}`,de?te.createElement(u,{dimColor:!0},` ${de}`):null,le?te.createElement(u,{color:"yellow"},le):null),{columns:q});process.stdout.write(`${_}
28
27
  `)}process.stdout.write(`
29
- `);const ae=$e(te.createElement(gs,{cached:T.cached,failed:T.failed,failedIds:F,projectNames:o,retriedIds:T.retriedIds.length>0?T.retriedIds:void 0,succeeded:T.succeeded,targets:e.targets,tasks:l,took:A}),{columns:U});if(process.stdout.write(`${ae}
30
- `),F.length>0&&s!=="quiet")for(const X of F){const K=T.outputs.get(X);if(K?.trim()){const ce=$e(te.createElement(d,null,`
31
- `,te.createElement(d,{bold:!0,color:"red"},` ${kr} vis run ${X}`)),{columns:U});process.stdout.write(`${ce}
28
+ `);const ae=$e(te.createElement(nn,{cached:x.cached,failed:x.failed,failedIds:P,projectNames:o,retriedIds:x.retriedIds.length>0?x.retriedIds:void 0,succeeded:x.succeeded,targets:e.targets,tasks:d,took:F}),{columns:q});if(process.stdout.write(`${ae}
29
+ `),P.length>0&&n!=="quiet")for(const Q of P){const V=x.outputs.get(Q);if(V?.trim()){const ce=$e(te.createElement(u,null,`
30
+ `,te.createElement(u,{bold:!0,color:"red"},` ${fr} vis run ${Q}`)),{columns:q});process.stdout.write(`${ce}
32
31
 
33
- `);const Me=K.trim().split(`
32
+ `);const Me=V.trim().split(`
34
33
  `).map(ie=>` ${ie}`).join(`
35
34
  `);process.stdout.write(`${Me}
36
- `)}}},"printExitSummary");let O;const w=Ze(()=>{O&&(clearInterval(O),O=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){D(),f.markDone(),O||(O=setInterval(()=>{},1e3))},endTasks(T){f.endTasks(T)},printCacheDisabledByTask(T){f.addOutput(T.id,`ⓘ caching disabled by task via disableCache()
37
- `)},printEmptyFingerprintWarning(T,A){f.addOutput(T.id,`ⓘ caching skipped — ${A}
38
- `)},printSelfModifyingSkip(T,A){f.addOutput(T.id,`ⓘ caching skipped — task modified its own input${A.length===1?"":"s"} (${A.join(", ")})
39
- `)},printTaskTerminalOutput(T,A,F){f.getSnapshot().outputs.has(T.id)||f.addOutput(T.id,F)},startCommand(){process.on("SIGINT",R),process.on("SIGTERM",R),O||(O=setInterval(()=>{},1e3)),c=To(te.createElement(id,{autoExitSeconds:p,onRetryService:n,parallelSlots:u,projectNames:o,serviceDockStore:i,stdinRegistry:a??new Map,store:f,targets:e.targets,tasks:l}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{w(),S(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),x(),m()}).catch(()=>{w(),S(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),m()})},startTasks(T){f.startTasks(T),M||(M=setInterval(()=>{f.tick()},100))}},renderIsDone:y,store:f}},"createDynamicOutputRenderer");var cd=Object.defineProperty,Yr=v((r,e)=>cd(r,"name",{value:e,configurable:!0}),"p$1");const ld=Yr(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),dd=Yr((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class ud{static{v(this,"StaticOutputLifeCycle")}static{Yr(this,"StaticOutputLifeCycle")}#e;#n;#r;#s=[];#t=[];#i=[];#o=new Map;#a;#c;#l;#u=0;constructor(e){this.#e=e.projectNames,this.#n=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#u=Date.now();const e=process.stdout.columns||80,t=`Running ${Or(this.#e,this.#n,this.#r)}`,n=$e(te.createElement(ur,{title:t,variant:"info"}),{columns:e});process.stdout.write(n);const s=this.#r[0],o=s?.overrides?Object.entries(s.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
35
+ `)}}},"printExitSummary");let C;const v=Qe(()=>{C&&(clearInterval(C),C=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){L(),h.markDone(),C||(C=setInterval(()=>{},1e3))},endTasks(x){h.endTasks(x)},printCacheDisabledByTask(x){h.addOutput(x.id,`ⓘ caching disabled by task via disableCache()
36
+ `)},printEmptyFingerprintWarning(x,F){h.addOutput(x.id,`ⓘ caching skipped — ${F}
37
+ `)},printSelfModifyingSkip(x,F){h.addOutput(x.id,`ⓘ caching skipped — task modified its own input${F.length===1?"":"s"} (${F.join(", ")})
38
+ `)},printTaskTerminalOutput(x,F,P){h.getSnapshot().outputs.has(x.id)||h.addOutput(x.id,P)},startCommand(){process.on("SIGINT",R),process.on("SIGTERM",R),C||(C=setInterval(()=>{},1e3)),l=yi(te.createElement(Tl,{autoExitSeconds:p,onRetryService:s,parallelSlots:f,projectNames:o,serviceDockStore:i,stdinRegistry:c??new Map,store:h,targets:e.targets,tasks:d}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),l.waitUntilExit().then(()=>{v(),k(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),j(),g()}).catch(()=>{v(),k(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),g()})},startTasks(x){h.startTasks(x),I||(I=setInterval(()=>{h.tick()},100))}},renderIsDone:w,store:h}},"createDynamicOutputRenderer");var Ml=Object.defineProperty,Gr=m((t,e)=>Ml(t,"name",{value:e,configurable:!0}),"p$1");const Rl=Gr(t=>t==="quiet"?"quiet":"normal","parseOutputStyle"),Ol=Gr((t,e)=>{const r=t.overrides.visOptions;return r?.outputStyle==="normal"||r?.outputStyle==="quiet"?r.outputStyle:e},"resolveTaskOutputStyle");class El{static{m(this,"StaticOutputLifeCycle")}static{Gr(this,"StaticOutputLifeCycle")}#e;#s;#r;#n=[];#t=[];#i=[];#o=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,r=`Running ${yr(this.#e,this.#s,this.#r)}`,s=$e(te.createElement(rr,{title:r,variant:"info"}),{columns:e});process.stdout.write(s);const n=this.#r[0],o=n?.overrides?Object.entries(n.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
40
39
  With additional flags:
41
- `);for(const[i,a]of o)process.stdout.write(`${ic(" ",i,a)}
40
+ `);for(const[i,c]of o)process.stdout.write(`${Za(" ",i,c)}
42
41
  `)}process.stdout.write(`
43
- `)}startTasks(e){const t=process.stdout.columns||80;for(const n of e){const s=$e(te.createElement(d,null,te.createElement(d,{dimColor:!0},">"),` ${n.id}`),{columns:t});process.stdout.write(`${s}
44
- `)}}endTasks(e){const t=process.stdout.columns||80;for(const n of e){this.#o.set(n.task.id,n),n.status==="failure"?this.#s.push(n):lt(n.status)&&this.#t.push(n),n.retryAttempts&&n.retryAttempts>0&&this.#i.push(n);const s=St(n.status),o=n.startTime&&n.endTime?` (${nt(n.endTime-n.startTime)})`:"",i=lt(n.status)?" [cache]":"",a=n.retryAttempts&&n.retryAttempts>0?` [retried ${n.retryAttempts}x]`:"",l=$e(te.createElement(d,null,s,` ${n.task.id}`,i?te.createElement(d,{color:"cyan"},i):null,a?te.createElement(d,{color:"yellow"},a):null,o?te.createElement(d,{dimColor:!0},o):null),{columns:t});process.stdout.write(`${l}
45
- `)}}#d(e){const t=process.stdout.columns||80,n=$e(te.createElement(d,{dimColor:!0},` ⓘ ${e}`),{columns:t});process.stdout.write(`${n}
46
- `)}printCacheDisabledByTask(e){this.#d(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,t){this.#d(`${e.id}: caching skipped — task modified its own input${t.length===1?"":"s"} (${t.join(", ")})`)}printEmptyFingerprintWarning(e,t){this.#d(`${e.id}: caching skipped — ${t}`)}printTaskTerminalOutput(e,t,n){if(dd(e,this.#c)==="quiet"&&(t==="success"||lt(t)))return;const s=t==="failure"?ri(n,{color:!process.env.NO_COLOR,cwd:process.cwd()}):n;if(this.#a){this.#a.printTaskTerminalOutput(e,t,s);return}Ul(e.id,t,s,this.#l)}endCommand(){const e=nt(Date.now()-this.#u),t=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
47
- `);const n=process.stdout.columns||80,s=$e(te.createElement(gs,{cached:this.#t.length,failed:this.#s.length,failedIds:this.#s.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#o.size-this.#s.length-this.#t.length,targets:this.#n,tasks:this.#r,took:e}),{columns:n});process.stdout.write(`${s}
48
- `)}}var fd=Object.defineProperty,er=v((r,e)=>fd(r,"name",{value:e,configurable:!0}),"o");const hd=er(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||Lo()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=xi(e);try{if(t==="zsh"){await pd(r);return}if(t==="bash"){await gd(r);return}t==="fish"&&await md(r)}catch{}},"appendToShellHistory"),pd=er(async r=>{const e=process.env.HISTFILE??de(process.env.ZDOTDIR??Sr(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
49
- `;await br(e,t)},"writeZshHistory"),gd=er(async r=>{const e=process.env.HISTFILE??de(Sr(),".bash_history");await br(e,`${r}
50
- `)},"writeBashHistory"),md=er(async r=>{const e=de(Sr(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
42
+ `)}startTasks(e){const r=process.stdout.columns||80;for(const s of e){const n=$e(te.createElement(u,null,te.createElement(u,{dimColor:!0},">"),` ${s.id}`),{columns:r});process.stdout.write(`${n}
43
+ `)}}endTasks(e){const r=process.stdout.columns||80;for(const s of e){this.#o.set(s.task.id,s),s.status==="failure"?this.#n.push(s):ot(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#i.push(s);const n=wt(s.status),o=s.startTime&&s.endTime?` (${et(s.endTime-s.startTime)})`:"",i=ot(s.status)?" [cache]":"",c=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",d=$e(te.createElement(u,null,n,` ${s.task.id}`,i?te.createElement(u,{color:"cyan"},i):null,c?te.createElement(u,{color:"yellow"},c):null,o?te.createElement(u,{dimColor:!0},o):null),{columns:r});process.stdout.write(`${d}
44
+ `)}}#u(e){const r=process.stdout.columns||80,s=$e(te.createElement(u,{dimColor:!0},` ⓘ ${e}`),{columns:r});process.stdout.write(`${s}
45
+ `)}printCacheDisabledByTask(e){this.#u(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,r){this.#u(`${e.id}: caching skipped — task modified its own input${r.length===1?"":"s"} (${r.join(", ")})`)}printEmptyFingerprintWarning(e,r){this.#u(`${e.id}: caching skipped — ${r}`)}printTaskTerminalOutput(e,r,s){if(Ol(e,this.#c)==="quiet"&&(r==="success"||ot(r)))return;const n=r==="failure"?Un(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,r,n);return}ul(e.id,r,n,this.#l)}endCommand(){const e=et(Date.now()-this.#d),r=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
46
+ `);const s=process.stdout.columns||80,n=$e(te.createElement(nn,{cached:this.#t.length,failed:this.#n.length,failedIds:this.#n.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:r.length>0?r:void 0,succeeded:this.#o.size-this.#n.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${n}
47
+ `)}}var Pl=Object.defineProperty,Vt=m((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"o");const Fl=Vt(async t=>{if(process.env.VIS_NO_SHELL_HISTORY||jo()==="win32")return;const e=process.env.SHELL;if(!e)return;const r=fi(e);try{if(r==="zsh"){await Al(t);return}if(r==="bash"){await Ll(t);return}r==="fish"&&await Dl(t)}catch{}},"appendToShellHistory"),Al=Vt(async t=>{const e=process.env.HISTFILE??ue(process.env.ZDOTDIR??pr(),".zsh_history"),r=`: ${Math.floor(Date.now()/1e3)}:0;${t}
48
+ `;await hr(e,r)},"writeZshHistory"),Ll=Vt(async t=>{const e=process.env.HISTFILE??ue(pr(),".bash_history");await hr(e,`${t}
49
+ `)},"writeBashHistory"),Dl=Vt(async t=>{const e=ue(pr(),".local","share","fish","fish_history"),r=`- cmd: ${t.replaceAll("\\","\\\\").replaceAll(`
51
50
  `,String.raw`\n`)}
52
51
  when: ${Math.floor(Date.now()/1e3)}
53
- `;await br(e,t)},"writeFishHistory");var vd=Object.defineProperty,lr=v((r,e)=>vd(r,"name",{value:e,configurable:!0}),"e");const yd=lr(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:n,timeoutMs:s}=r;if(s<=0)return{cancel:lr(()=>{},"cancel")};const o=Math.max(e,0);let i;const a=setTimeout(()=>{t?.(),n("SIGTERM"),o>0&&(i=setTimeout(()=>{n("SIGKILL")},o))},s);return{cancel:lr(()=>{clearTimeout(a),i&&clearTimeout(i)},"cancel")}},"scheduleTimeoutKill");var wd=Object.defineProperty,$d=v((r,e)=>wd(r,"name",{value:e,configurable:!0}),"n");const kd=$d((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const n=t.toLowerCase();return{filter:t,tasks:r.filter(s=>s.target.project.toLowerCase().includes(n))}},"applyProjectFilter");var bd=Object.defineProperty,Be=v((r,e)=>bd(r,"name",{value:e,configurable:!0}),"a$1");const Sd=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
54
- `),Td=Be(r=>{r.write(`${Sd}
55
- `)},"writeHelp"),xd=Be(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,n=t.isRaw===!0;if(n)try{t.setRawMode?.(!1)}catch{}return await new Promise(s=>{let o="";const i=Be(a=>{o+=typeof a=="string"?a:a.toString("utf8");const l=o.indexOf(`
56
- `);if(l===-1)return;const f=o.slice(0,l).replace(/\r$/,"").trim();if(r.off("data",i),n)try{t.setRawMode?.(!0)}catch{}s(f.length>0?f:void 0)},"onData");r.on("data",i)})},"defaultPromptFilter"),Cd=Be(r=>{const{handlers:e}=r,t=r.input??process.stdin,n=r.output??process.stdout,s=r.promptFilter??xd;if(!t||t.isTTY===!1)return{close:Be(()=>{},"close")};ao(t);const o=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let i=!1;const a=Be(async u=>{if(u.ctrl===!0&&u.name==="c"){await e.onQuit();return}if(!i)switch(u.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const p=await s(t,n);p===void 0?n.write(`filter cancelled.
57
- `):await e.onFilter(p)}finally{i=!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=>{n.write(`[vis watch] keybind handler failed: ${c.message}
58
- `)})},"onKeypress"),f=t;return f.on("keypress",l),{close:Be(()=>{if(f.off("keypress",l),!o)try{t.setRawMode?.(!1)}catch{}const u=t;if(typeof u.pause=="function")try{u.pause()}catch{}},"close")}},"installKeybinds");var Id=Object.defineProperty,vr=v((r,e)=>Id(r,"name",{value:e,configurable:!0}),"y");const Od=vr(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Md=vr(async r=>{const{initialTasks:e,probe:t,registeredEntries:n,taskGraph:s,visVersion:o}=r,i=new Map,a=new Map,l=new Map;for(const w of n)if(uo(w.pid)){if(w.visVersion!==o){a.set(w.id,w);continue}i.set(w.id,w)}if(t){const w=[...i.values()],T=await Promise.all(w.map(async A=>{try{return[A.id,await t(A)]}catch{return[A.id,!1]}}));for(const[A,F]of T)if(!F){const U=i.get(A);i.delete(A),U&&l.set(A,U)}}const f=new Set(e.map(w=>w.id)),u=new Set,p=[],c=[],m=new Set;for(const w of Object.values(s.dependencies))for(const T of w)m.add(T);for(const[w,T]of Object.entries(s.tasks)){if(!Od(T)?.service)continue;if(i.has(w)){u.add(w),c.push(i.get(w));continue}if(f.has(w)||!m.has(w))continue;const A=a.get(w),F=l.get(w);let U;A?U=`Service ${w} is registered with vis ${A.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${w}\` to pick up the new version.`:F?U=`Service ${w} is registered (PID ${String(F.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${w}\` to recover.`:U=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,p.push({message:U,targetId:w})}if(u.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:s};const y=new Map,M=vr(w=>{const T=new Set,A=[...s.dependencies[w]??[]],F=new Set;for(;A.length>0;){const U=A.pop();if(!F.has(U)){F.add(U),u.has(U)&&T.add(U);for(const ae of s.dependencies[U]??[])F.has(ae)||A.push(ae)}}return[...T].sort()},"collectTransitiveServices"),D=new Map;for(const w of Object.keys(s.dependencies)){if(u.has(w))continue;const T=M(w);if(T.length===0)continue;const A={};for(const F of T){const U=i.get(F);if(!U)continue;Object.assign(A,U.env);const ae=D.get(F);ae?ae.push(w):D.set(F,[w])}Object.keys(A).length>0&&y.set(w,A)}for(const w of D.values())w.sort();const b={};for(const[w,T]of Object.entries(s.tasks))u.has(w)||(b[w]=T);const S={};for(const[w,T]of Object.entries(s.dependencies))u.has(w)||(S[w]=T.filter(A=>!u.has(A)));const R=new Map;for(const w of Object.keys(b))R.set(w,0);for(const w of Object.values(S))for(const T of w)R.has(T)&&R.set(T,(R.get(T)??0)+1);const x=[];for(const w of s.roots)!u.has(w)&&b[w]&&x.push(w);for(const[w,T]of R)T===0&&!x.includes(w)&&b[w]&&x.push(w);const O=e.filter(w=>!u.has(w.id));return{diagnostics:p,initialTasks:O,satisfiedServices:c,serviceDependentsByServiceId:D,serviceEnvByTaskId:y,taskGraph:{dependencies:S,roots:x,tasks:b}}},"applyServiceRegistry");var Ed=Object.defineProperty,Tt=v((r,e)=>Ed(r,"name",{value:e,configurable:!0}),"c");const Ft="[[VIS_BOOT]]",Rd=250,jd=1e3,Vn=3,Pd=Tt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Kn=Tt(r=>{try{const e=dt(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class Fd{static{v(this,"ServiceEventBridge")}static{Tt(this,"ServiceEventBridge")}#e;#n;#r;#s;#t=new Map;#i=new Map;#o=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#n=new Map(e.services),this.#r=e.sink,this.#s=e.workspaceRoot}onProcessEvent=Tt(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.#n.has(e))return;const n=((this.#t.get(e)??"")+t).split(`
59
- `),s=n.pop()??"";this.#t.set(e,s);for(const o of n)this.#l(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,t){this.#r.started(e,t)}onRegistryTaskStarted(e){this.#n.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,n){if(this.#n.get(e)?.mode!=="registry")return;if(n||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:n});return}const s=await fo(this.#s,e);if(!s){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=s,i=o.readiness?.tcp?.port??o.port??0,a=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:a,logFile:s.logFile,pid:s.pid,port:i})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#h(e,t.logFile),t.pid!==null&&this.#p(e,t.pid)}notifyRegistryFailed(e,t,n){this.#r.failed(e,t,n)}async retry(e){const t=this.#n.get(e);if(t){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#w(e,t.registry);return}t.mode==="ephemeral"&&this.#y(e,t.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(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.#i.clear()}#l(e,t){if(t.startsWith(Ft)){this.#u(e,t.slice(Ft.length));return}const n=this.#i.get(e)??[];n.push(t),n.length>Vn&&n.shift(),this.#i.set(e,n),this.#r.log(e,`${t}
60
- `)}#u(e,t){let n;try{n=JSON.parse(t)}catch{this.#r.log(e,`${Ft+t}
61
- `);return}switch(n.event){case"failed":{const s=typeof n.reason=="string"?n.reason:"unknown",o={};for(const[i,a]of Object.entries(n))i!=="event"&&i!=="id"&&i!=="reason"&&(o[i]=a);this.#r.failed(e,s,o);break}case"ready":{const s=typeof n.host=="string"?n.host:"127.0.0.1",o=typeof n.port=="number"?n.port:0;this.#r.ready(e,{host:s,port:o}),this.#d(e);break}case"started":{const s=typeof n.pid=="number"?n.pid:null;this.#r.started(e,s);break}default:this.#r.log(e,`${Ft+t}
62
- `)}}#d(e){const t=this.#n.get(e);if(t?.ephemeral===void 0)return;this.#h(e,t.ephemeral.logFile);const n=Kn(t.ephemeral.pidFile);n!==null&&this.#p(e,n)}#h(e,t){if(this.#o.has(e)||!_e(t))return;const n=no(t,"r"),s=(()=>{try{return _t(t).size}catch{return 0}})(),o={fd:n,logFile:t,pollTimer:setInterval(()=>{this.#m(e)},Rd),position:s};this.#o.set(e,o)}#m(e){const t=this.#o.get(e);if(t)try{const n=_t(t.logFile);if(n.size<=t.position)return;const s=Buffer.alloc(n.size-t.position),o=so(t.fd,s,0,s.length,t.position);if(o>0){t.position+=o;const i=s.subarray(0,o).toString("utf8");for(const a of i.split(`
63
- `))a.length!==0&&this.#v(e,a);this.#r.log(e,i)}}catch{}}#v(e,t){const n=this.#i.get(e)??[];for(n.push(t);n.length>Vn;)n.shift();this.#i.set(e,n)}#p(e,t){if(this.#a.has(e))return;const n={pid:t,timer:setInterval(()=>{if(!Pd(t)){const s=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,s)}},jd)};this.#a.set(e,n)}#f(e){const t=this.#o.get(e);if(t){clearInterval(t.pollTimer);try{io(t.fd)}catch{}this.#o.delete(e)}const n=this.#a.get(e);n&&(clearInterval(n.timer),this.#a.delete(e))}#y(e,t){if(t===void 0)return;const n=Kn(t.pidFile);if(n!==null)try{process.kill(-n,"SIGTERM")}catch{}const s=No("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});s.stdout.on("data",i=>{this.#g(e,i)}),s.stderr.on("data",i=>{this.#g(e,i)}),s.on("error",i=>{this.#r.failed(e,"respawn-error",{message:i.message})});const o=new Promise(i=>{const a=Tt(()=>{this.#c.delete(o),i()},"settle");s.once("exit",a),s.once("error",a)});this.#c.add(o)}#g(e,t){const n=((this.#t.get(e)??"")+t.toString("utf8")).split(`
64
- `),s=n.pop()??"";this.#t.set(e,s);for(const o of n)this.#l(e,o)}async#w(e,t){if(t!==void 0){try{await ho({id:e,workspaceRoot:this.#s})}catch{}try{const n=await po({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#s}),s=t.config.readiness?.tcp?.port??t.config.port??0,o=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,n.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:n.entry.logFile,pid:n.entry.pid,port:s})}catch(n){const s=n instanceof Error?n.message:String(n);this.#r.failed(e,"retry-failed",{message:s})}}}}var Ad=Object.defineProperty,Oe=v((r,e)=>Ad(r,"name",{value:e,configurable:!0}),"f");const Ld=Oe(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),ci=Oe((r,e,t)=>{const n=[],s=[];for(const o of e){const i=t.tasks[o];if(!i){s.push({id:o,reason:"task not in graph"});continue}const a=i.overrides.command;if(!a){s.push({id:o,reason:"no command resolved"});continue}const l=Ld(i);if(!l?.service){s.push({id:o,reason:"no service config"});continue}const f=Ht(r,i.projectRoot,!!l.runFromWorkspaceRoot),{envFile:u}=l,p=u===void 0||u===!1?{}:yr(f,u),c=l.service.env??{};n.push({command:a,config:l.service,cwd:f,env:{...p,...c},id:o})}return{services:n,skipped:s}},"extractPreflightTasks"),Dd=Oe((r,e)=>{const t=new Set(r),n=new Map;for(const i of r){const a=(e.dependencies[i]??[]).filter(l=>t.has(l));n.set(i,new Set(a))}const s=[],o=new Set;for(;n.size>0;){const i=[];for(const[a,l]of n){for(const f of l)o.has(f)&&l.delete(f);l.size===0&&i.push(a)}i.length===0&&i.push(...n.keys());for(const a of i)o.add(a),n.delete(a);i.sort(),s.push({ids:i})}return s},"planTopoLevels"),Bd=Oe((r,e)=>{const t=[];for(const n of Dd(r,e))t.push(...n.ids);return t},"linearize"),Nd=String.raw`import { spawn } from "node:child_process";
52
+ `;await hr(e,r)},"writeFishHistory");var Bl=Object.defineProperty,er=m((t,e)=>Bl(t,"name",{value:e,configurable:!0}),"e");const _l=er(t=>{const{killGracePeriodMs:e=5e3,onTimeout:r,sendSignal:s,timeoutMs:n}=t;if(n<=0)return{cancel:er(()=>{},"cancel")};const o=Math.max(e,0);let i;const c=setTimeout(()=>{r?.(),s("SIGTERM"),o>0&&(i=setTimeout(()=>{s("SIGKILL")},o))},n);return{cancel:er(()=>{clearTimeout(c),i&&clearTimeout(i)},"cancel")}},"scheduleTimeoutKill");var Nl=Object.defineProperty,Gl=m((t,e)=>Nl(t,"name",{value:e,configurable:!0}),"n");const ql=Gl((t,e)=>{const r=e?.trim();if(!r)return{filter:void 0,tasks:[...t]};const s=r.toLowerCase();return{filter:r,tasks:t.filter(n=>n.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Ul=Object.defineProperty,Be=m((t,e)=>Ul(t,"name",{value:e,configurable:!0}),"a$1");const zl=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
53
+ `),Hl=Be(t=>{t.write(`${zl}
54
+ `)},"writeHelp"),Wl=Be(async(t,e)=>{e.write("filter projects (empty to cancel) > ");const r=t,s=r.isRaw===!0;if(s)try{r.setRawMode?.(!1)}catch{}return await new Promise(n=>{let o="";const i=Be(c=>{o+=typeof c=="string"?c:c.toString("utf8");const d=o.indexOf(`
55
+ `);if(d===-1)return;const h=o.slice(0,d).replace(/\r$/,"").trim();if(t.off("data",i),s)try{r.setRawMode?.(!0)}catch{}n(h.length>0?h:void 0)},"onData");t.on("data",i)})},"defaultPromptFilter"),Vl=Be(t=>{const{handlers:e}=t,r=t.input??process.stdin,s=t.output??process.stdout,n=t.promptFilter??Wl;if(!r||r.isTTY===!1)return{close:Be(()=>{},"close")};Zi(r);const o=r.isRaw===!0;try{r.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof r.resume=="function"&&r.resume();let i=!1;const c=Be(async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!i)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const p=await n(r,s);p===void 0?s.write(`filter cancelled.
56
+ `):await e.onFilter(p)}finally{i=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),d=Be((f,p)=>{c(p).catch(l=>{s.write(`[vis watch] keybind handler failed: ${l.message}
57
+ `)})},"onKeypress"),h=r;return h.on("keypress",d),{close:Be(()=>{if(h.off("keypress",d),!o)try{r.setRawMode?.(!1)}catch{}const f=r;if(typeof f.pause=="function")try{f.pause()}catch{}},"close")}},"installKeybinds");var Kl=Object.defineProperty,cr=m((t,e)=>Kl(t,"name",{value:e,configurable:!0}),"y");const Yl=cr(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Jl=cr(async t=>{const{initialTasks:e,probe:r,registeredEntries:s,taskGraph:n,visVersion:o}=t,i=new Map,c=new Map,d=new Map;for(const v of s)if(ro(v.pid)){if(v.visVersion!==o){c.set(v.id,v);continue}i.set(v.id,v)}if(r){const v=[...i.values()],x=await Promise.all(v.map(async F=>{try{return[F.id,await r(F)]}catch{return[F.id,!1]}}));for(const[F,P]of x)if(!P){const q=i.get(F);i.delete(F),q&&d.set(F,q)}}const h=new Set(e.map(v=>v.id)),f=new Set,p=[],l=[],g=new Set;for(const v of Object.values(n.dependencies))for(const x of v)g.add(x);for(const[v,x]of Object.entries(n.tasks)){if(!Yl(x)?.service)continue;if(i.has(v)){f.add(v),l.push(i.get(v));continue}if(h.has(v)||!g.has(v))continue;const F=c.get(v),P=d.get(v);let q;F?q=`Service ${v} is registered with vis ${F.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${v}\` to pick up the new version.`:P?q=`Service ${v} is registered (PID ${String(P.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.`:q=`Target depends on the service ${v}, which is not running. Run \`vis service start ${v}\` first, or invoke \`${v}\` directly.`,p.push({message:q,targetId:v})}if(f.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:l,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:n};const w=new Map,I=cr(v=>{const x=new Set,F=[...n.dependencies[v]??[]],P=new Set;for(;F.length>0;){const q=F.pop();if(!P.has(q)){P.add(q),f.has(q)&&x.add(q);for(const ae of n.dependencies[q]??[])P.has(ae)||F.push(ae)}}return[...x].sort()},"collectTransitiveServices"),L=new Map;for(const v of Object.keys(n.dependencies)){if(f.has(v))continue;const x=I(v);if(x.length===0)continue;const F={};for(const P of x){const q=i.get(P);if(!q)continue;Object.assign(F,q.env);const ae=L.get(P);ae?ae.push(v):L.set(P,[v])}Object.keys(F).length>0&&w.set(v,F)}for(const v of L.values())v.sort();const b={};for(const[v,x]of Object.entries(n.tasks))f.has(v)||(b[v]=x);const k={};for(const[v,x]of Object.entries(n.dependencies))f.has(v)||(k[v]=x.filter(F=>!f.has(F)));const R=new Map;for(const v of Object.keys(b))R.set(v,0);for(const v of Object.values(k))for(const x of v)R.has(x)&&R.set(x,(R.get(x)??0)+1);const j=[];for(const v of n.roots)!f.has(v)&&b[v]&&j.push(v);for(const[v,x]of R)x===0&&!j.includes(v)&&b[v]&&j.push(v);const C=e.filter(v=>!f.has(v.id));return{diagnostics:p,initialTasks:C,satisfiedServices:l,serviceDependentsByServiceId:L,serviceEnvByTaskId:w,taskGraph:{dependencies:k,roots:j,tasks:b}}},"applyServiceRegistry");var Xl=Object.defineProperty,yt=m((t,e)=>Xl(t,"name",{value:e,configurable:!0}),"c");const It="[[VIS_BOOT]]",Ql=250,Zl=1e3,Ls=3,eu=yt(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),Ds=yt(t=>{try{const e=at(t,"utf8").trim(),r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}},"readPidFile");class tu{static{m(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#s;#r;#n;#t=new Map;#i=new Map;#o=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 r=this.#e.get(e.index);r===void 0||e.text===void 0||this.onTaskOutput(r,e.text)},"onProcessEvent");onTaskOutput(e,r){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+r).split(`
58
+ `),n=s.pop()??"";this.#t.set(e,n);for(const o of s)this.#l(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,r){this.#r.started(e,r)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,r,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||r!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:r,killed:s});return}const n=await so(this.#n,e);if(!n){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=n,i=o.readiness?.tcp?.port??o.port??0,c=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:c,logFile:n.logFile,pid:n.pid,port:i})}notifyRegistryReady(e,r){this.#r.ready(e,{host:r.host,port:r.port}),this.#h(e,r.logFile),r.pid!==null&&this.#p(e,r.pid)}notifyRegistryFailed(e,r,s){this.#r.failed(e,r,s)}async retry(e){const r=this.#s.get(e);if(r){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),r.mode==="registry"){await this.#y(e,r.registry);return}r.mode==="ephemeral"&&this.#w(e,r.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(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.#i.clear()}#l(e,r){if(r.startsWith(It)){this.#d(e,r.slice(It.length));return}const s=this.#i.get(e)??[];s.push(r),s.length>Ls&&s.shift(),this.#i.set(e,s),this.#r.log(e,`${r}
59
+ `)}#d(e,r){let s;try{s=JSON.parse(r)}catch{this.#r.log(e,`${It+r}
60
+ `);return}switch(s.event){case"failed":{const n=typeof s.reason=="string"?s.reason:"unknown",o={};for(const[i,c]of Object.entries(s))i!=="event"&&i!=="id"&&i!=="reason"&&(o[i]=c);this.#r.failed(e,n,o);break}case"ready":{const n=typeof s.host=="string"?s.host:"127.0.0.1",o=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:n,port:o}),this.#u(e);break}case"started":{const n=typeof s.pid=="number"?s.pid:null;this.#r.started(e,n);break}default:this.#r.log(e,`${It+r}
61
+ `)}}#u(e){const r=this.#s.get(e);if(r?.ephemeral===void 0)return;this.#h(e,r.ephemeral.logFile);const s=Ds(r.ephemeral.pidFile);s!==null&&this.#p(e,s)}#h(e,r){if(this.#o.has(e)||!Ne(r))return;const s=Yi(r,"r"),n=(()=>{try{return Pt(r).size}catch{return 0}})(),o={fd:s,logFile:r,pollTimer:setInterval(()=>{this.#m(e)},Ql),position:n};this.#o.set(e,o)}#m(e){const r=this.#o.get(e);if(r)try{const s=Pt(r.logFile);if(s.size<=r.position)return;const n=Buffer.alloc(s.size-r.position),o=Ji(r.fd,n,0,n.length,r.position);if(o>0){r.position+=o;const i=n.subarray(0,o).toString("utf8");for(const c of i.split(`
62
+ `))c.length!==0&&this.#v(e,c);this.#r.log(e,i)}}catch{}}#v(e,r){const s=this.#i.get(e)??[];for(s.push(r);s.length>Ls;)s.shift();this.#i.set(e,s)}#p(e,r){if(this.#a.has(e))return;const s={pid:r,timer:setInterval(()=>{if(!eu(r)){const n=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,n)}},Zl)};this.#a.set(e,s)}#f(e){const r=this.#o.get(e);if(r){clearInterval(r.pollTimer);try{Xi(r.fd)}catch{}this.#o.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,r){if(r===void 0)return;const s=Ds(r.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const n=Co("node",[r.scriptPath,r.configFile],{cwd:r.cwd,stdio:["ignore","pipe","pipe"]});n.stdout.on("data",i=>{this.#g(e,i)}),n.stderr.on("data",i=>{this.#g(e,i)}),n.on("error",i=>{this.#r.failed(e,"respawn-error",{message:i.message})});const o=new Promise(i=>{const c=yt(()=>{this.#c.delete(o),i()},"settle");n.once("exit",c),n.once("error",c)});this.#c.add(o)}#g(e,r){const s=((this.#t.get(e)??"")+r.toString("utf8")).split(`
63
+ `),n=s.pop()??"";this.#t.set(e,n);for(const o of s)this.#l(e,o)}async#y(e,r){if(r!==void 0){try{await no({id:e,workspaceRoot:this.#n})}catch{}try{const s=await io({command:r.command,config:r.config,cwd:r.cwd,env:r.env,id:e,workspaceRoot:this.#n}),n=r.config.readiness?.tcp?.port??r.config.port??0,o=r.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:s.entry.logFile,pid:s.entry.pid,port:n})}catch(s){const n=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:n})}}}}var ru=Object.defineProperty,Ie=m((t,e)=>ru(t,"name",{value:e,configurable:!0}),"f");const su=Ie(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Yn=Ie((t,e,r)=>{const s=[],n=[];for(const o of e){const i=r.tasks[o];if(!i){n.push({id:o,reason:"task not in graph"});continue}const c=i.overrides.command;if(!c){n.push({id:o,reason:"no command resolved"});continue}const d=su(i);if(!d?.service){n.push({id:o,reason:"no service config"});continue}const h=_t(t,i.projectRoot,!!d.runFromWorkspaceRoot),{envFile:f}=d,p=f===void 0||f===!1?{}:lr(h,f),l=d.service.env??{};s.push({command:c,config:d.service,cwd:h,env:{...p,...l},id:o})}return{services:s,skipped:n}},"extractPreflightTasks"),nu=Ie((t,e)=>{const r=new Set(t),s=new Map;for(const i of t){const c=(e.dependencies[i]??[]).filter(d=>r.has(d));s.set(i,new Set(c))}const n=[],o=new Set;for(;s.size>0;){const i=[];for(const[c,d]of s){for(const h of d)o.has(h)&&d.delete(h);d.size===0&&i.push(c)}i.length===0&&i.push(...s.keys());for(const c of i)o.add(c),s.delete(c);i.sort(),n.push({ids:i})}return n},"planTopoLevels"),iu=Ie((t,e)=>{const r=[];for(const s of nu(t,e))r.push(...s.ids);return r},"linearize"),ou=String.raw`import { spawn } from "node:child_process";
65
64
  import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
66
65
  import { createConnection } from "node:net";
67
66
 
@@ -175,22 +174,22 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
175
174
  try { process.kill(-child.pid, "SIGTERM"); } catch {}
176
175
  process.exit(1);
177
176
  })();
178
- `,_d=Oe(()=>{const r=oo(de(Do(),"vis-services-")),e=de(r,"bootstrap.mjs");return os(e,Nd),{runDir:r,scriptPath:e}},"prepareBootstrap"),li=Oe((r,e,t)=>{const n=t.replaceAll(/[^\w-]/g,"_");return{configFile:de(r,`${n}.json`),logFile:de(r,`${n}.log`),pidFile:de(r,`${n}.pid`),scriptPath:e}},"buildBootstrapPaths"),Gd=Oe(r=>{const{paths:e,service:t}=r,n=t.config.readiness?.tcp?.port??t.config.port;if(typeof n!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const s={...t.env,PATH:Wi(t.cwd,t.env)};return{command:t.command,cwd:t.cwd,env:s,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:n,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),qd=Oe(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),Ud=Oe(r=>{const{id:e,visBin:t,workspaceRoot:n}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(n)}`},"buildRegistryCommand"),Wd=Oe(r=>{const{missingServiceIds:e,mode:t,taskGraph:n,visBin:s,workspaceRoot:o}=r,{services:i,skipped:a}=ci(o,e,n);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:a};const l=Bd(i.map(b=>b.id),n),f=new Map(i.map(b=>[b.id,b])),u=[],p=[];if(t==="ephemeral")for(const b of l){const S=f.get(b);S&&p.push({id:b,payload:Gd({paths:{logFile:"",pidFile:""},service:S})})}let c;t==="ephemeral"&&(c=_d());let m;for(const b of l){const S=f.get(b),R=n.tasks[b];if(!S||!R)continue;let x;if(t==="ephemeral"){const O=li(c.runDir,c.scriptPath,b),w={...p.find(T=>T.id===b).payload,logFile:O.logFile,pidFile:O.pidFile};os(O.configFile,JSON.stringify(w)),x=qd(O),u.push(O.pidFile)}else x=Ud({id:b,visBin:s,workspaceRoot:o});if(R.overrides={...R.overrides,command:x},R.cache=!1,n.tasks[b]=R,m!==void 0){const O=n.dependencies[b]??[];O.includes(m)||(n.dependencies[b]=[...O,m])}m=b}const y=new Set(l),M=new Map,D=Oe(b=>{const S=new Set,R=[...n.dependencies[b]??[]],x=new Set;for(;R.length>0;){const O=R.pop();if(!x.has(O)){x.add(O),y.has(O)&&S.add(O);for(const w of n.dependencies[O]??[])x.has(w)||R.push(w)}}return[...S].sort()},"collectTransitive");for(const b of Object.keys(n.dependencies)){if(y.has(b))continue;const S=D(b);if(S.length===0)continue;const R={};for(const x of S){const O=f.get(x);O?.config.env&&Object.assign(R,O.config.env)}Object.keys(R).length>0&&M.set(b,R)}return{chain:l,ephemeralPidFiles:u,runDir:c?.runDir,serviceEnvByTaskId:M,skipped:a}},"injectServiceTasks"),zd=new Set(["auto","ephemeral","off","persistent"]),Hd=Oe(r=>{const{cli:e,config:t,isCi:n,isPersistentTarget:s,isTty:o,target:i}=r;if(e!==void 0&&!zd.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const a=e??t??(o&&!n?"auto":"off");return a==="off"?"off":a==="ephemeral"?"ephemeral":a==="persistent"?"registry":s||i==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var Vd=Object.defineProperty,Ue=v((r,e)=>Vd(r,"name",{value:e,configurable:!0}),"l$1");const di=Ue(r=>r.replace(/^--?/u,""),"asKebab"),Kd=new Set(["0","1","false","no","true","yes"]),Jd=Ue(r=>!r.startsWith("-")||/^-(?:\d|\.\d)/u.test(r),"isValueToken"),Jn=Ue((r,e,t,n,s,o)=>{if(n!==void 0)return r.set(e,n),0;const i=s[o+1];return(t?.type??"string")==="boolean"?i!==void 0&&Kd.has(i.toLowerCase())?(r.set(e,i.toLowerCase()),1):(r.set(e,"true"),0):i!==void 0&&Jd(i)?(r.set(e,i),1):(r.set(e,"true"),0)},"captureValue"),Yd=Ue((r,e)=>{const t=r.type??"string";if(t==="number"){const n=e.trim(),s=Number(n);return n===""||!Number.isFinite(s)?{error:`--${r.name} expects a number, got "${e}"`}:{value:s}}if(t==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${r.name} expects a boolean, got "${e}"`};if(t==="enum"){const n=r.choices??[];return n.includes(e)?{value:e}:{error:`--${r.name} must be one of [${n.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),Qd=Ue(r=>{const e=[],t=new Set;for(const n of r){const s=n.name||"<unnamed>";(!n.name||!/^[a-zA-Z][\w-]*$/u.test(n.name))&&e.push(`argument name "${s}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),t.has(n.name)&&e.push(`duplicate argument name "${s}"`),t.add(n.name),n.alias!==void 0&&n.alias.length!==1&&e.push(`argument "${s}" alias "${n.alias}" must be a single character`);const o=n.type??"string";if(o==="enum"&&(n.choices===void 0||n.choices.length===0)&&e.push(`argument "${s}" has type "enum" but declares no choices`),n.default!==void 0){const i=typeof n.default;o==="number"&&i==="number"||o==="boolean"&&i==="boolean"||(o==="string"||o==="enum")&&i==="string"?o==="enum"&&n.choices&&!n.choices.includes(n.default)&&e.push(`argument "${s}" default "${String(n.default)}" is not one of its choices`):e.push(`argument "${s}" default ${JSON.stringify(n.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),Xd=Ue((r,e)=>{const t=new Map,n=new Map;for(const f of r)t.set(f.name,f),f.alias&&n.set(f.alias,f);const s=new Map,o=[];for(let f=0;f<e.length;f+=1){const u=e[f];if(u==="--"){o.push(...e.slice(f+1));break}if(u.startsWith("--no-")){s.set(di(u.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(u);if(p){const y=p[1];f+=Jn(s,y,t.get(y),p[2],e,f);continue}const c=/^-([^=-])(?:=(.*))?$/su.exec(u),m=c?.[1];if(c&&m!==void 0){const y=n.get(m);f+=Jn(s,y?.name??m,y,c[2],e,f);continue}o.push(u)}const i={},a=[];let l=0;for(const f of r){let u=s.get(f.name);if(u===void 0&&f.positional&&l<o.length&&(u=o[l],l+=1),u===void 0){f.default!==void 0?i[f.name]=f.default:f.required&&a.push(`missing required argument --${f.name}`);continue}const{error:p,value:c}=Yd(f,u);p?a.push(p):c!==void 0&&(i[f.name]=c)}return{errors:a,values:i}},"parseTaskArguments"),Zd=Ue(r=>`VIS_ARG_${di(r).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),eu=Ue(r=>{const e={};for(const[t,n]of Object.entries(r))e[Zd(t)]=String(n);return e},"taskArgumentEnv"),dr=Ue((r,e,t)=>{const n=[`Usage: vis run ${r} [-- <args>]`];if(e&&n.push("",e),t.length===0)return n.join(`
179
- `);n.push("","Arguments:");const s=t.map(i=>{const a=i.positional?`<${i.name}>`:`--${i.name}`,l=i.alias?`, -${i.alias}`:"";return{left:`${a}${l}`,right:i}}),o=Math.max(...s.map(i=>i.left.length));for(const{left:i,right:a}of s){const l=[],f=a.type??"string";l.push(f==="enum"?`enum(${(a.choices??[]).join("|")})`:f),a.required&&l.push("required"),a.default!==void 0&&l.push(`default: ${String(a.default)}`);const u=`${a.description??""}${a.description?" ":""}[${l.join(", ")}]`;n.push(` ${i.padEnd(o)} ${u}`)}return n.join(`
180
- `)},"renderTaskArgumentsHelp");var tu=Object.defineProperty,ru=v((r,e)=>tu(r,"name",{value:e,configurable:!0}),"l");const nu=ru((r,e,t,n)=>{if(!t||t.length===0)return{env:{},kind:"ok"};const s=Qd(t);if(s.length>0)return{errors:s.map(i=>`invalid \`arguments\` schema for "${r}": ${i}`),help:dr(r,e,t),kind:"invalid"};if(n.includes("--help")||n.includes("-h"))return{kind:"help",text:dr(r,e,t)};const o=Xd(t,n);return o.errors.length>0?{errors:o.errors,help:dr(r,e,t),kind:"invalid"}:{env:eu(o.values),kind:"ok"}},"resolveTaskArguments");var su=Object.defineProperty,j=v((r,e)=>su(r,"name",{value:e,configurable:!0}),"a");const Qr="VIS_AFFECTED_FILES",iu=2e3,Yn=j(async(r,e,t,n,s,o)=>{const i=r.map(x=>{const O=x.overrides.command;if(!O)return;const w=x.overrides.visOptions,T=Ht(e,x.projectRoot,!!w?.runFromWorkspaceRoot),A=w?.envFile?yr(T,w.envFile):{},F=t&&(w?.affectedFiles==="env"||w?.affectedFiles==="both")?{[Qr]:t.join(`
181
- `)}:{},U=o?.get(x.id)??{},ae=Ba({interactive:!!s,taskPty:x.pty,workspacePty:w?.pty});return{command:O,cwd:T,env:{INIT_CWD:n,...A,...U,...F,...x.overrides[Zr]},name:x.id,...ae?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(x=>x!==void 0);if(i.length===0)return;if(!s){await Nt(i,{killOthers:["failure"],onEvent:j(()=>{},"onEvent")});return}const{abortSignal:a,lifeCycle:l,stdinRegistry:f,store:u}=s,p=i.map(x=>r.find(O=>O.id===x.name)).filter(Boolean),c=j(x=>i[x]?.stdin==="pty","isPtyIndex"),m=new Map,y=j(x=>{if(!c(x))return;let O=m.get(x);return O||(O=new wr(zt),m.set(x,O)),O},"getTermBuffer");u.unmarkDone(),l.startTasks?.(p);const M=new Map,D=new Map;let b;const S=j(()=>{for(const x of D.values())try{x("SIGTERM")}catch{}b||(b=setTimeout(()=>{for(const x of D.values())try{x("SIGKILL")}catch{}D.clear()},2e3),b.unref?.())},"killAll");let R;a&&(R=j(()=>{S()},"abortListener"),a.then(()=>{R?.()}).catch(()=>{R?.()}));try{await Nt(i,{killOthers:["failure"],onEvent:j(x=>{const O=p[x.index];if(O)switch(x.kind){case"close":{const w=M.get(O.id)??Date.now(),T=x.killed||x.exitCode===0?"success":"failure";l.endTasks?.([{code:x.exitCode??0,endTime:Date.now(),startTime:w,status:T,task:O,terminalOutput:u.getSnapshot().outputs.get(O.id)??""}]),D.delete(x.index),f?.delete(O.id);break}case"error":{if(x.message){const w=y(x.index);w?(w.write(`${x.message}
182
- `),u.setOutput(O.id,w.toString())):u.addOutput(O.id,`${x.message}
183
- `)}break}case"started":{M.set(O.id,Date.now()),x.kill&&D.set(x.index,x.kill),x.write&&f&&f.set(O.id,{kill:x.kill,resize:x.resize,write:x.write});break}case"stderr":case"stdout":{if(x.text){const w=y(x.index);w?(w.write(x.text),u.setOutput(O.id,w.toString())):u.addOutput(O.id,`${x.text}
184
- `)}break}}},"onEvent")})}finally{b&&(clearTimeout(b),b=void 0),u.markDone()}},"runPersistentTasks"),Qn=j(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),ou=j(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),au=j(r=>{const{extraPids:e=[],pidFiles:t,runDir:n}=r,s=[],o=j(i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}},"sendSigterm");for(const i of t){let a;try{const l=Ci(i),f=Number.parseInt(l.trim(),10);a=Number.isFinite(f)&&f>0?f:void 0}catch{continue}a!==void 0&&(s.push(a),o(a))}for(const i of e)!Number.isFinite(i)||i<=0||(s.push(i),o(i));if(s.length>0){const i=Date.now()+1500;for(;Date.now()<i;){let a=!0;for(const l of s)if(Qn(l)){a=!1;break}if(a)break;ou(100)}for(const a of s)if(Qn(a))try{process.kill(-a,"SIGKILL")}catch{try{process.kill(a,"SIGKILL")}catch{}}}n&&Oi(n)},"cleanupEphemeralServices"),zt=256*1024;class cu{static{v(this,"zn")}static{j(this,"OutputRingBuffer")}#e;#n="";#r=!1;constructor(e){this.#e=e}append(e){this.#n+=e,this.#n.length>this.#e&&(this.#n=this.#n.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
185
- ${this.#n}`:this.#n}}const ui=j(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),lu=j(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Xr=j(r=>process.platform==="win32"?r.length>0&&!/[\s"&|<>^()%!]/.test(r)?r:`"${r.replaceAll('"','""')}"`:lu(r),"shellQuote"),du=j((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const n=e.map(s=>Xr(s)).join(" ");return`${r} ${n}`}return r},"buildAffectedFilesArgs"),fi="visForwardedArgs",Zr="visTaskArgEnv",uu=j((r,e)=>{const t=e.overrides[fi];if(!Array.isArray(t)||t.length===0)return r;const n=t.map(s=>Xr(s)).join(" ");return`${r} ${n}`},"appendForwardedArgs"),fu=j(async(r,e,t)=>{if(!e)return t();const n=r.get(e)??Promise.resolve();let s;const o=new Promise(a=>{s=a}),i=n.then(()=>o);r.set(e,i),await n;try{return await t()}finally{s(),r.get(e)===i&&r.delete(e)}},"withMutex"),hu=j(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const n=Math.max(0,Math.min(t,e));return e-=n,n},get remaining(){return e}}},"createRetryBudget"),pu=j((r,e,t)=>{const n=`${e}\0${typeof t=="string"?t:String(t)}`,s=r.get(n);if(s)return s;const o=yr(e,t);return r.set(n,o),o},"loadEnvFileCached"),Xn=j(r=>{const e=new Map;return async(t,n)=>{const{affectedFiles:s,currentOs:o,hooks:i,initCwd:a,lifeCycle:l,mutexPool:f,onOutput:u,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:m,serviceEventBridge:y,stdinRegistry:M,strictEnv:D,workspaceRoot:b}=r,S=ui(t),R=Ht(b,n.cwd??t.projectRoot,S?.runFromWorkspaceRoot===!0),x=t.overrides.command;if(!x)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const O=uu(x,t),w=du(O,s,S?.affectedFiles),T=Mi(S,o),A=S?.shellArgs,F=A&&A.length>0?A.join(" "):"-c",U=T?`${T} ${F} ${Xr(w)}`:w,ae=S?.envFile?pu(e,R,S.envFile):void 0,X={};s&&s.length>0&&(S?.affectedFiles==="env"||S?.affectedFiles==="both")&&(X[Qr]=s.join(`
186
- `));const K=m?.get(t.id),ce={INIT_CWD:a,...ae,...K,...n.env,...X,...t.overrides[Zr]};if(S?.strictEnv??D??!1){const Y=Ha({command:w,processEnv:process.env,taskEnv:ce,taskId:t.id});if(Y){const me=Va(Y);return l?.onTaskStderr?.(t,me),{code:1,terminalOutput:me}}}const Me=S?.pty===!0,ie=!!M,ge=t.pty===!0?!0:t.pty===!1?!1:ie||Me;ge&&(t.cache=!1);const J=ge?void 0:new cu(zt),re=ge?new wr(zt):void 0;let ue;const le=j(Y=>{if(Y.kind==="started"&&(ue=Y.kill,Y.write&&M&&M.set(t.id,{kill:Y.kill,resize:Y.resize,write:Y.write}),y?.onRegistryTaskStarted(t.id)),(Y.kind==="stdout"||Y.kind==="stderr")&&Y.text!==void 0)if(Y.kind==="stdout"?l?.onTaskStdout?.(t,Y.text):l?.onTaskStderr?.(t,Y.text),re)re.write(Y.text),ie&&p?.(t.id,re.toString()),y&&y.onTaskOutput(t.id,Y.text);else{const me=`${Y.text}
187
- `;J.append(me),u?.(t.id,me)}Y.kind==="close"&&(M&&M.delete(t.id),y&&y.onRegistryTaskClosed(t.id,Y.exitCode??0,!!Y.killed).catch(()=>{}))},"onEvent"),_=j(async()=>{const Y=S?.retryCount??0,me=S?.retryDelay,Je=c?c.claim(Y):Y,Ye=typeof S?.timeout=="number"&&S.timeout>0?S.timeout:0,ot=typeof S?.killGracePeriodMs=="number"&&S.killGracePeriodMs>=0?S.killGracePeriodMs:5e3;let oe=!1,Ae=0;const We=yd({killGracePeriodMs:ot,onTimeout:j(()=>{oe=!0},"onTimeout"),sendSignal:j(be=>{ue?.(be)},"sendSignal"),timeoutMs:Ye});let ke;try{ke=await Nt([{command:U,cwd:R,env:ce,name:t.id,...ge?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:le,...Je>0?{restart:{delay:me??"exponential",onRetry:j(async(be,He,Se)=>{Ae=be,i&&await i.callHook("task:retry",t,be,Se)},"onRetry"),tries:Je}}:{}})}finally{We.cancel()}const ze=ke.closeEvents[0],Ee=re?re.toString():J.toString();return oe?{code:124,retryAttempts:Ae,terminalOutput:`${Ee}
188
- [timeout] Task "${t.id}" exceeded ${Ye}ms budget.
189
- `}:{code:ze?.exitCode??1,retryAttempts:Ae,terminalOutput:Ee}},"runOnce");return f?fu(f,S?.mutex,_):_()}},"createConcurrentExecutor"),gu=j(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"),mu=j(async(r,e)=>{const t=await zi(r,{dataDirectory:Bt(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Hi(r,{dataDirectory:Bt(r)})}.`);return}const n=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${n}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 o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const a=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${a}ms)`)}e.info("")}const s=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(s.length>0){e.info("Slowest tasks:");for(const o of s)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),vu=j(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"),yu=j(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"),Vu=j(async({argument:r,logger:e,options:t,runtime:n,visConfig:s,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o;if(Ei(i),t.lastDetails===!0){await mu(i,e);return}const a=process.cwd(),l=await Ri(i),{config:f,packageJsons:u,projectOptions:p,workspace:c}=ji(i,s,l),m=Pi(i,c,u);let y=r[0];if(!y){const $=En(c);if(process.stdout.isTTY&&process.stdin.isTTY){const I=await ec($);if(!I){e.info("No target selected.");return}y=I,await hd(`vis run ${I}`)}else{e.info("Available targets:"),e.info(""),e.info(Za($)),e.info(""),e.info("Usage: vis run <target>");return}}if(f.constraints&&!t.skipConstraints){const $=Vi(m,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 n.runCommand("affected",{argv:$});return}const M=await bo(y,c,process.cwd(),i),D=Ja(p),b=Ya(M.target,D);b!==M.target&&e.debug?.(`Resolved alias "${M.target}" → "${b}"`);let S=M.projects;const R=r.slice(1).map(String);if(t.projects){const $=new Set(t.projects.split(",").map(I=>I.trim()));if(S=S.filter(I=>$.has(I)),S.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(S=So(S,c,t.query),S.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const x=Fi(),O=process.env[Qr],w=O?O.split(`
190
- `).filter(Boolean):void 0,T=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,A=T?new Set(T.split(",").map($=>$.trim()).filter(Boolean)):void 0,F=[],U=new Map;for(const $ of S){const I=p.get($)?.[b];if(!I)continue;const E=I.options;if(!E?.internal){if(!Ai(E,!!vt)){e.debug?.(`Skipping ${$}:${b} — runInCI filter`);continue}if(!Li(E,A)){e.debug?.(`Skipping ${$}:${b} — runner-tags filter`);continue}F.push($),U.set($,I)}}if(F.length===0){const $=En(c),I=Object.entries(c.projects).filter(([,E])=>E.targets?.[b]!==void 0).map(([E])=>E);if(e.error(`No projects have the "${b}" target.`),I.length>0){e.info(""),e.info(`Target "${b}" exists in these projects but was filtered out:`);for(const E of I.slice(0,5))e.info(` - ${E}`);I.length>5&&e.info(` …and ${I.length-5} more`)}else{const E=ps(b,$,3);E.length>0&&(e.info(""),e.info(E.length===1?`Did you mean "${E[0]}"?`:`Did you mean one of: ${E.map(G=>`"${G}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ae=t.pty===!0,X=F.map($=>({project:$,schema:U.get($)?.arguments})).filter($=>Array.isArray($.schema)&&$.schema.length>0),K=new Map;for(const{project:$,schema:I}of X){const E=JSON.stringify(I),G=K.get(E)??[];G.push($),K.set(E,G)}if(K.size>1){const $=[...K.values()].map(I=>I.join(", ")).join(" | ");throw new Error(`Target "${b}" declares conflicting \`arguments\` schemas across projects (${$}). Run a single project (e.g. \`vis run ${X[0]?.project}:${b}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ce=X[0]?.schema,Me=U.get(X[0]?.project??F[0])?.description,ie=nu(b,Me,ce,R);if(ie.kind==="help"){e.info(ie.text);return}if(ie.kind==="invalid"){e.info(`Invalid arguments for "${b}":`);for(const $ of ie.errors)e.info(` ✖ ${$}`);throw e.info(""),e.info(ie.help),new Error(`Invalid arguments for target "${b}"`)}const ge=ie.env;let J=F.map($=>{const I=c.projects[$],E=U.get($),G={project:$,target:b},V=`${$}:${b}`,Z=ae?{...E.options,pty:E.options?.pty??!0}:E.options,q=E.command?yn(E.command,{affectedFiles:w,projectRoot:I?.root}):E.command;return{cache:E.cache,id:V,outputs:E.outputs??[],overrides:{command:q,...R.length>0?{[fi]:R}:{},...Object.keys(ge).length>0?{[Zr]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:E.parallelism,projectRoot:I?.root,target:G}});const re=[],ue=[];for(const $ of J)ui($)?.persistent?($.cache=!1,re.push($)):ue.push($);J=ue;const le=Ki(t.partition);if(le&&(J=Ji.partitionTasks(J,le),e.info(`Partition ${le.index}/${le.total}: running ${J.length} task(s)`),J.length===0)){e.info("No tasks assigned to this partition.");return}let _=Yi([...J,...re],{onCycleBroken:j($=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${$.join(" → ")}`)},"onCycleBroken"),projectGraph:m,targetDefaults:f.tasks,workspace:c});for(const[$,I]of Object.entries(_.tasks)){const E=I.target.project,G=I.target.target,V=p.get(E)?.[G];if(!V)continue;const Z=c.projects[E];let q=!1;const N={...I.overrides};N.visOptions===void 0&&V.options&&(N.visOptions=V.options,q=!0),N.command===void 0&&V.command&&(N.command=yn(V.command,{affectedFiles:w,projectRoot:Z?.root}),q=!0),q&&(I.overrides=N,_.tasks[$]=I)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const $=Ga(t.skipCache,c,Object.keys(_.tasks));for(const I of $.skipTaskIds){const E=_.tasks[I];E!==void 0&&(E.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 lo(i,f.toolchain,{error:j($=>{e.error($)},"error"),info:j($=>{e.info($)},"info"),warn:j($=>{e.warn($)},"warn")},!!t.skipToolchain);const Y=t.preflight!==!1&&f.preflight?.lockfile!==!1,me=xa(i,vt,{warn:j($=>{e.warn($)},"warn")},{skip:!Y});if(!me.shouldContinue)throw new Error(`${me.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);Y&&!vt&&process.stdin.isTTY&&process.stdout.isTTY&&await Aa(i,{interactive:!0,logger:{info:j($=>{e.info($)},"info"),warn:j($=>{e.warn($)},"warn")},projectManifests:[...u.values()]});const Je=process.env.VIS_VERSION??"0.0.0",Ye=t.dryRun?void 0:async $=>{try{return await $o($.config,{timeoutMs:iu}),!0}catch{return!1}},ot=await go(i),oe=await Md({initialTasks:[...J,...re],probe:Ye,registeredEntries:ot,taskGraph:_,visVersion:Je}),Ae=[];let We,ke=0;const ze=[],Ee=new Map;let be=[];const He=new Set;let Se=null,ye=null;if(oe.diagnostics.length>0){const $=!!(process.stdout.isTTY&&process.stdin.isTTY),I=t.dryRun?"off":Hd({cli:t.services,config:f.run?.services,isCi:!!vt,isPersistentTarget:re.length>0,isTty:$,target:b});if(I==="off"){for(const N of oe.diagnostics)e.error(N.message);throw new Error(`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const E=oe.diagnostics.map(N=>N.targetId),G=I,V=G==="registry"?ci(i,E,_):void 0,Z=process.argv[1]??"vis",q=Wd({missingServiceIds:E,mode:G,taskGraph:_,visBin:Z,workspaceRoot:i});if(q.skipped.length>0){for(const{id:N,reason:fe}of q.skipped)e.error(`Cannot auto-start ${N}: ${fe}`);throw new Error(`${q.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ae.push(...q.ephemeralPidFiles),We=q.runDir,be=q.chain;for(const N of q.chain)He.add(N);if(G==="registry"&&(ke=q.chain.length,ze.push(...q.chain)),q.chain.length>0){const N=new Rn(q.chain),fe=new Map;if(G==="ephemeral"&&q.runDir)for(const B of q.chain){const H=li(q.runDir,`${q.runDir}/bootstrap.mjs`,B);fe.set(B,{ephemeral:{configFile:H.configFile,cwd:i,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(G==="registry"&&V)for(const B of V.services)fe.set(B.id,{mode:"registry",registry:{command:B.command,config:B.config,cwd:B.cwd,env:B.env}});if(fe.size>0){const B=new Fd({indexToId:new Map,services:fe,sink:{crashed:j((H,W)=>{N.markCrashed(H,W)},"crashed"),failed:j((H,W,ne)=>{N.markFailed(H,W,ne)},"failed"),log:j((H,W)=>{N.appendLog(H,W)},"log"),ready:j((H,W)=>{N.markReady(H,W)},"ready"),started:j((H,W)=>{N.markStarted(H,W),G==="registry"&&W!==null&&Ee.set(H,W)},"started"),starting:j(H=>{N.markStarting(H)},"starting")},workspaceRoot:i});Se=N,ye=B}}for(const[N,fe]of q.serviceEnvByTaskId){const B=oe.serviceEnvByTaskId.get(N)??{};oe.serviceEnvByTaskId.set(N,{...B,...fe})}}const P=new Set(re.map($=>$.id));if(J=oe.initialTasks.filter($=>!P.has($.id)),_=oe.taskGraph,be.length>0&&(J=[...be.map($=>_.tasks[$]).filter($=>$!==void 0),...J]),re.length>0){const $=new Set(re.map(Z=>Z.id)),I={};for(const[Z,q]of Object.entries(_.tasks))$.has(Z)||(I[Z]=q);const E={};for(const[Z,q]of Object.entries(_.dependencies))$.has(Z)||(E[Z]=q.filter(N=>!$.has(N)));const G=new Set;for(const Z of Object.values(E))for(const q of Z)G.add(q);const V=Object.keys(I).filter(Z=>!G.has(Z));_={dependencies:E,roots:V,tasks:I}}const{serviceEnvByTaskId:C}=oe;if(oe.satisfiedServices.length>0){const $=oe.satisfiedServices.map(I=>I.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${$}`),Se)for(const I of oe.satisfiedServices)Se.registerService(I.id);else Se=new Rn(oe.satisfiedServices.map(I=>I.id));for(const I of oe.satisfiedServices){const E=I.config.readiness?.tcp?.port??I.config.port??0,G=I.config.readiness?.tcp?.host??"127.0.0.1";Se.markReady(I.id,{host:G,port:E})}}if(t.reverse&&(_=Qi(_),e.debug?.(`Reversed task graph: ${String(_.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const $=Object.keys(_.tasks).length,I=_.roots.length;e.info(`Execution plan (${String($)} task(s), ${String(I)} root(s)):`),e.info("");const E=new Set,G=j((V,Z)=>{if(E.has(V))return;E.add(V);for(const fe of _.dependencies[V]??[])G(fe,Z+1);const q=_.tasks[V],N=" ".repeat(Z+1);e.info(`${N}${V}${q?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const V of _.roots)G(V,0);for(const V of Object.keys(_.tasks))G(V,0);re.length>0&&(e.info(""),e.info(` + ${String(re.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const L=Date.now(),Q=mo(),Qe=j(($,I)=>{const E=I instanceof Error?I.message:String(I);e.warn(`Plugin error in ${$}: ${E}`)},"onHookError");await vo(Q,f.plugins);const ht=typeof t.profile=="string"?t.profile:void 0,en=j(async $=>{if(!ht)return;const I=wn($,_,L),E=ht.startsWith("/")?ht:`${i}/${ht}`;await Xi(I,E),e.info(`Profile written to ${ht}`)},"maybeWriteProfile"),Mt=f.taskRunner??{},hi=Di(i,t.cacheDir,Mt.cacheDirectory,f.sharedWorktreeCache),pi=Bi(hi,i,f.branchScopedCache),at=gu(process.env.VIS_RUN_CONCURRENCY_LIMIT);at&&"invalid"in at&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${at.invalid} is not a positive number; falling back to default concurrency.`);const gi=at&&"value"in at?at.value:void 0,mi=t.parallel??gi??3,tn=t.strictEnv??f.strictEnv??!1,Xe={dryRun:t.dryRun??!1,parallel:mi,skipNxCache:!t.cache,summarize:t.summarize??!1,...Mt,cacheDirectory:pi,dataDirectory:Mt.dataDirectory??Bt(i),onFingerprint:j(async($,I)=>{await Q.callHook("task:fingerprint",$,I)},"onFingerprint")},rn=Zi(Mt.remoteCache);if(rn){const $=vu(t.cacheMode),I=yu(t.cacheBackend);if(Xe.remoteCache={...rn,...$?{mode:$}:{},...I?{backend:I}:{}},Xe.remoteCache.attestation){const{expectedIdentity:E,requireOnDownload:G}=Xe.remoteCache.attestation;if(!(E!==void 0&&("github"in E&&typeof E.github?.ref=="string"&&typeof E.github.repo=="string"&&typeof E.github.workflow=="string"||"oidcIssuer"in E&&typeof E.oidcIssuer=="string"&&(typeof E.san=="string"||typeof E.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 E&&(!E.sanRegex.startsWith("^")||!E.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:V,isSigstoreInstalled:Z}=await import("./loader.js");Z()||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:
191
- ${V(i)}`);const{buildCacheAttestationHooks:q}=await import("./cache-attestation.js");Xe.remoteCache.attestation=q({expectedIdentity:E,onReject:j((N,fe)=>{e.warn(`[vis run] remote cache entry ${N.slice(0,12)} rejected: attestation ${fe}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:j(N=>{e.warn(`[vis run] attestation verification failed: ${N}`)},"onVerifyFailure"),requireOnDownload:G,workspaceRoot:i})}}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 vi=process.stdout.isTTY&&!vt,yi=f.tui?.autoExit??!1,nn={args:{parallel:Xe.parallel,targets:[b]},autoExit:yi,projectNames:F,tasks:[...J,...re]},sn=typeof t.retryBudget=="number"?t.retryBudget:void 0,on=sn===void 0?void 0:hu(sn),an=new yo(Q,Qe),cn=new co(i),ln=ld(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(oe.satisfiedServices.length>0)for(const $ of oe.satisfiedServices){const I=oe.serviceDependentsByServiceId.get($.id)??[];try{await Q.callHook("service:attach",$,I)}catch(E){Qe("service:attach",E)}}await Q.callHook("run:before",{tasks:J,workspaceRoot:i});const pt=t.stopServices===!0;let dn=!1;const un=j(()=>{if(dn)return;dn=!0,ye&&ye.dispose().catch(()=>{});const $=pt?[...Ee.values()]:void 0;au({extraPids:$,pidFiles:Ae,runDir:We})},"runCleanupOnce"),Et=j(()=>{un()},"onCleanupSignal"),fn=Ae.length>0||We!==void 0||pt&&ze.length>0;fn&&(process.on("SIGINT",Et),process.on("SIGTERM",Et));try{if(vi){const $=new Map,I=ad({...nn,onRetryService:ye?B=>ye.retry(B):void 0,outputStyle:ln,serviceDockStore:Se,stdinRegistry:$}),{lifeCycle:E,store:G}=I,V=new $n([E,an,cn]),Z=Xn({affectedFiles:w,currentOs:x,hooks:Q,initCwd:a,lifeCycle:V,mutexPool:new Map,onOutput:j((B,H)=>{ye&&He.has(B)?ye.onTaskOutput(B,H):G.addOutput(B,H)},"onOutput"),onOutputReplace:j((B,H)=>{G.setOutput(B,H)},"onOutputReplace"),retryBudget:on,serviceEnvByTaskId:C,serviceEventBridge:ye??void 0,stdinRegistry:$,strictEnv:tn,workspaceRoot:i});let q="rerun",N=null,fe=new Map;for(;q!=="quit";){if(q==="rerun"){if(fe=await kn(J,Xe,{lifeCycle:V,projectGraph:m,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),re.length>0&&!t.failFast){const B=new Promise(H=>{const W=G.subscribe(()=>{const ne=G.getSnapshot();(ne.rerunRequested||ne.retryTaskId)&&(W(),H())});I.renderIsDone.then(()=>{W(),H()}).catch(()=>{W(),H()})});await Yn(re,i,w,a,{abortSignal:B,lifeCycle:V,stdinRegistry:$,store:G},C)}}else if(q==="retry"&&N){const B=J.find(W=>W.id===N),H=B?.overrides.command;if(B&&H){const W=Ht(i,B.projectRoot,!1);V.startTasks?.([B]);const ne=new wr(zt),we=(await Nt([{command:H,cwd:W,name:B.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:j(he=>{he.kind==="started"&&he.write&&$.set(B.id,{kill:he.kill,resize:he.resize,write:he.write}),(he.kind==="stdout"||he.kind==="stderr")&&he.text&&(ne.write(he.text),G.setOutput(B.id,ne.toString())),he.kind==="close"&&$.delete(B.id)},"onEvent")})).closeEvents[0];V.endTasks?.([{code:we?.exitCode??1,status:we?.exitCode===0?"success":"failure",task:B,terminalOutput:G.getSnapshot().outputs.get(B.id)}])}else B&&V.endTasks?.([{code:1,status:"failure",task:B,terminalOutput:`No command configured for ${B.id}`}]);N=null,G.markDone()}q=await new Promise(B=>{const H=G.subscribe(()=>{const W=G.getSnapshot();W.rerunRequested&&(G.acknowledgeRerun(),H(),B("rerun")),W.retryTaskId&&(N=G.acknowledgeRetry(),H(),B("retry"))});I.renderIsDone.then(()=>{H(),B("quit")}).catch(()=>{H(),B("quit")})})}await I.renderIsDone,await Q.callHook("run:after",fe),await en(fe),ke>0&&(e.info(""),pt?e.info(`${String(ke)} service(s) stopped (--stop-services).`):e.info(`${String(ke)} 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():"",E=I==="labeled"||I==="grouped"||I==="interleaved"?I:void 0,G=E?eo(E):void 0,V=new $n([new ud({...nn,ciGrouping:s?.run?.ciGrouping??"auto",logReporter:G,outputStyle:ln}),an,cn]),Z=Xn({affectedFiles:w,currentOs:x,hooks:Q,initCwd:a,lifeCycle:V,mutexPool:$,retryBudget:on,serviceEnvByTaskId:C,serviceEventBridge:ye??void 0,strictEnv:tn,workspaceRoot:i}),q=j(async()=>{const W=Date.now(),ne=await kn(J,Xe,{lifeCycle:V,projectGraph:m,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),we=Date.now()-W;if(t.summarize){const Ie=wn(ne,_,L);await to(Ie,i,{dataDirectory:Bt(i)})}let he=!1;for(const[,Ie]of ne)Ie.status==="failure"&&(he=!0);const Ce=Ni(ne,we),Re=_i(i),Ve=Gi(i,we,Re);return e.info(""),e.info(` ${Ce}${Ve?` ${Ve}`:""}`),{hasFailure:he,results:ne,runHistory:Re}},"runOnce"),N=await q();await Q.callHook("run:after",N.results),await en(N.results);const{hasFailure:fe}=N;if(t.watch){const W=F.map(ve=>{const Te=c.projects[ve]?.root;if(Te)return Te.startsWith("/")?Te:`${i}/${Te}`}).filter(ve=>ve!==void 0),ne=J;let we;const he=j(ve=>{const Te=kd(ne,ve);return we=Te.filter,J=Te.tasks,Te.tasks.length},"applyFilter");let Ce=!1,Re=N.results;const Ve=j(()=>{const ve=Cn(Re,i);if(ve.directories.length>0&&ve.files.size>0){const Te=Bo(ve.files,i,ve.directories);return{handle:In({filter:Te,onChange:Rt,paths:ve.directories}),mode:"tracked"}}return{handle:In({onChange:Rt,paths:W}),mode:"roots"}},"buildHandle");let Ie;const Rt=j(async ve=>{if(!Ce){Ce=!0;try{e.info(`Change detected in ${ve.length} file(s), rerunning…`),Re=(await q()).results,Ie?.close(),Ie=Ve().handle}finally{Ce=!1}}},"onChangeHandler"),hn=Ve();Ie=hn.handle;const wi=hn.mode==="tracked"?`Watching ${String(Cn(Re,i).files.size)} tracked file(s)`:`Watching ${String(W.length)} project root(s)`;e.info(`${wi} — edit a file to rerun, press h for keybinds, q to quit.`);const tr=j(async()=>{if(!Ce){Ce=!0;try{if(J.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Re=(await q()).results,Ie?.close(),Ie=Ve().handle}finally{Ce=!1}}},"triggerRerun");await new Promise(ve=>{let Te=!1,pn;const gn=j(()=>{mn()},"onSigint"),mn=j(()=>{Te||(Te=!0,pn?.close(),process.off("SIGINT",gn),Ie?.close(),ve())},"exit");process.on("SIGINT",gn),pn=Cd({handlers:{onClearFilter:j(async()=>{const gt=he(void 0);e.info(`Filter cleared — running ${String(gt)} task(s).`),await tr()},"onClearFilter"),onFilter:j(async gt=>{const $i=we,vn=he(gt);if(vn===0){e.info(`Filter "${gt}" matched no projects — keeping previous filter.`),he($i);return}e.info(`Filter "${gt}" matched ${String(vn)} task(s).`),await tr()},"onFilter"),onHelp:j(()=>{Td(process.stdout)},"onHelp"),onQuit:j(()=>{mn()},"onQuit"),onRerun:tr}})});return}if(t.flaky!==!1){const W=qi(i,{minRuns:2},N.runHistory);if(W.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const ne of Ui(W))e.info(` ${ne}`);e.info("")}}const B=[];for(const[W,ne]of N.results)ne.retryAttempts&&ne.retryAttempts>0&&B.push(W);const H=t.failOnRetry===!0&&B.length>0;if(H){const W=B.slice(0,5),ne=B.length-W.length,we=ne>0?`${W.join(", ")}, and ${String(ne)} more`:W.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(B.length)} task(s) succeeded only after retry: ${we}`)}if(fe||H){const W=H&&!fe?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",ne=2e3,we=[];for(const[he,Ce]of N.results){if(Ce.status!=="failure")continue;const Re=Ce.terminalOutput??"",Ve=Re.length>ne?`…${Re.slice(-ne)}`:Re,Ie=Ce.code??"?";we.push(` ${he} (exit ${String(Ie)}):
192
- ${Ve.split(`
193
- `).map(Rt=>` ${Rt}`).join(`
194
- `)}`)}throw new Error(we.length>0?`${W}
195
- ${we.join(`
196
- `)}`:W)}re.length>0&&!t.failFast&&await Yn(re,i,w,a,void 0,C),ke>0&&(e.info(""),pt?e.info(`${String(ke)} service(s) stopped (--stop-services).`):e.info(`${String(ke)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{un(),fn&&(process.off("SIGINT",Et),process.off("SIGTERM",Et)),pt&&ze.length>0&&await Promise.all(ze.map(async $=>{try{await wo(i,$)}catch{}}))}},"execute");export{hu as createRetryBudget,Vu as default};
177
+ `,au=Ie(()=>{const t=Qi(ue(So(),"vis-services-")),e=ue(t,"bootstrap.mjs");return Ks(e,ou),{runDir:t,scriptPath:e}},"prepareBootstrap"),Jn=Ie((t,e,r)=>{const s=r.replaceAll(/[^\w-]/g,"_");return{configFile:ue(t,`${s}.json`),logFile:ue(t,`${s}.log`),pidFile:ue(t,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),cu=Ie(t=>{const{paths:e,service:r}=t,s=r.config.readiness?.tcp?.port??r.config.port;if(typeof s!="number")throw new TypeError(`Service ${r.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const n={...r.env,PATH:Li(r.cwd,r.env)};return{command:r.command,cwd:r.cwd,env:n,host:r.config.readiness?.tcp?.host??"127.0.0.1",id:r.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:r.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),lu=Ie(t=>`node ${JSON.stringify(t.scriptPath)} ${JSON.stringify(t.configFile)}`,"buildEphemeralCommand"),uu=Ie(t=>{const{id:e,visBin:r,workspaceRoot:s}=t;return`node ${JSON.stringify(r)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),du=Ie(t=>{const{missingServiceIds:e,mode:r,taskGraph:s,visBin:n,workspaceRoot:o}=t,{services:i,skipped:c}=Yn(o,e,s);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:c};const d=iu(i.map(b=>b.id),s),h=new Map(i.map(b=>[b.id,b])),f=[],p=[];if(r==="ephemeral")for(const b of d){const k=h.get(b);k&&p.push({id:b,payload:cu({paths:{logFile:"",pidFile:""},service:k})})}let l;r==="ephemeral"&&(l=au());let g;for(const b of d){const k=h.get(b),R=s.tasks[b];if(!k||!R)continue;let j;if(r==="ephemeral"){const C=Jn(l.runDir,l.scriptPath,b),v={...p.find(x=>x.id===b).payload,logFile:C.logFile,pidFile:C.pidFile};Ks(C.configFile,JSON.stringify(v)),j=lu(C),f.push(C.pidFile)}else j=uu({id:b,visBin:n,workspaceRoot:o});if(R.overrides={...R.overrides,command:j},R.cache=!1,s.tasks[b]=R,g!==void 0){const C=s.dependencies[b]??[];C.includes(g)||(s.dependencies[b]=[...C,g])}g=b}const w=new Set(d),I=new Map,L=Ie(b=>{const k=new Set,R=[...s.dependencies[b]??[]],j=new Set;for(;R.length>0;){const C=R.pop();if(!j.has(C)){j.add(C),w.has(C)&&k.add(C);for(const v of s.dependencies[C]??[])j.has(v)||R.push(v)}}return[...k].sort()},"collectTransitive");for(const b of Object.keys(s.dependencies)){if(w.has(b))continue;const k=L(b);if(k.length===0)continue;const R={};for(const j of k){const C=h.get(j);C?.config.env&&Object.assign(R,C.config.env)}Object.keys(R).length>0&&I.set(b,R)}return{chain:d,ephemeralPidFiles:f,runDir:l?.runDir,serviceEnvByTaskId:I,skipped:c}},"injectServiceTasks"),fu=new Set(["auto","ephemeral","off","persistent"]),hu=Ie(t=>{const{cli:e,config:r,isCi:s,isPersistentTarget:n,isTty:o,target:i}=t;if(e!==void 0&&!fu.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const c=e??r??(o&&!s?"auto":"off");return c==="off"?"off":c==="ephemeral"?"ephemeral":c==="persistent"?"registry":n||i==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var pu=Object.defineProperty,qe=m((t,e)=>pu(t,"name",{value:e,configurable:!0}),"l$1");const Xn=qe(t=>t.replace(/^--?/u,""),"asKebab"),gu=new Set(["0","1","false","no","true","yes"]),mu=qe(t=>!t.startsWith("-")||/^-(?:\d|\.\d)/u.test(t),"isValueToken"),Bs=qe((t,e,r,s,n,o)=>{if(s!==void 0)return t.set(e,s),0;const i=n[o+1];return(r?.type??"string")==="boolean"?i!==void 0&&gu.has(i.toLowerCase())?(t.set(e,i.toLowerCase()),1):(t.set(e,"true"),0):i!==void 0&&mu(i)?(t.set(e,i),1):(t.set(e,"true"),0)},"captureValue"),vu=qe((t,e)=>{const r=t.type??"string";if(r==="number"){const s=e.trim(),n=Number(s);return s===""||!Number.isFinite(n)?{error:`--${t.name} expects a number, got "${e}"`}:{value:n}}if(r==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${t.name} expects a boolean, got "${e}"`};if(r==="enum"){const s=t.choices??[];return s.includes(e)?{value:e}:{error:`--${t.name} must be one of [${s.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),wu=qe(t=>{const e=[],r=new Set;for(const s of t){const n=s.name||"<unnamed>";(!s.name||!/^[a-zA-Z][\w-]*$/u.test(s.name))&&e.push(`argument name "${n}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),r.has(s.name)&&e.push(`duplicate argument name "${n}"`),r.add(s.name),s.alias!==void 0&&s.alias.length!==1&&e.push(`argument "${n}" alias "${s.alias}" must be a single character`);const o=s.type??"string";if(o==="enum"&&(s.choices===void 0||s.choices.length===0)&&e.push(`argument "${n}" has type "enum" but declares no choices`),s.default!==void 0){const i=typeof s.default;o==="number"&&i==="number"||o==="boolean"&&i==="boolean"||(o==="string"||o==="enum")&&i==="string"?o==="enum"&&s.choices&&!s.choices.includes(s.default)&&e.push(`argument "${n}" default "${String(s.default)}" is not one of its choices`):e.push(`argument "${n}" default ${JSON.stringify(s.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),yu=qe((t,e)=>{const r=new Map,s=new Map;for(const h of t)r.set(h.name,h),h.alias&&s.set(h.alias,h);const n=new Map,o=[];for(let h=0;h<e.length;h+=1){const f=e[h];if(f==="--"){o.push(...e.slice(h+1));break}if(f.startsWith("--no-")){n.set(Xn(f.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(f);if(p){const w=p[1];h+=Bs(n,w,r.get(w),p[2],e,h);continue}const l=/^-([^=-])(?:=(.*))?$/su.exec(f),g=l?.[1];if(l&&g!==void 0){const w=s.get(g);h+=Bs(n,w?.name??g,w,l[2],e,h);continue}o.push(f)}const i={},c=[];let d=0;for(const h of t){let f=n.get(h.name);if(f===void 0&&h.positional&&d<o.length&&(f=o[d],d+=1),f===void 0){h.default!==void 0?i[h.name]=h.default:h.required&&c.push(`missing required argument --${h.name}`);continue}const{error:p,value:l}=vu(h,f);p?c.push(p):l!==void 0&&(i[h.name]=l)}return{errors:c,values:i}},"parseTaskArguments"),$u=qe(t=>`VIS_ARG_${Xn(t).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),bu=qe(t=>{const e={};for(const[r,s]of Object.entries(t))e[$u(r)]=String(s);return e},"taskArgumentEnv"),tr=qe((t,e,r)=>{const s=[`Usage: vis run ${t} [-- <args>]`];if(e&&s.push("",e),r.length===0)return s.join(`
178
+ `);s.push("","Arguments:");const n=r.map(i=>{const c=i.positional?`<${i.name}>`:`--${i.name}`,d=i.alias?`, -${i.alias}`:"";return{left:`${c}${d}`,right:i}}),o=Math.max(...n.map(i=>i.left.length));for(const{left:i,right:c}of n){const d=[],h=c.type??"string";d.push(h==="enum"?`enum(${(c.choices??[]).join("|")})`:h),c.required&&d.push("required"),c.default!==void 0&&d.push(`default: ${String(c.default)}`);const f=`${c.description??""}${c.description?" ":""}[${d.join(", ")}]`;s.push(` ${i.padEnd(o)} ${f}`)}return s.join(`
179
+ `)},"renderTaskArgumentsHelp");var ku=Object.defineProperty,xu=m((t,e)=>ku(t,"name",{value:e,configurable:!0}),"l");const ju=xu((t,e,r,s)=>{if(!r||r.length===0)return{env:{},kind:"ok"};const n=wu(r);if(n.length>0)return{errors:n.map(i=>`invalid \`arguments\` schema for "${t}": ${i}`),help:tr(t,e,r),kind:"invalid"};if(s.includes("--help")||s.includes("-h"))return{kind:"help",text:tr(t,e,r)};const o=yu(r,s);return o.errors.length>0?{errors:o.errors,help:tr(t,e,r),kind:"invalid"}:{env:bu(o.values),kind:"ok"}},"resolveTaskArguments");var Su=Object.defineProperty,O=m((t,e)=>Su(t,"name",{value:e,configurable:!0}),"a");const qr="VIS_AFFECTED_FILES",Tu=2e3,_s=O(async(t,e,r,s,n,o)=>{const i=t.map(j=>{const C=j.overrides.command;if(!C)return;const v=j.overrides.visOptions,x=_t(e,j.projectRoot,!!v?.runFromWorkspaceRoot),F=v?.envFile?lr(x,v.envFile):{},P=r&&(v?.affectedFiles==="env"||v?.affectedFiles==="both")?{[qr]:r.join(`
180
+ `)}:{},q=o?.get(j.id)??{},ae=Ta({interactive:!!n,taskPty:j.pty,workspacePty:v?.pty});return{command:C,cwd:x,env:{INIT_CWD:s,...F,...q,...P,...j.overrides[zr]},name:j.id,...ae?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(j=>j!==void 0);if(i.length===0)return;if(!n){await Et(i,{killOthers:["failure"],onEvent:O(()=>{},"onEvent")});return}const{abortSignal:c,lifeCycle:d,stdinRegistry:h,store:f}=n,p=i.map(j=>t.find(C=>C.id===j.name)).filter(Boolean),l=O(j=>i[j]?.stdin==="pty","isPtyIndex"),g=new Map,w=O(j=>{if(!l(j))return;let C=g.get(j);return C||(C=new ur(Bt),g.set(j,C)),C},"getTermBuffer");f.unmarkDone(),d.startTasks?.(p);const I=new Map,L=new Map;let b;const k=O(()=>{for(const j of L.values())try{j("SIGTERM")}catch{}b||(b=setTimeout(()=>{for(const j of L.values())try{j("SIGKILL")}catch{}L.clear()},2e3),b.unref?.())},"killAll");let R;c&&(R=O(()=>{k()},"abortListener"),c.then(()=>{R?.()}).catch(()=>{R?.()}));try{await Et(i,{killOthers:["failure"],onEvent:O(j=>{const C=p[j.index];if(C)switch(j.kind){case"close":{const v=I.get(C.id)??Date.now(),x=j.killed||j.exitCode===0?"success":"failure";d.endTasks?.([{code:j.exitCode??0,endTime:Date.now(),startTime:v,status:x,task:C,terminalOutput:f.getSnapshot().outputs.get(C.id)??""}]),L.delete(j.index),h?.delete(C.id);break}case"error":{if(j.message){const v=w(j.index);v?(v.write(`${j.message}
181
+ `),f.setOutput(C.id,v.toString())):f.addOutput(C.id,`${j.message}
182
+ `)}break}case"started":{I.set(C.id,Date.now()),j.kill&&L.set(j.index,j.kill),j.write&&h&&h.set(C.id,{kill:j.kill,resize:j.resize,write:j.write});break}case"stderr":case"stdout":{if(j.text){const v=w(j.index);v?(v.write(j.text),f.setOutput(C.id,v.toString())):f.addOutput(C.id,`${j.text}
183
+ `)}break}}},"onEvent")})}finally{b&&(clearTimeout(b),b=void 0),f.markDone()}},"runPersistentTasks"),Ns=O(t=>{try{return process.kill(-t,0),!0}catch{try{return process.kill(t,0),!0}catch{return!1}}},"isPidAlive"),Cu=O(t=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t)},"sleepSyncMs"),Iu=O(t=>{const{extraPids:e=[],pidFiles:r,runDir:s}=t,n=[],o=O(i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}},"sendSigterm");for(const i of r){let c;try{const d=hi(i),h=Number.parseInt(d.trim(),10);c=Number.isFinite(h)&&h>0?h:void 0}catch{continue}c!==void 0&&(n.push(c),o(c))}for(const i of e)!Number.isFinite(i)||i<=0||(n.push(i),o(i));if(n.length>0){const i=Date.now()+1500;for(;Date.now()<i;){let c=!0;for(const d of n)if(Ns(d)){c=!1;break}if(c)break;Cu(100)}for(const c of n)if(Ns(c))try{process.kill(-c,"SIGKILL")}catch{try{process.kill(c,"SIGKILL")}catch{}}}s&&$i(s)},"cleanupEphemeralServices"),Bt=256*1024;class Mu{static{m(this,"zn")}static{O(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...]
184
+ ${this.#s}`:this.#s}}const Qn=O(t=>{const e=t.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),Ru=O(t=>`'${t.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Ur=O(t=>process.platform==="win32"?t.length>0&&!/[\s"&|<>^()%!]/.test(t)?t:`"${t.replaceAll('"','""')}"`:Ru(t),"shellQuote"),Ou=O((t,e,r)=>{if(!e||e.length===0||r===!1||r===void 0)return t;if(r==="args"||r==="both"){const s=e.map(n=>Ur(n)).join(" ");return`${t} ${s}`}return t},"buildAffectedFilesArgs"),Zn="visForwardedArgs",zr="visTaskArgEnv",Eu=O((t,e)=>{const r=e.overrides[Zn];if(!Array.isArray(r)||r.length===0)return t;const s=r.map(n=>Ur(n)).join(" ");return`${t} ${s}`},"appendForwardedArgs"),Pu=O(async(t,e,r)=>{if(!e)return r();const s=t.get(e)??Promise.resolve();let n;const o=new Promise(c=>{n=c}),i=s.then(()=>o);t.set(e,i),await s;try{return await r()}finally{n(),t.get(e)===i&&t.delete(e)}},"withMutex"),Fu=O(t=>{let e=Math.max(0,Math.floor(t));return{claim(r){const s=Math.max(0,Math.min(r,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Au=O((t,e,r)=>{const s=`${e}\0${typeof r=="string"?r:String(r)}`,n=t.get(s);if(n)return n;const o=lr(e,r);return t.set(s,o),o},"loadEnvFileCached"),Gs=O(t=>{const e=new Map;return async(r,s)=>{const{affectedFiles:n,currentOs:o,hooks:i,initCwd:c,lifeCycle:d,mutexPool:h,onOutput:f,onOutputReplace:p,retryBudget:l,serviceEnvByTaskId:g,serviceEventBridge:w,stdinRegistry:I,strictEnv:L,workspaceRoot:b}=t,k=Qn(r),R=_t(b,s.cwd??r.projectRoot,k?.runFromWorkspaceRoot===!0),j=r.overrides.command;if(!j)return{code:0,terminalOutput:`No command configured for ${r.target.project}:${r.target.target}`};const C=Eu(j,r),v=Ou(C,n,k?.affectedFiles),x=bi(k,o),F=k?.shellArgs,P=F&&F.length>0?F.join(" "):"-c",q=x?`${x} ${P} ${Ur(v)}`:v,ae=k?.envFile?Au(e,R,k.envFile):void 0,Q={};n&&n.length>0&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")&&(Q[qr]=n.join(`
185
+ `));const V=g?.get(r.id),ce={INIT_CWD:c,...ae,...V,...s.env,...Q,...r.overrides[zr]};if(k?.strictEnv??L??!1){const J=Fa({command:v,processEnv:process.env,taskEnv:ce,taskId:r.id});if(J){const me=Aa(J);return d?.onTaskStderr?.(r,me),{code:1,terminalOutput:me}}}const Me=k?.pty===!0,ie=!!I,ge=r.pty===!0?!0:r.pty===!1?!1:ie||Me;ge&&(r.cache=!1);const Y=ge?void 0:new Mu(Bt),re=ge?new ur(Bt):void 0;let de;const le=O(J=>{if(J.kind==="started"&&(de=J.kill,J.write&&I&&I.set(r.id,{kill:J.kill,resize:J.resize,write:J.write}),w?.onRegistryTaskStarted(r.id)),(J.kind==="stdout"||J.kind==="stderr")&&J.text!==void 0)if(J.kind==="stdout"?d?.onTaskStdout?.(r,J.text):d?.onTaskStderr?.(r,J.text),re)re.write(J.text),ie&&p?.(r.id,re.toString()),w&&w.onTaskOutput(r.id,J.text);else{const me=`${J.text}
186
+ `;Y.append(me),f?.(r.id,me)}J.kind==="close"&&(I&&I.delete(r.id),w&&w.onRegistryTaskClosed(r.id,J.exitCode??0,!!J.killed).catch(()=>{}))},"onEvent"),_=O(async()=>{const J=k?.retryCount??0,me=k?.retryDelay,Ke=l?l.claim(J):J,Ye=typeof k?.timeout=="number"&&k.timeout>0?k.timeout:0,st=typeof k?.killGracePeriodMs=="number"&&k.killGracePeriodMs>=0?k.killGracePeriodMs:5e3;let oe=!1,Ae=0;const Ue=_l({killGracePeriodMs:st,onTimeout:O(()=>{oe=!0},"onTimeout"),sendSignal:O(ke=>{de?.(ke)},"sendSignal"),timeoutMs:Ye});let be;try{be=await Et([{command:q,cwd:R,env:ce,name:r.id,...ge?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:le,...Ke>0?{restart:{delay:me??"exponential",onRetry:O(async(ke,He,xe)=>{Ae=ke,i&&await i.callHook("task:retry",r,ke,xe)},"onRetry"),tries:Ke}}:{}})}finally{Ue.cancel()}const ze=be.closeEvents[0],Re=re?re.toString():Y.toString();return oe?{code:124,retryAttempts:Ae,terminalOutput:`${Re}
187
+ [timeout] Task "${r.id}" exceeded ${Ye}ms budget.
188
+ `}:{code:ze?.exitCode??1,retryAttempts:Ae,terminalOutput:Re}},"runOnce");return h?Pu(h,k?.mutex,_):_()}},"createConcurrentExecutor"),Lu=O(t=>{if(!t||t.trim().length===0)return;const e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?{invalid:t}:{value:Math.floor(e)}},"parseEnvConcurrency"),Du=O(async(t,e)=>{const r=await Di(t,{dataDirectory:Ot(t)});if(!r){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Bi(t,{dataDirectory:Ot(t)})}.`);return}const s=(r.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${r.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(r.stats.total)}`),e.info(` Succeeded: ${String(r.stats.succeeded)}`),e.info(` Cached: ${String(r.stats.cached)}`),e.info(` Failed: ${String(r.stats.failed)}`),e.info(` Skipped: ${String(r.stats.skipped)}`),e.info(""),r.stats.failed>0){const o=r.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const c=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${c}ms)`)}e.info("")}const n=[...r.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(n.length>0){e.info("Slowest tasks:");for(const o of n)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Bu=O(t=>{if(!(t===void 0||t==="")){if(t!=="read"&&t!=="write"&&t!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${t}")`);return t}},"parseCacheMode"),_u=O(t=>{if(!(t===void 0||t==="")){if(t!=="http"&&t!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${t}")`);return t}},"parseCacheBackend"),sd=O(async({argument:t,logger:e,options:r,runtime:s,visConfig:n,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o;if(ki(i),r.lastDetails===!0){await Du(i,e);return}const c=process.cwd(),d=await xi(i),{config:h,packageJsons:f,projectOptions:p,workspace:l}=ji(i,n,d),g=Si(i,l,f);let w=t[0];if(!w){const y=ys(l);if(process.stdout.isTTY&&process.stdin.isTTY){const T=await qa(y);if(!T){e.info("No target selected.");return}w=T,await Fl(`vis run ${T}`)}else{e.info("Available targets:"),e.info(""),e.info(Ga(y)),e.info(""),e.info("Usage: vis run <target>");return}}if(h.constraints&&!r.skipConstraints){const y=_i(g,h.constraints);if(y.length>0){for(const T of y)e.error(`[${T.rule}] ${T.message}`);throw new Error(`${y.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(r.affected){const y=[w];r.parallel!==void 0&&y.push(`--parallel=${String(r.parallel)}`),r.cache||y.push("--no-cache"),r.query&&y.push(`--query=${String(r.query)}`),r.reverse&&y.push("--reverse"),typeof r.runnerTags=="string"&&r.runnerTags!==""&&y.push(`--runner-tags=${r.runnerTags}`),await s.runCommand("affected",{argv:y});return}const I=await po(w,l,process.cwd(),i),L=Da(p),b=Ba(I.target,L);b!==I.target&&e.debug?.(`Resolved alias "${I.target}" → "${b}"`);let k=I.projects;const R=t.slice(1).map(String);if(r.projects){const y=new Set(r.projects.split(",").map(T=>T.trim()));if(k=k.filter(T=>y.has(T)),k.length===0)throw new Error(`No matching projects found for: ${String(r.projects)}`)}if(r.query&&(k=go(k,l,r.query),k.length===0)){e.info(`Query "${String(r.query)}" matched no projects.`);return}const j=Ti(),C=process.env[qr],v=C?C.split(`
189
+ `).filter(Boolean):void 0,x=(typeof r.runnerTags=="string"?r.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,F=x?new Set(x.split(",").map(y=>y.trim()).filter(Boolean)):void 0,P=[],q=new Map;for(const y of k){const T=p.get(y)?.[b];if(!T)continue;const M=T.options;if(!M?.internal){if(!Ci(M,!!pt)){e.debug?.(`Skipping ${y}:${b} — runInCI filter`);continue}if(!Ii(M,F)){e.debug?.(`Skipping ${y}:${b} — runner-tags filter`);continue}P.push(y),q.set(y,T)}}if(P.length===0){const y=ys(l),T=Object.entries(l.projects).filter(([,M])=>M.targets?.[b]!==void 0).map(([M])=>M);if(e.error(`No projects have the "${b}" target.`),T.length>0){e.info(""),e.info(`Target "${b}" exists in these projects but was filtered out:`);for(const M of T.slice(0,5))e.info(` - ${M}`);T.length>5&&e.info(` …and ${T.length-5} more`)}else{const M=rn(b,y,3);M.length>0&&(e.info(""),e.info(M.length===1?`Did you mean "${M[0]}"?`:`Did you mean one of: ${M.map(N=>`"${N}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ae=r.pty===!0,Q=P.map(y=>({project:y,schema:q.get(y)?.arguments})).filter(y=>Array.isArray(y.schema)&&y.schema.length>0),V=new Map;for(const{project:y,schema:T}of Q){const M=JSON.stringify(T),N=V.get(M)??[];N.push(y),V.set(M,N)}if(V.size>1){const y=[...V.values()].map(T=>T.join(", ")).join(" | ");throw new Error(`Target "${b}" declares conflicting \`arguments\` schemas across projects (${y}). Run a single project (e.g. \`vis run ${Q[0]?.project}:${b}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ce=Q[0]?.schema,Me=q.get(Q[0]?.project??P[0])?.description,ie=ju(b,Me,ce,R);if(ie.kind==="help"){e.info(ie.text);return}if(ie.kind==="invalid"){e.info(`Invalid arguments for "${b}":`);for(const y of ie.errors)e.info(` ✖ ${y}`);throw e.info(""),e.info(ie.help),new Error(`Invalid arguments for target "${b}"`)}const ge=ie.env;let Y=P.map(y=>{const T=l.projects[y],M=q.get(y),N={project:y,target:b},W=`${y}:${b}`,Z=ae?{...M.options,pty:M.options?.pty??!0}:M.options,G=M.command?ls(M.command,{affectedFiles:v,projectRoot:T?.root}):M.command;return{cache:M.cache,id:W,outputs:M.outputs??[],overrides:{command:G,...R.length>0?{[Zn]:R}:{},...Object.keys(ge).length>0?{[zr]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:M.parallelism,projectRoot:T?.root,target:N}});const re=[],de=[];for(const y of Y)Qn(y)?.persistent?(y.cache=!1,re.push(y)):de.push(y);Y=de;const le=Ni(r.partition);if(le&&(Y=Gi.partitionTasks(Y,le),e.info(`Partition ${le.index}/${le.total}: running ${Y.length} task(s)`),Y.length===0)){e.info("No tasks assigned to this partition.");return}let _=qi([...Y,...re],{onCycleBroken:O(y=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${y.join(" → ")}`)},"onCycleBroken"),projectGraph:g,targetDefaults:h.tasks,workspace:l});for(const[y,T]of Object.entries(_.tasks)){const M=T.target.project,N=T.target.target,W=p.get(M)?.[N];if(!W)continue;const Z=l.projects[M];let G=!1;const B={...T.overrides};B.visOptions===void 0&&W.options&&(B.visOptions=W.options,G=!0),B.command===void 0&&W.command&&(B.command=ls(W.command,{affectedFiles:v,projectRoot:Z?.root}),G=!0),G&&(T.overrides=B,_.tasks[y]=T)}if(typeof r.skipCache=="string"&&r.skipCache.trim()!=="")if(r.cache){const y=Ma(r.skipCache,l,Object.keys(_.tasks));for(const T of y.skipTaskIds){const M=_.tasks[T];M!==void 0&&(M.cache=!1)}y.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${y.unmatchedPatterns.map(T=>`"${T}"`).join(", ")}`),y.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(y.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await to(i,h.toolchain,{error:O(y=>{e.error(y)},"error"),info:O(y=>{e.info(y)},"info"),warn:O(y=>{e.warn(y)},"warn")},!!r.skipToolchain);const J=r.preflight!==!1&&h.preflight?.lockfile!==!1,me=ha(i,pt,{warn:O(y=>{e.warn(y)},"warn")},{skip:!J});if(!me.shouldContinue)throw new Error(`${me.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);J&&!pt&&process.stdin.isTTY&&process.stdout.isTTY&&await xa(i,{interactive:!0,logger:{info:O(y=>{e.info(y)},"info"),warn:O(y=>{e.warn(y)},"warn")},projectManifests:[...f.values()]});const Ke=process.env.VIS_VERSION??"0.0.0",Ye=r.dryRun?void 0:async y=>{try{return await fo(y.config,{timeoutMs:Tu}),!0}catch{return!1}},st=await oo(i),oe=await Jl({initialTasks:[...Y,...re],probe:Ye,registeredEntries:st,taskGraph:_,visVersion:Ke}),Ae=[];let Ue,be=0;const ze=[],Re=new Map;let ke=[];const He=new Set;let xe=null,we=null;if(oe.diagnostics.length>0){const y=!!(process.stdout.isTTY&&process.stdin.isTTY),T=r.dryRun?"off":hu({cli:r.services,config:h.run?.services,isCi:!!pt,isPersistentTarget:re.length>0,isTty:y,target:b});if(T==="off"){for(const B of oe.diagnostics)e.error(B.message);throw new Error(`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const M=oe.diagnostics.map(B=>B.targetId),N=T,W=N==="registry"?Yn(i,M,_):void 0,Z=process.argv[1]??"vis",G=du({missingServiceIds:M,mode:N,taskGraph:_,visBin:Z,workspaceRoot:i});if(G.skipped.length>0){for(const{id:B,reason:fe}of G.skipped)e.error(`Cannot auto-start ${B}: ${fe}`);throw new Error(`${G.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ae.push(...G.ephemeralPidFiles),Ue=G.runDir,ke=G.chain;for(const B of G.chain)He.add(B);if(N==="registry"&&(be=G.chain.length,ze.push(...G.chain)),G.chain.length>0){const B=new $s(G.chain),fe=new Map;if(N==="ephemeral"&&G.runDir)for(const D of G.chain){const H=Jn(G.runDir,`${G.runDir}/bootstrap.mjs`,D);fe.set(D,{ephemeral:{configFile:H.configFile,cwd:i,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(N==="registry"&&W)for(const D of W.services)fe.set(D.id,{mode:"registry",registry:{command:D.command,config:D.config,cwd:D.cwd,env:D.env}});if(fe.size>0){const D=new tu({indexToId:new Map,services:fe,sink:{crashed:O((H,U)=>{B.markCrashed(H,U)},"crashed"),failed:O((H,U,se)=>{B.markFailed(H,U,se)},"failed"),log:O((H,U)=>{B.appendLog(H,U)},"log"),ready:O((H,U)=>{B.markReady(H,U)},"ready"),started:O((H,U)=>{B.markStarted(H,U),N==="registry"&&U!==null&&Re.set(H,U)},"started"),starting:O(H=>{B.markStarting(H)},"starting")},workspaceRoot:i});xe=B,we=D}}for(const[B,fe]of G.serviceEnvByTaskId){const D=oe.serviceEnvByTaskId.get(B)??{};oe.serviceEnvByTaskId.set(B,{...D,...fe})}}const E=new Set(re.map(y=>y.id));if(Y=oe.initialTasks.filter(y=>!E.has(y.id)),_=oe.taskGraph,ke.length>0&&(Y=[...ke.map(y=>_.tasks[y]).filter(y=>y!==void 0),...Y]),re.length>0){const y=new Set(re.map(Z=>Z.id)),T={};for(const[Z,G]of Object.entries(_.tasks))y.has(Z)||(T[Z]=G);const M={};for(const[Z,G]of Object.entries(_.dependencies))y.has(Z)||(M[Z]=G.filter(B=>!y.has(B)));const N=new Set;for(const Z of Object.values(M))for(const G of Z)N.add(G);const W=Object.keys(T).filter(Z=>!N.has(Z));_={dependencies:M,roots:W,tasks:T}}const{serviceEnvByTaskId:S}=oe;if(oe.satisfiedServices.length>0){const y=oe.satisfiedServices.map(T=>T.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${y}`),xe)for(const T of oe.satisfiedServices)xe.registerService(T.id);else xe=new $s(oe.satisfiedServices.map(T=>T.id));for(const T of oe.satisfiedServices){const M=T.config.readiness?.tcp?.port??T.config.port??0,N=T.config.readiness?.tcp?.host??"127.0.0.1";xe.markReady(T.id,{host:N,port:M})}}if(r.reverse&&(_=Ui(_),e.debug?.(`Reversed task graph: ${String(_.roots.length)} new root(s) (originally leaves)`)),r.dryRun){const y=Object.keys(_.tasks).length,T=_.roots.length;e.info(`Execution plan (${String(y)} task(s), ${String(T)} root(s)):`),e.info("");const M=new Set,N=O((W,Z)=>{if(M.has(W))return;M.add(W);for(const fe of _.dependencies[W]??[])N(fe,Z+1);const G=_.tasks[W],B=" ".repeat(Z+1);e.info(`${B}${W}${G?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const W of _.roots)N(W,0);for(const W of Object.keys(_.tasks))N(W,0);re.length>0&&(e.info(""),e.info(` + ${String(re.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const A=Date.now(),X=ao(),Je=O((y,T)=>{const M=T instanceof Error?T.message:String(T);e.warn(`Plugin error in ${y}: ${M}`)},"onHookError");await co(X,h.plugins);const ut=typeof r.profile=="string"?r.profile:void 0,Hr=O(async y=>{if(!ut)return;const T=us(y,_,A),M=ut.startsWith("/")?ut:`${i}/${ut}`;await zi(T,M),e.info(`Profile written to ${ut}`)},"maybeWriteProfile"),jt=h.taskRunner??{},ei=Mi(i,r.cacheDir,jt.cacheDirectory,h.sharedWorktreeCache),ti=Ri(ei,i,h.branchScopedCache),nt=Lu(process.env.VIS_RUN_CONCURRENCY_LIMIT);nt&&"invalid"in nt&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${nt.invalid} is not a positive number; falling back to default concurrency.`);const ri=nt&&"value"in nt?nt.value:void 0,si=r.parallel??ri??3,Wr=r.strictEnv??h.strictEnv??!1,Xe={dryRun:r.dryRun??!1,parallel:si,skipNxCache:!r.cache,summarize:r.summarize??!1,...jt,cacheDirectory:ti,dataDirectory:jt.dataDirectory??Ot(i),onFingerprint:O(async(y,T)=>{await X.callHook("task:fingerprint",y,T)},"onFingerprint")},Vr=Hi(jt.remoteCache);if(Vr){const y=Bu(r.cacheMode),T=_u(r.cacheBackend);if(Xe.remoteCache={...Vr,...y?{mode:y}:{},...T?{backend:T}:{}},Xe.remoteCache.attestation){const{expectedIdentity:M,requireOnDownload:N}=Xe.remoteCache.attestation;if(!(M!==void 0&&("github"in M&&typeof M.github?.ref=="string"&&typeof M.github.repo=="string"&&typeof M.github.workflow=="string"||"oidcIssuer"in M&&typeof M.oidcIssuer=="string"&&(typeof M.san=="string"||typeof M.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 M&&(!M.sanRegex.startsWith("^")||!M.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:W,isSigstoreInstalled:Z}=await import("./loader.js");Z()||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:
190
+ ${W(i)}`);const{buildCacheAttestationHooks:G}=await import("./cache-attestation.js");Xe.remoteCache.attestation=G({expectedIdentity:M,onReject:O((B,fe)=>{e.warn(`[vis run] remote cache entry ${B.slice(0,12)} rejected: attestation ${fe}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:O(B=>{e.warn(`[vis run] attestation verification failed: ${B}`)},"onVerifyFailure"),requireOnDownload:N,workspaceRoot:i})}}else(r.cacheMode||r.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ni=process.stdout.isTTY&&!pt,ii=h.tui?.autoExit??!1,Kr={args:{parallel:Xe.parallel,targets:[b]},autoExit:ii,projectNames:P,tasks:[...Y,...re]},Yr=typeof r.retryBudget=="number"?r.retryBudget:void 0,Jr=Yr===void 0?void 0:Fu(Yr),Xr=new lo(X,Je),Qr=new eo(i),Zr=Rl(typeof r.outputStyle=="string"?r.outputStyle.toLowerCase():void 0);if(oe.satisfiedServices.length>0)for(const y of oe.satisfiedServices){const T=oe.serviceDependentsByServiceId.get(y.id)??[];try{await X.callHook("service:attach",y,T)}catch(M){Je("service:attach",M)}}await X.callHook("run:before",{tasks:Y,workspaceRoot:i});const dt=r.stopServices===!0;let es=!1;const ts=O(()=>{if(es)return;es=!0,we&&we.dispose().catch(()=>{});const y=dt?[...Re.values()]:void 0;Iu({extraPids:y,pidFiles:Ae,runDir:Ue})},"runCleanupOnce"),St=O(()=>{ts()},"onCleanupSignal"),rs=Ae.length>0||Ue!==void 0||dt&&ze.length>0;rs&&(process.on("SIGINT",St),process.on("SIGTERM",St));try{if(ni){const y=new Map,T=Il({...Kr,onRetryService:we?D=>we.retry(D):void 0,outputStyle:Zr,serviceDockStore:xe,stdinRegistry:y}),{lifeCycle:M,store:N}=T,W=new ds([M,Xr,Qr]),Z=Gs({affectedFiles:v,currentOs:j,hooks:X,initCwd:c,lifeCycle:W,mutexPool:new Map,onOutput:O((D,H)=>{we&&He.has(D)?we.onTaskOutput(D,H):N.addOutput(D,H)},"onOutput"),onOutputReplace:O((D,H)=>{N.setOutput(D,H)},"onOutputReplace"),retryBudget:Jr,serviceEnvByTaskId:S,serviceEventBridge:we??void 0,stdinRegistry:y,strictEnv:Wr,workspaceRoot:i});let G="rerun",B=null,fe=new Map;for(;G!=="quit";){if(G==="rerun"){if(fe=await fs(Y,Xe,{lifeCycle:W,projectGraph:g,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),re.length>0&&!r.failFast){const D=new Promise(H=>{const U=N.subscribe(()=>{const se=N.getSnapshot();(se.rerunRequested||se.retryTaskId)&&(U(),H())});T.renderIsDone.then(()=>{U(),H()}).catch(()=>{U(),H()})});await _s(re,i,v,c,{abortSignal:D,lifeCycle:W,stdinRegistry:y,store:N},S)}}else if(G==="retry"&&B){const D=Y.find(U=>U.id===B),H=D?.overrides.command;if(D&&H){const U=_t(i,D.projectRoot,!1);W.startTasks?.([D]);const se=new ur(Bt),ye=(await Et([{command:H,cwd:U,name:D.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:O(he=>{he.kind==="started"&&he.write&&y.set(D.id,{kill:he.kill,resize:he.resize,write:he.write}),(he.kind==="stdout"||he.kind==="stderr")&&he.text&&(se.write(he.text),N.setOutput(D.id,se.toString())),he.kind==="close"&&y.delete(D.id)},"onEvent")})).closeEvents[0];W.endTasks?.([{code:ye?.exitCode??1,status:ye?.exitCode===0?"success":"failure",task:D,terminalOutput:N.getSnapshot().outputs.get(D.id)}])}else D&&W.endTasks?.([{code:1,status:"failure",task:D,terminalOutput:`No command configured for ${D.id}`}]);B=null,N.markDone()}G=await new Promise(D=>{const H=N.subscribe(()=>{const U=N.getSnapshot();U.rerunRequested&&(N.acknowledgeRerun(),H(),D("rerun")),U.retryTaskId&&(B=N.acknowledgeRetry(),H(),D("retry"))});T.renderIsDone.then(()=>{H(),D("quit")}).catch(()=>{H(),D("quit")})})}await T.renderIsDone,await X.callHook("run:after",fe),await Hr(fe),be>0&&(e.info(""),dt?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 y=new Map,T=typeof r.log=="string"?r.log.toLowerCase():"",M=T==="labeled"||T==="grouped"||T==="interleaved"?T:void 0,N=M?Wi(M):void 0,W=new ds([new El({...Kr,ciGrouping:n?.run?.ciGrouping??"auto",logReporter:N,outputStyle:Zr}),Xr,Qr]),Z=Gs({affectedFiles:v,currentOs:j,hooks:X,initCwd:c,lifeCycle:W,mutexPool:y,retryBudget:Jr,serviceEnvByTaskId:S,serviceEventBridge:we??void 0,strictEnv:Wr,workspaceRoot:i}),G=O(async()=>{const U=Date.now(),se=await fs(Y,Xe,{lifeCycle:W,projectGraph:g,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),ye=Date.now()-U;if(r.summarize){const Ce=us(se,_,A);await Vi(Ce,i,{dataDirectory:Ot(i)})}let he=!1;for(const[,Ce]of se)Ce.status==="failure"&&(he=!0);const Te=Oi(se,ye),Oe=Ei(i),We=Pi(i,ye,Oe);return e.info(""),e.info(` ${Te}${We?` ${We}`:""}`),{hasFailure:he,results:se,runHistory:Oe}},"runOnce"),B=await G();await X.callHook("run:after",B.results),await Hr(B.results);const{hasFailure:fe}=B;if(r.watch){const U=P.map(ve=>{const je=l.projects[ve]?.root;if(je)return je.startsWith("/")?je:`${i}/${je}`}).filter(ve=>ve!==void 0),se=Y;let ye;const he=O(ve=>{const je=ql(se,ve);return ye=je.filter,Y=je.tasks,je.tasks.length},"applyFilter");let Te=!1,Oe=B.results;const We=O(()=>{const ve=gs(Oe,i);if(ve.directories.length>0&&ve.files.size>0){const je=To(ve.files,i,ve.directories);return{handle:ms({filter:je,onChange:Tt,paths:ve.directories}),mode:"tracked"}}return{handle:ms({onChange:Tt,paths:U}),mode:"roots"}},"buildHandle");let Ce;const Tt=O(async ve=>{if(!Te){Te=!0;try{e.info(`Change detected in ${ve.length} file(s), rerunning…`),Oe=(await G()).results,Ce?.close(),Ce=We().handle}finally{Te=!1}}},"onChangeHandler"),ss=We();Ce=ss.handle;const oi=ss.mode==="tracked"?`Watching ${String(gs(Oe,i).files.size)} tracked file(s)`:`Watching ${String(U.length)} project root(s)`;e.info(`${oi} — edit a file to rerun, press h for keybinds, q to quit.`);const Kt=O(async()=>{if(!Te){Te=!0;try{if(Y.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Oe=(await G()).results,Ce?.close(),Ce=We().handle}finally{Te=!1}}},"triggerRerun");await new Promise(ve=>{let je=!1,ns;const is=O(()=>{os()},"onSigint"),os=O(()=>{je||(je=!0,ns?.close(),process.off("SIGINT",is),Ce?.close(),ve())},"exit");process.on("SIGINT",is),ns=Vl({handlers:{onClearFilter:O(async()=>{const ft=he(void 0);e.info(`Filter cleared — running ${String(ft)} task(s).`),await Kt()},"onClearFilter"),onFilter:O(async ft=>{const ai=ye,as=he(ft);if(as===0){e.info(`Filter "${ft}" matched no projects — keeping previous filter.`),he(ai);return}e.info(`Filter "${ft}" matched ${String(as)} task(s).`),await Kt()},"onFilter"),onHelp:O(()=>{Hl(process.stdout)},"onHelp"),onQuit:O(()=>{os()},"onQuit"),onRerun:Kt}})});return}if(r.flaky!==!1){const U=Fi(i,{minRuns:2},B.runHistory);if(U.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const se of Ai(U))e.info(` ${se}`);e.info("")}}const D=[];for(const[U,se]of B.results)se.retryAttempts&&se.retryAttempts>0&&D.push(U);const H=r.failOnRetry===!0&&D.length>0;if(H){const U=D.slice(0,5),se=D.length-U.length,ye=se>0?`${U.join(", ")}, and ${String(se)} more`:U.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(D.length)} task(s) succeeded only after retry: ${ye}`)}if(fe||H){const U=H&&!fe?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",se=2e3,ye=[];for(const[he,Te]of B.results){if(Te.status!=="failure")continue;const Oe=Te.terminalOutput??"",We=Oe.length>se?`…${Oe.slice(-se)}`:Oe,Ce=Te.code??"?";ye.push(` ${he} (exit ${String(Ce)}):
191
+ ${We.split(`
192
+ `).map(Tt=>` ${Tt}`).join(`
193
+ `)}`)}throw new Error(ye.length>0?`${U}
194
+ ${ye.join(`
195
+ `)}`:U)}re.length>0&&!r.failFast&&await _s(re,i,v,c,void 0,S),be>0&&(e.info(""),dt?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",St),process.off("SIGTERM",St)),dt&&ze.length>0&&await Promise.all(ze.map(async y=>{try{await uo(i,y)}catch{}}))}},"execute");export{Fu as createRetryBudget,sd as default};