@visulima/vis 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE.md +1 -1
- package/dashboard/dist/index.html +10 -10
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +3 -3
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +2 -2
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/group-tags.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +1 -1
- package/dist/packem_chunks/handler65.js +6 -6
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +1 -1
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +41 -41
- package/dist/packem_chunks/handler73.js +2 -2
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index3.js +1 -1
- package/dist/packem_chunks/index4.js +46 -46
- package/dist/packem_chunks/index5.js +22 -23
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_shared/{Table-CcVkyULl-DLWu6XHL.js → Table-BGIHvenQ-D2oJtNQj.js} +1 -1
- package/dist/packem_shared/{advisories-B76fBVL-.js → advisories-CaP4uNhD.js} +1 -1
- package/dist/packem_shared/{affected-shas-CCxG4tvm.js → affected-shas-BfO3PDJq.js} +1 -1
- package/dist/packem_shared/ai-analysis-CO7No4rt.js +68 -0
- package/dist/packem_shared/{ai-fix-CeGzAT9m.js → ai-fix-B4u2zlVG.js} +1 -1
- package/dist/packem_shared/{augment-DaSS2Lgs.js → augment-8z86AwtF.js} +1 -1
- package/dist/packem_shared/{bin-BlGVEhl8.js → bin-Cv8vsMEo.js} +1 -1
- package/dist/packem_shared/{build-scripts-q__dKE2y.js → build-scripts-D477Ou-x.js} +1 -1
- package/dist/packem_shared/{command-runtime-3FTGuUsK.js → command-runtime-EWjmSxPj.js} +1 -1
- package/dist/packem_shared/{cyclonedx-CmrYQ0vx.js → cyclonedx-CDWHbD9s.js} +1 -1
- package/dist/packem_shared/{dependency-scan-DpOFiZuI.js → dependency-scan-P52jY0pU.js} +1 -1
- package/dist/packem_shared/{docker-BYqiD711.js → docker-CD7o1D1o.js} +1 -1
- package/dist/packem_shared/{env-DdQRnEIy.js → env-Cpxa_7UE.js} +1 -1
- package/dist/packem_shared/{failure-log-CKMhqLWr.js → failure-log-MOhz-TBv.js} +1 -1
- package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +1 -0
- package/dist/packem_shared/index-BAUIIRZJ.js +1 -0
- package/dist/packem_shared/index-BVuCxe14.js +22 -0
- package/dist/packem_shared/{index-Cg71MisW.js → index-CdTXvj-V.js} +1 -1
- package/dist/packem_shared/{index-jJNulo5i.js → index-CgXLAAVI.js} +1 -1
- package/dist/packem_shared/{lifecycle-aDTZ8dW1.js → lifecycle-hzwghh5a.js} +1 -1
- package/dist/packem_shared/{lockfile-C1qCKGH6.js → lockfile-CWcVTdRc.js} +1 -1
- package/dist/packem_shared/{manifests-DSBr3-dw.js → manifests-CaPqgQxW.js} +1 -1
- package/dist/packem_shared/{min-release-age-C71MO72F.js → min-release-age-skpcnlpk.js} +1 -1
- package/dist/packem_shared/{missing-package-json-CTF71tE5.js → missing-package-json-_hOp4AW5.js} +1 -1
- package/dist/packem_shared/{native-config-sync-D-z2Uwqu.js → native-config-sync-CFi1iQNG.js} +1 -1
- package/dist/packem_shared/{osv-bloom-DMhXP184.js → osv-bloom-BAyJUnRx.js} +1 -1
- package/dist/packem_shared/{packument-aGzYwXKn.js → packument-CYxvm590.js} +1 -1
- package/dist/packem_shared/{pm-runner-CQcraCcu.js → pm-runner-mVFjedM6.js} +1 -1
- package/dist/packem_shared/{provenance-S7y0BRAt.js → provenance-CI_WQx7G.js} +1 -1
- package/dist/packem_shared/{readJsonSync-DuMMeB3s-ihoybKvs.js → readJsonSync-DuMMeB3s-Cx08VBQg.js} +1 -1
- package/dist/packem_shared/{registry-keys-CRnXATt2.js → registry-keys-AGlSEY6R.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CJGazevw.js → resolve-explicit-DVE9cfkm.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-QRaQucfL.js → resolve-runtime-CGHf-wHz.js} +1 -1
- package/dist/packem_shared/{run-file-DD7Ne23Z.js → run-file-Bs_E9O6O.js} +1 -1
- package/dist/packem_shared/{runtime-check-qnrPTlma.js → runtime-check-pS2XH4BO.js} +1 -1
- package/dist/packem_shared/{s1ngularity-BLj4Jy8z.js → s1ngularity-xmrq5T5r.js} +1 -1
- package/dist/packem_shared/{scan-progress-BDcl7Kty.js → scan-progress-DQ4TMXcb.js} +1 -1
- package/dist/packem_shared/{selectors-D4iCvITE.js → selectors-CRgS4bU9.js} +1 -1
- package/dist/packem_shared/{signatures-DoNG2hEr.js → signatures-Dp3th1DB.js} +1 -1
- package/dist/packem_shared/target-merge-D2eTghgd.js +11 -0
- package/dist/packem_shared/{target-options-CR0OuYJr.js → target-options-TM6ETDAS.js} +1 -1
- package/dist/packem_shared/{toolchain-Zb3VzZb4.js → toolchain-B5KwUZfq.js} +1 -1
- package/dist/packem_shared/{typosquats-C12CP_2G.js → typosquats-C0layQsP.js} +1 -1
- package/dist/packem_shared/{use-measured-height-CjS7Tks7.js → use-measured-height-Drobr4fe.js} +1 -1
- package/dist/packem_shared/{verify-DStfg3nb.js → verify-Cjo4EBFZ.js} +1 -1
- package/dist/packem_shared/{vis-update-app-BlocL713.js → vis-update-app-qIkyvrd1.js} +1 -1
- package/dist/packem_shared/{watch-BXNI7dC6.js → watch-BnE1TzYn.js} +1 -1
- package/dist/packem_shared/{watch-loop-BZudYfcl.js → watch-loop-Irf3Pm-1.js} +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +654 -570
- package/package.json +37 -37
- package/dist/packem_shared/ai-analysis-BpVdn20h.js +0 -68
- package/dist/packem_shared/glob-fqg4KepW-1S3z30c8.js +0 -1
- package/dist/packem_shared/index-CE6MsgcV.js +0 -22
- package/dist/packem_shared/index-Cg0IHaFI.js +0 -1
- package/dist/packem_shared/target-merge-Dg25Izl5.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as ht}from"node:module";import{I as ze,s as I,E as q,q as Ge,V as G,j as yt}from"../packem_shared/index.server-J83sowC4.js";import{m as _,f as O,v as K,I as Y,A as kt,T as wt}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as ht}from"node:module";import{I as ze,s as I,E as q,q as Ge,V as G,j as yt}from"../packem_shared/index.server-J83sowC4.js";import{m as _,f as O,v as K,I as Y,A as kt,T as wt}from"../packem_shared/index-BVuCxe14.js";import{u as Ee,m as vt}from"./ts-loader.js";import{E as bt}from"../packem_shared/public-api-WqUCiyIe.js";import{P as Rt,ak as xt,i as ge}from"./cli-main.js";import{_ as At,w as St,x as Et,g as Ct,R as Tt,c as jt,V as It,y as Nt,z as Ke,$ as Ce,d as P,h as me,i as L,H as Je,A as Dt,F as W,Z as Ut,L as Vt,j as Ot,G as Bt}from"./catalog.js";import{B as _t}from"../packem_shared/env-Cpxa_7UE.js";import{I as le}from"../packem_shared/index-B0EsgdzO.js";import{K as qt,Z as Wt,W as Te}from"../packem_shared/ai-analysis-CO7No4rt.js";import{v as Ht,h as Lt,s as Ye}from"../packem_shared/pm-runner-mVFjedM6.js";import{a as Ft,r as zt}from"../packem_shared/command-runtime-EWjmSxPj.js";import{r as Gt,a as Kt,p as Jt}from"../packem_shared/resolve-explicit-DVE9cfkm.js";import{S as Yt}from"../packem_shared/min-release-age-skpcnlpk.js";import{r as Zt,s as Xt}from"../packem_shared/typosquats-C0layQsP.js";import{U as Qt,b as en,u as je,e as tn}from"../packem_shared/vis-update-app-qIkyvrd1.js";import{h as Ze,P as Xe}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{f as Qe}from"../packem_shared/utils-CRueU43T.js";import{s as te}from"../packem_shared/index-BAUIIRZJ.js";import{r as nn,q as sn}from"../packem_shared/advisories-CaP4uNhD.js";const $t=ht(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[n,t]=Q.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return Q.getBuiltinModule(e)}return $t(e)},{createInterface:Fe}=Le("node:readline"),{existsSync:Mt,realpathSync:Pt}=Le("node:fs"),on=e=>{const n=[];for(const t of e.filters)n.push("--filter",t);return e.workspaceRoot&&n.push("--filter","."),n.push("update"),e.latest&&n.push("--latest"),e.recursive&&n.push("--recursive"),e.interactive&&n.push("--interactive"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"pnpm"}},rn=e=>{const n=[];return e.filters.length>0&&n.push("workspace",e.filters[0]),n.push("upgrade"),e.latest&&n.push("--latest"),n.push(...e.packages),{args:n,bin:"yarn"}},an=e=>{const n=[];if(e.filters.length>0||e.recursive){n.push("workspaces","foreach","--all");for(const t of e.filters)n.push("--include",t)}return n.push("up"),e.interactive&&n.push("--interactive"),n.push(...e.packages),{args:n,bin:"yarn"}},cn=(e,n)=>{const t=["update"];e.latest&&n.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&n.push("npm does not support --interactive mode.");for(const s of e.filters)t.push("--workspace",s);return e.recursive&&t.push("--workspaces"),e.workspaceRoot&&t.push("--include-workspace-root"),e.dev&&t.push("--dev"),e.prod&&t.push("--production"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"npm"}},ln=e=>{const n=["update"];e.latest&&n.push("--latest");for(const t of e.filters)n.push("--filter",t);return n.push(...e.packages),{args:n,bin:"bun"}},un=(e,n)=>{const t=["outdated","--update"];return e.latest&&t.push("--latest"),e.interactive&&t.push("--interactive"),e.filters.length>0&&n.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&n.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&n.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&n.push("deno outdated has no --no-save flag; ignoring."),t.push(...e.packages),{args:t,bin:"deno"}},dn=(e,n,t)=>{const s=[];if(t.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...t.packages],bin:"npm"},warnings:s};let r;switch(e){case"aube":{const o=Ht(t);r={args:o.args,bin:o.bin},s.push(...o.warnings);break}case"bun":{r=ln(t);break}case"deno":{r=un(t,s);break}case"npm":{r=cn(t,s);break}case"pnpm":{r=on(t);break}case"yarn":{r=n.startsWith("1.")?rn(t):an(t);break}default:{const o=e;throw new Error(`Unsupported package manager: ${String(o)}`)}}return{command:r,warnings:s}},et=e=>{const n=e.indexOf("@");return n<=0?e:e.slice(0,n)},pn=e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},fn=(e,n)=>{const t=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of t){const r=_(e,s);if(!O(r))continue;let o;try{o=bt(K(r))}catch{continue}if(o?.updates){for(const i of o.updates){const a=pn(i["package-ecosystem"]);if(!(!a||!Array.isArray(i.ignore)))for(const d of i.ignore){const c=d["dependency-name"];typeof c=="string"&&c.length>0&&n[a].add(et(c))}}return}}},gn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),mn=Object.freeze({docker:"docker","github-tags":"actions"}),he=(e,n)=>{if(n)for(const t of n)typeof t=="string"&&t.length>0&&e.add(et(t))},hn=e=>{let n="",t=0;const{length:s}=e;let r=!1,o="";for(;t<s;){const i=e[t]??"";if(r){if(n+=i,i==="\\"&&t+1<s){n+=e[t+1]??"",t+=2;continue}i===o&&(r=!1),t+=1;continue}if(i==='"'||i==="'"){r=!0,o=i,n+=i,t+=1;continue}if(i==="/"&&e[t+1]==="/"){for(;t<s&&e[t]!==`
|
|
2
2
|
`;)t+=1;continue}if(i==="/"&&e[t+1]==="*"){for(t+=2;t<s&&!(e[t]==="*"&&e[t+1]==="/");)t+=1;t+=2;continue}if(i===","){let a=t+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const d=e[a];if(d==="}"||d==="]"){t+=1;continue}}n+=i,t+=1}return n},$n=(e,n)=>{const t=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of t){const r=_(e,s);if(!O(r))continue;let o;try{const a=K(r);o=JSON.parse(hn(a))}catch{continue}if(!o)continue;if(Array.isArray(o.ignoreDeps))for(const a of["actions","docker","gitlab"])he(n[a],o.ignoreDeps);const i=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,d]of i){const c=o[a];he(n[d],c?.ignoreDeps)}if(!Array.isArray(o.packageRules))return;for(const a of o.packageRules){if(a.enabled!==!1)continue;const d=new Set;for(const u of a.matchManagers??[]){const f=gn[u];f&&d.add(f)}for(const u of a.matchDatasources??[]){const f=mn[u];f&&d.add(f)}d.size===0&&(d.add("actions"),d.add("docker"),d.add("gitlab"));const c=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const u of d)he(n[u],c)}return}},yn=e=>{const n={actions:new Set,docker:new Set,gitlab:new Set};return fn(e,n),$n(e,n),n},ke=(e,n,t)=>{const s=t[n];if(s.size===0)return!1;if(s.has(e))return!0;for(const r of s)if(/[*?[\]/.+]/.test(r))try{const o=r.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${o}$`).test(e))return!0}catch{}return!1},F=e=>{const n=e.trim();if(n==="")return;const t=n.startsWith("v")||n.startsWith("V")?n.slice(1):n,s=(te.valid(t)?te.parse(t):void 0)??te.coerce(t,{includePrerelease:!0});if(s)return{major:s.major,minor:s.minor,normalized:`${String(s.major)}.${String(s.minor)}.${String(s.patch)}${s.prerelease.length>0?`-${s.prerelease.join(".")}`:""}`,patch:s.patch,prerelease:s.prerelease.length>0,raw:n}},kn=(e,n)=>te.rcompare(e.normalized,n.normalized),we=(e,n,t,s)=>{if(!n&&t!=="latest")return;const r=e.filter(o=>o.prerelease?!1:n?t==="patch"&&(o.major!==n.major||o.minor!==n.minor)||t==="minor"&&o.major!==n.major?!1:te.gt(o.normalized,n.normalized):!0);if(r.length!==0)return r.toSorted(kn)[0]},ve=(e,n)=>!e||!n?"unknown":n.major!==e.major?"major":n.minor!==e.minor?"minor":n.patch!==e.patch?"patch":"unknown",wn="GitHub Actions",Ie=(e,n)=>`${e}@${n}`,vn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),bn=(e,n)=>{if(n.length===0)return n;const t=nn(e);if(!Mt(t))return n;const s=new Map;for(const o of n){const i=o.currentVersion??o.currentRef;i&&s.set(Ie(o.name,i),{name:o.name,version:i})}if(s.size===0)return n;const r=new Map;try{for(const[o,i]of s){const a=sn([i],{ecosystem:wn,workspaceRoot:e}).get(i.name);a&&a.length>0&&r.set(o,a)}}catch{return n}return r.size===0?n:n.map(o=>{const i=o.currentVersion??o.currentRef;if(!i)return o;const a=r.get(Ie(o.name,i));return a?{...o,advisories:a.map(d=>vn(d))}:o})},tt=e=>{if(!e)return{};const n={};for(const t of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(t);if(!s)continue;const r=s[1]??"",o=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(o)?.[1]?.toLowerCase()){case"first":{n.first=r;break}case"last":{n.last=r;break}case"next":{n.next=r;break}case"prev":case"previous":{n.previous=r;break}}}return n};class Rn{token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(n){this.token=n.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=n.apiBase??"https://api.github.com",this.fetchImpl=n.fetch??fetch}async listTags(n,t){const s=`${n}/${t}`,r=this.tagsCache.get(s);if(r)return r;const o=this.fetchTags(n,t);return this.tagsCache.set(s,o),o}async resolveRef(n,t,s){const r=`${n}/${t}@${s}`,o=this.commitCache.get(r);if(o)return o;const i=this.fetchCommit(n,t,s);return this.commitCache.set(r,i),i}buildHeaders(){const n={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(n.Authorization=`Bearer ${this.token}`),n}async fetchTags(n,t){const s=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/tags?per_page=100`,r={parsed:[],tags:[]},o=[];let i=s,a=0;for(;i&&a<5;){const c=i;let u;try{u=await this.fetchImpl(c,{headers:this.buildHeaders()})}catch{return r}if(!u.ok)return r;let f;try{f=await u.json()}catch{return r}if(!Array.isArray(f))return r;for(const g of f){const m=typeof g.name=="string"?g.name:"",h=typeof g.commit?.sha=="string"?g.commit.sha:"";m!==""&&h!==""&&o.push({name:m,sha:h})}i=tt(u.headers.get("link")).next,a+=1}const d=[];for(const c of o){const u=F(c.name);u&&d.push({...u,sha:c.sha})}return{parsed:d,tags:o}}async fetchCommit(n,t,s){const r=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/commits/${encodeURIComponent(s)}`;try{const o=await this.fetchImpl(r,{headers:this.buildHeaders()});if(!o.ok)return;const i=await o.json();return typeof i.sha!="string"?void 0:{committedAt:i.commit?.committer?.date,sha:i.sha}}catch{return}}}const xn=".github/workflows",An=".github/actions",Sn=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,En=/^[a-f0-9]{40}$/i,Cn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Tn=/actions-up-ignore-start/i,jn=/actions-up-ignore-end/i,In=e=>{const n=e.split("/");if(n.length<2)return;const[t,s,...r]=n;if(!(!t||!s))return{owner:t,repo:s,subpath:r.length>0?r.join("/"):void 0}},Nn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r,o=!1;for(const[i,a]of t.entries()){const d=a??"";if(Tn.test(d)&&(o=!0),jn.test(d)){o=!1;continue}const c=d.trim(),u=c===""||c.startsWith("#")?Cn.exec(d):void 0;if(u){r=u[1]??"actions-up-ignore-next-line";continue}const f=Sn.exec(d);if(!f){r=void 0;continue}const g=f[1]??"",m=g==="'"||g==='"'?g:"",h=f[2]??"",R=f[3]?.trim();if(h.startsWith("./")||h.startsWith("../")||h.startsWith("docker://")){r=void 0;continue}const A=h.lastIndexOf("@");if(A<=0){r=void 0;continue}const $=h.slice(0,A),S=h.slice(A+1),y=In($);if(!y){r=void 0;continue}let p=r??(o?"actions-up-ignore-block":void 0);if(R){const k=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(R);k&&(p=p??k[1]??"actions-up-ignore")}r=void 0,s.push({file:e,ignoreReason:p,isSha:En.test(S),line:i+1,original:`${m}${h}${m}`,owner:y.owner,quote:m,ref:S,repo:y.repo,slug:$,subpath:y.subpath,trailingComment:R&&!p?R:void 0})}return s},Ne=e=>e.endsWith(".yml")||e.endsWith(".yaml"),Dn=(e,n=[])=>{const t=[],s=new Set,r=a=>{if(s.has(a))return;s.add(a);let d;try{d=K(a)}catch{return}const c=Nn(a,d);t.push(...c)},o=_(e,xn);if(O(o))for(const a of Y(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Ne(a.name)&&r(a.path);const i=_(e,An);if(O(i))for(const a of Y(i,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&r(a.path);for(const a of["action.yml","action.yaml"]){const d=_(e,a);O(d)&&r(d)}for(const a of n){const d=kt(a)?a:_(e,a);if(O(d))for(const c of Y(d,{includeDirs:!1,includeSymlinks:!1}))Ne(c.name)&&r(c.path)}return t},Un=40,Vn=1440*60*1e3,On=new Set(["develop","edge","main","master","stable","trunk"]),Bn=e=>e.length===Un&&/^[a-f0-9]{40}$/i.test(e)?!1:On.has(e.toLowerCase())?!0:F(e)===void 0,De=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},_n=(e,n,t,s)=>{const r=s==="sha"||e.isSha,{quote:o}=e;return r?`${o}${e.slug}@${n}${o} # ${t}`:`${o}${e.slug}@${t}${o}`},Mn=async(e,n)=>{const{ignoreRules:t,options:s,references:r,resolverOptions:o}=n,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const c=new Rn({apiBase:o?.apiBase,fetch:o?.fetch,token:s.githubToken??o?.token}),u=new Map;for(const $ of r){const S=`${$.owner}/${$.repo}`,y=u.get(S)??[];y.push($),u.set(S,y)}const f=Math.max(1,s.maxConcurrentRequests),g=[...u.keys()];let m=0;const h=async $=>{const S=u.get($)??[],[y,p]=$.split("/");if(!y||!p)return;let k;try{k=await c.listTags(y,p)}catch{for(const l of S)d.push({file:l.file,reason:`failed to list tags for ${$}`});return}for(const l of S){const E=l.slug;let w;if(l.ignoreReason?w=l.ignoreReason:De(E,s.exclude)?w="matched --exclude":s.include.length>0&&!De(E,s.include)?w="not matched by --include":s.respectDependabotConfig&&t&&ke(E,"actions",t)&&(w="ignored by dependabot/renovate config"),w){a.push({currentRef:l.ref,currentVersion:l.isSha?l.trailingComment?.replace(/^#\s*/,""):l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:w,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&Bn(l.ref)){a.push({currentRef:l.ref,currentVersion:l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:"branch reference (use --include-branches)",replacement:l.original,updateType:"unknown"});continue}const C=l.isSha?l.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":l.ref,T=F(C);if(l.isSha&&!T&&s.mode!=="latest"){a.push({currentRef:l.ref,currentVersion:void 0,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:l.original,updateType:"unknown"});continue}const x=we(k.parsed,T,s.mode);if(!x)continue;if(s.minAgeDays!==void 0){const M=await c.resolveRef(y,p,x.sha),D=M?.committedAt?new Date(M.committedAt).getTime():void 0;if(D&&(Date.now()-D)/Vn<s.minAgeDays){a.push({currentRef:l.ref,currentVersion:T?.raw,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:x.raw,original:l.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:l.original,updateType:"unknown"});continue}}const j=s.style==="sha"||l.isSha?x.sha:x.raw,N=_n(l,x.sha,x.raw,s.style);i.push({currentRef:l.ref,currentVersion:T?.raw??l.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:l.file,line:l.line,name:E,newRef:j,newVersion:x.raw,original:l.original,replacement:N,updateType:ve(T,x),url:`https://github.com/${y}/${p}/releases/tag/${x.raw}`})}},R=[];for(let $=0;$<Math.min(f,g.length);$++)R.push((async()=>{for(;m<g.length;){const S=g[m];m+=1,S!==void 0&&await h(S)}})());await Promise.all(R);const A=bn(e,i);return{failed:d,ignored:a,updates:A}},Pn=e=>e.toSorted((n,t)=>n.file!==t.file?n.file<t.file?-1:1:n.line-t.line),nt=e=>{const n=[],t=[];if(e.length===0)return{applied:n,skipped:t};const s=Pn(e),r=new Map;for(const o of s){const i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}for(const[o,i]of r){let a;try{a=K(o)}catch(g){for(const m of i)t.push({reason:`read failed: ${g.message}`,update:m});continue}const d=a.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as mt}from"node:module";import{y as b,J as it,B as yt,A as at,m as O,f as B,k as kt}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as mt}from"node:module";import{y as b,J as it,B as yt,A as at,m as O,f as B,k as kt}from"../packem_shared/index-BVuCxe14.js";import{$ as vt,m as w,n as C,i as x,k as Tt,W as St}from"./catalog.js";import ot from"./index.js";import{k as ct}from"../packem_shared/main-B3juSU5z.js";import"../packem_shared/env-Cpxa_7UE.js";import{o as It}from"../packem_shared/spinner-DuJJvFTl.js";import{C as dt,D as _,T as lt}from"../packem_shared/symbols-DPTlrJ3B.js";import{s as V,E as $,q as P,V as G,I as Et}from"../packem_shared/index.server-J83sowC4.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";const wt=mt(import.meta.url),A=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,H=t=>{if(typeof A<"u"&&A.versions&&A.versions.node){const[e,s]=A.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return A.getBuiltinModule(t)}return wt(t)},{readFileSync:xt,writeFileSync:bt,unlinkSync:$t}=H("node:fs"),{randomBytes:Ct}=H("node:crypto"),{availableParallelism:z}=H("node:os");class E extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class At extends E{}class v extends E{}class W extends E{}class R extends E{stderr;constructor(e,s,r){super(e,r),this.stderr=s}}class K extends E{}class I extends E{commandTitle;constructor(e,s,r){super(s,r),this.commandTitle=e}}const ut=t=>t.includes("/"),D=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,r={})=>{const n=ut(t),a=r.caseInsensitive===!0,c=D(t,a),i=[];for(const o of e){const l=n?b(s,o):it(o);ot(c,D(l,a))&&i.push(o)}return i},Rt=(t,e,s,r={})=>{if(!e||e.length===0)return[...t];const n=r.caseInsensitive===!0;return t.filter(a=>{for(const c of e){const i=ut(c)?b(s,a):it(a),o=D(c,n);if(ot(o,D(i,n)))return!1}return!0})},L=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",N=t=>typeof t=="object"&&t!==null&&typeof t.command=="string"&&typeof t.task!="function",Nt=(t,e)=>{const s=b(t,e);return s===""||!s.startsWith("..")&&!at(s)},Ot=(t,e)=>{let s;for(const r of e)Nt(r,t)&&(s===void 0||r.length>s.length)&&(s=r);return s},_t=async t=>{let e=0,s=0;const r=()=>(e+=1,`pattern-${e}`),n=()=>(s+=1,`cmd-${s}`),a=(o,l,h,d)=>{if(o.perPackage===!0){const u=t.workspacePackages??[],p=new Map;for(const f of h){const g=Ot(f,u)??t.cwd,y=p.get(g)??[];y.push(b(g,f)),p.set(g,y)}for(const f of[...p.keys()].sort()){const g=b(t.cwd,f)||".";d.push({command:o.command,cwd:f,files:p.get(f)??[],id:n(),source:"string",title:`${o.command} — ${g}`})}return}if(o.cwd!==void 0){const u=yt(t.cwd,o.cwd);d.push({command:o.command,cwd:u,files:h,id:n(),source:"string",title:`${o.command} — ${b(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:n(),source:"string",title:o.command})},c=async(o,l,h,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:n(),source:"string",title:o});return}if(Array.isArray(o)){for(const u of o)await c(u,l,h,d);return}if(N(o)){a(o,l,h,d);return}if(typeof o=="function"){const u=await o([...l]);if(typeof u=="string"){d.push({command:u,files:l,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const p of u)if(typeof p=="string")d.push({command:p,files:l,id:n(),source:"function",title:p});else if(N(p))a(p,l,h,d);else if(L(p))d.push({files:l,id:n(),run:p.task,source:"custom",title:p.title});else throw new v("Task function returned an array with an unsupported entry — expected strings, { command, … }, or { title, task }.");return}if(N(u)){a(u,l,h,d);return}if(L(u)){d.push({files:l,id:n(),run:u.task,source:"custom",title:u.title});return}throw new v("Task function returned an unsupported value — expected string, string[], { command, … }, or { title, task }.")}if(L(o)){d.push({files:l,id:n(),run:o.task,source:"custom",title:o.title});return}throw new v("Unsupported task value — expected string, string[], function, { command, … }, or { title, task }.")},i=[];for(const[o,l]of Object.entries(t.config)){const h=jt(o,t.files,t.cwd,{caseInsensitive:t.caseInsensitive===!0});if(h.length===0)continue;const d=t.relative?h.map(p=>b(t.cwd,p)):h,u=[];await c(l,d,h,u),u.length!==0&&i.push({commands:u,files:d,id:r(),pattern:o,title:`${o} — ${h.length} file${h.length===1?"":"s"}`})}return i},Dt=async t=>{if(t.config!==void 0)return t.config;throw new v(`No staged config provided. Add \`staged\` to your vis.config.ts:
|
|
2
2
|
|
|
3
3
|
import { defineConfig } from "@visulima/vis/config";
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as Be}from"node:module";import{r as p,m as e,n as s,i as r,$ as ze,d as Ge}from"./catalog.js";import"../packem_shared/env-
|
|
1
|
+
import{createRequire as Be}from"node:module";import{r as p,m as e,n as s,i as r,$ as ze,d as Ge}from"./catalog.js";import"../packem_shared/env-Cpxa_7UE.js";import{I as Ue}from"../packem_shared/index-B0EsgdzO.js";import{A as We}from"../packem_shared/pm-runner-mVFjedM6.js";import{i as $e,m as le,f as Xe,v as Ve,H as He,a as Je}from"../packem_shared/index-BVuCxe14.js";import{y as W,_ as Ce,J as qe,K as Ye,I as Ke,M as Qe,Q as Ze}from"./cli-main.js";import{F as et,a as tt}from"../packem_shared/tabs-CgxCvjCY.js";const Ne=Be(import.meta.url),Y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Re=i=>{if(typeof Y<"u"&&Y.versions&&Y.versions.node){const[t,n]=Y.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Y.getBuiltinModule(i)}return Ne(i)},{writeFileSync:_e}=Re("node:fs"),rt=(i,{whitespace:t=!0}={})=>i.replace($e,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),$=[{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)"}],ot=i=>{const t=le(i,".devcontainer","devcontainer.json");if(!Xe(t))return null;const n=Ve(t),c=rt(n),l=c!==n;let o;try{o=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:o,hadComments:l}},nt=(i,t,n)=>{const c=n?He(n):le(i,".devcontainer"),l=n??le(c,"devcontainer.json");Je(c),_e(l,`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,"utf8")},it={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},st=[{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 it[i])l.has(a.target)||c.push(a);const o=Object.keys(t);for(const{featureMatch:a,mounts:m}of st)if(o.some(g=>g.includes(a)))for(const g of m)l.has(g.target)||c.push(g);return c},N=["general","features","ports","lifecycle","extensions","environment","mounts","compose"],K=i=>structuredClone(i);class ct{#o=new Set;#e;constructor(t,n,c=null){const l=t===null,o=t??{name:""},a=K(o);this.#e={config:a,detectedPm:c,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:n,isDirty:!1,mode:l?"create":"edit",originalConfig:l?null:K(o),section:"general",showTemplateSelector:l,suggestedMounts:pe(c,a.features??{},a.mounts??[]),templateIndex:0}}getSnapshot=()=>this.#e;subscribe=t=>(this.#o.add(t),()=>{this.#o.delete(t)});setSection(t){t!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:t})}nextSection(){const t=(N.indexOf(this.#e.section)+1)%N.length;this.setSection(N[t])}previousSection(){const t=(N.indexOf(this.#e.section)-1+N.length)%N.length;this.setSection(N[t])}setFieldIndex(t){t!==this.#e.fieldIndex&&this.#t({...this.#e,fieldIndex:Math.max(0,t)})}setFieldEditing(t){t!==this.#e.fieldEditing&&this.#t({...this.#e,fieldEditing:t})}setTemplateIndex(t){const n=Math.max(0,Math.min(t,$.length-1));n!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:n})}applyTemplate(t){const n=$.find(c=>c.id===t);n&&this.#t(this.#r({...this.#e,config:K(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.#r({...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??[]],o=l.indexOf(t);o===-1?l.push(t):l.splice(o,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",o={...this.#e.config[l],[n]:c};this.#t({...this.#e,config:{...this.#e.config,[l]:o},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.#r({...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.#r({...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.#r({...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:K(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const t=K(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}#r(t){return{...t,suggestedMounts:pe(t.detectedPm,t.config.features??{},t.config.mounts??[])}}#t(t){this.#e=t;for(const n of this.#o)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))},lt=/^[a-z]$/i,at=i=>{const t=i.codePointAt(0);return t!==void 0&&(t<32||t===127)},dt=(i,t)=>i.length===0||at(i)?!1:t.ctrl&&t.meta?!lt.test(i):!(t.ctrl||t.meta),ut=/\S+\s*$/,se=(i,t)=>i.length===0||!t?void 0:t.find(n=>n.startsWith(i))?.slice(i.length)??void 0,Se=-1,ht=(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:Se,mt=(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(ut,"");return[l+n.slice(c),l.length]}};function he({defaultValue:i="",isDisabled:t=!1,mask:n=!1,onChange:c,onSubmit:l,placeholder:o,suggestions:a}){const[m,g]=p.useState(i),[f,j]=p.useState(i.length),x=p.useRef(m);x.current=m;const v=p.useRef(f);v.current=f;const b=p.useRef(c);b.current=c;const S=p.useRef(l);S.current=l;const D=se(m,a),R=p.useCallback((T,I)=>{const{current:E}=v,k=x.current;if(I.return){const w=se(k,a),C=w?k+w:k;w&&(g(C),j(C.length),b.current?.(C)),S.current?.(C);return}if(I.escape)return;if(I.rightArrow){const w=se(k,a);if(E===k.length&&w){const C=k+w;g(C),j(C.length),b.current?.(C);return}j(Math.min(k.length,E+1));return}const P=ht(T,I,E,k.length);if(P!==Se){j(P);return}const H=mt(T,I,k,E);if(H){const[w,C]=H;g(w),j(C),b.current?.(w);return}if(dt(T,I)){const w=k.slice(0,E)+T+k.slice(E);g(w),j(E+T.length),b.current?.(w)}},[a]);W(R,{isActive:!t});const L=n?"*".repeat(m.length):m,X=L.slice(0,f),V=L[f],Q=L.slice(f+1);return t?e.jsx(s,{children:e.jsx(r,{dimColor:!0,children:L||o||""})}):m.length===0&&o?e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,inverse:!0,children:o[0]}),e.jsx(r,{dimColor:!0,children:o.slice(1)})]}):e.jsxs(s,{children:[e.jsxs(r,{children:[X,e.jsx(r,{inverse:!0,children:V??" "}),Q]}),D?e.jsx(r,{dimColor:!0,children:D}):void 0]})}const Ee=["dockerComposeFile","service"],gt={dockerComposeFile:"Compose File",service:"Service"},ve={dockerComposeFile:"docker-compose.yml",service:"app"},ft={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},pt=({config:i,fieldEditing:t,fieldIndex:n,onUpdate:c})=>{const l=!!i.dockerComposeFile,o=!!(i.image||i.build);return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&l&&e.jsx(s,{marginBottom:1,children:e.jsx(r,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Ee.map((a,m)=>{const g=m===n,f=i[a]??"",j=Array.isArray(i[a])?i[a].join(", "):f;return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:g,color:g?"cyan":"white",children:[g?"❯ ":" ",gt[a],":"]})}),e.jsx(s,{flexGrow:1,children:g&&t?e.jsx(he,{defaultValue:j,onChange:x=>{c({[a]:x||void 0})},placeholder:ve[a]}):e.jsx(r,{color:j?"white":"gray",children:j||ve[a]})})]}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:ft[a]})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},xt=Ee.length,jt=({config:i,fieldIndex:t})=>{const n=i.containerEnv??{},c=i.remoteEnv??{},l=Object.keys(n),o=Object.keys(c),a=l.length,m=l.length+1,g=m+o.length,f=t<=a,j=t>a;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{borderColor:f?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:l.length>0?1:0,children:[e.jsx(r,{bold:!0,color:f?"cyan":"white",children:"containerEnv"}),e.jsx(r,{dimColor:!0,children:" — baked into the container image"})]}),l.map((x,v)=>{const b=v===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:b?"cyan":void 0,inverse:b,wrap:"truncate",children:[b?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:n[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:l.length>0?1:0,children:e.jsxs(r,{color:t===a?"cyan":"gray",inverse:t===a,children:[" ","+ Add variable..."]})})]}),e.jsxs(s,{borderColor:j?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:o.length>0?1:0,children:[e.jsx(r,{bold:!0,color:j?"cyan":"white",children:"remoteEnv"}),e.jsx(r,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((x,v)=>{const b=m+v===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:b?"cyan":void 0,inverse:b,wrap:"truncate",children:[b?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:c[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:o.length>0?1:0,children:e.jsxs(r,{color:t===g?"cyan":"gray",inverse:t===g,children:[" ","+ Add variable..."]})})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},vt=i=>{const t=Object.keys(i.containerEnv??{}).length,n=Object.keys(i.remoteEnv??{}).length;return t+1+n+1},yt=({config:i,fieldIndex:t,scrollOffset:n,searchText:c,viewportHeight:l})=>{const o=p.useMemo(()=>new Set(i.customizations?.vscode?.extensions),[i.customizations?.vscode?.extensions]),a=p.useMemo(()=>ue(c),[c]),m=a.length,g=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(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{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((f,j)=>{const x=j===t,v=o.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:v?"white":"gray",children:[" ",v?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.id]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Ce,{contentHeight:m,placement:"inset",scrollOffset:n,style:"block",viewportHeight:l})})]}),a.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No extensions match the search."})})]})},bt=({config:i,fieldIndex:t,scrollOffset:n,searchText:c,viewportHeight:l})=>{const o=p.useMemo(()=>new Set(Object.keys(i.features??{})),[i.features]),a=p.useMemo(()=>de(c),[c]),m=a.length,g=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(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{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((f,j)=>{const x=j===t,v=o.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:v?"white":"gray",children:[" ",v?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.description]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Ce,{contentHeight:m,placement:"inset",scrollOffset:n,style:"block",viewportHeight:l})})]}),a.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No features match the search."})})]})},ae=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],wt={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},ye={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"],kt={overrideCommand:"Override Command",privileged:"Privileged"},Ct=ae.length+te.length,St=({config:i,fieldEditing:t,fieldIndex:n,onUpdate:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"General Configuration"})}),ae.map((l,o)=>{const a=o===n,m=i[l]??"";return e.jsxs(s,{marginBottom:1,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:a,color:a?"cyan":"white",children:[a?"❯ ":" ",wt[l],":"]})}),e.jsx(s,{flexGrow:1,children:a&&t?e.jsx(he,{defaultValue:m,onChange:g=>{c({[l]:g})},placeholder:ye[l]}):e.jsx(r,{color:m?"white":"gray",children:m||ye[l]})})]},l)}),te.map((l,o)=>{const a=ae.length+o===n,m=i[l]??!1;return e.jsxs(s,{marginBottom:o<te.length-1?1:0,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:a,color:a?"cyan":"white",children:[a?"❯ ":" ",kt[l],":"]})}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{color:m?"green":"gray",children:[m?"yes":"no",a&&e.jsx(r,{dimColor:!0,children:" (Space to toggle)"})]})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),Ie=Ct,ce=te,Te=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],Et={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},It={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(r,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Te.map((l,o)=>{const a=o===n,m=i[l],g=Array.isArray(m)?m.join(" && "):m??"";return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsx(s,{children:e.jsxs(r,{bold:a,color:a?"cyan":"white",children:[a?"❯ ":" ",Et[l]]})}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:It[l]})}),e.jsx(s,{paddingLeft:4,children:a&&t?e.jsx(he,{defaultValue:g,onChange:f=>{c(l,f)},placeholder:"e.g. npm install"}):e.jsx(r,{color:g?"green":"gray",children:g||"(not set)"})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),Dt=Te.length,be=i=>typeof i=="string"?i:`[${i.type}] ${i.source} → ${i.target}`,Pt=({addingMount:i,config:t,detectedPm:n,fieldIndex:c,mountPhase:l,mountSource:o,mountTarget:a,mountType:m,suggestedMounts:g})=>{const f=t.mounts??[];return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[f.length," ","mounts"]}),n&&e.jsxs(r,{dimColor:!0,children:["— detected:"," ",e.jsx(r,{color:"white",children:n})]})]}),g.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(r,{bold:!0,color:"yellow",children:"Suggested mounts"}),e.jsxs(r,{dimColor:!0,children:[" ","— press"," ",e.jsx(r,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),g.map((j,x)=>e.jsx(s,{flexShrink:0,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" + ",be(j)]})},`suggestion-${String(x)}`))]}),f.length>0&&e.jsx(s,{flexDirection:"column",marginBottom:1,children:f.map((j,x)=>{const v=x===c;return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:v?">":" "}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:v,inverse:v,wrap:"truncate",children:[" ",be(j)]})})]},`mount-${String(x)}`)})}),!i&&e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:c===f.length?"cyan":"gray",inverse:c===f.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(r,{bold:!0,color:"cyan",children:"New Mount"})}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:l==="source",color:l==="source"?"cyan":"white",children:[l==="source"?"❯ ":" ","Source:"]})}),e.jsx(r,{color:o?"yellow":"gray",children:o||(l==="source"?"_":"(type source, Enter to continue)")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:l==="target",color:l==="target"?"cyan":"white",children:[l==="target"?"❯ ":" ","Target:"]})}),e.jsx(r,{color:a?"yellow":"gray",children:a||(l==="target"?"_":"/container/path")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:l==="type",color:l==="type"?"cyan":"white",children:[l==="type"?"❯ ":" ","Type:"]})}),l==="type"?e.jsxs(r,{children:[e.jsx(r,{bold:m==="volume",color:m==="volume"?"cyan":"gray",children:"[1] volume"})," ",e.jsx(r,{bold:m==="bind",color:m==="bind"?"cyan":"gray",children:"[2] bind"})," ",e.jsx(r,{bold:m==="tmpfs",color:m==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):e.jsx(r,{color:"gray",children:m})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:l==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),f.length===0&&!i&&g.length===0&&e.jsx(s,{marginTop:1,children:e.jsx(r,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},Ft=({addingPort:i,addPortValue:t,config:n,fieldIndex:c})=>{const l=n.forwardPorts??[],o=c===l.length;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{bold:!0,color:"cyan",children:"Forwarded Ports"}),e.jsxs(r,{dimColor:!0,children:[" ","(",l.length," ","ports)"]})]}),l.map((a,m)=>{const g=m===c;return e.jsx(s,{children:e.jsxs(r,{color:g?"cyan":void 0,inverse:g,children:[" ",String(a)]})},`port-${String(a)}`)}),e.jsx(s,{marginTop:l.length>0?1:0,children:e.jsxs(r,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&i?e.jsxs(r,{children:["Enter port:"," ",e.jsx(r,{color:"yellow",children:t||"_"})]}):"+ Add port..."]})}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},At=({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(r,{bold:!0,color:i?"cyan":"white",children:"Preview"}),e.jsxs(r,{dimColor:!0,children:[" ","(",c==="create"?"new":"edit",")"]})]}),t&&c==="edit"&&e.jsx(s,{flexShrink:0,paddingX:1,children:e.jsx(r,{color:"yellow",children:"Comments will not be preserved."})}),e.jsx(qe,{flexGrow:1,ref:l,scrollbar:!0,scrollbarColor:"gray",children:n.split(`
|
|
3
3
|
`).map((o,a)=>e.jsx(r,{color:"green",children:o},`line-${String(a)}`))})]}),Ot=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,o]of i.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&t.push({field:"forwardPorts",message:`Invalid port ${String(o)} 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}},we=80,ke=15,Mt=120,De=[{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"}],Lt=new Map(De.map(i=>[i.id,i.description])),Bt=(i,t,n,c)=>{switch(i){case"compose":return xt;case"environment":return vt(t);case"extensions":return ue(c).length;case"features":return de(n).length;case"general":return Ie;case"lifecycle":return Dt;case"mounts":return(t.mounts?.length??0)+1;case"ports":return(t.forwardPorts?.length??0)+1;default:return 0}},Nt=({onSave:i,store:t})=>{const{exit:n}=Ye(),{columns:c,rows:l}=Ke(),o=p.useSyncExternalStore(t.subscribe,t.getSnapshot),[a,m]=p.useState(!1),[g,f]=p.useState(!1),[j,x]=p.useState(!1),[v,b]=p.useState(null),[S,D]=p.useState("editor"),[R,L]=p.useState(0),[X,V]=p.useState(!1),[Q,T]=p.useState(""),[I,E]=p.useState(null),[k,P]=p.useState(""),[H,w]=p.useState(""),[C,z]=p.useState("key"),[re,Z]=p.useState(!1),[oe,G]=p.useState(""),[ne,_]=p.useState(""),[me,J]=p.useState("volume"),[A,U]=p.useState("source"),ie=p.useRef(null),B=p.useRef(null),M=p.useRef(null),ee=p.useRef(!0);p.useEffect(()=>(ee.current=!0,()=>{ee.current=!1,M.current&&clearTimeout(M.current)}),[]);const ge=Bt(o.section,o.config,o.featureSearch,o.extensionSearch),q=Math.max(1,l-9);p.useEffect(()=>{o.section!=="features"&&o.section!=="extensions"||L(u=>o.fieldIndex>=u+q?o.fieldIndex-q+1:o.fieldIndex<u?o.fieldIndex:u)},[o.fieldIndex,o.section,q]),p.useEffect(()=>{L(0)},[o.section,o.featureSearch,o.extensionSearch]);const Pe=p.useCallback(()=>{const u=t.cleanConfig(),h=Ot(u);if(!h.valid){const y=h.errors[0];b(y?`Error: ${y.message}`:"Validation failed"),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{ee.current&&b(null)},3e3);return}i(u),t.markClean();const d=h.warnings.length;b(d>0?`Saved! (${String(d)} warning${d>1?"s":""})`:"Saved!"),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{ee.current&&b(null)},2e3)},[i,t]);W((u,h)=>{if(h.downArrow||u==="j")t.setTemplateIndex(o.templateIndex+1);else if(h.upArrow||u==="k")t.setTemplateIndex(o.templateIndex-1);else if(h.return){const d=$[o.templateIndex];d&&t.applyTemplate(d.id)}else h.escape&&t.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),W((u,h)=>{if(h.escape){V(!1),T("");return}if(h.return){const d=Number.parseInt(Q,10);!Number.isNaN(d)&&d>0&&d<=65535&&t.addPort(d),V(!1),T("");return}if(h.backspace){T(d=>d.slice(0,-1));return}u&&/^\d$/u.test(u)&&T(d=>d+u)},{isActive:X}),W((u,h)=>{if(h.escape){E(null),P(""),w(""),z("key");return}if(h.return){if(C==="key"&&k){z("value");return}if(C==="value"&&k){t.addEnvVar(I,k,H),E(null),P(""),w(""),z("key");return}}if(h.backspace){C==="key"?P(d=>d.slice(0,-1)):w(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(C==="key"?P(d=>d+u):w(d=>d+u))},{isActive:I!==null}),W((u,h)=>{if(h.escape){Z(!1),G(""),_(""),U("source");return}if(h.return){if(A==="source"&&oe){U("target");return}if(A==="target"&&ne){U("type");return}if(A==="type"){t.addMount({source:oe,target:ne,type:me}),Z(!1),G(""),_(""),U("source");return}}if(A==="type"){switch(u){case"1":{J("volume");break}case"2":{J("bind");break}case"3":{J("tmpfs");break}}return}if(h.backspace){A==="source"?G(d=>d.slice(0,-1)):A==="target"&&_(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(A==="source"?G(d=>d+u):A==="target"&&_(d=>d+u))},{isActive:re}),W((u,h)=>{if(u==="c"&&h.ctrl){n();return}if(!g){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),f(!0));return}if(j){if(h.escape){x(!1),o.section==="features"?t.setFeatureSearch(""):t.setExtensionSearch("");return}if(h.return){x(!1);return}if(h.backspace){o.section==="features"?t.setFeatureSearch(o.featureSearch.slice(0,-1)):t.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(u&&!h.ctrl&&!h.meta){o.section==="features"?t.setFeatureSearch(o.featureSearch+u):t.setExtensionSearch(o.extensionSearch+u);return}return}if(o.fieldEditing){if(h.escape){t.setFieldEditing(!1);return}if(h.return){t.setFieldEditing(!1);return}return}if(u==="?"){m(!0);return}if(u==="q"){o.isDirty?f(!0):n();return}if(u==="s"){Pe();return}if(h.tab){D(d=>d==="editor"?"preview":"editor");return}if(S==="preview"){if(h.downArrow||u==="j"){B.current?.scrollBy(1);return}if(h.upArrow||u==="k"){B.current?.scrollBy(-1);return}if(h.pageDown){B.current?.scrollBy(10);return}if(h.pageUp){B.current?.scrollBy(-10);return}if(h.home){B.current?.scrollToTop();return}if(h.end){B.current?.scrollToBottom();return}h.escape&&D("editor");return}if(h.downArrow||u==="j"){ge>0&&t.setFieldIndex(Math.min(o.fieldIndex+1,ge-1));return}if(h.upArrow||u==="k"){t.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(h.return){switch(o.section){case"compose":case"general":case"lifecycle":{t.setFieldEditing(!0);break}case"environment":{const d=Object.keys(o.config.containerEnv??{}).length,y=d,O=d+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===y?(E("container"),P(""),w(""),z("key")):o.fieldIndex===O&&(E("remote"),P(""),w(""),z("key"));break}case"mounts":{const d=o.config.mounts??[];o.fieldIndex===d.length&&(Z(!0),G(""),_(""),J("volume"),U("source"));break}case"ports":{const d=o.config.forwardPorts??[];o.fieldIndex===d.length&&(V(!0),T(""));break}}return}if(u===" "){switch(o.section){case"extensions":{const d=ue(o.extensionSearch)[o.fieldIndex];d&&t.toggleExtension(d.id);break}case"features":{const d=de(o.featureSearch)[o.fieldIndex];d&&t.toggleFeature(d.id);break}case"general":{const d=Ie-ce.length,y=o.fieldIndex-d;if(y>=0&&y<ce.length){const O=ce[y];t.updateConfig({[O]:!o.config[O]})}break}}return}if(u==="/"){(o.section==="features"||o.section==="extensions")&&x(!0);return}if(u==="A"&&o.section==="mounts"){t.applySuggestedMounts();return}if(u==="a"){if(o.section==="environment"){const d=Object.keys(o.config.containerEnv??{}).length,y=o.fieldIndex<=d?"container":"remote";E(y),P(""),w(""),z("key")}else o.section==="mounts"&&(Z(!0),G(""),_(""),J("volume"),U("source"));return}if(u==="d")switch(o.section){case"environment":{const d=Object.keys(o.config.containerEnv??{}),y=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<d.length)t.removeEnvVar("container",d[o.fieldIndex]),d.length===1||o.fieldIndex>=d.length-1&&t.setFieldIndex(d.length-2);else{const O=o.fieldIndex-d.length-1;O>=0&&O<y.length&&(t.removeEnvVar("remote",y[O]),y.length===1||O>=y.length-1&&t.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const d=o.config.mounts??[];if(o.fieldIndex<d.length){t.removeMount(o.fieldIndex);const y=d.length-1;o.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}case"ports":{const d=o.config.forwardPorts??[];if(o.fieldIndex<d.length){t.removePort(o.fieldIndex);const y=d.length-1;o.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}}}},{isActive:!o.showTemplateSelector&&!X&&I===null&&!re});const Fe=p.useMemo(()=>t.getJsonPreview(),[o.config]);if(c<we||l<ke)return e.jsx(s,{alignItems:"center",height:l,justifyContent:"center",width:c,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",l,"), need"," ",we,"x",ke]})});if(o.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(r,{bold:!0,color:"cyan",children:"Select a Template"})}),$.map((u,h)=>{const d=h===o.templateIndex;return e.jsx(s,{children:e.jsxs(r,{color:d?"cyan":void 0,inverse:d,children:[d?" ❯ ":" ",e.jsx(r,{bold:d,children:u.name}),e.jsxs(r,{dimColor:!0,children:[" ","-",u.description]})]})},u.id)}),e.jsx(s,{justifyContent:"center",marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","select"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let F;switch(o.section){case"compose":{F=e.jsx(pt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:u=>{t.updateConfig(u)}});break}case"environment":{F=e.jsxs(s,{flexDirection:"column",children:[e.jsx(jt,{config:o.config,fieldIndex:o.fieldIndex}),I!==null&&e.jsx(s,{marginTop:1,paddingX:1,children:e.jsxs(r,{color:"cyan",children:["Add"," ",I," ","env:"," ",C==="key"?e.jsxs(r,{children:["key=",e.jsx(r,{color:"yellow",children:k||"_"})," ","(Enter to set value)"]}):e.jsxs(r,{children:[k,"=",e.jsx(r,{color:"yellow",children:H||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{F=e.jsx(yt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:R,searchText:o.extensionSearch,viewportHeight:q});break}case"features":{F=e.jsx(bt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:R,searchText:o.featureSearch,viewportHeight:q});break}case"general":{F=e.jsx(St,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:u=>{t.updateConfig(u)}});break}case"lifecycle":{F=e.jsx(Tt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:(u,h)=>{t.setLifecycleCommand(u,h)}});break}case"mounts":{F=e.jsx(Pt,{addingMount:re,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:A,mountSource:oe,mountTarget:ne,mountType:me,suggestedMounts:o.suggestedMounts});break}case"ports":{F=e.jsx(Ft,{addingPort:X,addPortValue:Q,config:o.config,fieldIndex:o.fieldIndex});break}default:F=e.jsx(r,{children:"Unknown section"})}const Ae=e.jsxs(s,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[e.jsxs(s,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"TABS"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:"SAVE"})]})]}),e.jsxs(s,{paddingX:1,children:[v&&e.jsxs(r,{color:v.startsWith("Error")?"red":"green",children:[v," "]}),o.isDirty&&e.jsx(r,{color:"yellow",children:"[modified]"}),!o.isDirty&&!v&&e.jsx(r,{dimColor:!0,children:"[saved]"})]})]}),Oe=e.jsxs(Qe,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef: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(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:" Switch tabs"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),"/",e.jsx(r,{bold:!0,color:"white",children:"j/k"}),e.jsx(r,{dimColor:!0,children:" Navigate within section"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:" Switch editor/preview panel"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Enter"}),e.jsx(r,{dimColor:!0,children:" Edit selected field"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Esc"}),e.jsx(r,{dimColor:!0,children:" Stop editing / cancel"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:" Toggle selection"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:" Search / filter"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:" Add new entry"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"d"}),e.jsx(r,{dimColor:!0,children:" Delete selected entry"})]})]}),e.jsxs(s,{flexDirection:"column",children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:" Save configuration"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Me=e.jsx(At,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:Fe,mode:o.mode,scrollRef:B}),fe=c>=Mt,Le=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(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),e.jsx(s,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(et,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:u=>{t.setSection(u),D("editor")},showIndex:!1,children:De.map(({id:u,label:h})=>e.jsx(tt,{name:u,children:h},u))})}),e.jsx(s,{flexShrink:0,paddingRight:2,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:Lt.get(o.section)??""})}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:F}),fe&&e.jsx(s,{flexShrink:0,width:Le,children:Me})]}),Ae,e.jsx(Ze,{autoExitSeconds:3,onCancel:()=>{f(!1)},visible:g}),Oe]})},Vt=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,o=t.output,a=!!process.stdout.isTTY&&!Ue;let m=null;try{m=We(c).name}catch{}const g=ot(c);let f=g?.config??null;const j=g?.hadComments??!1;if(l&&!g){const S=$.find(D=>D.id===l);if(!S){const D=$.map(R=>R.id).join(", ");throw new Error(`Unknown template "${l}". Valid templates: ${D}`)}f=S.config}if(!a){f?i.info(JSON.stringify(f,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),v=new ct(f,j,m);l&&!g&&v.dismissTemplateSelector();let b=null;if(await ze(Ge.createElement(Nt,{onSave:S=>{nt(c,S,o),b=S},store:v}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(x),b){const S=o??".devcontainer/devcontainer.json";i.info(`DevContainer config saved to ${S}`)}};export{Vt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as rr}from"node:module";import{m as oe,H as js,J as nr,y as or,T as $s,v as ar,l as cr}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as rr}from"node:module";import{m as oe,H as js,J as nr,y as or,T as $s,v as ar,l as cr}from"../packem_shared/index-BVuCxe14.js";import{expandAffected as lr,getChangedFiles as dr,buildEnhancedPath as ur,enforceProjectConstraints as hr,expandTokensInString as Ht,parsePartition as fr,TaskScheduler as pr,createTaskGraph as gr,reverseTaskGraph as mr,resolveTurboEnvCompat as wr,CompositeLifeCycle as zt,defaultTaskRunner as Yt,createLogReporter as yr,readLastRunSummary as vr,getLastRunSummaryPath as kr,runConcurrently as Xe,generateRunSummary as Jt,writeChromeTrace as xr,writeRunSummary as jr,TerminalBuffer as mt}from"@visulima/task-runner";import{I as He}from"../packem_shared/index-B0EsgdzO.js";import{J as bs,K as $r,I as br,y as Kt,M as Sr,Q as Tr,T as Cr,al as Ir,b as Rr,am as Er,an as Mr,ao as Fr,ap as Or}from"./cli-main.js";import{r as z,m as n,n as m,i as c,h as he,d as K,$ as Pr,C as Ar,b as Dr,O as Lr}from"./catalog.js";import{d as Br,r as Nr}from"../packem_shared/lockfile-CWcVTdRc.js";import{a as Ts}from"../packem_shared/public-api-WqUCiyIe.js";import{F as Hr}from"../packem_shared/failure-log-MOhz-TBv.js";import{r as zr}from"../packem_shared/command-runtime-EWjmSxPj.js";import{r as Yr}from"../packem_shared/toolchain-B5KwUZfq.js";import{i as Jr,r as Kr,s as Qr,a as Xr,c as Zr,d as ei,e as ti,H as si,f as ri,b as ii}from"../packem_shared/lifecycle-hzwghh5a.js";import{p as ni,r as oi,f as ai}from"../packem_shared/selectors-CRgS4bU9.js";import{r as nt,l as yt,d as ci,s as li,m as di,a as ui}from"../packem_shared/target-options-TM6ETDAS.js";import{o as hi,m as fi,c as Ze}from"../packem_shared/env-Cpxa_7UE.js";import{T as Cs,C as Is,D as ot,E as Rs}from"../packem_shared/symbols-DPTlrJ3B.js";import{V as dt,E as Zt,q as vi,j as ki}from"../packem_shared/index.server-J83sowC4.js";import{parseStacktrace as xi,codeFrame as ji}from"@visulima/error";import{originalPositionFor as $i,sourceContentFor as bi,loadSourceMap as Si}from"@visulima/source-map";import{o as Es}from"../packem_shared/spinner-DuJJvFTl.js";import{c as es,a as Ei,s as ts}from"../packem_shared/watch-BnE1TzYn.js";import ft from"./index.js";const ir=rr(import.meta.url),Ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ee=s=>{if(typeof Ve<"u"&&Ve.versions&&Ve.versions.node){const[e,t]=Ve.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Ve.getBuiltinModule(s)}return ir(s)},{existsSync:Ae,mkdirSync:Gr,writeFileSync:wt,readFileSync:Ge,openSync:_r,statSync:Qt,readSync:qr,closeSync:Wr,mkdtempSync:Ur}=Ee("node:fs"),{createInterface:Ss,emitKeypressEvents:Vr}=Ee("node:readline"),{spawn:pi}=Ee("node:child_process"),{isAbsolute:gi,resolve:Xt,dirname:mi,relative:wi}=Ee("node:path"),{fileURLToPath:yi}=Ee("node:url"),{createHash:Ti}=Ee("node:crypto"),{mkdir:Ci,appendFile:at}=Ee("node:fs/promises"),{platform:Ii,homedir:vt,tmpdir:Ri}=Ee("node:os"),ss=new WeakSet,Mi=s=>{if(ss.has(s))return;const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(typeof s.future!="string"||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");ss.add(s)},Ms=(s,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:\.\d{0,${String(e)}})?`).exec(s.toString());return t===null?s:Number.parseFloat(t[0])},rs=({unitCount:s,unitName:e},t,r)=>{let{spacer:o}=r;const{maxDecimalPoints:a}=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,f=s;a!==void 0&&(f=Ms(s,a));const h=f.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const $ of h)u+=$==="."?i:d[$]}else u=h.replace(".",i);else u="";const p=t[e];let l=p;return typeof p=="function"&&(l=p(s)),t._hideCountIf2&&s===2&&(o=""),t._numberFirst?l+o+u:u+o+l},Fi=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,o=e.largest??Number.POSITIVE_INFINITY,a={};let i,d,u,f=s;for(d=0;d<t.length;d++){i=t[d];const p=r[i];u=d===t.length-1?f/p:Math.floor(f/p),a[i]=u,f-=u*p}if(e.round){let p=o;for(d=0;d<t.length;d++)if(i=t[d],u=a[i],u!==0&&(p--,p===0)){for(let l=d+1;l<t.length;l++){const $=t[l],R=a[$];a[i]=(a[i]??0)+R*r[$]/r[i],a[$]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=a[i],u===0)continue;const l=Math.round(u);if(a[i]=l,d===0)break;const $=t[d-1],R=r[$],G=Math.floor(l*r[i]/R);if(G)a[$]=(a[$]??0)+G,a[i]=0;else break}}const h=[];for(d=0;d<t.length&&h.length<o;d++){if(i=t[d],u=a[i],u&&!e.round&&h.length===o-1){let p,l=0;for(p=d+1,t.length;p<t.length;p++){const $=t[p];l+=a[$]*(e.unitMeasures[$]/e.unitMeasures[i])}u+=l,e.maxDecimalPoints!==void 0&&(u=Ms(u,e.maxDecimalPoints))}u&&h.push({unitCount:u,unitName:i})}return h},Oi=(s,e,t)=>{const{language:r,units:o}=e;if(s.length===0){const p=o.at(-1);return rs({unitCount:0,unitName:p},r,e)}const{conjunction:a,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 f=s.map(p=>rs(p,r,e));let h;return!a||s.length===1?h=f.join(d):s.length===2?h=f.join(a):h=f.slice(0,-1).join(d)+(i?",":"")+a+(f.at(-1)??""),u&&(h=u.replace("%s",h)),h},Pi=(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:hi,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};Mi(t.language);const r=Math.abs(s),o=Fi(r,t);return Oi(o,t,s)},Fs=s=>s===155||s===157||s===144||s===152||s===158||s===159,Os=(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},et=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const o=s.codePointAt(r);if(o===156||t&&o===7)return r;if(o===27&&s.codePointAt(r+1)===92)return r+1}return-1},Ai=(s,e)=>{const t=s.codePointAt(e+1);return t===91?Os(s,e+2):t===93?et(s,e+2,!0):t===80||t===88||t===94||t===95?et(s,e+2,!1):t!==void 0?e+1:-1},Di=(s,e)=>{const t=s.codePointAt(e);return t===155?Os(s,e+1):t===157?et(s,e+1,!0):t===144||t===152||t===158||t===159?et(s,e+1,!1):-1},Li=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Fs(s.codePointAt(e)))return!0;return!1},Bi=s=>{if(!Li(s))return s;let e="",t=0,r=0;const{length:o}=s;for(;r<o;){const a=s.codePointAt(r);let i;if(a===27)i=Ai(s,r);else if(Fs(a))i=Di(s,r);else{r+=1;continue}i===-1&&(i=o-1),e+=s.slice(t,r),t=i+1,r=i+1}return e+=s.slice(t),e},be="@voidzero-dev/vite-task-client",kt="@visulima/task-runner-client",tt=`npm:${kt}@^1`,Ps=oe(".vis",".vite-client-override-declined"),st="pnpm-workspace.yaml",Ni=["dependencies","devDependencies","optionalDependencies","peerDependencies"],As=s=>{try{return JSON.parse(Ge(s,"utf8"))}catch{return}},Gi=s=>{const e=oe(s,st);if(Ae(e))try{return Ts(Ge(e,"utf8")).toJS()?.overrides}catch{return}},_i=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",qi=s=>{const e=oe(s,st);try{const t=Ts(Ge(e,"utf8"));return t.setIn(["overrides",be],tt),wt(e,t.toString()),!0}catch{return!1}},is=s=>s!==void 0&&Ni.some(e=>s[e]?.[be]!==void 0),Wi=(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,Ui=(s,e=[])=>{const t=As(oe(s,"package.json")),r=Ae(oe(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:Wi(t,Gi(s)),declined:Ae(oe(s,Ps)),manager:Br(s)?.manager,present:is(t)||r||e.some(o=>is(o))}},Vi=s=>{try{const e=oe(s,Ps);Gr(js(e),{recursive:!0}),wt(e,`Declined adding the ${be} → ${kt} override.
|
|
2
2
|
Delete this file to be asked again.
|
|
3
3
|
`)}catch{}},Hi=(s,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&Ae(oe(s,st))&&qi(s))return{file:st,installCommand:t};const r=oe(s,"package.json"),o=As(r);if(!o)return;const a=_i(e);a==="pnpm.overrides"?(o.pnpm??={},o.pnpm.overrides??={},o.pnpm.overrides[be]=tt):(o[a]??={},o[a][be]=tt);try{wt(r,`${JSON.stringify(o,void 0,4)}
|
|
4
4
|
`)}catch{return}return{file:"package.json",installCommand:t}},zi=async(s,e)=>{const t=Ui(s,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined)return!1;const r=Ss({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${be}. Its cache hints no-op under @visulima/task-runner unless aliased to ${kt} (a drop-in replacement).`);const o=await new Promise(i=>{r.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(o.trim()))return Vi(s),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const a=Hi(s,t.manager);return a===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}": "${tt}" to ${a.file}. Run \`${a.installCommand}\` to apply it.`),!0)}finally{r.close()}},Yi=({interactive:s,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:s&&t!==!1,Ji=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),Ki=(s,e,t)=>{const r=new Set,o=[];if(s===void 0||s.trim()==="")return{skipTaskIds:r,unmatchedPatterns:o};const a=[...t],i=new Set(a),d=new Map;for(const u of a){const f=u.lastIndexOf(":");if(f===-1)continue;const h=u.slice(f+1),p=d.get(h);p===void 0?d.set(h,[u]):p.push(u)}for(const u of Ji(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 f=ni(u);if(!f){o.push(u);continue}let h=!1;switch(f.kind){case"all":{const p=d.get(f.target)??[];for(const l of p)r.add(l),h=!0;break}case"project":{const p=f.projects?.[0];if(p!==void 0){const l=`${p}:${f.target}`;i.has(l)&&(r.add(l),h=!0)}break}case"tag":{const{tag:p}=f;if(p!==void 0){const l=d.get(f.target)??[];for(const $ of l){const R=$.slice(0,$.lastIndexOf(":"));e.projects[R]?.tags?.includes(p)===!0&&(r.add($),h=!0)}}break}}h||o.push(u)}return{skipTaskIds:r,unmatchedPatterns:o}},Qi=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Xi=new Set(["0","!","#","$","*","-","?","@","_"]),Zi=s=>{const e=new Map;for(const t of s.matchAll(Qi)){const r=t[1],o=t[3],a=t[2],i=r??o;if(i===void 0||Xi.has(i))continue;const d=a!==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}))},en=s=>{const{command:e,processEnv:t,taskEnv:r,taskId:o}=s,a=Zi(e);if(a.length===0)return;const i=[];for(const{hasDefault:d,name:u}of a){if(d)continue;const f=r[u],h=t[u];f===void 0&&h===void 0&&i.push(u)}if(i.length!==0)return{missing:i.toSorted(),taskId:o}},tn=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.`},ns=s=>{const e=new Set;for(const t of Object.values(s.projects))for(const r of Object.keys(t.targets??{}))e.add(r);return[...e].sort()},sn=s=>{const e=new Map;for(const t of s.values())for(const[r,o]of Object.entries(t))for(const a of o.aliases??[])e.has(a)||e.set(a,r);return e},rn=(s,e)=>e.get(s)??s,nn=(s,e)=>{if(s.length===0)return e.length;if(e.length===0)return s.length;const t=[];for(let r=0;r<=e.length;r++)t[r]=[r];for(let r=0;r<=s.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let o=1;o<=s.length;o++){const a=e[r-1]===s[o-1]?0:1;t[r][o]=Math.min(t[r-1][o]+1,t[r][o-1]+1,t[r-1][o-1]+a)}return t[e.length][s.length]},on=(s,e,t=3)=>Ds(s,e,1,t)[0],Ds=(s,e,t=3,r=3)=>{const o=[];for(const a of e){const i=nn(s.toLowerCase(),a.toLowerCase());i<=r&&o.push({distance:i,name:a})}return o.sort((a,i)=>a.distance-i.distance||a.name.localeCompare(i.name)),o.slice(0,t).map(a=>a.name)},an=s=>s.length===0?" (no targets found)":s.map(e=>` - ${e}`).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as ps}from"node:module";import{E as De,s as Wt,V as oi,I as Cr,q as ai}from"../packem_shared/index.server-J83sowC4.js";import{T as ms,f as jr,A as At,y as Nr,B as Pt,v as fs,m as St}from"../packem_shared/index-CE6MsgcV.js";import{g as bs}from"../packem_shared/_commonjsHelpers-B5Y90VFO.js";import{fingerprint as yt,scan as ii,scanFiles as vs,inspectRuleset as ys,listRules as Ir,listRequiredValidators as ws,scanGitHistory as $s}from"@visulima/secret-scanner";import{aq as ks,ar as Rr,p as de}from"./cli-main.js";import{o as Ps}from"../packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js";import{a as As}from"../packem_shared/readJsonSync-DuMMeB3s-ihoybKvs.js";const gs=ps(import.meta.url),Tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ri=e=>{if(typeof Tt<"u"&&Tt.versions&&Tt.versions.node){const[t,n]=Tt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Tt.getBuiltinModule(e)}return gs(e)},{pathToFileURL:si}=ri("node:url"),{execFileSync:xs}=ri("node:child_process"),Cs={one:{},two:{},three:{},four:{}},js={one:{},two:{},three:{}},Ns={},Is=[],ar={methods:Cs,model:js,compute:Ns,hooks:Is},Ts=e=>Object.prototype.toString.call(e)==="[object Array]",Es={compute:function(e){const{world:t}=this,n=t.compute;return typeof e=="string"&&n.hasOwnProperty(e)?n[e](this):Ts(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}},Ds=function(e){return this.fullPointer.forEach((t,n)=>{const r=this.update([t]);e(r,n)}),this},Hs=function(e,t){const n=this.fullPointer.map((o,a)=>{const i=this.update([o]),s=e(i,a);return s===void 0?this.none():s});if(n.length===0)return t||this.update([]);if(n[0]!==void 0&&(typeof n[0]=="string"||typeof n[0]=="object"&&(n[0]===null||!n[0].isView)))return n;let r=[];return n.forEach(o=>{r=r.concat(o.fullPointer)}),this.toView(r)},Gs=function(e){let t=this.fullPointer;return t=t.filter((n,r)=>{const o=this.update([n]);return e(o,r)}),this.update(t)},Os=function(e){const t=this.fullPointer.find((n,r)=>{const o=this.update([n]);return e(o,r)});return this.update([t])},Fs=function(e){return this.fullPointer.some((t,n)=>{const r=this.update([t]);return e(r,n)})},Vs=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)},zs={forEach:Ds,map:Hs,filter:Gs,find:Os,some:Fs,random:Vs},He={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}};He.group=He.groups;He.fullSentence=He.fullSentences;He.sentence=He.fullSentences;He.lastTerm=He.lastTerms;He.firstTerm=He.firstTerms;const ir=Object.assign({},He,Es,zs);ir.get=ir.eq;let En=class vn{constructor(t,n,r={}){[["document",t],["world",ar],["_groups",r],["_cache",null],["viewType","View"]].forEach(o=>{Object.defineProperty(this,o[0],{value:o[1],writable:!0})}),this.ptrs=n}get docs(){let t=this.document;return this.ptrs&&(t=ar.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((o,a)=>[a])).map(o=>{let[a,i,s,u,l]=o;return i=i||0,s=s||(r[a]||[]).length,r[a]&&r[a][i]&&(u=u||r[a][i].id,r[a][s-1]&&(l=l||r[a][s-1].id)),[a,i,s,u,l]})}update(t){const n=new vn(this.document,t);if(this._cache&&t&&t.length>0){const r=[];t.forEach((o,a)=>{const[i,s,u]=o;o.length===1?r[a]=this._cache[i]:s===0&&this.document[i].length===u&&(r[a]=this._cache[i])}),r.length>0&&(n._cache=r)}return n.world=this.world,n}toView(t){return new vn(this.document,t||this.pointer)}fromText(t){const{methods:n}=this,r=n.one.tokenize.fromString(t,this.world),o=new vn(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(En.prototype,ir);const Bs="14.15.1",Ur=function(e){return e&&typeof e=="object"&&!Array.isArray(e)},Ss=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function ui(e,t){if(Ur(t))for(const n in t)Ur(t[n])?(e[n]||Object.assign(e,{[n]:{}}),ui(e[n],t[n])):Object.assign(e,{[n]:t[n]});return e}function Ms(e,t){for(const n in t)e[n]=e[n]||{},Object.assign(e[n],t[n]);return e}const Ls=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))})},li=function(e,t,n,r){if(Ss(e)){e.forEach(u=>li(u,t,n,r));return}const{methods:o,model:a,compute:i,hooks:s}=t;e.methods&&Ms(o,e.methods),e.model&&ui(a,e.model),e.irregulars&&Ls(a,e.irregulars),e.compute&&Object.assign(i,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)},Ks=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},Js=e=>Object.prototype.toString.call(e)==="[object Object]",sr=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Ws=function(e){return e.map(t=>t.terms.map(n=>(sr(n.tags)&&(n.tags=new Set(n.tags)),n)))},qs=function(e){return e.map(t=>t.map(n=>({text:n,normal:n,pre:"",post:" ",tags:new Set})))},ci=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 a=r.one.tokenize.fromString(e,n);return new t(a)}if(Js(e)&&e.isView)return new t(e.document,e.ptrs);if(sr(e)){if(sr(e[0])){const i=qs(e);return new t(i)}const a=Ws(e);return new t(a)}return o},xn=Object.assign({},ar),T=function(e,t){t&&T.addWords(t);const n=ci(e,En,xn);return e&&n.compute(xn.hooks),n};Object.defineProperty(T,"_world",{value:xn,writable:!0});T.tokenize=function(e,t){const{compute:n}=this._world;t&&T.addWords(t);const r=ci(e,En,xn);return n.contractions&&r.compute(["alias","normal","machine","contractions"]),r};T.plugin=function(e){return li(e,this._world,En,this),this};T.extend=T.plugin;T.world=function(){return this._world};T.model=function(){return this._world.model};T.methods=function(){return this._world.methods};T.hooks=function(){return this._world.hooks};T.verbose=Ks;T.version=Bs;const Rs=function(e){return e.map(t=>{const n=new Set;return t.forEach(r=>{r.normal!==""&&n.add(r.normal),r.switch&&n.add(`%${r.switch}%`),r.implicit&&n.add(r.implicit),r.machine&&n.add(r.machine),r.root&&n.add(r.root),r.alias&&r.alias.forEach(a=>n.add(a));const o=Array.from(r.tags);for(let a=0;a<o.length;a+=1)n.add("#"+o[a])}),n})},Us={one:{cacheDoc:Rs}},_s={cache:function(){return this._cache=this.methods.one.cacheDoc(this.document),this},uncache:function(){return this._cache=null,this}},Qs=function(e){Object.assign(e.prototype,_s)},Zs={cache:function(e){e._cache=e.methods.one.cacheDoc(e.document)}},Xs={api:Qs,compute:Zs,methods:Us},Ys={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}},_r=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),eu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),tu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hi=(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},Vt=function(e){const t=/ $/,n=/[-–—]/,r=e[e.length-1];r&&!t.test(r.post)&&!n.test(r.post)&&(r.post+=" ")},Qr=(e,t,n)=>{const r=/[-.?!,;:)–—'"]/g,o=e[t-1];if(!o)return;const a=o.post;if(r.test(a)){const i=a.match(r).join(""),s=n[n.length-1];s.post=i+s.post,o.post=o.post.replace(r,"")}},nu=function(e,t,n){const r=e[t];if(t!==0||!_r(r.text))return;n[0].text=eu(n[0].text);const o=e[t];o.tags.has("ProperNoun")||o.tags.has("Acronym")||_r(o.text)&&o.text.length>1&&(o.text=tu(o.text))},ru=function(e,t,n,r){const[o,a,i]=t;a===0||i===r[o].length?Vt(n):(Vt(n),Vt([e[t[1]]])),nu(e,a,n),hi(e,a,n)},ou=function(e,t,n,r){const[o,,a]=t,i=(r[o]||[]).length;a<i?(Qr(e,a,n),Vt(n)):i===a&&(Vt(e),Qr(e,a,n),r[o+1]&&(n[n.length-1].post+=" ")),hi(e,t[2],n),t[4]=n[n.length-1].id};let Et=0;const Zr=e=>(e=e.length<3?"0"+e:e,e.length<3?"0"+e:e),di=function(e){let[t,n]=e.index||[0,0];Et+=1,Et=Et>46655?0:Et,t=t>46655?0:t,n=n>1294?0:n;let r=Zr(Et.toString(36));r+=Zr(t.toString(36));let o=n.toString(36);o=o.length<2?"0"+o:o,r+=o;const a=parseInt(Math.random()*36,10);return r+=a.toString(36),e.normal+"|"+r.toUpperCase()},Xr=function(e){e.has("@hasContraction")&&typeof e.contractions=="function"&&e.grow("@hasContraction").contractions().expand()},Yr=e=>Object.prototype.toString.call(e)==="[object Array]",au=function(e){return e=e.map(t=>(t.id=di(t),t)),e},iu=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]||[]:Yr(e)?Yr(e[0])?e[0]:e:[]},eo=function(e,t,n){const{document:r,world:o}=t;t.uncache();const a=t.fullPointer,i=t.fullPointer;t.forEach((u,l)=>{const c=u.fullPointer[0],[d]=c,g=r[d];let x=iu(e,o);x.length!==0&&(x=au(x),n?(Xr(t.update([c]).firstTerm()),ru(g,c,x,r)):(Xr(t.update([c]).lastTerm()),ou(g,c,x,r)),r[d]&&r[d][c[1]]&&(c[3]=r[d][c[1]].id),i[l]=c,c[2]+=x.length,a[l]=c)});const s=t.toView(a);return t.ptrs=i,s.compute(["id","index","freeze","lexicon"]),s.world.compute.preTagger&&s.compute("preTagger"),s.compute("unfreeze"),s},ut={insertAfter:function(e){return eo(e,this,!1)},insertBefore:function(e){return eo(e,this,!0)}};ut.append=ut.insertAfter;ut.prepend=ut.insertBefore;ut.insert=ut.insertAfter;const su=/\$[0-9a-z]+/g,Tr={},uu=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),lu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),cu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hu=function(e,t,n){return e.forEach(r=>{const o=t(r);r.replaceWith(o,n)}),e},du=function(e,t){if(typeof e!="string")return e;const n=t.groups();return e=e.replace(su,r=>{const o=r.replace(/\$/,"");return n.hasOwnProperty(o)?n[o].text():r}),e};Tr.replaceWith=function(e,t={}){let n=this.fullPointer;const r=this;if(this.uncache(),typeof e=="function")return hu(r,e,t);const o=r.docs[0];if(!o)return r;const a=t.possessives&&o[o.length-1].tags.has("Possessive"),i=t.case&&uu(o[0].text);e=du(e,r);const s=this.update(n);n=n.map(g=>g.slice(0,3));const u=(s.docs[0]||[]).map(g=>Array.from(g.tags)),l=s.docs[0][0].pre,c=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),a){const g=r.docs[0],x=g[g.length-1];x.tags.has("Possessive")||(x.text+="'s",x.normal+="'s",x.tags.add("Possessive"))}if(l&&r.docs[0]&&(r.docs[0][0].pre=l),c&&r.docs[0]){const g=r.docs[0][r.docs[0].length-1];g.post.trim()||(g.post=c)}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((g,x)=>{g.tagSafe(u[x])}),!d.docs[0]||!d.docs[0][0])return d;if(t.case){const g=i?lu:cu;d.docs[0][0].text=g(d.docs[0][0].text)}return d};Tr.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 pu=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"))},gu=function(e,t){t.forEach(n=>{const[r,o,a]=n,i=a-o;e[r]&&(a===e[r].length&&a>1&&pu(e[r],i),e[r].splice(o,i))});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},mu=function(e,t){return e=e.map(n=>{const[r]=n;return t[r]&&t[r].forEach(o=>{const a=o[2]-o[1];n[1]<=o[1]&&n[2]>=o[2]&&(n[2]-=a)}),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},ur={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 a=n.fullPointer;const i=r.fullPointer.reverse(),s=gu(this.document,i),u=t(i);return a=mu(a,u),n.ptrs=a,n.document=s,n.compute("index"),o&&(n.ptrs=void 0),e?n.toView(a):(this.ptrs=[],n.none())}};ur.delete=ur.remove;const Mt={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}};Mt.deHyphenate=Mt.dehyphenate;Mt.toQuotation=Mt.toQuotations;const fu=(e,t)=>e.normal<t.normal?-1:e.normal>t.normal?1:0,bu=(e,t)=>{const n=e.normal.trim().length,r=t.normal.trim().length;return n<r?1:n>r?-1:0},vu=(e,t)=>e.words<t.words?1:e.words>t.words?-1:0,yu=(e,t)=>e[0]<t[0]?1:e[0]>t[0]?-1:e[1]>t[1]?1:-1,wu=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],a=t[r.normal];return o<a?1:o>a?-1:0}),e},Vn={alpha:fu,length:bu,wordCount:vu,sequential:yu,byFreq:wu},$u=new Set(["index","sequence","seq","sequential","chron","chronological"]),ku=new Set(["freq","frequency","topk","repeats"]),Pu=new Set(["alpha","alphabetical"]),Au=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},xu=function(e){const{docs:t,pointer:n}=this;if(this.uncache(),typeof e=="function")return Au(this,e);e=e||"alpha";const r=n||t.map((a,i)=>[i]);let o=t.map((a,i)=>({index:i,words:a.length,normal:a.map(s=>s.machine||s.normal||"").join(" "),pointer:r[i]}));return $u.has(e)&&(e="sequential"),Pu.has(e)&&(e="alpha"),ku.has(e)?(o=Vn.byFreq(o),this.update(o.map(a=>a.pointer))):typeof Vn[e]=="function"?(o=o.sort(Vn[e]),this.update(o.map(a=>a.pointer))):this},Cu=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)},ju=function(){const e=new Set;return this.filter(t=>{const n=t.text("machine");return e.has(n)?!1:(e.add(n),!0)})},Nu={unique:ju,reverse:Cu,sort:xu},Iu=e=>Object.prototype.toString.call(e)==="[object Array]",pi=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},Tu=function(e,t){if(e.document===t.document){const n=e.fullPointer.concat(t.fullPointer);return e.toView(n).compute("index")}return t.fullPointer.forEach(n=>{n[0]+=e.document.length}),e.document=pi(e.document,t.docs),e.all()},Eu={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 Tu(this,e);if(Iu(e)){const t=pi(this.document,e);return this.document=t,this.all()}return this}},Du=function(){return this.ptrs=this.fullPointer,this},Hu=function(){let e=this.ptrs;return!e||e.length<1?this:(e=e.map(t=>t.slice(0,3)),this.ptrs=e,this)},Gu={harden:Du,soften:Hu},Ou=Object.assign({},Ys,ut,Tr,ur,Mt,Nu,Eu,Gu),Fu=function(e){Object.assign(e.prototype,Ou)},Vu={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||di(o)}}},zu={api:Fu,compute:Vu},Bu=[{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"]}],Su={st:!0,nd:!0,rd:!0,th:!0,am:!0,pm:!0,max:!0,"°":!0,s:!0,e:!0,er:!0,ère:!0,ème:!0},Mu={one:{contractions:Bu,numberSuffixes:Su}},zn=function(e,t,n){const[r,o]=t;!n||n.length===0||(n=n.map((a,i)=>(a.implicit=a.text,a.machine=a.text,a.pre="",a.post="",a.text="",a.normal="",a.index=[r,o+i],a)),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))},Lu=/'/,Ku=new Set(["what","how","when","where","why"]),Ju=new Set(["be","go","start","think","need"]),Wu=new Set(["been","gone"]),qu=function(e,t){const n=e[t].normal.split(Lu)[0];if(Ku.has(n))return[n,"did"];if(e[t+1]){if(Wu.has(e[t+1].normal))return[n,"had"];if(Ju.has(e[t+1].normal))return[n,"would"]}return null},Ru=function(e,t){return e[t].normal==="ain't"||e[t].normal==="aint"?null:[e[t].normal.replace(/n't/,""),"not"]},Er=/'/,Uu=/(e|é|aison|sion|tion)$/,_u=/(age|isme|acle|ege|oire)$/,Qu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&n.endsWith("e")?["la",n]:["le",n]},Zu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&Uu.test(n)&&!_u.test(n)?["du",n]:n&&n.endsWith("s")?["des",n]:["de",n]},Xu=(e,t)=>["je",e[t].normal.split(Er)[1]],Bn={preJ:Xu,preL:Qu,preD:Zu},Yu=/^([0-9.]{1,4}[a-z]{0,2}) ?[-–—] ?([0-9]{1,4}[a-z]{0,2})$/i,el=/^([0-9]{1,2}(:[0-9][0-9])?(am|pm)?) ?[-–—] ?([0-9]{1,2}(:[0-9][0-9])?(am|pm)?)$/i,tl=/^[0-9]{3}-[0-9]{4}$/,nl=function(e,t){const n=e[t];let r=n.text.match(Yu);return r!==null?n.tags.has("PhoneNumber")===!0||tl.test(n.text)?null:[r[1],"to",r[2]]:(r=n.text.match(el),r!==null?[r[1],"to",r[4]]:null)},rl=/^([+-]?[0-9][.,0-9]*)([a-z°²³µ/]+)$/,ol=function(e,t,n){const r=n.model.one.numberSuffixes||{},o=e[t].text.match(rl);if(o!==null){const a=o[2].toLowerCase().trim();return r.hasOwnProperty(a)?null:[o[1],a]}return null},to=/'/,al=/^[0-9][^-–—]*[-–—].*?[0-9]/,no=function(e,t,n,r){const o=t.update();o.document=[e];let a=n+r;n>0&&(n-=1),e[a]&&(a+=1),o.ptrs=[[0,n,a]]},ro={t:(e,t)=>Ru(e,t),d:(e,t)=>qu(e,t)},oo={j:(e,t)=>Bn.preJ(e,t),l:(e,t)=>Bn.preL(e,t),d:(e,t)=>Bn.preD(e,t)},il=function(e,t,n,r){for(let o=0;o<e.length;o+=1){const a=e[o];if(a.word===t.normal)return a.out;if(r!==null&&r===a.after)return[n].concat(a.out);if(n!==null&&n===a.before&&r&&r.length>2)return a.out.concat(r)}return null},Sn=function(e,t){const n=t.fromText(e.join(" "));return n.compute(["id","alias"]),n.docs[0]},sl=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"]},ul=e=>{const{world:t,document:n}=e,{model:r,methods:o}=t,a=r.one.contractions||[];n.forEach((i,s)=>{for(let u=i.length-1;u>=0;u-=1){let l=null,c=null;if(to.test(i[u].normal)===!0){const g=i[u].normal.split(to);l=g[0],c=g[1]}let d=il(a,i[u],l,c);if(!d&&ro.hasOwnProperty(c)&&(d=ro[c](i,u,t)),!d&&oo.hasOwnProperty(l)&&(d=oo[l](i,u)),l==="there"&&c==="s"&&(d=sl(i,u)),d){d=Sn(d,e),zn(n,[s,u],d),no(n[s],e,u,d.length);continue}if(al.test(i[u].normal)){d=nl(i,u),d&&(d=Sn(d,e),zn(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"),no(n[s],e,u,d.length));continue}d=ol(i,u,t),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag([d[1]],"Unit",t,null,"contraction-unit"))}})},ll={contractions:ul},cl={model:Mu,compute:ll,hooks:["contractions"]},ao=function(e){const t=e.world,{model:n,methods:r}=e.world,o=r.one.setTag,{frozenLex:a}=n.one,i=n.one._multiCache||{};e.docs.forEach(s=>{for(let u=0;u<s.length;u+=1){const l=s[u],c=l.machine||l.normal;if(i[c]!==void 0&&s[u+1]){const d=u+i[c]-1;for(let g=d;g>u;g-=1){const x=s.slice(u,g+1),G=x.map(U=>U.machine||U.normal).join(" ");if(a.hasOwnProperty(G)===!0){o(x,a[G],t,!1,"1-frozen-multi-lexicon"),x.forEach(U=>U.frozen=!0);continue}}}if(a[c]!==void 0&&a.hasOwnProperty(c)){o([l],a[c],t,!1,"1-freeze-lexicon"),l.frozen=!0;continue}}})},hl=function(e){return e.docs.forEach(t=>{t.forEach(n=>{delete n.frozen})}),e},dl={frozen:ao,freeze:ao,unfreeze:hl},io=e=>"\x1B[34m"+e+"\x1B[0m",so=e=>"\x1B[3m\x1B[2m"+e+"\x1B[0m",uo=function(e){e.docs.forEach(t=>{console.log(io(`
|
|
1
|
+
import{createRequire as ps}from"node:module";import{E as De,s as Wt,V as oi,I as Cr,q as ai}from"../packem_shared/index.server-J83sowC4.js";import{T as ms,f as jr,A as At,y as Nr,B as Pt,v as fs,m as St}from"../packem_shared/index-BVuCxe14.js";import{g as bs}from"../packem_shared/_commonjsHelpers-B5Y90VFO.js";import{fingerprint as yt,scan as ii,scanFiles as vs,inspectRuleset as ys,listRules as Ir,listRequiredValidators as ws,scanGitHistory as $s}from"@visulima/secret-scanner";import{aq as ks,ar as Rr,p as de}from"./cli-main.js";import{o as Ps}from"../packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js";import{a as As}from"../packem_shared/readJsonSync-DuMMeB3s-Cx08VBQg.js";const gs=ps(import.meta.url),Tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ri=e=>{if(typeof Tt<"u"&&Tt.versions&&Tt.versions.node){const[t,n]=Tt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Tt.getBuiltinModule(e)}return gs(e)},{pathToFileURL:si}=ri("node:url"),{execFileSync:xs}=ri("node:child_process"),Cs={one:{},two:{},three:{},four:{}},js={one:{},two:{},three:{}},Ns={},Is=[],ar={methods:Cs,model:js,compute:Ns,hooks:Is},Ts=e=>Object.prototype.toString.call(e)==="[object Array]",Es={compute:function(e){const{world:t}=this,n=t.compute;return typeof e=="string"&&n.hasOwnProperty(e)?n[e](this):Ts(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}},Ds=function(e){return this.fullPointer.forEach((t,n)=>{const r=this.update([t]);e(r,n)}),this},Hs=function(e,t){const n=this.fullPointer.map((o,a)=>{const i=this.update([o]),s=e(i,a);return s===void 0?this.none():s});if(n.length===0)return t||this.update([]);if(n[0]!==void 0&&(typeof n[0]=="string"||typeof n[0]=="object"&&(n[0]===null||!n[0].isView)))return n;let r=[];return n.forEach(o=>{r=r.concat(o.fullPointer)}),this.toView(r)},Gs=function(e){let t=this.fullPointer;return t=t.filter((n,r)=>{const o=this.update([n]);return e(o,r)}),this.update(t)},Os=function(e){const t=this.fullPointer.find((n,r)=>{const o=this.update([n]);return e(o,r)});return this.update([t])},Fs=function(e){return this.fullPointer.some((t,n)=>{const r=this.update([t]);return e(r,n)})},Vs=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)},zs={forEach:Ds,map:Hs,filter:Gs,find:Os,some:Fs,random:Vs},He={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}};He.group=He.groups;He.fullSentence=He.fullSentences;He.sentence=He.fullSentences;He.lastTerm=He.lastTerms;He.firstTerm=He.firstTerms;const ir=Object.assign({},He,Es,zs);ir.get=ir.eq;let En=class vn{constructor(t,n,r={}){[["document",t],["world",ar],["_groups",r],["_cache",null],["viewType","View"]].forEach(o=>{Object.defineProperty(this,o[0],{value:o[1],writable:!0})}),this.ptrs=n}get docs(){let t=this.document;return this.ptrs&&(t=ar.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((o,a)=>[a])).map(o=>{let[a,i,s,u,l]=o;return i=i||0,s=s||(r[a]||[]).length,r[a]&&r[a][i]&&(u=u||r[a][i].id,r[a][s-1]&&(l=l||r[a][s-1].id)),[a,i,s,u,l]})}update(t){const n=new vn(this.document,t);if(this._cache&&t&&t.length>0){const r=[];t.forEach((o,a)=>{const[i,s,u]=o;o.length===1?r[a]=this._cache[i]:s===0&&this.document[i].length===u&&(r[a]=this._cache[i])}),r.length>0&&(n._cache=r)}return n.world=this.world,n}toView(t){return new vn(this.document,t||this.pointer)}fromText(t){const{methods:n}=this,r=n.one.tokenize.fromString(t,this.world),o=new vn(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(En.prototype,ir);const Bs="14.15.1",Ur=function(e){return e&&typeof e=="object"&&!Array.isArray(e)},Ss=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function ui(e,t){if(Ur(t))for(const n in t)Ur(t[n])?(e[n]||Object.assign(e,{[n]:{}}),ui(e[n],t[n])):Object.assign(e,{[n]:t[n]});return e}function Ms(e,t){for(const n in t)e[n]=e[n]||{},Object.assign(e[n],t[n]);return e}const Ls=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))})},li=function(e,t,n,r){if(Ss(e)){e.forEach(u=>li(u,t,n,r));return}const{methods:o,model:a,compute:i,hooks:s}=t;e.methods&&Ms(o,e.methods),e.model&&ui(a,e.model),e.irregulars&&Ls(a,e.irregulars),e.compute&&Object.assign(i,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)},Ks=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},Js=e=>Object.prototype.toString.call(e)==="[object Object]",sr=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Ws=function(e){return e.map(t=>t.terms.map(n=>(sr(n.tags)&&(n.tags=new Set(n.tags)),n)))},qs=function(e){return e.map(t=>t.map(n=>({text:n,normal:n,pre:"",post:" ",tags:new Set})))},ci=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 a=r.one.tokenize.fromString(e,n);return new t(a)}if(Js(e)&&e.isView)return new t(e.document,e.ptrs);if(sr(e)){if(sr(e[0])){const i=qs(e);return new t(i)}const a=Ws(e);return new t(a)}return o},xn=Object.assign({},ar),T=function(e,t){t&&T.addWords(t);const n=ci(e,En,xn);return e&&n.compute(xn.hooks),n};Object.defineProperty(T,"_world",{value:xn,writable:!0});T.tokenize=function(e,t){const{compute:n}=this._world;t&&T.addWords(t);const r=ci(e,En,xn);return n.contractions&&r.compute(["alias","normal","machine","contractions"]),r};T.plugin=function(e){return li(e,this._world,En,this),this};T.extend=T.plugin;T.world=function(){return this._world};T.model=function(){return this._world.model};T.methods=function(){return this._world.methods};T.hooks=function(){return this._world.hooks};T.verbose=Ks;T.version=Bs;const Rs=function(e){return e.map(t=>{const n=new Set;return t.forEach(r=>{r.normal!==""&&n.add(r.normal),r.switch&&n.add(`%${r.switch}%`),r.implicit&&n.add(r.implicit),r.machine&&n.add(r.machine),r.root&&n.add(r.root),r.alias&&r.alias.forEach(a=>n.add(a));const o=Array.from(r.tags);for(let a=0;a<o.length;a+=1)n.add("#"+o[a])}),n})},Us={one:{cacheDoc:Rs}},_s={cache:function(){return this._cache=this.methods.one.cacheDoc(this.document),this},uncache:function(){return this._cache=null,this}},Qs=function(e){Object.assign(e.prototype,_s)},Zs={cache:function(e){e._cache=e.methods.one.cacheDoc(e.document)}},Xs={api:Qs,compute:Zs,methods:Us},Ys={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}},_r=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),eu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),tu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hi=(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},Vt=function(e){const t=/ $/,n=/[-–—]/,r=e[e.length-1];r&&!t.test(r.post)&&!n.test(r.post)&&(r.post+=" ")},Qr=(e,t,n)=>{const r=/[-.?!,;:)–—'"]/g,o=e[t-1];if(!o)return;const a=o.post;if(r.test(a)){const i=a.match(r).join(""),s=n[n.length-1];s.post=i+s.post,o.post=o.post.replace(r,"")}},nu=function(e,t,n){const r=e[t];if(t!==0||!_r(r.text))return;n[0].text=eu(n[0].text);const o=e[t];o.tags.has("ProperNoun")||o.tags.has("Acronym")||_r(o.text)&&o.text.length>1&&(o.text=tu(o.text))},ru=function(e,t,n,r){const[o,a,i]=t;a===0||i===r[o].length?Vt(n):(Vt(n),Vt([e[t[1]]])),nu(e,a,n),hi(e,a,n)},ou=function(e,t,n,r){const[o,,a]=t,i=(r[o]||[]).length;a<i?(Qr(e,a,n),Vt(n)):i===a&&(Vt(e),Qr(e,a,n),r[o+1]&&(n[n.length-1].post+=" ")),hi(e,t[2],n),t[4]=n[n.length-1].id};let Et=0;const Zr=e=>(e=e.length<3?"0"+e:e,e.length<3?"0"+e:e),di=function(e){let[t,n]=e.index||[0,0];Et+=1,Et=Et>46655?0:Et,t=t>46655?0:t,n=n>1294?0:n;let r=Zr(Et.toString(36));r+=Zr(t.toString(36));let o=n.toString(36);o=o.length<2?"0"+o:o,r+=o;const a=parseInt(Math.random()*36,10);return r+=a.toString(36),e.normal+"|"+r.toUpperCase()},Xr=function(e){e.has("@hasContraction")&&typeof e.contractions=="function"&&e.grow("@hasContraction").contractions().expand()},Yr=e=>Object.prototype.toString.call(e)==="[object Array]",au=function(e){return e=e.map(t=>(t.id=di(t),t)),e},iu=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]||[]:Yr(e)?Yr(e[0])?e[0]:e:[]},eo=function(e,t,n){const{document:r,world:o}=t;t.uncache();const a=t.fullPointer,i=t.fullPointer;t.forEach((u,l)=>{const c=u.fullPointer[0],[d]=c,g=r[d];let x=iu(e,o);x.length!==0&&(x=au(x),n?(Xr(t.update([c]).firstTerm()),ru(g,c,x,r)):(Xr(t.update([c]).lastTerm()),ou(g,c,x,r)),r[d]&&r[d][c[1]]&&(c[3]=r[d][c[1]].id),i[l]=c,c[2]+=x.length,a[l]=c)});const s=t.toView(a);return t.ptrs=i,s.compute(["id","index","freeze","lexicon"]),s.world.compute.preTagger&&s.compute("preTagger"),s.compute("unfreeze"),s},ut={insertAfter:function(e){return eo(e,this,!1)},insertBefore:function(e){return eo(e,this,!0)}};ut.append=ut.insertAfter;ut.prepend=ut.insertBefore;ut.insert=ut.insertAfter;const su=/\$[0-9a-z]+/g,Tr={},uu=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),lu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),cu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hu=function(e,t,n){return e.forEach(r=>{const o=t(r);r.replaceWith(o,n)}),e},du=function(e,t){if(typeof e!="string")return e;const n=t.groups();return e=e.replace(su,r=>{const o=r.replace(/\$/,"");return n.hasOwnProperty(o)?n[o].text():r}),e};Tr.replaceWith=function(e,t={}){let n=this.fullPointer;const r=this;if(this.uncache(),typeof e=="function")return hu(r,e,t);const o=r.docs[0];if(!o)return r;const a=t.possessives&&o[o.length-1].tags.has("Possessive"),i=t.case&&uu(o[0].text);e=du(e,r);const s=this.update(n);n=n.map(g=>g.slice(0,3));const u=(s.docs[0]||[]).map(g=>Array.from(g.tags)),l=s.docs[0][0].pre,c=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),a){const g=r.docs[0],x=g[g.length-1];x.tags.has("Possessive")||(x.text+="'s",x.normal+="'s",x.tags.add("Possessive"))}if(l&&r.docs[0]&&(r.docs[0][0].pre=l),c&&r.docs[0]){const g=r.docs[0][r.docs[0].length-1];g.post.trim()||(g.post=c)}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((g,x)=>{g.tagSafe(u[x])}),!d.docs[0]||!d.docs[0][0])return d;if(t.case){const g=i?lu:cu;d.docs[0][0].text=g(d.docs[0][0].text)}return d};Tr.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 pu=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"))},gu=function(e,t){t.forEach(n=>{const[r,o,a]=n,i=a-o;e[r]&&(a===e[r].length&&a>1&&pu(e[r],i),e[r].splice(o,i))});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},mu=function(e,t){return e=e.map(n=>{const[r]=n;return t[r]&&t[r].forEach(o=>{const a=o[2]-o[1];n[1]<=o[1]&&n[2]>=o[2]&&(n[2]-=a)}),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},ur={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 a=n.fullPointer;const i=r.fullPointer.reverse(),s=gu(this.document,i),u=t(i);return a=mu(a,u),n.ptrs=a,n.document=s,n.compute("index"),o&&(n.ptrs=void 0),e?n.toView(a):(this.ptrs=[],n.none())}};ur.delete=ur.remove;const Mt={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}};Mt.deHyphenate=Mt.dehyphenate;Mt.toQuotation=Mt.toQuotations;const fu=(e,t)=>e.normal<t.normal?-1:e.normal>t.normal?1:0,bu=(e,t)=>{const n=e.normal.trim().length,r=t.normal.trim().length;return n<r?1:n>r?-1:0},vu=(e,t)=>e.words<t.words?1:e.words>t.words?-1:0,yu=(e,t)=>e[0]<t[0]?1:e[0]>t[0]?-1:e[1]>t[1]?1:-1,wu=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],a=t[r.normal];return o<a?1:o>a?-1:0}),e},Vn={alpha:fu,length:bu,wordCount:vu,sequential:yu,byFreq:wu},$u=new Set(["index","sequence","seq","sequential","chron","chronological"]),ku=new Set(["freq","frequency","topk","repeats"]),Pu=new Set(["alpha","alphabetical"]),Au=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},xu=function(e){const{docs:t,pointer:n}=this;if(this.uncache(),typeof e=="function")return Au(this,e);e=e||"alpha";const r=n||t.map((a,i)=>[i]);let o=t.map((a,i)=>({index:i,words:a.length,normal:a.map(s=>s.machine||s.normal||"").join(" "),pointer:r[i]}));return $u.has(e)&&(e="sequential"),Pu.has(e)&&(e="alpha"),ku.has(e)?(o=Vn.byFreq(o),this.update(o.map(a=>a.pointer))):typeof Vn[e]=="function"?(o=o.sort(Vn[e]),this.update(o.map(a=>a.pointer))):this},Cu=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)},ju=function(){const e=new Set;return this.filter(t=>{const n=t.text("machine");return e.has(n)?!1:(e.add(n),!0)})},Nu={unique:ju,reverse:Cu,sort:xu},Iu=e=>Object.prototype.toString.call(e)==="[object Array]",pi=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},Tu=function(e,t){if(e.document===t.document){const n=e.fullPointer.concat(t.fullPointer);return e.toView(n).compute("index")}return t.fullPointer.forEach(n=>{n[0]+=e.document.length}),e.document=pi(e.document,t.docs),e.all()},Eu={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 Tu(this,e);if(Iu(e)){const t=pi(this.document,e);return this.document=t,this.all()}return this}},Du=function(){return this.ptrs=this.fullPointer,this},Hu=function(){let e=this.ptrs;return!e||e.length<1?this:(e=e.map(t=>t.slice(0,3)),this.ptrs=e,this)},Gu={harden:Du,soften:Hu},Ou=Object.assign({},Ys,ut,Tr,ur,Mt,Nu,Eu,Gu),Fu=function(e){Object.assign(e.prototype,Ou)},Vu={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||di(o)}}},zu={api:Fu,compute:Vu},Bu=[{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"]}],Su={st:!0,nd:!0,rd:!0,th:!0,am:!0,pm:!0,max:!0,"°":!0,s:!0,e:!0,er:!0,ère:!0,ème:!0},Mu={one:{contractions:Bu,numberSuffixes:Su}},zn=function(e,t,n){const[r,o]=t;!n||n.length===0||(n=n.map((a,i)=>(a.implicit=a.text,a.machine=a.text,a.pre="",a.post="",a.text="",a.normal="",a.index=[r,o+i],a)),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))},Lu=/'/,Ku=new Set(["what","how","when","where","why"]),Ju=new Set(["be","go","start","think","need"]),Wu=new Set(["been","gone"]),qu=function(e,t){const n=e[t].normal.split(Lu)[0];if(Ku.has(n))return[n,"did"];if(e[t+1]){if(Wu.has(e[t+1].normal))return[n,"had"];if(Ju.has(e[t+1].normal))return[n,"would"]}return null},Ru=function(e,t){return e[t].normal==="ain't"||e[t].normal==="aint"?null:[e[t].normal.replace(/n't/,""),"not"]},Er=/'/,Uu=/(e|é|aison|sion|tion)$/,_u=/(age|isme|acle|ege|oire)$/,Qu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&n.endsWith("e")?["la",n]:["le",n]},Zu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&Uu.test(n)&&!_u.test(n)?["du",n]:n&&n.endsWith("s")?["des",n]:["de",n]},Xu=(e,t)=>["je",e[t].normal.split(Er)[1]],Bn={preJ:Xu,preL:Qu,preD:Zu},Yu=/^([0-9.]{1,4}[a-z]{0,2}) ?[-–—] ?([0-9]{1,4}[a-z]{0,2})$/i,el=/^([0-9]{1,2}(:[0-9][0-9])?(am|pm)?) ?[-–—] ?([0-9]{1,2}(:[0-9][0-9])?(am|pm)?)$/i,tl=/^[0-9]{3}-[0-9]{4}$/,nl=function(e,t){const n=e[t];let r=n.text.match(Yu);return r!==null?n.tags.has("PhoneNumber")===!0||tl.test(n.text)?null:[r[1],"to",r[2]]:(r=n.text.match(el),r!==null?[r[1],"to",r[4]]:null)},rl=/^([+-]?[0-9][.,0-9]*)([a-z°²³µ/]+)$/,ol=function(e,t,n){const r=n.model.one.numberSuffixes||{},o=e[t].text.match(rl);if(o!==null){const a=o[2].toLowerCase().trim();return r.hasOwnProperty(a)?null:[o[1],a]}return null},to=/'/,al=/^[0-9][^-–—]*[-–—].*?[0-9]/,no=function(e,t,n,r){const o=t.update();o.document=[e];let a=n+r;n>0&&(n-=1),e[a]&&(a+=1),o.ptrs=[[0,n,a]]},ro={t:(e,t)=>Ru(e,t),d:(e,t)=>qu(e,t)},oo={j:(e,t)=>Bn.preJ(e,t),l:(e,t)=>Bn.preL(e,t),d:(e,t)=>Bn.preD(e,t)},il=function(e,t,n,r){for(let o=0;o<e.length;o+=1){const a=e[o];if(a.word===t.normal)return a.out;if(r!==null&&r===a.after)return[n].concat(a.out);if(n!==null&&n===a.before&&r&&r.length>2)return a.out.concat(r)}return null},Sn=function(e,t){const n=t.fromText(e.join(" "));return n.compute(["id","alias"]),n.docs[0]},sl=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"]},ul=e=>{const{world:t,document:n}=e,{model:r,methods:o}=t,a=r.one.contractions||[];n.forEach((i,s)=>{for(let u=i.length-1;u>=0;u-=1){let l=null,c=null;if(to.test(i[u].normal)===!0){const g=i[u].normal.split(to);l=g[0],c=g[1]}let d=il(a,i[u],l,c);if(!d&&ro.hasOwnProperty(c)&&(d=ro[c](i,u,t)),!d&&oo.hasOwnProperty(l)&&(d=oo[l](i,u)),l==="there"&&c==="s"&&(d=sl(i,u)),d){d=Sn(d,e),zn(n,[s,u],d),no(n[s],e,u,d.length);continue}if(al.test(i[u].normal)){d=nl(i,u),d&&(d=Sn(d,e),zn(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"),no(n[s],e,u,d.length));continue}d=ol(i,u,t),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag([d[1]],"Unit",t,null,"contraction-unit"))}})},ll={contractions:ul},cl={model:Mu,compute:ll,hooks:["contractions"]},ao=function(e){const t=e.world,{model:n,methods:r}=e.world,o=r.one.setTag,{frozenLex:a}=n.one,i=n.one._multiCache||{};e.docs.forEach(s=>{for(let u=0;u<s.length;u+=1){const l=s[u],c=l.machine||l.normal;if(i[c]!==void 0&&s[u+1]){const d=u+i[c]-1;for(let g=d;g>u;g-=1){const x=s.slice(u,g+1),G=x.map(U=>U.machine||U.normal).join(" ");if(a.hasOwnProperty(G)===!0){o(x,a[G],t,!1,"1-frozen-multi-lexicon"),x.forEach(U=>U.frozen=!0);continue}}}if(a[c]!==void 0&&a.hasOwnProperty(c)){o([l],a[c],t,!1,"1-freeze-lexicon"),l.frozen=!0;continue}}})},hl=function(e){return e.docs.forEach(t=>{t.forEach(n=>{delete n.frozen})}),e},dl={frozen:ao,freeze:ao,unfreeze:hl},io=e=>"\x1B[34m"+e+"\x1B[0m",so=e=>"\x1B[3m\x1B[2m"+e+"\x1B[0m",uo=function(e){e.docs.forEach(t=>{console.log(io(`
|
|
2
2
|
┌─────────`)),t.forEach(n=>{let r=` ${so("│")} `;const o=n.implicit||n.text||"-";n.frozen===!0?r+=`${io(o)} ❄️`:r+=so(o),console.log(r)})})},pl={compute:dl,mutate:e=>{const t=e.methods.one;t.termMethods.isFrozen=n=>n.frozen===!0,t.debug.freeze=uo,t.debug.frozen=uo},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"]},gl=function(e,t,n){const{model:r,methods:o}=n,a=o.one.setTag,i=r.one._multiCache||{},{lexicon:s}=r.one||{},u=e[t],l=u.machine||u.normal;if(i[l]!==void 0&&e[t+1]){const c=t+i[l]-1;for(let d=c;d>t;d-=1){const g=e.slice(t,d+1);if(g.length<=1)return!1;const x=g.map(G=>G.machine||G.normal).join(" ");if(s.hasOwnProperty(x)===!0){const G=s[x];return a(g,G,n,!1,"1-multi-lexicon"),G&&G.length===2&&(G[0]==="PhrasalVerb"||G[1]==="PhrasalVerb")&&a([g[1]],"Particle",n,!1,"1-phrasal-particle"),!0}}return!1}return null},lo=/^(under|over|mis|re|un|dis|semi|pre|post)-?/,ml=new Set(["Verb","Infinitive","PastTense","Gerund","PresentTense","Adjective","Participle"]),fl=function(e,t,n){const{model:r,methods:o}=n,a=o.one.setTag,{lexicon:i}=r.one,s=e[t],u=s.machine||s.normal;if(i[u]!==void 0&&i.hasOwnProperty(u))return a([s],i[u],n,!1,"1-lexicon"),!0;if(s.alias){const l=s.alias.find(c=>i.hasOwnProperty(c));if(l)return a([s],i[l],n,!1,"1-lexicon-alias"),!0}if(lo.test(u)===!0){const l=u.replace(lo,"");if(i.hasOwnProperty(l)&&l.length>3&&ml.has(i[l]))return a([s],i[l],n,!1,"1-lexicon-prefix"),!0}return null},bl=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||gl(n,r,t),o=o||fl(n,r,t)}})},vl={lexicon:bl},yl=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 a=r.split(/ /);a.length>1&&(n[a[0]]===void 0||a.length>n[a[0]])&&(n[a[0]]=a.length),t[r]=t[r]||o}),delete t[""],delete t[null],delete t[" "],{lex:t,_multi:n}},wl={one:{expandLexicon:yl}},$l=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:a,_multi:i}=r.one.expandLexicon(e,n);Object.assign(o.one.lexicon,a),Object.assign(o.one._multiCache,i)},kl={addWords:$l},Pl={one:{lexicon:{},_multiCache:{},frozenLex:{}}},Al={model:Pl,methods:wl,compute:vl,lib:kl,hooks:["lexicon"]},xl=function(e,t){const{methods:n,model:r}=t;return n.one.tokenize.splitTerms(e,r).map(o=>n.one.tokenize.splitWhitespace(o,r)).map(o=>o.text.toLowerCase())},gi=function(e,t){const n=[{}],r=[null],o=[0],a=[];let i=0;e.forEach(function(s){let u=0;const l=xl(s,t);for(let c=0;c<l.length;c++){const d=l[c];n[u]&&n[u].hasOwnProperty(d)?u=n[u][d]:(i++,n[u][d]=i,n[i]={},u=i,r[i]=null)}r[u]=[l.length]});for(const s in n[0])i=n[0][s],o[i]=0,a.push(i);for(;a.length;){const s=a.shift(),u=Object.keys(n[s]);for(let l=0;l<u.length;l+=1){const c=u[l],d=n[s][c];for(a.push(d),i=o[s];i>0&&!n[i].hasOwnProperty(c);)i=o[i];if(n.hasOwnProperty(i)){const g=n[i][c];o[d]=g,r[g]&&(r[d]=r[d]||[],r[d]=r[d].concat(r[g]))}else o[d]=0}}return{goNext:n,endAs:r,failTo:o}},Cl=function(e,t,n){let r=0;const o=[];for(let a=0;a<e.length;a++){const i=e[a][n.form]||e[a].normal;for(;r>0&&(t.goNext[r]===void 0||!t.goNext[r].hasOwnProperty(i));)r=t.failTo[r]||0;if(t.goNext[r].hasOwnProperty(i)&&(r=t.goNext[r][i],t.endAs[r])){const s=t.endAs[r];for(let u=0;u<s.length;u++){const l=s[u],c=e[a-l+1],[d,g]=c.index;o.push([d,g,g+l,c.id])}}}return o},jl=function(e,t){for(let n=0;n<e.length;n+=1)if(t.has(e[n])===!0)return!1;return!0},Nl=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 a=Object.keys(t.goNext[0]);for(let i=0;i<o.length;i++){if(e._cache&&e._cache[i]&&jl(a,e._cache[i])===!0)continue;const s=o[i],u=Cl(s,t,n);u.length>0&&(r=r.concat(u))}return e.update(r)},Il=e=>Object.prototype.toString.call(e)==="[object Object]";function Tl(e){e.prototype.lookup=function(t,n={}){if(!t)return this.none();typeof t=="string"&&(t=[t]);const r=Il(t)?t:gi(t,this.world);let o=Nl(this,r,n);return o=o.settle(),o}}const Mn=(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},El=function(e){return e.goNext=e.goNext.map(t=>{if(Object.keys(t).length!==0)return t}),e.goNext=Mn(e.goNext,void 0),e.failTo=Mn(e.failTo,0),e.endAs=Mn(e.endAs,null),e},lr={buildTrie:function(e){const t=gi(e,this.world());return El(t)}};lr.compile=lr.buildTrie;const Dl={api:Tl,lib:lr},co=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},mi=function(e,t){let{ptrs:n}=e;const{byGroup:r}=e;return n=co(n,t),Object.keys(r).forEach(o=>{r[o]=co(r[o],t)}),{ptrs:n,byGroup:r}},qt=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},fi=e=>Object.prototype.toString.call(e)==="[object Object]",Rt=e=>e&&fi(e)&&e.isView===!0,Ut=e=>e&&fi(e)&&e.isNet===!0,Hl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e);if(Ut(e))return this.sweep(e,{tagger:!1}).view.settle();e=qt(e,n,this.world);const o={regs:e,group:t},a=r.match(this.docs,o,this._cache),{ptrs:i,byGroup:s}=mi(a,this.fullPointer),u=this.toView(i);return u._groups=s,u},Gl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e).eq(0);if(Ut(e))return this.sweep(e,{tagger:!1,matchOne:!0}).view;e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0},a=r.match(this.docs,o,this._cache),{ptrs:i,byGroup:s}=mi(a,this.fullPointer),u=this.toView(i);return u._groups=s,u},Ol=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e).fullPointer.length>0;if(Ut(e))return this.sweep(e,{tagger:!1}).view.found;e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0};return r.match(this.docs,o,this._cache).ptrs.length>0},Fl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.filter(u=>u.intersection(e).found);if(Ut(e)){const u=this.sweep(e,{tagger:!1}).view.settle();return this.if(u)}e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0};let a=this.fullPointer;const i=this._cache||[];a=a.filter((u,l)=>{const c=this.update([u]);return r.match(c.docs,o,i[l]).ptrs.length>0});const s=this.update(a);return this._cache&&(s._cache=a.map(u=>i[u[0]])),s},Vl=function(e,t,n){const{methods:r}=this,o=r.one;if(Rt(e))return this.filter(s=>!s.intersection(e).found);if(Ut(e)){const s=this.sweep(e,{tagger:!1}).view.settle();return this.ifNo(s)}e=qt(e,n,this.world);const a=this._cache||[],i=this.filter((s,u)=>{const l={regs:e,group:t,justOne:!0};return o.match(s.docs,l,a[u]).ptrs.length===0});return this._cache&&(i._cache=i.ptrs.map(s=>a[s[0]])),i},zl={matchOne:Gl,match:Hl,has:Ol,if:Fl,ifNo:Vl},Bl=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],a=r(this.fullPointer);Object.keys(a).forEach(s=>{const u=a[s].sort((l,c)=>l[1]>c[1]?1:-1)[0];u[1]>0&&o.push([u[0],0,u[1]])});const i=this.toView(o);return e?i.match(e,t,n):i},Sl=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],a=r(this.fullPointer),i=this.document;Object.keys(a).forEach(u=>{const l=a[u].sort((g,x)=>g[1]>x[1]?-1:1)[0],[c,,d]=l;d<i[c].length&&o.push([c,d,i[c].length])});const s=this.toView(o);return e?s.match(e,t,n):s},Ml=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,a)=>{const i=o.before(e,t);if(i.found){const s=i.terms();r[a][1]-=s.length,r[a][3]=s.docs[0][0].id}}),this.update(r)},Ll=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,a)=>{const i=o.after(e,t);if(i.found){const s=i.terms();r[a][2]+=s.length,r[a][4]=null}}),this.update(r)},Kl=function(e,t,n){return this.growRight(e,t,n).growLeft(e,t,n)},Jl={before:Bl,after:Sl,growLeft:Ml,growRight:Ll,grow:Kl},bi=function(e,t){return[e[0],e[1],t[2]]},Wl=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Dr=(e,t,n)=>typeof e=="string"||Wl(e)?t.match(e,n):e||t.none(),Hr=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},xt={};xt.splitOn=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);let a=[];return o.forEach(i=>{a.push(i.passthrough),a.push(i.before),a.push(i.match),a.push(i.after)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.splitBefore=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);for(let i=0;i<o.length;i+=1)!o[i].after&&o[i+1]&&o[i+1].before&&o[i].match&&o[i].match[0]===o[i+1].before[0]&&(o[i].after=o[i+1].before,delete o[i+1].before);let a=[];return o.forEach(i=>{a.push(i.passthrough),a.push(i.before),i.match&&i.after?a.push(bi(i.match,i.after)):a.push(i.match)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.splitAfter=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);let a=[];return o.forEach(i=>{a.push(i.passthrough),i.before&&i.match?a.push(bi(i.before,i.match)):(a.push(i.before),a.push(i.match)),a.push(i.after)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.split=xt.splitAfter;const ql=function(e,t){return!e||!t||e[0]!==t[0]?!1:e[2]===t[1]},ho=function(e,t,n){const r=e.world,o=r.methods.one.parseMatch;t=t||".$",n=n||"^.";const a=o(t,{},r),i=o(n,{},r);a[a.length-1].end=!0,i[0].start=!0;const s=e.fullPointer,u=[s[0]];for(let l=1;l<s.length;l+=1){const c=u[u.length-1],d=s[l],g=e.update([c]),x=e.update([d]);ql(c,d)&&g.has(a)&&x.has(i)?u[u.length-1]=[c[0],c[1],d[2],c[3],d[4]]:u.push(d)}return e.update(u)},Rl={joinIf:function(e,t){return ho(this,e,t)},join:function(){return ho(this)}},Ge=Object.assign({},zl,Jl,xt,Rl);Ge.lookBehind=Ge.before;Ge.lookBefore=Ge.before;Ge.lookAhead=Ge.after;Ge.lookAfter=Ge.after;Ge.notIf=Ge.ifNo;const Ul=function(e){Object.assign(e.prototype,Ge)},_l=/(?:^|\s)([![^]*(?:<[^<]*>)?\/.*?[^\\/]\/[?\]+*$~]*)(?:\s|$)/,Ql=/([!~[^]*(?:<[^<]*>)?\([^)]+[^\\)]\)[?\]+*$~]*)(?:\s|$)/,Zl=/ /g,Xl=e=>/^[![^]*(<[^<]*>)?\(/.test(e)&&/\)[?\]+*$~]*$/.test(e),po=e=>/^[![^]*(<[^<]*>)?\//.test(e)&&/\/[?\]+*$~]*$/.test(e),go=function(e){return e=e.map(t=>t.trim()),e=e.filter(t=>t),e},Yl=function(e){const t=e.split(_l);let n=[];t.forEach(o=>{if(po(o)){n.push(o);return}n=n.concat(o.split(Ql))}),n=go(n);let r=[];return n.forEach(o=>{Xl(o)||po(o)?r.push(o):r=r.concat(o.split(Zl))}),r=go(r),r},mo=/\{([0-9]+)?(, *[0-9]*)?\}/,fo=/&&/,ec=new RegExp(/^<\s*(\S+)\s*>/),bo=e=>e.charAt(0).toUpperCase()+e.substring(1),$e=e=>e.charAt(e.length-1),me=e=>e.charAt(0),wt=e=>e.substring(1),$t=e=>e.substring(0,e.length-1),Dt=function(e){return e=wt(e),e=$t(e),e},vi=function(e,t){const n={};for(let r=0;r<2;r+=1){if($e(e)==="$"&&(n.end=!0,e=$t(e)),me(e)==="^"&&(n.start=!0,e=wt(e)),$e(e)==="?"&&(n.optional=!0,e=$t(e)),(me(e)==="["||$e(e)==="]")&&(n.group=null,me(e)==="["&&(n.groupStart=!0),$e(e)==="]"&&(n.groupEnd=!0),e=e.replace(/^\[/,""),e=e.replace(/\]$/,""),me(e)==="<")){const o=ec.exec(e);o.length>=2&&(n.group=o[1],e=e.replace(o[0],""))}if($e(e)==="+"&&(n.greedy=!0,e=$t(e)),e!=="*"&&$e(e)==="*"&&e!=="\\*"&&(n.greedy=!0,e=$t(e)),me(e)==="!"&&(n.negative=!0,e=wt(e)),me(e)==="~"&&$e(e)==="~"&&e.length>2&&(e=Dt(e),n.fuzzy=!0,n.min=t.fuzzy||.85,/\(/.test(e)===!1))return n.word=e,n;if(me(e)==="/"&&$e(e)==="/")return e=Dt(e),t.caseSensitive&&(n.use="text"),n.regex=new RegExp(e),n;if(mo.test(e)===!0&&(e=e.replace(mo,(o,a,i)=>(i===void 0?(n.min=Number(a),n.max=Number(a)):(i=i.replace(/, */,""),a===void 0?(n.min=0,n.max=Number(i)):(n.min=Number(a),n.max=Number(i||999))),n.greedy=!0,n.min||(n.optional=!0),""))),me(e)==="("&&$e(e)===")"){fo.test(e)?(n.choices=e.split(fo),n.operator="and"):(n.choices=e.split("|"),n.operator="or"),n.choices[0]=wt(n.choices[0]);const o=n.choices.length-1;n.choices[o]=$t(n.choices[o]),n.choices=n.choices.map(a=>a.trim()),n.choices=n.choices.filter(a=>a),n.choices=n.choices.map(a=>a.split(/ /g).map(i=>vi(i,t))),e=""}if(me(e)==="{"&&$e(e)==="}"){if(e=Dt(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(me(e)==="<"&&$e(e)===">")return e=Dt(e),n.chunk=bo(e),n.greedy=!0,n;if(me(e)==="%"&&$e(e)==="%")return e=Dt(e),n.switch=e,n}return me(e)==="#"?(n.tag=wt(e),n.tag=bo(n.tag),n):me(e)==="@"?(n.method=wt(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)},tc=/[a-z0-9][-–—][a-z]/i,nc=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&&tc.test(o.word)){let a=o.word.split(/[-–—]/g);if(n.hasOwnProperty(a[0]))continue;a=a.filter(i=>i).reverse(),e.splice(r,1),a.forEach(i=>{const s=Object.assign({},o);s.word=i,e.splice(r,0,s)})}}return e},vo=function(e,t){const{all:n}=t.methods.two.transform.verb||{},r=e.root;return n?n(r,t.model):[]},yo=function(e,t){const{all:n}=t.methods.two.transform.noun||{};return n?n(e.root,t.model):[e.root]},wo=function(e,t){const{all:n}=t.methods.two.transform.adjective||{};return n?n(e.root,t.model):[e.root]},rc=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(vo(n,t)):n.pos==="Noun"?r=r.concat(yo(n,t)):n.pos==="Adjective"&&(r=r.concat(wo(n,t))):(r=r.concat(vo(n,t)),r=r.concat(yo(n,t)),r=r.concat(wo(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},oc=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},ac=function(e){return e.map(t=>{if(t.choices!==void 0){if(t.operator!=="or"||t.fuzzy===!0)return t;t.choices.every(n=>{if(n.length!==1)return!1;const r=n[0];return r.fuzzy===!0||r.start||r.end?!1:r.word!==void 0&&r.negative!==!0&&r.optional!==!0&&r.method!==!0})===!0&&(t.fastOr=new Set,t.choices.forEach(n=>{t.fastOr.add(n[0].word)}),delete t.choices)}return t})},ic=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))},sc=function(e){return e=oc(e),e=ac(e),e=ic(e),e},uc=function(e,t,n){if(e==null||e==="")return[];t=t||{},typeof e=="number"&&(e=String(e));let r=Yl(e);return r=r.map(o=>vi(o,t)),r=nc(r,n),r=rc(r,n),r=sc(r),r},lc=function(e,t){for(const n of t)if(e.has(n))return!0;return!1},cc=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&&lc(r.fastOr,t)===!1)return!1}}return!1},hc=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 a=[];for(let g=0;g<o;g++)a[g]=[g],a[g].length=o;for(let g=0;g<o;g++)a[0][g]=g;let i,s,u,l,c,d;for(let g=1;g<=n;++g)for(s=e[g-1],i=1;i<=r;++i){if(g===i&&a[g][i]>4)return n;u=t[i-1],l=s===u?0:1,c=a[g-1][i]+1,(d=a[g][i-1]+1)<c&&(c=d),(d=a[g-1][i-1]+l)<c&&(c=d),g>1&&i>1&&s===t[i-2]&&e[g-2]===u&&(d=a[g-2][i-2]+l)<c?a[g][i]=d:a[g][i]=c}return a[n][r]},dc=function(e,t,n=3){if(e===t)return 1;if(e.length<n||t.length<n)return 0;const r=hc(e,t),o=Math.max(e.length,t.length);return 1-(o===0?0:r/o)},pc=/([\u0022\uFF02\u0027\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F])/,gc=/([\u0022\uFF02\u0027\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4])/,$o=/^[-–—]$/,ko=/ [-–—]{1,3} /,Oe=(e,t)=>e.post.indexOf(t)!==-1,Lt={hasQuote:e=>pc.test(e.pre)||gc.test(e.post),hasComma:e=>Oe(e,","),hasPeriod:e=>Oe(e,".")===!0&&Oe(e,"...")===!1,hasExclamation:e=>Oe(e,"!"),hasQuestionMark:e=>Oe(e,"?")||Oe(e,"¿"),hasEllipses:e=>Oe(e,"..")||Oe(e,"…"),hasSemicolon:e=>Oe(e,";"),hasColon:e=>Oe(e,":"),hasSlash:e=>/\//.test(e.text),hasHyphen:e=>$o.test(e.post)||$o.test(e.pre),hasDash:e=>ko.test(e.post)||ko.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)};Lt.hasQuotation=Lt.hasQuote;let Cn=function(){};const mc=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||dc(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 Lt[t.method]=="function"&&Lt[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=>Cn(e,o,n,r)):t.choices.some(o=>Cn(e,o,n,r)):!1};Cn=function(e,t,n,r){const o=mc(e,t,n,r);return t.negative===!0?!o:o};const pe=Cn,fc=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&&pe(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(pe(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},bc=function(e,t){let n=e.t;if(!t)return e.terms.length;for(;n<e.terms.length;n+=1)if(pe(e.terms[n],t,e.start_i+n,e.phrase_length)===!0)return n;return null},vc=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(pe(t.terms[t.t],n,t.start_i+t.t,t.phrase_length)===!0)return!0}return!1},Dn=function(e,t){return e.groups[e.inGroup]||(e.groups[e.inGroup]={start:t,length:0}),e.groups[e.inGroup]},yc=function(e){const{regs:t}=e,n=t[e.r],r=bc(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=Dn(e,e.t);o.length=r-e.t}return e.t=r,!0},wc=function(e){return Object.prototype.toString.call(e)==="[object Array]"},yi=function(e,t=0){const n=e.regs[e.r];let r=!1;for(let o=0;o<n.choices.length;o+=1){const a=n.choices[o];if(!wc(a))return!1;if(r=a.every((i,s)=>{let u=0;const l=e.t+s+t+u;if(e.terms[l]===void 0)return!1;const c=pe(e.terms[l],i,l+e.start_i,e.phrase_length);if(c===!0&&i.greedy===!0)for(let d=1;d<e.terms.length;d+=1){const g=e.terms[l+d];if(g)if(pe(g,i,e.start_i+d,e.phrase_length)===!0)u+=1;else break}return t+=u,c}),r){t+=a.length;break}}return r&&n.greedy===!0?yi(e,t):t},$c=function(e){let t=0;return e.regs[e.r].choices.every(n=>{const r=n.every((o,a)=>{const i=e.t+a;return e.terms[i]===void 0?!1:pe(e.terms[i],o,i,e.phrase_length)});return r===!0&&n.length>t&&(t=n.length),r})===!0?t:!1},kc=function(e){const{regs:t}=e,n=t[e.r],r=yi(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Dn(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},Pc=function(e){const{regs:t}=e,n=t[e.r],r=$c(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Dn(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},Ac=function(e,t,n){let r=0;for(let o=e.t;o<e.terms.length;o+=1){let a=pe(e.terms[o],t,e.start_i+e.t,e.phrase_length);if(a||n&&(a=pe(e.terms[o],n,e.start_i+e.t,e.phrase_length),a)||(r+=1,t.max!==void 0&&r===t.max))break}return r===0||t.min&&t.min>r?!1:(e.t+=r,!0)},xc=function(e){const{regs:t}=e,n=t[e.r],r=Object.assign({},n);if(r.negative=!1,pe(e.terms[e.t],r,e.start_i+e.t,e.phrase_length))return!1;if(n.optional){const o=t[e.r+1];o&&(pe(e.terms[e.t],o,e.start_i+e.t,e.phrase_length)?e.r+=1:o.optional&&t[e.r+2]&&pe(e.terms[e.t],t[e.r+2],e.start_i+e.t,e.phrase_length)&&(e.r+=2))}return n.greedy?Ac(e,r,t[e.r+1]):(e.t+=1,!0)},Cc=function(e){const{regs:t}=e,n=t[e.r],r=e.terms[e.t],o=pe(r,t[e.r+1],e.start_i+e.t,e.phrase_length);if(n.negative||o){const a=e.terms[e.t+1];(!a||!pe(a,t[e.r+1],e.start_i+e.t,e.phrase_length))&&(e.r+=1)}},jc=function(e){const{regs:t,phrase_length:n}=e,r=t[e.r];return e.t=fc(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},Nc=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)}},Ic=function(e,t){const n=e.regs[e.r],r=Dn(e,t);e.t>1&&n.greedy?r.length+=e.t-t:r.length++},Ln=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]&&Cc(e),r.implicit&&e.terms[e.t+1]&&Nc(e),e.t+=1,n.end===!0&&e.t!==e.terms.length&&n.greedy!==!0||n.greedy===!0&&!jc(e)?null:(e.hasGroup===!0&&Ic(e,o),!0))},Gr=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(u=>!u.optional)===!1)break;return null}if(s.anything===!0&&s.greedy===!0){if(!yc(o))return null;continue}if(s.choices!==void 0&&s.operator==="or"){if(!kc(o))return null;continue}if(s.choices!==void 0&&s.operator==="and"){if(!Pc(o))return null;continue}if(s.anything===!0){if(s.negative&&s.anything||!Ln(o))return null;continue}if(vc(s,o)===!0){if(!Ln(o))return null;continue}if(s.negative){if(!xc(o))return null;continue}if(pe(o.terms[o.t],s,o.start_i+o.t,o.phrase_length)===!0){if(!Ln(o))return null;continue}if(s.optional!==!0)return null}const a=[null,n,o.t+n];if(a[1]===a[2])return null;const i={};return Object.keys(o.groups).forEach(s=>{const u=o.groups[s],l=n+u.start;i[s]=[null,l,l+u.length]}),{pointer:a,groups:i}},Tc=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(a=>{r[a]=r[a]||[],r[a].push(o.groups[a])})}),{ptrs:n,byGroup:r})},Ec=function(e,t,n){return e=e.filter(r=>{const[o,a,i]=r.pointer,s=n[o].slice(a,i);for(let u=0;u<s.length;u+=1){const l=s.slice(u);if(Gr(l,t,u,s.length)!==null)return!1}return!0}),e},wi=function(e,t){return e.pointer[0]=t,Object.keys(e.groups).forEach(n=>{e.groups[n][0]=t}),e},Dc=function(e,t,n){let r=Gr(e,t,0,e.length);return r?(r=wi(r,n),r):null},Hc=function(e,t,n){n=n||[];const{regs:r,group:o,justOne:a}=t;let i=[];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 l=e[u];if(!(n[u]&&cc(r,n[u]))){if(r[0].start===!0){const c=Dc(l,r,u);c&&i.push(c);continue}for(let c=0;c<l.length;c+=1){const d=l.slice(c);if(d.length<s)break;let g=Gr(d,r,c,l.length);if(g){if(g=wi(g,u),i.push(g),a===!0)break e;const x=g.pointer[2];Math.abs(x-1)>c&&(c=Math.abs(x-1))}}}}return r[r.length-1].end===!0&&(i=i.filter(u=>{const l=u.pointer[0];return e[l].length===u.pointer[2]})),t.notIf&&(i=Ec(i,t.notIf,e)),i=Tc(i,o),i.ptrs.forEach(u=>{const[l,c,d]=u;u[3]=e[l][c].id,u[4]=e[l][d-1].id}),i},Gc={one:{termMethods:Lt,parseMatch:uc,match:Hc}},Oc={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)}},Fc={api:Ul,methods:Gc,lib:Oc},Vc=/^\../,zc=/^#./,Bc=e=>(e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,"""),e=e.replace(/'/g,"'"),e),Sc=function(e){let t="",n="</span>";return e=Bc(e),Vc.test(e)?t=`<span class="${e.replace(/^\./,"")}"`:zc.test(e)?t=`<span id="${e.replace(/^#/,"")}"`:(t=`<${e}`,n=`</${e}>`),t+=">",{start:t,end:n}},Mc=function(e,t){const n={},r={};return Object.keys(t).forEach(o=>{let a=t[o];const i=Sc(o);typeof a=="string"&&(a=e.match(a)),a.docs.forEach(s=>{if(s.every(c=>c.implicit))return;const u=s[0].id;n[u]=n[u]||[],n[u].push(i.start);const l=s[s.length-1].id;r[l]=r[l]||[],r[l].push(i.end)})}),{starts:n,ends:r}},Lc=function(e){const{starts:t,ends:n}=Mc(this,e);let r="";return this.docs.forEach(o=>{for(let a=0;a<o.length;a+=1){const i=o[a];t.hasOwnProperty(i.id)&&(r+=t[i.id].join("")),r+=i.pre||"",r+=i.text||"",n.hasOwnProperty(i.id)&&(r+=n[i.id].join("")),r+=i.post||""}}),r},Kc={html:Lc},$i=/[,:;)\]*.?~!\u0022\uFF02\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4—-]+$/,cr=/^[(['"*~\uFF02\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F]+/,Jc=/[,:;)('"\u201D\]]/,Wc=/^[-–—]$/,qc=/ /,it=function(e,t,n=!0){let r="";return e.forEach(o=>{let a=o.pre||"",i=o.post||"";t.punctuation==="some"&&(a=a.replace(cr,""),Wc.test(i)&&(i=" "),i=i.replace(Jc,""),i=i.replace(/\?!+/,"?"),i=i.replace(/!+/,"!"),i=i.replace(/\?+/,"?"),i=i.replace(/\.{2,}/,""),o.tags.has("Abbreviation")&&(i=i.replace(/\./,""))),t.whitespace==="some"&&(a=a.replace(/\s/,""),i=i.replace(/\s+/," ")),t.keepPunct||(a=a.replace(cr,""),i==="-"?i=" ":i=i.replace($i,""));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&&(!i||!qc.test(i))&&(i+=" "),r+=a+s+i}),n===!1&&(r=r.trim()),t.lowerCase===!0&&(r=r.toLowerCase()),r},Rc=function(e,t){let n="";if(!e||!e[0]||!e[0][0])return n;for(let r=0;r<e.length;r+=1)n+=it(e[r],t,!0);if(t.keepSpace||(n=n.trim()),t.keepEndPunct===!1){e[0][0].tags.has("Emoticon")||(n=n.replace(cr,""));const r=e[e.length-1];r[r.length-1].tags.has("Emoticon")||(n=n.replace($i,"")),n.endsWith("'")&&!n.endsWith("s'")&&(n=n.replace(/'/,""))}return t.cleanWhitespace===!0&&(n=n.trim()),n},tt={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"}};tt.clean=tt.normal;tt.reduced=tt.root;const ki=[];let st=0;for(;st<64;)ki[st]=0|Math.sin(++st%Math.PI)*4294967296;const Or=function(e){let t,n,r,o=decodeURI(encodeURI(e))+"",a=o.length;const i=[t=1732584193,n=4023233417,~t,~n],s=[];for(e=--a/4+2|15,s[--e]=a*8;~a;)s[a>>2]|=o.charCodeAt(a)<<8*a--;for(st=o=0;st<e;st+=16){for(a=i;o<64;a=[r=a[3],t+((r=a[0]+[t&n|~t&r,r&t|~r&n,t^n^r,n^(t|~r)][a=o>>4]+ki[o]+~~s[st|[o,5*o+1,3*o+5,7*o][a]&15])<<(a=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*a+o++%4])|r>>>-a),t,n])t=a[1]|0,n=a[2];for(o=4;o;)i[--o]+=a[o]}for(e="";o<32;)e+=(i[o>>3]>>(1^o++)*4&15).toString(16);return e},Uc={text:!0,terms:!0},Po={case:"none",unicode:"some",form:"machine",punctuation:"some"},Kn=function(e,t){return Object.assign({},e,t)},_e={text:e=>it(e,{keepPunct:!0},!1),normal:e=>it(e,Kn(tt.normal,{keepPunct:!0}),!1),implicit:e=>it(e,Kn(tt.implicit,{keepPunct:!0}),!1),machine:e=>it(e,Po,!1),root:e=>it(e,Kn(Po,{form:"root"}),!1),hash:e=>Or(it(e,{keepPunct:!0},!1)),offset:e=>{const t=_e.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)};_e.sentences=_e.sentence;_e.clean=_e.normal;_e.reduced=_e.root;const _c=function(e,t){return t=t||{},typeof t=="string"&&(t={}),t=Object.assign({},Uc,t),t.offset&&e.compute("offset"),e.docs.map((n,r)=>{const o={};return Object.keys(t).forEach(a=>{t[a]&&_e[a]&&(o[a]=_e[a](n,e,r))}),o})},hr={json:function(e){const t=_c(this,e);return typeof e=="number"?t[e]:t}};hr.data=hr.json;const Qc=()=>typeof window<"u"&&window.document,Zc=function(e){const t=this.methods.one.debug||{};return e&&t.hasOwnProperty(e)?(t[e](this),this):Qc()?(t.clientSide(this),this):(t.tags(this),this)},Xc=function(e){const t=e.pre||"",n=e.post||"";return t+e.text+n},Yc=function(e,t){const n={};return Object.keys(t).forEach(r=>{e.match(r).fullPointer.forEach(o=>{n[o[3]]={fn:t[r],end:o[2]}})}),n},Pi=function(e,t){const n=Yc(e,t);let r="";return e.docs.forEach((o,a)=>{for(let i=0;i<o.length;i+=1){const s=o[i];if(n.hasOwnProperty(s.id)){const{fn:u,end:l}=n[s.id],c=e.update([[a,i,l]]);r+=o[i].pre||"",r+=u(c),i=l-1,r+=o[i].post||""}else r+=Xc(s)}}),r},eh=e=>Object.prototype.toString.call(e)==="[object Object]",th=function(e){const t={};return e.forEach(n=>{t[n]=t[n]||0,t[n]+=1}),Object.keys(t).map(n=>({normal:n,count:t[n]})).sort((n,r)=>n.count>r.count?-1:0)},nh=function(e){if(eh(e))return Pi(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 Or(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(t=>t.reduce((n,r)=>n+r.pre+r.text+r.post,"").trim()).filter(t=>t);if(e==="freq"||e==="frequency"||e==="topk")return th(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()},rh={debug:Zc,out:nh,wrap:function(e){return Pi(this,e)}},oh=e=>Object.prototype.toString.call(e)==="[object Object]",ah={text:function(e){let t={};if(e&&typeof e=="string"&&tt.hasOwnProperty(e)?t=Object.assign({},tt[e]):e&&oh(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),Rc(this.docs,t)}},ih=Object.assign({},rh,ah,hr,Kc),sh=function(e){Object.assign(e.prototype,ih)},uh=function(e){console.log("%c -=-=- ","background-color:#6699cc;"),e.forEach(t=>{console.groupCollapsed(t.text());const n=t.docs[0].map(r=>{let o=r.text||"-";r.implicit&&(o="["+r.implicit+"]");const a="["+Array.from(r.tags).join(", ")+"]";return{text:o,tags:a}});console.table(n,["text","tags"]),console.groupEnd()})},Be="\x1B[0m",ve={green:e=>"\x1B[32m"+e+Be,red:e=>"\x1B[31m"+e+Be,blue:e=>"\x1B[34m"+e+Be,magenta:e=>"\x1B[35m"+e+Be,cyan:e=>"\x1B[36m"+e+Be,yellow:e=>"\x1B[33m"+e+Be,black:e=>"\x1B[30m"+e+Be,dim:e=>"\x1B[2m"+e+Be,i:e=>"\x1B[3m"+e+Be},lh=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 ve[r](n)})),e.join(", ")},ch=function(e){const{docs:t,model:n}=e;t.length===0&&console.log(ve.blue(`
|
|
3
3
|
──────`)),t.forEach(r=>{console.log(ve.blue(`
|
|
4
4
|
┌─────────`)),r.forEach(o=>{const a=[...o.tags||[]];let i=o.text||"-";o.sense&&(i=`{${o.normal}/${o.sense}}`),o.implicit&&(i="["+o.implicit+"]"),i=ve.yellow(i);let s="'"+i+"'";if(o.reference){const l=e.update([o.reference]).text("normal");s+=` - ${ve.dim(ve.i("["+l+"]"))}`}s=s.padEnd(18);const u=ve.blue(" │ ")+ve.i(s)+" - "+lh(a,n);console.log(u)})}),console.log(`
|