@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,3 +1,3 @@
1
- var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{render as Ye}from"@visulima/tui";import{au as Ke,s as Qe}from"./bin.js";import Ze,{useMemo as q,useSyncExternalStore as er,useState as C,useRef as Z,useEffect as ae,useCallback as rr}from"react";import{A as tr}from"../packem_shared/pm-runner-BwX5AL3W.js";import{b as nr}from"./config.js";import{o as ir,M as de,i as cr,$ as sr,K as ar}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{Box as c}from"@visulima/tui/components/box";import{Dialog as lr}from"@visulima/tui/components/dialog";import{Tab as dr}from"@visulima/tui/components/tab";import{Tabs as ur}from"@visulima/tui/components/tabs";import{Text as t}from"@visulima/tui/components/text";import{useApp as hr}from"@visulima/tui/hooks/use-app";import{useInput as H}from"@visulima/tui/hooks/use-input";import{useWindowSize as mr}from"@visulima/tui/hooks/use-window-size";import{TextInput as he}from"@visulima/tui/components/text-input";import{ScrollBar as je}from"@visulima/tui/components/scroll-bar";import{ScrollView as gr}from"@visulima/tui/components/scroll-view";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:or}=qe("node:fs");var fr=Object.defineProperty,pr=y((n,e)=>fr(n,"name",{value:e,configurable:!0}),"a$1"),vr=Object.defineProperty,yr=pr((n,e)=>vr(n,"name",{value:e,configurable:!0}),"r"),br=Object.defineProperty,wr=yr((n,e)=>br(n,"name",{value:e,configurable:!0}),"n");const xr=wr((n,{whitespace:e=!0}={})=>n.replace(ir,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:e?s.replaceAll(/\S/g," "):""),"stripJsonComments"),$=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var Cr=Object.defineProperty,Oe=y((n,e)=>Cr(n,"name",{value:e,configurable:!0}),"s$6");const kr=Oe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!cr(e))return null;const s=sr(e),l=xr(s),a=l!==s;let o;try{o=JSON.parse(l)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:a}},"readDevcontainerJson"),Sr=Oe((n,e,s)=>{const l=s?ar(s):de(n,".devcontainer"),a=s??de(l,"devcontainer.json");nr(l),or(a,`${JSON.stringify(e,null,2)}
2
- `,"utf8")},"writeDevcontainerJson");var Er=Object.defineProperty,Ir=y((n,e)=>Er(n,"name",{value:e,configurable:!0}),"s$5");const Tr={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},Pr=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],xe=Ir((n,e,s)=>{const l=[],a=new Set(s.map(d=>typeof d=="string"?d:d.target));if(n)for(const d of Tr[n])a.has(d.target)||l.push(d);const o=Object.keys(e);for(const{featureMatch:d,mounts:g}of Pr)if(o.some(f=>f.includes(d)))for(const f of g)a.has(f.target)||l.push(f);return l},"getSuggestedMounts"),A=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Dr=Object.defineProperty,ee=y((n,e)=>Dr(n,"name",{value:e,configurable:!0}),"c$1");const J=ee(n=>structuredClone(n),"deepClone");class jr{static{y(this,"DevcontainerStore")}static{ee(this,"DevcontainerStore")}#o=new Set;#e;constructor(e,s,l=null){const a=e===null,o=e??{name:""},d=J(o);this.#e={config:d,detectedPm:l,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:s,isDirty:!1,mode:a?"create":"edit",originalConfig:a?null:J(o),section:"general",showTemplateSelector:a,suggestedMounts:xe(l,d.features??{},d.mounts??[]),templateIndex:0}}getSnapshot=ee(()=>this.#e,"getSnapshot");subscribe=ee(e=>(this.#o.add(e),()=>{this.#o.delete(e)}),"subscribe");setSection(e){e!==this.#e.section&&this.#r({...this.#e,fieldEditing:!1,fieldIndex:0,section:e})}nextSection(){const e=(A.indexOf(this.#e.section)+1)%A.length;this.setSection(A[e])}previousSection(){const e=(A.indexOf(this.#e.section)-1+A.length)%A.length;this.setSection(A[e])}setFieldIndex(e){e!==this.#e.fieldIndex&&this.#r({...this.#e,fieldIndex:Math.max(0,e)})}setFieldEditing(e){e!==this.#e.fieldEditing&&this.#r({...this.#e,fieldEditing:e})}setTemplateIndex(e){const s=Math.max(0,Math.min(e,$.length-1));s!==this.#e.templateIndex&&this.#r({...this.#e,templateIndex:s})}applyTemplate(e){const s=$.find(l=>l.id===e);s&&this.#r(this.#t({...this.#e,config:J(s.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#r({...this.#e,showTemplateSelector:!1})}updateConfig(e){this.#r({...this.#e,config:{...this.#e.config,...e},isDirty:!0})}toggleFeature(e){const s={...this.#e.config.features};s[e]===void 0?s[e]={}:delete s[e],this.#r(this.#t({...this.#e,config:{...this.#e.config,features:s},isDirty:!0}))}setFeatureSearch(e){this.#r({...this.#e,featureSearch:e,fieldIndex:0})}addPort(e){const s=this.#e.config.forwardPorts??[];if(s.includes(e))return;const l=[...s,e];this.#r({...this.#e,config:{...this.#e.config,forwardPorts:l},isDirty:!0})}removePort(e){const s=[...this.#e.config.forwardPorts??[]];s.splice(e,1),this.#r({...this.#e,config:{...this.#e.config,forwardPorts:s.length>0?s:void 0},isDirty:!0})}toggleExtension(e){const s={...this.#e.config.customizations},l={...s.vscode},a=[...l.extensions??[]],o=a.indexOf(e);o===-1?a.push(e):a.splice(o,1),l.extensions=a.length>0?a:void 0,s.vscode=l.extensions||l.settings?l:void 0,this.#r({...this.#e,config:{...this.#e.config,customizations:s.vscode||s.jetbrains?s:void 0},isDirty:!0})}setExtensionSearch(e){this.#r({...this.#e,extensionSearch:e,fieldIndex:0})}addEnvVar(e,s,l){const a=e==="container"?"containerEnv":"remoteEnv",o={...this.#e.config[a],[s]:l};this.#r({...this.#e,config:{...this.#e.config,[a]:o},isDirty:!0})}removeEnvVar(e,s){const l=e==="container"?"containerEnv":"remoteEnv",a={...this.#e.config[l]};delete a[s],this.#r({...this.#e,config:{...this.#e.config,[l]:Object.keys(a).length>0?a:void 0},isDirty:!0})}addMount(e){const s=[...this.#e.config.mounts??[],e];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s},isDirty:!0}))}removeMount(e){const s=[...this.#e.config.mounts??[]];s.splice(e,1),this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s.length>0?s:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const e=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:e},isDirty:!0}))}setLifecycleCommand(e,s){this.#r({...this.#e,config:{...this.#e.config,[e]:s||void 0},isDirty:!0})}markClean(){this.#r({...this.#e,isDirty:!1,originalConfig:J(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const e=J(this.#e.config);for(const[s,l]of Object.entries(e))(l===""||l===void 0)&&delete e[s];return e.build&&(e.build.dockerfile===""&&delete e.build.dockerfile,e.build.context===""&&delete e.build.context,e.build.args&&Object.keys(e.build.args).length===0&&delete e.build.args,Object.keys(e.build).length===0&&delete e.build),e.forwardPorts?.length===0&&delete e.forwardPorts,e.mounts?.length===0&&delete e.mounts,e.runServices?.length===0&&delete e.runServices,e.capAdd?.length===0&&delete e.capAdd,e.securityOpt?.length===0&&delete e.securityOpt,e.features&&Object.keys(e.features).length===0&&delete e.features,e.customizations?.vscode?.extensions?.length===0&&delete e.customizations.vscode.extensions,e.customizations?.vscode&&Object.keys(e.customizations.vscode).length===0&&delete e.customizations.vscode,e.customizations&&Object.keys(e.customizations).length===0&&delete e.customizations,e.containerEnv&&Object.keys(e.containerEnv).length===0&&delete e.containerEnv,e.remoteEnv&&Object.keys(e.remoteEnv).length===0&&delete e.remoteEnv,e}#t(e){return{...e,suggestedMounts:xe(e.detectedPm,e.config.features??{},e.config.mounts??[])}}#r(e){this.#e=e;for(const s of this.#o)try{s()}catch{}}}const Ce=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ke=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var Or=Object.defineProperty,Fe=y((n,e)=>Or(n,"name",{value:e,configurable:!0}),"r$1");const me=Fe(n=>{if(!n)return ke;const e=n.toLowerCase();return ke.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterFeatures"),ge=Fe(n=>{if(!n)return Ce;const e=n.toLowerCase();return Ce.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterExtensions");var Fr=Object.defineProperty,Ar=y((n,e)=>Fr(n,"name",{value:e,configurable:!0}),"l$1");const Ae=["dockerComposeFile","service"],Lr={dockerComposeFile:"Compose File",service:"Service"},Se={dockerComposeFile:"docker-compose.yml",service:"app"},Mr={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Br=Ar(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>{const a=!!n.dockerComposeFile,o=!!(n.image||n.build);return i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&a&&r(c,{marginBottom:1,children:r(t,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Ae.map((d,g)=>{const f=g===s,p=n[d]??"",x=Array.isArray(n[d])?n[d].join(", "):p;return i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{children:[r(c,{width:20,children:i(t,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",Lr[d],":"]})}),r(c,{flexGrow:1,children:f&&e?r(he,{defaultValue:x,onChange:y(v=>{l({[d]:v||void 0})},"onChange"),placeholder:Se[d]}):r(t,{color:x?"white":"gray",children:x||Se[d]})})]}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:Mr[d]})})]},d)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),Nr=Ae.length;var $r=Object.defineProperty,Le=y((n,e)=>$r(n,"name",{value:e,configurable:!0}),"h$2");const zr=Le(({config:n,fieldIndex:e})=>{const s=n.containerEnv??{},l=n.remoteEnv??{},a=Object.keys(s),o=Object.keys(l),d=a.length,g=a.length+1,f=g+o.length,p=e<=d,x=e>d;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{borderColor:p?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:a.length>0?1:0,children:[r(t,{bold:!0,color:p?"cyan":"white",children:"containerEnv"}),r(t,{dimColor:!0,children:" — baked into the container image"})]}),a.map((v,w)=>{const k=w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:s[v]})]})},v)}),r(c,{flexShrink:0,marginTop:a.length>0?1:0,children:i(t,{color:e===d?"cyan":"gray",inverse:e===d,children:[" ","+ Add variable..."]})})]}),i(c,{borderColor:x?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:o.length>0?1:0,children:[r(t,{bold:!0,color:x?"cyan":"white",children:"remoteEnv"}),r(t,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((v,w)=>{const k=g+w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:l[v]})]})},v)}),r(c,{flexShrink:0,marginTop:o.length>0?1:0,children:i(t,{color:e===f?"cyan":"gray",inverse:e===f,children:[" ","+ Add variable..."]})})]}),r(c,{flexShrink:0,marginTop:1,children:i(t,{dimColor:!0,wrap:"truncate",children:[r(t,{bold:!0,color:"white",children:"a"}),"/",r(t,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),Gr=Le(n=>{const e=Object.keys(n.containerEnv??{}).length,s=Object.keys(n.remoteEnv??{}).length;return e+1+s+1},"getEnvFieldCount");var Rr=Object.defineProperty,_r=y((n,e)=>Rr(n,"name",{value:e,configurable:!0}),"g$2");const Wr=_r(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(n.customizations?.vscode?.extensions),[n.customizations?.vscode?.extensions]),d=q(()=>ge(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.id]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var Ur=Object.defineProperty,Xr=y((n,e)=>Ur(n,"name",{value:e,configurable:!0}),"g$1");const Vr=Xr(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(Object.keys(n.features??{})),[n.features]),d=q(()=>me(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.description]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var Hr=Object.defineProperty,Jr=y((n,e)=>Hr(n,"name",{value:e,configurable:!0}),"u$1");const ue=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],qr={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ee={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},re=["privileged","overrideCommand"],Yr={overrideCommand:"Override Command",privileged:"Privileged"},Kr=ue.length+re.length,Qr=Jr(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"General Configuration"})}),ue.map((a,o)=>{const d=o===s,g=n[a]??"";return i(c,{marginBottom:1,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",qr[a],":"]})}),r(c,{flexGrow:1,children:d&&e?r(he,{defaultValue:g,onChange:y(f=>{l({[a]:f})},"onChange"),placeholder:Ee[a]}):r(t,{color:g?"white":"gray",children:g||Ee[a]})})]},a)}),re.map((a,o)=>{const d=ue.length+o===s,g=n[a]??!1;return i(c,{marginBottom:o<re.length-1?1:0,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Yr[a],":"]})}),r(c,{flexGrow:1,children:i(t,{color:g?"green":"gray",children:[g?"yes":"no",d&&r(t,{dimColor:!0,children:" (Space to toggle)"})]})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Me=Kr,le=re;var Zr=Object.defineProperty,et=y((n,e)=>Zr(n,"name",{value:e,configurable:!0}),"s$3");const Be=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],rt={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},tt={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},ot=et(({config:n,fieldEditing:e,fieldIndex:s,onSetCommand:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Be.map((a,o)=>{const d=o===s,g=n[a],f=Array.isArray(g)?g.join(" && "):g??"";return i(c,{flexDirection:"column",marginBottom:1,children:[r(c,{children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",rt[a]]})}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:tt[a]})}),r(c,{paddingLeft:4,children:d&&e?r(he,{defaultValue:f,onChange:y(p=>{l(a,p)},"onChange"),placeholder:"e.g. npm install"}):r(t,{color:f?"green":"gray",children:f||"(not set)"})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),nt=Be.length;var it=Object.defineProperty,Ne=y((n,e)=>it(n,"name",{value:e,configurable:!0}),"s$2");const Ie=Ne(n=>typeof n=="string"?n:`[${n.type}] ${n.source} → ${n.target}`,"formatMount"),ct=Ne(({addingMount:n,config:e,detectedPm:s,fieldIndex:l,mountPhase:a,mountSource:o,mountTarget:d,mountType:g,suggestedMounts:f})=>{const p=e.mounts??[];return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[p.length," ","mounts"]}),s&&i(t,{dimColor:!0,children:["— detected:"," ",r(t,{color:"white",children:s})]})]}),f.length>0&&!n&&i(c,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[i(c,{flexShrink:0,children:[r(t,{bold:!0,color:"yellow",children:"Suggested mounts"}),i(t,{dimColor:!0,children:[" ","— press"," ",r(t,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((x,v)=>r(c,{flexShrink:0,children:i(t,{dimColor:!0,wrap:"truncate",children:[" + ",Ie(x)]})},`suggestion-${String(v)}`))]}),p.length>0&&r(c,{flexDirection:"column",marginBottom:1,children:p.map((x,v)=>{const w=v===l;return i(c,{flexShrink:0,height:1,children:[r(t,{children:w?">":" "}),r(c,{flexGrow:1,children:i(t,{bold:w,inverse:w,wrap:"truncate",children:[" ",Ie(x)]})})]},`mount-${String(v)}`)})}),!n&&r(c,{flexShrink:0,children:i(t,{color:l===p.length?"cyan":"gray",inverse:l===p.length,children:[" ","+ Add mount..."]})}),n&&i(c,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[r(c,{flexShrink:0,marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"New Mount"})}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="source",color:a==="source"?"cyan":"white",children:[a==="source"?"❯ ":" ","Source:"]})}),r(t,{color:o?"yellow":"gray",children:o||(a==="source"?"_":"(type source, Enter to continue)")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="target",color:a==="target"?"cyan":"white",children:[a==="target"?"❯ ":" ","Target:"]})}),r(t,{color:d?"yellow":"gray",children:d||(a==="target"?"_":"/container/path")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="type",color:a==="type"?"cyan":"white",children:[a==="type"?"❯ ":" ","Type:"]})}),a==="type"?i(t,{children:[r(t,{bold:g==="volume",color:g==="volume"?"cyan":"gray",children:"[1] volume"})," ",r(t,{bold:g==="bind",color:g==="bind"?"cyan":"gray",children:"[2] bind"})," ",r(t,{bold:g==="tmpfs",color:g==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):r(t,{color:"gray",children:g})]}),r(c,{flexShrink:0,marginTop:1,children:r(t,{dimColor:!0,wrap:"truncate",children:a==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),p.length===0&&!n&&f.length===0&&r(c,{marginTop:1,children:r(t,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var st=Object.defineProperty,at=y((n,e)=>st(n,"name",{value:e,configurable:!0}),"s$1");const lt=at(({addingPort:n,addPortValue:e,config:s,fieldIndex:l})=>{const a=s.forwardPorts??[],o=l===a.length;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{marginBottom:1,children:[r(t,{bold:!0,color:"cyan",children:"Forwarded Ports"}),i(t,{dimColor:!0,children:[" ","(",a.length," ","ports)"]})]}),a.map((d,g)=>{const f=g===l;return r(c,{children:i(t,{color:f?"cyan":void 0,inverse:f,children:[" ",String(d)]})},`port-${String(d)}`)}),r(c,{marginTop:a.length>0?1:0,children:i(t,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&n?i(t,{children:["Enter port:"," ",r(t,{color:"yellow",children:e||"_"})]}):"+ Add port..."]})}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var dt=Object.defineProperty,ut=y((n,e)=>dt(n,"name",{value:e,configurable:!0}),"a");const ht=ut(({focused:n,hadComments:e,jsonPreview:s,mode:l,scrollRef:a})=>i(c,{borderColor:n?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,paddingX:1,children:[r(t,{bold:!0,color:n?"cyan":"white",children:"Preview"}),i(t,{dimColor:!0,children:[" ","(",l==="create"?"new":"edit",")"]})]}),e&&l==="edit"&&r(c,{flexShrink:0,paddingX:1,children:r(t,{color:"yellow",children:"Comments will not be preserved."})}),r(gr,{flexGrow:1,ref:a,scrollbar:!0,scrollbarColor:"gray",children:s.split(`
3
- `).map((o,d)=>r(t,{color:"green",children:o},`line-${String(d)}`))})]}),"PreviewPanel");var mt=Object.defineProperty,gt=y((n,e)=>mt(n,"name",{value:e,configurable:!0}),"r");const ft=gt(n=>{const e=[],s=[],l=[];if(!n.image&&!n.build&&!n.dockerComposeFile&&e.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),n.build&&(n.image&&s.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),n.build.dockerfile||e.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),n.dockerComposeFile&&!n.service&&e.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),n.features!==void 0&&(typeof n.features!="object"||Array.isArray(n.features))&&e.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),n.forwardPorts)if(Array.isArray(n.forwardPorts))for(const[a,o]of n.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&e.push({field:"forwardPorts",message:`Invalid port ${String(o)} at index ${String(a)}`});else e.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return n.customizations?.vscode?.extensions&&!Array.isArray(n.customizations.vscode.extensions)&&e.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),n.customizations?.vscode?.settings&&typeof n.customizations.vscode.settings!="object"&&e.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),n.name||l.push({field:"name",message:"Consider adding a name for better identification"}),(!n.features||Object.keys(n.features).length===0)&&l.push({field:"features",message:"Consider adding features for common tools"}),(!n.customizations?.vscode?.extensions||n.customizations.vscode.extensions.length===0)&&l.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),n.privileged&&s.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:e,suggestions:l,valid:e.length===0,warnings:s}},"validateConfig");var pt=Object.defineProperty,$e=y((n,e)=>pt(n,"name",{value:e,configurable:!0}),"$");const Te=80,Pe=15,vt=120,ze=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],yt=new Map(ze.map(n=>[n.id,n.description])),bt=$e((n,e,s,l)=>{switch(n){case"compose":return Nr;case"environment":return Gr(e);case"extensions":return ge(l).length;case"features":return me(s).length;case"general":return Me;case"lifecycle":return nt;case"mounts":return(e.mounts?.length??0)+1;case"ports":return(e.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),wt=$e(({onSave:n,store:e})=>{const{exit:s}=hr(),{columns:l,rows:a}=mr(),o=er(e.subscribe,e.getSnapshot),[d,g]=C(!1),[f,p]=C(!1),[x,v]=C(!1),[w,k]=C(null),[S,D]=C("editor"),[Y,fe]=C(0),[te,oe]=C(!1),[pe,z]=C(""),[G,R]=C(null),[_,j]=C(""),[ve,O]=C(""),[W,L]=C("key"),[ne,K]=C(!1),[ie,M]=C(""),[ce,B]=C(""),[ye,U]=C("volume"),[I,N]=C("source"),se=Z(null),F=Z(null),P=Z(null),Q=Z(!0);ae(()=>(Q.current=!0,()=>{Q.current=!1,P.current&&clearTimeout(P.current)}),[]);const be=bt(o.section,o.config,o.featureSearch,o.extensionSearch),X=Math.max(1,a-9);ae(()=>{o.section!=="features"&&o.section!=="extensions"||fe(h=>o.fieldIndex>=h+X?o.fieldIndex-X+1:o.fieldIndex<h?o.fieldIndex:h)},[o.fieldIndex,o.section,X]),ae(()=>{fe(0)},[o.section,o.featureSearch,o.extensionSearch]);const Ge=rr(()=>{const h=e.cleanConfig(),m=ft(h);if(!m.valid){const b=m.errors[0];k(b?`Error: ${b.message}`:"Validation failed"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},3e3);return}n(h),e.markClean();const u=m.warnings.length;k(u>0?`Saved! (${String(u)} warning${u>1?"s":""})`:"Saved!"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},2e3)},[n,e]);H((h,m)=>{if(m.downArrow||h==="j")e.setTemplateIndex(o.templateIndex+1);else if(m.upArrow||h==="k")e.setTemplateIndex(o.templateIndex-1);else if(m.return){const u=$[o.templateIndex];u&&e.applyTemplate(u.id)}else m.escape&&e.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),H((h,m)=>{if(m.escape){oe(!1),z("");return}if(m.return){const u=Number.parseInt(pe,10);!Number.isNaN(u)&&u>0&&u<=65535&&e.addPort(u),oe(!1),z("");return}if(m.backspace){z(u=>u.slice(0,-1));return}h&&/^\d$/u.test(h)&&z(u=>u+h)},{isActive:te}),H((h,m)=>{if(m.escape){R(null),j(""),O(""),L("key");return}if(m.return){if(W==="key"&&_){L("value");return}if(W==="value"&&_){e.addEnvVar(G,_,ve),R(null),j(""),O(""),L("key");return}}if(m.backspace){W==="key"?j(u=>u.slice(0,-1)):O(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(W==="key"?j(u=>u+h):O(u=>u+h))},{isActive:G!==null}),H((h,m)=>{if(m.escape){K(!1),M(""),B(""),N("source");return}if(m.return){if(I==="source"&&ie){N("target");return}if(I==="target"&&ce){N("type");return}if(I==="type"){e.addMount({source:ie,target:ce,type:ye}),K(!1),M(""),B(""),N("source");return}}if(I==="type"){switch(h){case"1":{U("volume");break}case"2":{U("bind");break}case"3":{U("tmpfs");break}}return}if(m.backspace){I==="source"?M(u=>u.slice(0,-1)):I==="target"&&B(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(I==="source"?M(u=>u+h):I==="target"&&B(u=>u+h))},{isActive:ne}),H((h,m)=>{if(h==="c"&&m.ctrl){s();return}if(!f){if(d){m.escape||h==="?"?g(!1):m.downArrow||h==="j"?se.current?.scrollBy(1):m.upArrow||h==="k"?se.current?.scrollBy(-1):h==="q"&&(g(!1),p(!0));return}if(x){if(m.escape){v(!1),o.section==="features"?e.setFeatureSearch(""):e.setExtensionSearch("");return}if(m.return){v(!1);return}if(m.backspace){o.section==="features"?e.setFeatureSearch(o.featureSearch.slice(0,-1)):e.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(h&&!m.ctrl&&!m.meta){o.section==="features"?e.setFeatureSearch(o.featureSearch+h):e.setExtensionSearch(o.extensionSearch+h);return}return}if(o.fieldEditing){if(m.escape){e.setFieldEditing(!1);return}if(m.return){e.setFieldEditing(!1);return}return}if(h==="?"){g(!0);return}if(h==="q"){o.isDirty?p(!0):s();return}if(h==="s"){Ge();return}if(m.tab){D(u=>u==="editor"?"preview":"editor");return}if(S==="preview"){if(m.downArrow||h==="j"){F.current?.scrollBy(1);return}if(m.upArrow||h==="k"){F.current?.scrollBy(-1);return}if(m.pageDown){F.current?.scrollBy(10);return}if(m.pageUp){F.current?.scrollBy(-10);return}if(m.home){F.current?.scrollToTop();return}if(m.end){F.current?.scrollToBottom();return}m.escape&&D("editor");return}if(m.downArrow||h==="j"){be>0&&e.setFieldIndex(Math.min(o.fieldIndex+1,be-1));return}if(m.upArrow||h==="k"){e.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(m.return){switch(o.section){case"compose":case"general":case"lifecycle":{e.setFieldEditing(!0);break}case"environment":{const u=Object.keys(o.config.containerEnv??{}).length,b=u,T=u+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===b?(R("container"),j(""),O(""),L("key")):o.fieldIndex===T&&(R("remote"),j(""),O(""),L("key"));break}case"mounts":{const u=o.config.mounts??[];o.fieldIndex===u.length&&(K(!0),M(""),B(""),U("volume"),N("source"));break}case"ports":{const u=o.config.forwardPorts??[];o.fieldIndex===u.length&&(oe(!0),z(""));break}}return}if(h===" "){switch(o.section){case"extensions":{const u=ge(o.extensionSearch)[o.fieldIndex];u&&e.toggleExtension(u.id);break}case"features":{const u=me(o.featureSearch)[o.fieldIndex];u&&e.toggleFeature(u.id);break}case"general":{const u=Me-le.length,b=o.fieldIndex-u;if(b>=0&&b<le.length){const T=le[b];e.updateConfig({[T]:!o.config[T]})}break}}return}if(h==="/"){(o.section==="features"||o.section==="extensions")&&v(!0);return}if(h==="A"&&o.section==="mounts"){e.applySuggestedMounts();return}if(h==="a"){if(o.section==="environment"){const u=Object.keys(o.config.containerEnv??{}).length,b=o.fieldIndex<=u?"container":"remote";R(b),j(""),O(""),L("key")}else o.section==="mounts"&&(K(!0),M(""),B(""),U("volume"),N("source"));return}if(h==="d")switch(o.section){case"environment":{const u=Object.keys(o.config.containerEnv??{}),b=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<u.length)e.removeEnvVar("container",u[o.fieldIndex]),u.length===1||o.fieldIndex>=u.length-1&&e.setFieldIndex(u.length-2);else{const T=o.fieldIndex-u.length-1;T>=0&&T<b.length&&(e.removeEnvVar("remote",b[T]),b.length===1||T>=b.length-1&&e.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const u=o.config.mounts??[];if(o.fieldIndex<u.length){e.removeMount(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}case"ports":{const u=o.config.forwardPorts??[];if(o.fieldIndex<u.length){e.removePort(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}}}},{isActive:!o.showTemplateSelector&&!te&&G===null&&!ne});const Re=q(()=>e.getJsonPreview(),[o.config]);if(l<Te||a<Pe)return r(c,{alignItems:"center",height:a,justifyContent:"center",width:l,children:i(t,{color:"yellow",children:["Terminal too small (",l,"x",a,"), need"," ",Te,"x",Pe]})});if(o.showTemplateSelector)return r(c,{alignItems:"center",flexDirection:"column",height:a,justifyContent:"center",width:l,children:i(c,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[r(c,{justifyContent:"center",marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Select a Template"})}),$.map((h,m)=>{const u=m===o.templateIndex;return r(c,{children:i(t,{color:u?"cyan":void 0,inverse:u,children:[u?" ❯ ":" ",r(t,{bold:u,children:h.name}),i(t,{dimColor:!0,children:[" ","-",h.description]})]})},h.id)}),r(c,{justifyContent:"center",marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Enter"})," ","select"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let E;switch(o.section){case"compose":{E=r(Br,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"environment":{E=i(c,{flexDirection:"column",children:[r(zr,{config:o.config,fieldIndex:o.fieldIndex}),G!==null&&r(c,{marginTop:1,paddingX:1,children:i(t,{color:"cyan",children:["Add"," ",G," ","env:"," ",W==="key"?i(t,{children:["key=",r(t,{color:"yellow",children:_||"_"})," ","(Enter to set value)"]}):i(t,{children:[_,"=",r(t,{color:"yellow",children:ve||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{E=r(Wr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.extensionSearch,viewportHeight:X});break}case"features":{E=r(Vr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.featureSearch,viewportHeight:X});break}case"general":{E=r(Qr,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"lifecycle":{E=r(ot,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:y((h,m)=>{e.setLifecycleCommand(h,m)},"onSetCommand")});break}case"mounts":{E=r(ct,{addingMount:ne,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:I,mountSource:ie,mountTarget:ce,mountType:ye,suggestedMounts:o.suggestedMounts});break}case"ports":{E=r(lt,{addingPort:te,addPortValue:pe,config:o.config,fieldIndex:o.fieldIndex});break}default:E=r(t,{children:"Unknown section"})}const _e=i(c,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[i(c,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:"QUIT"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:"HELP"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"↑↓"}),r(t,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:"CHECK"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:"TABS"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:"FILTER"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:"SAVE"})]})]}),i(c,{paddingX:1,children:[w&&i(t,{color:w.startsWith("Error")?"red":"green",children:[w," "]}),o.isDirty&&r(t,{color:"yellow",children:"[modified]"}),!o.isDirty&&!w&&r(t,{dimColor:!0,children:"[saved]"})]})]}),We=i(lr,{footer:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(t,{bold:!0,color:"white",children:"?"}),"/",r(t,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:se,title:"KEYBOARD SHORTCUTS",visible:d,width:56,children:[i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"NAVIGATION"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:" Switch tabs"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"↑↓"}),"/",r(t,{bold:!0,color:"white",children:"j/k"}),r(t,{dimColor:!0,children:" Navigate within section"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:" Switch editor/preview panel"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Enter"}),r(t,{dimColor:!0,children:" Edit selected field"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Esc"}),r(t,{dimColor:!0,children:" Stop editing / cancel"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:" Toggle selection"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:" Search / filter"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"a"}),r(t,{dimColor:!0,children:" Add new entry"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"d"}),r(t,{dimColor:!0,children:" Delete selected entry"})]})]}),i(c,{flexDirection:"column",children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"ACTIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:" Save configuration"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:" Quit"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:" Toggle help"})]})]})]}),Ue=r(ht,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:Re,mode:o.mode,scrollRef:F}),we=l>=vt,Xe=we?Math.floor(l*.38):0;return i(c,{flexDirection:"column",height:a,width:l,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[r(t,{bold:!0,inverse:!0,children:" VIS "}),i(t,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),r(c,{flexShrink:0,paddingX:1,paddingY:1,children:r(ur,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:y(h=>{e.setSection(h),D("editor")},"onChange"),showIndex:!1,children:ze.map(({id:h,label:m})=>r(dr,{name:h,children:m},h))})}),r(c,{flexShrink:0,paddingRight:2,children:r(t,{dimColor:!0,wrap:"truncate",children:yt.get(o.section)??""})}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:E}),we&&r(c,{flexShrink:0,width:Xe,children:Ue})]}),_e,r(Ke,{autoExitSeconds:3,onCancel:y(()=>{p(!1)},"onCancel"),visible:f}),We]})},"VisDevcontainerApp");var xt=Object.defineProperty,De=y((n,e)=>xt(n,"name",{value:e,configurable:!0}),"c");const _t=De(async({logger:n,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const l=s,a=e.template,o=e.output,d=!!process.stdout.isTTY&&!Qe;let g=null;try{g=tr(l).name}catch{}const f=kr(l);let p=f?.config??null;const x=f?.hadComments??!1;if(a&&!f){const S=$.find(D=>D.id===a);if(!S){const D=$.map(Y=>Y.id).join(", ");throw new Error(`Unknown template "${a}". Valid templates: ${D}`)}p=S.config}if(!d){p?n.info(JSON.stringify(p,null,2)):(n.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const v=setInterval(()=>{},1e3),w=new jr(p,x,g);a&&!f&&w.dismissTemplateSelector();let k=null;if(await Ye(Ze.createElement(wt,{onSave:De(S=>{Sr(l,S,o),k=S},"onSave"),store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(v),k){const S=o??".devcontainer/devcontainer.json";n.info(`DevContainer config saved to ${S}`)}},"execute");export{_t as default};
1
+ var Je=Object.defineProperty;var v=(o,t)=>Je(o,"name",{value:t,configurable:!0});import{createRequire as qe}from"node:module";import{r as p,af as U,a5 as e,a6 as s,n as r,aH as Te,aG as Qe,aI as Ze,aF as et,aJ as tt,aK as rt,v as ot,d as nt,s as it}from"./bin.js";import{A as st}from"../packem_shared/pm-runner-COoPLGKi.js";import{d as at}from"./config.js";import{o as lt,M as he,i as dt,$ as ut,K as ht}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{g as mt,r as gt}from"../packem_shared/tabs-C-qFIoUv.js";const Ke=qe(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ye=v(o=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,i]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Q.getBuiltinModule(o)}return Ke(o)},"__cjs_getBuiltinModule"),{writeFileSync:ct}=Ye("node:fs");var ft=Object.defineProperty,pt=v((o,t)=>ft(o,"name",{value:t,configurable:!0}),"a$2"),xt=Object.defineProperty,vt=pt((o,t)=>xt(o,"name",{value:t,configurable:!0}),"r"),jt=Object.defineProperty,bt=vt((o,t)=>jt(o,"name",{value:t,configurable:!0}),"n");const yt=bt((o,{whitespace:t=!0}={})=>o.replace(lt,i=>i.startsWith('"')||i[1]==="*"&&!i.endsWith("*/")?i:t?i.replaceAll(/\S/g," "):""),"stripJsonComments"),V=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var wt=Object.defineProperty,Pe=v((o,t)=>wt(o,"name",{value:t,configurable:!0}),"s$7");const Ct=Pe(o=>{const t=he(o,".devcontainer","devcontainer.json");if(!dt(t))return null;const i=ut(t),c=yt(i),a=c!==i;let n;try{n=JSON.parse(c)}catch(l){const m=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse ${t}: ${m}`,{cause:l})}return{config:n,hadComments:a}},"readDevcontainerJson"),St=Pe((o,t,i)=>{const c=i?ht(i):he(o,".devcontainer"),a=i??he(c,"devcontainer.json");at(c),ct(a,`${JSON.stringify(t,null,2)}
2
+ `,"utf8")},"writeDevcontainerJson");var kt=Object.defineProperty,Et=v((o,t)=>kt(o,"name",{value:t,configurable:!0}),"s$6");const It={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},Tt=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],je=Et((o,t,i)=>{const c=[],a=new Set(i.map(l=>typeof l=="string"?l:l.target));if(o)for(const l of It[o])a.has(l.target)||c.push(l);const n=Object.keys(t);for(const{featureMatch:l,mounts:m}of Tt)if(n.some(g=>g.includes(l)))for(const g of m)a.has(g.target)||c.push(g);return c},"getSuggestedMounts"),N=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Pt=Object.defineProperty,oe=v((o,t)=>Pt(o,"name",{value:t,configurable:!0}),"c$2");const Z=oe(o=>structuredClone(o),"deepClone");class Dt{static{v(this,"DevcontainerStore")}static{oe(this,"DevcontainerStore")}#o=new Set;#e;constructor(t,i,c=null){const a=t===null,n=t??{name:""},l=Z(n);this.#e={config:l,detectedPm:c,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:i,isDirty:!1,mode:a?"create":"edit",originalConfig:a?null:Z(n),section:"general",showTemplateSelector:a,suggestedMounts:je(c,l.features??{},l.mounts??[]),templateIndex:0}}getSnapshot=oe(()=>this.#e,"getSnapshot");subscribe=oe(t=>(this.#o.add(t),()=>{this.#o.delete(t)}),"subscribe");setSection(t){t!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:t})}nextSection(){const t=(N.indexOf(this.#e.section)+1)%N.length;this.setSection(N[t])}previousSection(){const t=(N.indexOf(this.#e.section)-1+N.length)%N.length;this.setSection(N[t])}setFieldIndex(t){t!==this.#e.fieldIndex&&this.#t({...this.#e,fieldIndex:Math.max(0,t)})}setFieldEditing(t){t!==this.#e.fieldEditing&&this.#t({...this.#e,fieldEditing:t})}setTemplateIndex(t){const i=Math.max(0,Math.min(t,V.length-1));i!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:i})}applyTemplate(t){const i=V.find(c=>c.id===t);i&&this.#t(this.#r({...this.#e,config:Z(i.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#t({...this.#e,showTemplateSelector:!1})}updateConfig(t){this.#t({...this.#e,config:{...this.#e.config,...t},isDirty:!0})}toggleFeature(t){const i={...this.#e.config.features};i[t]===void 0?i[t]={}:delete i[t],this.#t(this.#r({...this.#e,config:{...this.#e.config,features:i},isDirty:!0}))}setFeatureSearch(t){this.#t({...this.#e,featureSearch:t,fieldIndex:0})}addPort(t){const i=this.#e.config.forwardPorts??[];if(i.includes(t))return;const c=[...i,t];this.#t({...this.#e,config:{...this.#e.config,forwardPorts:c},isDirty:!0})}removePort(t){const i=[...this.#e.config.forwardPorts??[]];i.splice(t,1),this.#t({...this.#e,config:{...this.#e.config,forwardPorts:i.length>0?i:void 0},isDirty:!0})}toggleExtension(t){const i={...this.#e.config.customizations},c={...i.vscode},a=[...c.extensions??[]],n=a.indexOf(t);n===-1?a.push(t):a.splice(n,1),c.extensions=a.length>0?a:void 0,i.vscode=c.extensions||c.settings?c:void 0,this.#t({...this.#e,config:{...this.#e.config,customizations:i.vscode||i.jetbrains?i:void 0},isDirty:!0})}setExtensionSearch(t){this.#t({...this.#e,extensionSearch:t,fieldIndex:0})}addEnvVar(t,i,c){const a=t==="container"?"containerEnv":"remoteEnv",n={...this.#e.config[a],[i]:c};this.#t({...this.#e,config:{...this.#e.config,[a]:n},isDirty:!0})}removeEnvVar(t,i){const c=t==="container"?"containerEnv":"remoteEnv",a={...this.#e.config[c]};delete a[i],this.#t({...this.#e,config:{...this.#e.config,[c]:Object.keys(a).length>0?a:void 0},isDirty:!0})}addMount(t){const i=[...this.#e.config.mounts??[],t];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:i},isDirty:!0}))}removeMount(t){const i=[...this.#e.config.mounts??[]];i.splice(t,1),this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:i.length>0?i:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const t=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:t},isDirty:!0}))}setLifecycleCommand(t,i){this.#t({...this.#e,config:{...this.#e.config,[t]:i||void 0},isDirty:!0})}markClean(){this.#t({...this.#e,isDirty:!1,originalConfig:Z(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const t=Z(this.#e.config);for(const[i,c]of Object.entries(t))(c===""||c===void 0)&&delete t[i];return t.build&&(t.build.dockerfile===""&&delete t.build.dockerfile,t.build.context===""&&delete t.build.context,t.build.args&&Object.keys(t.build.args).length===0&&delete t.build.args,Object.keys(t.build).length===0&&delete t.build),t.forwardPorts?.length===0&&delete t.forwardPorts,t.mounts?.length===0&&delete t.mounts,t.runServices?.length===0&&delete t.runServices,t.capAdd?.length===0&&delete t.capAdd,t.securityOpt?.length===0&&delete t.securityOpt,t.features&&Object.keys(t.features).length===0&&delete t.features,t.customizations?.vscode?.extensions?.length===0&&delete t.customizations.vscode.extensions,t.customizations?.vscode&&Object.keys(t.customizations.vscode).length===0&&delete t.customizations.vscode,t.customizations&&Object.keys(t.customizations).length===0&&delete t.customizations,t.containerEnv&&Object.keys(t.containerEnv).length===0&&delete t.containerEnv,t.remoteEnv&&Object.keys(t.remoteEnv).length===0&&delete t.remoteEnv,t}#r(t){return{...t,suggestedMounts:je(t.detectedPm,t.config.features??{},t.config.mounts??[])}}#t(t){this.#e=t;for(const i of this.#o)try{i()}catch{}}}const be=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ye=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var Ot=Object.defineProperty,De=v((o,t)=>Ot(o,"name",{value:t,configurable:!0}),"r$1");const ge=De(o=>{if(!o)return ye;const t=o.toLowerCase();return ye.filter(i=>i.name.toLowerCase().includes(t)||i.id.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))},"filterFeatures"),fe=De(o=>{if(!o)return be;const t=o.toLowerCase();return be.filter(i=>i.name.toLowerCase().includes(t)||i.id.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))},"filterExtensions");var Ft=Object.defineProperty,At=v((o,t)=>Ft(o,"name",{value:t,configurable:!0}),"t"),$t=Object.defineProperty,Mt=At((o,t)=>$t(o,"name",{value:t,configurable:!0}),"r"),Lt=Object.defineProperty,Oe=Mt((o,t)=>Lt(o,"name",{value:t,configurable:!0}),"r");const Bt=/^[a-z]$/i,Nt=Oe(o=>{const t=o.codePointAt(0);return t!==void 0&&(t<32||t===127)},"isControlCharacter"),Rt=Oe((o,t)=>o.length===0||Nt(o)?!1:t.ctrl&&t.meta?!Bt.test(o):!(t.ctrl||t.meta),"isInsertableInput");var zt=Object.defineProperty,Fe=v((o,t)=>zt(o,"name",{value:t,configurable:!0}),"w$3"),Gt=Object.defineProperty,Ae=Fe((o,t)=>Gt(o,"name",{value:t,configurable:!0}),"A"),_t=Object.defineProperty,ie=Ae((o,t)=>_t(o,"name",{value:t,configurable:!0}),"p");const Wt=/\S+\s*$/,de=ie((o,t)=>o.length===0||!t?void 0:t.find(i=>i.startsWith(o))?.slice(o.length)??void 0,"findSuggestion"),$e=-1,Ut=ie((o,t,i,c)=>t.leftArrow?Math.max(0,i-1):t.home||t.ctrl&&o==="a"?0:t.end||t.ctrl&&o==="e"?c:$e,"handleNavigation"),Vt=ie((o,t,i,c)=>{if(t.backspace&&c>0)return[i.slice(0,c-1)+i.slice(c),c-1];if(t.delete&&c<i.length)return[i.slice(0,c)+i.slice(c+1),c];if(t.ctrl&&o==="u")return[i.slice(c),0];if(t.ctrl&&o==="k")return[i.slice(0,c),c];if(t.ctrl&&o==="w"){const a=i.slice(0,c).replace(Wt,"");return[a+i.slice(c),a.length]}},"handleEditing");function X({defaultValue:o="",isDisabled:t=!1,mask:i=!1,onChange:c,onSubmit:a,placeholder:n,suggestions:l}){const[m,g]=p.useState(o),[f,j]=p.useState(o.length),x=p.useRef(m);x.current=m;const b=p.useRef(f);b.current=f;const w=p.useRef(c);w.current=c;const E=p.useRef(a);E.current=a;const D=de(m,l),R=p.useCallback((P,T)=>{const{current:I}=b,S=x.current;if(T.return){const C=de(S,l),k=C?S+C:S;C&&(g(k),j(k.length),w.current?.(k)),E.current?.(k);return}if(T.escape)return;if(T.rightArrow){const C=de(S,l);if(I===S.length&&C){const k=S+C;g(k),j(k.length),w.current?.(k);return}j(Math.min(S.length,I+1));return}const O=Ut(P,T,I,S.length);if(O!==$e){j(O);return}const q=Vt(P,T,S,I);if(q){const[C,k]=q;g(C),j(k),w.current?.(C);return}if(Rt(P,T)){const C=S.slice(0,I)+P+S.slice(I);g(C),j(I+P.length),w.current?.(C)}},[l]);U(R,{isActive:!t});const L=i?"*".repeat(m.length):m,H=L.slice(0,f),J=L[f],ee=L.slice(f+1);return t?e.jsx(s,{children:e.jsx(r,{dimColor:!0,children:L||n||""})}):m.length===0&&n?e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,inverse:!0,children:n[0]}),e.jsx(r,{dimColor:!0,children:n.slice(1)})]}):e.jsxs(s,{children:[e.jsxs(r,{children:[H,e.jsx(r,{inverse:!0,children:J??" "}),ee]}),D?e.jsx(r,{dimColor:!0,children:D}):void 0]})}v(X,"k");Fe(X,"q");Ae(X,"y");ie(X,"TextInput");var Xt=Object.defineProperty,Ht=v((o,t)=>Xt(o,"name",{value:t,configurable:!0}),"l$1");const Me=["dockerComposeFile","service"],Jt={dockerComposeFile:"Compose File",service:"Service"},we={dockerComposeFile:"docker-compose.yml",service:"app"},qt={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Kt=Ht(({config:o,fieldEditing:t,fieldIndex:i,onUpdate:c})=>{const a=!!o.dockerComposeFile,n=!!(o.image||o.build);return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),n&&a&&e.jsx(s,{marginBottom:1,children:e.jsx(r,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Me.map((l,m)=>{const g=m===i,f=o[l]??"",j=Array.isArray(o[l])?o[l].join(", "):f;return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:g,color:g?"cyan":"white",children:[g?"❯ ":" ",Jt[l],":"]})}),e.jsx(s,{flexGrow:1,children:g&&t?e.jsx(X,{defaultValue:j,onChange:v(x=>{c({[l]:x||void 0})},"onChange"),placeholder:we[l]}):e.jsx(r,{color:j?"white":"gray",children:j||we[l]})})]}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:qt[l]})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),Yt=Me.length;var Qt=Object.defineProperty,Le=v((o,t)=>Qt(o,"name",{value:t,configurable:!0}),"h$2");const Zt=Le(({config:o,fieldIndex:t})=>{const i=o.containerEnv??{},c=o.remoteEnv??{},a=Object.keys(i),n=Object.keys(c),l=a.length,m=a.length+1,g=m+n.length,f=t<=l,j=t>l;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{borderColor:f?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:a.length>0?1:0,children:[e.jsx(r,{bold:!0,color:f?"cyan":"white",children:"containerEnv"}),e.jsx(r,{dimColor:!0,children:" — baked into the container image"})]}),a.map((x,b)=>{const w=b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:w?"cyan":void 0,inverse:w,wrap:"truncate",children:[w?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:i[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:a.length>0?1:0,children:e.jsxs(r,{color:t===l?"cyan":"gray",inverse:t===l,children:[" ","+ Add variable..."]})})]}),e.jsxs(s,{borderColor:j?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:n.length>0?1:0,children:[e.jsx(r,{bold:!0,color:j?"cyan":"white",children:"remoteEnv"}),e.jsx(r,{dimColor:!0,children:" — set at runtime by the IDE"})]}),n.map((x,b)=>{const w=m+b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:w?"cyan":void 0,inverse:w,wrap:"truncate",children:[w?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:c[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:n.length>0?1:0,children:e.jsxs(r,{color:t===g?"cyan":"gray",inverse:t===g,children:[" ","+ Add variable..."]})})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),er=Le(o=>{const t=Object.keys(o.containerEnv??{}).length,i=Object.keys(o.remoteEnv??{}).length;return t+1+i+1},"getEnvFieldCount");var tr=Object.defineProperty,rr=v((o,t)=>tr(o,"name",{value:t,configurable:!0}),"g$2");const or=rr(({config:o,fieldIndex:t,scrollOffset:i,searchText:c,viewportHeight:a})=>{const n=p.useMemo(()=>new Set(o.customizations?.vscode?.extensions),[o.customizations?.vscode?.extensions]),l=p.useMemo(()=>fe(c),[c]),m=l.length,g=m>a&&a>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[n.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{color:"yellow",children:c})," ","(",l.length," ","results)"]})]}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(s,{flexDirection:"column",marginTop:-i,children:l.map((f,j)=>{const x=j===t,b=n.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.id]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Te,{contentHeight:m,placement:"inset",scrollOffset:i,style:"block",viewportHeight:a})})]}),l.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var nr=Object.defineProperty,ir=v((o,t)=>nr(o,"name",{value:t,configurable:!0}),"g$1");const sr=ir(({config:o,fieldIndex:t,scrollOffset:i,searchText:c,viewportHeight:a})=>{const n=p.useMemo(()=>new Set(Object.keys(o.features??{})),[o.features]),l=p.useMemo(()=>ge(c),[c]),m=l.length,g=m>a&&a>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[n.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{color:"yellow",children:c})," ","(",l.length," ","results)"]})]}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(s,{flexDirection:"column",marginTop:-i,children:l.map((f,j)=>{const x=j===t,b=n.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.description]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Te,{contentHeight:m,placement:"inset",scrollOffset:i,style:"block",viewportHeight:a})})]}),l.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var cr=Object.defineProperty,ar=v((o,t)=>cr(o,"name",{value:t,configurable:!0}),"u$1");const me=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],lr={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ce={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},ne=["privileged","overrideCommand"],dr={overrideCommand:"Override Command",privileged:"Privileged"},ur=me.length+ne.length,hr=ar(({config:o,fieldEditing:t,fieldIndex:i,onUpdate:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"General Configuration"})}),me.map((a,n)=>{const l=n===i,m=o[a]??"";return e.jsxs(s,{marginBottom:1,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",lr[a],":"]})}),e.jsx(s,{flexGrow:1,children:l&&t?e.jsx(X,{defaultValue:m,onChange:v(g=>{c({[a]:g})},"onChange"),placeholder:Ce[a]}):e.jsx(r,{color:m?"white":"gray",children:m||Ce[a]})})]},a)}),ne.map((a,n)=>{const l=me.length+n===i,m=o[a]??!1;return e.jsxs(s,{marginBottom:n<ne.length-1?1:0,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",dr[a],":"]})}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{color:m?"green":"gray",children:[m?"yes":"no",l&&e.jsx(r,{dimColor:!0,children:" (Space to toggle)"})]})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Be=ur,ue=ne;var mr=Object.defineProperty,gr=v((o,t)=>mr(o,"name",{value:t,configurable:!0}),"s$3");const Ne=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],fr={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},pr={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},xr=gr(({config:o,fieldEditing:t,fieldIndex:i,onSetCommand:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Ne.map((a,n)=>{const l=n===i,m=o[a],g=Array.isArray(m)?m.join(" && "):m??"";return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsx(s,{children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",fr[a]]})}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:pr[a]})}),e.jsx(s,{paddingLeft:4,children:l&&t?e.jsx(X,{defaultValue:g,onChange:v(f=>{c(a,f)},"onChange"),placeholder:"e.g. npm install"}):e.jsx(r,{color:g?"green":"gray",children:g||"(not set)"})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),vr=Ne.length;var jr=Object.defineProperty,Re=v((o,t)=>jr(o,"name",{value:t,configurable:!0}),"s$2");const Se=Re(o=>typeof o=="string"?o:`[${o.type}] ${o.source} → ${o.target}`,"formatMount"),br=Re(({addingMount:o,config:t,detectedPm:i,fieldIndex:c,mountPhase:a,mountSource:n,mountTarget:l,mountType:m,suggestedMounts:g})=>{const f=t.mounts??[];return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[f.length," ","mounts"]}),i&&e.jsxs(r,{dimColor:!0,children:["— detected:"," ",e.jsx(r,{color:"white",children:i})]})]}),g.length>0&&!o&&e.jsxs(s,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[e.jsxs(s,{flexShrink:0,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Suggested mounts"}),e.jsxs(r,{dimColor:!0,children:[" ","— press"," ",e.jsx(r,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),g.map((j,x)=>e.jsx(s,{flexShrink:0,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" + ",Se(j)]})},`suggestion-${String(x)}`))]}),f.length>0&&e.jsx(s,{flexDirection:"column",marginBottom:1,children:f.map((j,x)=>{const b=x===c;return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:b?">":" "}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:b,inverse:b,wrap:"truncate",children:[" ",Se(j)]})})]},`mount-${String(x)}`)})}),!o&&e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:c===f.length?"cyan":"gray",inverse:c===f.length,children:[" ","+ Add mount..."]})}),o&&e.jsxs(s,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[e.jsx(s,{flexShrink:0,marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"New Mount"})}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="source",color:a==="source"?"cyan":"white",children:[a==="source"?"❯ ":" ","Source:"]})}),e.jsx(r,{color:n?"yellow":"gray",children:n||(a==="source"?"_":"(type source, Enter to continue)")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="target",color:a==="target"?"cyan":"white",children:[a==="target"?"❯ ":" ","Target:"]})}),e.jsx(r,{color:l?"yellow":"gray",children:l||(a==="target"?"_":"/container/path")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="type",color:a==="type"?"cyan":"white",children:[a==="type"?"❯ ":" ","Type:"]})}),a==="type"?e.jsxs(r,{children:[e.jsx(r,{bold:m==="volume",color:m==="volume"?"cyan":"gray",children:"[1] volume"})," ",e.jsx(r,{bold:m==="bind",color:m==="bind"?"cyan":"gray",children:"[2] bind"})," ",e.jsx(r,{bold:m==="tmpfs",color:m==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):e.jsx(r,{color:"gray",children:m})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:a==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),f.length===0&&!o&&g.length===0&&e.jsx(s,{marginTop:1,children:e.jsx(r,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var yr=Object.defineProperty,wr=v((o,t)=>yr(o,"name",{value:t,configurable:!0}),"s$1");const Cr=wr(({addingPort:o,addPortValue:t,config:i,fieldIndex:c})=>{const a=i.forwardPorts??[],n=c===a.length;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{bold:!0,color:"cyan",children:"Forwarded Ports"}),e.jsxs(r,{dimColor:!0,children:[" ","(",a.length," ","ports)"]})]}),a.map((l,m)=>{const g=m===c;return e.jsx(s,{children:e.jsxs(r,{color:g?"cyan":void 0,inverse:g,children:[" ",String(l)]})},`port-${String(l)}`)}),e.jsx(s,{marginTop:a.length>0?1:0,children:e.jsxs(r,{color:n?"cyan":"gray",inverse:n,children:[" ",n&&o?e.jsxs(r,{children:["Enter port:"," ",e.jsx(r,{color:"yellow",children:t||"_"})]}):"+ Add port..."]})}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ",n?"type port number, Enter to confirm":"select"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var Sr=Object.defineProperty,kr=v((o,t)=>Sr(o,"name",{value:t,configurable:!0}),"a");const Er=kr(({focused:o,hadComments:t,jsonPreview:i,mode:c,scrollRef:a})=>e.jsxs(s,{borderColor:o?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:o?"cyan":"white",children:"Preview"}),e.jsxs(r,{dimColor:!0,children:[" ","(",c==="create"?"new":"edit",")"]})]}),t&&c==="edit"&&e.jsx(s,{flexShrink:0,paddingX:1,children:e.jsx(r,{color:"yellow",children:"Comments will not be preserved."})}),e.jsx(Qe,{flexGrow:1,ref:a,scrollbar:!0,scrollbarColor:"gray",children:i.split(`
3
+ `).map((n,l)=>e.jsx(r,{color:"green",children:n},`line-${String(l)}`))})]}),"PreviewPanel");var Ir=Object.defineProperty,Tr=v((o,t)=>Ir(o,"name",{value:t,configurable:!0}),"r");const Pr=Tr(o=>{const t=[],i=[],c=[];if(!o.image&&!o.build&&!o.dockerComposeFile&&t.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),o.build&&(o.image&&i.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),o.build.dockerfile||t.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),o.dockerComposeFile&&!o.service&&t.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),o.features!==void 0&&(typeof o.features!="object"||Array.isArray(o.features))&&t.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),o.forwardPorts)if(Array.isArray(o.forwardPorts))for(const[a,n]of o.forwardPorts.entries())typeof n=="number"&&(n<1||n>65535)&&t.push({field:"forwardPorts",message:`Invalid port ${String(n)} at index ${String(a)}`});else t.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return o.customizations?.vscode?.extensions&&!Array.isArray(o.customizations.vscode.extensions)&&t.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),o.customizations?.vscode?.settings&&typeof o.customizations.vscode.settings!="object"&&t.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),o.name||c.push({field:"name",message:"Consider adding a name for better identification"}),(!o.features||Object.keys(o.features).length===0)&&c.push({field:"features",message:"Consider adding features for common tools"}),(!o.customizations?.vscode?.extensions||o.customizations.vscode.extensions.length===0)&&c.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),o.privileged&&i.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:t,suggestions:c,valid:t.length===0,warnings:i}},"validateConfig");var Dr=Object.defineProperty,ze=v((o,t)=>Dr(o,"name",{value:t,configurable:!0}),"$");const ke=80,Ee=15,Or=120,Ge=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],Fr=new Map(Ge.map(o=>[o.id,o.description])),Ar=ze((o,t,i,c)=>{switch(o){case"compose":return Yt;case"environment":return er(t);case"extensions":return fe(c).length;case"features":return ge(i).length;case"general":return Be;case"lifecycle":return vr;case"mounts":return(t.mounts?.length??0)+1;case"ports":return(t.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),$r=ze(({onSave:o,store:t})=>{const{exit:i}=Ze(),{columns:c,rows:a}=et(),n=p.useSyncExternalStore(t.subscribe,t.getSnapshot),[l,m]=p.useState(!1),[g,f]=p.useState(!1),[j,x]=p.useState(!1),[b,w]=p.useState(null),[E,D]=p.useState("editor"),[R,L]=p.useState(0),[H,J]=p.useState(!1),[ee,P]=p.useState(""),[T,I]=p.useState(null),[S,O]=p.useState(""),[q,C]=p.useState(""),[k,z]=p.useState("key"),[se,te]=p.useState(!1),[ce,G]=p.useState(""),[ae,_]=p.useState(""),[pe,K]=p.useState("volume"),[A,W]=p.useState("source"),le=p.useRef(null),B=p.useRef(null),M=p.useRef(null),re=p.useRef(!0);p.useEffect(()=>(re.current=!0,()=>{re.current=!1,M.current&&clearTimeout(M.current)}),[]);const xe=Ar(n.section,n.config,n.featureSearch,n.extensionSearch),Y=Math.max(1,a-9);p.useEffect(()=>{n.section!=="features"&&n.section!=="extensions"||L(u=>n.fieldIndex>=u+Y?n.fieldIndex-Y+1:n.fieldIndex<u?n.fieldIndex:u)},[n.fieldIndex,n.section,Y]),p.useEffect(()=>{L(0)},[n.section,n.featureSearch,n.extensionSearch]);const _e=p.useCallback(()=>{const u=t.cleanConfig(),h=Pr(u);if(!h.valid){const y=h.errors[0];w(y?`Error: ${y.message}`:"Validation failed"),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{re.current&&w(null)},3e3);return}o(u),t.markClean();const d=h.warnings.length;w(d>0?`Saved! (${String(d)} warning${d>1?"s":""})`:"Saved!"),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{re.current&&w(null)},2e3)},[o,t]);U((u,h)=>{if(h.downArrow||u==="j")t.setTemplateIndex(n.templateIndex+1);else if(h.upArrow||u==="k")t.setTemplateIndex(n.templateIndex-1);else if(h.return){const d=V[n.templateIndex];d&&t.applyTemplate(d.id)}else h.escape&&t.dismissTemplateSelector()},{isActive:n.showTemplateSelector}),U((u,h)=>{if(h.escape){J(!1),P("");return}if(h.return){const d=Number.parseInt(ee,10);!Number.isNaN(d)&&d>0&&d<=65535&&t.addPort(d),J(!1),P("");return}if(h.backspace){P(d=>d.slice(0,-1));return}u&&/^\d$/u.test(u)&&P(d=>d+u)},{isActive:H}),U((u,h)=>{if(h.escape){I(null),O(""),C(""),z("key");return}if(h.return){if(k==="key"&&S){z("value");return}if(k==="value"&&S){t.addEnvVar(T,S,q),I(null),O(""),C(""),z("key");return}}if(h.backspace){k==="key"?O(d=>d.slice(0,-1)):C(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(k==="key"?O(d=>d+u):C(d=>d+u))},{isActive:T!==null}),U((u,h)=>{if(h.escape){te(!1),G(""),_(""),W("source");return}if(h.return){if(A==="source"&&ce){W("target");return}if(A==="target"&&ae){W("type");return}if(A==="type"){t.addMount({source:ce,target:ae,type:pe}),te(!1),G(""),_(""),W("source");return}}if(A==="type"){switch(u){case"1":{K("volume");break}case"2":{K("bind");break}case"3":{K("tmpfs");break}}return}if(h.backspace){A==="source"?G(d=>d.slice(0,-1)):A==="target"&&_(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(A==="source"?G(d=>d+u):A==="target"&&_(d=>d+u))},{isActive:se}),U((u,h)=>{if(u==="c"&&h.ctrl){i();return}if(!g){if(l){h.escape||u==="?"?m(!1):h.downArrow||u==="j"?le.current?.scrollBy(1):h.upArrow||u==="k"?le.current?.scrollBy(-1):u==="q"&&(m(!1),f(!0));return}if(j){if(h.escape){x(!1),n.section==="features"?t.setFeatureSearch(""):t.setExtensionSearch("");return}if(h.return){x(!1);return}if(h.backspace){n.section==="features"?t.setFeatureSearch(n.featureSearch.slice(0,-1)):t.setExtensionSearch(n.extensionSearch.slice(0,-1));return}if(u&&!h.ctrl&&!h.meta){n.section==="features"?t.setFeatureSearch(n.featureSearch+u):t.setExtensionSearch(n.extensionSearch+u);return}return}if(n.fieldEditing){if(h.escape){t.setFieldEditing(!1);return}if(h.return){t.setFieldEditing(!1);return}return}if(u==="?"){m(!0);return}if(u==="q"){n.isDirty?f(!0):i();return}if(u==="s"){_e();return}if(h.tab){D(d=>d==="editor"?"preview":"editor");return}if(E==="preview"){if(h.downArrow||u==="j"){B.current?.scrollBy(1);return}if(h.upArrow||u==="k"){B.current?.scrollBy(-1);return}if(h.pageDown){B.current?.scrollBy(10);return}if(h.pageUp){B.current?.scrollBy(-10);return}if(h.home){B.current?.scrollToTop();return}if(h.end){B.current?.scrollToBottom();return}h.escape&&D("editor");return}if(h.downArrow||u==="j"){xe>0&&t.setFieldIndex(Math.min(n.fieldIndex+1,xe-1));return}if(h.upArrow||u==="k"){t.setFieldIndex(Math.max(n.fieldIndex-1,0));return}if(h.return){switch(n.section){case"compose":case"general":case"lifecycle":{t.setFieldEditing(!0);break}case"environment":{const d=Object.keys(n.config.containerEnv??{}).length,y=d,$=d+1+Object.keys(n.config.remoteEnv??{}).length;n.fieldIndex===y?(I("container"),O(""),C(""),z("key")):n.fieldIndex===$&&(I("remote"),O(""),C(""),z("key"));break}case"mounts":{const d=n.config.mounts??[];n.fieldIndex===d.length&&(te(!0),G(""),_(""),K("volume"),W("source"));break}case"ports":{const d=n.config.forwardPorts??[];n.fieldIndex===d.length&&(J(!0),P(""));break}}return}if(u===" "){switch(n.section){case"extensions":{const d=fe(n.extensionSearch)[n.fieldIndex];d&&t.toggleExtension(d.id);break}case"features":{const d=ge(n.featureSearch)[n.fieldIndex];d&&t.toggleFeature(d.id);break}case"general":{const d=Be-ue.length,y=n.fieldIndex-d;if(y>=0&&y<ue.length){const $=ue[y];t.updateConfig({[$]:!n.config[$]})}break}}return}if(u==="/"){(n.section==="features"||n.section==="extensions")&&x(!0);return}if(u==="A"&&n.section==="mounts"){t.applySuggestedMounts();return}if(u==="a"){if(n.section==="environment"){const d=Object.keys(n.config.containerEnv??{}).length,y=n.fieldIndex<=d?"container":"remote";I(y),O(""),C(""),z("key")}else n.section==="mounts"&&(te(!0),G(""),_(""),K("volume"),W("source"));return}if(u==="d")switch(n.section){case"environment":{const d=Object.keys(n.config.containerEnv??{}),y=Object.keys(n.config.remoteEnv??{});if(n.fieldIndex<d.length)t.removeEnvVar("container",d[n.fieldIndex]),d.length===1||n.fieldIndex>=d.length-1&&t.setFieldIndex(d.length-2);else{const $=n.fieldIndex-d.length-1;$>=0&&$<y.length&&(t.removeEnvVar("remote",y[$]),y.length===1||$>=y.length-1&&t.setFieldIndex(n.fieldIndex-1))}break}case"mounts":{const d=n.config.mounts??[];if(n.fieldIndex<d.length){t.removeMount(n.fieldIndex);const y=d.length-1;n.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}case"ports":{const d=n.config.forwardPorts??[];if(n.fieldIndex<d.length){t.removePort(n.fieldIndex);const y=d.length-1;n.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}}}},{isActive:!n.showTemplateSelector&&!H&&T===null&&!se});const We=p.useMemo(()=>t.getJsonPreview(),[n.config]);if(c<ke||a<Ee)return e.jsx(s,{alignItems:"center",height:a,justifyContent:"center",width:c,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",a,"), need"," ",ke,"x",Ee]})});if(n.showTemplateSelector)return e.jsx(s,{alignItems:"center",flexDirection:"column",height:a,justifyContent:"center",width:c,children:e.jsxs(s,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[e.jsx(s,{justifyContent:"center",marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Select a Template"})}),V.map((u,h)=>{const d=h===n.templateIndex;return e.jsx(s,{children:e.jsxs(r,{color:d?"cyan":void 0,inverse:d,children:[d?" ❯ ":" ",e.jsx(r,{bold:d,children:u.name}),e.jsxs(r,{dimColor:!0,children:[" ","-",u.description]})]})},u.id)}),e.jsx(s,{justifyContent:"center",marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","select"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let F;switch(n.section){case"compose":{F=e.jsx(Kt,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onUpdate:v(u=>{t.updateConfig(u)},"onUpdate")});break}case"environment":{F=e.jsxs(s,{flexDirection:"column",children:[e.jsx(Zt,{config:n.config,fieldIndex:n.fieldIndex}),T!==null&&e.jsx(s,{marginTop:1,paddingX:1,children:e.jsxs(r,{color:"cyan",children:["Add"," ",T," ","env:"," ",k==="key"?e.jsxs(r,{children:["key=",e.jsx(r,{color:"yellow",children:S||"_"})," ","(Enter to set value)"]}):e.jsxs(r,{children:[S,"=",e.jsx(r,{color:"yellow",children:q||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{F=e.jsx(or,{config:n.config,fieldIndex:n.fieldIndex,scrollOffset:R,searchText:n.extensionSearch,viewportHeight:Y});break}case"features":{F=e.jsx(sr,{config:n.config,fieldIndex:n.fieldIndex,scrollOffset:R,searchText:n.featureSearch,viewportHeight:Y});break}case"general":{F=e.jsx(hr,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onUpdate:v(u=>{t.updateConfig(u)},"onUpdate")});break}case"lifecycle":{F=e.jsx(xr,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onSetCommand:v((u,h)=>{t.setLifecycleCommand(u,h)},"onSetCommand")});break}case"mounts":{F=e.jsx(br,{addingMount:se,config:n.config,detectedPm:n.detectedPm,fieldIndex:n.fieldIndex,mountPhase:A,mountSource:ce,mountTarget:ae,mountType:pe,suggestedMounts:n.suggestedMounts});break}case"ports":{F=e.jsx(Cr,{addingPort:H,addPortValue:ee,config:n.config,fieldIndex:n.fieldIndex});break}default:F=e.jsx(r,{children:"Unknown section"})}const Ue=e.jsxs(s,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[e.jsxs(s,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]}),(n.section==="features"||n.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"TABS"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]}),(n.section==="features"||n.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:"SAVE"})]})]}),e.jsxs(s,{paddingX:1,children:[b&&e.jsxs(r,{color:b.startsWith("Error")?"red":"green",children:[b," "]}),n.isDirty&&e.jsx(r,{color:"yellow",children:"[modified]"}),!n.isDirty&&!b&&e.jsx(r,{dimColor:!0,children:"[saved]"})]})]}),Ve=e.jsxs(tt,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:le,title:"KEYBOARD SHORTCUTS",visible:l,width:56,children:[e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:" Switch tabs"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),"/",e.jsx(r,{bold:!0,color:"white",children:"j/k"}),e.jsx(r,{dimColor:!0,children:" Navigate within section"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:" Switch editor/preview panel"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Enter"}),e.jsx(r,{dimColor:!0,children:" Edit selected field"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Esc"}),e.jsx(r,{dimColor:!0,children:" Stop editing / cancel"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:" Toggle selection"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:" Search / filter"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:" Add new entry"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"d"}),e.jsx(r,{dimColor:!0,children:" Delete selected entry"})]})]}),e.jsxs(s,{flexDirection:"column",children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:" Save configuration"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Xe=e.jsx(Er,{focused:E==="preview",hadComments:n.hadComments,jsonPreview:We,mode:n.mode,scrollRef:B}),ve=c>=Or,He=ve?Math.floor(c*.38):0;return e.jsxs(s,{flexDirection:"column",height:a,width:c,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[n.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),e.jsx(s,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(mt,{defaultValue:n.section,keyMap:{useNumbers:!1,useTab:!1},onChange:v(u=>{t.setSection(u),D("editor")},"onChange"),showIndex:!1,children:Ge.map(({id:u,label:h})=>e.jsx(gt,{name:u,children:h},u))})}),e.jsx(s,{flexShrink:0,paddingRight:2,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:Fr.get(n.section)??""})}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{borderColor:E==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:F}),ve&&e.jsx(s,{flexShrink:0,width:He,children:Xe})]}),Ue,e.jsx(rt,{autoExitSeconds:3,onCancel:v(()=>{f(!1)},"onCancel"),visible:g}),Ve]})},"VisDevcontainerApp");var Mr=Object.defineProperty,Ie=v((o,t)=>Mr(o,"name",{value:t,configurable:!0}),"c");const Wr=Ie(async({logger:o,options:t,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const c=i,a=t.template,n=t.output,l=!!process.stdout.isTTY&&!it;let m=null;try{m=st(c).name}catch{}const g=Ct(c);let f=g?.config??null;const j=g?.hadComments??!1;if(a&&!g){const E=V.find(D=>D.id===a);if(!E){const D=V.map(R=>R.id).join(", ");throw new Error(`Unknown template "${a}". Valid templates: ${D}`)}f=E.config}if(!l){f?o.info(JSON.stringify(f,null,2)):(o.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const x=setInterval(()=>{},1e3),b=new Dt(f,j,m);a&&!g&&b.dismissTemplateSelector();let w=null;if(await ot(nt.createElement($r,{onSave:Ie(E=>{St(c,E,n),w=E},"onSave"),store:b}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(x),w){const E=n??".devcontainer/devcontainer.json";o.info(`DevContainer config saved to ${E}`)}},"execute");export{Wr as default};
@@ -1,4 +1,4 @@
1
- var Fe=Object.defineProperty;var f=(e,t)=>Fe(e,"name",{value:t,configurable:!0});import{createRequire as Ne}from"node:module";import{a as He,M as re,z as B,i as oe,Q as Se}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{x as $e}from"tinyexec";import{o as xe}from"../packem_shared/index-DH-5hsrC.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";import{render as Ue}from"@visulima/tui";import{Box as M}from"@visulima/tui/components/box";import{Spinner as ze}from"@visulima/tui/components/spinner";import{Text as $}from"@visulima/tui/components/text";import{C as Ce,D as q,T as Ie}from"../packem_shared/symbols-CQmER5MT.js";import{E as I,I as Ve,e as ce,q as J,T as X}from"../packem_shared/index.server-B7ETiT4C.js";import{withEnhancedPath as We}from"@visulima/task-runner";const Ge=Ne(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,z=f(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[t,r]=F.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return F.getBuiltinModule(e)}return Ge(e)},"__cjs_getBuiltinModule"),{createRequire:_e}=z("node:module"),{readFileSync:De,writeFileSync:Be,unlinkSync:Le}=z("node:fs"),{randomBytes:qe}=z("node:crypto"),{availableParallelism:de}=z("node:os");var Ke=Object.defineProperty,Ye=f((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"u$4"),Qe=Object.defineProperty,Ee=Ye((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"c");const Je=_e(import.meta.url),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ne=Ee(e=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[t,r]=N.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return N.getBuiltinModule(e)}return Je(e)},"__cjs_getBuiltinModule"),Xe=ne("fs"),Ze=ne("os"),et=ne("path");var tt=Object.defineProperty,rt=Ee((e,t)=>tt(e,"name",{value:t,configurable:!0}),"a"),st=Object.defineProperty,V=rt((e,t)=>st(e,"name",{value:t,configurable:!0}),"s");const Me=V(e=>{let t="";for(let r=0;r<e.length;r+=1){const s=e[r],n=s.toUpperCase();t+=s===n?s.toLowerCase():n}return t},"invertCase"),Z=new Map,le=V((e,t)=>{const r=et.join(e,`.is-fs-case-sensitive-test-${process.pid}`);try{return t.writeFileSync(r,""),!t.existsSync(Me(r))}finally{try{t.unlinkSync(r)}catch{}}},"checkDirectoryCaseWithWrite"),nt=V((e,t,r)=>{try{return le(e,r)}catch(s){if(t===void 0)return le(Ze.tmpdir(),r);throw s}},"checkDirectoryCaseWithFallback"),at=V((e,t=Xe,r=!0)=>{const s=e??process.cwd();if(r&&Z.has(s))return Z.get(s);let n;const i=Me(s);return i!==s&&t.existsSync(s)?n=!t.existsSync(i):n=nt(s,e,t),r&&Z.set(s,n),n},"isFsCaseSensitive");var it=Object.defineProperty,ot=f((e,t)=>it(e,"name",{value:t,configurable:!0}),"s$3");class A extends Error{static{f(this,"StagedError")}static{ot(this,"StagedError")}constructor(t,r){super(t,r),this.name=this.constructor.name}}var ct=Object.defineProperty,dt=f((e,t)=>ct(e,"name",{value:t,configurable:!0}),"o$6");class lt extends A{static{f(this,"ApplyEmptyCommitError")}static{dt(this,"ApplyEmptyCommitError")}}var ut=Object.defineProperty,ft=f((e,t)=>ut(e,"name",{value:t,configurable:!0}),"o$5");class T extends A{static{f(this,"ConfigError")}static{ft(this,"ConfigError")}}var ht=Object.defineProperty,pt=f((e,t)=>ht(e,"name",{value:t,configurable:!0}),"t$1");class ue extends A{static{f(this,"GetBackupStashError")}static{pt(this,"GetBackupStashError")}}var gt=Object.defineProperty,mt=f((e,t)=>gt(e,"name",{value:t,configurable:!0}),"s$2");class D extends A{static{f(this,"GitError")}static{mt(this,"GitError")}stderr;constructor(t,r,s){super(t,s),this.stderr=r}}var wt=Object.defineProperty,vt=f((e,t)=>wt(e,"name",{value:t,configurable:!0}),"e");class fe extends A{static{f(this,"RestoreOriginalStateError")}static{vt(this,"RestoreOriginalStateError")}}var yt=Object.defineProperty,kt=f((e,t)=>yt(e,"name",{value:t,configurable:!0}),"o$2");class O extends A{static{f(this,"TaskError")}static{kt(this,"TaskError")}commandTitle;constructor(t,r,s){super(r,s),this.commandTitle=t}}var bt=Object.defineProperty,W=f((e,t)=>bt(e,"name",{value:t,configurable:!0}),"i");const Tt=W(async e=>{if(e.config!==void 0)return e.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
1
+ var Re=Object.defineProperty;var f=(e,t)=>Re(e,"name",{value:t,configurable:!0});import{createRequire as Fe}from"node:module";import{a as Be,M as te,z as D,i as ie,Q as Te}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{x as Se}from"tinyexec";import{o as $e}from"../packem_shared/index-DH-5hsrC.js";import{a5 as w,n as $,a6 as j,v as qe}from"./bin.js";import{n as Ue}from"../packem_shared/spinner-B9ZPv1iT.js";import{C as xe,D as H,T as Ce}from"../packem_shared/symbols-CQmER5MT.js";import{E as C,I as ze,e as oe,q as Q,T as J}from"../packem_shared/Table-CwC2kW07-EjFLNV0q.js";import{withEnhancedPath as Ve}from"@visulima/task-runner";const Ne=Fe(import.meta.url),R=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=f(e=>{if(typeof R<"u"&&R.versions&&R.versions.node){const[t,s]=R.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return R.getBuiltinModule(e)}return Ne(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=U("node:module"),{readFileSync:_e,writeFileSync:De,unlinkSync:Le}=U("node:fs"),{randomBytes:He}=U("node:crypto"),{availableParallelism:ce}=U("node:os");var We=Object.defineProperty,Ke=f((e,t)=>We(e,"name",{value:t,configurable:!0}),"u$4"),Ye=Object.defineProperty,Ie=Ke((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"c");const Qe=Ge(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=Ie(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[t,s]=F.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return F.getBuiltinModule(e)}return Qe(e)},"__cjs_getBuiltinModule"),Je=re("fs"),Xe=re("os"),Ze=re("path");var et=Object.defineProperty,tt=Ie((e,t)=>et(e,"name",{value:t,configurable:!0}),"a"),st=Object.defineProperty,z=tt((e,t)=>st(e,"name",{value:t,configurable:!0}),"s");const je=z(e=>{let t="";for(let s=0;s<e.length;s+=1){const r=e[s],n=r.toUpperCase();t+=r===n?r.toLowerCase():n}return t},"invertCase"),X=new Map,de=z((e,t)=>{const s=Ze.join(e,`.is-fs-case-sensitive-test-${process.pid}`);try{return t.writeFileSync(s,""),!t.existsSync(je(s))}finally{try{t.unlinkSync(s)}catch{}}},"checkDirectoryCaseWithWrite"),rt=z((e,t,s)=>{try{return de(e,s)}catch(r){if(t===void 0)return de(Xe.tmpdir(),s);throw r}},"checkDirectoryCaseWithFallback"),nt=z((e,t=Je,s=!0)=>{const r=e??process.cwd();if(s&&X.has(r))return X.get(r);let n;const i=je(r);return i!==r&&t.existsSync(r)?n=!t.existsSync(i):n=rt(r,e,t),s&&X.set(r,n),n},"isFsCaseSensitive");var at=Object.defineProperty,it=f((e,t)=>at(e,"name",{value:t,configurable:!0}),"s$3");class O extends Error{static{f(this,"StagedError")}static{it(this,"StagedError")}constructor(t,s){super(t,s),this.name=this.constructor.name}}var ot=Object.defineProperty,ct=f((e,t)=>ot(e,"name",{value:t,configurable:!0}),"o$6");class dt extends O{static{f(this,"ApplyEmptyCommitError")}static{ct(this,"ApplyEmptyCommitError")}}var lt=Object.defineProperty,ut=f((e,t)=>lt(e,"name",{value:t,configurable:!0}),"o$5");class T extends O{static{f(this,"ConfigError")}static{ut(this,"ConfigError")}}var ft=Object.defineProperty,ht=f((e,t)=>ft(e,"name",{value:t,configurable:!0}),"t$1");class le extends O{static{f(this,"GetBackupStashError")}static{ht(this,"GetBackupStashError")}}var pt=Object.defineProperty,gt=f((e,t)=>pt(e,"name",{value:t,configurable:!0}),"s$2");class _ extends O{static{f(this,"GitError")}static{gt(this,"GitError")}stderr;constructor(t,s,r){super(t,r),this.stderr=s}}var mt=Object.defineProperty,wt=f((e,t)=>mt(e,"name",{value:t,configurable:!0}),"e");class ue extends O{static{f(this,"RestoreOriginalStateError")}static{wt(this,"RestoreOriginalStateError")}}var vt=Object.defineProperty,yt=f((e,t)=>vt(e,"name",{value:t,configurable:!0}),"o$2");class E extends O{static{f(this,"TaskError")}static{yt(this,"TaskError")}commandTitle;constructor(t,s,r){super(s,r),this.commandTitle=t}}var kt=Object.defineProperty,V=f((e,t)=>kt(e,"name",{value:t,configurable:!0}),"i");const bt=V(async e=>{if(e.config!==void 0)return e.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
2
2
 
3
3
  import { defineConfig } from "@visulima/vis/config";
4
4
 
@@ -6,16 +6,16 @@ var Fe=Object.defineProperty;var f=(e,t)=>Fe(e,"name",{value:t,configurable:!0})
6
6
  staged: { "*.ts": "eslint --fix" },
7
7
  });
8
8
 
9
- Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},"resolveConfig"),he=W(e=>{if(typeof e!="object"||e===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const t=Object.entries(e);if(t.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[r,s]of t){if(!r||r.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");Oe(r,s)}return e},"validateConfig"),Oe=W((e,t)=>{if(typeof t=="string"){if(t.trim()==="")throw new T(`Task for "${e}" is an empty string.`);return}if(Array.isArray(t)){if(t.length===0)throw new T(`Task array for "${e}" is empty.`);for(const r of t)Oe(e,r);return}if(typeof t!="function"&&!St(t))throw new T(`Invalid task for "${e}" — expected string, string[], function, or { title, task } object.`)},"validateTask"),St=W(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask");var $t=Object.defineProperty,x=f((e,t)=>$t(e,"name",{value:t,configurable:!0}),"r$2");const pe=2048,g=x(async(e,t)=>{const r=t.input===void 0?void 0:typeof t.input=="string"?t.input:t.input.toString("utf8"),s=await $e("git",[...e],{nodeOptions:{cwd:t.cwd,env:t.env?{...process.env,...t.env}:void 0,stdio:r===void 0?["ignore","pipe","pipe"]:["pipe","pipe","pipe"]},stdin:r}),n=typeof s.exitCode=="number"?s.exitCode:1;if(n!==0&&!t.lenient){const{stderr:i}=s,o=i.length>pe?`${i.slice(0,pe)}…`:i;throw new D(`git ${e.join(" ")} failed with exit code ${n}: ${o.trim()}`,i)}return{exitCode:n,stderr:s.stderr,stdout:s.stdout}},"git"),R=x(async(e,t)=>{const{stdout:r}=await g(e,t);return r.trim()},"gitOut"),xt=x(async e=>{const t=await g(["rev-parse","--is-inside-work-tree"],{cwd:e,lenient:!0});return t.exitCode===0&&t.stdout.trim()==="true"},"isGitRepo"),Ct=x(async e=>R(["rev-parse","--absolute-git-dir"],{cwd:e}),"getGitDirectory"),je=x(async e=>R(["rev-parse","--show-toplevel"],{cwd:e}),"getWorkTree"),ge=x(async e=>R(["write-tree"],{cwd:e}),"writeIndexTree"),It=x(async e=>{const t=await g(["rev-parse","HEAD^{tree}"],{cwd:e,lenient:!0});return t.exitCode===0?t.stdout.trim():""},"headTreeSha"),G={major:2,minor:32},Et=x(e=>{const t=/git version (\d+)\.(\d+)/.exec(e);if(!t)return null;const r=Number.parseInt(t[1]??"",10),s=Number.parseInt(t[2]??"",10);return Number.isNaN(r)||Number.isNaN(s)?null:{major:r,minor:s}},"parseGitVersion"),Mt=x(async e=>{const t=Et(await R(["--version"],{cwd:e}));if(t!==null&&(t.major<G.major||t.major===G.major&&t.minor<G.minor))throw new D(`Git ${G.major}.${G.minor} or newer is required; found ${t.major}.${t.minor}.`)},"assertGitVersion");var Ot=Object.defineProperty,E=f((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"a$2");const jt="ACMR",me=500,At=E(async e=>{const{stdout:t}=await g(["diff-files","--raw","-z"],{cwd:e}),r=t.split("\0").filter(n=>n.length>0),s=[];for(let n=0;n<r.length;n+=1){const i=r[n];if(!i?.startsWith(":"))continue;const o=i.slice(1).split(" "),a=o[3],c=o[4],d=r[n+1];n+=1,c==="A"&&a!==void 0&&/^0+$/.test(a)&&d!==void 0&&s.push(d)}return s},"getIntentToAddPaths"),we=E(async e=>{const{stdout:t}=await g(["ls-files","--others","--exclude-standard","-z"],{cwd:e});return t.split("\0").filter(r=>r.length>0)},"getUntrackedFiles"),Pt=E(async(e,t)=>{if(e.length===0)return;const r=`${e.join("\0")}\0`;await g(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"removeFromIndex"),Rt=E(async e=>{const t=e.diffFilter??jt,r=e.diff===void 0?["diff","--name-only","-z",`--diff-filter=${t}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${t}`,...e.diff.split(/\s+/).filter(Boolean)],{stdout:s}=await g(r,{cwd:e.cwd}),n=s.split("\0").filter(o=>o.length>0);if(n.length===0)return[];const i=e.workTree??await je(e.cwd);return n.map(o=>He(o)?o:re(i,o))},"getFiles"),Ft=E(async(e,t)=>{if(e.length===0)return null;const r=[];for(let i=0;i<e.length;i+=me){const o=e.slice(i,i+me),{stdout:a}=await g(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...o],{cwd:t.cwd});a.length>0&&r.push(a)}if(r.length===0)return null;const s=r.join(""),n=s.endsWith(`
10
- `)?s:`${s}
11
- `;return Buffer.from(n,"utf8")},"capturePatch"),Nt=E(async e=>{const{stdout:t}=await g(["status","--porcelain=v1","-z"],{cwd:e}),r=t.split("\0"),s=[];for(let n=0;n<r.length;n+=1){const i=r[n];if(i===void 0||i.length<4)continue;const o=i.charAt(0),a=i.charAt(1),c=i.slice(3),d=o==="R"||o==="C"||a==="R"||a==="C";o!==" "&&o!=="?"&&a!==" "&&a!=="?"&&s.push(c),d&&(n+=1)}return s},"getPartiallyStagedFiles"),Gt=E(async(e,t)=>{if(e.length===0)return;const r=`${e.join("\0")}\0`;await g(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"checkoutPaths"),_t=E(async(e,t)=>{if(await g(["update-index","--again"],{cwd:t.cwd,lenient:!0}),e.length===0)return;const r=`${e.join("\0")}\0`;await g(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"updateIndexAgain");var Dt=Object.defineProperty,P=f((e,t)=>Dt(e,"name",{value:t,configurable:!0}),"r$1");const Bt="vis_staged_automatic_backup",Ae=P(()=>`${Bt}-${process.pid}-${Date.now()}-${qe(3).toString("hex")}`,"buildMessage"),Lt=P(async e=>{const t=await R(["stash","create"],{cwd:e});return t.length===0?null:(await g(["stash","store","-m",Ae(),t],{cwd:e}),t)},"createBackupStash"),Ht=P(async e=>{const t=Ae(),{exitCode:r,stdout:s}=await g(["stash","push","--keep-index","--include-untracked","--quiet","-m",t],{cwd:e,lenient:!0});if(r!==0)return null;const n=s.trim();return n.length>0&&/no local changes/i.test(n)?null:R(["rev-parse","stash@{0}"],{cwd:e})},"createHideAllStash"),ae=P(async(e,t)=>{const{exitCode:r,stdout:s}=await g(["reflog","--format=%H %gd","refs/stash"],{cwd:e,lenient:!0});if(r!==0)return null;for(const n of s.split(/\r?\n/)){const[i,o]=n.split(/\s+/,2);if(i===t&&o!==void 0)return o}return null},"findStashRefBySha"),ve=P(async(e,t)=>{if(t===null)return;const r=await ae(e,t);r!==null&&await g(["stash","drop","--quiet",r],{cwd:e})},"dropBackupStash"),qt=P(async(e,t)=>{if(t===null)throw new ue("Backup stash was not found — can't revert working tree.");const r=await ae(e,t);if(r===null)throw new ue(`Backup stash ${t} is no longer reachable — can't revert working tree.`);await g(["reset","--hard","HEAD"],{cwd:e}),await g(["stash","apply","--index","--quiet",r],{cwd:e})},"applyBackupStash"),Ut=P(async(e,t)=>{if(t===null)return;const r=await ae(e,t);r!==null&&await g(["stash","pop","--quiet",r],{cwd:e})},"popHideAllStash");var zt=Object.defineProperty,Vt=f((e,t)=>zt(e,"name",{value:t,configurable:!0}),"l");class Wt{static{f(this,"GitWorkflow")}static{Vt(this,"GitWorkflow")}stagedFiles=[];partiallyStaged=[];workTree="";gitDir="";preTaskIndexTree="";postTaskIndexTree="";headTree="";revertApplied=!1;warnings=[];cwd;options;patch=null;backupStashSha=null;merge=[];shouldStash;shouldHidePartial;shouldHideUnstaged;shouldHideAll;hideAllStashSha=null;intentToAddPaths=[];preTaskUntracked=new Set;constructor(t){this.cwd=t.cwd??process.cwd(),this.options=t,this.shouldStash=t.stash!==!1&&t.diff===void 0,this.shouldHidePartial=t.hidePartiallyStaged!==!1,this.shouldHideUnstaged=t.hideUnstaged===!0,this.shouldHideAll=t.hideAll===!0}async prepare(){if(!await xt(this.cwd))throw new D(`Not a git repository: ${this.cwd}`);await Mt(this.cwd),this.workTree=await je(this.cwd),this.gitDir=await Ct(this.cwd),this.stagedFiles=await Rt({cwd:this.workTree,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await Nt(this.workTree),this.snapshotMergeState(),this.intentToAddPaths=await At(this.workTree),this.intentToAddPaths.length>0&&await Pt(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await Lt(this.workTree):this.partiallyStaged.length>0&&this.warnings.push("Running with --no-stash on partially-staged files — unstaged deltas will be captured to a patch, but if re-applying the patch fails after tasks run the changes cannot be recovered."),this.shouldHideAll?this.hideAllStashSha=await Ht(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await ge(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await It(this.workTree),this.preTaskUntracked=new Set(await we(this.workTree))}async applyModifications({autoStage:t=!1}={}){if(this.stagedFiles.length===0)return;const r=this.stagedFiles.map(s=>B(this.workTree,s));if(await _t(r,{cwd:this.workTree}),t){const s=(await we(this.workTree)).filter(n=>!this.preTaskUntracked.has(n));if(s.length>0){const n=`${s.join("\0")}\0`;await g(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:n})}}if(this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await ge(this.workTree)}indexTreeChanged(){return this.preTaskIndexTree.length>0&&this.postTaskIndexTree.length>0&&this.preTaskIndexTree!==this.postTaskIndexTree}postTaskIndexMatchesHead(){return this.postTaskIndexTree.length>0&&this.headTree.length>0&&this.postTaskIndexTree===this.headTree}async restoreUnstagedChanges(){if(this.revertApplied||this.patch===null||this.shouldHideAll)return;const t=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let r;try{await g(t,{cwd:this.workTree,input:this.patch});return}catch(s){r=s instanceof D?s.stderr:String(s)}try{await g([...t,"--3way"],{cwd:this.workTree,input:this.patch})}catch(s){const n=s instanceof D&&s.stderr?s.stderr:String(s);throw new fe(`Failed to re-apply unstaged changes after running tasks. Original changes remain in the backup stash — recover with \`git stash list\` and \`git stash apply\`.
12
- First attempt: ${r??"(no stderr)"}
13
- Second attempt: ${n}`,{cause:s})}}async revert(){if(this.backupStashSha!==null){try{await qt(this.workTree,this.backupStashSha)}catch(t){throw new fe("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:t})}if(await ve(this.workTree,this.backupStashSha),this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(t){if(this.restoreMergeState(),this.hideAllStashSha!==null)try{await Ut(this.workTree,this.hideAllStashSha)}catch{}t&&this.backupStashSha!==null&&!this.revertApplied&&await ve(this.workTree,this.backupStashSha)}recoveryHint(){return this.backupStashSha===null?null:`Backup stash is preserved (sha ${this.backupStashSha.slice(0,7)}) — restore with: git stash apply --index ${this.backupStashSha}`}async hideUnstagedChanges(){const t=new Set(this.stagedFiles.map(s=>B(this.workTree,s))),r=this.shouldHideUnstaged?[...t]:this.shouldHidePartial?this.partiallyStaged.filter(s=>t.has(s)):[];r.length!==0&&(this.patch=await Ft(r,{cwd:this.workTree}),this.patch!==null&&await Gt(r,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(t=>{const r=re(this.gitDir,t);return oe(r)?{body:De(r),existed:!0,name:t}:{body:null,existed:!1,name:t}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const t of this.merge){const r=re(this.gitDir,t.name);try{t.existed&&t.body!==null?Be(r,t.body):oe(r)&&Le(r)}catch{}}}}var Kt=Object.defineProperty,K=f((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"r");const Pe=K(e=>e.includes("/"),"isPathStyle"),U=K((e,t)=>t?e.toLowerCase():e,"normalizeForMatch"),Yt=K((e,t,r,s={})=>{const n=Pe(e),i=s.caseInsensitive===!0,o=U(e,i),a=[];for(const c of t){const d=n?B(r,c):Se(c);xe(o,U(d,i))&&a.push(c)}return a},"matchFiles"),Qt=K((e,t,r,s={})=>{if(!t||t.length===0)return[...e];const n=s.caseInsensitive===!0;return e.filter(i=>{for(const o of t){const a=Pe(o)?B(r,i):Se(i),c=U(o,n);if(xe(c,U(a,n)))return!1}return!0})},"applyIgnore");var Jt=Object.defineProperty,L=f((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"g");const Xt=L(e=>{switch(e){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},"colorForStatus"),ye=L(e=>{if(e==="running")return b(ze,{type:"dots"});const t=e==="failed"?Ce:e==="skipped"?q:e==="success"?Ie:q;return b($,{color:Xt(e),children:t})},"iconForStatus"),ke=L(({state:e,tick:t,verbose:r})=>C(M,{flexDirection:"column",children:[[...e.patterns.values()].map(s=>C(M,{flexDirection:"column",children:[C(M,{children:[ye(s.status),C($,{children:[" ",s.title]})]}),[...s.commands.values()].map(n=>C(M,{flexDirection:"column",marginLeft:2,children:[C(M,{children:[ye(n.status),C($,{children:[" ",n.title," "]}),n.status!=="pending"&&n.status!=="running"?C($,{color:"gray",children:["(",n.durationMs,"ms)"]}):null]}),r&&n.output?b(M,{flexDirection:"column",marginLeft:2,children:n.output.split(/\r?\n/).slice(0,20).map((i,o)=>b($,{color:"gray",children:i},`${n.id}-line-${o}`))}):null,n.status==="failed"&&n.error?b(M,{marginLeft:2,children:b($,{color:"red",children:n.error.message})}):null]},n.id))]},s.id)),e.infoMessages.map((s,n)=>b($,{color:"gray",children:s},`info-${n}`)),e.warnMessages.map((s,n)=>b($,{color:"yellow",children:s},`warn-${n}`)),e.errorMessages.map(({message:s},n)=>b($,{color:"red",children:s},`err-${n}`))]}),"App"),Zt=L((e={})=>{const t=e.verbose===!0,r={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let s=0;const n=Ue(b(ke,{state:r,tick:s,verbose:t}),{exitOnCtrlC:!1,stdout:process.stderr}),i=L(()=>{s+=1,n.rerender(b(ke,{state:r,tick:s,verbose:t}))},"refresh");return{commandEnd({commandId:o,durationMs:a,error:c,output:d,patternId:u,status:l}){const p=r.patterns.get(u)?.commands.get(o);p&&(p.status=l,p.durationMs=a,p.output=d,p.error=c,i())},commandStart({commandId:o,patternId:a}){const c=r.patterns.get(a)?.commands.get(o);c&&(c.status="running",i())},error({error:o,message:a}){r.errorMessages.push({error:o,message:a}),i()},info({message:o}){r.infoMessages.push(o),i()},patternEnd({patternId:o,status:a}){const c=r.patterns.get(o);c&&(c.status=a,i())},patternStart({patternId:o}){const a=r.patterns.get(o);a&&(a.status="running",i())},start({patterns:o}){r.started=!0;for(const a of o){const c=new Map;for(const d of a.commands)c.set(d.id,{durationMs:0,id:d.id,status:"pending",title:d.title});r.patterns.set(a.id,{commands:c,id:a.id,status:"pending",title:a.title})}i()},async stop(){n.unmount(),await n.waitUntilExit()},warn({message:o}){r.warnMessages.push(o),i()}}},"createInkRenderer");var er=Object.defineProperty,ee=f((e,t)=>er(e,"name",{value:t,configurable:!0}),"a$1");const be=ee((e={})=>{const{quiet:t=!1,verbose:r=!1}=e,s=new Map,n=new Map,i=ee(a=>{t||process.stderr.write(`${a}
14
- `)},"print"),o=ee(a=>{switch(a){case"failed":return X(Ce);case"running":return J(">");case"skipped":return ce(q);case"success":return Ve(Ie);default:return I(q)}},"iconFor");return{commandEnd({commandId:a,durationMs:c,error:d,output:u,status:l}){const p=n.get(a)??a,w=I(`(${c}ms)`);if(i(` ${o(l)} ${p} ${w}`),l==="failed"&&d&&i(I(d.message)),(l==="failed"||r)&&u&&u.trim().length>0)for(const h of u.split(/\r?\n/))i(` ${I(h)}`)},commandStart({commandId:a}){if(!r)return;const c=n.get(a)??a;i(` ${I("…")} ${c}`)},error({error:a,message:c}){t?process.stderr.write(`${X(c)}
15
- `):i(X(c)),a?.stack&&(r||!t)&&process.stderr.write(`${I(a.stack)}
16
- `)},info({message:a}){i(I(a))},patternEnd({patternId:a,status:c}){const d=s.get(a)??a;i(`${o(c)} ${d}`)},patternStart({patternId:a}){const c=s.get(a)??a;i(`${J(">")} ${c}`)},start({patterns:a}){if(a.length===0){i(I("No staged files matched any pattern."));return}const c=new Set(a.flatMap(d=>d.files)).size;i(`${J(">")} Running staged tasks on ${c} file${c===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const d of a){s.set(d.id,d.title);for(const u of d.commands)n.set(u.id,u.title)}},stop(){},warn({message:a}){i(ce(a))}}},"createPlainRenderer");var tr=Object.defineProperty,rr=f((e,t)=>tr(e,"name",{value:t,configurable:!0}),"t");const sr=rr(async e=>{const{env:t}=process;if(e.debug===!0||e.quiet===!0||t.NODE_ENV==="test"||t.TERM==="dumb"||t.CI!==void 0||!process.stderr.isTTY)return be({quiet:e.quiet,verbose:e.verbose});try{return Zt({verbose:e.verbose})}catch{return be({quiet:e.quiet,verbose:e.verbose})}},"pickRenderer");var nr=Object.defineProperty,_=f((e,t)=>nr(e,"name",{value:t,configurable:!0}),"a");const te=_(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask"),ar=_(async e=>{let t=0,r=0;const s=_(()=>(t+=1,`pattern-${t}`),"nextPatternId"),n=_(()=>(r+=1,`cmd-${r}`),"nextCommandId"),i=_(async(a,c,d)=>{if(typeof a=="string"){d.push({command:a,files:c,id:n(),source:"string",title:a});return}if(Array.isArray(a)){for(const u of a)await i(u,c,d);return}if(typeof a=="function"){const u=await a([...c]);if(typeof u=="string"){d.push({command:u,files:c,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const l of u)if(typeof l=="string")d.push({command:l,files:c,id:n(),source:"function",title:l});else if(te(l))d.push({files:c,id:n(),run:l.task,source:"custom",title:l.title});else throw new T("Task function returned an array with an unsupported entry — expected strings or { title, task }.");return}if(te(u)){d.push({files:c,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], or { title, task }.")}if(te(a)){d.push({files:c,id:n(),run:a.task,source:"custom",title:a.title});return}throw new T("Unsupported task value — expected string, string[], function, or { title, task }.")},"expandTask"),o=[];for(const[a,c]of Object.entries(e.config)){const d=Yt(a,e.files,e.cwd,{caseInsensitive:e.caseInsensitive===!0});if(d.length===0)continue;const u=e.relative?d.map(p=>B(e.cwd,p)):d,l=[];await i(c,u,l),l.length!==0&&o.push({commands:l,files:u,id:s(),pattern:a,title:`${a} — ${d.length} file${d.length===1?"":"s"}`})}return o},"buildTaskGraph");var ir=Object.defineProperty,Y=f((e,t)=>ir(e,"name",{value:t,configurable:!0}),"c");const or=Y(e=>{const t=[];let r="",s=!1,n=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(o===void 0)break;if(o==="\\"&&!s&&i+1<e.length){const a=e[i+1];if(a!==void 0){n&&a!=='"'&&a!=="\\"&&(r+=o),r+=a,i+=1;continue}}if(o==='"'&&!s){n=!n;continue}if(o==="'"&&!n){s=!s;continue}if(!s&&!n&&/\s/.test(o)){r.length>0&&(t.push(r),r="");continue}r+=o}if(s||n)throw new T(`Unterminated ${s?"single":"double"} quote in command: ${e}`);return r.length>0&&t.push(r),t},"parseCommandString"),Re=process.platform==="win32"?28e3:131072,cr=Y((e,t,r)=>{const s=[];let n=[],i=t;const o=r<=0?Re:r;for(const a of e){const c=Buffer.byteLength(a)+1;n.length>0&&i+c>o&&(s.push(n),n=[],i=t),n.push(a),i+=c}return n.length>0&&s.push(n),s},"chunkFiles"),dr=Y(async(e,t,r)=>{const s=or(e);if(s.length===0)throw new O(e,"Empty command for staged task.");const[n,...i]=s;if(n===void 0)throw new O(e,"Empty command for staged task.");const o=Buffer.byteLength(n)+i.reduce((u,l)=>u+Buffer.byteLength(l)+1,0),a=cr(t,o,r.maxArgLength??Re),c=Date.now(),d=[];for(const u of a){if(r.signal?.aborted===!0)throw new O(e,"Task aborted by earlier failure.");const l=$e(n,[...i,...u],{nodeOptions:{cwd:r.cwd,env:lr(r.env,r.cwd),killSignal:r.killSignal??"SIGTERM",stdio:["ignore","pipe","pipe"]},...r.signal===void 0?{}:{signal:r.signal}}),p=await l,w=[p.stdout,p.stderr].filter(m=>m.length>0).join(`
17
- `);w.length>0&&d.push(w);const h=l.process?.signalCode??null;if(l.aborted||h!==null||p.exitCode===void 0){const m=l.aborted?"Task aborted by earlier failure.":h===null?w.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new O(e,m)}if(p.exitCode!==0)throw new O(e,w.trim()||`Exit code ${p.exitCode} from ${n}`)}return{durationMs:Date.now()-c,output:d.join(`
18
- `)}},"execCommand"),lr=Y((e,t)=>{const r={...process.env};process.stderr.isTTY&&r.FORCE_COLOR===void 0&&r.NO_COLOR===void 0&&(r.FORCE_COLOR="1");const s=e?{...r,...e}:r;return We(s,t)},"buildTaskEnv");var ur=Object.defineProperty,j=f((e,t)=>ur(e,"name",{value:t,configurable:!0}),"o");const fr=j(async(e,t,r)=>{const s=pr(r.concurrent,e.length),n=[],i=new AbortController;let o=!1,a=0;const c=j(()=>{o||(o=!0,r.continueOnError||i.abort())},"cancel");r.externalSignal&&(r.externalSignal.aborted?c():r.externalSignal.addEventListener("abort",()=>{c()},{once:!0}));const d=j(h=>{for(const m of h.commands)t.commandEnd({commandId:m.id,durationMs:0,patternId:h.id,status:"skipped"})},"emitSkippedCommands"),u=j(async h=>{if(o){d(h),t.patternEnd({patternId:h.id,status:"skipped"});return}t.patternStart({patternId:h.id});let m="success";for(const y of h.commands){if(o){t.commandEnd({commandId:y.id,durationMs:0,patternId:h.id,status:"skipped"}),m=m==="success"?"skipped":m;continue}t.commandStart({commandId:y.id,patternId:h.id});const k=await hr(y,r,i.signal),S=k.status==="failed"&&i.signal.aborted?{...k,status:"skipped"}:k;if(t.commandEnd({commandId:y.id,durationMs:S.durationMs,error:S.error,output:S.output,patternId:h.id,status:S.status}),S.status==="failed"){n.push(y.title),m="failed",c();break}if(S.status==="skipped"){m=m==="success"?"skipped":m;break}}t.patternEnd({patternId:h.id,status:m})},"runOne"),l=j(async()=>{for(;a<e.length;){const h=e[a];a+=1,h&&await u(h)}},"pickNext"),p=[];for(let h=0;h<Math.min(s,e.length);h+=1)p.push(l());await Promise.all(p);const w=r.externalSignal?.aborted===!0;return{failedCommands:n,success:n.length===0&&!w}},"runTasks"),hr=j(async(e,t,r)=>{const s=Date.now();try{if(e.source==="custom"&&e.run)return await e.run([...e.files]),{durationMs:Date.now()-s,status:"success"};if(e.command){const n=await dr(e.command,e.files,{cwd:t.cwd,killSignal:t.killSignal,maxArgLength:t.maxArgLength,signal:r});return{durationMs:n.durationMs,output:t.verbose?n.output:void 0,status:"success"}}return{durationMs:Date.now()-s,error:new O(e.title,"Command has no invocation target."),status:"failed"}}catch(n){const i=n instanceof Error?n:new Error(String(n));return{durationMs:Date.now()-s,error:i,output:i instanceof O?i.message:void 0,status:"failed"}}},"runCommand"),pr=j((e,t)=>{if(e===!1)return 1;if(e===!0){const s=Math.max(1,typeof de=="function"?de():4);return Math.min(Math.max(1,t),s)}const r=Math.floor(e);return r>0?r:1},"concurrencyLimit");var gr=Object.defineProperty,se=f((e,t)=>gr(e,"name",{value:t,configurable:!0}),"u");const mr=!0,wr=se(e=>{try{return!at(e)}catch{return!1}},"detectCaseInsensitive"),vr=se(async(e={})=>{const t=e.cwd??process.cwd(),r=await sr(e),s=await Tt(e);typeof s!="function"&&he(s);const n=new Wt({...e,cwd:t}),i=new AbortController;let o=!1;const a=se(l=>{if(o){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,l);return}o=!0,r.warn({message:`Received ${l} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()},"onInterrupt");process.on("SIGINT",a),process.on("SIGTERM",a);let c={failedCommands:[],ranTasks:!1,success:!0},d=!1,u=!1;try{await n.prepare(),d=!0;for(const k of n.warnings)r.warn({message:k});if(n.stagedFiles.length===0)return e.allowEmpty!==!0&&r.info({message:"No staged files found."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const l=wr(t),p=Qt(n.stagedFiles,e.ignore,t,{caseInsensitive:l});if(p.length===0&&n.stagedFiles.length>0)return r.info({message:"Every staged file was excluded by the `ignore` list."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const w=typeof s=="function"?he(await s([...p])):s,h=await ar({caseInsensitive:l,config:w,cwd:t,files:p,relative:e.relative});if(r.start({patterns:h}),h.length===0)return r.info({message:"No staged files matched any pattern."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:m,success:y}=await fr(h,r,{concurrent:e.concurrent??mr,continueOnError:e.continueOnError===!0,cwd:t,externalSignal:i.signal,killSignal:e.killSignal,maxArgLength:e.maxArgLength,verbose:e.verbose});if(c={failedCommands:m,ranTasks:!0,success:y},y){if(e.diff===void 0&&(await n.applyModifications({autoStage:e.autoStage===!0}),e.failOnChanges===!0&&n.indexTreeChanged()&&(r.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),c={failedCommands:[...m],ranTasks:!0,success:!1}),e.allowEmpty!==!0&&n.postTaskIndexMatchesHead()))throw new lt("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else if(e.revert===!0)r.info({message:"Reverting working tree from backup stash."}),await n.revert();else{const k=n.recoveryHint();k&&r.warn({message:k})}return await n.restoreUnstagedChanges(),u=c.success,c}catch(l){const p=l instanceof Error?l.message:String(l),w=l instanceof Error?l:new Error(p);if(r.error({error:w,message:p}),l instanceof A)return{failedCommands:c.failedCommands,ranTasks:c.ranTasks,success:!1};throw l}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),d)try{await n.cleanup(u)}catch(l){r.error({error:l,message:"Cleanup failed."})}await r.stop()}},"runStaged");var yr=Object.defineProperty,kr=f((e,t)=>yr(e,"name",{value:t,configurable:!0}),"n");const br="VIS_STAGED_CONCURRENT",Te=kr(e=>{const t=e.trim();if(t==="true"||t==="")return!0;if(t==="false")return!1;const r=Number(t);return Number.isNaN(r)?!0:r},"parseConcurrent");var Tr=Object.defineProperty,H=f((e,t)=>Tr(e,"name",{value:t,configurable:!0}),"d");const Sr=H((e,t)=>{const r={};t!==void 0&&(r.config=t);const s=H(v=>e[v]===void 0?void 0:!!e[v],"readBool"),n=H(v=>{const Q=e[v];return typeof Q=="string"&&Q.length>0?Q:void 0},"readString"),i=s("allow-empty");i!==void 0&&(r.allowEmpty=i);const o=s("auto-stage");o!==void 0&&(r.autoStage=o);const a=s("continue-on-error");a!==void 0&&(r.continueOnError=a);const c=s("debug");c!==void 0&&(r.debug=c);const d=s("fail-on-changes");d!==void 0&&(r.failOnChanges=d);const u=s("hide-partially-staged");u!==void 0&&(r.hidePartiallyStaged=u);const l=s("hide-unstaged");l!==void 0&&(r.hideUnstaged=l);const p=s("quiet");p!==void 0&&(r.quiet=p);const w=s("relative");w!==void 0&&(r.relative=w);const h=s("revert");h!==void 0&&(r.revert=h);const m=s("stash");m!==void 0&&(r.stash=m);const y=s("verbose");y!==void 0&&(r.verbose=y);const k=n("cwd");k!==void 0&&(r.cwd=k);const S=n("diff");S!==void 0&&(r.diff=S);const ie=n("diff-filter");if(ie!==void 0&&(r.diffFilter=ie),s("force-kill")===!0&&(r.killSignal="SIGKILL"),e.concurrent===void 0){const v=process.env[br];v!==void 0&&(r.concurrent=Te(v.trim()))}else{const{concurrent:v}=e;r.concurrent=Te(typeof v=="string"?v:typeof v=="number"||typeof v=="boolean"?String(v):"")}return r},"buildRunOptions"),Gr=H(async({options:e,visConfig:t})=>{const r=(t??{}).staged;if(!r)throw new Error(`No "staged" config found in vis.config.ts. Add one:
9
+ Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},"resolveConfig"),fe=V(e=>{if(typeof e!="object"||e===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const t=Object.entries(e);if(t.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[s,r]of t){if(!s||s.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");Ee(s,r)}return e},"validateConfig"),Ee=V((e,t)=>{if(typeof t=="string"){if(t.trim()==="")throw new T(`Task for "${e}" is an empty string.`);return}if(Array.isArray(t)){if(t.length===0)throw new T(`Task array for "${e}" is empty.`);for(const s of t)Ee(e,s);return}if(typeof t!="function"&&!Tt(t))throw new T(`Invalid task for "${e}" — expected string, string[], function, or { title, task } object.`)},"validateTask"),Tt=V(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask");var St=Object.defineProperty,x=f((e,t)=>St(e,"name",{value:t,configurable:!0}),"r$2");const he=2048,g=x(async(e,t)=>{const s=t.input===void 0?void 0:typeof t.input=="string"?t.input:t.input.toString("utf8"),r=await Se("git",[...e],{nodeOptions:{cwd:t.cwd,env:t.env?{...process.env,...t.env}:void 0,stdio:s===void 0?["ignore","pipe","pipe"]:["pipe","pipe","pipe"]},stdin:s}),n=typeof r.exitCode=="number"?r.exitCode:1;if(n!==0&&!t.lenient){const{stderr:i}=r,o=i.length>he?`${i.slice(0,he)}…`:i;throw new _(`git ${e.join(" ")} failed with exit code ${n}: ${o.trim()}`,i)}return{exitCode:n,stderr:r.stderr,stdout:r.stdout}},"git"),P=x(async(e,t)=>{const{stdout:s}=await g(e,t);return s.trim()},"gitOut"),$t=x(async e=>{const t=await g(["rev-parse","--is-inside-work-tree"],{cwd:e,lenient:!0});return t.exitCode===0&&t.stdout.trim()==="true"},"isGitRepo"),xt=x(async e=>P(["rev-parse","--absolute-git-dir"],{cwd:e}),"getGitDirectory"),Me=x(async e=>P(["rev-parse","--show-toplevel"],{cwd:e}),"getWorkTree"),pe=x(async e=>P(["write-tree"],{cwd:e}),"writeIndexTree"),Ct=x(async e=>{const t=await g(["rev-parse","HEAD^{tree}"],{cwd:e,lenient:!0});return t.exitCode===0?t.stdout.trim():""},"headTreeSha"),N={major:2,minor:32},It=x(e=>{const t=/git version (\d+)\.(\d+)/.exec(e);if(!t)return null;const s=Number.parseInt(t[1]??"",10),r=Number.parseInt(t[2]??"",10);return Number.isNaN(s)||Number.isNaN(r)?null:{major:s,minor:r}},"parseGitVersion"),jt=x(async e=>{const t=It(await P(["--version"],{cwd:e}));if(t!==null&&(t.major<N.major||t.major===N.major&&t.minor<N.minor))throw new _(`Git ${N.major}.${N.minor} or newer is required; found ${t.major}.${t.minor}.`)},"assertGitVersion");var Et=Object.defineProperty,I=f((e,t)=>Et(e,"name",{value:t,configurable:!0}),"a$2");const Mt="ACMR",ge=500,Ot=I(async e=>{const{stdout:t}=await g(["diff-files","--raw","-z"],{cwd:e}),s=t.split("\0").filter(n=>n.length>0),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(!i?.startsWith(":"))continue;const o=i.slice(1).split(" "),a=o[3],c=o[4],d=s[n+1];n+=1,c==="A"&&a!==void 0&&/^0+$/.test(a)&&d!==void 0&&r.push(d)}return r},"getIntentToAddPaths"),me=I(async e=>{const{stdout:t}=await g(["ls-files","--others","--exclude-standard","-z"],{cwd:e});return t.split("\0").filter(s=>s.length>0)},"getUntrackedFiles"),At=I(async(e,t)=>{if(e.length===0)return;const s=`${e.join("\0")}\0`;await g(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"removeFromIndex"),Pt=I(async e=>{const t=e.diffFilter??Mt,s=e.diff===void 0?["diff","--name-only","-z",`--diff-filter=${t}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${t}`,...e.diff.split(/\s+/).filter(Boolean)],{stdout:r}=await g(s,{cwd:e.cwd}),n=r.split("\0").filter(o=>o.length>0);if(n.length===0)return[];const i=e.workTree??await Me(e.cwd);return n.map(o=>Be(o)?o:te(i,o))},"getFiles"),Rt=I(async(e,t)=>{if(e.length===0)return null;const s=[];for(let i=0;i<e.length;i+=ge){const o=e.slice(i,i+ge),{stdout:a}=await g(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...o],{cwd:t.cwd});a.length>0&&s.push(a)}if(s.length===0)return null;const r=s.join(""),n=r.endsWith(`
10
+ `)?r:`${r}
11
+ `;return Buffer.from(n,"utf8")},"capturePatch"),Ft=I(async e=>{const{stdout:t}=await g(["status","--porcelain=v1","-z"],{cwd:e}),s=t.split("\0"),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(i===void 0||i.length<4)continue;const o=i.charAt(0),a=i.charAt(1),c=i.slice(3),d=o==="R"||o==="C"||a==="R"||a==="C";o!==" "&&o!=="?"&&a!==" "&&a!=="?"&&r.push(c),d&&(n+=1)}return r},"getPartiallyStagedFiles"),Nt=I(async(e,t)=>{if(e.length===0)return;const s=`${e.join("\0")}\0`;await g(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"checkoutPaths"),Gt=I(async(e,t)=>{if(await g(["update-index","--again"],{cwd:t.cwd,lenient:!0}),e.length===0)return;const s=`${e.join("\0")}\0`;await g(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"updateIndexAgain");var _t=Object.defineProperty,A=f((e,t)=>_t(e,"name",{value:t,configurable:!0}),"r$1");const Dt="vis_staged_automatic_backup",Oe=A(()=>`${Dt}-${process.pid}-${Date.now()}-${He(3).toString("hex")}`,"buildMessage"),Lt=A(async e=>{const t=await P(["stash","create"],{cwd:e});return t.length===0?null:(await g(["stash","store","-m",Oe(),t],{cwd:e}),t)},"createBackupStash"),Bt=A(async e=>{const t=Oe(),{exitCode:s,stdout:r}=await g(["stash","push","--keep-index","--include-untracked","--quiet","-m",t],{cwd:e,lenient:!0});if(s!==0)return null;const n=r.trim();return n.length>0&&/no local changes/i.test(n)?null:P(["rev-parse","stash@{0}"],{cwd:e})},"createHideAllStash"),ne=A(async(e,t)=>{const{exitCode:s,stdout:r}=await g(["reflog","--format=%H %gd","refs/stash"],{cwd:e,lenient:!0});if(s!==0)return null;for(const n of r.split(/\r?\n/)){const[i,o]=n.split(/\s+/,2);if(i===t&&o!==void 0)return o}return null},"findStashRefBySha"),we=A(async(e,t)=>{if(t===null)return;const s=await ne(e,t);s!==null&&await g(["stash","drop","--quiet",s],{cwd:e})},"dropBackupStash"),Ht=A(async(e,t)=>{if(t===null)throw new le("Backup stash was not found — can't revert working tree.");const s=await ne(e,t);if(s===null)throw new le(`Backup stash ${t} is no longer reachable — can't revert working tree.`);await g(["reset","--hard","HEAD"],{cwd:e}),await g(["stash","apply","--index","--quiet",s],{cwd:e})},"applyBackupStash"),qt=A(async(e,t)=>{if(t===null)return;const s=await ne(e,t);s!==null&&await g(["stash","pop","--quiet",s],{cwd:e})},"popHideAllStash");var Ut=Object.defineProperty,zt=f((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"l");class Vt{static{f(this,"GitWorkflow")}static{zt(this,"GitWorkflow")}stagedFiles=[];partiallyStaged=[];workTree="";gitDir="";preTaskIndexTree="";postTaskIndexTree="";headTree="";revertApplied=!1;warnings=[];cwd;options;patch=null;backupStashSha=null;merge=[];shouldStash;shouldHidePartial;shouldHideUnstaged;shouldHideAll;hideAllStashSha=null;intentToAddPaths=[];preTaskUntracked=new Set;constructor(t){this.cwd=t.cwd??process.cwd(),this.options=t,this.shouldStash=t.stash!==!1&&t.diff===void 0,this.shouldHidePartial=t.hidePartiallyStaged!==!1,this.shouldHideUnstaged=t.hideUnstaged===!0,this.shouldHideAll=t.hideAll===!0}async prepare(){if(!await $t(this.cwd))throw new _(`Not a git repository: ${this.cwd}`);await jt(this.cwd),this.workTree=await Me(this.cwd),this.gitDir=await xt(this.cwd),this.stagedFiles=await Pt({cwd:this.workTree,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await Ft(this.workTree),this.snapshotMergeState(),this.intentToAddPaths=await Ot(this.workTree),this.intentToAddPaths.length>0&&await At(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await Lt(this.workTree):this.partiallyStaged.length>0&&this.warnings.push("Running with --no-stash on partially-staged files — unstaged deltas will be captured to a patch, but if re-applying the patch fails after tasks run the changes cannot be recovered."),this.shouldHideAll?this.hideAllStashSha=await Bt(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await pe(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await Ct(this.workTree),this.preTaskUntracked=new Set(await me(this.workTree))}async applyModifications({autoStage:t=!1}={}){if(this.stagedFiles.length===0)return;const s=this.stagedFiles.map(r=>D(this.workTree,r));if(await Gt(s,{cwd:this.workTree}),t){const r=(await me(this.workTree)).filter(n=>!this.preTaskUntracked.has(n));if(r.length>0){const n=`${r.join("\0")}\0`;await g(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:n})}}if(this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await pe(this.workTree)}indexTreeChanged(){return this.preTaskIndexTree.length>0&&this.postTaskIndexTree.length>0&&this.preTaskIndexTree!==this.postTaskIndexTree}postTaskIndexMatchesHead(){return this.postTaskIndexTree.length>0&&this.headTree.length>0&&this.postTaskIndexTree===this.headTree}async restoreUnstagedChanges(){if(this.revertApplied||this.patch===null||this.shouldHideAll)return;const t=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let s;try{await g(t,{cwd:this.workTree,input:this.patch});return}catch(r){s=r instanceof _?r.stderr:String(r)}try{await g([...t,"--3way"],{cwd:this.workTree,input:this.patch})}catch(r){const n=r instanceof _&&r.stderr?r.stderr:String(r);throw new ue(`Failed to re-apply unstaged changes after running tasks. Original changes remain in the backup stash — recover with \`git stash list\` and \`git stash apply\`.
12
+ First attempt: ${s??"(no stderr)"}
13
+ Second attempt: ${n}`,{cause:r})}}async revert(){if(this.backupStashSha!==null){try{await Ht(this.workTree,this.backupStashSha)}catch(t){throw new ue("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:t})}if(await we(this.workTree,this.backupStashSha),this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(t){if(this.restoreMergeState(),this.hideAllStashSha!==null)try{await qt(this.workTree,this.hideAllStashSha)}catch{}t&&this.backupStashSha!==null&&!this.revertApplied&&await we(this.workTree,this.backupStashSha)}recoveryHint(){return this.backupStashSha===null?null:`Backup stash is preserved (sha ${this.backupStashSha.slice(0,7)}) — restore with: git stash apply --index ${this.backupStashSha}`}async hideUnstagedChanges(){const t=new Set(this.stagedFiles.map(r=>D(this.workTree,r))),s=this.shouldHideUnstaged?[...t]:this.shouldHidePartial?this.partiallyStaged.filter(r=>t.has(r)):[];s.length!==0&&(this.patch=await Rt(s,{cwd:this.workTree}),this.patch!==null&&await Nt(s,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(t=>{const s=te(this.gitDir,t);return ie(s)?{body:_e(s),existed:!0,name:t}:{body:null,existed:!1,name:t}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const t of this.merge){const s=te(this.gitDir,t.name);try{t.existed&&t.body!==null?De(s,t.body):ie(s)&&Le(s)}catch{}}}}var Wt=Object.defineProperty,W=f((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"r");const Ae=W(e=>e.includes("/"),"isPathStyle"),q=W((e,t)=>t?e.toLowerCase():e,"normalizeForMatch"),Kt=W((e,t,s,r={})=>{const n=Ae(e),i=r.caseInsensitive===!0,o=q(e,i),a=[];for(const c of t){const d=n?D(s,c):Te(c);$e(o,q(d,i))&&a.push(c)}return a},"matchFiles"),Yt=W((e,t,s,r={})=>{if(!t||t.length===0)return[...e];const n=r.caseInsensitive===!0;return e.filter(i=>{for(const o of t){const a=Ae(o)?D(s,i):Te(i),c=q(o,n);if($e(c,q(a,n)))return!1}return!0})},"applyIgnore");var Qt=Object.defineProperty,L=f((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"g");const Jt=L(e=>{switch(e){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},"colorForStatus"),ve=L(e=>{if(e==="running")return w.jsx(Ue,{type:"dots"});const t=e==="failed"?xe:e==="skipped"?H:e==="success"?Ce:H;return w.jsx($,{color:Jt(e),children:t})},"iconForStatus"),ye=L(({state:e,tick:t,verbose:s})=>w.jsxs(j,{flexDirection:"column",children:[[...e.patterns.values()].map(r=>w.jsxs(j,{flexDirection:"column",children:[w.jsxs(j,{children:[ve(r.status),w.jsxs($,{children:[" ",r.title]})]}),[...r.commands.values()].map(n=>w.jsxs(j,{flexDirection:"column",marginLeft:2,children:[w.jsxs(j,{children:[ve(n.status),w.jsxs($,{children:[" ",n.title," "]}),n.status!=="pending"&&n.status!=="running"?w.jsxs($,{color:"gray",children:["(",n.durationMs,"ms)"]}):null]}),s&&n.output?w.jsx(j,{flexDirection:"column",marginLeft:2,children:n.output.split(/\r?\n/).slice(0,20).map((i,o)=>w.jsx($,{color:"gray",children:i},`${n.id}-line-${o}`))}):null,n.status==="failed"&&n.error?w.jsx(j,{marginLeft:2,children:w.jsx($,{color:"red",children:n.error.message})}):null]},n.id))]},r.id)),e.infoMessages.map((r,n)=>w.jsx($,{color:"gray",children:r},`info-${n}`)),e.warnMessages.map((r,n)=>w.jsx($,{color:"yellow",children:r},`warn-${n}`)),e.errorMessages.map(({message:r},n)=>w.jsx($,{color:"red",children:r},`err-${n}`))]}),"App"),Xt=L((e={})=>{const t=e.verbose===!0,s={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let r=0;const n=qe(w.jsx(ye,{state:s,tick:r,verbose:t}),{exitOnCtrlC:!1,stdout:process.stderr}),i=L(()=>{r+=1,n.rerender(w.jsx(ye,{state:s,tick:r,verbose:t}))},"refresh");return{commandEnd({commandId:o,durationMs:a,error:c,output:d,patternId:u,status:l}){const p=s.patterns.get(u)?.commands.get(o);p&&(p.status=l,p.durationMs=a,p.output=d,p.error=c,i())},commandStart({commandId:o,patternId:a}){const c=s.patterns.get(a)?.commands.get(o);c&&(c.status="running",i())},error({error:o,message:a}){s.errorMessages.push({error:o,message:a}),i()},info({message:o}){s.infoMessages.push(o),i()},patternEnd({patternId:o,status:a}){const c=s.patterns.get(o);c&&(c.status=a,i())},patternStart({patternId:o}){const a=s.patterns.get(o);a&&(a.status="running",i())},start({patterns:o}){s.started=!0;for(const a of o){const c=new Map;for(const d of a.commands)c.set(d.id,{durationMs:0,id:d.id,status:"pending",title:d.title});s.patterns.set(a.id,{commands:c,id:a.id,status:"pending",title:a.title})}i()},async stop(){n.unmount(),await n.waitUntilExit()},warn({message:o}){s.warnMessages.push(o),i()}}},"createInkRenderer");var Zt=Object.defineProperty,Z=f((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"a$1");const ke=Z((e={})=>{const{quiet:t=!1,verbose:s=!1}=e,r=new Map,n=new Map,i=Z(a=>{t||process.stderr.write(`${a}
14
+ `)},"print"),o=Z(a=>{switch(a){case"failed":return J(xe);case"running":return Q(">");case"skipped":return oe(H);case"success":return ze(Ce);default:return C(H)}},"iconFor");return{commandEnd({commandId:a,durationMs:c,error:d,output:u,status:l}){const p=n.get(a)??a,v=C(`(${c}ms)`);if(i(` ${o(l)} ${p} ${v}`),l==="failed"&&d&&i(C(d.message)),(l==="failed"||s)&&u&&u.trim().length>0)for(const h of u.split(/\r?\n/))i(` ${C(h)}`)},commandStart({commandId:a}){if(!s)return;const c=n.get(a)??a;i(` ${C("…")} ${c}`)},error({error:a,message:c}){t?process.stderr.write(`${J(c)}
15
+ `):i(J(c)),a?.stack&&(s||!t)&&process.stderr.write(`${C(a.stack)}
16
+ `)},info({message:a}){i(C(a))},patternEnd({patternId:a,status:c}){const d=r.get(a)??a;i(`${o(c)} ${d}`)},patternStart({patternId:a}){const c=r.get(a)??a;i(`${Q(">")} ${c}`)},start({patterns:a}){if(a.length===0){i(C("No staged files matched any pattern."));return}const c=new Set(a.flatMap(d=>d.files)).size;i(`${Q(">")} Running staged tasks on ${c} file${c===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const d of a){r.set(d.id,d.title);for(const u of d.commands)n.set(u.id,u.title)}},stop(){},warn({message:a}){i(oe(a))}}},"createPlainRenderer");var es=Object.defineProperty,ts=f((e,t)=>es(e,"name",{value:t,configurable:!0}),"t");const ss=ts(async e=>{const{env:t}=process;if(e.debug===!0||e.quiet===!0||t.NODE_ENV==="test"||t.TERM==="dumb"||t.CI!==void 0||!process.stderr.isTTY)return ke({quiet:e.quiet,verbose:e.verbose});try{return Xt({verbose:e.verbose})}catch{return ke({quiet:e.quiet,verbose:e.verbose})}},"pickRenderer");var rs=Object.defineProperty,G=f((e,t)=>rs(e,"name",{value:t,configurable:!0}),"a");const ee=G(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask"),ns=G(async e=>{let t=0,s=0;const r=G(()=>(t+=1,`pattern-${t}`),"nextPatternId"),n=G(()=>(s+=1,`cmd-${s}`),"nextCommandId"),i=G(async(a,c,d)=>{if(typeof a=="string"){d.push({command:a,files:c,id:n(),source:"string",title:a});return}if(Array.isArray(a)){for(const u of a)await i(u,c,d);return}if(typeof a=="function"){const u=await a([...c]);if(typeof u=="string"){d.push({command:u,files:c,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const l of u)if(typeof l=="string")d.push({command:l,files:c,id:n(),source:"function",title:l});else if(ee(l))d.push({files:c,id:n(),run:l.task,source:"custom",title:l.title});else throw new T("Task function returned an array with an unsupported entry — expected strings or { title, task }.");return}if(ee(u)){d.push({files:c,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], or { title, task }.")}if(ee(a)){d.push({files:c,id:n(),run:a.task,source:"custom",title:a.title});return}throw new T("Unsupported task value — expected string, string[], function, or { title, task }.")},"expandTask"),o=[];for(const[a,c]of Object.entries(e.config)){const d=Kt(a,e.files,e.cwd,{caseInsensitive:e.caseInsensitive===!0});if(d.length===0)continue;const u=e.relative?d.map(p=>D(e.cwd,p)):d,l=[];await i(c,u,l),l.length!==0&&o.push({commands:l,files:u,id:r(),pattern:a,title:`${a} — ${d.length} file${d.length===1?"":"s"}`})}return o},"buildTaskGraph");var as=Object.defineProperty,K=f((e,t)=>as(e,"name",{value:t,configurable:!0}),"c");const is=K(e=>{const t=[];let s="",r=!1,n=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(o===void 0)break;if(o==="\\"&&!r&&i+1<e.length){const a=e[i+1];if(a!==void 0){n&&a!=='"'&&a!=="\\"&&(s+=o),s+=a,i+=1;continue}}if(o==='"'&&!r){n=!n;continue}if(o==="'"&&!n){r=!r;continue}if(!r&&!n&&/\s/.test(o)){s.length>0&&(t.push(s),s="");continue}s+=o}if(r||n)throw new T(`Unterminated ${r?"single":"double"} quote in command: ${e}`);return s.length>0&&t.push(s),t},"parseCommandString"),Pe=process.platform==="win32"?28e3:131072,os=K((e,t,s)=>{const r=[];let n=[],i=t;const o=s<=0?Pe:s;for(const a of e){const c=Buffer.byteLength(a)+1;n.length>0&&i+c>o&&(r.push(n),n=[],i=t),n.push(a),i+=c}return n.length>0&&r.push(n),r},"chunkFiles"),cs=K(async(e,t,s)=>{const r=is(e);if(r.length===0)throw new E(e,"Empty command for staged task.");const[n,...i]=r;if(n===void 0)throw new E(e,"Empty command for staged task.");const o=Buffer.byteLength(n)+i.reduce((u,l)=>u+Buffer.byteLength(l)+1,0),a=os(t,o,s.maxArgLength??Pe),c=Date.now(),d=[];for(const u of a){if(s.signal?.aborted===!0)throw new E(e,"Task aborted by earlier failure.");const l=Se(n,[...i,...u],{nodeOptions:{cwd:s.cwd,env:ds(s.env,s.cwd),killSignal:s.killSignal??"SIGTERM",stdio:["ignore","pipe","pipe"]},...s.signal===void 0?{}:{signal:s.signal}}),p=await l,v=[p.stdout,p.stderr].filter(m=>m.length>0).join(`
17
+ `);v.length>0&&d.push(v);const h=l.process?.signalCode??null;if(l.aborted||h!==null||p.exitCode===void 0){const m=l.aborted?"Task aborted by earlier failure.":h===null?v.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new E(e,m)}if(p.exitCode!==0)throw new E(e,v.trim()||`Exit code ${p.exitCode} from ${n}`)}return{durationMs:Date.now()-c,output:d.join(`
18
+ `)}},"execCommand"),ds=K((e,t)=>{const s={...process.env};process.stderr.isTTY&&s.FORCE_COLOR===void 0&&s.NO_COLOR===void 0&&(s.FORCE_COLOR="1");const r=e?{...s,...e}:s;return Ve(r,t)},"buildTaskEnv");var ls=Object.defineProperty,M=f((e,t)=>ls(e,"name",{value:t,configurable:!0}),"o");const us=M(async(e,t,s)=>{const r=hs(s.concurrent,e.length),n=[],i=new AbortController;let o=!1,a=0;const c=M(()=>{o||(o=!0,s.continueOnError||i.abort())},"cancel");s.externalSignal&&(s.externalSignal.aborted?c():s.externalSignal.addEventListener("abort",()=>{c()},{once:!0}));const d=M(h=>{for(const m of h.commands)t.commandEnd({commandId:m.id,durationMs:0,patternId:h.id,status:"skipped"})},"emitSkippedCommands"),u=M(async h=>{if(o){d(h),t.patternEnd({patternId:h.id,status:"skipped"});return}t.patternStart({patternId:h.id});let m="success";for(const k of h.commands){if(o){t.commandEnd({commandId:k.id,durationMs:0,patternId:h.id,status:"skipped"}),m=m==="success"?"skipped":m;continue}t.commandStart({commandId:k.id,patternId:h.id});const b=await fs(k,s,i.signal),S=b.status==="failed"&&i.signal.aborted?{...b,status:"skipped"}:b;if(t.commandEnd({commandId:k.id,durationMs:S.durationMs,error:S.error,output:S.output,patternId:h.id,status:S.status}),S.status==="failed"){n.push(k.title),m="failed",c();break}if(S.status==="skipped"){m=m==="success"?"skipped":m;break}}t.patternEnd({patternId:h.id,status:m})},"runOne"),l=M(async()=>{for(;a<e.length;){const h=e[a];a+=1,h&&await u(h)}},"pickNext"),p=[];for(let h=0;h<Math.min(r,e.length);h+=1)p.push(l());await Promise.all(p);const v=s.externalSignal?.aborted===!0;return{failedCommands:n,success:n.length===0&&!v}},"runTasks"),fs=M(async(e,t,s)=>{const r=Date.now();try{if(e.source==="custom"&&e.run)return await e.run([...e.files]),{durationMs:Date.now()-r,status:"success"};if(e.command){const n=await cs(e.command,e.files,{cwd:t.cwd,killSignal:t.killSignal,maxArgLength:t.maxArgLength,signal:s});return{durationMs:n.durationMs,output:t.verbose?n.output:void 0,status:"success"}}return{durationMs:Date.now()-r,error:new E(e.title,"Command has no invocation target."),status:"failed"}}catch(n){const i=n instanceof Error?n:new Error(String(n));return{durationMs:Date.now()-r,error:i,output:i instanceof E?i.message:void 0,status:"failed"}}},"runCommand"),hs=M((e,t)=>{if(e===!1)return 1;if(e===!0){const r=Math.max(1,typeof ce=="function"?ce():4);return Math.min(Math.max(1,t),r)}const s=Math.floor(e);return s>0?s:1},"concurrencyLimit");var ps=Object.defineProperty,se=f((e,t)=>ps(e,"name",{value:t,configurable:!0}),"u");const gs=!0,ms=se(e=>{try{return!nt(e)}catch{return!1}},"detectCaseInsensitive"),ws=se(async(e={})=>{const t=e.cwd??process.cwd(),s=await ss(e),r=await bt(e);typeof r!="function"&&fe(r);const n=new Vt({...e,cwd:t}),i=new AbortController;let o=!1;const a=se(l=>{if(o){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,l);return}o=!0,s.warn({message:`Received ${l} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()},"onInterrupt");process.on("SIGINT",a),process.on("SIGTERM",a);let c={failedCommands:[],ranTasks:!1,success:!0},d=!1,u=!1;try{await n.prepare(),d=!0;for(const b of n.warnings)s.warn({message:b});if(n.stagedFiles.length===0)return e.allowEmpty!==!0&&s.info({message:"No staged files found."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const l=ms(t),p=Yt(n.stagedFiles,e.ignore,t,{caseInsensitive:l});if(p.length===0&&n.stagedFiles.length>0)return s.info({message:"Every staged file was excluded by the `ignore` list."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const v=typeof r=="function"?fe(await r([...p])):r,h=await ns({caseInsensitive:l,config:v,cwd:t,files:p,relative:e.relative});if(s.start({patterns:h}),h.length===0)return s.info({message:"No staged files matched any pattern."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:m,success:k}=await us(h,s,{concurrent:e.concurrent??gs,continueOnError:e.continueOnError===!0,cwd:t,externalSignal:i.signal,killSignal:e.killSignal,maxArgLength:e.maxArgLength,verbose:e.verbose});if(c={failedCommands:m,ranTasks:!0,success:k},k){if(e.diff===void 0&&(await n.applyModifications({autoStage:e.autoStage===!0}),e.failOnChanges===!0&&n.indexTreeChanged()&&(s.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),c={failedCommands:[...m],ranTasks:!0,success:!1}),e.allowEmpty!==!0&&n.postTaskIndexMatchesHead()))throw new dt("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else if(e.revert===!0)s.info({message:"Reverting working tree from backup stash."}),await n.revert();else{const b=n.recoveryHint();b&&s.warn({message:b})}return await n.restoreUnstagedChanges(),u=c.success,c}catch(l){const p=l instanceof Error?l.message:String(l),v=l instanceof Error?l:new Error(p);if(s.error({error:v,message:p}),l instanceof O)return{failedCommands:c.failedCommands,ranTasks:c.ranTasks,success:!1};throw l}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),d)try{await n.cleanup(u)}catch(l){s.error({error:l,message:"Cleanup failed."})}await s.stop()}},"runStaged");var vs=Object.defineProperty,ys=f((e,t)=>vs(e,"name",{value:t,configurable:!0}),"n");const ks="VIS_STAGED_CONCURRENT",be=ys(e=>{const t=e.trim();if(t==="true"||t==="")return!0;if(t==="false")return!1;const s=Number(t);return Number.isNaN(s)?!0:s},"parseConcurrent");var bs=Object.defineProperty,B=f((e,t)=>bs(e,"name",{value:t,configurable:!0}),"d");const Ts=B((e,t)=>{const s={};t!==void 0&&(s.config=t);const r=B(y=>e[y]===void 0?void 0:!!e[y],"readBool"),n=B(y=>{const Y=e[y];return typeof Y=="string"&&Y.length>0?Y:void 0},"readString"),i=r("allow-empty");i!==void 0&&(s.allowEmpty=i);const o=r("auto-stage");o!==void 0&&(s.autoStage=o);const a=r("continue-on-error");a!==void 0&&(s.continueOnError=a);const c=r("debug");c!==void 0&&(s.debug=c);const d=r("fail-on-changes");d!==void 0&&(s.failOnChanges=d);const u=r("hide-partially-staged");u!==void 0&&(s.hidePartiallyStaged=u);const l=r("hide-unstaged");l!==void 0&&(s.hideUnstaged=l);const p=r("quiet");p!==void 0&&(s.quiet=p);const v=r("relative");v!==void 0&&(s.relative=v);const h=r("revert");h!==void 0&&(s.revert=h);const m=r("stash");m!==void 0&&(s.stash=m);const k=r("verbose");k!==void 0&&(s.verbose=k);const b=n("cwd");b!==void 0&&(s.cwd=b);const S=n("diff");S!==void 0&&(s.diff=S);const ae=n("diff-filter");if(ae!==void 0&&(s.diffFilter=ae),r("force-kill")===!0&&(s.killSignal="SIGKILL"),e.concurrent===void 0){const y=process.env[ks];y!==void 0&&(s.concurrent=be(y.trim()))}else{const{concurrent:y}=e;s.concurrent=be(typeof y=="string"?y:typeof y=="number"||typeof y=="boolean"?String(y):"")}return s},"buildRunOptions"),Ps=B(async({options:e,visConfig:t})=>{const s=(t??{}).staged;if(!s)throw new Error(`No "staged" config found in vis.config.ts. Add one:
19
19
 
20
20
  // vis.config.ts
21
21
  import { defineConfig } from "@visulima/vis/config";
@@ -24,4 +24,4 @@ Second attempt: ${n}`,{cause:s})}}async revert(){if(this.backupStashSha!==null){
24
24
  staged: { '*': 'vis check --fix' },
25
25
  });
26
26
 
27
- Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await vr(Sr(e,r))).success||(process.exitCode=1)},"execute");export{Sr as buildRunOptions,Gr as default};
27
+ Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await ws(Ts(e,s))).success||(process.exitCode=1)},"execute");export{Ts as buildRunOptions,Ps as default};