@visulima/vis 3.0.3 → 3.0.5

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 (89) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE.md +1 -130
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/packem_chunks/catalog.js +1 -1
  6. package/dist/packem_chunks/cli-exec.js +1 -1
  7. package/dist/packem_chunks/cli-main.js +172 -171
  8. package/dist/packem_chunks/fix.js +1 -1
  9. package/dist/packem_chunks/handler.js +1 -1
  10. package/dist/packem_chunks/handler10.js +1 -1
  11. package/dist/packem_chunks/handler11.js +1 -1
  12. package/dist/packem_chunks/handler12.js +1 -1
  13. package/dist/packem_chunks/handler13.js +3 -3
  14. package/dist/packem_chunks/handler14.js +1 -1
  15. package/dist/packem_chunks/handler15.js +1 -1
  16. package/dist/packem_chunks/handler16.js +1 -1
  17. package/dist/packem_chunks/handler17.js +1 -1
  18. package/dist/packem_chunks/handler18.js +1 -1
  19. package/dist/packem_chunks/handler19.js +5 -5
  20. package/dist/packem_chunks/handler2.js +1 -1
  21. package/dist/packem_chunks/handler21.js +2 -2
  22. package/dist/packem_chunks/handler24.js +1 -1
  23. package/dist/packem_chunks/handler27.js +1 -1
  24. package/dist/packem_chunks/handler28.js +1 -1
  25. package/dist/packem_chunks/handler29.js +1 -1
  26. package/dist/packem_chunks/handler3.js +1 -1
  27. package/dist/packem_chunks/handler33.js +2 -2
  28. package/dist/packem_chunks/handler34.js +1 -1
  29. package/dist/packem_chunks/handler45.js +1 -1
  30. package/dist/packem_chunks/handler46.js +1 -1
  31. package/dist/packem_chunks/handler48.js +3 -3
  32. package/dist/packem_chunks/handler5.js +1 -1
  33. package/dist/packem_chunks/handler50.js +6 -6
  34. package/dist/packem_chunks/handler51.js +1 -1
  35. package/dist/packem_chunks/handler54.js +1 -1
  36. package/dist/packem_chunks/handler55.js +1 -1
  37. package/dist/packem_chunks/handler57.js +1 -1
  38. package/dist/packem_chunks/handler58.js +2 -2
  39. package/dist/packem_chunks/handler59.js +2 -2
  40. package/dist/packem_chunks/handler6.js +7 -7
  41. package/dist/packem_chunks/handler62.js +2 -2
  42. package/dist/packem_chunks/handler64.js +3 -3
  43. package/dist/packem_chunks/handler66.js +2 -2
  44. package/dist/packem_chunks/handler68.js +1 -1
  45. package/dist/packem_chunks/handler69.js +2 -2
  46. package/dist/packem_chunks/handler7.js +1 -1
  47. package/dist/packem_chunks/handler70.js +1 -1
  48. package/dist/packem_chunks/handler71.js +15 -15
  49. package/dist/packem_chunks/handler72.js +2 -2
  50. package/dist/packem_chunks/handler74.js +1 -1
  51. package/dist/packem_chunks/handler75.js +10 -10
  52. package/dist/packem_chunks/handler76.js +1 -1
  53. package/dist/packem_chunks/handler77.js +4 -4
  54. package/dist/packem_chunks/handler78.js +1 -1
  55. package/dist/packem_chunks/handler9.js +1 -1
  56. package/dist/packem_chunks/heal-accept.js +1 -1
  57. package/dist/packem_chunks/heal.js +1 -1
  58. package/dist/packem_chunks/help-command.js +7 -7
  59. package/dist/packem_chunks/index5.js +1 -1
  60. package/dist/packem_chunks/keys-refresh.js +1 -1
  61. package/dist/packem_chunks/list.js +1 -1
  62. package/dist/packem_chunks/loader.js +1 -1
  63. package/dist/packem_chunks/sync2.js +1 -1
  64. package/dist/packem_chunks/tripwire.js +1 -1
  65. package/dist/packem_chunks/verify-lockfile.js +1 -1
  66. package/dist/packem_shared/{affected-selection-BMoQWuHl.js → affected-selection-DIgAsQTu.js} +1 -1
  67. package/dist/packem_shared/{ai-fix-CKN1JGRh.js → ai-fix-CyUx_ZAB.js} +1 -1
  68. package/dist/packem_shared/{bin-CN4heKmb.js → bin-CVfNImCA.js} +1 -1
  69. package/dist/packem_shared/{failure-log-D92tM0ie.js → failure-log-DE_MJCzB.js} +1 -1
  70. package/dist/packem_shared/{formatBytes-BHAzNIrn-DFIppnY0.js → formatBytes-BHAzNIrn-Bkk_uRS-.js} +1 -1
  71. package/dist/packem_shared/index-5GrALmsb.js +1 -0
  72. package/dist/packem_shared/{index-DXPSWMbG.js → index-CIIKPX4H.js} +1 -1
  73. package/dist/packem_shared/{lifecycle-CfTZQHOG.js → lifecycle-DW8KRF5d.js} +1 -1
  74. package/dist/packem_shared/{package-version-CJxZ_B7G.js → package-version-CIhwFJn3.js} +1 -1
  75. package/dist/packem_shared/{packument-C55kVxcQ.js → packument-CHdDsn0O.js} +1 -1
  76. package/dist/packem_shared/{pm-runner-de-jCq8q.js → pm-runner-d93_73O6.js} +1 -1
  77. package/dist/packem_shared/{project-name-filter-DsrVo0MY.js → project-name-filter-sYH4Zvsm.js} +1 -1
  78. package/dist/packem_shared/{provenance-CvfQEJPQ.js → provenance-w-NIPtim.js} +1 -1
  79. package/dist/packem_shared/{registry-keys-DmBrAlhg.js → registry-keys-_IKDLSbu.js} +1 -1
  80. package/dist/packem_shared/{resolve-explicit-DYaHAVDg.js → resolve-explicit-ZZEPWdpP.js} +1 -1
  81. package/dist/packem_shared/{s1ngularity-C8sva2SO.js → s1ngularity-R-zLjQjp.js} +1 -1
  82. package/dist/packem_shared/{signatures-oZ_2IneN.js → signatures-ijwqxAtF.js} +1 -1
  83. package/dist/packem_shared/{vis-update-app-zqSa2clT.js → vis-update-app-DNeU8RBQ.js} +1 -1
  84. package/dist/packem_shared/vis-user-error-CgyYA29v.js +30 -0
  85. package/index.d.ts +204 -204
  86. package/index.js +52 -52
  87. package/package.json +11 -11
  88. package/dist/packem_shared/index-DjTWo3sH.js +0 -1
  89. package/dist/packem_shared/vis-user-error-Dkc97rGY.js +0 -30
@@ -1,3 +1,3 @@
1
- import{createRequire as Ne}from"node:module";import{v as W,V as Ce,U as ze,W as Ge,T as $e,X as We,Y as Ve,d as Ue}from"./cli-main.js";import{i as Xe}from"../packem_shared/index-BjdW45xX.js";import{u as p,y as e,X as s,m as o,R as He}from"./catalog.js";import{d as Ke}from"../packem_shared/pm-runner-de-jCq8q.js";import{i as qe,e as le,z as Ye,m as Qe}from"../packem_shared/index-DHD8wb6Z.js";import{y as Ze}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{h as et}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{n as tt,a as ot}from"../packem_shared/tabs-UDYQ3tqt.js";let Re;const Be=i=>(Re??=Ne(import.meta.url))(i),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=i=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[t,n]=q.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return q.getBuiltinModule(i)}return Be(i)},{writeFileSync:Je}=_e("node:fs"),rt=(i,{whitespace:t=!0}={})=>i.replace(qe,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),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)"}],nt=i=>{const t=le(i,".devcontainer","devcontainer.json");if(!Ze(t))return null;const n=Ye(t),c=rt(n),l=c!==n;let r;try{r=JSON.parse(c)}catch(a){const m=a instanceof Error?a.message:String(a);throw new Error(`Failed to parse ${t}: ${m}`,{cause:a})}return{config:r,hadComments:l}},it=(i,t,n)=>{const c=n?Qe(n):le(i,".devcontainer"),l=n??le(c,"devcontainer.json");et(c),Je(l,`${JSON.stringify(t,null,2)}
1
+ import{createRequire as Ne}from"node:module";import{v as W,V as Ce,U as ze,W as Ge,T as $e,X as We,Y as Ve,d as Ue}from"./cli-main.js";import{i as Xe}from"../packem_shared/index-BjdW45xX.js";import{u as p,y as e,X as s,m as o,R as He}from"./catalog.js";import{d as Ke}from"../packem_shared/pm-runner-d93_73O6.js";import{i as qe,e as le,z as Ye,m as Qe}from"../packem_shared/index-DHD8wb6Z.js";import{y as Ze}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{h as et}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{n as tt,a as ot}from"../packem_shared/tabs-UDYQ3tqt.js";let Re;const Be=i=>(Re??=Ne(import.meta.url))(i),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=i=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[t,n]=q.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return q.getBuiltinModule(i)}return Be(i)},{writeFileSync:Je}=_e("node:fs"),rt=(i,{whitespace:t=!0}={})=>i.replace(qe,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),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)"}],nt=i=>{const t=le(i,".devcontainer","devcontainer.json");if(!Ze(t))return null;const n=Ye(t),c=rt(n),l=c!==n;let r;try{r=JSON.parse(c)}catch(a){const m=a instanceof Error?a.message:String(a);throw new Error(`Failed to parse ${t}: ${m}`,{cause:a})}return{config:r,hadComments:l}},it=(i,t,n)=>{const c=n?Qe(n):le(i,".devcontainer"),l=n??le(c,"devcontainer.json");et(c),Je(l,`${JSON.stringify(t,null,2)}
2
2
  `,"utf8")},st={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"}]},ct=[{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"}]}],pe=(i,t,n)=>{const c=[],l=new Set(n.map(a=>typeof a=="string"?a:a.target));if(i)for(const a of st[i])l.has(a.target)||c.push(a);const r=Object.keys(t);for(const{featureMatch:a,mounts:m}of ct)if(r.some(g=>g.includes(a)))for(const g of m)l.has(g.target)||c.push(g);return c},B=["general","features","ports","lifecycle","extensions","environment","mounts","compose"],Y=i=>structuredClone(i);class lt{#r=new Set;#e;constructor(t,n,c=null){const l=t===null,r=t??{name:""},a=Y(r);this.#e={config:a,detectedPm:c,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:n,isDirty:!1,mode:l?"create":"edit",originalConfig:l?null:Y(r),section:"general",showTemplateSelector:l,suggestedMounts:pe(c,a.features??{},a.mounts??[]),templateIndex:0}}getSnapshot=()=>this.#e;subscribe=t=>(this.#r.add(t),()=>{this.#r.delete(t)});setSection(t){t!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:t})}nextSection(){const n=(B.indexOf(this.#e.section)+1)%B.length;this.setSection(B[n])}previousSection(){const n=(B.indexOf(this.#e.section)-1+B.length)%B.length;this.setSection(B[n])}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 n=Math.max(0,Math.min(t,V.length-1));n!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:n})}applyTemplate(t){const n=V.find(c=>c.id===t);n&&this.#t(this.#o({...this.#e,config:Y(n.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 n={...this.#e.config.features};n[t]===void 0?n[t]={}:delete n[t],this.#t(this.#o({...this.#e,config:{...this.#e.config,features:n},isDirty:!0}))}setFeatureSearch(t){this.#t({...this.#e,featureSearch:t,fieldIndex:0})}addPort(t){const n=this.#e.config.forwardPorts??[];if(n.includes(t))return;const c=[...n,t];this.#t({...this.#e,config:{...this.#e.config,forwardPorts:c},isDirty:!0})}removePort(t){const n=[...this.#e.config.forwardPorts??[]];n.splice(t,1),this.#t({...this.#e,config:{...this.#e.config,forwardPorts:n.length>0?n:void 0},isDirty:!0})}toggleExtension(t){const n={...this.#e.config.customizations},c={...n.vscode},l=[...c.extensions??[]],r=l.indexOf(t);r===-1?l.push(t):l.splice(r,1),c.extensions=l.length>0?l:void 0,n.vscode=c.extensions||c.settings?c:void 0,this.#t({...this.#e,config:{...this.#e.config,customizations:n.vscode||n.jetbrains?n:void 0},isDirty:!0})}setExtensionSearch(t){this.#t({...this.#e,extensionSearch:t,fieldIndex:0})}addEnvVar(t,n,c){const l=t==="container"?"containerEnv":"remoteEnv",r={...this.#e.config[l],[n]:c};this.#t({...this.#e,config:{...this.#e.config,[l]:r},isDirty:!0})}removeEnvVar(t,n){const c=t==="container"?"containerEnv":"remoteEnv",l={...this.#e.config[c]};delete l[n],this.#t({...this.#e,config:{...this.#e.config,[c]:Object.keys(l).length>0?l:void 0},isDirty:!0})}addMount(t){const n=[...this.#e.config.mounts??[],t];this.#t(this.#o({...this.#e,config:{...this.#e.config,mounts:n},isDirty:!0}))}removeMount(t){const n=[...this.#e.config.mounts??[]];n.splice(t,1),this.#t(this.#o({...this.#e,config:{...this.#e.config,mounts:n.length>0?n:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const t=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#t(this.#o({...this.#e,config:{...this.#e.config,mounts:t},isDirty:!0}))}setLifecycleCommand(t,n){this.#t({...this.#e,config:{...this.#e.config,[t]:n||void 0},isDirty:!0})}markClean(){this.#t({...this.#e,isDirty:!1,originalConfig:Y(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const t=Y(this.#e.config);for(const[n,c]of Object.entries(t))(c===""||c===void 0)&&delete t[n];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}#o(t){return{...t,suggestedMounts:pe(t.detectedPm,t.config.features??{},t.config.mounts??[])}}#t(t){this.#e=t;for(const n of this.#r)try{n()}catch{}}}const xe=[{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"}],je=[{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"}],de=i=>{if(!i)return je;const t=i.toLowerCase();return je.filter(n=>n.name.toLowerCase().includes(t)||n.id.toLowerCase().includes(t)||n.description.toLowerCase().includes(t))},ue=i=>{if(!i)return xe;const t=i.toLowerCase();return xe.filter(n=>n.name.toLowerCase().includes(t)||n.id.toLowerCase().includes(t)||n.description.toLowerCase().includes(t))},at=/^[a-z]$/i,dt=i=>{const t=i.codePointAt(0);return t!==void 0&&(t<32||t===127)},ut=(i,t)=>i.length===0||dt(i)?!1:t.ctrl&&t.meta?!at.test(i):!(t.ctrl||t.meta),ht=/\S+\s*$/,se=(i,t)=>i.length===0||!t?void 0:t.find(n=>n.startsWith(i))?.slice(i.length)??void 0,ke=-1,mt=(i,t,n,c)=>t.leftArrow?Math.max(0,n-1):t.home||t.ctrl&&i==="a"?0:t.end||t.ctrl&&i==="e"?c:ke,gt=(i,t,n,c)=>{if(t.backspace&&c>0)return[n.slice(0,c-1)+n.slice(c),c-1];if(t.delete&&c<n.length)return[n.slice(0,c)+n.slice(c+1),c];if(t.ctrl&&i==="u")return[n.slice(c),0];if(t.ctrl&&i==="k")return[n.slice(0,c),c];if(t.ctrl&&i==="w"){const l=n.slice(0,c).replace(ht,"");return[l+n.slice(c),l.length]}};function he({defaultValue:i="",isDisabled:t=!1,mask:n=!1,onChange:c,onSubmit:l,placeholder:r,suggestions:a}){const[m,f]=p.useState(i),[g,v]=p.useState(i.length),x=p.useRef(m);x.current=m;const b=p.useRef(g);b.current=g;const y=p.useRef(c);y.current=c;const D=p.useRef(l);D.current=l;const k=se(m,a),M=p.useCallback((T,I)=>{const{current:E}=b,S=x.current;if(I.return){const w=se(S,a),C=w?S+w:S;w&&(f(C),v(C.length),y.current?.(C)),D.current?.(C);return}if(I.escape)return;if(I.rightArrow){const w=se(S,a);if(E===S.length&&w){const C=S+w;f(C),v(C.length),y.current?.(C);return}v(Math.min(S.length,E+1));return}const A=mt(T,I,E,S.length);if(A!==ke){v(A);return}const H=gt(T,I,S,E);if(H){const[w,C]=H;f(w),v(C),y.current?.(w);return}if(ut(T,I)){const w=S.slice(0,E)+T+S.slice(E);f(w),v(E+T.length),y.current?.(w)}},[a]);W(M,{isActive:!t});const L=n?"*".repeat(m.length):m,U=L.slice(0,g),X=L[g],Q=L.slice(g+1);return t?e.jsx(s,{children:e.jsx(o,{dimColor:!0,children:L||r||""})}):m.length===0&&r?e.jsxs(s,{children:[e.jsx(o,{dimColor:!0,inverse:!0,children:r[0]}),e.jsx(o,{dimColor:!0,children:r.slice(1)})]}):e.jsxs(s,{children:[e.jsxs(o,{children:[U,e.jsx(o,{inverse:!0,children:X??" "}),Q]}),k?e.jsx(o,{dimColor:!0,children:k}):void 0]})}const Ee=["dockerComposeFile","service"],ft={dockerComposeFile:"Compose File",service:"Service"},ve={dockerComposeFile:"docker-compose.yml",service:"app"},pt={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},xt=({config:i,fieldEditing:t,fieldIndex:n,onUpdate:c})=>{const l=!!i.dockerComposeFile,r=!!(i.image||i.build);return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(o,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),r&&l&&e.jsx(s,{marginBottom:1,children:e.jsx(o,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Ee.map((a,m)=>{const f=m===n,g=i[a]??"",v=Array.isArray(i[a])?i[a].join(", "):g;return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{children:[e.jsx(s,{width:20,children:e.jsxs(o,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",ft[a],":"]})}),e.jsx(s,{flexGrow:1,children:f&&t?e.jsx(he,{defaultValue:v,onChange:x=>{c({[a]:x||void 0})},placeholder:ve[a]}):e.jsx(o,{color:v?"white":"gray",children:v||ve[a]})})]}),e.jsx(s,{paddingLeft:4,children:e.jsx(o,{dimColor:!0,children:pt[a]})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(o,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},jt=Ee.length,vt=({config:i,fieldIndex:t})=>{const n=i.containerEnv??{},c=i.remoteEnv??{},l=Object.keys(n),r=Object.keys(c),a=l.length,m=l.length+1,f=m+r.length,g=t<=a,v=t>a;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{borderColor:g?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:l.length>0?1:0,children:[e.jsx(o,{bold:!0,color:g?"cyan":"white",children:"containerEnv"}),e.jsx(o,{dimColor:!0,children:" — baked into the container image"})]}),l.map((x,b)=>{const y=b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(o,{color:y?"cyan":void 0,inverse:y,wrap:"truncate",children:[y?" ❯ ":" ",e.jsx(o,{bold:!0,children:x}),e.jsx(o,{dimColor:!0,children:" = "}),e.jsx(o,{children:n[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:l.length>0?1:0,children:e.jsxs(o,{color:t===a?"cyan":"gray",inverse:t===a,children:[" ","+ Add variable..."]})})]}),e.jsxs(s,{borderColor:v?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:r.length>0?1:0,children:[e.jsx(o,{bold:!0,color:v?"cyan":"white",children:"remoteEnv"}),e.jsx(o,{dimColor:!0,children:" — set at runtime by the IDE"})]}),r.map((x,b)=>{const D=m+b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(o,{color:D?"cyan":void 0,inverse:D,wrap:"truncate",children:[D?" ❯ ":" ",e.jsx(o,{bold:!0,children:x}),e.jsx(o,{dimColor:!0,children:" = "}),e.jsx(o,{children:c[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:r.length>0?1:0,children:e.jsxs(o,{color:t===f?"cyan":"gray",inverse:t===f,children:[" ","+ Add variable..."]})})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsxs(o,{dimColor:!0,wrap:"truncate",children:[e.jsx(o,{bold:!0,color:"white",children:"a"}),"/",e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",e.jsx(o,{bold:!0,color:"white",children:"d"})," ","remove"," ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},bt=i=>{const t=Object.keys(i.containerEnv??{}).length,n=Object.keys(i.remoteEnv??{}).length;return t+1+n+1},wt=({config:i,fieldIndex:t,scrollOffset:n,searchText:c,viewportHeight:l})=>{const r=p.useMemo(()=>new Set(i.customizations?.vscode?.extensions),[i.customizations?.vscode?.extensions]),a=p.useMemo(()=>ue(c),[c]),m=a.length,f=m>l&&l>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(o,{bold:!0,color:"cyan",children:[r.size," ","selected"]}),c&&e.jsxs(o,{dimColor:!0,children:["— filter:"," ",e.jsx(o,{color:"yellow",children:c})," ","(",a.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:-n,children:a.map((g,v)=>{const x=v===t,b=r.has(g.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(o,{children:x?">":" "}),e.jsxs(o,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(o,{bold:x,inverse:x,wrap:"truncate",children:[g.name,e.jsxs(o,{dimColor:!0,children:[" ","-",g.id]})]})})]},g.id)})})}),f&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Ce,{contentHeight:m,placement:"inset",scrollOffset:n,style:"block",viewportHeight:l})})]}),a.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(o,{dimColor:!0,children:"No extensions match the search."})})]})},yt=({config:i,fieldIndex:t,scrollOffset:n,searchText:c,viewportHeight:l})=>{const r=p.useMemo(()=>new Set(Object.keys(i.features??{})),[i.features]),a=p.useMemo(()=>de(c),[c]),m=a.length,f=m>l&&l>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(o,{bold:!0,color:"cyan",children:[r.size," ","selected"]}),c&&e.jsxs(o,{dimColor:!0,children:["— filter:"," ",e.jsx(o,{color:"yellow",children:c})," ","(",a.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:-n,children:a.map((g,v)=>{const x=v===t,b=r.has(g.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(o,{children:x?">":" "}),e.jsxs(o,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(o,{bold:x,inverse:x,wrap:"truncate",children:[g.name,e.jsxs(o,{dimColor:!0,children:[" ","-",g.description]})]})})]},g.id)})})}),f&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Ce,{contentHeight:m,placement:"inset",scrollOffset:n,style:"block",viewportHeight:l})})]}),a.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(o,{dimColor:!0,children:"No features match the search."})})]})},ae=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],St={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},be={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"},te=["privileged","overrideCommand"],Ct={overrideCommand:"Override Command",privileged:"Privileged"},kt=ae.length+te.length,Et=({config:i,fieldEditing:t,fieldIndex:n,onUpdate:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(o,{bold:!0,color:"cyan",children:"General Configuration"})}),ae.map((l,r)=>{const a=r===n,m=i[l]??"";return e.jsxs(s,{marginBottom:1,children:[e.jsx(s,{width:20,children:e.jsxs(o,{bold:a,color:a?"cyan":"white",children:[a?"❯ ":" ",St[l],":"]})}),e.jsx(s,{flexGrow:1,children:a&&t?e.jsx(he,{defaultValue:m,onChange:f=>{c({[l]:f})},placeholder:be[l]}):e.jsx(o,{color:m?"white":"gray",children:m||be[l]})})]},l)}),te.map((l,r)=>{const m=ae.length+r===n,f=i[l]??!1;return e.jsxs(s,{marginBottom:r<te.length-1?1:0,children:[e.jsx(s,{width:20,children:e.jsxs(o,{bold:m,color:m?"cyan":"white",children:[m?"❯ ":" ",Ct[l],":"]})}),e.jsx(s,{flexGrow:1,children:e.jsxs(o,{color:f?"green":"gray",children:[f?"yes":"no",m&&e.jsx(o,{dimColor:!0,children:" (Space to toggle)"})]})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(o,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(o,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),Ie=kt,ce=te,De=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],It={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},Dt={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"},Tt=({config:i,fieldEditing:t,fieldIndex:n,onSetCommand:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(o,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),De.map((l,r)=>{const a=r===n,m=i[l],f=Array.isArray(m)?m.join(" && "):m??"";return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsx(s,{children:e.jsxs(o,{bold:a,color:a?"cyan":"white",children:[a?"❯ ":" ",It[l]]})}),e.jsx(s,{paddingLeft:4,children:e.jsx(o,{dimColor:!0,children:Dt[l]})}),e.jsx(s,{paddingLeft:4,children:a&&t?e.jsx(he,{defaultValue:f,onChange:g=>{c(l,g)},placeholder:"e.g. npm install"}):e.jsx(o,{color:f?"green":"gray",children:f||"(not set)"})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(o,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),At=De.length,we=i=>typeof i=="string"?i:`[${i.type}] ${i.source} → ${i.target}`,Ft=({addingMount:i,config:t,detectedPm:n,fieldIndex:c,mountPhase:l,mountSource:r,mountTarget:a,mountType:m,suggestedMounts:f})=>{const g=t.mounts??[];return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(o,{bold:!0,color:"cyan",children:[g.length," ","mounts"]}),n&&e.jsxs(o,{dimColor:!0,children:["— detected:"," ",e.jsx(o,{color:"white",children:n})]})]}),f.length>0&&!i&&e.jsxs(s,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[e.jsxs(s,{flexShrink:0,children:[e.jsx(o,{bold:!0,color:"yellow",children:"Suggested mounts"}),e.jsxs(o,{dimColor:!0,children:[" ","— press"," ",e.jsx(o,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((v,x)=>e.jsx(s,{flexShrink:0,children:e.jsxs(o,{dimColor:!0,wrap:"truncate",children:[" + ",we(v)]})},`suggestion-${String(x)}`))]}),g.length>0&&e.jsx(s,{flexDirection:"column",marginBottom:1,children:g.map((v,x)=>{const b=x===c;return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(o,{children:b?">":" "}),e.jsx(s,{flexGrow:1,children:e.jsxs(o,{bold:b,inverse:b,wrap:"truncate",children:[" ",we(v)]})})]},`mount-${String(x)}`)})}),!i&&e.jsx(s,{flexShrink:0,children:e.jsxs(o,{color:c===g.length?"cyan":"gray",inverse:c===g.length,children:[" ","+ Add mount..."]})}),i&&e.jsxs(s,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[e.jsx(s,{flexShrink:0,marginBottom:1,children:e.jsx(o,{bold:!0,color:"cyan",children:"New Mount"})}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(o,{bold:l==="source",color:l==="source"?"cyan":"white",children:[l==="source"?"❯ ":" ","Source:"]})}),e.jsx(o,{color:r?"yellow":"gray",children:r||(l==="source"?"_":"(type source, Enter to continue)")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(o,{bold:l==="target",color:l==="target"?"cyan":"white",children:[l==="target"?"❯ ":" ","Target:"]})}),e.jsx(o,{color:a?"yellow":"gray",children:a||(l==="target"?"_":"/container/path")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(o,{bold:l==="type",color:l==="type"?"cyan":"white",children:[l==="type"?"❯ ":" ","Type:"]})}),l==="type"?e.jsxs(o,{children:[e.jsx(o,{bold:m==="volume",color:m==="volume"?"cyan":"gray",children:"[1] volume"})," ",e.jsx(o,{bold:m==="bind",color:m==="bind"?"cyan":"gray",children:"[2] bind"})," ",e.jsx(o,{bold:m==="tmpfs",color:m==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):e.jsx(o,{color:"gray",children:m})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsx(o,{dimColor:!0,wrap:"truncate",children:l==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),g.length===0&&!i&&f.length===0&&e.jsx(s,{marginTop:1,children:e.jsx(o,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},Lt=({addingPort:i,addPortValue:t,config:n,fieldIndex:c})=>{const l=n.forwardPorts??[],r=c===l.length;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(o,{bold:!0,color:"cyan",children:"Forwarded Ports"}),e.jsxs(o,{dimColor:!0,children:[" ","(",l.length," ","ports)"]})]}),l.map((a,m)=>{const f=m===c;return e.jsx(s,{children:e.jsxs(o,{color:f?"cyan":void 0,inverse:f,children:[" ",String(a)]})},`port-${String(a)}`)}),e.jsx(s,{marginTop:l.length>0?1:0,children:e.jsxs(o,{color:r?"cyan":"gray",inverse:r,children:[" ",r&&i?e.jsxs(o,{children:["Enter port:"," ",e.jsx(o,{color:"yellow",children:t||"_"})]}):"+ Add port..."]})}),e.jsx(s,{marginTop:1,children:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ",r?"type port number, Enter to confirm":"select"," ",e.jsx(o,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},Ot=({focused:i,hadComments:t,jsonPreview:n,mode:c,scrollRef:l})=>e.jsxs(s,{borderColor:i?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,paddingX:1,children:[e.jsx(o,{bold:!0,color:i?"cyan":"white",children:"Preview"}),e.jsxs(o,{dimColor:!0,children:[" ","(",c==="create"?"new":"edit",")"]})]}),t&&c==="edit"&&e.jsx(s,{flexShrink:0,paddingX:1,children:e.jsx(o,{color:"yellow",children:"Comments will not be preserved."})}),e.jsx(ze,{flexGrow:1,ref:l,scrollbar:!0,scrollbarColor:"gray",children:n.split(`
3
3
  `).map((r,a)=>e.jsx(o,{color:"green",children:r},`line-${String(a)}`))})]}),Pt=i=>{const t=[],n=[],c=[];if(!i.image&&!i.build&&!i.dockerComposeFile&&t.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),i.build&&(i.image&&n.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),i.build.dockerfile||t.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),i.dockerComposeFile&&!i.service&&t.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),i.features!==void 0&&(typeof i.features!="object"||Array.isArray(i.features))&&t.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),i.forwardPorts)if(Array.isArray(i.forwardPorts))for(const[l,r]of i.forwardPorts.entries())typeof r=="number"&&(r<1||r>65535)&&t.push({field:"forwardPorts",message:`Invalid port ${String(r)} at index ${String(l)}`});else t.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return i.customizations?.vscode?.extensions&&!Array.isArray(i.customizations.vscode.extensions)&&t.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),i.customizations?.vscode?.settings&&typeof i.customizations.vscode.settings!="object"&&t.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),i.name||c.push({field:"name",message:"Consider adding a name for better identification"}),(!i.features||Object.keys(i.features).length===0)&&c.push({field:"features",message:"Consider adding features for common tools"}),(!i.customizations?.vscode?.extensions||i.customizations.vscode.extensions.length===0)&&c.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),i.privileged&&n.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:t,suggestions:c,valid:t.length===0,warnings:n}},ye=80,Se=15,Mt=120,Te=[{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"}],Nt=new Map(Te.map(i=>[i.id,i.description])),Rt=(i,t,n,c)=>{switch(i){case"compose":return jt;case"environment":return bt(t);case"extensions":return ue(c).length;case"features":return de(n).length;case"general":return Ie;case"lifecycle":return At;case"mounts":return(t.mounts?.length??0)+1;case"ports":return(t.forwardPorts?.length??0)+1;default:return 0}},Bt=({onSave:i,store:t})=>{const{exit:n}=Ge(),{columns:c,rows:l}=$e(),r=p.useSyncExternalStore(t.subscribe,t.getSnapshot),[a,m]=p.useState(!1),[f,g]=p.useState(!1),[v,x]=p.useState(!1),[b,y]=p.useState(null),[D,k]=p.useState("editor"),[M,L]=p.useState(0),[U,X]=p.useState(!1),[Q,T]=p.useState(""),[I,E]=p.useState(null),[S,A]=p.useState(""),[H,w]=p.useState(""),[C,_]=p.useState("key"),[oe,Z]=p.useState(!1),[re,z]=p.useState(""),[ne,G]=p.useState(""),[me,K]=p.useState("volume"),[O,$]=p.useState("source"),ie=p.useRef(null),R=p.useRef(null),N=p.useRef(null),ee=p.useRef(!0);p.useEffect(()=>(ee.current=!0,()=>{ee.current=!1,N.current&&clearTimeout(N.current)}),[]);const ge=Rt(r.section,r.config,r.featureSearch,r.extensionSearch),J=Math.max(1,l-9);p.useEffect(()=>{r.section!=="features"&&r.section!=="extensions"||L(u=>r.fieldIndex>=u+J?r.fieldIndex-J+1:r.fieldIndex<u?r.fieldIndex:u)},[r.fieldIndex,r.section,J]),p.useEffect(()=>{L(0)},[r.section,r.featureSearch,r.extensionSearch]);const Ae=p.useCallback(()=>{const u=t.cleanConfig(),h=Pt(u);if(!h.valid){const j=h.errors[0];y(j?`Error: ${j.message}`:"Validation failed"),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{ee.current&&y(null)},3e3);return}i(u),t.markClean();const d=h.warnings.length;y(d>0?`Saved! (${String(d)} warning${d>1?"s":""})`:"Saved!"),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{ee.current&&y(null)},2e3)},[i,t]);W((u,h)=>{if(h.downArrow||u==="j")t.setTemplateIndex(r.templateIndex+1);else if(h.upArrow||u==="k")t.setTemplateIndex(r.templateIndex-1);else if(h.return){const d=V[r.templateIndex];d&&t.applyTemplate(d.id)}else h.escape&&t.dismissTemplateSelector()},{isActive:r.showTemplateSelector}),W((u,h)=>{if(h.escape){X(!1),T("");return}if(h.return){const d=Number.parseInt(Q,10);!Number.isNaN(d)&&d>0&&d<=65535&&t.addPort(d),X(!1),T("");return}if(h.backspace){T(d=>d.slice(0,-1));return}u&&/^\d$/u.test(u)&&T(d=>d+u)},{isActive:U}),W((u,h)=>{if(h.escape){E(null),A(""),w(""),_("key");return}if(h.return){if(C==="key"&&S){_("value");return}if(C==="value"&&S){t.addEnvVar(I,S,H),E(null),A(""),w(""),_("key");return}}if(h.backspace){C==="key"?A(d=>d.slice(0,-1)):w(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(C==="key"?A(d=>d+u):w(d=>d+u))},{isActive:I!==null}),W((u,h)=>{if(h.escape){Z(!1),z(""),G(""),$("source");return}if(h.return){if(O==="source"&&re){$("target");return}if(O==="target"&&ne){$("type");return}if(O==="type"){t.addMount({source:re,target:ne,type:me}),Z(!1),z(""),G(""),$("source");return}}if(O==="type"){switch(u){case"1":{K("volume");break}case"2":{K("bind");break}case"3":{K("tmpfs");break}}return}if(h.backspace){O==="source"?z(d=>d.slice(0,-1)):O==="target"&&G(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(O==="source"?z(d=>d+u):O==="target"&&G(d=>d+u))},{isActive:oe}),W((u,h)=>{if(u==="c"&&h.ctrl){n();return}if(!f){if(a){h.escape||u==="?"?m(!1):h.downArrow||u==="j"?ie.current?.scrollBy(1):h.upArrow||u==="k"?ie.current?.scrollBy(-1):u==="q"&&(m(!1),g(!0));return}if(v){if(h.escape){x(!1),r.section==="features"?t.setFeatureSearch(""):t.setExtensionSearch("");return}if(h.return){x(!1);return}if(h.backspace){r.section==="features"?t.setFeatureSearch(r.featureSearch.slice(0,-1)):t.setExtensionSearch(r.extensionSearch.slice(0,-1));return}if(u&&!h.ctrl&&!h.meta){r.section==="features"?t.setFeatureSearch(r.featureSearch+u):t.setExtensionSearch(r.extensionSearch+u);return}return}if(r.fieldEditing){if(h.escape){t.setFieldEditing(!1);return}if(h.return){t.setFieldEditing(!1);return}return}if(u==="?"){m(!0);return}if(u==="q"){r.isDirty?g(!0):n();return}if(u==="s"){Ae();return}if(h.tab){k(d=>d==="editor"?"preview":"editor");return}if(D==="preview"){if(h.downArrow||u==="j"){R.current?.scrollBy(1);return}if(h.upArrow||u==="k"){R.current?.scrollBy(-1);return}if(h.pageDown){R.current?.scrollBy(10);return}if(h.pageUp){R.current?.scrollBy(-10);return}if(h.home){R.current?.scrollToTop();return}if(h.end){R.current?.scrollToBottom();return}h.escape&&k("editor");return}if(h.downArrow||u==="j"){ge>0&&t.setFieldIndex(Math.min(r.fieldIndex+1,ge-1));return}if(h.upArrow||u==="k"){t.setFieldIndex(Math.max(r.fieldIndex-1,0));return}if(h.return){switch(r.section){case"compose":case"general":case"lifecycle":{t.setFieldEditing(!0);break}case"environment":{const d=Object.keys(r.config.containerEnv??{}).length,j=d,P=d+1+Object.keys(r.config.remoteEnv??{}).length;r.fieldIndex===j?(E("container"),A(""),w(""),_("key")):r.fieldIndex===P&&(E("remote"),A(""),w(""),_("key"));break}case"mounts":{const d=r.config.mounts??[];r.fieldIndex===d.length&&(Z(!0),z(""),G(""),K("volume"),$("source"));break}case"ports":{const d=r.config.forwardPorts??[];r.fieldIndex===d.length&&(X(!0),T(""));break}}return}if(u===" "){switch(r.section){case"extensions":{const j=ue(r.extensionSearch)[r.fieldIndex];j&&t.toggleExtension(j.id);break}case"features":{const j=de(r.featureSearch)[r.fieldIndex];j&&t.toggleFeature(j.id);break}case"general":{const d=Ie-ce.length,j=r.fieldIndex-d;if(j>=0&&j<ce.length){const P=ce[j];t.updateConfig({[P]:!r.config[P]})}break}}return}if(u==="/"){(r.section==="features"||r.section==="extensions")&&x(!0);return}if(u==="A"&&r.section==="mounts"){t.applySuggestedMounts();return}if(u==="a"){if(r.section==="environment"){const d=Object.keys(r.config.containerEnv??{}).length,j=r.fieldIndex<=d?"container":"remote";E(j),A(""),w(""),_("key")}else r.section==="mounts"&&(Z(!0),z(""),G(""),K("volume"),$("source"));return}if(u==="d")switch(r.section){case"environment":{const d=Object.keys(r.config.containerEnv??{}),j=Object.keys(r.config.remoteEnv??{});if(r.fieldIndex<d.length)t.removeEnvVar("container",d[r.fieldIndex]),d.length===1||r.fieldIndex>=d.length-1&&t.setFieldIndex(d.length-2);else{const P=r.fieldIndex-d.length-1;P>=0&&P<j.length&&(t.removeEnvVar("remote",j[P]),j.length===1||P>=j.length-1&&t.setFieldIndex(r.fieldIndex-1))}break}case"mounts":{const d=r.config.mounts??[];if(r.fieldIndex<d.length){t.removeMount(r.fieldIndex);const j=d.length-1;r.fieldIndex>=j&&j>0&&t.setFieldIndex(j-1)}break}case"ports":{const d=r.config.forwardPorts??[];if(r.fieldIndex<d.length){t.removePort(r.fieldIndex);const j=d.length-1;r.fieldIndex>=j&&j>0&&t.setFieldIndex(j-1)}break}}}},{isActive:!r.showTemplateSelector&&!U&&I===null&&!oe});const Fe=p.useMemo(()=>t.getJsonPreview(),[r.config]);if(c<ye||l<Se)return e.jsx(s,{alignItems:"center",height:l,justifyContent:"center",width:c,children:e.jsxs(o,{color:"yellow",children:["Terminal too small (",c,"x",l,"), need"," ",ye,"x",Se]})});if(r.showTemplateSelector)return e.jsx(s,{alignItems:"center",flexDirection:"column",height:l,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(o,{bold:!0,color:"cyan",children:"Select a Template"})}),V.map((u,h)=>{const d=h===r.templateIndex;return e.jsx(s,{children:e.jsxs(o,{color:d?"cyan":void 0,inverse:d,children:[d?" ❯ ":" ",e.jsx(o,{bold:d,children:u.name}),e.jsxs(o,{dimColor:!0,children:[" ","-",u.description]})]})},u.id)}),e.jsx(s,{justifyContent:"center",marginTop:1,children:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(o,{bold:!0,color:"white",children:"Enter"})," ","select"," ",e.jsx(o,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let F;switch(r.section){case"compose":{F=e.jsx(xt,{config:r.config,fieldEditing:r.fieldEditing,fieldIndex:r.fieldIndex,onUpdate:u=>{t.updateConfig(u)}});break}case"environment":{F=e.jsxs(s,{flexDirection:"column",children:[e.jsx(vt,{config:r.config,fieldIndex:r.fieldIndex}),I!==null&&e.jsx(s,{marginTop:1,paddingX:1,children:e.jsxs(o,{color:"cyan",children:["Add"," ",I," ","env:"," ",C==="key"?e.jsxs(o,{children:["key=",e.jsx(o,{color:"yellow",children:S||"_"})," ","(Enter to set value)"]}):e.jsxs(o,{children:[S,"=",e.jsx(o,{color:"yellow",children:H||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{F=e.jsx(wt,{config:r.config,fieldIndex:r.fieldIndex,scrollOffset:M,searchText:r.extensionSearch,viewportHeight:J});break}case"features":{F=e.jsx(yt,{config:r.config,fieldIndex:r.fieldIndex,scrollOffset:M,searchText:r.featureSearch,viewportHeight:J});break}case"general":{F=e.jsx(Et,{config:r.config,fieldEditing:r.fieldEditing,fieldIndex:r.fieldIndex,onUpdate:u=>{t.updateConfig(u)}});break}case"lifecycle":{F=e.jsx(Tt,{config:r.config,fieldEditing:r.fieldEditing,fieldIndex:r.fieldIndex,onSetCommand:(u,h)=>{t.setLifecycleCommand(u,h)}});break}case"mounts":{F=e.jsx(Ft,{addingMount:oe,config:r.config,detectedPm:r.detectedPm,fieldIndex:r.fieldIndex,mountPhase:O,mountSource:re,mountTarget:ne,mountType:me,suggestedMounts:r.suggestedMounts});break}case"ports":{F=e.jsx(Lt,{addingPort:U,addPortValue:Q,config:r.config,fieldIndex:r.fieldIndex});break}default:F=e.jsx(o,{children:"Unknown section"})}const Le=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(o,{bold:!0,color:"white",children:"q"}),e.jsx(o,{dimColor:!0,children:"QUIT"})]}),e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"?"}),e.jsx(o,{dimColor:!0,children:"HELP"})]}),e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"↑↓"}),e.jsx(o,{dimColor:!0,children:"NAV"})]}),(r.section==="features"||r.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"Space"}),e.jsx(o,{dimColor:!0,children:"CHECK"})]}),e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"←→"}),e.jsx(o,{dimColor:!0,children:"TABS"})]}),e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"Tab"}),e.jsx(o,{dimColor:!0,children:"PANEL"})]}),(r.section==="features"||r.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"/"}),e.jsx(o,{dimColor:!0,children:"FILTER"})]}),e.jsxs(s,{gap:1,children:[e.jsx(o,{bold:!0,color:"white",children:"s"}),e.jsx(o,{dimColor:!0,children:"SAVE"})]})]}),e.jsxs(s,{paddingX:1,children:[b&&e.jsxs(o,{color:b.startsWith("Error")?"red":"green",children:[b," "]}),r.isDirty&&e.jsx(o,{color:"yellow",children:"[modified]"}),!r.isDirty&&!b&&e.jsx(o,{dimColor:!0,children:"[saved]"})]})]}),Oe=e.jsxs(We,{footer:e.jsxs(o,{dimColor:!0,children:[e.jsx(o,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(o,{bold:!0,color:"white",children:"?"}),"/",e.jsx(o,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:ie,title:"KEYBOARD SHORTCUTS",visible:a,width:56,children:[e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(o,{dimColor:!0,children:"── "}),e.jsx(o,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"←→"}),e.jsx(o,{dimColor:!0,children:" Switch tabs"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"↑↓"}),"/",e.jsx(o,{bold:!0,color:"white",children:"j/k"}),e.jsx(o,{dimColor:!0,children:" Navigate within section"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"Tab"}),e.jsx(o,{dimColor:!0,children:" Switch editor/preview panel"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"Enter"}),e.jsx(o,{dimColor:!0,children:" Edit selected field"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"Esc"}),e.jsx(o,{dimColor:!0,children:" Stop editing / cancel"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(o,{dimColor:!0,children:"── "}),e.jsx(o,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"Space"}),e.jsx(o,{dimColor:!0,children:" Toggle selection"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"/"}),e.jsx(o,{dimColor:!0,children:" Search / filter"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(o,{dimColor:!0,children:"── "}),e.jsx(o,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"a"}),e.jsx(o,{dimColor:!0,children:" Add new entry"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"d"}),e.jsx(o,{dimColor:!0,children:" Delete selected entry"})]})]}),e.jsxs(s,{flexDirection:"column",children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(o,{dimColor:!0,children:"── "}),e.jsx(o,{bold:!0,color:"white",children:"ACTIONS"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"s"}),e.jsx(o,{dimColor:!0,children:" Save configuration"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"q"}),e.jsx(o,{dimColor:!0,children:" Quit"})]}),e.jsxs(o,{children:[" ",e.jsx(o,{bold:!0,color:"white",children:"?"}),e.jsx(o,{dimColor:!0,children:" Toggle help"})]})]})]}),Pe=e.jsx(Ot,{focused:D==="preview",hadComments:r.hadComments,jsonPreview:Fe,mode:r.mode,scrollRef:R}),fe=c>=Mt,Me=fe?Math.floor(c*.38):0;return e.jsxs(s,{flexDirection:"column",height:l,width:c,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(o,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(o,{wrap:"truncate",children:[r.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),e.jsx(s,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(tt,{defaultValue:r.section,keyMap:{useNumbers:!1,useTab:!1},onChange:u=>{t.setSection(u),k("editor")},showIndex:!1,children:Te.map(({id:u,label:h})=>e.jsx(ot,{name:u,children:h},u))})}),e.jsx(s,{flexShrink:0,paddingRight:2,children:e.jsx(o,{dimColor:!0,wrap:"truncate",children:Nt.get(r.section)??""})}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{borderColor:D==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:F}),fe&&e.jsx(s,{flexShrink:0,width:Me,children:Pe})]}),Le,e.jsx(Ve,{autoExitSeconds:3,onCancel:()=>{g(!1)},visible:f}),Oe]})},Kt=async({logger:i,options:t,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const c=n,l=t.template,r=t.output,a=!!process.stdout.isTTY&&!Xe;let m=null;try{m=Ke(c).name}catch{}const f=nt(c);let g=f?.config??null;const v=f?.hadComments??!1;if(l&&!f){const k=V.find(M=>M.id===l);if(!k){const M=V.map(L=>L.id).join(", ");throw new Error(`Unknown template "${l}". Valid templates: ${M}`)}g=k.config}if(!a){g?i.info(JSON.stringify(g,null,2)):(i.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 lt(g,v,m);l&&!f&&b.dismissTemplateSelector();let y=null;if(await Ue(He.createElement(Bt,{onSave:k=>{it(c,k,r),y=k},store:b}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(x),y){const k=r??".devcontainer/devcontainer.json";i.info(`DevContainer config saved to ${k}`)}};export{Kt as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as rr}from"node:module";import{e as ue,m as Ss,$ as or,a as cr,z as ar}from"../packem_shared/index-DHD8wb6Z.js";import{expandAffected as lr,getChangedFiles as dr,buildEnhancedPath as ur,enforceProjectConstraints as fr,expandTokensInString as zt,parsePartition as hr,TaskScheduler as pr,createTaskGraph as mr,reverseTaskGraph as gr,resolveTurboEnvCompat as wr,CompositeLifeCycle as Yt,defaultTaskRunner as Kt,TerminalBuffer as yt,runConcurrently as tt,createLogReporter as vr,generateRunSummary as Xt,writeRunSummary as yr,readLastRunSummary as xr,getLastRunSummaryPath as jr,writeChromeTrace as kr}from"@visulima/task-runner";import{i as Ye}from"../packem_shared/index-BjdW45xX.js";import{U as Ts,W as br,T as Sr,v as Jt,X as Tr,Y as $r,d as Ir,Z as Cr,ao as Er,ap as Rr,aq as Pr,ar as Mr,k as Fr,as as Or}from"./cli-main.js";import{u as U,y as n,X as g,m as a,E as me,R as J,w as Ar,d as Lr,b as Dr,Q as Br}from"./catalog.js";import{V as Ze}from"../packem_shared/vis-user-error-Dkc97rGY.js";import{d as _r,r as Nr}from"../packem_shared/lockfile-35RFsJDs.js";import{y as $s}from"../packem_shared/index-BisalDCf.js";import{F as Yr}from"../packem_shared/failure-log-D92tM0ie.js";import{r as Kr}from"../packem_shared/command-runtime-CiLVo4ED.js";import{r as Xr}from"../packem_shared/toolchain-DY11tPCw.js";import{i as Jr,r as Qr,s as Zr,a as en,b as tn,c as sn,d as rn,e as nn,H as on,f as cn}from"../packem_shared/lifecycle-CfTZQHOG.js";import{s as an}from"../packem_shared/affected-selection-BMoQWuHl.js";import{c as Zt,p as ln,a as dn,b as un,r as fn,f as hn,s as pn}from"../packem_shared/project-name-filter-DsrVo0MY.js";import{p as mn,r as gn,f as wn,a as vn}from"../packem_shared/selectors-B7lSFz7l.js";import{r as at,l as jt,d as yn,s as xn,m as jn,a as kn}from"../packem_shared/target-options-d_rIrLyq.js";import{T as Is,C as Cs,D as lt,E as Es}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as In,j as Cn,X as ht,F as ts}from"../packem_shared/index.server-BAjDJSEu.js";import{parseStacktrace as En,codeFrame as Rn}from"@visulima/error";import{originalPositionFor as Pn,sourceContentFor as Mn,loadSourceMap as Fn}from"@visulima/source-map";import{l as Rs}from"../packem_shared/spinner-BM_0Bj6x.js";import{R as Bn,c as st}from"../packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js";import{c as ss,a as _n,s as rs}from"../packem_shared/watch-Dswvj6Zp.js";import gt from"./index.js";import{U as Ps}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nr;const ir=s=>(nr??=rr(import.meta.url))(s),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,t]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ze.getBuiltinModule(s)}return ir(s)},{existsSync:De,mkdirSync:Gr,writeFileSync:xt,readFileSync:We,openSync:Wr,statSync:Qt,readSync:Hr,closeSync:qr,mkdtempSync:Vr}=Pe("node:fs"),{createInterface:Ur,emitKeypressEvents:zr}=Pe("node:readline"),{isAbsolute:bn,resolve:es,dirname:Sn,relative:Tn}=Pe("node:path"),{fileURLToPath:$n}=Pe("node:url"),{createHash:On}=Pe("node:crypto"),{mkdir:An,appendFile:dt}=Pe("node:fs/promises"),{platform:Ln,homedir:kt,tmpdir:Dn}=Pe("node:os"),{spawn:Nn}=Pe("node:child_process"),Gn=27,Wn={95:"apc",80:"dcs",94:"pm",88:"sos"},Hn={159:"apc",144:"dcs",158:"pm",152:"sos"},Ms=s=>s===155||s===157||s===144||s===152||s===158||s===159,Fs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},rt=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},qn=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Fs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=rt(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=rt(s,e+2,!1),c=Wn[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},Vn=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Fs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=rt(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=rt(s,e+1,!1),c=Hn[t];return r===-1?void 0:{end:r,kind:c}}},Un=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Ms(s.codePointAt(e)))return!0;return!1},zn=s=>{if(!Un(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===Gn)i=qn(s,r);else if(Ms(o))i=Vn(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},Yn=(s,e,t,r,c,o,i,d,u,p,f,h,l,b)=>{const T={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return T.future=u,T.past=p,T.decimal=f,h!==void 0&&(T.unitMap=h),T.groupSeparator=l,T.placeholderSeparator=b,T},Kn={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Xn=Yn(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",Kn,",","_"),ns=new WeakSet,Jn=s=>{if(ns.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ns.add(s)},Os=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},is=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=Os(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const b of f)u+=b==="."?i:d[b]}else u=f.replace(".",i);else u="";const h=t[e];let l=h;return typeof h=="function"&&(l=h(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?l+c+u:u+c+l},Qn=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const h=r[i];u=d===t.length-1?p/h:Math.floor(p/h),o[i]=u,p-=u*h}if(e.round){let h=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(h--,h===0)){for(let l=d+1;l<t.length;l++){const b=t[l],T=o[b];o[i]=(o[i]??0)+T*r[b]/r[i],o[b]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const l=Math.round(u);if(o[i]=l,d===0)break;const b=t[d-1],T=r[b],N=Math.floor(l*r[i]/T);if(N)o[b]=(o[b]??0)+N,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let h,l=0;for(h=d+1,t.length;h<t.length;h++){const b=t[h];l+=o[b]*(e.unitMeasures[b]/e.unitMeasures[i])}u+=l,e.maxDecimalPoints!==void 0&&(u=Os(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},Zn=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const h=c.at(-1);return is({unitCount:0,unitName:h},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(h=>is(h,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},ei=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Xn,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Jn(t.language);const r=Math.abs(s),c=Qn(r,t);return Zn(c,t,s)},be="@voidzero-dev/vite-task-client",bt="@visulima/task-runner-client",nt=`npm:${bt}@^1`,As=ue(".vis",".vite-client-override-declined"),it="pnpm-workspace.yaml",ti=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ls=s=>{try{return JSON.parse(We(s,"utf8"))}catch{return}},si=s=>{const e=ue(s,it);if(De(e))try{return $s(We(e,"utf8")).toJS()?.overrides}catch{return}},ri=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",ni=s=>{const e=ue(s,it);try{const t=$s(We(e,"utf8"));return t.setIn(["overrides",be],nt),xt(e,t.toString()),!0}catch{return!1}},os=s=>s!==void 0&&ti.some(e=>s[e]?.[be]!==void 0),ii=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[be]!==void 0||s.overrides?.[be]!==void 0||s.resolutions?.[be]!==void 0)||e?.[be]!==void 0,oi=(s,e=[])=>{const t=Ls(ue(s,"package.json")),r=De(ue(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ii(t,si(s)),declined:De(ue(s,As)),manager:_r(s)?.manager,present:os(t)||r||e.some(c=>os(c))}},ci=s=>{try{const e=ue(s,As);Gr(Ss(e),{recursive:!0}),xt(e,`Declined adding the ${be} → ${bt} override.
1
+ import{createRequire as rr}from"node:module";import{e as ue,m as Ss,$ as or,a as cr,z as ar}from"../packem_shared/index-DHD8wb6Z.js";import{expandAffected as lr,getChangedFiles as dr,buildEnhancedPath as ur,enforceProjectConstraints as fr,expandTokensInString as zt,parsePartition as hr,TaskScheduler as pr,createTaskGraph as mr,reverseTaskGraph as gr,resolveTurboEnvCompat as wr,CompositeLifeCycle as Yt,defaultTaskRunner as Kt,TerminalBuffer as yt,runConcurrently as tt,createLogReporter as vr,generateRunSummary as Xt,writeRunSummary as yr,readLastRunSummary as xr,getLastRunSummaryPath as jr,writeChromeTrace as kr}from"@visulima/task-runner";import{i as Ye}from"../packem_shared/index-BjdW45xX.js";import{U as Ts,W as br,T as Sr,v as Jt,X as Tr,Y as $r,d as Ir,Z as Cr,ap as Er,aq as Rr,ar as Pr,as as Mr,k as Fr,at as Or}from"./cli-main.js";import{u as U,y as n,X as g,m as a,E as me,R as J,w as Ar,d as Lr,b as Dr,Q as Br}from"./catalog.js";import{V as Ze}from"../packem_shared/vis-user-error-CgyYA29v.js";import{d as _r,r as Nr}from"../packem_shared/lockfile-35RFsJDs.js";import{y as $s}from"../packem_shared/index-BisalDCf.js";import{F as Yr}from"../packem_shared/failure-log-DE_MJCzB.js";import{r as Kr}from"../packem_shared/command-runtime-CiLVo4ED.js";import{r as Xr}from"../packem_shared/toolchain-DY11tPCw.js";import{i as Jr,r as Qr,s as Zr,a as en,b as tn,c as sn,d as rn,e as nn,H as on,f as cn}from"../packem_shared/lifecycle-DW8KRF5d.js";import{s as an}from"../packem_shared/affected-selection-DIgAsQTu.js";import{c as Zt,p as ln,a as dn,b as un,r as fn,f as hn,s as pn}from"../packem_shared/project-name-filter-sYH4Zvsm.js";import{p as mn,r as gn,f as wn,a as vn}from"../packem_shared/selectors-B7lSFz7l.js";import{r as at,l as jt,d as yn,s as xn,m as jn,a as kn}from"../packem_shared/target-options-d_rIrLyq.js";import{T as Is,C as Cs,D as lt,E as Es}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as In,j as Cn,X as ht,F as ts}from"../packem_shared/index.server-BAjDJSEu.js";import{parseStacktrace as En,codeFrame as Rn}from"@visulima/error";import{originalPositionFor as Pn,sourceContentFor as Mn,loadSourceMap as Fn}from"@visulima/source-map";import{l as Rs}from"../packem_shared/spinner-BM_0Bj6x.js";import{R as Bn,c as st}from"../packem_shared/formatBytes-BHAzNIrn-Bkk_uRS-.js";import{c as ss,a as _n,s as rs}from"../packem_shared/watch-Dswvj6Zp.js";import gt from"./index.js";import{U as Ps}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nr;const ir=s=>(nr??=rr(import.meta.url))(s),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,t]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ze.getBuiltinModule(s)}return ir(s)},{existsSync:De,mkdirSync:Gr,writeFileSync:xt,readFileSync:We,openSync:Wr,statSync:Qt,readSync:Hr,closeSync:qr,mkdtempSync:Vr}=Pe("node:fs"),{createInterface:Ur,emitKeypressEvents:zr}=Pe("node:readline"),{isAbsolute:bn,resolve:es,dirname:Sn,relative:Tn}=Pe("node:path"),{fileURLToPath:$n}=Pe("node:url"),{createHash:On}=Pe("node:crypto"),{mkdir:An,appendFile:dt}=Pe("node:fs/promises"),{platform:Ln,homedir:kt,tmpdir:Dn}=Pe("node:os"),{spawn:Nn}=Pe("node:child_process"),Gn=27,Wn={95:"apc",80:"dcs",94:"pm",88:"sos"},Hn={159:"apc",144:"dcs",158:"pm",152:"sos"},Ms=s=>s===155||s===157||s===144||s===152||s===158||s===159,Fs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},rt=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},qn=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Fs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=rt(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=rt(s,e+2,!1),c=Wn[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},Vn=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Fs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=rt(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=rt(s,e+1,!1),c=Hn[t];return r===-1?void 0:{end:r,kind:c}}},Un=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Ms(s.codePointAt(e)))return!0;return!1},zn=s=>{if(!Un(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===Gn)i=qn(s,r);else if(Ms(o))i=Vn(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},Yn=(s,e,t,r,c,o,i,d,u,p,f,h,l,b)=>{const T={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return T.future=u,T.past=p,T.decimal=f,h!==void 0&&(T.unitMap=h),T.groupSeparator=l,T.placeholderSeparator=b,T},Kn={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Xn=Yn(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",Kn,",","_"),ns=new WeakSet,Jn=s=>{if(ns.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ns.add(s)},Os=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},is=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=Os(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const b of f)u+=b==="."?i:d[b]}else u=f.replace(".",i);else u="";const h=t[e];let l=h;return typeof h=="function"&&(l=h(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?l+c+u:u+c+l},Qn=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const h=r[i];u=d===t.length-1?p/h:Math.floor(p/h),o[i]=u,p-=u*h}if(e.round){let h=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(h--,h===0)){for(let l=d+1;l<t.length;l++){const b=t[l],T=o[b];o[i]=(o[i]??0)+T*r[b]/r[i],o[b]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const l=Math.round(u);if(o[i]=l,d===0)break;const b=t[d-1],T=r[b],N=Math.floor(l*r[i]/T);if(N)o[b]=(o[b]??0)+N,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let h,l=0;for(h=d+1,t.length;h<t.length;h++){const b=t[h];l+=o[b]*(e.unitMeasures[b]/e.unitMeasures[i])}u+=l,e.maxDecimalPoints!==void 0&&(u=Os(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},Zn=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const h=c.at(-1);return is({unitCount:0,unitName:h},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(h=>is(h,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},ei=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Xn,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Jn(t.language);const r=Math.abs(s),c=Qn(r,t);return Zn(c,t,s)},be="@voidzero-dev/vite-task-client",bt="@visulima/task-runner-client",nt=`npm:${bt}@^1`,As=ue(".vis",".vite-client-override-declined"),it="pnpm-workspace.yaml",ti=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ls=s=>{try{return JSON.parse(We(s,"utf8"))}catch{return}},si=s=>{const e=ue(s,it);if(De(e))try{return $s(We(e,"utf8")).toJS()?.overrides}catch{return}},ri=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",ni=s=>{const e=ue(s,it);try{const t=$s(We(e,"utf8"));return t.setIn(["overrides",be],nt),xt(e,t.toString()),!0}catch{return!1}},os=s=>s!==void 0&&ti.some(e=>s[e]?.[be]!==void 0),ii=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[be]!==void 0||s.overrides?.[be]!==void 0||s.resolutions?.[be]!==void 0)||e?.[be]!==void 0,oi=(s,e=[])=>{const t=Ls(ue(s,"package.json")),r=De(ue(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ii(t,si(s)),declined:De(ue(s,As)),manager:_r(s)?.manager,present:os(t)||r||e.some(c=>os(c))}},ci=s=>{try{const e=ue(s,As);Gr(Ss(e),{recursive:!0}),xt(e,`Declined adding the ${be} → ${bt} override.
2
2
  Delete this file to be asked again.
3
3
  `)}catch{}},ai=(s,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&De(ue(s,it))&&ni(s))return{file:it,installCommand:t};const r=ue(s,"package.json"),c=Ls(r);if(!c)return;const o=ri(e);o==="pnpm.overrides"?(c.pnpm??={},c.pnpm.overrides??={},c.pnpm.overrides[be]=nt):(c[o]??={},c[o][be]=nt);try{xt(r,`${JSON.stringify(c,void 0,4)}
4
4
  `)}catch{return}return{file:"package.json",installCommand:t}},li=async(s,e)=>{const t=oi(s,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined)return!1;const r=Ur({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${be}. Its cache hints no-op under @visulima/task-runner unless aliased to ${bt} (a drop-in replacement).`);const c=await new Promise(i=>{r.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(c.trim()))return ci(s),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=ai(s,t.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${be}": "${nt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{r.close()}},di=({interactive:s,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:s&&t!==!1,ui=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),fi=(s,e,t)=>{const r=new Set,c=[];if(s===void 0||s.trim()==="")return{skipTaskIds:r,unmatchedPatterns:c};const o=[...t],i=new Set(o),d=new Map;for(const u of o){const p=u.lastIndexOf(":");if(p===-1)continue;const f=u.slice(p+1),h=d.get(f);h===void 0?d.set(f,[u]):h.push(u)}for(const u of ui(s)){if(u.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${u}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(u)){r.add(u);continue}const p=mn(u);if(!p){c.push(u);continue}let f=!1;switch(p.kind){case"all":{const h=d.get(p.target)??[];for(const l of h)r.add(l),f=!0;break}case"project":{const h=p.projects?.[0];if(h!==void 0){const l=`${h}:${p.target}`;i.has(l)&&(r.add(l),f=!0)}break}case"tag":{const{tag:h}=p;if(h!==void 0){const l=d.get(p.target)??[];for(const b of l){const T=b.slice(0,b.lastIndexOf(":"));e.projects[T]?.tags?.includes(h)===!0&&(r.add(b),f=!0)}}break}}f||c.push(u)}return{skipTaskIds:r,unmatchedPatterns:c}},hi=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,pi=new Set(["0","!","#","$","*","-","?","@","_"]),mi=s=>{const e=new Map;for(const t of s.matchAll(hi)){const r=t[1],c=t[3],o=t[2],i=r??c;if(i===void 0||pi.has(i))continue;const d=o!==void 0,u=e.get(i);u===void 0?e.set(i,d):u&&!d&&e.set(i,!1)}return[...e.entries()].map(([t,r])=>({hasDefault:r,name:t}))},gi=s=>{const{command:e,processEnv:t,taskEnv:r,taskId:c}=s,o=mi(e);if(o.length===0)return;const i=[];for(const{hasDefault:d,name:u}of o){if(d)continue;const p=r[u],f=t[u];p===void 0&&f===void 0&&i.push(u)}if(i.length!==0)return{missing:i.toSorted(),taskId:c}},wi=s=>{const e=s.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${s.taskId} references unset variable${s.missing.length===1?"":"s"} ${e}. Set ${s.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},vi=64*1024,cs=256,yi=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),pt=s=>s.replaceAll(yi,"").replaceAll("\r","");class as{#e=[];#r=new Set;#s=new Map;#n=new Map;constructor(e=[]){for(const t of e)this.#n.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=()=>this.#s;subscribe=e=>(this.#r.add(e),()=>{this.#r.delete(e)});getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,t=!1;for(const r of this.#n.values())r.status==="crashed"||r.status==="failed"?e=!0:(r.status==="pending"||r.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#n.has(e)||(this.#n.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,r=>({...r,startedAt:r.startedAt??Date.now(),status:r.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,r=>({...r,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,r){const c=r?.message;this.#t(e,o=>({...o,errorMessage:pt(c??t),status:"failed"}))}markCrashed(e,t){const r=t.slice(-cs).map(c=>pt(c));this.#t(e,c=>({...c,errorMessage:r.length>0?r[r.length-1]:"process exited",status:"crashed",tailLines:r}))}appendLog(e,t){const r=t.split(`
@@ -176,12 +176,12 @@ ${this.#r}`:this.#r}}const zs=s=>{const e=s.overrides.visOptions;if(e&&typeof e=
176
176
  `));const ee=b?.get(t.id),ie={INIT_CWD:d,VIS_TASK_SLOTS:String(S),...ae,...ee,...r.env,...Q,...t.overrides[Ct]};if(I?.strictEnv??F??!1){const z=gi({command:O,processEnv:process.env,taskEnv:ie,taskId:t.id});if(z){const we=wi(z);return u?.onTaskStderr?.(t,we),{code:1,terminalOutput:we}}}const ge=I?.pty===!0,le=!!N,q=t.pty===!0?!0:t.pty===!1?!1:le||ge;q&&(t.cache=!1);const K=q?void 0:new Yo(ct),re=q?new yt(ct):void 0;let X;const Se=z=>{if(z.kind==="started"&&(X=z.kill,z.write&&N&&N.set(t.id,{kill:z.kill,resize:z.resize,write:z.write}),T?.onRegistryTaskStarted(t.id)),(z.kind==="stdout"||z.kind==="stderr")&&z.text!==void 0)if(z.kind==="stdout"?u?.onTaskStdout?.(t,z.text):u?.onTaskStderr?.(t,z.text),re)re.write(z.text),le&&h?.(t.id,re.toString()),T&&T.onTaskOutput(t.id,z.text);else{const we=`${z.text}
177
177
  `;K.append(we),f?.(t.id,we)}z.kind==="close"&&(N&&N.delete(t.id),T&&T.onRegistryTaskClosed(t.id,z.exitCode??0,!!z.killed).catch(()=>{}))},_=async()=>{const z=I?.retryCount??0,we=I?.retryDelay,Me=l?l.claim(z):z,Fe=typeof I?.timeout=="number"&&I.timeout>0?I.timeout:0,_e=typeof I?.killGracePeriodMs=="number"&&I.killGracePeriodMs>=0?I.killGracePeriodMs:5e3;let ne=!1,Te=0;const Oe=ro({killGracePeriodMs:_e,onTimeout:()=>{ne=!0},sendSignal:ve=>{X?.(ve)},timeoutMs:Fe});let fe;try{fe=await tt([{command:se,cwd:j,env:ie,name:t.id,...q?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:Se,...Me>0?{restart:{delay:we??"exponential",onRetry:async(ve,Ce,$)=>{Te=ve,i&&await i.callHook("task:retry",t,ve,$)},tries:Me}}:{}})}finally{Oe.cancel()}const xe=fe.closeEvents[0],$e=re?re.toString():K.toString();return ne?{code:124,retryAttempts:Te,terminalOutput:`${$e}
178
178
  [timeout] Task "${t.id}" exceeded ${Fe}ms budget.
179
- `}:{code:xe?.exitCode??1,retryAttempts:Te,terminalOutput:$e}};return p?Qo(p,I?.mutex,_):_()}},tc=s=>{if(!s||s.trim().length===0)return;const e=Number.parseFloat(s);return!Number.isFinite(e)||e<=0?{invalid:s}:{value:Math.floor(e)}},sc=async(s,e)=>{const t=await xr(s,{dataDirectory:st(s)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${jr(s,{dataDirectory:st(s)})}.`);return}const r=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${r}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const d=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${d}ms)`)}e.info("")}const c=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(c.length>0){e.info("Slowest tasks:");for(const o of c)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},rc=s=>{if(!(s===void 0||s==="")){if(s!=="read"&&s!=="write"&&s!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${s}")`);return s}},nc=s=>{if(!(s===void 0||s==="")){if(s!=="http"&&s!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${s}")`);return s}},ic=s=>{if(!(s===void 0||s==="")){if(s!=="declared"&&s!=="trace")throw new Error(`--hash-mode must be one of: declared, trace (received "${s}")`);return s}},Mc=async({argument:s,logger:e,options:t,visConfig:r,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const o=c;if(Kr({logger:e,options:t,visConfig:r},o),Bn(o),t.lastDetails===!0){await sc(o,e);return}const i=process.cwd(),d=await Ar(o),{config:u,packageJsons:p,projectOptions:f,workspace:h}=Lr(o,r,d),l=Dr(o,h,p);let b=s[0];if(!b){const m=Zt(h);if(process.stdout.isTTY&&process.stdin.isTTY){const v=await ln(m);if(!v){e.info("No target selected.");return}b=v,await Qi(`vis run ${v}`)}else{e.info("Available targets:"),e.info(""),e.info(dn(m)),e.info(""),e.info("Usage: vis run <target>");return}}if(u.constraints&&!t.skipConstraints){const m=fr(l,u.constraints);if(m.length>0){for(const v of m)e.error(`[${v.rule}] ${v.message}`);throw new Error(`${m.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(!t.affected){const m=t.uncommitted===!1?"--no-uncommitted":"--uncommitted",v=[["--base",t.base],["--head",t.head],["--downstream",t.downstream],["--upstream",t.upstream],[m,t.uncommitted]].filter(([,y])=>y!==void 0).map(([y])=>y);if(v.length>0)throw new Ze(`${v.join(", ")} ${v.length===1?"requires":"require"} --affected.
179
+ `}:{code:xe?.exitCode??1,retryAttempts:Te,terminalOutput:$e}};return p?Qo(p,I?.mutex,_):_()}},tc=s=>{if(!s||s.trim().length===0)return;const e=Number.parseFloat(s);return!Number.isFinite(e)||e<=0?{invalid:s}:{value:Math.floor(e)}},sc=async(s,e)=>{const t=await xr(s,{dataDirectory:st(s)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${jr(s,{dataDirectory:st(s)})}.`);return}const r=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${r}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const d=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${d}ms)`)}e.info("")}const c=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(c.length>0){e.info("Slowest tasks:");for(const o of c)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},rc=s=>{if(!(s===void 0||s==="")){if(s!=="read"&&s!=="write"&&s!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${s}")`);return s}},nc=s=>{if(!(s===void 0||s==="")){if(s!=="http"&&s!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${s}")`);return s}},ic=s=>{if(!(s===void 0||s==="")){if(s!=="declared"&&s!=="trace")throw new Error(`--hash-mode must be one of: declared, trace (received "${s}")`);return s}},Mc=async({argument:s,logger:e,options:t,visConfig:r,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const o=c;if(Kr({logger:e,options:t,visConfig:r},o),Bn(o),t.lastDetails){await sc(o,e);return}const i=process.cwd(),d=await Ar(o),{config:u,packageJsons:p,projectOptions:f,workspace:h}=Lr(o,r,d),l=Dr(o,h,p);let b=s[0];if(!b){const m=Zt(h);if(process.stdout.isTTY&&process.stdin.isTTY){const v=await ln(m);if(!v){e.info("No target selected.");return}b=v,await Qi(`vis run ${v}`)}else{e.info("Available targets:"),e.info(""),e.info(dn(m)),e.info(""),e.info("Usage: vis run <target>");return}}if(u.constraints&&!t.skipConstraints){const m=fr(l,u.constraints);if(m.length>0){for(const v of m)e.error(`[${v.rule}] ${v.message}`);throw new Error(`${m.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(!t.affected){const m=t.uncommitted?"--uncommitted":"--no-uncommitted",v=[["--base",t.base],["--head",t.head],["--downstream",t.downstream],["--upstream",t.upstream],[m,t.uncommitted]].filter(([,y])=>y!==void 0).map(([y])=>y);if(v.length>0)throw new Ze(`${v.join(", ")} ${v.length===1?"requires":"require"} --affected.
180
180
  Did you mean: vis run ${b} --affected ${v.map(y=>y.includes("uncommitted")?y:`${y}=…`).join(" ")}
181
181
  Or use the dedicated command: vis affected ${b} …`)}const T=await gn(b,h,process.cwd(),o),N=un(f),F=fn(T.target,N);F!==T.target&&e.debug?.(`Resolved alias "${T.target}" → "${F}"`);let S=T.projects;const E=s.slice(1).map(String);if(t.projects!==void 0&&(S=hn(S,String(t.projects),Object.keys(h.projects))),t.filter&&t.filter.length>0){const m=new Map;for(const[P,G]of p)m.set(P,G.name);const v=await xo(t.filter,{defaultBase:r?.defaultBase,packageNameByProject:m,projectGraph:l,workspaceRoot:o}),y=new Set(v);if(S=S.filter(P=>y.has(P)),S.length===0){e.info(`Filter ${t.filter.map(P=>`"${P}"`).join(", ")} matched no projects.`);return}}if(t.query&&(S=wn(S,h,t.query),S.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}if(t.tag&&t.tag.length>0&&(S=vn(S,h,t.tag),S.length===0)){e.info(`Tag filter ${t.tag.map(m=>`"${m}"`).join(", ")} matched no projects.`);return}let I;if(t.affected){const m=await an({base:t.base,downstream:t.downstream,head:t.head,uncommitted:t.uncommitted,upstream:t.upstream},{projectGraph:l,projects:h.projects,workspaceRoot:o},{defaultBase:r?.defaultBase});for(const y of m.notes)e.info(`▸ ${y}`);if(m.changedFiles.length===0){e.info("No files changed. Nothing to run.");return}const v=new Set(m.affectedProjects);if(S=S.filter(y=>v.has(y)),S.length===0){e.info("No projects affected by the changes.");return}I=m.changedFiles,e.info(`Affected projects: ${S.join(", ")}`)}const j=yn(),R=process.env[$t],w=I??(R?R.split(`
182
- `).filter(Boolean):void 0),O=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,B=O?new Set(O.split(",").map(m=>m.trim()).filter(Boolean)):void 0,k=[],W=new Map;for(const m of S){const y=f.get(m)?.[F];if(!y)continue;const P=y.options;if(!P?.internal){if(!xn(P,!!Ye)){e.debug?.(`Skipping ${m}:${F} — runInCI filter`);continue}if(!jn(P,B)){e.debug?.(`Skipping ${m}:${F} — runner-tags filter`);continue}k.push(m),W.set(m,y)}}if(k.length===0){const m=Zt(h),v=Object.entries(h.projects).filter(([,y])=>y.targets?.[F]!==void 0).map(([y])=>y);if(e.error(`No projects have the "${F}" target.`),v.length>0){e.info(""),e.info(`Target "${F}" exists in these projects but was filtered out:`);for(const y of v.slice(0,5))e.info(` - ${y}`);v.length>5&&e.info(` …and ${v.length-5} more`)}else{const y=pn(F,m,3);y.length>0&&(e.info(""),e.info(y.length===1?`Did you mean "${y[0]}"?`:`Did you mean one of: ${y.map(P=>`"${P}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const se=t.pty===!0,ae=k.map(m=>({project:m,schema:W.get(m)?.arguments})).filter(m=>Array.isArray(m.schema)&&m.schema.length>0),Q=new Map;for(const{project:m,schema:v}of ae){const y=JSON.stringify(v),P=Q.get(y)??[];P.push(m),Q.set(y,P)}if(Q.size>1){const m=[...Q.values()].map(v=>v.join(", ")).join(" | ");throw new Error(`Target "${F}" declares conflicting \`arguments\` schemas across projects (${m}). Run a single project (e.g. \`vis run ${ae[0]?.project}:${F}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ee=ae[0]?.schema,ie=W.get(ae[0]?.project??k[0])?.description,oe=qo(F,ie,ee,E);if(oe.kind==="help"){e.info(oe.text);return}if(oe.kind==="invalid"){e.info(`Invalid arguments for "${F}":`);for(const m of oe.errors)e.info(` ✖ ${m}`);throw e.info(""),e.info(oe.help),new Error(`Invalid arguments for target "${F}"`)}const ge=oe.env,le=ic(t.hashMode);let q=k.map(m=>{const v=h.projects[m],y=W.get(m),P={project:m,target:F},G=`${m}:${F}`,Z=se?{...y.options,pty:y.options?.pty??!0}:y.options,D=y.command?zt(y.command,{affectedFiles:w,projectRoot:v?.root}):y.command,A=v?.root&&v.root.length>0?v.root:".",Y=(y.outputs??[]).map(H=>typeof H!="string"?H:H.replaceAll("{projectRoot}",A).replaceAll("{projectName}",m));return{cache:y.cache,hashMode:le??y.hashMode,id:G,outputs:Y,overrides:{command:D,...E.length>0?{[Ys]:E}:{},...Object.keys(ge).length>0?{[Ct]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:y.parallelism,projectRoot:v?.root,target:P}});const K=[],re=[];for(const m of q)zs(m)?.persistent?(m.cache=!1,K.push(m)):re.push(m);q=re;const X=hr(t.partition);if(X&&(q=pr.partitionTasks(q,X),e.info(`Partition ${X.index}/${X.total}: running ${q.length} task(s)`),q.length===0)){e.info("No tasks assigned to this partition.");return}const Se=new Set([...q,...K].map(m=>m.id));let _=mr([...q,...K],{onCycleBroken:m=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${m.join(" → ")}`)},projectGraph:l,targetDefaults:u.tasks,workspace:h});for(const[m,v]of Object.entries(_.tasks)){const y=v.target.project,P=v.target.target,G=f.get(y)?.[P];if(!G){Se.has(m)||e.warn(`${P} required via dependsOn but no command is configured for ${y} — skipping (no-op).`);continue}const Z=h.projects[y];let D=!1;const A={...v.overrides};A.visOptions===void 0&&G.options&&(A.visOptions=G.options,D=!0),A.command===void 0&&G.command&&(A.command=zt(G.command,{affectedFiles:w,projectRoot:Z?.root}),D=!0),D&&(v.overrides=A,_.tasks[m]=v)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const m=fi(t.skipCache,h,Object.keys(_.tasks));for(const v of m.skipTaskIds){const y=_.tasks[v];y!==void 0&&(y.cache=!1)}m.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${m.unmatchedPatterns.map(v=>`"${v}"`).join(", ")}`),m.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(m.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await Xr(o,u.toolchain,{error:m=>{e.error(m)},info:m=>{e.info(m)},warn:m=>{e.warn(m)}},!!t.skipToolchain);const z=t.preflight!==!1&&u.preflight?.lockfile!==!1,we=Nr(o,Ye,{warn:m=>{e.warn(m)}},{skip:!z});if(!we.shouldContinue)throw new Error(`${we.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);z&&!Ye&&process.stdin.isTTY&&process.stdout.isTTY&&await li(o,{interactive:!0,logger:{info:m=>{e.info(m)},warn:m=>{e.warn(m)}},projectManifests:[...p.values()]});const Me=process.env.VIS_VERSION??"0.0.0",Fe=t.dryRun?void 0:async m=>{try{return await tn(m.config,{timeoutMs:Vo}),!0}catch{return!1}},_e=await sn(o),ne=await uo({initialTasks:[...q,...K],probe:Fe,registeredEntries:_e,taskGraph:_,visVersion:Me}),Te=[];let Oe,fe=0;const xe=[],$e=new Map;let ve=[];const Ce=new Set;let $=null,x=null;if(ne.diagnostics.length>0){const m=!!(process.stdout.isTTY&&process.stdin.isTTY),v=t.dryRun?"off":Lo({cli:t.services,config:u.run?.services,isCi:!!Ye,isPersistentTarget:K.length>0,isTty:m,target:F});if(v==="off"){for(const H of ne.diagnostics)e.error(H.message);const A=Ao({cli:t.services,config:u.run?.services}),Y=[];throw t.dryRun?Y.push("`--dry-run` never starts services; drop it to let vis boot them."):A==="default"?Y.push("vis only auto-starts service deps in an interactive terminal by default (this run is CI or non-TTY).","Pass `--services=ephemeral` to boot them for this run, or set `run.services` in vis.config.ts."):A==="cli"?Y.push("`--services=off` was passed; use `--services=ephemeral` to boot them for this run."):Y.push('`run.services: "off"` is set in vis.config.ts; override it with `--services=ephemeral`.'),new Ze([`${ne.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`,...Y].join(`
182
+ `).filter(Boolean):void 0),O=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,B=O?new Set(O.split(",").map(m=>m.trim()).filter(Boolean)):void 0,k=[],W=new Map;for(const m of S){const y=f.get(m)?.[F];if(!y)continue;const P=y.options;if(!P?.internal){if(!xn(P,!!Ye)){e.debug?.(`Skipping ${m}:${F} — runInCI filter`);continue}if(!jn(P,B)){e.debug?.(`Skipping ${m}:${F} — runner-tags filter`);continue}k.push(m),W.set(m,y)}}if(k.length===0){const m=Zt(h),v=Object.entries(h.projects).filter(([,y])=>y.targets?.[F]!==void 0).map(([y])=>y);if(e.error(`No projects have the "${F}" target.`),v.length>0){e.info(""),e.info(`Target "${F}" exists in these projects but was filtered out:`);for(const y of v.slice(0,5))e.info(` - ${y}`);v.length>5&&e.info(` …and ${v.length-5} more`)}else{const y=pn(F,m,3);y.length>0&&(e.info(""),e.info(y.length===1?`Did you mean "${y[0]}"?`:`Did you mean one of: ${y.map(P=>`"${P}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const se=t.pty,ae=k.map(m=>({project:m,schema:W.get(m)?.arguments})).filter(m=>Array.isArray(m.schema)&&m.schema.length>0),Q=new Map;for(const{project:m,schema:v}of ae){const y=JSON.stringify(v),P=Q.get(y)??[];P.push(m),Q.set(y,P)}if(Q.size>1){const m=[...Q.values()].map(v=>v.join(", ")).join(" | ");throw new Error(`Target "${F}" declares conflicting \`arguments\` schemas across projects (${m}). Run a single project (e.g. \`vis run ${ae[0]?.project}:${F}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ee=ae[0]?.schema,ie=W.get(ae[0]?.project??k[0])?.description,oe=qo(F,ie,ee,E);if(oe.kind==="help"){e.info(oe.text);return}if(oe.kind==="invalid"){e.info(`Invalid arguments for "${F}":`);for(const m of oe.errors)e.info(` ✖ ${m}`);throw e.info(""),e.info(oe.help),new Error(`Invalid arguments for target "${F}"`)}const ge=oe.env,le=ic(t.hashMode);let q=k.map(m=>{const v=h.projects[m],y=W.get(m),P={project:m,target:F},G=`${m}:${F}`,Z=se?{...y.options,pty:y.options?.pty??!0}:y.options,D=y.command?zt(y.command,{affectedFiles:w,projectRoot:v?.root}):y.command,A=v?.root&&v.root.length>0?v.root:".",Y=(y.outputs??[]).map(H=>typeof H!="string"?H:H.replaceAll("{projectRoot}",A).replaceAll("{projectName}",m));return{cache:y.cache,hashMode:le??y.hashMode,id:G,outputs:Y,overrides:{command:D,...E.length>0?{[Ys]:E}:{},...Object.keys(ge).length>0?{[Ct]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:y.parallelism,projectRoot:v?.root,target:P}});const K=[],re=[];for(const m of q)zs(m)?.persistent?(m.cache=!1,K.push(m)):re.push(m);q=re;const X=hr(t.partition);if(X&&(q=pr.partitionTasks(q,X),e.info(`Partition ${X.index}/${X.total}: running ${q.length} task(s)`),q.length===0)){e.info("No tasks assigned to this partition.");return}const Se=new Set([...q,...K].map(m=>m.id));let _=mr([...q,...K],{onCycleBroken:m=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${m.join(" → ")}`)},projectGraph:l,targetDefaults:u.tasks,workspace:h});for(const[m,v]of Object.entries(_.tasks)){const y=v.target.project,P=v.target.target,G=f.get(y)?.[P];if(!G){Se.has(m)||e.warn(`${P} required via dependsOn but no command is configured for ${y} — skipping (no-op).`);continue}const Z=h.projects[y];let D=!1;const A={...v.overrides};A.visOptions===void 0&&G.options&&(A.visOptions=G.options,D=!0),A.command===void 0&&G.command&&(A.command=zt(G.command,{affectedFiles:w,projectRoot:Z?.root}),D=!0),D&&(v.overrides=A,_.tasks[m]=v)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const m=fi(t.skipCache,h,Object.keys(_.tasks));for(const v of m.skipTaskIds){const y=_.tasks[v];y!==void 0&&(y.cache=!1)}m.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${m.unmatchedPatterns.map(v=>`"${v}"`).join(", ")}`),m.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(m.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await Xr(o,u.toolchain,{error:m=>{e.error(m)},info:m=>{e.info(m)},warn:m=>{e.warn(m)}},!!t.skipToolchain);const z=t.preflight!==!1&&u.preflight?.lockfile!==!1,we=Nr(o,Ye,{warn:m=>{e.warn(m)}},{skip:!z});if(!we.shouldContinue)throw new Error(`${we.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);z&&!Ye&&process.stdin.isTTY&&process.stdout.isTTY&&await li(o,{interactive:!0,logger:{info:m=>{e.info(m)},warn:m=>{e.warn(m)}},projectManifests:[...p.values()]});const Me=process.env.VIS_VERSION??"0.0.0",Fe=t.dryRun?void 0:async m=>{try{return await tn(m.config,{timeoutMs:Vo}),!0}catch{return!1}},_e=await sn(o),ne=await uo({initialTasks:[...q,...K],probe:Fe,registeredEntries:_e,taskGraph:_,visVersion:Me}),Te=[];let Oe,fe=0;const xe=[],$e=new Map;let ve=[];const Ce=new Set;let $=null,x=null;if(ne.diagnostics.length>0){const m=!!(process.stdout.isTTY&&process.stdin.isTTY),v=t.dryRun?"off":Lo({cli:t.services,config:u.run?.services,isCi:!!Ye,isPersistentTarget:K.length>0,isTty:m,target:F});if(v==="off"){for(const H of ne.diagnostics)e.error(H.message);const A=Ao({cli:t.services,config:u.run?.services}),Y=[];throw t.dryRun?Y.push("`--dry-run` never starts services; drop it to let vis boot them."):A==="default"?Y.push("vis only auto-starts service deps in an interactive terminal by default (this run is CI or non-TTY).","Pass `--services=ephemeral` to boot them for this run, or set `run.services` in vis.config.ts."):A==="cli"?Y.push("`--services=off` was passed; use `--services=ephemeral` to boot them for this run."):Y.push('`run.services: "off"` is set in vis.config.ts; override it with `--services=ephemeral`.'),new Ze([`${ne.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`,...Y].join(`
183
183
  `))}const y=ne.diagnostics.map(A=>A.targetId),P=v,G=P==="registry"?qs(o,y,_):void 0,Z=process.argv[1]??"vis",D=Fo({missingServiceIds:y,mode:P,taskGraph:_,visBin:Z,workspaceRoot:o});if(D.skipped.length>0){for(const{id:A,reason:Y}of D.skipped)e.error(`Cannot auto-start ${A}: ${Y}`);throw new Ze(`${D.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Te.push(...D.ephemeralPidFiles),Oe=D.runDir,ve=D.chain;for(const A of D.chain)Ce.add(A);if(P==="registry"&&(fe=D.chain.length,xe.push(...D.chain)),D.chain.length>0){const A=new as(D.chain),Y=new Map;if(P==="ephemeral"&&D.runDir)for(const H of D.chain){const M=Vs(D.runDir,`${D.runDir}/bootstrap.mjs`,H);Y.set(H,{ephemeral:{configFile:M.configFile,cwd:o,logFile:M.logFile,pidFile:M.pidFile,scriptPath:M.scriptPath},mode:"ephemeral"})}else if(P==="registry"&&G)for(const H of G.services)Y.set(H.id,{mode:"registry",registry:{command:H.command,config:H.config,cwd:H.cwd,env:H.env}});if(Y.size>0){const H=new So({indexToId:new Map,services:Y,sink:{crashed:(M,L)=>{A.markCrashed(M,L)},failed:(M,L,V)=>{A.markFailed(M,L,V)},log:(M,L)=>{A.appendLog(M,L)},ready:(M,L)=>{A.markReady(M,L)},started:(M,L)=>{A.markStarted(M,L),P==="registry"&&L!==null&&$e.set(M,L)},starting:M=>{A.markStarting(M)}},workspaceRoot:o});$=A,x=H}}for(const[A,Y]of D.serviceEnvByTaskId){const H=ne.serviceEnvByTaskId.get(A)??{};ne.serviceEnvByTaskId.set(A,{...H,...Y})}}const C=new Set(K.map(m=>m.id));if(q=ne.initialTasks.filter(m=>!C.has(m.id)),_=ne.taskGraph,ve.length>0&&(q=[...ve.map(v=>_.tasks[v]).filter(v=>v!==void 0),...q]),K.length>0){const m=new Set(K.map(Z=>Z.id)),v={};for(const[Z,D]of Object.entries(_.tasks))m.has(Z)||(v[Z]=D);const y={};for(const[Z,D]of Object.entries(_.dependencies))m.has(Z)||(y[Z]=D.filter(A=>!m.has(A)));const P=new Set;for(const Z of Object.values(y))for(const D of Z)P.add(D);const G=Object.keys(v).filter(Z=>!P.has(Z));_={dependencies:y,roots:G,tasks:v}}const{serviceEnvByTaskId:te}=ne;if(ne.satisfiedServices.length>0){const m=ne.satisfiedServices.map(v=>v.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${m}`),$)for(const v of ne.satisfiedServices)$.registerService(v.id);else $=new as(ne.satisfiedServices.map(v=>v.id));for(const v of ne.satisfiedServices){const y=v.config.readiness?.tcp?.port??v.config.port??0,P=v.config.readiness?.tcp?.host??"127.0.0.1";$.markReady(v.id,{host:P,port:y})}}if(t.reverse&&(_=gr(_),e.debug?.(`Reversed task graph: ${String(_.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const m=Object.keys(_.tasks).length,v=_.roots.length;e.info(`Execution plan (${String(m)} task(s), ${String(v)} root(s)):`),e.info("");const y=new Set,P=(G,Z)=>{if(y.has(G))return;y.add(G);for(const H of _.dependencies[G]??[])P(H,Z+1);const D=_.tasks[G],A=" ".repeat(Z+1),Y=`${D?.cache===!1?" (no-cache)":""}${D?.hashMode==="trace"?" (trace)":""}`;e.info(`${A}${G}${Y}`)};for(const G of _.roots)P(G,0);for(const G of Object.keys(_.tasks))P(G,0);K.length>0&&(e.info(""),e.info(` + ${String(K.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const Ae=Date.now(),Ie=rn(),Et=(m,v)=>{const y=v instanceof Error?v.message:String(v);e.warn(`Plugin error in ${m}: ${y}`)};await nn(Ie,u.plugins);const qe=typeof t.profile=="string"?t.profile:void 0,Rt=async m=>{if(!qe)return;const v=Xt(m,_,Ae),y=qe.startsWith("/")?qe:`${o}/${qe}`;await kr(v,y),e.info(`Profile written to ${qe}`)},Xe=u.taskRunner??{},Ks=Cr(o,t.cacheDir,Xe.cacheDirectory,u.sharedWorktreeCache),Xs=Er(Ks,o,u.branchScopedCache),Ne=tc(process.env.VIS_RUN_CONCURRENCY_LIMIT);Ne&&"invalid"in Ne&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${Ne.invalid} is not a positive number; falling back to default concurrency.`);const Js=Ne&&"value"in Ne?Ne.value:void 0,ut=t.parallel??Js??3,Pt=t.strictEnv??u.strictEnv??!1,Mt=new Set,Le={dryRun:t.dryRun??!1,parallel:ut,skipNxCache:!t.cache,summarize:t.summarize??!1,...Xe,cacheDirectory:Xs,dataDirectory:Xe.dataDirectory??st(o),namedInputs:u.namedInputs,onDiagnostic:(m,v)=>{Mt.has(m)||(Mt.add(m),e.warn(v))},onFingerprint:async(m,v)=>{await Ie.callHook("task:fingerprint",m,v)}},Ft=wr(Xe.remoteCache);if(Ft){const m=rc(t.cacheMode),v=nc(t.cacheBackend);if(Le.remoteCache={...Ft,...m?{mode:m}:{},...v?{backend:v}:{}},Le.remoteCache.attestation){const{expectedIdentity:y,requireOnDownload:P}=Le.remoteCache.attestation;if(!(y!==void 0&&("github"in y&&typeof y.github?.ref=="string"&&typeof y.github.repo=="string"&&typeof y.github.workflow=="string"||"oidcIssuer"in y&&typeof y.oidcIssuer=="string"&&(typeof y.san=="string"||typeof y.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in y&&(!y.sanRegex.startsWith("^")||!y.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:Z,isSigstoreInstalled:D}=await import("./loader.js");D()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
184
- ${Z(o)}`);const{buildCacheAttestationHooks:A}=await import("./cache-attestation.js");Le.remoteCache.attestation=A({expectedIdentity:y,onReject:(Y,H)=>{e.warn(`[vis run] remote cache entry ${Y.slice(0,12)} rejected: attestation ${H}. Treating as a cache miss.`)},onVerifyFailure:Y=>{e.warn(`[vis run] attestation verification failed: ${Y}`)},requireOnDownload:P,workspaceRoot:o})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const Qs=process.stdout.isTTY&&!Ye,Zs=r?.run?.quietOnSuccess===!0,er=u.tui?.autoExit??(Zs?3:!1),Ot={args:{parallel:Le.parallel,targets:[F]},autoExit:er,projectNames:k,tasks:[...q,...K],totalTaskCount:Object.keys(_.tasks).length+K.length},At=typeof t.retryBudget=="number"?t.retryBudget:void 0,Lt=At===void 0?void 0:Zo(At),Dt=new on(Ie,Et),Bt=new Yr(o),_t=Ki(t.outputStyle,r?.run?.quietOnSuccess);if(ne.satisfiedServices.length>0)for(const m of ne.satisfiedServices){const v=ne.serviceDependentsByServiceId.get(m.id)??[];try{await Ie.callHook("service:attach",m,v)}catch(y){Et("service:attach",y)}}await Ie.callHook("run:before",{tasks:q,workspaceRoot:o});const Ve=t.stopServices===!0;let Nt=!1;const Gt=()=>{if(Nt)return;Nt=!0,x&&x.dispose().catch(()=>{});const m=Ve?[...$e.values()]:void 0;zo({extraPids:m,pidFiles:Te,runDir:Oe})},Je=()=>{Gt()},Wt=Te.length>0||Oe!==void 0||Ve&&xe.length>0;Wt&&(process.on("SIGINT",Je),process.on("SIGTERM",Je));try{if(Qs){const m=new Map,v=zi({...Ot,onRetryService:x?M=>x.retry(M):void 0,outputStyle:_t,serviceDockStore:$,stdinRegistry:m}),{lifeCycle:y,store:P}=v,G=new Yt([y,Dt,Bt]),D=bs({affectedFiles:w,currentOs:j,hooks:Ie,initCwd:i,lifeCycle:G,mutexPool:new Map,onOutput:(M,L)=>{x&&Ce.has(M)?x.onTaskOutput(M,L):P.addOutput(M,L)},onOutputReplace:(M,L)=>{P.setOutput(M,L)},retryBudget:Lt,serviceEnvByTaskId:te,serviceEventBridge:x??void 0,stdinRegistry:m,strictEnv:Pt,taskSlots:ut,workspaceRoot:o});let A="rerun",Y=null,H=new Map;for(;A!=="quit";){if(A==="rerun"){if(H=await Kt(q,Le,{lifeCycle:G,projectGraph:l,taskExecutor:D,taskGraph:_,workspaceRoot:o}),K.length>0&&!t.failFast){const M=new Promise(L=>{const V=P.subscribe(()=>{const de=P.getSnapshot();(de.rerunRequested||de.retryTaskId)&&(V(),L())});v.renderIsDone.then(()=>{V(),L()}).catch(()=>{V(),L()})});await js(K,o,w,i,{abortSignal:M,lifeCycle:G,stdinRegistry:m,store:P},te)}}else if(A==="retry"&&Y){const M=q.find(V=>V.id===Y),L=M?.overrides.command;if(M&&L){const V=at(o,M.projectRoot,!1);G.startTasks?.([M]);const de=new yt(ct),pe=(await tt([{command:L,cwd:V,name:M.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:ce=>{ce.kind==="started"&&ce.write&&m.set(M.id,{kill:ce.kill,resize:ce.resize,write:ce.write}),(ce.kind==="stdout"||ce.kind==="stderr")&&ce.text&&(de.write(ce.text),P.setOutput(M.id,de.toString())),ce.kind==="close"&&m.delete(M.id)}})).closeEvents[0];G.endTasks?.([{code:pe?.exitCode??1,status:pe?.exitCode===0?"success":"failure",task:M,terminalOutput:P.getSnapshot().outputs.get(M.id)}])}else M&&G.endTasks?.([{code:1,status:"failure",task:M,terminalOutput:`No command configured for ${M.id}`}]);Y=null,P.markDone()}A=await new Promise(M=>{const L=P.subscribe(()=>{const V=P.getSnapshot();V.rerunRequested&&(P.acknowledgeRerun(),L(),M("rerun")),V.retryTaskId&&(Y=P.acknowledgeRetry(),L(),M("retry"))});v.renderIsDone.then(()=>{L(),M("quit")}).catch(()=>{L(),M("quit")})})}await v.renderIsDone,await Ie.callHook("run:after",H),await Rt(H),fe>0&&(e.info(""),Ve?e.info(`${String(fe)} service(s) stopped (--stop-services).`):e.info(`${String(fe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const m=new Map,v=typeof t.log=="string"?t.log.toLowerCase():"",y=v==="labeled"||v==="grouped"||v==="interleaved"?v:void 0,P=y?vr(y):void 0,G=new Yt([new Ji({...Ot,ciGrouping:r?.run?.ciGrouping??"auto",logReporter:P,outputStyle:_t}),Dt,Bt]),Z=bs({affectedFiles:w,currentOs:j,hooks:Ie,initCwd:i,lifeCycle:G,mutexPool:m,retryBudget:Lt,serviceEnvByTaskId:te,serviceEventBridge:x??void 0,strictEnv:Pt,taskSlots:ut,workspaceRoot:o}),D=async()=>{const L=Date.now(),V=await Kt(q,Le,{lifeCycle:G,projectGraph:l,taskExecutor:Z,taskGraph:_,workspaceRoot:o}),de=Date.now()-L;if(t.summarize){const ye=Xt(V,_,Ae);await yr(ye,o,{dataDirectory:st(o)})}let je=!1;for(const[,ye]of V)ye.status==="failure"&&(je=!0);const pe=Rr(V,de),ce=Pr(o),Ee=Mr(o,de,ce);return e.info(""),e.info(` ${pe}${Ee?` ${Ee}`:""}`),{hasFailure:je,results:V,runHistory:ce}},A=await D();await Ie.callHook("run:after",A.results),await Rt(A.results);const{hasFailure:Y}=A;if(t.watch){const L=k.map(he=>{const Re=h.projects[he]?.root;if(Re)return Re.startsWith("/")?Re:`${o}/${Re}`}).filter(he=>he!==void 0),V=q;let de;const je=he=>{const ke=no(V,he);return de=ke.filter,q=ke.tasks,ke.tasks.length};let pe=!1,ce=A.results;const Ee=()=>{const he=ss(ce,o);if(he.directories.length>0&&he.files.size>0){const ke=_n(he.files,o,he.directories);return{handle:rs({filter:ke,onChange:Qe,paths:he.directories}),mode:"tracked"}}return{handle:rs({onChange:Qe,paths:L}),mode:"roots"}};let ye;const Qe=async he=>{if(!pe){pe=!0;try{e.info(`Change detected in ${he.length} file(s), rerunning…`),ce=(await D()).results,ye?.close(),ye=Ee().handle}finally{pe=!1}}},Ht=Ee();ye=Ht.handle;const tr=Ht.mode==="tracked"?`Watching ${String(ss(ce,o).files.size)} tracked file(s)`:`Watching ${String(L.length)} project root(s)`;e.info(`${tr} — edit a file to rerun, press h for keybinds, q to quit.`);const ft=async()=>{if(!pe){pe=!0;try{if(q.length===0){e.info("No tasks match the active filter — press a to clear it.");return}ce=(await D()).results,ye?.close(),ye=Ee().handle}finally{pe=!1}}};await new Promise(he=>{let ke=!1,Re;const qt=()=>{Vt()},Vt=()=>{ke||(ke=!0,Re?.close(),process.off("SIGINT",qt),ye?.close(),he())};process.on("SIGINT",qt),Re=ao({handlers:{onClearFilter:async()=>{const Ue=je(void 0);e.info(`Filter cleared — running ${String(Ue)} task(s).`),await ft()},onFilter:async Ue=>{const sr=de,Ut=je(Ue);if(Ut===0){e.info(`Filter "${Ue}" matched no projects — keeping previous filter.`),je(sr);return}e.info(`Filter "${Ue}" matched ${String(Ut)} task(s).`),await ft()},onHelp:()=>{oo(process.stdout)},onQuit:()=>{Vt()},onRerun:ft}})});return}if(t.flaky!==!1){const L=Fr(o,{minRuns:2},A.runHistory);if(L.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const V of Or(L))e.info(` ${V}`);e.info("")}}const H=[];for(const[L,V]of A.results)V.retryAttempts&&V.retryAttempts>0&&H.push(L);const M=t.failOnRetry===!0&&H.length>0;if(M){const V=H.slice(0,5),de=H.length-V.length,je=de>0?`${V.join(", ")}, and ${String(de)} more`:V.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(H.length)} task(s) succeeded only after retry: ${je}`)}if(Y||M){const L=M&&!Y?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",V=2e3,de=[];for(const[je,pe]of A.results){if(pe.status!=="failure")continue;const ce=pe.terminalOutput??"",Ee=ce.length>V?`…${ce.slice(-V)}`:ce,ye=pe.code??"?";de.push(` ${je} (exit ${String(ye)}):
184
+ ${Z(o)}`);const{buildCacheAttestationHooks:A}=await import("./cache-attestation.js");Le.remoteCache.attestation=A({expectedIdentity:y,onReject:(Y,H)=>{e.warn(`[vis run] remote cache entry ${Y.slice(0,12)} rejected: attestation ${H}. Treating as a cache miss.`)},onVerifyFailure:Y=>{e.warn(`[vis run] attestation verification failed: ${Y}`)},requireOnDownload:P,workspaceRoot:o})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const Qs=process.stdout.isTTY&&!Ye,Zs=r?.run?.quietOnSuccess===!0,er=u.tui?.autoExit??(Zs?3:!1),Ot={args:{parallel:Le.parallel,targets:[F]},autoExit:er,projectNames:k,tasks:[...q,...K],totalTaskCount:Object.keys(_.tasks).length+K.length},At=typeof t.retryBudget=="number"?t.retryBudget:void 0,Lt=At===void 0?void 0:Zo(At),Dt=new on(Ie,Et),Bt=new Yr(o),_t=Ki(t.outputStyle,r?.run?.quietOnSuccess);if(ne.satisfiedServices.length>0)for(const m of ne.satisfiedServices){const v=ne.serviceDependentsByServiceId.get(m.id)??[];try{await Ie.callHook("service:attach",m,v)}catch(y){Et("service:attach",y)}}await Ie.callHook("run:before",{tasks:q,workspaceRoot:o});const Ve=t.stopServices;let Nt=!1;const Gt=()=>{if(Nt)return;Nt=!0,x&&x.dispose().catch(()=>{});const m=Ve?[...$e.values()]:void 0;zo({extraPids:m,pidFiles:Te,runDir:Oe})},Je=()=>{Gt()},Wt=Te.length>0||Oe!==void 0||Ve&&xe.length>0;Wt&&(process.on("SIGINT",Je),process.on("SIGTERM",Je));try{if(Qs){const m=new Map,v=zi({...Ot,onRetryService:x?M=>x.retry(M):void 0,outputStyle:_t,serviceDockStore:$,stdinRegistry:m}),{lifeCycle:y,store:P}=v,G=new Yt([y,Dt,Bt]),D=bs({affectedFiles:w,currentOs:j,hooks:Ie,initCwd:i,lifeCycle:G,mutexPool:new Map,onOutput:(M,L)=>{x&&Ce.has(M)?x.onTaskOutput(M,L):P.addOutput(M,L)},onOutputReplace:(M,L)=>{P.setOutput(M,L)},retryBudget:Lt,serviceEnvByTaskId:te,serviceEventBridge:x??void 0,stdinRegistry:m,strictEnv:Pt,taskSlots:ut,workspaceRoot:o});let A="rerun",Y=null,H=new Map;for(;A!=="quit";){if(A==="rerun"){if(H=await Kt(q,Le,{lifeCycle:G,projectGraph:l,taskExecutor:D,taskGraph:_,workspaceRoot:o}),K.length>0&&!t.failFast){const M=new Promise(L=>{const V=P.subscribe(()=>{const de=P.getSnapshot();(de.rerunRequested||de.retryTaskId)&&(V(),L())});v.renderIsDone.then(()=>{V(),L()}).catch(()=>{V(),L()})});await js(K,o,w,i,{abortSignal:M,lifeCycle:G,stdinRegistry:m,store:P},te)}}else if(A==="retry"&&Y){const M=q.find(V=>V.id===Y),L=M?.overrides.command;if(M&&L){const V=at(o,M.projectRoot,!1);G.startTasks?.([M]);const de=new yt(ct),pe=(await tt([{command:L,cwd:V,name:M.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:ce=>{ce.kind==="started"&&ce.write&&m.set(M.id,{kill:ce.kill,resize:ce.resize,write:ce.write}),(ce.kind==="stdout"||ce.kind==="stderr")&&ce.text&&(de.write(ce.text),P.setOutput(M.id,de.toString())),ce.kind==="close"&&m.delete(M.id)}})).closeEvents[0];G.endTasks?.([{code:pe?.exitCode??1,status:pe?.exitCode===0?"success":"failure",task:M,terminalOutput:P.getSnapshot().outputs.get(M.id)}])}else M&&G.endTasks?.([{code:1,status:"failure",task:M,terminalOutput:`No command configured for ${M.id}`}]);Y=null,P.markDone()}A=await new Promise(M=>{const L=P.subscribe(()=>{const V=P.getSnapshot();V.rerunRequested&&(P.acknowledgeRerun(),L(),M("rerun")),V.retryTaskId&&(Y=P.acknowledgeRetry(),L(),M("retry"))});v.renderIsDone.then(()=>{L(),M("quit")}).catch(()=>{L(),M("quit")})})}await v.renderIsDone,await Ie.callHook("run:after",H),await Rt(H),fe>0&&(e.info(""),Ve?e.info(`${String(fe)} service(s) stopped (--stop-services).`):e.info(`${String(fe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const m=new Map,v=typeof t.log=="string"?t.log.toLowerCase():"",y=v==="labeled"||v==="grouped"||v==="interleaved"?v:void 0,P=y?vr(y):void 0,G=new Yt([new Ji({...Ot,ciGrouping:r?.run?.ciGrouping??"auto",logReporter:P,outputStyle:_t}),Dt,Bt]),Z=bs({affectedFiles:w,currentOs:j,hooks:Ie,initCwd:i,lifeCycle:G,mutexPool:m,retryBudget:Lt,serviceEnvByTaskId:te,serviceEventBridge:x??void 0,strictEnv:Pt,taskSlots:ut,workspaceRoot:o}),D=async()=>{const L=Date.now(),V=await Kt(q,Le,{lifeCycle:G,projectGraph:l,taskExecutor:Z,taskGraph:_,workspaceRoot:o}),de=Date.now()-L;if(t.summarize){const ye=Xt(V,_,Ae);await yr(ye,o,{dataDirectory:st(o)})}let je=!1;for(const[,ye]of V)ye.status==="failure"&&(je=!0);const pe=Rr(V,de),ce=Pr(o),Ee=Mr(o,de,ce);return e.info(""),e.info(` ${pe}${Ee?` ${Ee}`:""}`),{hasFailure:je,results:V,runHistory:ce}},A=await D();await Ie.callHook("run:after",A.results),await Rt(A.results);const{hasFailure:Y}=A;if(t.watch){const L=k.map(he=>{const Re=h.projects[he]?.root;if(Re)return Re.startsWith("/")?Re:`${o}/${Re}`}).filter(he=>he!==void 0),V=q;let de;const je=he=>{const ke=no(V,he);return de=ke.filter,q=ke.tasks,ke.tasks.length};let pe=!1,ce=A.results;const Ee=()=>{const he=ss(ce,o);if(he.directories.length>0&&he.files.size>0){const ke=_n(he.files,o,he.directories);return{handle:rs({filter:ke,onChange:Qe,paths:he.directories}),mode:"tracked"}}return{handle:rs({onChange:Qe,paths:L}),mode:"roots"}};let ye;const Qe=async he=>{if(!pe){pe=!0;try{e.info(`Change detected in ${he.length} file(s), rerunning…`),ce=(await D()).results,ye?.close(),ye=Ee().handle}finally{pe=!1}}},Ht=Ee();ye=Ht.handle;const tr=Ht.mode==="tracked"?`Watching ${String(ss(ce,o).files.size)} tracked file(s)`:`Watching ${String(L.length)} project root(s)`;e.info(`${tr} — edit a file to rerun, press h for keybinds, q to quit.`);const ft=async()=>{if(!pe){pe=!0;try{if(q.length===0){e.info("No tasks match the active filter — press a to clear it.");return}ce=(await D()).results,ye?.close(),ye=Ee().handle}finally{pe=!1}}};await new Promise(he=>{let ke=!1,Re;const qt=()=>{Vt()},Vt=()=>{ke||(ke=!0,Re?.close(),process.off("SIGINT",qt),ye?.close(),he())};process.on("SIGINT",qt),Re=ao({handlers:{onClearFilter:async()=>{const Ue=je(void 0);e.info(`Filter cleared — running ${String(Ue)} task(s).`),await ft()},onFilter:async Ue=>{const sr=de,Ut=je(Ue);if(Ut===0){e.info(`Filter "${Ue}" matched no projects — keeping previous filter.`),je(sr);return}e.info(`Filter "${Ue}" matched ${String(Ut)} task(s).`),await ft()},onHelp:()=>{oo(process.stdout)},onQuit:()=>{Vt()},onRerun:ft}})});return}if(t.flaky){const L=Fr(o,{minRuns:2},A.runHistory);if(L.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const V of Or(L))e.info(` ${V}`);e.info("")}}const H=[];for(const[L,V]of A.results)V.retryAttempts&&V.retryAttempts>0&&H.push(L);const M=t.failOnRetry&&H.length>0;if(M){const V=H.slice(0,5),de=H.length-V.length,je=de>0?`${V.join(", ")}, and ${String(de)} more`:V.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(H.length)} task(s) succeeded only after retry: ${je}`)}if(Y||M){const L=M&&!Y?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",V=2e3,de=[];for(const[je,pe]of A.results){if(pe.status!=="failure")continue;const ce=pe.terminalOutput??"",Ee=ce.length>V?`…${ce.slice(-V)}`:ce,ye=pe.code??"?";de.push(` ${je} (exit ${String(ye)}):
185
185
  ${Ee.split(`
186
186
  `).map(Qe=>` ${Qe}`).join(`
187
187
  `)}`)}throw new Ze(de.length>0?`${L}
@@ -1,4 +1,4 @@
1
- import{createRequire as vs}from"node:module";import{F as He,b as Yt,X as ca,J as Dr,q as la}from"../packem_shared/index.server-BAjDJSEu.js";import{v as Dt,a as Or,U as Et,z as ks,e as Ut}from"../packem_shared/index-DHD8wb6Z.js";import{g as As}from"../packem_shared/_commonjsHelpers-DTfxOvZk.js";import{fingerprint as Nt,scan as ha,scanFiles as xs,inspectRuleset as Cs,listRules as Hr,listRequiredValidators as Ns,scanGitHistory as js}from"@visulima/secret-scanner";import{at as $s,au as Yr,p as de}from"./cli-main.js";import{I as Is,W as Es}from"../packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js";import{U as Ds}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{y as Fr}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as Os}from"../packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js";let ws;const Ps=e=>(ws??=vs(import.meta.url))(e),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Er=e=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[t,n]=zt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return zt.getBuiltinModule(e)}return Ps(e)},{createRequire:Ts}=Er("node:module"),{pathToFileURL:da}=Er("node:url"),{execFileSync:Hs}=Er("node:child_process");let Fs;const Gs=e=>(Fs??=Ts(import.meta.url))(e),Bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ss=e=>{if(typeof Bt<"u"&&Bt.versions&&Bt.versions.node){const[t,n]=Bt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Bt.getBuiltinModule(e)}return Gs(e)},{styleText:zs}=Ss("node:util"),Bs={error:"✖",info:"ℹ",success:"✓",warning:"⚠"},Vs=()=>{const{env:e}=process;return!!e.CI||e.CONTINUOUS_INTEGRATION==="true"||"BUILD_NUMBER"in e||"RUN_ID"in e},Ms=/\u001B\[[\d;]*[a-z]/gi,Ls=e=>[...e.replaceAll(Ms,"")].length,Ks=e=>{const t=[];return e.bold&&t.push("bold"),e.dim&&t.push("dim"),e.italic&&t.push("italic"),e.underline&&t.push("underline"),e.strikethrough&&t.push("strikethrough"),e.color&&t.push(e.color),e.bgColor&&t.push(e.bgColor),t.length===0?n=>n:n=>zs(t,n)};let Ws=class{#i=0;#c;#e=!1;#o="";#a="";#m=0;#l=0;#t;#n;#h="";#s;#p;#r;#w;#d=0;#u;#P;constructor(t={},n){if(t.frames)this.#s=t.frames;else{const r=t.name??"dots",o=Es(r);if(!o)throw new Error(`Unknown spinner "${r}". Pass a custom \`frames\` set or use one of: ${Is().join(", ")}.`);this.#s=o}this.#p=t.verbose!==!1,this.#o=t.prefixText??"",this.#t=n,this.#r=t.stream??process.stderr,this.#w=n?!0:this.#r.isTTY&&!Vs(),this.#P={...Bs,...t.icons},typeof t.style=="function"?this.#u=t.style:t.style&&(this.#u=Ks(t.style))}get elapsedTime(){return this.#m===0?0:(this.#l||Date.now())-this.#m}get text(){return this.#a}set text(t){this.#a=t,this.#e&&this.#b()}get prefixText(){return this.#o}set prefixText(t){this.#o=t,this.#e&&this.#b()}get isRunning(){return this.#e}setInteractiveManager(t){this.#t=t}setMultiSpinner(t){this.#n=t}tick(){this.#e&&(this.#i=(this.#i+1)%this.#s.frames.length)}start(t,n){return this.#e?this:this.#p?(this.#e=!0,this.#m=Date.now(),this.#l=0,this.#i=0,this.#h="",t&&(this.#a=t),n?.prefixText&&(this.#o=n.prefixText),this.#n?(this.#n.renderAll(),this):(this.#t?(this.#t.hook(),this.#k(),this.#y()):(this.#A(),this.#y()),this)):this}stop(){if(this.#e){if(this.#f(),this.#e=!1,this.#l=Date.now(),this.#h="",this.#n){this.#n.renderAll();return}this.#t?(this.#t.erase("stdout"),this.#t.unhook(!1)):this.#v()}}stopAndPersist(t){if(!this.#e||(this.#f(),this.#e=!1,this.#l=Date.now(),!this.#p))return;const n=t?.prefixText??this.#o,r=t?.text??this.#a;let o=t?.symbol??"";n&&(o=o?`${n} ${o}`:n),r&&(o=o?`${o} ${r}`:r),this.#x(o)}succeed(t){this.#g("success",t)}failed(t){this.#g("error",t)}warn(t){this.#g("warning",t)}info(t){this.#g("info",t)}pause(){this.#f()}resume(){this.#e&&(this.#f(),this.#n||this.#y())}getFrameOutput(){if(!this.#e&&this.#h)return this.#h;const t=this.#s.frames[this.#i];let n=this.#u?this.#u(t):t;return this.#o&&(n=`${this.#o} ${n}`),this.#a&&(n=`${n} ${this.#a}`),n}#y(){this.#w&&(this.#c=setInterval(()=>{this.#e&&(this.#i=(this.#i+1)%this.#s.frames.length,this.#b())},this.#s.interval),this.#c.unref())}#f(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}#b(){this.#n?this.#n.renderAll():this.#t?this.#k():this.#A()}#k(){this.#t&&this.#t.update("stdout",[this.getFrameOutput()])}#A(){const t=this.getFrameOutput();if(this.#v(),this.#r.isTTY){this.#r.write(t);const n=this.#r.columns||80;this.#d=Math.max(1,Math.ceil(Ls(t)/n))}else this.#r.write(`${t}
1
+ import{createRequire as vs}from"node:module";import{F as He,b as Yt,X as ca,J as Dr,q as la}from"../packem_shared/index.server-BAjDJSEu.js";import{v as Dt,a as Or,U as Et,z as ks,e as Ut}from"../packem_shared/index-DHD8wb6Z.js";import{g as As}from"../packem_shared/_commonjsHelpers-DTfxOvZk.js";import{fingerprint as Nt,scan as ha,scanFiles as xs,inspectRuleset as Cs,listRules as Hr,listRequiredValidators as Ns,scanGitHistory as js}from"@visulima/secret-scanner";import{au as $s,av as Yr,p as de}from"./cli-main.js";import{I as Is,W as Es}from"../packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js";import{U as Ds}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{y as Fr}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as Os}from"../packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js";let ws;const Ps=e=>(ws??=vs(import.meta.url))(e),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Er=e=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[t,n]=zt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return zt.getBuiltinModule(e)}return Ps(e)},{createRequire:Ts}=Er("node:module"),{pathToFileURL:da}=Er("node:url"),{execFileSync:Hs}=Er("node:child_process");let Fs;const Gs=e=>(Fs??=Ts(import.meta.url))(e),Bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ss=e=>{if(typeof Bt<"u"&&Bt.versions&&Bt.versions.node){const[t,n]=Bt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Bt.getBuiltinModule(e)}return Gs(e)},{styleText:zs}=Ss("node:util"),Bs={error:"✖",info:"ℹ",success:"✓",warning:"⚠"},Vs=()=>{const{env:e}=process;return!!e.CI||e.CONTINUOUS_INTEGRATION==="true"||"BUILD_NUMBER"in e||"RUN_ID"in e},Ms=/\u001B\[[\d;]*[a-z]/gi,Ls=e=>[...e.replaceAll(Ms,"")].length,Ks=e=>{const t=[];return e.bold&&t.push("bold"),e.dim&&t.push("dim"),e.italic&&t.push("italic"),e.underline&&t.push("underline"),e.strikethrough&&t.push("strikethrough"),e.color&&t.push(e.color),e.bgColor&&t.push(e.bgColor),t.length===0?n=>n:n=>zs(t,n)};let Ws=class{#i=0;#c;#e=!1;#o="";#a="";#m=0;#l=0;#t;#n;#h="";#s;#p;#r;#w;#d=0;#u;#P;constructor(t={},n){if(t.frames)this.#s=t.frames;else{const r=t.name??"dots",o=Es(r);if(!o)throw new Error(`Unknown spinner "${r}". Pass a custom \`frames\` set or use one of: ${Is().join(", ")}.`);this.#s=o}this.#p=t.verbose!==!1,this.#o=t.prefixText??"",this.#t=n,this.#r=t.stream??process.stderr,this.#w=n?!0:this.#r.isTTY&&!Vs(),this.#P={...Bs,...t.icons},typeof t.style=="function"?this.#u=t.style:t.style&&(this.#u=Ks(t.style))}get elapsedTime(){return this.#m===0?0:(this.#l||Date.now())-this.#m}get text(){return this.#a}set text(t){this.#a=t,this.#e&&this.#b()}get prefixText(){return this.#o}set prefixText(t){this.#o=t,this.#e&&this.#b()}get isRunning(){return this.#e}setInteractiveManager(t){this.#t=t}setMultiSpinner(t){this.#n=t}tick(){this.#e&&(this.#i=(this.#i+1)%this.#s.frames.length)}start(t,n){return this.#e?this:this.#p?(this.#e=!0,this.#m=Date.now(),this.#l=0,this.#i=0,this.#h="",t&&(this.#a=t),n?.prefixText&&(this.#o=n.prefixText),this.#n?(this.#n.renderAll(),this):(this.#t?(this.#t.hook(),this.#k(),this.#y()):(this.#A(),this.#y()),this)):this}stop(){if(this.#e){if(this.#f(),this.#e=!1,this.#l=Date.now(),this.#h="",this.#n){this.#n.renderAll();return}this.#t?(this.#t.erase("stdout"),this.#t.unhook(!1)):this.#v()}}stopAndPersist(t){if(!this.#e||(this.#f(),this.#e=!1,this.#l=Date.now(),!this.#p))return;const n=t?.prefixText??this.#o,r=t?.text??this.#a;let o=t?.symbol??"";n&&(o=o?`${n} ${o}`:n),r&&(o=o?`${o} ${r}`:r),this.#x(o)}succeed(t){this.#g("success",t)}failed(t){this.#g("error",t)}warn(t){this.#g("warning",t)}info(t){this.#g("info",t)}pause(){this.#f()}resume(){this.#e&&(this.#f(),this.#n||this.#y())}getFrameOutput(){if(!this.#e&&this.#h)return this.#h;const t=this.#s.frames[this.#i];let n=this.#u?this.#u(t):t;return this.#o&&(n=`${this.#o} ${n}`),this.#a&&(n=`${n} ${this.#a}`),n}#y(){this.#w&&(this.#c=setInterval(()=>{this.#e&&(this.#i=(this.#i+1)%this.#s.frames.length,this.#b())},this.#s.interval),this.#c.unref())}#f(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}#b(){this.#n?this.#n.renderAll():this.#t?this.#k():this.#A()}#k(){this.#t&&this.#t.update("stdout",[this.getFrameOutput()])}#A(){const t=this.getFrameOutput();if(this.#v(),this.#r.isTTY){this.#r.write(t);const n=this.#r.columns||80;this.#d=Math.max(1,Math.ceil(Ls(t)/n))}else this.#r.write(`${t}
2
2
  `),this.#d=0}#v(){if(this.#d>0&&this.#r.isTTY){for(let t=1;t<this.#d;t+=1)this.#r.write("\x1B[1A\x1B[2K");this.#r.write("\r\x1B[K")}this.#d=0}#x(t){this.#h=t,this.#n?this.#n.renderAll():this.#t?(this.#t.update("stdout",[t]),this.#t.unhook(!1)):(this.#v(),this.#r.write(`${t}
3
3
  `))}#g(t,n){if(!this.#e||(this.#f(),this.#e=!1,this.#l=Date.now(),!this.#p))return;let r="";const o=this.#P[t];o&&(r=this.#u?this.#u(o):o),this.#o&&(r=`${this.#o} ${r}`),n&&(r=`${r} ${n}`),this.#x(r)}};const Js={one:{},two:{},three:{},four:{}},Rs={one:{},two:{},three:{}},qs={},Us=[],cr={methods:Js,model:Rs,compute:qs,hooks:Us},_s=e=>Object.prototype.toString.call(e)==="[object Array]",Qs={compute:function(e){const{world:t}=this,n=t.compute;return typeof e=="string"&&n.hasOwnProperty(e)?n[e](this):_s(e)?e.forEach(r=>{t.compute.hasOwnProperty(r)?n[r](this):console.warn("no compute:",e)}):typeof e=="function"?e(this):console.warn("no compute:",e),this}},Zs=function(e){return this.fullPointer.forEach((n,r)=>{const o=this.update([n]);e(o,r)}),this},Xs=function(e,t){const r=this.fullPointer.map((i,a)=>{const s=this.update([i]),u=e(s,a);return u===void 0?this.none():u});if(r.length===0)return t||this.update([]);if(r[0]!==void 0&&(typeof r[0]=="string"||typeof r[0]=="object"&&(r[0]===null||!r[0].isView)))return r;let o=[];return r.forEach(i=>{o=o.concat(i.fullPointer)}),this.toView(o)},Ys=function(e){let t=this.fullPointer;return t=t.filter((r,o)=>{const i=this.update([r]);return e(i,o)}),this.update(t)},eu=function(e){const n=this.fullPointer.find((r,o)=>{const i=this.update([r]);return e(i,o)});return this.update([n])},tu=function(e){return this.fullPointer.some((n,r)=>{const o=this.update([n]);return e(o,r)})},nu=function(e=1){let t=this.fullPointer,n=Math.floor(Math.random()*t.length);return n+e>this.length&&(n=this.length-e,n=n<0?0:n),t=t.slice(n,n+e),this.update(t)},ru={forEach:Zs,map:Xs,filter:Ys,find:eu,some:tu,random:nu},Fe={termList:function(){return this.methods.one.termList(this.docs)},terms:function(e){const t=this.match(".");return typeof e=="number"?t.eq(e):t},groups:function(e){if(e||e===0)return this.update(this._groups[e]||[]);const t={};return Object.keys(this._groups).forEach(n=>{t[n]=this.update(this._groups[n])}),t},eq:function(e){let t=this.pointer;return t||(t=this.docs.map((n,r)=>[r])),t[e]?this.update([t[e]]):this.none()},first:function(){return this.eq(0)},last:function(){const e=this.fullPointer.length-1;return this.eq(e)},firstTerms:function(){return this.match("^.")},lastTerms:function(){return this.match(".$")},slice:function(e,t){let n=this.pointer||this.docs.map((r,o)=>[o]);return n=n.slice(e,t),this.update(n)},all:function(){return this.update().toView()},fullSentences:function(){const e=this.fullPointer.map(t=>[t[0]]);return this.update(e).toView()},none:function(){return this.update([])},isDoc:function(e){if(!e||!e.isView)return!1;const t=this.fullPointer,n=e.fullPointer;return!t.length===n.length?!1:t.every((r,o)=>n[o]?r[0]===n[o][0]&&r[1]===n[o][1]&&r[2]===n[o][2]:!1)},wordCount:function(){return this.docs.reduce((e,t)=>(e+=t.filter(n=>n.text!=="").length,e),0)},isFull:function(){const e=this.pointer;if(!e)return!0;if(e.length===0||e[0][0]!==0)return!1;let t=0,n=0;return this.document.forEach(r=>t+=r.length),this.docs.forEach(r=>n+=r.length),t===n},getNth:function(e){return typeof e=="number"?this.eq(e):typeof e=="string"?this.if(e):this}};Fe.group=Fe.groups;Fe.fullSentence=Fe.fullSentences;Fe.sentence=Fe.fullSentences;Fe.lastTerm=Fe.lastTerms;Fe.firstTerm=Fe.firstTerms;const lr=Object.assign({},Fe,Qs,ru);lr.get=lr.eq;class ot{constructor(t,n,r={}){[["document",t],["world",cr],["_groups",r],["_cache",null],["viewType","View"]].forEach(i=>{Object.defineProperty(this,i[0],{value:i[1],writable:!0})}),this.ptrs=n}get docs(){let t=this.document;return this.ptrs&&(t=cr.methods.one.getDoc(this.ptrs,this.document)),t}get pointer(){return this.ptrs}get methods(){return this.world.methods}get model(){return this.world.model}get hooks(){return this.world.hooks}get isView(){return!0}get found(){return this.docs.length>0}get length(){return this.docs.length}get fullPointer(){const{docs:t,ptrs:n,document:r}=this;return(n||t.map((i,a)=>[a])).map(i=>{let[a,s,u,c,l]=i;return s=s||0,u=u||(r[a]||[]).length,r[a]&&r[a][s]&&(c=c||r[a][s].id,r[a][u-1]&&(l=l||r[a][u-1].id)),[a,s,u,c,l]})}update(t){const n=new ot(this.document,t);if(this._cache&&t&&t.length>0){const r=[];t.forEach((o,i)=>{const[a,s,u]=o;o.length===1?r[i]=this._cache[a]:s===0&&this.document[a].length===u&&(r[i]=this._cache[a])}),r.length>0&&(n._cache=r)}return n.world=this.world,n}toView(t){return new ot(this.document,t||this.pointer)}fromText(t){const{methods:n}=this,r=n.one.tokenize.fromString(t,this.world),o=new ot(r);return o.world=this.world,o.compute(["normal","freeze","lexicon"]),this.world.compute.preTagger&&o.compute("preTagger"),o.compute("unfreeze"),o}clone(){let t=this.document.slice(0);t=t.map(r=>r.map(o=>(o=Object.assign({},o),o.tags=new Set(o.tags),o)));const n=this.update(this.pointer);return n.document=t,n._cache=this._cache,n}}Object.assign(ot.prototype,lr);const ou="14.15.1",eo=function(e){return e&&typeof e=="object"&&!Array.isArray(e)},iu=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function fa(e,t){if(eo(t))for(const n in t)eo(t[n])?(e[n]||Object.assign(e,{[n]:{}}),fa(e[n],t[n])):Object.assign(e,{[n]:t[n]});return e}function au(e,t){for(const n in t)e[n]=e[n]||{},Object.assign(e[n],t[n]);return e}const su=function(e,t){const n=e.two.models||{};Object.keys(t).forEach(r=>{t[r].pastTense&&(n.toPast&&(n.toPast.ex[r]=t[r].pastTense),n.fromPast&&(n.fromPast.ex[t[r].pastTense]=r)),t[r].presentTense&&(n.toPresent&&(n.toPresent.ex[r]=t[r].presentTense),n.fromPresent&&(n.fromPresent.ex[t[r].presentTense]=r)),t[r].gerund&&(n.toGerund&&(n.toGerund.ex[r]=t[r].gerund),n.fromGerund&&(n.fromGerund.ex[t[r].gerund]=r)),t[r].comparative&&(n.toComparative&&(n.toComparative.ex[r]=t[r].comparative),n.fromComparative&&(n.fromComparative.ex[t[r].comparative]=r)),t[r].superlative&&(n.toSuperlative&&(n.toSuperlative.ex[r]=t[r].superlative),n.fromSuperlative&&(n.fromSuperlative.ex[t[r].superlative]=r))})},pa=function(e,t,n,r){if(iu(e)){e.forEach(u=>pa(u,t,n,r));return}const{methods:o,model:i,compute:a,hooks:s}=t;e.methods&&au(o,e.methods),e.model&&fa(i,e.model),e.irregulars&&su(i,e.irregulars),e.compute&&Object.assign(a,e.compute),s&&(t.hooks=s.concat(e.hooks||[])),e.api&&e.api(n),e.lib&&Object.keys(e.lib).forEach(u=>r[u]=e.lib[u]),e.tags&&r.addTags(e.tags),e.words&&r.addWords(e.words),e.frozen&&r.addWords(e.frozen,!0),e.mutate&&e.mutate(t,r)},uu=function(e){const t=process.env?process.env:self.env||{};return t.DEBUG_TAGS=e==="tagger"||e===!0?!0:"",t.DEBUG_MATCH=e==="match"||e===!0?!0:"",t.DEBUG_CHUNKS=e==="chunker"||e===!0?!0:"",this},cu=e=>Object.prototype.toString.call(e)==="[object Object]",hr=function(e){return Object.prototype.toString.call(e)==="[object Array]"},lu=function(e){return e.map(t=>t.terms.map(n=>(hr(n.tags)&&(n.tags=new Set(n.tags)),n)))},hu=function(e){return e.map(t=>t.map(n=>({text:n,normal:n,pre:"",post:" ",tags:new Set})))},ga=function(e,t,n){const{methods:r}=n,o=new t([]);if(o.world=n,typeof e=="number"&&(e=String(e)),!e)return o;if(typeof e=="string"){const i=r.one.tokenize.fromString(e,n);return new t(i)}if(cu(e)&&e.isView)return new t(e.document,e.ptrs);if(hr(e)){if(hr(e[0])){const a=hu(e);return new t(a)}const i=lu(e);return new t(i)}return o},In=Object.assign({},cr),I=function(e,t){t&&I.addWords(t);const n=ga(e,ot,In);return e&&n.compute(In.hooks),n};Object.defineProperty(I,"_world",{value:In,writable:!0});I.tokenize=function(e,t){const{compute:n}=this._world;t&&I.addWords(t);const r=ga(e,ot,In);return n.contractions&&r.compute(["alias","normal","machine","contractions"]),r};I.plugin=function(e){return pa(e,this._world,ot,this),this};I.extend=I.plugin;I.world=function(){return this._world};I.model=function(){return this._world.model};I.methods=function(){return this._world.methods};I.hooks=function(){return this._world.hooks};I.verbose=uu;I.version=ou;const du=function(e){return e.map(n=>{const r=new Set;return n.forEach(o=>{o.normal!==""&&r.add(o.normal),o.switch&&r.add(`%${o.switch}%`),o.implicit&&r.add(o.implicit),o.machine&&r.add(o.machine),o.root&&r.add(o.root),o.alias&&o.alias.forEach(a=>r.add(a));const i=Array.from(o.tags);for(let a=0;a<i.length;a+=1)r.add("#"+i[a])}),r})},fu={one:{cacheDoc:du}},pu={cache:function(){return this._cache=this.methods.one.cacheDoc(this.document),this},uncache:function(){return this._cache=null,this}},gu=function(e){Object.assign(e.prototype,pu)},mu={cache:function(e){e._cache=e.methods.one.cacheDoc(e.document)}},yu={api:gu,compute:mu,methods:fu},bu={toLowerCase:function(){return this.termList().forEach(e=>{e.text=e.text.toLowerCase()}),this},toUpperCase:function(){return this.termList().forEach(e=>{e.text=e.text.toUpperCase()}),this},toTitleCase:function(){return this.termList().forEach(e=>{e.text=e.text.replace(/^ *[a-z\u00C0-\u00FF]/,t=>t.toUpperCase())}),this},toCamelCase:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.text=t.text.replace(/^ *[a-z\u00C0-\u00FF]/,r=>r.toUpperCase())),n!==e.length-1&&(t.post="")})}),this}},to=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),vu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),wu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),ma=(e,t,n)=>{if(n.forEach(r=>r.dirty=!0),e){const r=[t,0].concat(n);Array.prototype.splice.apply(e,r)}return e},It=function(e){const t=/ $/,n=/[-–—]/,r=e[e.length-1];r&&!t.test(r.post)&&!n.test(r.post)&&(r.post+=" ")},no=(e,t,n)=>{const r=/[-.?!,;:)–—'"]/g,o=e[t-1];if(!o)return;const i=o.post;if(r.test(i)){const a=i.match(r).join(""),s=n[n.length-1];s.post=a+s.post,o.post=o.post.replace(r,"")}},Pu=function(e,t,n){const r=e[t];if(t!==0||!to(r.text))return;n[0].text=vu(n[0].text);const o=e[t];o.tags.has("ProperNoun")||o.tags.has("Acronym")||to(o.text)&&o.text.length>1&&(o.text=wu(o.text))},ku=function(e,t,n,r){const[o,i,a]=t;i===0||a===r[o].length?It(n):(It(n),It([e[t[1]]])),Pu(e,i,n),ma(e,i,n)},Au=function(e,t,n,r){const[o,,i]=t,a=(r[o]||[]).length;i<a?(no(e,i,n),It(n)):a===i&&(It(e),no(e,i,n),r[o+1]&&(n[n.length-1].post+=" ")),ma(e,t[2],n),t[4]=n[n.length-1].id};let Vt=0;const ro=e=>(e=e.length<3?"0"+e:e,e.length<3?"0"+e:e),ya=function(e){let[t,n]=e.index||[0,0];Vt+=1,Vt=Vt>46655?0:Vt,t=t>46655?0:t,n=n>1294?0:n;let r=ro(Vt.toString(36));r+=ro(t.toString(36));let o=n.toString(36);o=o.length<2?"0"+o:o,r+=o;const i=parseInt(Math.random()*36,10);return r+=i.toString(36),e.normal+"|"+r.toUpperCase()},oo=function(e){e.has("@hasContraction")&&typeof e.contractions=="function"&&e.grow("@hasContraction").contractions().expand()},io=e=>Object.prototype.toString.call(e)==="[object Array]",xu=function(e){return e=e.map(t=>(t.id=ya(t),t)),e},Cu=function(e,t){const{methods:n}=t;return typeof e=="string"?n.one.tokenize.fromString(e,t)[0]:typeof e=="object"&&e.isView?e.clone().docs[0]||[]:io(e)?io(e[0])?e[0]:e:[]},ao=function(e,t,n){const{document:r,world:o}=t;t.uncache();const i=t.fullPointer,a=t.fullPointer;t.forEach((u,c)=>{const l=u.fullPointer[0],[d]=l,p=r[d];let P=Cu(e,o);P.length!==0&&(P=xu(P),n?(oo(t.update([l]).firstTerm()),ku(p,l,P,r)):(oo(t.update([l]).lastTerm()),Au(p,l,P,r)),r[d]&&r[d][l[1]]&&(l[3]=r[d][l[1]].id),a[c]=l,l[2]+=P.length,i[c]=l)});const s=t.toView(i);return t.ptrs=a,s.compute(["id","index","freeze","lexicon"]),s.world.compute.preTagger&&s.compute("preTagger"),s.compute("unfreeze"),s},gt={insertAfter:function(e){return ao(e,this,!1)},insertBefore:function(e){return ao(e,this,!0)}};gt.append=gt.insertAfter;gt.prepend=gt.insertBefore;gt.insert=gt.insertAfter;const Nu=/\$[0-9a-z]+/g,Gr={},ju=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),$u=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),Tu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),Iu=function(e,t,n){return e.forEach(r=>{const o=t(r);r.replaceWith(o,n)}),e},Eu=function(e,t){if(typeof e!="string")return e;const n=t.groups();return e=e.replace(Nu,r=>{const o=r.replace(/\$/,"");return n.hasOwnProperty(o)?n[o].text():r}),e};Gr.replaceWith=function(e,t={}){let n=this.fullPointer;const r=this;if(this.uncache(),typeof e=="function")return Iu(r,e,t);const o=r.docs[0];if(!o)return r;const i=t.possessives&&o[o.length-1].tags.has("Possessive"),a=t.case&&ju(o[0].text);e=Eu(e,r);const s=this.update(n);n=n.map(p=>p.slice(0,3));const u=(s.docs[0]||[]).map(p=>Array.from(p.tags)),c=s.docs[0][0].pre,l=s.docs[0][s.docs[0].length-1].post;if(typeof e=="string"&&(e=this.fromText(e).compute("id")),r.insertAfter(e),s.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction+").contractions().expand(),r.delete(s),i){const p=r.docs[0],P=p[p.length-1];P.tags.has("Possessive")||(P.text+="'s",P.normal+="'s",P.tags.add("Possessive"))}if(c&&r.docs[0]&&(r.docs[0][0].pre=c),l&&r.docs[0]){const p=r.docs[0][r.docs[0].length-1];p.post.trim()||(p.post=l)}const d=r.toView(n).compute(["index","freeze","lexicon"]);if(d.world.compute.preTagger&&d.compute("preTagger"),d.compute("unfreeze"),t.tags&&d.terms().forEach((p,P)=>{p.tagSafe(u[P])}),!d.docs[0]||!d.docs[0][0])return d;if(t.case){const p=a?$u:Tu;d.docs[0][0].text=p(d.docs[0][0].text)}return d};Gr.replace=function(e,t,n){if(e&&!t)return this.replaceWith(e,n);const r=this.match(e);return r.found?(this.soften(),r.replaceWith(t,n)):this};const Du=function(e,t){const n=e.length-1,r=e[n],o=e[n-t];o&&r&&(o.post+=r.post,o.post=o.post.replace(/ +([.?!,;:])/,"$1"),o.post=o.post.replace(/[,;:]+([.?!])/,"$1"))},Ou=function(e,t){t.forEach(n=>{const[r,o,i]=n,a=i-o;e[r]&&(i===e[r].length&&i>1&&Du(e[r],a),e[r].splice(o,a))});for(let n=e.length-1;n>=0;n-=1)if(e[n].length===0&&(e.splice(n,1),n===e.length&&e[n-1])){const r=e[n-1],o=r[r.length-1];o&&(o.post=o.post.trimEnd())}return e},Hu=function(e,t){return e=e.map(n=>{const[r]=n;return t[r]&&t[r].forEach(o=>{const i=o[2]-o[1];n[1]<=o[1]&&n[2]>=o[2]&&(n[2]-=i)}),n}),e.forEach((n,r)=>{if(n[1]===0&&n[2]==0)for(let o=r+1;o<e.length;o+=1)e[o][0]-=1,e[o][0]<0&&(e[o][0]=0)}),e=e.filter(n=>n[2]-n[1]>0),e=e.map(n=>(n[3]=null,n[4]=null,n)),e},dr={remove:function(e){const{indexN:t}=this.methods.one.pointer;this.uncache();let n=this.all(),r=this;e&&(n=this,r=this.match(e));const o=!n.ptrs;r.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction").contractions().expand();let i=n.fullPointer;const a=r.fullPointer.reverse(),s=Ou(this.document,a),u=t(a);return i=Hu(i,u),n.ptrs=i,n.document=s,n.compute("index"),o&&(n.ptrs=void 0),e?n.toView(i):(this.ptrs=[],n.none())}};dr.delete=dr.remove;const _t={pre:function(e,t){return e===void 0&&this.found?this.docs[0][0].pre:(this.docs.forEach(n=>{const r=n[0];t===!0?r.pre+=e:r.pre=e}),this)},post:function(e,t){if(e===void 0){const n=this.docs[this.docs.length-1];return n[n.length-1].post}return this.docs.forEach(n=>{const r=n[n.length-1];t===!0?r.post+=e:r.post=e}),this},trim:function(){if(!this.found)return this;const e=this.docs,t=e[0][0];t.pre=t.pre.trimStart();const n=e[e.length-1],r=n[n.length-1];return r.post=r.post.trimEnd(),this},hyphenate:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.pre=""),e[n+1]&&(t.post="-")})}),this},dehyphenate:function(){const e=/[-–—]/;return this.docs.forEach(t=>{t.forEach(n=>{e.test(n.post)&&(n.post=" ")})}),this},toQuotations:function(e,t){return e=e||'"',t=t||'"',this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this},toParentheses:function(e,t){return e=e||"(",t=t||")",this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this}};_t.deHyphenate=_t.dehyphenate;_t.toQuotation=_t.toQuotations;const Fu=(e,t)=>e.normal<t.normal?-1:e.normal>t.normal?1:0,Gu=(e,t)=>{const n=e.normal.trim().length,r=t.normal.trim().length;return n<r?1:n>r?-1:0},Su=(e,t)=>e.words<t.words?1:e.words>t.words?-1:0,zu=(e,t)=>e[0]<t[0]?1:e[0]>t[0]?-1:e[1]>t[1]?1:-1,Bu=function(e){const t={};return e.forEach(n=>{t[n.normal]=t[n.normal]||0,t[n.normal]+=1}),e.sort((n,r)=>{const o=t[n.normal],i=t[r.normal];return o<i?1:o>i?-1:0}),e},Vn={alpha:Fu,length:Gu,wordCount:Su,sequential:zu,byFreq:Bu},Vu=new Set(["index","sequence","seq","sequential","chron","chronological"]),Mu=new Set(["freq","frequency","topk","repeats"]),Lu=new Set(["alpha","alphabetical"]),Ku=function(e,t){let n=e.fullPointer;return n=n.sort((r,o)=>(r=e.update([r]),o=e.update([o]),t(r,o))),e.ptrs=n,e},Wu=function(e){const{docs:t,pointer:n}=this;if(this.uncache(),typeof e=="function")return Ku(this,e);e=e||"alpha";const r=n||t.map((i,a)=>[a]);let o=t.map((i,a)=>({index:a,words:i.length,normal:i.map(s=>s.machine||s.normal||"").join(" "),pointer:r[a]}));return Vu.has(e)&&(e="sequential"),Lu.has(e)&&(e="alpha"),Mu.has(e)?(o=Vn.byFreq(o),this.update(o.map(i=>i.pointer))):typeof Vn[e]=="function"?(o=o.sort(Vn[e]),this.update(o.map(i=>i.pointer))):this},Ju=function(){let e=this.pointer||this.docs.map((t,n)=>[n]);return e=[].concat(e),e=e.reverse(),this._cache&&(this._cache=this._cache.reverse()),this.update(e)},Ru=function(){const e=new Set;return this.filter(n=>{const r=n.text("machine");return e.has(r)?!1:(e.add(r),!0)})},qu={unique:Ru,reverse:Ju,sort:Wu},Uu=e=>Object.prototype.toString.call(e)==="[object Array]",ba=function(e,t){if(e.length>0){const n=e[e.length-1],r=n[n.length-1];/ /.test(r.post)===!1&&(r.post+=" ")}return e=e.concat(t),e},_u=function(e,t){if(e.document===t.document){const r=e.fullPointer.concat(t.fullPointer);return e.toView(r).compute("index")}return t.fullPointer.forEach(r=>{r[0]+=e.document.length}),e.document=ba(e.document,t.docs),e.all()},Qu={concat:function(e){if(typeof e=="string"){const t=this.fromText(e);if(!this.found||!this.ptrs)this.document=this.document.concat(t.document);else{const n=this.fullPointer,r=n[n.length-1][0];this.document.splice(r,0,...t.document)}return this.all().compute("index")}if(typeof e=="object"&&e.isView)return _u(this,e);if(Uu(e)){const t=ba(this.document,e);return this.document=t,this.all()}return this}},Zu=function(){return this.ptrs=this.fullPointer,this},Xu=function(){let e=this.ptrs;return!e||e.length<1?this:(e=e.map(t=>t.slice(0,3)),this.ptrs=e,this)},Yu={harden:Zu,soften:Xu},ec=Object.assign({},bu,gt,Gr,dr,_t,qu,Qu,Yu),tc=function(e){Object.assign(e.prototype,ec)},nc={id:function(e){const t=e.docs;for(let n=0;n<t.length;n+=1)for(let r=0;r<t[n].length;r+=1){const o=t[n][r];o.id=o.id||ya(o)}}},rc={api:tc,compute:nc},oc=[{word:"@",out:["at"]},{word:"arent",out:["are","not"]},{word:"alot",out:["a","lot"]},{word:"brb",out:["be","right","back"]},{word:"cannot",out:["can","not"]},{word:"dun",out:["do","not"]},{word:"can't",out:["can","not"]},{word:"shan't",out:["should","not"]},{word:"won't",out:["will","not"]},{word:"that's",out:["that","is"]},{word:"what's",out:["what","is"]},{word:"let's",out:["let","us"]},{word:"dunno",out:["do","not","know"]},{word:"gonna",out:["going","to"]},{word:"gotta",out:["have","got","to"]},{word:"gimme",out:["give","me"]},{word:"outta",out:["out","of"]},{word:"tryna",out:["trying","to"]},{word:"gtg",out:["got","to","go"]},{word:"im",out:["i","am"]},{word:"imma",out:["I","will"]},{word:"imo",out:["in","my","opinion"]},{word:"irl",out:["in","real","life"]},{word:"ive",out:["i","have"]},{word:"rn",out:["right","now"]},{word:"tbh",out:["to","be","honest"]},{word:"wanna",out:["want","to"]},{word:"c'mere",out:["come","here"]},{word:"c'mon",out:["come","on"]},{word:"shoulda",out:["should","have"]},{word:"coulda",out:["coulda","have"]},{word:"woulda",out:["woulda","have"]},{word:"musta",out:["must","have"]},{word:"tis",out:["it","is"]},{word:"twas",out:["it","was"]},{word:"y'know",out:["you","know"]},{word:"ne'er",out:["never"]},{word:"o'er",out:["over"]},{after:"ll",out:["will"]},{after:"ve",out:["have"]},{after:"re",out:["are"]},{after:"m",out:["am"]},{before:"c",out:["ce"]},{before:"m",out:["me"]},{before:"n",out:["ne"]},{before:"qu",out:["que"]},{before:"s",out:["se"]},{before:"t",out:["tu"]},{word:"shouldnt",out:["should","not"]},{word:"couldnt",out:["could","not"]},{word:"wouldnt",out:["would","not"]},{word:"hasnt",out:["has","not"]},{word:"wasnt",out:["was","not"]},{word:"isnt",out:["is","not"]},{word:"cant",out:["can","not"]},{word:"dont",out:["do","not"]},{word:"wont",out:["will","not"]},{word:"howd",out:["how","did"]},{word:"whatd",out:["what","did"]},{word:"whend",out:["when","did"]},{word:"whered",out:["where","did"]}],pe=!0,ic={st:pe,nd:pe,rd:pe,th:pe,am:pe,pm:pe,max:pe,"°":pe,s:pe,e:pe,er:pe,ère:pe,ème:pe},ac={one:{contractions:oc,numberSuffixes:ic}},Mn=function(e,t,n){const[r,o]=t;!n||n.length===0||(n=n.map((i,a)=>(i.implicit=i.text,i.machine=i.text,i.pre="",i.post="",i.text="",i.normal="",i.index=[r,o+a],i)),n[0]&&(n[0].pre=e[r][o].pre,n[n.length-1].post=e[r][o].post,n[0].text=e[r][o].text,n[0].normal=e[r][o].normal),e[r].splice(o,1,...n))},sc=/'/,uc=new Set(["what","how","when","where","why"]),cc=new Set(["be","go","start","think","need"]),lc=new Set(["been","gone"]),hc=function(e,t){const n=e[t].normal.split(sc)[0];if(uc.has(n))return[n,"did"];if(e[t+1]){if(lc.has(e[t+1].normal))return[n,"had"];if(cc.has(e[t+1].normal))return[n,"would"]}return null},dc=function(e,t){return e[t].normal==="ain't"||e[t].normal==="aint"?null:[e[t].normal.replace(/n't/,""),"not"]},Sr=/'/,fc=/(e|é|aison|sion|tion)$/,pc=/(age|isme|acle|ege|oire)$/,gc=(e,t)=>{const n=e[t].normal.split(Sr)[1];return n&&n.endsWith("e")?["la",n]:["le",n]},mc=(e,t)=>{const n=e[t].normal.split(Sr)[1];return n&&fc.test(n)&&!pc.test(n)?["du",n]:n&&n.endsWith("s")?["des",n]:["de",n]},yc=(e,t)=>["je",e[t].normal.split(Sr)[1]],Ln={preJ:yc,preL:gc,preD:mc},bc=/^([0-9.]{1,4}[a-z]{0,2}) ?[-–—] ?([0-9]{1,4}[a-z]{0,2})$/i,vc=/^([0-9]{1,2}(:[0-9][0-9])?(am|pm)?) ?[-–—] ?([0-9]{1,2}(:[0-9][0-9])?(am|pm)?)$/i,wc=/^[0-9]{3}-[0-9]{4}$/,Pc=function(e,t){const n=e[t];let r=n.text.match(bc);return r!==null?n.tags.has("PhoneNumber")===!0||wc.test(n.text)?null:[r[1],"to",r[2]]:(r=n.text.match(vc),r!==null?[r[1],"to",r[4]]:null)},kc=/^([+-]?[0-9][.,0-9]*)([a-z°²³µ/]+)$/,Ac=function(e,t,n){const r=n.model.one.numberSuffixes||{},i=e[t].text.match(kc);if(i!==null){const a=i[2].toLowerCase().trim();return r.hasOwnProperty(a)?null:[i[1],a]}return null},so=/'/,xc=/^[0-9][^-–—]*[-–—].*?[0-9]/,uo=function(e,t,n,r){const o=t.update();o.document=[e];let i=n+r;n>0&&(n-=1),e[i]&&(i+=1),o.ptrs=[[0,n,i]]},co={t:(e,t)=>dc(e,t),d:(e,t)=>hc(e,t)},lo={j:(e,t)=>Ln.preJ(e,t),l:(e,t)=>Ln.preL(e,t),d:(e,t)=>Ln.preD(e,t)},Cc=function(e,t,n,r){for(let o=0;o<e.length;o+=1){const i=e[o];if(i.word===t.normal)return i.out;if(r!==null&&r===i.after)return[n].concat(i.out);if(n!==null&&n===i.before&&r&&r.length>2)return i.out.concat(r)}return null},Kn=function(e,t){const n=t.fromText(e.join(" "));return n.compute(["id","alias"]),n.docs[0]},Nc=function(e,t){for(let n=t+1;n<5&&e[n];n+=1)if(e[n].normal==="been")return["there","has"];return["there","is"]},jc=e=>{const{world:t,document:n}=e,{model:r,methods:o}=t,i=r.one.contractions||[];n.forEach((a,s)=>{for(let u=a.length-1;u>=0;u-=1){let c=null,l=null;if(so.test(a[u].normal)===!0){const p=a[u].normal.split(so);c=p[0],l=p[1]}let d=Cc(i,a[u],c,l);if(!d&&co.hasOwnProperty(l)&&(d=co[l](a,u,t)),!d&&lo.hasOwnProperty(c)&&(d=lo[c](a,u)),c==="there"&&l==="s"&&(d=Nc(a,u)),d){d=Kn(d,e),Mn(n,[s,u],d),uo(n[s],e,u,d.length);continue}if(xc.test(a[u].normal)){d=Pc(a,u),d&&(d=Kn(d,e),Mn(n,[s,u],d),o.one.setTag(d,"NumberRange",t),d[2]&&d[2].tags.has("Time")&&o.one.setTag([d[0]],"Time",t,null,"time-range"),uo(n[s],e,u,d.length));continue}d=Ac(a,u,t),d&&(d=Kn(d,e),Mn(n,[s,u],d),o.one.setTag([d[1]],"Unit",t,null,"contraction-unit"))}})},$c={contractions:jc},Tc={model:ac,compute:$c,hooks:["contractions"]},ho=function(e){const t=e.world,{model:n,methods:r}=e.world,o=r.one.setTag,{frozenLex:i}=n.one,a=n.one._multiCache||{};e.docs.forEach(s=>{for(let u=0;u<s.length;u+=1){const c=s[u],l=c.machine||c.normal;if(a[l]!==void 0&&s[u+1]){const d=u+a[l]-1;for(let p=d;p>u;p-=1){const P=s.slice(u,p+1),E=P.map(L=>L.machine||L.normal).join(" ");if(i.hasOwnProperty(E)===!0){o(P,i[E],t,!1,"1-frozen-multi-lexicon"),P.forEach(L=>L.frozen=!0);continue}}}if(i[l]!==void 0&&i.hasOwnProperty(l)){o([c],i[l],t,!1,"1-freeze-lexicon"),c.frozen=!0;continue}}})},Ic=function(e){return e.docs.forEach(t=>{t.forEach(n=>{delete n.frozen})}),e},Ec={frozen:ho,freeze:ho,unfreeze:Ic},fo=e=>"\x1B[34m"+e+"\x1B[0m",po=e=>"\x1B[3m\x1B[2m"+e+"\x1B[0m",go=function(e){e.docs.forEach(t=>{console.log(fo(`
4
4
  ┌─────────`)),t.forEach(n=>{let r=` ${po("│")} `;const o=n.implicit||n.text||"-";n.frozen===!0?r+=`${fo(o)} ❄️`:r+=po(o),console.log(r)})})},Dc={compute:Ec,mutate:e=>{const t=e.methods.one;t.termMethods.isFrozen=n=>n.frozen===!0,t.debug.freeze=go,t.debug.frozen=go},api:function(e){e.prototype.freeze=function(){return this.docs.forEach(t=>{t.forEach(n=>{n.frozen=!0})}),this},e.prototype.unfreeze=function(){this.compute("unfreeze")},e.prototype.isFrozen=function(){return this.match("@isFrozen+")}},hooks:["freeze"]},Oc=function(e,t,n){const{model:r,methods:o}=n,i=o.one.setTag,a=r.one._multiCache||{},{lexicon:s}=r.one||{},u=e[t],c=u.machine||u.normal;if(a[c]!==void 0&&e[t+1]){const l=t+a[c]-1;for(let d=l;d>t;d-=1){const p=e.slice(t,d+1);if(p.length<=1)return!1;const P=p.map(E=>E.machine||E.normal).join(" ");if(s.hasOwnProperty(P)===!0){const E=s[P];return i(p,E,n,!1,"1-multi-lexicon"),E&&E.length===2&&(E[0]==="PhrasalVerb"||E[1]==="PhrasalVerb")&&i([p[1]],"Particle",n,!1,"1-phrasal-particle"),!0}}return!1}return null},mo=/^(under|over|mis|re|un|dis|semi|pre|post)-?/,Hc=new Set(["Verb","Infinitive","PastTense","Gerund","PresentTense","Adjective","Participle"]),Fc=function(e,t,n){const{model:r,methods:o}=n,i=o.one.setTag,{lexicon:a}=r.one,s=e[t],u=s.machine||s.normal;if(a[u]!==void 0&&a.hasOwnProperty(u))return i([s],a[u],n,!1,"1-lexicon"),!0;if(s.alias){const c=s.alias.find(l=>a.hasOwnProperty(l));if(c)return i([s],a[c],n,!1,"1-lexicon-alias"),!0}if(mo.test(u)===!0){const c=u.replace(mo,"");if(a.hasOwnProperty(c)&&c.length>3&&Hc.has(a[c]))return i([s],a[c],n,!1,"1-lexicon-prefix"),!0}return null},Gc=function(e){const t=e.world;e.docs.forEach(n=>{for(let r=0;r<n.length;r+=1)if(n[r].tags.size===0){let o=null;o=o||Oc(n,r,t),o=o||Fc(n,r,t)}})},Sc={lexicon:Gc},zc=function(e){const t={},n={};return Object.keys(e).forEach(r=>{const o=e[r];r=r.toLowerCase().trim(),r=r.replace(/'s\b/,"");const i=r.split(/ /);i.length>1&&(n[i[0]]===void 0||i.length>n[i[0]])&&(n[i[0]]=i.length),t[r]=t[r]||o}),delete t[""],delete t[null],delete t[" "],{lex:t,_multi:n}},Bc={one:{expandLexicon:zc}},Vc=function(e,t=!1){const n=this.world(),{methods:r,model:o}=n;if(!e)return;if(Object.keys(e).forEach(s=>{typeof e[s]=="string"&&e[s].startsWith("#")&&(e[s]=e[s].replace(/^#/,""))}),t===!0){const{lex:s,_multi:u}=r.one.expandLexicon(e,n);Object.assign(o.one._multiCache,u),Object.assign(o.one.frozenLex,s);return}if(r.two.expandLexicon){const{lex:s,_multi:u}=r.two.expandLexicon(e,n);Object.assign(o.one.lexicon,s),Object.assign(o.one._multiCache,u)}const{lex:i,_multi:a}=r.one.expandLexicon(e,n);Object.assign(o.one.lexicon,i),Object.assign(o.one._multiCache,a)},Mc={addWords:Vc},Lc={one:{lexicon:{},_multiCache:{},frozenLex:{}}},Kc={model:Lc,methods:Bc,compute:Sc,lib:Mc,hooks:["lexicon"]},Wc=function(e,t){const{methods:n,model:r}=t;return n.one.tokenize.splitTerms(e,r).map(i=>n.one.tokenize.splitWhitespace(i,r)).map(i=>i.text.toLowerCase())},va=function(e,t){const n=[{}],r=[null],o=[0],i=[];let a=0;e.forEach(function(s){let u=0;const c=Wc(s,t);for(let l=0;l<c.length;l++){const d=c[l];n[u]&&n[u].hasOwnProperty(d)?u=n[u][d]:(a++,n[u][d]=a,n[a]={},u=a,r[a]=null)}r[u]=[c.length]});for(const s in n[0])a=n[0][s],o[a]=0,i.push(a);for(;i.length;){const s=i.shift(),u=Object.keys(n[s]);for(let c=0;c<u.length;c+=1){const l=u[c],d=n[s][l];for(i.push(d),a=o[s];a>0&&!n[a].hasOwnProperty(l);)a=o[a];if(n.hasOwnProperty(a)){const p=n[a][l];o[d]=p,r[p]&&(r[d]=r[d]||[],r[d]=r[d].concat(r[p]))}else o[d]=0}}return{goNext:n,endAs:r,failTo:o}},Jc=function(e,t,n){let r=0;const o=[];for(let i=0;i<e.length;i++){const a=e[i][n.form]||e[i].normal;for(;r>0&&(t.goNext[r]===void 0||!t.goNext[r].hasOwnProperty(a));)r=t.failTo[r]||0;if(t.goNext[r].hasOwnProperty(a)&&(r=t.goNext[r][a],t.endAs[r])){const s=t.endAs[r];for(let u=0;u<s.length;u++){const c=s[u],l=e[i-c+1],[d,p]=l.index;o.push([d,p,p+c,l.id])}}}return o},Rc=function(e,t){for(let n=0;n<e.length;n+=1)if(t.has(e[n])===!0)return!1;return!0},qc=function(e,t,n){let r=[];n.form=n.form||"normal";const o=e.docs;if(!t.goNext||!t.goNext[0])return console.error("Compromise invalid lookup trie"),e.none();const i=Object.keys(t.goNext[0]);for(let a=0;a<o.length;a++){if(e._cache&&e._cache[a]&&Rc(i,e._cache[a])===!0)continue;const s=o[a],u=Jc(s,t,n);u.length>0&&(r=r.concat(u))}return e.update(r)},Uc=e=>Object.prototype.toString.call(e)==="[object Object]";function _c(e){e.prototype.lookup=function(t,n={}){if(!t)return this.none();typeof t=="string"&&(t=[t]);const r=Uc(t)?t:va(t,this.world);let o=qc(this,r,n);return o=o.settle(),o}}const Wn=(e,t)=>{for(let n=e.length-1;n>=0;n-=1)if(e[n]!==t)return e=e.slice(0,n+1),e;return e},Qc=function(e){return e.goNext=e.goNext.map(t=>{if(Object.keys(t).length!==0)return t}),e.goNext=Wn(e.goNext,void 0),e.failTo=Wn(e.failTo,0),e.endAs=Wn(e.endAs,null),e},fr={buildTrie:function(e){const t=va(e,this.world());return Qc(t)}};fr.compile=fr.buildTrie;const Zc={api:_c,lib:fr},yo=function(e,t){return t&&e.forEach(n=>{const r=n[0];t[r]&&(n[0]=t[r][0],n[1]+=t[r][1],n[2]+=t[r][1])}),e},wa=function(e,t){let{ptrs:n}=e;const{byGroup:r}=e;return n=yo(n,t),Object.keys(r).forEach(o=>{r[o]=yo(r[o],t)}),{ptrs:n,byGroup:r}},en=function(e,t,n){const r=n.methods.one;return typeof e=="number"&&(e=String(e)),typeof e=="string"&&(e=r.killUnicode(e,n),e=r.parseMatch(e,t,n)),e},Pa=e=>Object.prototype.toString.call(e)==="[object Object]",tn=e=>e&&Pa(e)&&e.isView===!0,nn=e=>e&&Pa(e)&&e.isNet===!0,Xc=function(e,t,n){const r=this.methods.one;if(tn(e))return this.intersection(e);if(nn(e))return this.sweep(e,{tagger:!1}).view.settle();e=en(e,n,this.world);const o={regs:e,group:t},i=r.match(this.docs,o,this._cache),{ptrs:a,byGroup:s}=wa(i,this.fullPointer),u=this.toView(a);return u._groups=s,u},Yc=function(e,t,n){const r=this.methods.one;if(tn(e))return this.intersection(e).eq(0);if(nn(e))return this.sweep(e,{tagger:!1,matchOne:!0}).view;e=en(e,n,this.world);const o={regs:e,group:t,justOne:!0},i=r.match(this.docs,o,this._cache),{ptrs:a,byGroup:s}=wa(i,this.fullPointer),u=this.toView(a);return u._groups=s,u},el=function(e,t,n){const r=this.methods.one;if(tn(e))return this.intersection(e).fullPointer.length>0;if(nn(e))return this.sweep(e,{tagger:!1}).view.found;e=en(e,n,this.world);const o={regs:e,group:t,justOne:!0};return r.match(this.docs,o,this._cache).ptrs.length>0},tl=function(e,t,n){const r=this.methods.one;if(tn(e))return this.filter(u=>u.intersection(e).found);if(nn(e)){const u=this.sweep(e,{tagger:!1}).view.settle();return this.if(u)}e=en(e,n,this.world);const o={regs:e,group:t,justOne:!0};let i=this.fullPointer;const a=this._cache||[];i=i.filter((u,c)=>{const l=this.update([u]);return r.match(l.docs,o,a[c]).ptrs.length>0});const s=this.update(i);return this._cache&&(s._cache=i.map(u=>a[u[0]])),s},nl=function(e,t,n){const{methods:r}=this,o=r.one;if(tn(e))return this.filter(s=>!s.intersection(e).found);if(nn(e)){const s=this.sweep(e,{tagger:!1}).view.settle();return this.ifNo(s)}e=en(e,n,this.world);const i=this._cache||[],a=this.filter((s,u)=>{const c={regs:e,group:t,justOne:!0};return o.match(s.docs,c,i[u]).ptrs.length===0});return this._cache&&(a._cache=a.ptrs.map(s=>i[s[0]])),a},rl={matchOne:Yc,match:Xc,has:el,if:tl,ifNo:nl},ol=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],i=r(this.fullPointer);Object.keys(i).forEach(s=>{const u=i[s].sort((c,l)=>c[1]>l[1]?1:-1)[0];u[1]>0&&o.push([u[0],0,u[1]])});const a=this.toView(o);return e?a.match(e,t,n):a},il=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],i=r(this.fullPointer),a=this.document;Object.keys(i).forEach(u=>{const c=i[u].sort((p,P)=>p[1]>P[1]?-1:1)[0],[l,,d]=c;d<a[l].length&&o.push([l,d,a[l].length])});const s=this.toView(o);return e?s.match(e,t,n):s},al=function(e,t,n){typeof e=="string"&&(e=this.world.methods.one.parseMatch(e,n,this.world)),e[e.length-1].end=!0;const r=this.fullPointer;return this.forEach((o,i)=>{const a=o.before(e,t);if(a.found){const s=a.terms();r[i][1]-=s.length,r[i][3]=s.docs[0][0].id}}),this.update(r)},sl=function(e,t,n){typeof e=="string"&&(e=this.world.methods.one.parseMatch(e,n,this.world)),e[0].start=!0;const r=this.fullPointer;return this.forEach((o,i)=>{const a=o.after(e,t);if(a.found){const s=a.terms();r[i][2]+=s.length,r[i][4]=null}}),this.update(r)},ul=function(e,t,n){return this.growRight(e,t,n).growLeft(e,t,n)},cl={before:ol,after:il,growLeft:al,growRight:sl,grow:ul},ka=function(e,t){return[e[0],e[1],t[2]]},ll=function(e){return Object.prototype.toString.call(e)==="[object Array]"},zr=(e,t,n)=>typeof e=="string"||ll(e)?t.match(e,n):e||t.none(),Br=function(e,t){const[n,r,o]=e;return t.document[n]&&t.document[n][r]&&(e[3]=e[3]||t.document[n][r].id,t.document[n][o-1]&&(e[4]=e[4]||t.document[n][o-1].id)),e},Ot={};Ot.splitOn=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=zr(e,this,t).fullPointer,o=n(this.fullPointer,r);let i=[];return o.forEach(a=>{i.push(a.passthrough),i.push(a.before),i.push(a.match),i.push(a.after)}),i=i.filter(a=>a),i=i.map(a=>Br(a,this)),this.update(i)};Ot.splitBefore=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=zr(e,this,t).fullPointer,o=n(this.fullPointer,r);for(let a=0;a<o.length;a+=1)!o[a].after&&o[a+1]&&o[a+1].before&&o[a].match&&o[a].match[0]===o[a+1].before[0]&&(o[a].after=o[a+1].before,delete o[a+1].before);let i=[];return o.forEach(a=>{i.push(a.passthrough),i.push(a.before),a.match&&a.after?i.push(ka(a.match,a.after)):i.push(a.match)}),i=i.filter(a=>a),i=i.map(a=>Br(a,this)),this.update(i)};Ot.splitAfter=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=zr(e,this,t).fullPointer,o=n(this.fullPointer,r);let i=[];return o.forEach(a=>{i.push(a.passthrough),a.before&&a.match?i.push(ka(a.before,a.match)):(i.push(a.before),i.push(a.match)),i.push(a.after)}),i=i.filter(a=>a),i=i.map(a=>Br(a,this)),this.update(i)};Ot.split=Ot.splitAfter;const hl=function(e,t){return!e||!t||e[0]!==t[0]?!1:e[2]===t[1]},bo=function(e,t,n){const r=e.world,o=r.methods.one.parseMatch;t=t||".$",n=n||"^.";const i=o(t,{},r),a=o(n,{},r);i[i.length-1].end=!0,a[0].start=!0;const s=e.fullPointer,u=[s[0]];for(let c=1;c<s.length;c+=1){const l=u[u.length-1],d=s[c],p=e.update([l]),P=e.update([d]);hl(l,d)&&p.has(i)&&P.has(a)?u[u.length-1]=[l[0],l[1],d[2],l[3],d[4]]:u.push(d)}return e.update(u)},dl={joinIf:function(e,t){return bo(this,e,t)},join:function(){return bo(this)}},Ge=Object.assign({},rl,cl,Ot,dl);Ge.lookBehind=Ge.before;Ge.lookBefore=Ge.before;Ge.lookAhead=Ge.after;Ge.lookAfter=Ge.after;Ge.notIf=Ge.ifNo;const fl=function(e){Object.assign(e.prototype,Ge)},pl=/(?:^|\s)([![^]*(?:<[^<]*>)?\/.*?[^\\/]\/[?\]+*$~]*)(?:\s|$)/,gl=/([!~[^]*(?:<[^<]*>)?\([^)]+[^\\)]\)[?\]+*$~]*)(?:\s|$)/,ml=/ /g,yl=e=>/^[![^]*(<[^<]*>)?\(/.test(e)&&/\)[?\]+*$~]*$/.test(e),vo=e=>/^[![^]*(<[^<]*>)?\//.test(e)&&/\/[?\]+*$~]*$/.test(e),wo=function(e){return e=e.map(t=>t.trim()),e=e.filter(t=>t),e},bl=function(e){const t=e.split(pl);let n=[];t.forEach(o=>{if(vo(o)){n.push(o);return}n=n.concat(o.split(gl))}),n=wo(n);let r=[];return n.forEach(o=>{yl(o)||vo(o)?r.push(o):r=r.concat(o.split(ml))}),r=wo(r),r},Po=/\{([0-9]+)?(, *[0-9]*)?\}/,ko=/&&/,vl=new RegExp(/^<\s*(\S+)\s*>/),Ao=e=>e.charAt(0).toUpperCase()+e.substring(1),Ae=e=>e.charAt(e.length-1),ge=e=>e.charAt(0),jt=e=>e.substring(1),$t=e=>e.substring(0,e.length-1),Mt=function(e){return e=jt(e),e=$t(e),e},Aa=function(e,t){const n={};for(let r=0;r<2;r+=1){if(Ae(e)==="$"&&(n.end=!0,e=$t(e)),ge(e)==="^"&&(n.start=!0,e=jt(e)),Ae(e)==="?"&&(n.optional=!0,e=$t(e)),(ge(e)==="["||Ae(e)==="]")&&(n.group=null,ge(e)==="["&&(n.groupStart=!0),Ae(e)==="]"&&(n.groupEnd=!0),e=e.replace(/^\[/,""),e=e.replace(/\]$/,""),ge(e)==="<")){const o=vl.exec(e);o.length>=2&&(n.group=o[1],e=e.replace(o[0],""))}if(Ae(e)==="+"&&(n.greedy=!0,e=$t(e)),e!=="*"&&Ae(e)==="*"&&e!=="\\*"&&(n.greedy=!0,e=$t(e)),ge(e)==="!"&&(n.negative=!0,e=jt(e)),ge(e)==="~"&&Ae(e)==="~"&&e.length>2&&(e=Mt(e),n.fuzzy=!0,n.min=t.fuzzy||.85,/\(/.test(e)===!1))return n.word=e,n;if(ge(e)==="/"&&Ae(e)==="/")return e=Mt(e),t.caseSensitive&&(n.use="text"),n.regex=new RegExp(e),n;if(Po.test(e)===!0&&(e=e.replace(Po,(o,i,a)=>(a===void 0?(n.min=Number(i),n.max=Number(i)):(a=a.replace(/, */,""),i===void 0?(n.min=0,n.max=Number(a)):(n.min=Number(i),n.max=Number(a||999))),n.greedy=!0,n.min||(n.optional=!0),""))),ge(e)==="("&&Ae(e)===")"){ko.test(e)?(n.choices=e.split(ko),n.operator="and"):(n.choices=e.split("|"),n.operator="or"),n.choices[0]=jt(n.choices[0]);const o=n.choices.length-1;n.choices[o]=$t(n.choices[o]),n.choices=n.choices.map(i=>i.trim()),n.choices=n.choices.filter(i=>i),n.choices=n.choices.map(i=>i.split(/ /g).map(a=>Aa(a,t))),e=""}if(ge(e)==="{"&&Ae(e)==="}"){if(e=Mt(e),n.root=e,/\//.test(e)){const o=n.root.split(/\//);n.root=o[0],n.pos=o[1],n.pos==="adj"&&(n.pos="Adjective"),n.pos=n.pos.charAt(0).toUpperCase()+n.pos.substr(1).toLowerCase(),o[2]!==void 0&&(n.sense=o[2])}return n}if(ge(e)==="<"&&Ae(e)===">")return e=Mt(e),n.chunk=Ao(e),n.greedy=!0,n;if(ge(e)==="%"&&Ae(e)==="%")return e=Mt(e),n.switch=e,n}return ge(e)==="#"?(n.tag=jt(e),n.tag=Ao(n.tag),n):ge(e)==="@"?(n.method=jt(e),n):e==="."?(n.anything=!0,n):e==="*"?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(e&&(e=e.replace("\\*","*"),e=e.replace("\\.","."),t.caseSensitive?n.use="text":e=e.toLowerCase(),n.word=e),n)},wl=/[a-z0-9][-–—][a-z]/i,Pl=function(e,t){const n=t.model.one.prefixes;for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(o.word&&wl.test(o.word)){let i=o.word.split(/[-–—]/g);if(n.hasOwnProperty(i[0]))continue;i=i.filter(a=>a).reverse(),e.splice(r,1),i.forEach(a=>{const s=Object.assign({},o);s.word=a,e.splice(r,0,s)})}}return e},xo=function(e,t){const{all:n}=t.methods.two.transform.verb||{},r=e.root;return n?n(r,t.model):[]},Co=function(e,t){const{all:n}=t.methods.two.transform.noun||{};return n?n(e.root,t.model):[e.root]},No=function(e,t){const{all:n}=t.methods.two.transform.adjective||{};return n?n(e.root,t.model):[e.root]},kl=function(e,t){return e=e.map(n=>{if(n.root)if(t.methods.two&&t.methods.two.transform){let r=[];n.pos?n.pos==="Verb"?r=r.concat(xo(n,t)):n.pos==="Noun"?r=r.concat(Co(n,t)):n.pos==="Adjective"&&(r=r.concat(No(n,t))):(r=r.concat(xo(n,t)),r=r.concat(Co(n,t)),r=r.concat(No(n,t))),r=r.filter(o=>o),r.length>0&&(n.operator="or",n.fastOr=new Set(r))}else n.machine=n.root,delete n.id,delete n.root;return n}),e},Al=function(e){let t=0,n=null;for(let r=0;r<e.length;r++){const o=e[r];o.groupStart===!0&&(n=o.group,n===null&&(n=String(t),t+=1)),n!==null&&(o.group=n),o.groupEnd===!0&&(n=null)}return e},xl=function(e){return e.map(t=>{if(t.choices!==void 0){if(t.operator!=="or"||t.fuzzy===!0)return t;t.choices.every(r=>{if(r.length!==1)return!1;const o=r[0];return o.fuzzy===!0||o.start||o.end?!1:o.word!==void 0&&o.negative!==!0&&o.optional!==!0&&o.method!==!0})===!0&&(t.fastOr=new Set,t.choices.forEach(r=>{t.fastOr.add(r[0].word)}),delete t.choices)}return t})},Cl=function(e){return e.map(t=>(t.fuzzy&&t.choices&&t.choices.forEach(n=>{n.length===1&&n[0].word&&(n[0].fuzzy=!0,n[0].min=t.min)}),t))},Nl=function(e){return e=Al(e),e=xl(e),e=Cl(e),e},jl=function(e,t,n){if(e==null||e==="")return[];t=t||{},typeof e=="number"&&(e=String(e));let r=bl(e);return r=r.map(o=>Aa(o,t)),r=Pl(r,n),r=kl(r,n),r=Nl(r),r},$l=function(e,t){for(const n of t)if(e.has(n))return!0;return!1},Tl=function(e,t){for(let n=0;n<e.length;n+=1){const r=e[n];if(!(r.optional===!0||r.negative===!0||r.fuzzy===!0)){if(r.word!==void 0&&t.has(r.word)===!1||r.tag!==void 0&&t.has("#"+r.tag)===!1)return!0;if(r.fastOr&&$l(r.fastOr,t)===!1)return!1}}return!1},Il=function(e,t){const n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;const o=(r>n?r:n)+1;if(Math.abs(n-r)>(o||100))return o||100;const i=[];for(let p=0;p<o;p++)i[p]=[p],i[p].length=o;for(let p=0;p<o;p++)i[0][p]=p;let a,s,u,c,l,d;for(let p=1;p<=n;++p)for(s=e[p-1],a=1;a<=r;++a){if(p===a&&i[p][a]>4)return n;u=t[a-1],c=s===u?0:1,l=i[p-1][a]+1,(d=i[p][a-1]+1)<l&&(l=d),(d=i[p-1][a-1]+c)<l&&(l=d),p>1&&a>1&&s===t[a-2]&&e[p-2]===u&&(d=i[p-2][a-2]+c)<l?i[p][a]=d:i[p][a]=l}return i[n][r]},El=function(e,t,n=3){if(e===t)return 1;if(e.length<n||t.length<n)return 0;const r=Il(e,t),o=Math.max(e.length,t.length);return 1-(o===0?0:r/o)},Dl=/([\u0022\uFF02\u0027\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F])/,Ol=/([\u0022\uFF02\u0027\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4])/,jo=/^[-–—]$/,$o=/ [-–—]{1,3} /,Se=(e,t)=>e.post.indexOf(t)!==-1,Qt={hasQuote:e=>Dl.test(e.pre)||Ol.test(e.post),hasComma:e=>Se(e,","),hasPeriod:e=>Se(e,".")===!0&&Se(e,"...")===!1,hasExclamation:e=>Se(e,"!"),hasQuestionMark:e=>Se(e,"?")||Se(e,"¿"),hasEllipses:e=>Se(e,"..")||Se(e,"…"),hasSemicolon:e=>Se(e,";"),hasColon:e=>Se(e,":"),hasSlash:e=>/\//.test(e.text),hasHyphen:e=>jo.test(e.post)||jo.test(e.pre),hasDash:e=>$o.test(e.post)||$o.test(e.pre),hasContraction:e=>!!e.implicit,isAcronym:e=>e.tags.has("Acronym"),isKnown:e=>e.tags.size>0,isTitleCase:e=>new RegExp("^\\p{Lu}[a-z'\\u00C0-\\u00FF]","u").test(e.text),isUpperCase:e=>new RegExp("^\\p{Lu}+$","u").test(e.text)};Qt.hasQuotation=Qt.hasQuote;let oe=function(){};const Hl=function(e,t,n,r){if(t.anything===!0)return!0;if(t.start===!0&&n!==0||t.end===!0&&n!==r-1)return!1;if(t.id!==void 0&&t.id===e.id)return!0;if(t.word!==void 0)return t.use?t.word===e[t.use]:e.machine!==null&&e.machine===t.word||e.alias!==void 0&&e.alias.hasOwnProperty(t.word)||t.fuzzy===!0&&(t.word===e.root||El(t.word,e.normal)>=t.min)||e.alias&&e.alias.some(o=>o===t.word)?!0:t.word===e.text||t.word===e.normal;if(t.tag!==void 0)return e.tags.has(t.tag)===!0;if(t.method!==void 0)return typeof Qt[t.method]=="function"&&Qt[t.method](e)===!0;if(t.pre!==void 0)return e.pre&&e.pre.includes(t.pre);if(t.post!==void 0)return e.post&&e.post.includes(t.post);if(t.regex!==void 0){let o=e.normal;return t.use&&(o=e[t.use]),t.regex.test(o)}if(t.chunk!==void 0)return e.chunk===t.chunk;if(t.switch!==void 0)return e.switch===t.switch;if(t.machine!==void 0)return e.normal===t.machine||e.machine===t.machine||e.root===t.machine;if(t.sense!==void 0)return e.sense===t.sense;if(t.fastOr!==void 0){if(t.pos&&!e.tags.has(t.pos))return null;const o=e.root||e.implicit||e.machine||e.normal;return t.fastOr.has(o)||t.fastOr.has(e.text)}return t.choices!==void 0?t.operator==="and"?t.choices.every(o=>oe(e,o,n,r)):t.choices.some(o=>oe(e,o,n,r)):!1};oe=function(e,t,n,r){const o=Hl(e,t,n,r);return t.negative===!0?!o:o};const Fl=function(e,t){const n=Object.assign({},e.regs[e.r],{start:!1,end:!1}),r=e.t;for(;e.t<e.terms.length;e.t+=1){if(t&&oe(e.terms[e.t],t,e.start_i+e.t,e.phrase_length))return e.t;const o=e.t-r+1;if(n.max!==void 0&&o===n.max)return e.t;if(oe(e.terms[e.t],n,e.start_i+e.t,e.phrase_length)===!1)return n.min!==void 0&&o<n.min?null:e.t}return e.t},Gl=function(e,t){let n=e.t;if(!t)return e.terms.length;for(;n<e.terms.length;n+=1)if(oe(e.terms[n],t,e.start_i+n,e.phrase_length)===!0)return n;return null},Sl=function(e,t){if(e.end===!0&&e.greedy===!0&&t.start_i+t.t<t.phrase_length-1){const n=Object.assign({},e,{end:!1});if(oe(t.terms[t.t],n,t.start_i+t.t,t.phrase_length)===!0)return!0}return!1},Hn=function(e,t){return e.groups[e.inGroup]||(e.groups[e.inGroup]={start:t,length:0}),e.groups[e.inGroup]},zl=function(e){const{regs:t}=e,n=t[e.r],r=Gl(e,t[e.r+1]);if(r===null||r===0||n.min!==void 0&&r-e.t<n.min)return null;if(n.max!==void 0&&r-e.t>n.max)return e.t=e.t+n.max,!0;if(e.hasGroup===!0){const o=Hn(e,e.t);o.length=r-e.t}return e.t=r,!0},Bl=function(e){return Object.prototype.toString.call(e)==="[object Array]"},xa=function(e,t=0){const n=e.regs[e.r];let r=!1;for(let o=0;o<n.choices.length;o+=1){const i=n.choices[o];if(!Bl(i))return!1;if(r=i.every((a,s)=>{let u=0;const c=e.t+s+t+u;if(e.terms[c]===void 0)return!1;const l=oe(e.terms[c],a,c+e.start_i,e.phrase_length);if(l===!0&&a.greedy===!0)for(let d=1;d<e.terms.length;d+=1){const p=e.terms[c+d];if(p)if(oe(p,a,e.start_i+d,e.phrase_length)===!0)u+=1;else break}return t+=u,l}),r){t+=i.length;break}}return r&&n.greedy===!0?xa(e,t):t},Vl=function(e){let t=0;return e.regs[e.r].choices.every(o=>{const i=o.every((a,s)=>{const u=e.t+s;return e.terms[u]===void 0?!1:oe(e.terms[u],a,u,e.phrase_length)});return i===!0&&o.length>t&&(t=o.length),i})===!0?t:!1},Ml=function(e){const{regs:t}=e,n=t[e.r],r=xa(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Hn(e,e.t);o.length+=r}if(n.end===!0){const o=e.phrase_length;if(e.t+e.start_i+r!==o)return null}return e.t+=r,!0}else if(!n.optional)return null;return!0},Ll=function(e){const{regs:t}=e,n=t[e.r],r=Vl(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Hn(e,e.t);o.length+=r}if(n.end===!0){const o=e.phrase_length-1;if(e.t+e.start_i!==o)return null}return e.t+=r,!0}else if(!n.optional)return null;return!0},Kl=function(e,t,n){let r=0;for(let o=e.t;o<e.terms.length;o+=1){let i=oe(e.terms[o],t,e.start_i+e.t,e.phrase_length);if(i||n&&(i=oe(e.terms[o],n,e.start_i+e.t,e.phrase_length),i)||(r+=1,t.max!==void 0&&r===t.max))break}return r===0||t.min&&t.min>r?!1:(e.t+=r,!0)},Wl=function(e){const{regs:t}=e,n=t[e.r],r=Object.assign({},n);if(r.negative=!1,oe(e.terms[e.t],r,e.start_i+e.t,e.phrase_length))return!1;if(n.optional){const i=t[e.r+1];i&&(oe(e.terms[e.t],i,e.start_i+e.t,e.phrase_length)?e.r+=1:i.optional&&t[e.r+2]&&oe(e.terms[e.t],t[e.r+2],e.start_i+e.t,e.phrase_length)&&(e.r+=2))}return n.greedy?Kl(e,r,t[e.r+1]):(e.t+=1,!0)},Jl=function(e){const{regs:t}=e,n=t[e.r],r=e.terms[e.t],o=oe(r,t[e.r+1],e.start_i+e.t,e.phrase_length);if(n.negative||o){const i=e.terms[e.t+1];(!i||!oe(i,t[e.r+1],e.start_i+e.t,e.phrase_length))&&(e.r+=1)}},Rl=function(e){const{regs:t,phrase_length:n}=e,r=t[e.r];return e.t=Fl(e,t[e.r+1]),e.t===null||r.min&&r.min>e.t||r.end===!0&&e.start_i+e.t!==n?null:!0},ql=function(e){const t=e.terms[e.t],n=e.regs[e.r];if(t.implicit&&e.terms[e.t+1]){if(!e.terms[e.t+1].implicit)return;n.word===t.normal&&(e.t+=1),n.method==="hasContraction"&&(e.t+=1)}},Ul=function(e,t){const n=e.regs[e.r],r=Hn(e,t);e.t>1&&n.greedy?r.length+=e.t-t:r.length++},Jn=function(e){const{regs:t}=e,n=t[e.r],r=e.terms[e.t],o=e.t;return n.optional&&t[e.r+1]&&n.negative?!0:(n.optional&&t[e.r+1]&&Jl(e),r.implicit&&e.terms[e.t+1]&&ql(e),e.t+=1,n.end===!0&&e.t!==e.terms.length&&n.greedy!==!0||n.greedy===!0&&!Rl(e)?null:(e.hasGroup===!0&&Ul(e,o),!0))},Vr=function(e,t,n,r){if(e.length===0||t.length===0)return null;const o={t:0,terms:e,r:0,regs:t,groups:{},start_i:n,phrase_length:r,inGroup:null};for(;o.r<t.length;o.r+=1){const s=t[o.r];if(o.hasGroup=!!s.group,o.hasGroup===!0?o.inGroup=s.group:o.inGroup=null,!o.terms[o.t]){if(t.slice(o.r).some(l=>!l.optional)===!1)break;return null}if(s.anything===!0&&s.greedy===!0){if(!zl(o))return null;continue}if(s.choices!==void 0&&s.operator==="or"){if(!Ml(o))return null;continue}if(s.choices!==void 0&&s.operator==="and"){if(!Ll(o))return null;continue}if(s.anything===!0){if(s.negative&&s.anything||!Jn(o))return null;continue}if(Sl(s,o)===!0){if(!Jn(o))return null;continue}if(s.negative){if(!Wl(o))return null;continue}if(oe(o.terms[o.t],s,o.start_i+o.t,o.phrase_length)===!0){if(!Jn(o))return null;continue}if(s.optional!==!0)return null}const i=[null,n,o.t+n];if(i[1]===i[2])return null;const a={};return Object.keys(o.groups).forEach(s=>{const u=o.groups[s],c=n+u.start;a[s]=[null,c,c+u.length]}),{pointer:i,groups:a}},_l=function(e,t){const n=[],r={};return e.length===0?{ptrs:n,byGroup:r}:(typeof t=="number"&&(t=String(t)),t?e.forEach(o=>{o.groups[t]&&n.push(o.groups[t])}):e.forEach(o=>{n.push(o.pointer),Object.keys(o.groups).forEach(i=>{r[i]=r[i]||[],r[i].push(o.groups[i])})}),{ptrs:n,byGroup:r})},Ql=function(e,t,n){return e=e.filter(r=>{const[o,i,a]=r.pointer,s=n[o].slice(i,a);for(let u=0;u<s.length;u+=1){const c=s.slice(u);if(Vr(c,t,u,s.length)!==null)return!1}return!0}),e},Ca=function(e,t){return e.pointer[0]=t,Object.keys(e.groups).forEach(n=>{e.groups[n][0]=t}),e},Zl=function(e,t,n){let r=Vr(e,t,0,e.length);return r?(r=Ca(r,n),r):null},Xl=function(e,t,n){n=n||[];const{regs:r,group:o,justOne:i}=t;let a=[];if(!r||r.length===0)return{ptrs:[],byGroup:{}};const s=r.filter(u=>u.optional!==!0&&u.negative!==!0).length;e:for(let u=0;u<e.length;u+=1){const c=e[u];if(!(n[u]&&Tl(r,n[u]))){if(r[0].start===!0){const l=Zl(c,r,u);l&&a.push(l);continue}for(let l=0;l<c.length;l+=1){const d=c.slice(l);if(d.length<s)break;let p=Vr(d,r,l,c.length);if(p){if(p=Ca(p,u),a.push(p),i===!0)break e;const P=p.pointer[2];Math.abs(P-1)>l&&(l=Math.abs(P-1))}}}}return r[r.length-1].end===!0&&(a=a.filter(u=>{const c=u.pointer[0];return e[c].length===u.pointer[2]})),t.notIf&&(a=Ql(a,t.notIf,e)),a=_l(a,o),a.ptrs.forEach(u=>{const[c,l,d]=u;u[3]=e[c][l].id,u[4]=e[c][d-1].id}),a},Yl={one:{termMethods:Qt,parseMatch:jl,match:Xl}},eh={parseMatch:function(e,t){const n=this.world(),r=n.methods.one.killUnicode;return r&&(e=r(e,n)),n.methods.one.parseMatch(e,t,n)}},th={api:fl,methods:Yl,lib:eh},nh=/^\../,rh=/^#./,oh=e=>(e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e=e.replace(/'/g,"&apos;"),e),ih=function(e){let t="",n="</span>";return e=oh(e),nh.test(e)?t=`<span class="${e.replace(/^\./,"")}"`:rh.test(e)?t=`<span id="${e.replace(/^#/,"")}"`:(t=`<${e}`,n=`</${e}>`),t+=">",{start:t,end:n}},ah=function(e,t){const n={},r={};return Object.keys(t).forEach(o=>{let i=t[o];const a=ih(o);typeof i=="string"&&(i=e.match(i)),i.docs.forEach(s=>{if(s.every(l=>l.implicit))return;const u=s[0].id;n[u]=n[u]||[],n[u].push(a.start);const c=s[s.length-1].id;r[c]=r[c]||[],r[c].push(a.end)})}),{starts:n,ends:r}},sh=function(e){const{starts:t,ends:n}=ah(this,e);let r="";return this.docs.forEach(o=>{for(let i=0;i<o.length;i+=1){const a=o[i];t.hasOwnProperty(a.id)&&(r+=t[a.id].join("")),r+=a.pre||"",r+=a.text||"",n.hasOwnProperty(a.id)&&(r+=n[a.id].join("")),r+=a.post||""}}),r},uh={html:sh},Na=/[,:;)\]*.?~!\u0022\uFF02\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4—-]+$/,pr=/^[(['"*~\uFF02\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F]+/,ch=/[,:;)('"\u201D\]]/,lh=/^[-–—]$/,hh=/ /,dt=function(e,t,n=!0){let r="";return e.forEach(o=>{let i=o.pre||"",a=o.post||"";t.punctuation==="some"&&(i=i.replace(pr,""),lh.test(a)&&(a=" "),a=a.replace(ch,""),a=a.replace(/\?!+/,"?"),a=a.replace(/!+/,"!"),a=a.replace(/\?+/,"?"),a=a.replace(/\.{2,}/,""),o.tags.has("Abbreviation")&&(a=a.replace(/\./,""))),t.whitespace==="some"&&(i=i.replace(/\s/,""),a=a.replace(/\s+/," ")),t.keepPunct||(i=i.replace(pr,""),a==="-"?a=" ":a=a.replace(Na,""));let s=o[t.form||"text"]||o.normal||"";t.form==="implicit"&&(s=o.implicit||o.text),t.form==="root"&&o.implicit&&(s=o.root||o.implicit||o.normal),(t.form==="machine"||t.form==="implicit"||t.form==="root")&&o.implicit&&(!a||!hh.test(a))&&(a+=" "),r+=i+s+a}),n===!1&&(r=r.trim()),t.lowerCase===!0&&(r=r.toLowerCase()),r},dh=function(e,t){let n="";if(!e||!e[0]||!e[0][0])return n;for(let r=0;r<e.length;r+=1)n+=dt(e[r],t,!0);if(t.keepSpace||(n=n.trim()),t.keepEndPunct===!1){e[0][0].tags.has("Emoticon")||(n=n.replace(pr,""));const r=e[e.length-1];r[r.length-1].tags.has("Emoticon")||(n=n.replace(Na,"")),n.endsWith("'")&&!n.endsWith("s'")&&(n=n.replace(/'/,""))}return t.cleanWhitespace===!0&&(n=n.trim()),n},it={text:{form:"text"},normal:{whitespace:"some",punctuation:"some",case:"some",unicode:"some",form:"normal"},machine:{keepSpace:!1,whitespace:"some",punctuation:"some",case:"none",unicode:"some",form:"machine"},root:{keepSpace:!1,whitespace:"some",punctuation:"some",case:"some",unicode:"some",form:"root"},implicit:{form:"implicit"}};it.clean=it.normal;it.reduced=it.root;const ja=[];let ft=0;for(;ft<64;)ja[ft]=0|Math.sin(++ft%Math.PI)*4294967296;const Mr=function(e){let t,n,r,o=decodeURI(encodeURI(e))+"€",i=o.length;const a=[t=1732584193,n=4023233417,~t,~n],s=[];for(e=--i/4+2|15,s[--e]=i*8;~i;)s[i>>2]|=o.charCodeAt(i)<<8*i--;for(ft=o=0;ft<e;ft+=16){for(i=a;o<64;i=[r=i[3],t+((r=i[0]+[t&n|~t&r,r&t|~r&n,t^n^r,n^(t|~r)][i=o>>4]+ja[o]+~~s[ft|[o,5*o+1,3*o+5,7*o][i]&15])<<(i=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*i+o++%4])|r>>>-i),t,n])t=i[1]|0,n=i[2];for(o=4;o;)a[--o]+=i[o]}for(e="";o<32;)e+=(a[o>>3]>>(1^o++)*4&15).toString(16);return e},fh={text:!0,terms:!0},To={case:"none",unicode:"some",form:"machine",punctuation:"some"},Rn=function(e,t){return Object.assign({},e,t)},Xe={text:e=>dt(e,{keepPunct:!0},!1),normal:e=>dt(e,Rn(it.normal,{keepPunct:!0}),!1),implicit:e=>dt(e,Rn(it.implicit,{keepPunct:!0}),!1),machine:e=>dt(e,To,!1),root:e=>dt(e,Rn(To,{form:"root"}),!1),hash:e=>Mr(dt(e,{keepPunct:!0},!1)),offset:e=>{const t=Xe.text(e).length;return{index:e[0].offset.index,start:e[0].offset.start,length:t}},terms:e=>e.map(t=>{const n=Object.assign({},t);return n.tags=Array.from(t.tags),n}),confidence:(e,t,n)=>t.eq(n).confidence(),syllables:(e,t,n)=>t.eq(n).syllables(),sentence:(e,t,n)=>t.eq(n).fullSentence().text(),dirty:e=>e.some(t=>t.dirty===!0)};Xe.sentences=Xe.sentence;Xe.clean=Xe.normal;Xe.reduced=Xe.root;const ph=function(e,t){return t=t||{},typeof t=="string"&&(t={}),t=Object.assign({},fh,t),t.offset&&e.compute("offset"),e.docs.map((n,r)=>{const o={};return Object.keys(t).forEach(i=>{t[i]&&Xe[i]&&(o[i]=Xe[i](n,e,r))}),o})},gr={json:function(e){const t=ph(this,e);return typeof e=="number"?t[e]:t}};gr.data=gr.json;const gh=()=>typeof window<"u"&&window.document,mh=function(e){const t=this.methods.one.debug||{};return e&&t.hasOwnProperty(e)?(t[e](this),this):gh()?(t.clientSide(this),this):(t.tags(this),this)},yh=function(e){const t=e.pre||"",n=e.post||"";return t+e.text+n},bh=function(e,t){const n={};return Object.keys(t).forEach(r=>{e.match(r).fullPointer.forEach(i=>{n[i[3]]={fn:t[r],end:i[2]}})}),n},$a=function(e,t){const n=bh(e,t);let r="";return e.docs.forEach((o,i)=>{for(let a=0;a<o.length;a+=1){const s=o[a];if(n.hasOwnProperty(s.id)){const{fn:u,end:c}=n[s.id],l=e.update([[i,a,c]]);r+=o[a].pre||"",r+=u(l),a=c-1,r+=o[a].post||""}else r+=yh(s)}}),r},vh=e=>Object.prototype.toString.call(e)==="[object Object]",wh=function(e){const t={};return e.forEach(r=>{t[r]=t[r]||0,t[r]+=1}),Object.keys(t).map(r=>({normal:r,count:t[r]})).sort((r,o)=>r.count>o.count?-1:0)},Ph=function(e){if(vh(e))return $a(this,e);if(e==="text")return this.text();if(e==="normal")return this.text("normal");if(e==="root")return this.text("root");if(e==="machine"||e==="reduced")return this.text("machine");if(e==="hash"||e==="md5")return Mr(this.text());if(e==="json")return this.json();if(e==="offset"||e==="offsets")return this.compute("offset"),this.json({offset:!0});if(e==="array")return this.docs.map(n=>n.reduce((r,o)=>r+o.pre+o.text+o.post,"").trim()).filter(n=>n);if(e==="freq"||e==="frequency"||e==="topk")return wh(this.json({normal:!0}).map(t=>t.normal));if(e==="terms"){let t=[];return this.docs.forEach(n=>{let r=n.map(o=>o.text);r=r.filter(o=>o),t=t.concat(r)}),t}return e==="tags"?this.docs.map(t=>t.reduce((n,r)=>(n[r.implicit||r.normal]=Array.from(r.tags),n),{})):e==="debug"?this.debug():this.text()},kh={debug:mh,out:Ph,wrap:function(e){return $a(this,e)}},Ah=e=>Object.prototype.toString.call(e)==="[object Object]",xh={text:function(e){let t={};if(e&&typeof e=="string"&&it.hasOwnProperty(e)?t=Object.assign({},it[e]):e&&Ah(e)&&(t=Object.assign({},e)),t.keepSpace===void 0&&!this.isFull()&&(t.keepSpace=!1),t.keepEndPunct===void 0&&this.pointer){const n=this.pointer[0];n&&n[1]?t.keepEndPunct=!1:t.keepEndPunct=!0}return t.keepPunct===void 0&&(t.keepPunct=!0),t.keepSpace===void 0&&(t.keepSpace=!0),dh(this.docs,t)}},Ch=Object.assign({},kh,xh,gr,uh),Nh=function(e){Object.assign(e.prototype,Ch)},jh=function(e){console.log("%c -=-=- ","background-color:#6699cc;"),e.forEach(t=>{console.groupCollapsed(t.text());const r=t.docs[0].map(o=>{let i=o.text||"-";o.implicit&&(i="["+o.implicit+"]");const a="["+Array.from(o.tags).join(", ")+"]";return{text:i,tags:a}});console.table(r,["text","tags"]),console.groupEnd()})},Le="\x1B[0m",be={green:e=>"\x1B[32m"+e+Le,red:e=>"\x1B[31m"+e+Le,blue:e=>"\x1B[34m"+e+Le,magenta:e=>"\x1B[35m"+e+Le,cyan:e=>"\x1B[36m"+e+Le,yellow:e=>"\x1B[33m"+e+Le,black:e=>"\x1B[30m"+e+Le,dim:e=>"\x1B[2m"+e+Le,i:e=>"\x1B[3m"+e+Le},$h=function(e,t){return t.one.tagSet&&(e=e.map(n=>{if(!t.one.tagSet.hasOwnProperty(n))return n;const r=t.one.tagSet[n].color||"blue";return be[r](n)})),e.join(", ")},Th=function(e){const{docs:t,model:n}=e;t.length===0&&console.log(be.blue(`
@@ -1 +1 @@
1
- import{a as d,e as l}from"../packem_shared/pm-runner-de-jCq8q.js";import{r as m,a as p}from"../packem_shared/command-runtime-CiLVo4ED.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};
1
+ import{a as d,e as l}from"../packem_shared/pm-runner-d93_73O6.js";import{r as m,a as p}from"../packem_shared/command-runtime-CiLVo4ED.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};