@stacksjs/dtsx 0.9.17 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/bin/cli.js +5 -5
  2. package/dist/chunk-1s045wj0.js +2 -0
  3. package/dist/{chunk-6sx8ppfg.js → chunk-1zqrzfqx.js} +1 -1
  4. package/dist/{chunk-scrtz9j4.js → chunk-4hpfq116.js} +1 -1
  5. package/dist/chunk-4jw8qvts.js +16 -0
  6. package/dist/{chunk-x3q42h61.js → chunk-5qqybwef.js} +1 -1
  7. package/dist/{chunk-3zjt21t1.js → chunk-72tqwhpx.js} +1 -1
  8. package/dist/{chunk-vpjw38x7.js → chunk-7pwy4m0c.js} +1 -1
  9. package/dist/chunk-aafhn8pf.js +2 -0
  10. package/dist/{chunk-pep9jyxn.js → chunk-acf8x00j.js} +1 -1
  11. package/dist/{chunk-y581wnfe.js → chunk-asnnmvct.js} +1 -1
  12. package/dist/{chunk-jvfvxm5w.js → chunk-bb28rgpz.js} +1 -1
  13. package/dist/chunk-e13937tc.js +2 -0
  14. package/dist/{chunk-a6tznyxq.js → chunk-f7fatmz3.js} +1 -1
  15. package/dist/{chunk-xmje6xfw.js → chunk-fmhrt2ca.js} +1 -1
  16. package/dist/{chunk-f4c389mj.js → chunk-fxh731yj.js} +1 -1
  17. package/dist/{chunk-4s9jv983.js → chunk-gc9n9za8.js} +1 -1
  18. package/dist/chunk-j0rnj1z0.js +25 -0
  19. package/dist/{chunk-bsxtpwx6.js → chunk-m5508xqy.js} +1 -1
  20. package/dist/{chunk-3rpqh1bm.js → chunk-rv908n0q.js} +1 -1
  21. package/dist/{chunk-yth8251f.js → chunk-s8yqbjn4.js} +1 -1
  22. package/dist/{chunk-8hxrwrsf.js → chunk-w08v45h7.js} +1 -1
  23. package/dist/{chunk-8z31rkfp.js → chunk-wcdd51hr.js} +1 -1
  24. package/dist/chunk-y515fe4f.js +2 -0
  25. package/dist/{chunk-83e9a4fq.js → chunk-zfrp784r.js} +1 -1
  26. package/dist/{chunk-mzq58nw0.js → chunk-zn70hw8f.js} +1 -1
  27. package/dist/{chunk-xhs0tsnn.js → chunk-zs5mk604.js} +1 -1
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/plugins/bun.js +1 -1
  30. package/dist/src/plugins/esbuild.js +1 -1
  31. package/dist/src/plugins/index.js +1 -1
  32. package/dist/src/plugins/tsup.js +1 -1
  33. package/dist/src/plugins/vite.js +1 -1
  34. package/dist/src/plugins/webpack.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-285mqzvx.js +0 -16
  37. package/dist/chunk-2r21f44d.js +0 -25
  38. package/dist/chunk-8cv1t8qg.js +0 -2
  39. package/dist/chunk-bh9ey0vw.js +0 -2
  40. package/dist/chunk-sdjfh4mj.js +0 -2
  41. package/dist/chunk-w8d9jjsa.js +0 -2
package/dist/bin/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import{dd as Y}from"../chunk-mcdb3q06.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-8cv1t8qg.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
- `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-3xqchdwd.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-bh9ey0vw.js"),{processDeclarations:F}=await import("../chunk-xmje6xfw.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-8cv1t8qg.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
2
+ import{dd as Y}from"../chunk-mcdb3q06.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-e13937tc.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
+ `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-3xqchdwd.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-aafhn8pf.js"),{processDeclarations:F}=await import("../chunk-fmhrt2ca.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-e13937tc.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
4
4
  `;if(A)await J.write(B,j);else K(B,j)}else V.stdout.write(q(z,$)),V.stdout.write(`
5
- `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-trm0gptj.js"),{version:e}=await import("../chunk-yth8251f.js"),{getConfig:o}=await import("../chunk-w71syh0b.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-sdjfh4mj.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-w8d9jjsa.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
- Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-bsxtpwx6.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-3rpqh1bm.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-pep9jyxn.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-sw3m29sw.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
5
+ `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-trm0gptj.js"),{version:e}=await import("../chunk-s8yqbjn4.js"),{getConfig:o}=await import("../chunk-w71syh0b.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-y515fe4f.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-1s045wj0.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
+ Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-m5508xqy.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-rv908n0q.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-acf8x00j.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-sw3m29sw.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
7
7
  \u2717 ${I}`);for(let _ of R.issues)if(console.log(` ${_.line}:${_.column} - ${_.message}`),_.missingAnnotation)console.log(` Missing: ${_.missingAnnotation} type annotation`)}else if(q.format==="json")M.push({file:I,compatible:!0,issues:[]})}if(q.format==="json")console.log(JSON.stringify(M,null,2));else if(E>0)console.log(`
8
8
  ${G.length} files checked, ${E} recommendations found`),console.log("Tip: Adding explicit type annotations improves .d.ts accuracy");else console.log(`
9
- ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-xtee8g1a.js"),{extractDeclarations:K}=await import("../chunk-3zjt21t1.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
9
+ ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-xtee8g1a.js"),{extractDeclarations:K}=await import("../chunk-72tqwhpx.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
10
10
  Converted ${X} declarations from ${F} files`)}catch(Q){console.error("Error converting files:",Q),V.exit(1)}});k.command("circular","Detect circular dependencies in TypeScript files").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--root <path>","Root directory for resolution",{default:"."}).option("--ignore <patterns>","Glob patterns to ignore (comma-separated)",{default:"",type:[String]}).option("--types-only","Only report type-level cycles",{default:!1}).option("--max-depth <number>","Maximum depth for cycle detection",{default:100}).option("--include-node-modules","Include node_modules in analysis",{default:!1}).option("--format <format>","Output format: text, json, dot",{default:"text"}).option("--summary","Show graph summary statistics",{default:!1}).example("dtsx circular").example('dtsx circular --files "src/**/*.ts"').example('dtsx circular --ignore "**/*.test.ts,**/__tests__/**"').example("dtsx circular --format dot > deps.dot").example("dtsx circular --summary").action(async(q)=>{try{let{analyzeCircularDependencies:Q,formatCircularAnalysis:K,getGraphSummary:N,exportGraphAsDot:A,exportGraphAsJson:J}=await import("../chunk-tne5n3h1.js"),{Glob:$}=awaitPromise.resolve(globalThis.Bun),{resolve:z,relative:B}=await import("path"),G=V.cwd(),j=z(q.root||"."),Z=q.files||["**/*.ts"],E=[];for(let T of Z){let R=new $(T);for await(let I of R.scan({cwd:j,absolute:!0,onlyFiles:!0}))if(!I.endsWith(".d.ts")){if(!q.includeNodeModules&&I.includes("node_modules"))continue;E.push(I)}}if(E.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Analyzing ${E.length} files for circular dependencies...`);let M=await Q(E,{rootDir:j,ignore:q.ignore?.filter(Boolean),typesOnly:q.typesOnly??!1,maxDepth:q.maxDepth??100,includeNodeModules:q.includeNodeModules??!1});if(q.format==="json")console.log(J(M.graph,j));else if(q.format==="dot")console.log(A(M.graph,j));else if(console.log(K(M,j)),q.summary){let T=N(M.graph);if(console.log(`
11
11
  --- Dependency Graph Summary ---`),console.log(`Total files: ${T.totalFiles}`),console.log(`Total dependencies: ${T.totalDependencies}`),console.log(`Average dependencies per file: ${T.avgDependencies.toFixed(2)}`),T.maxDependencies.count>0)console.log(`Most dependencies: ${B(j,T.maxDependencies.file)} (${T.maxDependencies.count})`);if(T.mostDepended.count>0)console.log(`Most depended on: ${B(j,T.mostDepended.file)} (${T.mostDepended.count} dependents)`);if(T.isolatedFiles.length>0)console.log(`Isolated files (no dependencies): ${T.isolatedFiles.length}`)}V.exit(M.hasCircular?1:0)}catch(Q){console.error("Error analyzing dependencies:",Q),V.exit(1)}});k.command("version","Show the version of dtsx").action(()=>{console.log(e)});k.version(e);k.help();k.parse();
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{a,b,c}from"./chunk-zfrp784r.js";import"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as z}from"./chunk-x3q42h61.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
2
+ import{tb as z}from"./chunk-5qqybwef.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
3
3
  export{C as fa,M as ga,P as ha};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as K}from"./chunk-x3q42h61.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
2
+ import{tb as K}from"./chunk-5qqybwef.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
3
3
  export{L as ca,Y as da,_ as ea};
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ var E=!1,M=null;function h(J){if(J.indexOf("/*")===-1)return J.trim();let X=[],Q=0,z=0,B=J.length;while(z<B)if(J.charCodeAt(z)===47&&z+1<B&&J.charCodeAt(z+1)===42){if(z>Q)X.push(J.substring(Q,z));z+=2;while(z<B-1){if(J.charCodeAt(z)===42&&J.charCodeAt(z+1)===47){z+=2;break}z++}Q=z}else z++;if(Q<B)X.push(J.substring(Q));return X.join("").trim()}function $z(){E=!0,M=null}function Qz(){E=!1;let J=M;return M=null,J}function S(J){let Y=J.length;if(Y===0)return!1;let X=0;if(J.charCodeAt(X)===45)X++;if(X>=Y)return!1;let Q=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===Q)return!1;if(X<Y&&J.charCodeAt(X)===46){X++;let z=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===z)return!1}return X===Y}function o(J){for(let Y=0,X=J.length-1;Y<X;Y++){let Q=J.charCodeAt(Y);if(Q<48||Q>57)return!1}return!0}function D(J,Y){let X=0,Q=0;while((Q=J.indexOf(Y,Q))!==-1)X++,Q+=Y.length;return X}function _(J){let Y=J.length,X=!1;for(let Z=1;Z<Y;Z++)if(J.charCodeAt(Z)<=32&&J.charCodeAt(Z-1)<=32){X=!0;break}if(!X)for(let Z=0;Z<Y;Z++){let $=J.charCodeAt(Z);if($===10||$===13||$===9){X=!0;break}}if(!X)return J;let Q=[],z=-1,B=!1;for(let Z=0;Z<Y;Z++)if(J.charCodeAt(Z)<=32){if(!B){if(z>=0)Q.push(J.substring(z,Z));Q.push(" "),B=!0,z=-1}}else{if(B||z<0)z=Z;B=!1}if(z>=0)Q.push(J.substring(z));return Q.join("")}function V(J,Y=!1,X=!1,Q=0){if(!J||typeof J!=="string")return"unknown";if(Q>=20)return"unknown";let z=J.trim();if(z.startsWith("BigInt("))return"bigint";if(z.startsWith("Symbol.for("))return"symbol";if(z.includes(".raw`")||z.includes("String.raw`"))return"string";if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")||z.startsWith("`")&&z.endsWith("`")){if(!z.includes("${")){if(!Y)return"string";return z}if(Y)return z;return"string"}if(S(z)){if(!Y)return"number";return z}if(z==="true"||z==="false"){if(!Y)return"boolean";return z}if(z==="null")return"null";if(z==="undefined")return"undefined";if(z.startsWith("[")&&z.endsWith("]"))return I(z,Y,Q+1);if(z.startsWith("{")&&z.endsWith("}"))return s(z,Y,Q+1);if(z.startsWith("class ")||z.startsWith("class{"))return c(z);if(z.startsWith("new "))return d(z);if(z.includes("=>")||z.startsWith("function")||z.startsWith("async"))return y(z,X,Q,Y);if(z.endsWith("as const")){let B=z.slice(0,-8).trim();if(B.startsWith("[")&&B.endsWith("]")){let Z=B.slice(1,-1).trim();if(!Z)return"readonly []";let $=w(Z),H=[];for(let L=0;L<$.length;L++)H.push(V($[L].trim(),!0,!1,Q+1));return`readonly [${H.join(", ")}]`}return V(B,!0,X,Q+1)}if(z.startsWith("`")&&z.endsWith("`"))return p(z,Y);if(z.startsWith("Promise."))return f(z,Y,Q);if(z.startsWith("await "))return"unknown";if(z.charCodeAt(z.length-1)===110&&z.length>1&&o(z)){if(Y)return z;return"bigint"}if(z.startsWith("Symbol(")||z==="Symbol.for")return"symbol";return"unknown"}function l(J,Y=!1,X=0){return V(J,Y,!0,X)}function p(J,Y){if(J.includes(".raw`")||J.includes("String.raw`"))return"string";if(!Y)return"string";if(!J.includes("${"))return J;return"string"}function d(J){let Y=4;while(Y<J.length&&J.charCodeAt(Y)<=32)Y++;let X=Y,Q=J.charCodeAt(Y);if(Q<65||Q>90)return"unknown";while(Y<J.length&&(P(J.charCodeAt(Y))||J.charCodeAt(Y)===46))Y++;if(Y===X)return"unknown";let z=J.slice(X,Y);{let B=J.slice(Y),Z=B;if(B.startsWith("<")){let H=0,L=-1;for(let O=0;O<B.length;O++)if(B[O]==="<")H++;else if(B[O]===">"){if(H--,H===0){L=O;break}}if(L!==-1){let O=B.slice(0,L+1);Z=B.slice(L+1);let G=Z.indexOf("(");if(G!==-1){let W=0,K=-1;for(let F=G;F<Z.length;F++)if(Z[F]==="(")W++;else if(Z[F]===")"){if(W--,W===0){K=F;break}}if(K!==-1){if(Z.slice(K+1).trimStart().startsWith("."))return"unknown"}}return`${z}${O}`}}let $=Z.indexOf("(");if($!==-1){let H=0,L=-1;for(let O=$;O<Z.length;O++)if(Z[O]==="(")H++;else if(Z[O]===")"){if(H--,H===0){L=O;break}}if(L!==-1){if(Z.slice(L+1).trimStart().startsWith("."))return"unknown"}}switch(z){case"Date":return"Date";case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"RegExp":return"RegExp";case"Error":return"Error";case"Array":return"any[]";case"Object":return"object";case"Function":return"Function";case"Promise":return"Promise<any>";default:return z}}return"unknown"}function c(J){let Y=J.trimStart(),X=5;while(X<Y.length&&Y.charCodeAt(X)<=32)X++;let Q=X;if(X<Y.length&&P(Y.charCodeAt(X))){while(X<Y.length&&P(Y.charCodeAt(X)))X++;return`typeof ${Y.slice(Q,X)}`}return"{ new (...args: any[]): any }"}function f(J,Y,X=0){if(J.startsWith("Promise.resolve(")){let z=J.indexOf(")",16);if(z!==-1){let B=J.slice(16,z).trim();if(B)return`Promise<${V(B,Y,!1,X+1)}>`}return"Promise<unknown>"}if(J.startsWith("Promise.reject("))return"Promise<never>";if(J.startsWith("Promise.all(")){let Q=J.indexOf("[",12),z=J.lastIndexOf("]");if(Q!==-1&&z>Q){let B=J.slice(Q+1,z).trim(),Z=w(B),$=[];for(let H=0;H<Z.length;H++){let L=Z[H].trim();if(L.startsWith("Promise.resolve(")){let O=f(L,Y,X+1),G=O.indexOf("<"),W=O.lastIndexOf(">");$.push(G!==-1&&W>G?O.slice(G+1,W):"unknown")}else $.push(V(L,Y,!1,X+1))}return`Promise<[${$.join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function I(J,Y,X=0){let Q=J.slice(1,-1).trim();if(!Q)return"never[]";if(X>=20)return"unknown[]";let z=w(Q),B=!1;for(let W=0;W<z.length;W++){let K=z[W],F=K.length;while(F>0&&K.charCodeAt(F-1)<=32)F--;if(F>=8&&K.slice(F-8,F)==="as const"){B=!0;break}}if(B){let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const")){let q=F.slice(0,-8).trim();if(q.startsWith("[")&&q.endsWith("]")){let N=q.slice(1,-1).trim(),U=w(N),R=[];for(let b=0;b<U.length;b++)R.push(V(U[b].trim(),!0,!1,X+1));W.push(`readonly [${R.join(", ")}]`)}else W.push(V(q,!0,!1,X+1))}else if(F.startsWith("[")&&F.endsWith("]"))W.push(I(F,!0,X+1));else W.push(V(F,!0,!1,X+1))}return`readonly [
3
+ ${W.join(` |
4
+ `)}
5
+ ]`}let Z=E&&!Y,$=[],H=[];for(let W of z){let K=W.trim(),F=M;if(M=null,K.startsWith("[")&&K.endsWith("]"))$.push(I(K,Y,X+1));else $.push(l(K,Y,X+1));if(Z)H.push(M);M=F}if(Z)if(g(J))M=_(J);else{let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const"))continue;if(x(F)||F==="null"||F==="undefined")W.push(F);else if(F.startsWith("[")&&g(F))W.push(_(F));else if(F.startsWith("{")){if(H[K])W.push(H[K])}else{let q=V(F,!1,!1,0);if(q!=="unknown")W.push(q)}}if(W.length>0)M=`[${W.join(", ")}]`}if(Y)return`readonly [${$.join(", ")}]`;let L=new Set,O=[],G=!0;for(let W of $){if(!L.has(W))L.add(W),O.push(W);if(G){if(!(S(W)||W==="true"||W==="false"||W.charCodeAt(0)===34&&W.charCodeAt(W.length-1)===34||W.charCodeAt(0)===39&&W.charCodeAt(W.length-1)===39))G=!1}}if(G&&$.length<=10)return`readonly [${$.join(", ")}]`;if(O.length===1)return`${O[0]}[]`;return`(${O.join(" | ")})[]`}function w(J){let Y=[],X=0,Q=0,z=!1,B=0;for(let $=0;$<J.length;$++){let H=J.charCodeAt($);if(!z&&(H===34||H===39||H===96))z=!0,B=H;else if(z&&H===B&&($===0||J.charCodeAt($-1)!==92))z=!1;if(!z){if(H===91||H===123||H===40)Q++;else if(H===93||H===125||H===41)Q--;else if(H===44&&Q===0){let L=J.substring(X,$).trim();if(L)Y.push(L);X=$+1;continue}}}let Z=J.substring(X).trim();if(Z)Y.push(Z);return Y}function x(J){if(S(J))return!0;if(J==="true"||J==="false")return!0;if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return!0;return!1}function m(J){return J==="number"||J==="string"||J==="boolean"}function g(J){let Y=!1,X=0,Q=J.length;for(let z=0;z<Q;z++){let B=J.charCodeAt(z);if(Y){if(B===92){z++;continue}if(B===X)Y=!1;continue}if(B===34||B===39||B===96){Y=!0,X=B;continue}if(B===61&&z+1<Q&&J.charCodeAt(z+1)===62)return!1;if(B>=97&&B<=122){let Z=z;while(z<Q&&(J.charCodeAt(z)>=97&&J.charCodeAt(z)<=122||J.charCodeAt(z)>=65&&J.charCodeAt(z)<=90||J.charCodeAt(z)>=48&&J.charCodeAt(z)<=57||J.charCodeAt(z)===95||J.charCodeAt(z)===36))z++;let $=J.slice(Z,z);if($==="new"||$==="async"||$==="await"||$==="function"||$==="yield"||$==="console"||$==="process")return!1;let H=z;while(H<Q&&J.charCodeAt(H)<=32)H++;if(H<Q&&J.charCodeAt(H)===40)return!1;z--}}return!0}function s(J,Y,X=0){let Q=J.slice(1,-1).trim();if(!Q)return"{}";if(X>=20)return"Record<string, unknown>";let z=a(Q),B=[],Z=E&&!Y,$=[];for(let[H,L]of z){let O=M;M=null;let G,W=L.trim();if(e(W))G=zz(H,W);else if(G=V(L,Y,!1,X+1),G.includes("=>")||G.includes("function")||G.includes("async"))G=i(G);let K=M;M=O;let F=L.trim(),q=r(H);if(q){let N=t(q.kind,q.name,G);if(N){B.push(N);continue}}if(!Y&&m(G)&&x(F))B.push(`/** @defaultValue ${F} */
6
+ ${H}: ${G}`);else B.push(`${H}: ${G}`);if(Z){let N=h(H);if(F.endsWith("as const"));else if(x(F))$.push(`${N}: ${F}`);else if(F.startsWith("[")&&g(F))$.push(`${N}: ${_(F)}`);else if(F.startsWith("{")){if(K)$.push(`${N}: ${K}`)}else if(!F.startsWith("[")&&(F.includes("=>")||F.startsWith("function")||F.startsWith("async"))){let U=y(F,!1,0,!0);$.push(`${N}: ${U}`)}}}if(Z&&$.length>0){let H=X>0?(X-1)/2:0,L=`{ ${$.join(", ")} }`;if(L.length<=80)M=L;else{let O=" ".repeat((H+1)*2),G=" ".repeat(H*2);M=`{
7
+ ${O}${$.join(`,
8
+ ${O}`)}
9
+ ${G}}`}}return`{
10
+ ${B.join(`;
11
+ `)}
12
+ }`}function i(J){let X=J.split(`
13
+ `).map((O)=>C(O)).join(`
14
+ `),Q=X.indexOf("async");if(Q!==-1){let O=Q>0?X.charCodeAt(Q-1):32,G=Q+5<X.length?X.charCodeAt(Q+5):32;if(!P(O)&&!P(G))X=(X.slice(0,Q)+X.slice(Q+5)).trim()}let z=X.indexOf("(");if(z!==-1){let O=j(X,z,"(",")");if(O!==-1){let G=X.slice(z,O+1),W=k(G);X=X.slice(0,z)+W+X.slice(O+1)}}let B=X.length,Z="",$=[],H=!1,L=!1;for(let O=0;O<B;O++){let G=X.charCodeAt(O);if(G===123||G===40)$.push(G);else if(G===125||G===41)$.pop();if(G<=32){if(H=!0,G===10||G===13)L=!0;continue}if(H&&Z.length>0){let K=($.length>0?$[$.length-1]:0)===123;if(L&&K){let F=Z.charCodeAt(Z.length-1),q=F===59||F===44||F===123||G===125,N=Z.length>=2&&Z.charCodeAt(Z.length-1)===47&&Z.charCodeAt(Z.length-2)===42;if(!q&&!N)Z+="; ";else Z+=" "}else Z+=" "}H=!1,L=!1,Z+=X[O]}return Z.trim()}function P(J){return J>=97&&J<=122||J>=65&&J<=90||J>=48&&J<=57||J===95||J===36}function k(J){let Y=J.trim(),X,Q=!1;if(Y.startsWith("(")&&Y.endsWith(")"))X=Y.slice(1,-1),Q=!0;else X=Y;let z=X.trim();if(!z)return Q?"()":"";let B=!1;{let F=0;for(let q=0;q<z.length;q++){let N=z.charCodeAt(q);if(N===40||N===60||N===91||N===123)F++;else if(N===41||N===62||N===93||N===125)F--;else if(F===0&&N===61){let U=q>0?z.charCodeAt(q-1):0,R=q+1<z.length?z.charCodeAt(q+1):0;if(U!==61&&U!==33&&U!==60&&U!==62&&R!==61&&R!==62){B=!0;break}}}}if(!B)return Y;let Z=[],$=[],H=0,L=0,O=!1,G=0;for(let F=0;F<=z.length;F++){if(F===z.length){Z.push(z.slice(H));break}let q=z.charCodeAt(F);if(O){if(q===92){F++;continue}if(q===G)O=!1;continue}if(q===47&&F+1<z.length){let N=z.charCodeAt(F+1);if(N===42){F+=2;while(F+1<z.length&&!(z.charCodeAt(F)===42&&z.charCodeAt(F+1)===47))F++;F++;continue}if(N===47){while(F<z.length&&z.charCodeAt(F)!==10)F++;continue}}if(q===39||q===34||q===96){O=!0,G=q;continue}if(q===40||q===60||q===91||q===123)L++;else if(q===41||q===62||q===93||q===125)L--;else if(q===44&&L===0){Z.push(z.slice(H,F));let N=",",U=F+1;while(U<z.length&&z.charCodeAt(U)<=32)N+=z[U],U++;$.push(N),H=U}}let W=[];for(let F of Z){let q=F.trim();if(!q){W.push(F);continue}if(q.startsWith("//"))continue;let N=C(q),U=F.slice(0,F.length-F.trimStart().length);W.push(U+n(N))}let K=W[0]||"";for(let F=1;F<W.length;F++)K+=($[F-1]||", ")+W[F];return Q?`(${K})`:K}function C(J){let Y=!1,X=0;for(let Q=0;Q<J.length-1;Q++){let z=J.charCodeAt(Q);if(Y){if(z===92){Q++;continue}if(z===X)Y=!1;continue}if(z===39||z===34||z===96){Y=!0,X=z;continue}if(z===47&&J.charCodeAt(Q+1)===47)return J.slice(0,Q).trimEnd()}return J}function n(J){if(J.startsWith("..."))return J;let Y=-1,X=-1,Q=0,z=!1,B=0;for(let $=0;$<J.length;$++){let H=J.charCodeAt($);if(z){if(H===92){$++;continue}if(H===B)z=!1;continue}if(H===47&&$+1<J.length){let L=J.charCodeAt($+1);if(L===42){$+=2;while($+1<J.length&&!(J.charCodeAt($)===42&&J.charCodeAt($+1)===47))$++;$++;continue}if(L===47){while($<J.length&&J.charCodeAt($)!==10)$++;continue}}if(H===39||H===34||H===96){z=!0,B=H;continue}if(H===40||H===60||H===91||H===123)Q++;else if(H===41||H===62||H===93||H===125)Q--;else if(Q===0){if(H===58&&Y===-1)Y=$;else if(H===61&&X===-1&&($===0||J.charCodeAt($-1)!==61)&&($+1>=J.length||J.charCodeAt($+1)!==61&&J.charCodeAt($+1)!==62))X=$}}let Z=X!==-1;if(Y!==-1&&(X===-1||Y<X)){let $=J.slice(0,Y).trim(),H=X!==-1?J.slice(Y+1,X).trim():J.slice(Y+1).trim(),L=Z&&!$.endsWith("?")?"?":"";return`${$}${L}: ${H}`}else if(X!==-1){let $=J.slice(0,X).trim(),H=!$.endsWith("?")?"?":"",L=J.slice(X+1).trim(),O="unknown";if(L==="true"||L==="false")O="boolean";else if(/^-?\d+(\.\d+)?$/.test(L))O="number";else if(L.startsWith("'")&&L.endsWith("'")||L.startsWith('"')&&L.endsWith('"'))O="string";else if(L.startsWith("["))O="unknown[]";else if(L.startsWith("{"))O="Record<string, unknown>";return`${$}${H}: ${O}`}return J}function a(J){let Y=[],X="",Q="",z=0,B=!1,Z="",$=!0,H=!1,L=0;for(let O=0;O<J.length;O++){let G=J.charCodeAt(O),W=O>0?J.charCodeAt(O-1):0,K=O<J.length-1?J.charCodeAt(O+1):0;if(!B&&!H&&G===47&&K===47){O+=2;while(O<J.length&&J.charCodeAt(O)!==10)O++;continue}if(!B&&!H&&G===47&&K===42){H=!0,L=1,X+="/*",O++;continue}else if(H&&G===42&&K===47){if(L--,X+="*/",O++,L===0)H=!1;continue}else if(H&&G===47&&K===42){L++,X+="/*",O++;continue}let F=J[O];if(!B&&(G===34||G===39||G===96))B=!0,Z=F,X+=F;else if(B&&F===Z&&W!==92)B=!1,X+=F;else if(!B&&!H)if(G===40&&z===0&&$){Q=X.trim();let q="";if(Q.startsWith("async "))Q=Q.slice(6).trim(),q="async ";if(Q.startsWith("*"))Q=Q.slice(1).trim(),q+="*";X=q+F,$=!1,z=1}else if(G===123||G===91||G===40)z++,X+=F;else if(G===125||G===93||G===41)z--,X+=F;else if(G===58&&z===0&&$)Q=X.trim(),X="",$=!1;else if(G===44&&z===0){if(Q&&X.trim()){let q=X.trim();Y.push([Q,q])}X="",Q="",$=!0}else X+=F;else X+=F}if(Q&&X.trim()){let O=X.trim();Y.push([Q,O])}return Y}function r(J){let Y=J.trim();if(Y.startsWith("get ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"get",name:X}}if(Y.startsWith("set ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"set",name:X}}return null}function t(J,Y,X){let Q=X.trim();if(Q.charCodeAt(0)!==40)return null;let z=j(Q,0,"(",")");if(z===-1)return null;let B=Q.slice(1,z).trim(),Z=Q.slice(z+1).trimStart();if(!Z.startsWith("=>"))return null;let $=Z.slice(2).trim();if(J==="get")return`get ${Y}(): ${$||"unknown"}`;return`set ${Y}(${B})`}function e(J){let Y=J;if(Y.startsWith("async ")||Y.startsWith("async\t"))Y=Y.slice(5).trimStart();if(Y.startsWith("*"))Y=Y.slice(1).trimStart();if(!Y.startsWith("("))return!1;let X=0;for(let Q=0;Q<Y.length;Q++){let z=Y.charCodeAt(Q);if(z===40)X++;else if(z===41){if(X--,X===0){let B=Y.slice(Q+1).trimStart();if(B.startsWith("{"))return!0;if(B.startsWith(":")){let Z=0;for(let $=0;$<B.length;$++){let H=B.charCodeAt($);if(H===40||H===91)Z++;else if(H===41||H===93)Z--;else if(H===60)Z++;else if(H===62){if(Z>0)Z--}else if(Z===0&&H===61&&$+1<B.length&&B.charCodeAt($+1)===62)return!1;else if(Z===0&&H===123)return!0}}return!1}}}return!1}function zz(J,Y){let X=Y.trimStart(),Q=!1,z=!1;if(X.startsWith("async ")||X.startsWith("async\t"))Q=!0,X=X.slice(5).trimStart();if(X.startsWith("*"))z=!0,X=X.slice(1).trimStart();let B="";if(X.charCodeAt(0)===60){let W=0,K=-1;for(let F=0;F<X.length;F++)if(X.charCodeAt(F)===60)W++;else if(X.charCodeAt(F)===62){if(W--,W===0){K=F;break}}if(K!==-1)B=X.slice(0,K+1),X=X.slice(K+1).trimStart()}let Z=X.indexOf("("),$=j(X,Z,"(",")");if(Z===-1||$===-1)return"() => unknown";let H=X.slice(Z,$+1),L="unknown",O=X.slice($+1).trimStart();if(O.charCodeAt(0)===58){let W=O.slice(1),K=0,F=-1,q=!1;for(let N=0;N<W.length;N++){let U=W.charCodeAt(N);if(U===40||U===91)K++;else if(U===41||U===93)K--;else if(U===123&&K===0){F=N;break}else if(U===61&&N+1<W.length&&W.charCodeAt(N+1)===62&&K===0){F=N,q=!0;break}}if(F!==-1)L=W.slice(0,F).trim();else L=W.trim()}if(L==="unknown"){if(Q&&z)L="AsyncGenerator<unknown, void, unknown>";else if(z)L="Generator<unknown, void, unknown>";else if(Q)L="Promise<void>"}else if(Q&&!L.startsWith("Promise<")&&!L.startsWith("AsyncGenerator<"))L=`Promise<${L}>`;let G=k(H);return`${B}${G} => ${L}`}function j(J,Y,X,Q){let z=0;for(let B=Y;B<J.length;B++)if(J[B]===X)z++;else if(J[B]===Q){if(z--,z===0)return B}return-1}function Jz(J){let Y=0,X=0,Q=!1,z="";for(let B=0;B<J.length-1;B++){let Z=J[B],$=J[B+1],H=B>0?J[B-1]:"";if(!Q&&(Z==='"'||Z==="'"||Z==="`"))Q=!0,z=Z;else if(Q&&Z===z&&H!=="\\")Q=!1;if(!Q){if(Z==="(")Y++;else if(Z===")")Y--;else if(Z==="[")X++;else if(Z==="]")X--;if(Z==="="&&$===">"&&Y===0&&X===0)return B}}return-1}function y(J,Y=!1,X=0,Q=!0){let z=J.trim();if(z.length>200&&D(z,"=>")>2&&D(z,"<")>5&&!z.startsWith("function"))return Y?"((...args: any[]) => any)":"(...args: any[]) => any";if(z.startsWith("async ")&&z.includes("=>")){let Z=z.slice(5).trim(),$=Z.indexOf("=>"),H=Z.substring(0,$).trim(),L=Z.substring($+2).trim();if(H=k(H),H==="()"||H==="")H="()";else if(!H.startsWith("("))H=`(${H})`;let O="unknown";if(L.startsWith("{"))O="unknown";else O=V(L,Q,!1,X+1);let G=`${H} => Promise<${O}>`;return Y?`(${G})`:G}if(z.includes("=>")){let Z="",$=z;if(z.startsWith("<")){let q=j(z,0,"<",">");if(q!==-1)Z=z.substring(0,q+1),$=z.substring(q+1).trim()}let H=Jz($);if(H===-1)return Y?"(() => unknown)":"() => unknown";let L=$.substring(0,H).trim(),O=$.substring(H+2).trim(),G="",W=L.lastIndexOf("):");if(W!==-1){let q=L.substring(W+2).trim();if(q&&!q.includes("=>")&&!q.includes("="))G=q,L=L.substring(0,W+1)}if(L=k(L),L==="()"||L==="")L="()";else if(!L.startsWith("("))L=`(${L})`;let K="unknown";if(G)K=G;else if(O.startsWith("{"))K="unknown";else if(O.includes("=>")){let q=O.trimStart(),N=q.indexOf("("),U=N!==-1?j(q,N,"(",")"):-1,R=U!==-1?q.indexOf("=>",U):-1;if(N===0&&U!==-1&&R!==-1){let b=q.substring(N+1,U).trim(),A=k(b);if(Z.includes("T")&&A.includes("T"))K=`(${A}) => T`;else K=`(${A}) => any`}else K="any"}else if(Y)K="unknown";else K=V(O,Q,!1,X+1);let F=`${Z}${L} => ${K}`;return Y?`(${F})`:F}if(z.startsWith("function")){let Z=8,$=z.length;while(Z<$&&z.charCodeAt(Z)<=32)Z++;let H=!1;if(Z<$&&z.charCodeAt(Z)===42){H=!0,Z++;while(Z<$&&z.charCodeAt(Z)<=32)Z++}let L="";if(Z<$&&z.charCodeAt(Z)===60){let W=Z,K=1;Z++;while(Z<$&&K>0){let F=z.charCodeAt(Z);if(F===60)K++;else if(F===62)K--;Z++}L=z.substring(W,Z);while(Z<$&&z.charCodeAt(Z)<=32)Z++}let O=z.indexOf("(",Z);if(O!==-1){let W=1,K=O+1;while(K<$&&W>0){let U=z.charCodeAt(K);if(U===40)W++;else if(U===41)W--;K++}let F=z.substring(O+1,K-1).trim(),q=F?`(${F})`:"()";if(H){let U=z.substring(K).trim(),R=U.indexOf("Generator<");if(R!==-1){let A=R+10,T=U.indexOf(">",A);if(T!==-1){let u=U.substring(A,T),v=`${L}${q} => Generator<${u}>`;return Y?`(${v})`:v}}let b=`${L}${q} => Generator<any, any, any>`;return Y?`(${b})`:b}let N=`${L}${q} => unknown`;return Y?`(${N})`:N}let G="(...args: any[]) => unknown";return Y?`(${G})`:G}if(z.includes("=>")&&z.includes("(")&&z.includes(")")){if(z.length>100||D(z,"=>")>2){let Z="";if(z.charCodeAt(0)===60){let G=j(z,0,"<",">");if(G!==-1)Z=z.substring(0,G+1)}let $=z.indexOf("("),H=$!==-1?j(z,$,"(",")"):-1,L=$!==-1&&H!==-1?z.substring($,H+1):"(...args: any[])";L=k(L);let O=`${Z}${L} => any`;return Y?`(${O})`:O}return Y?`(${z})`:z}let B="() => unknown";return Y?`(${B})`:B}function Hz(J){let Y=J.trim();if(Y==="any"||Y==="object"||Y==="unknown")return!0;if(Y.startsWith("Record<")&&Y.endsWith(">"))return!0;if(Y.startsWith("Array<")&&Y.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(Y))return!0;return!1}function Fz(J){let Y=J.lastIndexOf(" satisfies ");if(Y===-1)return null;let X=J.slice(Y+11).trim();if(X.endsWith(";"))X=X.slice(0,-1).trim();return X||null}var Xz=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,Yz=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,Zz=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function Lz(J){let Y=[],X=0;for(let Q=0;Q<=J.length;Q++)if(Q===J.length||J[Q]===`
15
+ `){let z=X,B=Q;while(z<B&&(J[z]===" "||J[z]==="\t"||J[z]==="\r"))z++;while(B>z&&(J[B-1]===" "||J[B-1]==="\t"||J[B-1]==="\r"))B--;let Z=J.slice(z,B);if(X=Q+1,Z.startsWith("///")){if(Z.indexOf("<")===-1)continue;if(Xz.test(Z)||Yz.test(Z)||Zz.test(Z))Y.push(Z)}else if(Z===""||Z.startsWith("//"))continue;else break}return Y}
16
+ export{$z as Dc,Qz as Ec,V as Fc,l as Gc,I as Hc,w as Ic,s as Jc,j as Kc,y as Lc,Hz as Mc,Fz as Nc,Lz as Oc};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as l}from"./chunk-y581wnfe.js";import{hc as CY}from"./chunk-2n1bbm2c.js";import{lc as UJ}from"./chunk-8z31rkfp.js";import{Cc as iJ}from"./chunk-vpjw38x7.js";import{Uc as f}from"./chunk-a3txc27m.js";import{Wc as K,Yc as r}from"./chunk-gssantc8.js";import{bd as xY,dd as AY}from"./chunk-mcdb3q06.js";var{Glob:oJ}=globalThis.Bun;import{mkdir as o}from"fs/promises";import{availableParallelism as dY}from"os";import{dirname as u,relative as v,resolve as x}from"path";import{existsSync as ZJ,mkdirSync as JY,readFileSync as YY,writeFileSync as $Y}from"fs";import{dirname as ZY,relative as QY,resolve as UY}from"path";async function TJ(J,Y,$){let Z=new Map,Q=[],U=new Set,X=0,H=0,j=0,G=[];for(let q of J){let B=Y.get(q);if(!B)continue;G.push({file:q,decls:l(B,q,$.keepComments)})}for(let{file:q,decls:B}of G){X+=B.length;for(let k of B)if(k.kind==="import"){H++;let R=k.source||"";if(R.startsWith("."))continue;if(!Z.has(R))Z.set(R,{source:R,specifiers:new Map,isTypeOnly:k.isTypeOnly||!1,isSideEffect:k.isSideEffect||!1});let L=Z.get(R);if(k.specifiers)for(let w of k.specifiers){let S=w.alias||w.name;if(!L.specifiers.has(S))L.specifiers.set(S,{name:w.name,alias:w.alias,isType:w.isType||!1})}if(!k.isTypeOnly)L.isTypeOnly=!1}else if(k.isExported||k.kind==="export"){if(j++,k.kind==="export"&&k.source&&(k.source.startsWith(".")||k.source.startsWith("/")))continue;if(k.name&&U.has(k.name))continue;if(k.name)U.add(k.name);Q.push({declaration:k,file:q})}}let z=[];z.push("/**"),z.push(" * Bundled TypeScript declarations"),z.push(` * Generated from ${J.length} source files`),z.push(" */"),z.push("");let A=$.importOrder||["bun"],N=Array.from(Z.values()),_=Array(N.length);for(let q=0;q<N.length;q++){let B=N[q].source,k=A.length;for(let R=0;R<A.length;R++)if(B.startsWith(A[R])){k=R;break}_[q]=k}let T=N.map((q,B)=>B);T.sort((q,B)=>{let k=_[q],R=_[B];if(k!==R)return k-R;return N[q].source.localeCompare(N[B].source)});let V=T.map((q)=>N[q]);for(let q of V)if(q.isSideEffect)z.push(`import '${q.source}';`);else if(q.specifiers.size>0){let k=Array.from(q.specifiers.values()).map((L)=>{let w=L.isType?"type ":"";return L.alias?`${w}${L.name} as ${L.alias}`:`${w}${L.name}`}),R=q.isTypeOnly?"type ":"";z.push(`import ${R}{ ${k.join(", ")} } from '${q.source}';`)}if(V.length>0)z.push("");let W=new Map;for(let{declaration:q,file:B}of Q){if(!W.has(B))W.set(B,[]);W.get(B).push(q)}for(let[q,B]of W){let k=QY($.cwd,q);z.push(`// From: ${k}`);for(let R of B){if($.keepComments&&R.leadingComments)for(let L of R.leadingComments)z.push(L);z.push(RJ(R))}z.push("")}let O=z.join(`
2
+ import{ec as l}from"./chunk-asnnmvct.js";import{hc as CY}from"./chunk-2n1bbm2c.js";import{lc as UJ}from"./chunk-wcdd51hr.js";import{Cc as iJ}from"./chunk-7pwy4m0c.js";import{Uc as f}from"./chunk-a3txc27m.js";import{Wc as K,Yc as r}from"./chunk-gssantc8.js";import{bd as xY,dd as AY}from"./chunk-mcdb3q06.js";var{Glob:oJ}=globalThis.Bun;import{mkdir as o}from"fs/promises";import{availableParallelism as dY}from"os";import{dirname as u,relative as v,resolve as x}from"path";import{existsSync as ZJ,mkdirSync as JY,readFileSync as YY,writeFileSync as $Y}from"fs";import{dirname as ZY,relative as QY,resolve as UY}from"path";async function TJ(J,Y,$){let Z=new Map,Q=[],U=new Set,X=0,H=0,j=0,G=[];for(let q of J){let B=Y.get(q);if(!B)continue;G.push({file:q,decls:l(B,q,$.keepComments)})}for(let{file:q,decls:B}of G){X+=B.length;for(let k of B)if(k.kind==="import"){H++;let R=k.source||"";if(R.startsWith("."))continue;if(!Z.has(R))Z.set(R,{source:R,specifiers:new Map,isTypeOnly:k.isTypeOnly||!1,isSideEffect:k.isSideEffect||!1});let L=Z.get(R);if(k.specifiers)for(let w of k.specifiers){let S=w.alias||w.name;if(!L.specifiers.has(S))L.specifiers.set(S,{name:w.name,alias:w.alias,isType:w.isType||!1})}if(!k.isTypeOnly)L.isTypeOnly=!1}else if(k.isExported||k.kind==="export"){if(j++,k.kind==="export"&&k.source&&(k.source.startsWith(".")||k.source.startsWith("/")))continue;if(k.name&&U.has(k.name))continue;if(k.name)U.add(k.name);Q.push({declaration:k,file:q})}}let z=[];z.push("/**"),z.push(" * Bundled TypeScript declarations"),z.push(` * Generated from ${J.length} source files`),z.push(" */"),z.push("");let A=$.importOrder||["bun"],N=Array.from(Z.values()),_=Array(N.length);for(let q=0;q<N.length;q++){let B=N[q].source,k=A.length;for(let R=0;R<A.length;R++)if(B.startsWith(A[R])){k=R;break}_[q]=k}let T=N.map((q,B)=>B);T.sort((q,B)=>{let k=_[q],R=_[B];if(k!==R)return k-R;return N[q].source.localeCompare(N[B].source)});let V=T.map((q)=>N[q]);for(let q of V)if(q.isSideEffect)z.push(`import '${q.source}';`);else if(q.specifiers.size>0){let k=Array.from(q.specifiers.values()).map((L)=>{let w=L.isType?"type ":"";return L.alias?`${w}${L.name} as ${L.alias}`:`${w}${L.name}`}),R=q.isTypeOnly?"type ":"";z.push(`import ${R}{ ${k.join(", ")} } from '${q.source}';`)}if(V.length>0)z.push("");let W=new Map;for(let{declaration:q,file:B}of Q){if(!W.has(B))W.set(B,[]);W.get(B).push(q)}for(let[q,B]of W){let k=QY($.cwd,q);z.push(`// From: ${k}`);for(let R of B){if($.keepComments&&R.leadingComments)for(let L of R.leadingComments)z.push(L);z.push(RJ(R))}z.push("")}let O=z.join(`
3
3
  `);return{content:O,files:J,declarationCount:X,importCount:H,exportCount:j,size:Buffer.byteLength(O,"utf8"),warnings:[]}}function RJ(J){if(J.text){let $=J.text.trim();if(J.isExported&&!$.startsWith("export"))$=`export ${$}`;if(!$.endsWith(";")&&!$.endsWith("}"))$+=";";return $}let Y=[];if(J.isExported)Y.push("export");if(J.isDefault)Y.push("default");switch(J.kind){case"function":if(Y.push("declare function"),Y.push(J.name),J.generics)Y.push(J.generics);if(Y.push(`(${XY(J.parameters)})`),J.returnType)Y.push(`: ${J.returnType}`);break;case"variable":if(Y.push("declare const"),Y.push(J.name),J.typeAnnotation)Y.push(`: ${J.typeAnnotation}`);break;case"interface":if(Y.push("interface"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(Y.push("{"),J.members)for(let $ of J.members)Y.push(` ${$.name}${$.typeAnnotation?`: ${$.typeAnnotation}`:""};`);Y.push("}");break;case"type":if(Y.push("type"),Y.push(J.name),J.generics)Y.push(J.generics);Y.push("="),Y.push(J.typeAnnotation||"unknown");break;case"class":if(Y.push("declare class"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(J.implements&&J.implements.length>0)Y.push(`implements ${J.implements.join(", ")}`);if(Y.push("{"),J.members)for(let $ of J.members)Y.push(` ${RJ($)}`);Y.push("}");break;case"enum":if(Y.push("declare enum"),Y.push(J.name),Y.push("{"),J.members){let $=J.members.map((Z)=>Z.value!==void 0?`${Z.name} = ${Z.value}`:Z.name);Y.push(` ${$.join(`,
4
4
  `)}`)}Y.push("}");break;default:return J.text||""}return Y.join(" ")}function XY(J){if(!J||J.length===0)return"";return J.map((Y)=>{let $="";if(Y.rest)$+="...";if($+=Y.name,Y.optional)$+="?";if(Y.type)$+=`: ${Y.type}`;if(Y.defaultValue)$+=` = ${Y.defaultValue}`;return $}).join(", ")}async function LJ(J,Y={}){let $=[],Z=new Map,Q=[],U=[],X=new Set,H=0,j=0,G=0;for(let _ of J){if(!ZJ(_)){$.push(`File not found: ${_}`);continue}let T=YY(_,"utf-8");U.push(_);let V=T.split(`
5
5
  `),W=[],O=0,q=!1;for(let B of V){let k=B.trim();if(!k&&!q)continue;if(k.startsWith("import ")){j++;let L=k.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(L){let[,w,S,M,F,D]=L;if(Y.externals?.some((C)=>D.startsWith(C))){Q.push(k);continue}if(D.startsWith("."))continue;if(!Z.has(D))Z.set(D,{source:D,specifiers:new Map,isTypeOnly:!!w,isSideEffect:!1});let p=Z.get(D);if(S){let C=S.split(",").map((e)=>e.trim());for(let e of C){let[JJ,YJ]=e.split(/\s+as\s+/).map((eJ)=>eJ.trim()),NJ=JJ.startsWith("type "),$J=NJ?JJ.replace("type ",""):JJ;p.specifiers.set(YJ||$J,{name:$J,alias:YJ!==$J?YJ:void 0,isType:NJ})}}if(!w)p.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(k)){if(q=!0,W=[B],O=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,O===0&&(k.endsWith(";")||!k.includes("{"))){let L=c(k);if(!X.has(L)||!Y.mergeDuplicates){if(X.add(L),Q.push(B),H++,k.startsWith("export"))G++}q=!1,W=[]}}else if(q){if(W.push(B),O+=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,O<=0){let L=W.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import{Oc as f}from"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{d as shouldUseAsyncParsing,m as shouldIncludeNonExportedInterface,l as shouldIncludeNonExportedFunction,n as isBuiltInType,j as hasExportModifier,k as hasAsyncModifier,a as getSourceFileCacheSize,b as getSourceFileAsync,e as getPendingParseCount,i as getParameterName,g as getNodeText,s as getInterfaceBody,I as findReferencedTypes,C as extractVariableStatement,o as extractTypesFromModuleText,E as extractTypeAliasDeclaration,f as extractTripleSlashDirectives,J as extractReferencedTypeDeclarations,H as extractModuleDeclaration,h as extractJSDocComments,D as extractInterfaceDeclaration,y as extractImportDeclaration,B as extractFunctionDeclaration,z as extractExportDeclaration,A as extractExportAssignment,G as extractEnumDeclaration,M as extractDeclarationsAsync,L as extractDeclarations,F as extractClassDeclaration,K as clearSourceFileCache,q as buildVariableDeclaration,t as buildTypeDeclaration,w as buildModuleDeclaration,x as buildModuleBody,r as buildInterfaceDeclaration,p as buildFunctionSignature,u as buildClassDeclaration,v as buildClassBody,c as batchParseSourceFiles,N as batchExtractDeclarations};
2
+ import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import{Oc as f}from"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{d as shouldUseAsyncParsing,m as shouldIncludeNonExportedInterface,l as shouldIncludeNonExportedFunction,n as isBuiltInType,j as hasExportModifier,k as hasAsyncModifier,a as getSourceFileCacheSize,b as getSourceFileAsync,e as getPendingParseCount,i as getParameterName,g as getNodeText,s as getInterfaceBody,I as findReferencedTypes,C as extractVariableStatement,o as extractTypesFromModuleText,E as extractTypeAliasDeclaration,f as extractTripleSlashDirectives,J as extractReferencedTypeDeclarations,H as extractModuleDeclaration,h as extractJSDocComments,D as extractInterfaceDeclaration,y as extractImportDeclaration,B as extractFunctionDeclaration,z as extractExportDeclaration,A as extractExportAssignment,G as extractEnumDeclaration,M as extractDeclarationsAsync,L as extractDeclarations,F as extractClassDeclaration,K as clearSourceFileCache,q as buildVariableDeclaration,t as buildTypeDeclaration,w as buildModuleDeclaration,x as buildModuleBody,r as buildInterfaceDeclaration,p as buildFunctionSignature,u as buildClassDeclaration,v as buildClassBody,c as batchParseSourceFiles,N as batchExtractDeclarations};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dc as Uz,Ec as Yz,Fc as T,Mc as u,Nc as p,Oc as Gz}from"./chunk-285mqzvx.js";function k(z,$=!0){if(!$||!z||z.length===0)return"";if(z.length===1){let U=z[0];if(U.length>0&&U.charCodeAt(0)>32&&U.charCodeAt(U.length-1)>32)return`${U}
2
+ import{Dc as Uz,Ec as Yz,Fc as T,Mc as u,Nc as p,Oc as Gz}from"./chunk-4jw8qvts.js";function k(z,$=!0){if(!$||!z||z.length===0)return"";if(z.length===1){let U=z[0];if(U.length>0&&U.charCodeAt(0)>32&&U.charCodeAt(U.length-1)>32)return`${U}
3
3
  `;return`${U.trim()}
4
4
  `}let K="";for(let U=0;U<z.length;U++){if(U>0)K+=`
5
5
  `;K+=z[U].trim()}return`${K}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{oc as a}from"./chunk-j0rnj1z0.js";import"./chunk-mcdb3q06.js";export{a as scanDeclarations};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-xhs0tsnn.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
2
+ import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-zs5mk604.js";import"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as p,mc as Rq,nc as zq}from"./chunk-8z31rkfp.js";import{Fc as Jq}from"./chunk-285mqzvx.js";import{bd as D}from"./chunk-mcdb3q06.js";var L=D(E(),1);var v=D(E(),1);var I=new Map,S=new Map,Oq=100;function Lq(){while(I.size>Oq){let q=I.keys().next().value;if(q===void 0)break;I.delete(q)}}function Vq(){I.clear()}function _q(){return I.size}var Uq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function u(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function Iq(q,$,Q){if($.length<Q.asyncThreshold)return v.createSourceFile(q,$,v.ScriptTarget.Latest,!0,v.ScriptKind.TS);await u(Q.yieldInterval);let W=v.createSourceFile(q,$,v.ScriptTarget.Latest,!1,v.ScriptKind.TS);return await u(Q.yieldInterval),W}async function g(q,$,Q={}){let W={...Uq,...Q},V=p($),Z=q,U=Date.now(),j=I.get(Z);if(j&&j.contentHash===V)return j.lastAccess=U,I.delete(Z),I.set(Z,j),j.sourceFile;let X=S.get(Z);if(X)return X;let w=(async()=>{try{let H=await Iq(q,$,W);return I.set(Z,{sourceFile:H,contentHash:V,lastAccess:U}),Lq(),H}finally{S.delete(Z)}})();return S.set(Z,w),w}async function vq(q,$={}){let Q=$.concurrency??4,W=new Map,V=[];for(let Z=0;Z<q.length;Z+=Q){let U=q.slice(Z,Z+Q),j=await Promise.allSettled(U.map(async({filePath:X,sourceCode:w})=>{let H=await g(X,w,$);return{filePath:X,sourceFile:H}}));for(let X=0;X<j.length;X++){let w=j[X];if(w.status==="fulfilled")W.set(w.value.filePath,w.value.sourceFile);else V.push({filePath:U[X].filePath,error:w.reason})}if(Z+Q<q.length)await u(0)}if(V.length>0)console.warn(`[dtsx] ${V.length} file(s) failed to parse:`,V.map((Z)=>Z.filePath));return W}function Aq(q,$={}){let Q=$.asyncThreshold??Uq.asyncThreshold;return q.length>=Q}function kq(){return S.size}var R=D(E(),1);var Y=D(E(),1);var O=D(E(),1);function P(q,$,Q){return $.slice(Q?q.getStart(Q):q.getStart(),q.getEnd())}var wq=/\/\*[\s\S]*?\*\//g;function _(q,$){let Q=[],W=q.getFullStart(),V=q.getStart($);if(W===V)return Q;let Z=$.text.substring(W,V);if(Z.indexOf("/*")!==-1){wq.lastIndex=0;let U;while((U=wq.exec(Z))!==null)Q.push(U[0])}if(Z.indexOf("//")!==-1){let U=Z.split(`
2
+ import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as p,mc as Rq,nc as zq}from"./chunk-wcdd51hr.js";import{Fc as Jq}from"./chunk-4jw8qvts.js";import{bd as D}from"./chunk-mcdb3q06.js";var L=D(E(),1);var v=D(E(),1);var I=new Map,S=new Map,Oq=100;function Lq(){while(I.size>Oq){let q=I.keys().next().value;if(q===void 0)break;I.delete(q)}}function Vq(){I.clear()}function _q(){return I.size}var Uq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function u(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function Iq(q,$,Q){if($.length<Q.asyncThreshold)return v.createSourceFile(q,$,v.ScriptTarget.Latest,!0,v.ScriptKind.TS);await u(Q.yieldInterval);let W=v.createSourceFile(q,$,v.ScriptTarget.Latest,!1,v.ScriptKind.TS);return await u(Q.yieldInterval),W}async function g(q,$,Q={}){let W={...Uq,...Q},V=p($),Z=q,U=Date.now(),j=I.get(Z);if(j&&j.contentHash===V)return j.lastAccess=U,I.delete(Z),I.set(Z,j),j.sourceFile;let X=S.get(Z);if(X)return X;let w=(async()=>{try{let H=await Iq(q,$,W);return I.set(Z,{sourceFile:H,contentHash:V,lastAccess:U}),Lq(),H}finally{S.delete(Z)}})();return S.set(Z,w),w}async function vq(q,$={}){let Q=$.concurrency??4,W=new Map,V=[];for(let Z=0;Z<q.length;Z+=Q){let U=q.slice(Z,Z+Q),j=await Promise.allSettled(U.map(async({filePath:X,sourceCode:w})=>{let H=await g(X,w,$);return{filePath:X,sourceFile:H}}));for(let X=0;X<j.length;X++){let w=j[X];if(w.status==="fulfilled")W.set(w.value.filePath,w.value.sourceFile);else V.push({filePath:U[X].filePath,error:w.reason})}if(Z+Q<q.length)await u(0)}if(V.length>0)console.warn(`[dtsx] ${V.length} file(s) failed to parse:`,V.map((Z)=>Z.filePath));return W}function Aq(q,$={}){let Q=$.asyncThreshold??Uq.asyncThreshold;return q.length>=Q}function kq(){return S.size}var R=D(E(),1);var Y=D(E(),1);var O=D(E(),1);function P(q,$,Q){return $.slice(Q?q.getStart(Q):q.getStart(),q.getEnd())}var wq=/\/\*[\s\S]*?\*\//g;function _(q,$){let Q=[],W=q.getFullStart(),V=q.getStart($);if(W===V)return Q;let Z=$.text.substring(W,V);if(Z.indexOf("/*")!==-1){wq.lastIndex=0;let U;while((U=wq.exec(Z))!==null)Q.push(U[0])}if(Z.indexOf("//")!==-1){let U=Z.split(`
3
3
  `),j=[];for(let X=U.length-1;X>=0;X--){let w=U[X].trim();if(w.startsWith("//"))j.unshift(w);else if(w==="")continue;else break}if(j.length>0)Q.push(j.join(`
4
4
  `))}return Q}function k(q,$){if(O.isObjectBindingPattern(q.name)){let Q=q.name.elements.map((W)=>{if(O.isBindingElement(W)&&O.isIdentifier(W.name))return W.name.getText($);return""}).filter(Boolean);if(Q.length>3)return`{
5
5
  ${Q.join(`,
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-x3q42h61.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
2
+ import{tb as I}from"./chunk-5qqybwef.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
3
3
  export{z as ma,R as na,T as oa,V as pa};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ic as a,jc as b,kc as c}from"./chunk-gc9n9za8.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as C}from"./chunk-x3q42h61.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
2
+ import{tb as C}from"./chunk-5qqybwef.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
3
3
  export{y as ia,L as ja,M as ka,P as la};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-vpjw38x7.js";import{Fc as a,Gc as b,Hc as c,Ic as d,Jc as e,Kc as f,Lc as g,Mc as h,Nc as i}from"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{l as processVariableDeclaration,n as processTypeDeclaration,s as processModuleDeclaration,m as processInterfaceDeclaration,q as processImportDeclaration,k as processFunctionDeclaration,r as processExportDeclaration,p as processEnumDeclaration,w as processDeclarations,o as processClassDeclaration,u as parseImportStatement,d as parseArrayElements,h as isGenericType,e as inferObjectType,b as inferNarrowTypeInUnion,a as inferNarrowType,g as inferFunctionType,c as inferArrayType,j as formatComments,f as findMatchingBracket,i as extractSatisfiesType,v as extractAllImportedItems,t as clearProcessorCaches};
2
+ import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-7pwy4m0c.js";import{Fc as a,Gc as b,Hc as c,Ic as d,Jc as e,Kc as f,Lc as g,Mc as h,Nc as i}from"./chunk-4jw8qvts.js";import"./chunk-mcdb3q06.js";export{l as processVariableDeclaration,n as processTypeDeclaration,s as processModuleDeclaration,m as processInterfaceDeclaration,q as processImportDeclaration,k as processFunctionDeclaration,r as processExportDeclaration,p as processEnumDeclaration,w as processDeclarations,o as processClassDeclaration,u as parseImportStatement,d as parseArrayElements,h as isGenericType,e as inferObjectType,b as inferNarrowTypeInUnion,a as inferNarrowType,g as inferFunctionType,c as inferArrayType,j as formatComments,f as findMatchingBracket,i as extractSatisfiesType,v as extractAllImportedItems,t as clearProcessorCaches};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as K}from"./chunk-y581wnfe.js";import{Wc as _}from"./chunk-gssantc8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
2
+ import{ec as K}from"./chunk-asnnmvct.js";import{Wc as _}from"./chunk-gssantc8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
3
3
  `).map((X)=>X.replace(/^\s*\*\s?/,"")).join(`
4
4
  `).trim(),Q=G.search(/@\w+/);if(Q===-1){z.description=G;continue}else if(Q>0)z.description=G.slice(0,Q).trim(),G=G.slice(Q);let U=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,W;while((W=U.exec(G))!==null){let[,X,Y,Z]=W,$=Z.trim();switch(X){case"param":{let v=$.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(v)z.params.push({name:v[2],type:Y,description:v[3].trim(),optional:!!v[1]});break}case"returns":case"return":z.returns={type:Y,description:$};break;case"example":z.examples.push($);break;case"deprecated":z.deprecated=$||"Deprecated";break;case"since":z.since=$;break;case"see":z.see.push($);break;case"throws":case"throw":z.throws.push({type:Y,description:$});break;case"category":z.category=$;break;default:if(!z.tags[X])z.tags[X]=[];z.tags[X].push($)}}}return z}function M(q,z){let A=N(q.leadingComments),G="";switch(q.kind){case"function":G=h(q);break;case"variable":G=T(q);break;case"interface":G=F(q);break;case"type":G=S(q);break;case"class":G=k(q);break;case"enum":G=x(q);break;default:G=q.text||q.name}let Q={name:q.name,kind:q.kind,signature:G,jsdoc:A,isExported:q.isExported,isDefault:q.isDefault,sourceFile:z};if(q.members&&q.members.length>0)Q.members=q.members.map((U)=>M(U,z));return Q}function h(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("function"),z.push(q.name),q.generics)z.push(q.generics);if(q.parameters){let A=q.parameters.map((G)=>{let Q="";if(G.rest)Q+="...";if(Q+=G.name,G.optional)Q+="?";if(G.type)Q+=`: ${G.type}`;return Q}).join(", ");z.push(`(${A})`)}else z.push("()");if(q.returnType)z.push(`: ${q.returnType}`);return z.join(" ").replace(/\s+/g," ")}function T(q){let z=[];if(q.isExported)z.push("export");if(z.push("const"),z.push(q.name),q.typeAnnotation)z.push(`: ${q.typeAnnotation}`);return z.join(" ")}function F(q){let z=[];if(q.isExported)z.push("export");if(z.push("interface"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);return z.join(" ")}function S(q){let z=[];if(q.isExported)z.push("export");if(z.push("type"),z.push(q.name),q.generics)z.push(q.generics);if(z.push("="),q.typeAnnotation)z.push(q.typeAnnotation);return z.join(" ")}function k(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("class"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);if(q.implements&&q.implements.length>0)z.push(`implements ${q.implements.join(", ")}`);return z.join(" ")}function x(q){let z=[];if(q.isExported)z.push("export");return z.push("enum"),z.push(q.name),z.join(" ")}async function P(q,z={}){let A=[],G=new Map;for(let Q of q){if(!j(Q)){_.warn(`File not found: ${Q}`);continue}let U=b(Q,"utf-8"),W=K(U,Q,!0);for(let X of W){if(X.kind==="import")continue;if(!z.includePrivate&&X.name.startsWith("_"))continue;if(!z.includeInternal&&X.leadingComments?.some((Z)=>Z.includes("@internal")))continue;let Y=M(X,Q);if(A.push(Y),z.groupByCategory&&Y.jsdoc.category){let Z=Y.jsdoc.category;if(!G.has(Z))G.set(Z,[]);G.get(Z).push(Y)}}}return{title:z.title||"API Documentation",description:z.description,entries:A,categories:G,generatedAt:new Date}}function B(q,z={}){let A=[];if(A.push(`# ${q.title}`),A.push(""),q.description)A.push(q.description),A.push("");if(A.push(`> Generated on ${q.generatedAt.toISOString()}`),A.push(""),A.push("## Table of Contents"),A.push(""),z.groupByCategory&&q.categories.size>0)for(let G of q.categories.keys())A.push(`- [${G}](#${E(G)})`);else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0)A.push(`- [${O(Q)}](#${E(O(Q))})`)}if(A.push(""),z.groupByCategory&&q.categories.size>0)for(let[G,Q]of q.categories){A.push(`## ${G}`),A.push("");for(let U of Q)A.push(...L(U,z))}else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0){A.push(`## ${O(Q)}`),A.push("");for(let W of U)A.push(...L(W,z))}}return A.join(`
5
5
  `)}function L(q,z){let A=[];if(A.push(`### ${q.name}`),A.push(""),q.jsdoc.deprecated)A.push(`> **Deprecated:** ${q.jsdoc.deprecated}`),A.push("");if(A.push("```typescript"),A.push(q.signature),A.push("```"),A.push(""),q.jsdoc.description)A.push(q.jsdoc.description),A.push("");if(q.jsdoc.params.length>0){A.push("**Parameters:**"),A.push(""),A.push("| Name | Type | Description |"),A.push("|------|------|-------------|");for(let G of q.jsdoc.params){let Q=G.optional?" (optional)":"",U=G.type||"any";A.push(`| \`${G.name}\`${Q} | \`${U}\` | ${G.description} |`)}A.push("")}if(q.jsdoc.returns){A.push("**Returns:**"),A.push("");let G=q.jsdoc.returns.type?`\`${q.jsdoc.returns.type}\``:"";A.push(`${G} ${q.jsdoc.returns.description}`),A.push("")}if(q.jsdoc.throws.length>0){A.push("**Throws:**"),A.push("");for(let G of q.jsdoc.throws){let Q=G.type?`\`${G.type}\``:"";A.push(`- ${Q} ${G.description}`)}A.push("")}if(q.jsdoc.examples.length>0){A.push("**Examples:**"),A.push("");for(let G of q.jsdoc.examples)A.push("```typescript"),A.push(G),A.push("```"),A.push("")}if(q.jsdoc.see.length>0){A.push("**See also:**"),A.push("");for(let G of q.jsdoc.see)A.push(`- ${G}`);A.push("")}if(q.jsdoc.since)A.push(`*Since: ${q.jsdoc.since}*`),A.push("");if(z.includeSourceLinks&&q.sourceFile){let G=q.sourceFile;if(z.sourceBaseUrl)A.push(`[Source](${z.sourceBaseUrl}/${G})`);else A.push(`*Source: ${G}*`);A.push("")}if(q.members&&q.members.length>0){A.push("**Members:**"),A.push("");for(let G of q.members)if(A.push(`#### ${G.name}`),A.push(""),A.push("```typescript"),A.push(G.signature),A.push("```"),A.push(""),G.jsdoc.description)A.push(G.jsdoc.description),A.push("")}return A.push("---"),A.push(""),A}function C(q,z={}){let A=B(q,z);return`<!DOCTYPE html>
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{lc as F,mc as L}from"./chunk-8z31rkfp.js";import{oc as I}from"./chunk-2r21f44d.js";import{Cc as g}from"./chunk-vpjw38x7.js";var R=100,w=0,z=new Map;function U(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=F(B),Y=`${G}:${J?1:0}:${P?1:0}`,Q=z.get(Y);if(Q&&Q.contentHash===N)return Q.lastAccess=++w,Q.result;let j=L(B,G,J,P),v=g(j,{filePath:G,sourceCode:B,declarations:j},J,W);if(z.set(Y,{result:v,contentHash:N,lastAccess:++w}),z.size>R){let M=Math.max(1,Math.ceil(z.size*0.1)),V=[];for(let[q,$]of z)V.push([q,$.lastAccess]);V.sort((q,$)=>q[1]-$[1]);for(let q=0;q<M&&q<V.length;q++)z.delete(V[q][0])}return v}function b(){z.clear()}function H(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=I(B,G,J,P);return g(N,{filePath:G,sourceCode:B,declarations:N},J,W)}
2
+ import{lc as F,mc as L}from"./chunk-wcdd51hr.js";import{oc as I}from"./chunk-j0rnj1z0.js";import{Cc as g}from"./chunk-7pwy4m0c.js";var R=100,w=0,z=new Map;function U(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=F(B),Y=`${G}:${J?1:0}:${P?1:0}`,Q=z.get(Y);if(Q&&Q.contentHash===N)return Q.lastAccess=++w,Q.result;let j=L(B,G,J,P),v=g(j,{filePath:G,sourceCode:B,declarations:j},J,W);if(z.set(Y,{result:v,contentHash:N,lastAccess:++w}),z.size>R){let M=Math.max(1,Math.ceil(z.size*0.1)),V=[];for(let[q,$]of z)V.push([q,$.lastAccess]);V.sort((q,$)=>q[1]-$[1]);for(let q=0;q<M&&q<V.length;q++)z.delete(V[q][0])}return v}function b(){z.clear()}function H(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=I(B,G,J,P);return g(N,{filePath:G,sourceCode:B,declarations:N},J,W)}
3
3
  export{U as ic,b as jc,H as kc};
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ function y(D){return D===32||D===9||D===10||D===13}function Bj(D){return D>=65&&D<=90||D>=97&&D<=122||D===95||D===36||D>127}function W(D){return Bj(D)||D>=48&&D<=57}function lj(D){if(D.charCodeAt(0)===82&&D.startsWith("Record<"))return!0;if(D.charCodeAt(0)===65&&D.startsWith("Array<"))return!0;if(D.charCodeAt(0)===123&&D.includes("[")&&D.includes("]:"))return!0;if(D==="any"||D==="object"||D==="unknown")return!0;return!1}var qj=["public","protected","private","readonly","override"];function dj(D,Hj,T=!0,l=!1){let Z=D,c=T,b=l,V=Z.length,L=[],P=new Map,x=new Set,j=0;if(j<V&&Z.charCodeAt(j)===65279)j++;function v(J,H){if(J<H){let U=Z.charCodeAt(J),X=Z.charCodeAt(H-1);if(U!==32&&U!==9&&U!==10&&U!==13&&X!==32&&X!==9&&X!==10&&X!==13)return Z.slice(J,H)}while(J<H&&y(Z.charCodeAt(J)))J++;while(H>J&&y(Z.charCodeAt(H-1)))H--;return Z.slice(J,H)}function O(){if(j>=V)return;let J=Z.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<V){let H=Z.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<V){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
3
+ `,j+2);j=X===-1?V:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?V:X+2;continue}}break}}function Ij(J){let H=J.length,U=0,X=H;for(let Y=0;Y<H;Y++){let $=J.charCodeAt(Y);if(U){if($===92){Y++;continue}if($===U)U=0;continue}if($===39||$===34||$===96){U=$;continue}if($===47&&Y+1<H){let G=J.charCodeAt(Y+1);if(G===47){X=Y;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9))X--;return J.slice(0,X)}if(G===42){let B=J.indexOf("*/",Y+2);if(B!==-1){J=`${J.slice(0,Y)} ${J.slice(B+2)}`,Y--;continue}}}}X=H;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9||J.charCodeAt(X-1)===13))X--;return X<H?J.slice(0,X):J}function h(J){j++;let H=J===39?"'":'"';while(j<V){let U=Z.indexOf(H,j);if(U===-1){j=V;return}let X=0,Y=U-1;while(Y>=0&&Z.charCodeAt(Y)===92)X++,Y--;if(X%2===0){j=U+1;return}j=U+1}}function t(){j++;let J=[];while(j<V){let H=Z.charCodeAt(j);if(J.length===0){if(H===92){j+=2;continue}if(H===96){j++;return}if(H===36&&j+1<V&&Z.charCodeAt(j+1)===123){j+=2,J.push(0);continue}j++;continue}if(H===39||H===34){h(H);continue}if(H===96){t();continue}if(H===47&&j+1<V){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
4
+ `,j+2);j=X===-1?V:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?V:X+2;continue}j++;continue}if(H===123){J[J.length-1]++,j++;continue}if(H===125){let U=J[J.length-1];if(U===0){J.pop(),j++;continue}J[J.length-1]=U-1,j++;continue}j++}}function E(){let J=Z.charCodeAt(j);if(J===39||J===34)return h(J),!0;if(J===96)return t(),!0;if(J===47&&j+1<V){let H=Z.charCodeAt(j+1);if(H===47){let U=Z.indexOf(`
5
+ `,j+2);return j=U===-1?V:U+1,!0}if(H===42){let U=Z.indexOf("*/",j+2);return j=U===-1?V:U+2,!0}if(fj())return Ej(),!0}return!1}function fj(){let J=j-1;while(J>=0&&(Z.charCodeAt(J)===32||Z.charCodeAt(J)===9||Z.charCodeAt(J)===10||Z.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Z.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(W(H)){let U=J;while(U>=0&&W(Z.charCodeAt(U)))U--;let X=Z.slice(U+1,J+1);if(X==="return"||X==="typeof"||X==="void"||X==="delete"||X==="throw"||X==="new"||X==="in"||X==="of"||X==="case"||X==="instanceof"||X==="yield"||X==="await")return!0}return!1}function Ej(){j++;let J=!1;while(j<V){let H=Z.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<V&&W(Z.charCodeAt(j)))j++}function f(){let J=j;while(j<V&&W(Z.charCodeAt(j)))j++;return Z.slice(J,j)}function z(J){if(j+J.length>V)return!1;for(let H=0;H<J.length;H++)if(Z.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<V&&W(Z.charCodeAt(j+J.length)))return!1;return!0}function Jj(J){let H=j+J;while(H<V){let U=Z.charCodeAt(H);if(U===32||U===9||U===10||U===13){H++;continue}return U!==46&&U!==61}return!1}function yj(){if(j>=V)return!1;switch(Z.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function a(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<V&&Z.charCodeAt(j)===10)j++;while(j<V){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<V){let Y=Z.charCodeAt(j+1);if(Y===47){let $=Z.indexOf(`
6
+ `,j+2);j=$===-1?V:$+1;continue}if(Y===42){let $=Z.indexOf("*/",j+2);j=$===-1?V:$+2;continue}}break}let U=j>=V||yj()||Z.charCodeAt(j)===125;return j=H,U}function e(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<V&&Z.charCodeAt(j)===10)j++;while(j<V){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<V&&Z.charCodeAt(j+1)===47){let Y=Z.indexOf(`
7
+ `,j+2);j=Y===-1?V:Y+1;continue}break}if(j>=V)return j=H,!0;let U=Z.charCodeAt(j);if(U===124||U===38||U===46||U===63||U===58)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Aj=/[{}'"`\/]/g,Tj=/[()'"`\/]/g,kj=/[[\]'"`\/]/g,Cj=/[<>'"`\/]/g;function A(J,H){let U=1;j++;let X=J===123?Aj:J===40?Tj:J===91?kj:Cj;X.lastIndex=j;let Y;while((Y=X.exec(Z))!==null){let $=Y.index,G=Z.charCodeAt($);if(G===39||G===34){j=$,h(G),X.lastIndex=j;continue}if(G===96){j=$,t(),X.lastIndex=j;continue}if(G===47){if(j=$,E()){X.lastIndex=j;continue}X.lastIndex=$+1;continue}if(G===J)U++;else if(G===H){if(H===62&&$>0&&Z.charCodeAt($-1)===61){X.lastIndex=$+1;continue}if(U--,U===0)return j=$+1,j}X.lastIndex=$+1}return j=V,j}function S(){return j>0&&Z.charCodeAt(j-1)===61}function Xj(){return j+1<V&&Z.charCodeAt(j+1)===62}let k=/[{};'"`\/\n\r()[\]]/g;function I(){let J=0,H=0,U=0;k.lastIndex=j;let X;while((X=k.exec(Z))!==null){let Y=X.index,$=Z.charCodeAt(Y);if($===39||$===34){j=Y,h($),k.lastIndex=j;continue}if($===96){j=Y,t(),k.lastIndex=j;continue}if($===47){if(j=Y,E()){k.lastIndex=j;continue}k.lastIndex=Y+1;continue}if($===40){H++,k.lastIndex=Y+1;continue}if($===41){H--,k.lastIndex=Y+1;continue}if($===91){U++,k.lastIndex=Y+1;continue}if($===93){U--,k.lastIndex=Y+1;continue}if($===123){J++,k.lastIndex=Y+1;continue}if($===125){if(J--,J<=0&&H<=0&&U<=0){j=Y+1;return}k.lastIndex=Y+1;continue}if($===59&&J===0&&H===0&&U===0){j=Y+1;return}if(($===10||$===13)&&J===0&&H===0&&U===0){if(j=Y,a())return}k.lastIndex=Y+1}j=V}function Nj(){A(123,125);while(j<V&&y(Z.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<V&&y(Z.charCodeAt(j)))j++;if(j<V){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<V&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<V&&Z.charCodeAt(j)===59)j++}function Rj(){j++;while(j<V&&y(Z.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<V&&y(Z.charCodeAt(j)))j++;f();while(j<V&&y(Z.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<V&&y(Z.charCodeAt(j)))j++;if(j<V){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<V&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<V&&Z.charCodeAt(j)===59)j++}function Uj(J){let H=J.indexOf("from ");if(H===-1)return;let U=H+5;while(U<J.length&&(J.charCodeAt(U)===32||J.charCodeAt(U)===9))U++;if(U>=J.length)return;let X=J.charCodeAt(U);if(X!==39&&X!==34)return;let Y=J.indexOf(J[U],U+1);if(Y===-1)return;return J.slice(U+1,Y)}function C(J){if(!c)return;let H=J-1;while(H>=0&&y(Z.charCodeAt(H)))H--;if(H<0)return;let U=[],X=!1;while(H>=0){if(H>=1&&Z.charCodeAt(H)===47&&Z.charCodeAt(H-1)===42){let G=Z.lastIndexOf("/*",H-2);if(G>=0){U.push(Z.slice(G,H+1)),X=!0,H=G-1;while(H>=0&&y(Z.charCodeAt(H)))H--;continue}break}let Y=H;while(Y>0&&Z.charCodeAt(Y-1)!==10)Y--;let $=v(Y,H+1);if($.startsWith("//")){if(X)break;let G=[$];H=Y-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--;while(H>=0){let B=H;while(B>0&&Z.charCodeAt(B-1)!==10)B--;let Q=v(B,H+1);if(Q.startsWith("//")){G.push(Q),H=B-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else if(Q===""){H=B-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else break}G.reverse(),U.push(G.join(`
8
+ `));continue}break}if(U.length===0)return;return U.reverse(),U}function Sj(J){let H=J,U=!1;while(j<V){let Q=Z.charCodeAt(j);if(Q===59){j++;break}if(Q===39||Q===34){h(Q),U=!0;while(j<V&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<V&&Z.charCodeAt(j)===59)j++;break}if(Q===10&&U)break;j++}let X=v(H,j),Y=X.charCodeAt(7)===116&&(X.startsWith("import type ")||X.startsWith("import type{")),$=!1;{let Q=6;while(Q<X.length&&(X.charCodeAt(Q)===32||X.charCodeAt(Q)===9))Q++;if(Q<X.length&&X.charCodeAt(Q)===116&&X.startsWith("type",Q)){Q+=4;while(Q<X.length&&(X.charCodeAt(Q)===32||X.charCodeAt(Q)===9))Q++}if(Q<X.length){let K=X.charCodeAt(Q);$=K===39||K===34}}let G="";{let Q=X.indexOf("from ");if(Q!==-1){let K=Q+5;while(K<X.length&&(X.charCodeAt(K)===32||X.charCodeAt(K)===9))K++;if(K<X.length){let F=X.charCodeAt(K);if(F===39||F===34){let N=X.indexOf(String.fromCharCode(F),K+1);if(N!==-1)G=X.slice(K+1,N)}}}else if($){let K=6;while(K<X.length&&X.charCodeAt(K)!==39&&X.charCodeAt(K)!==34)K++;if(K<X.length){let F=X.charCodeAt(K),N=X.indexOf(String.fromCharCode(F),K+1);if(N!==-1)G=X.slice(K+1,N)}}}let B=C(H);return{kind:"import",name:"",text:X,isExported:!1,isTypeOnly:Y,isSideEffect:$,source:G,leadingComments:B,start:H,end:j}}function Yj(){let J=j;return A(123,125),Z.slice(J,j)}function _j(J){let H=J.indexOf("(");if(H===-1)return J;let U=J.slice(H);if(U.indexOf("=")===-1)return J;let X=!1;for(let Q=0;Q<U.length;Q++)if(U.charCodeAt(Q)===61){let F=Q>0?U.charCodeAt(Q-1):0,N=Q+1<U.length?U.charCodeAt(Q+1):0;if(F!==61&&F!==33&&F!==60&&F!==62&&N!==61&&N!==62){X=!0;break}}if(!X)return J;let Y=0,$=-1;for(let Q=H;Q<J.length;Q++){let K=J.charCodeAt(Q);if(K===40)Y++;else if(K===41){if(Y--,Y===0){$=Q;break}}}if($===-1)return J;let G=J.slice(H,$+1),B=n(G);return J.slice(0,H)+B+J.slice($+1)}function gj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,U=J.split(`
9
+ `),X=[],Y=[],$=[],G=!1,B=1/0;for(let F=0;F<U.length;F++){let N=U[F];if(H){if(G){if(N.includes("*/"))G=!1;continue}let _=N.trim();if(_.length===0)continue;let g=_.charCodeAt(0);if(g===47){let w=_.charCodeAt(1);if(w===47)continue;if(w===42){if(!_.includes("*/"))G=!0;continue}}if(g===42)continue;let q=Ij(N);if(q.charCodeAt(q.length-1)===59)q=q.slice(0,-1);q=_j(q);let R=q.trim();if(!R)continue;X.push(q),Y.push(R);let M=0;while(M<q.length&&y(q.charCodeAt(M)))M++;if(R!=="{"&&R!=="}"){if(M<B)B=M}$.push(M)}else{let _=N.length;while(_>0&&(N.charCodeAt(_-1)===32||N.charCodeAt(_-1)===9||N.charCodeAt(_-1)===13))_--;if(_===0)continue;let g=_<N.length?N.slice(0,_):N;if(g.charCodeAt(g.length-1)===59)g=g.slice(0,-1);g=_j(g);let q=g.trim();if(!q)continue;X.push(g),Y.push(q);let R=0;while(R<g.length&&y(g.charCodeAt(R)))R++;if(q!=="{"&&q!=="}"){if(R<B)B=R}$.push(R)}}if(X.length===0)return"{}";if(B===1/0||B<=2)return X.join(`
10
+ `);let Q=B-2,K=Array(X.length);for(let F=0;F<X.length;F++){let N=Y[F];if(N==="{"){K[F]=N;continue}let _=$[F];if(_>B)K[F]=X[F];else if(_===B&&(N.charCodeAt(0)===125||N.charCodeAt(0)===93||N.charCodeAt(0)===41))K[F]=X[F];else{let g=Math.max(0,_-Q);K[F]=" ".repeat(g)+N}}return K.join(`
11
+ `)}function u(){if(j>=V||Z.charCodeAt(j)!==60)return"";let J=j;A(60,62);let H=Z.slice(J,j);if(H.includes(`
12
+ `)){let U="",X=!1;for(let Y=0;Y<H.length;Y++){let $=H.charCodeAt(Y);if($===32||$===9||$===10||$===13){if(!X&&U.length>0)U+=" ",X=!0}else U+=H[Y],X=!1}if(U.charCodeAt(1)===32)U=`<${U.slice(2)}`;if(U.charCodeAt(U.length-2)===32)U=`${U.slice(0,-2)}>`;return U}return H}function m(){if(j>=V||Z.charCodeAt(j)!==40)return"()";let J=j;return A(40,41),Z.slice(J,j)}function n(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
13
+ `)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let Q=0,K=0,F=0;for(let N=0;N<H.length;N++){let _=H.charCodeAt(N);if(_===40||_===60||_===123)F++;else if(_===41||_===62||_===125)F--;else if(F===0){if(_===58)Q++;else if(_===44)K++}}if(Q>=K+1){let N=!1;for(let _=0;_<qj.length;_++){let g=qj[_],q=H.indexOf(g);if(q!==-1){let R=q+g.length;if((q===0||!W(H.charCodeAt(q-1)))&&(R>=H.length||!W(H.charCodeAt(R)))){N=!0;break}}}if(!N)return J}}let U=[],X=0,Y=0,$=!1,G=0;for(let Q=0;Q<=H.length;Q++){if(Q===H.length){U.push(H.slice(X).trim());break}let K=H.charCodeAt(Q);if($){if(K===92){Q++;continue}if(K===G)$=!1;continue}if(K===47&&Q+1<H.length){let F=H.charCodeAt(Q+1);if(F===42){Q+=2;while(Q+1<H.length&&!(H.charCodeAt(Q)===42&&H.charCodeAt(Q+1)===47))Q++;Q++;continue}if(F===47){while(Q<H.length&&H.charCodeAt(Q)!==10)Q++;continue}}if(K===39||K===34||K===96){$=!0,G=K;continue}if(K===40||K===123||K===91||K===60)Y++;else if(K===41||K===125||K===93||K===62&&!(Q>0&&H.charCodeAt(Q-1)===61))Y--;else if(K===44&&Y===0)U.push(H.slice(X,Q).trim()),X=Q+1}let B=[];for(let Q of U){if(!Q)continue;let K=Q.trim();if(K.startsWith("//")||K.startsWith("/*"))continue;let F=Q;{let N=!1,_=0,g=0,q=0;for(let R=0;R<F.length-1;R++){let M=F.charCodeAt(R);if(M===10){q=R+1;continue}if(N){if(M===92){R++;continue}if(M===_)N=!1;continue}if(M===39||M===34||M===96){N=!0,_=M;continue}if(M===123||M===91||M===40||M===60){g++;continue}if(M===125||M===93||M===41||M===62){if(g>0)g--;continue}if(M===47&&F.charCodeAt(R+1)===47){if(g===0){F=F.slice(0,R).trimEnd();break}let w=F.indexOf(`
14
+ `,R);if(w===-1){F=F.slice(0,q).trimEnd();break}let s=F.slice(0,q),hj=F.slice(w+1);F=`${s}${hj}`,R=q-1}}}if(!F.trim())continue;B.push(Lj(F))}return`(${B.join(", ")})`}function Wj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",U=0,X=0,Y=!1,$=0;while(U<J.length){let G=J.charCodeAt(U);if(Y){if(G===92&&U+1<J.length){H+=J[U]+J[U+1],U+=2;continue}if(G===$)Y=!1;H+=J[U],U++;continue}if(G===47&&U+1<J.length){let B=J.charCodeAt(U+1);if(B===42){let Q=U;U+=2;while(U+1<J.length&&!(J.charCodeAt(U)===42&&J.charCodeAt(U+1)===47))U++;U=Math.min(U+2,J.length),H+=J.slice(Q,U);continue}if(B===47){let Q=U;while(U<J.length&&J.charCodeAt(U)!==10)U++;H+=J.slice(Q,U);continue}}if(G===39||G===34||G===96){Y=!0,$=G,H+=J[U],U++;continue}if(G===123||G===91||G===40)X++;else if(G===125||G===93||G===41)X--;if(X>=1&&G===61&&(U+1>=J.length||J.charCodeAt(U+1)!==61&&J.charCodeAt(U+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
15
+ `))H=H.slice(0,-1);U++;let B=0;while(U<J.length){let Q=J.charCodeAt(U);if(Q===39||Q===34||Q===96){let K=Q;U++;while(U<J.length){if(J.charCodeAt(U)===92){U+=2;continue}if(J.charCodeAt(U)===K){U++;break}U++}continue}if(Q===123||Q===91||Q===40)B++;else if(Q===125||Q===93||Q===41){if(B===0)break;B--}else if(Q===44&&B===0)break;U++}continue}if(X===1&&G===46&&U+2<J.length&&J.charCodeAt(U+1)===46&&J.charCodeAt(U+2)===46){U+=3;continue}H+=J[U],U++}return H}function Lj(J){let H=J.trim(),U=H.startsWith("...");if(U)H=H.slice(3).trim();while(H.startsWith("@")){let q=1;while(q<H.length&&W(H.charCodeAt(q)))q++;if(q<H.length&&H.charCodeAt(q)===40){let R=1;q++;while(q<H.length&&R>0){if(H.charCodeAt(q)===40)R++;else if(H.charCodeAt(q)===41)R--;q++}}H=H.slice(q).trim()}let X=!0;while(X){X=!1;for(let q of qj)if(H.startsWith(q)&&H.length>q.length&&!W(H.charCodeAt(q.length))){let R=H.slice(q.length).trim();if(R.charCodeAt(0)===58||R.charCodeAt(0)===63&&R.length>1&&R.charCodeAt(1)===58)break;H=R,X=!0;break}}let Y=-1,$=-1,G=0,B=!1,Q=0;for(let q=0;q<H.length;q++){let R=H.charCodeAt(q);if(B){if(R===92){q++;continue}if(R===Q)B=!1;continue}if(R===47&&q+1<H.length){let M=H.charCodeAt(q+1);if(M===42){q+=2;while(q+1<H.length&&!(H.charCodeAt(q)===42&&H.charCodeAt(q+1)===47))q++;q++;continue}if(M===47){while(q<H.length&&H.charCodeAt(q)!==10)q++;continue}}if(R===39||R===34||R===96){B=!0,Q=R;continue}if(R===40||R===123||R===91||R===60)G++;else if(R===41||R===125||R===93||R===62&&!(q>0&&H.charCodeAt(q-1)===61))G--;else if(G===0){if(R===58&&Y===-1)Y=q;else if(R===61&&$===-1&&(q===0||H.charCodeAt(q-1)!==61)&&(q+1>=H.length||H.charCodeAt(q+1)!==61&&H.charCodeAt(q+1)!==62))$=q}}let K,F,N=$!==-1;if(Y!==-1&&($===-1||Y<$))if(K=H.slice(0,Y).trim(),$!==-1)F=H.slice(Y+1,$).trim();else F=H.slice(Y+1).trim();else if($!==-1)K=H.slice(0,$).trim(),F=Zj(H.slice($+1).trim());else K=H,F="unknown";if(K=Wj(K),(K.startsWith("{")||K.startsWith("["))&&K.includes(`
16
+ `)){let q=K.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(q.length<=40)K=q;else K=K.split(`
17
+ `).map((M)=>{let w=M.trim();if(!w)return"";if(w==="{"||w==="}"||w==="["||w==="]"||w.startsWith("}")||w.startsWith("]"))return w;return` ${w}`}).join(`
18
+ `)}let _=K.endsWith("?")||N;if(K.endsWith("?"))K=K.slice(0,-1).trim();let g=_&&!U?"?":"";if(U)return`...${K}: ${F}`;return`${K}${g}: ${F}`}function Mj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let U=J.charCodeAt(H);if(U<48||U>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Zj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Mj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function $j(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Mj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Qj(J){if(J.endsWith("as const"))return null;let H=0,U=-1;for(let Y=0;Y<J.length;Y++){let $=J.charCodeAt(Y);if($===123||$===91||$===40)H++;else if($===125||$===93||$===41)H--;else if(H===0&&$===32&&Y+4<=J.length&&J.substring(Y,Y+4)===" as ")U=Y}if(U===-1)return null;return J.slice(U+4).trim()||null}function jj(){if(O(),j<V&&Z.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<V){if(E())continue;let U=Z.charCodeAt(j);if(U===40||U===91||U===60)H++;else if(U===41||U===93||U===62&&!S())H--;else if(U===123)if(H>0)H++;else{let X=v(J,j),Y=($)=>{let G=X.length-$.length;return G>=0&&X.endsWith($)&&(G===0||!W(X.charCodeAt(G-1)))};if(X.length===0||X.endsWith("|")||X.endsWith("&")||Y("is")||Y("extends"))H++;else break}else if(U===125){if(H===0)break;H--}else if(H===0&&U===59)break;if(H===0&&e())break;j++}return v(J,j)}return""}function d(J,H,U,X){j+=8,O();let Y=j<V&&Z.charCodeAt(j)===42;if(Y)j++,O();let $=f();if(!$&&!X)return null;O();let G=u();O();let B=m();O();let Q=jj();if(!Q)if(U&&Y)Q="AsyncGenerator<unknown, void, unknown>";else if(Y)Q="Generator<unknown, void, unknown>";else if(U)Q="Promise<void>";else Q="void";O();let K=!1;if(j<V&&Z.charCodeAt(j)===123)K=!0,A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;let F=n(B),N=`${H?"export ":""}declare function ${$||"default"}${G}${F}: ${Q};`,_=C(J);if(K)x.add(L.length);return{kind:"function",name:$||"default",text:N,isExported:H,isDefault:X,isAsync:U,isGenerator:Y,returnType:Q,generics:G||void 0,leadingComments:_,start:J,end:j}}function r(J,H,U){j+=H.length,O();let X=[];do{if(O(),j>=V)break;let Y=Z.charCodeAt(j);if(Y===123||Y===91)return I(),X;let $=f();if(!$)return I(),X;O();let G,B,Q=!1;if(j<V&&Z.charCodeAt(j)===58){j++,O();let N=j,_=0;while(j<V){if(E())continue;let g=Z.charCodeAt(j);if(g===40||g===123||g===91||g===60)_++;else if(g===41||g===125||g===93||g===62&&!S())_--;else if(_===0&&(g===59||g===44))break;else if(_===0&&g===61&&!Xj())break;if(_===0&&a())break;j++}G=v(N,j)}if(j<V&&Z.charCodeAt(j)===61)if(b&&G&&!lj(G))I();else{j++,O();let N=j,_=0,g=0;while(j<V){if(E())continue;let q=Z.charCodeAt(j);if(q===40||q===123||q===91)_++;else if(q===41||q===125||q===93)_--;else if(q===60&&_===0){if(j+1>=V||Z.charCodeAt(j+1)!==61)g++}else if(q===62&&_===0&&!S()){if(g>0&&(j+1>=V||Z.charCodeAt(j+1)!==61))g--}else if(_===0&&g===0&&(q===59||q===44))break;if(_===0&&g===0&&a())break;j++}if(B=v(N,j),B.endsWith(" as const")||B==="const"){if(Q=!0,!G){let q=B.endsWith(" as const")?B.slice(0,-9).trim():B,R=$j(q);G=R!=="unknown"?R:void 0}}else if(!G){let q=Qj(B);if(q)G=q}}if(j<V){let N=Z.charCodeAt(j);if(N===44){j++;continue}if(N===59)j++}let K=C(J),F=`${U?"export ":""}declare ${H} ${$}: ${G||"unknown"};`;X.push({kind:"variable",name:$,text:F,isExported:U,typeAnnotation:G,value:B,modifiers:Q?[H,"const assertion"]:[H],leadingComments:K,start:J,end:j});break}while(j<V);return X}function Kj(J,H){j+=9,O();let U=f();O();let X=u();O();let Y="";if(z("extends")){j+=7,O();let K=j,F=0;while(j<V){if(E())continue;let N=Z.charCodeAt(j);if(N===60)F++;else if(N===62&&!S())F--;else if(N===123&&F===0)break;j++}Y=v(K,j)}O();let $=j<V&&Z.charCodeAt(j)===123?Yj():"{}",G=gj($),B=`${H?"export ":""}declare interface ${U}${X}${Y?` extends ${Y}`:""} ${G}`,Q=C(J);return{kind:"interface",name:U,text:B,isExported:H,extends:Y||void 0,generics:X||void 0,leadingComments:Q,start:J,end:j}}function Vj(J,H){j+=4,O();let U=f();O();let X=u();if(O(),j<V&&Z.charCodeAt(j)===61)j++;O();let Y=j,$=0;while(j<V){if(E())continue;let K=Z.charCodeAt(j);if(K===40||K===123||K===91||K===60)$++;else if(K===41||K===125||K===93||K===62&&!S())$--;else if($===0&&K===59)break;if($===0&&a())break;j++}let G=v(Y,j);if(j<V&&Z.charCodeAt(j)===59)j++;let B=`${H?"export ":""}type ${U}${X} = ${G}`,Q=C(J);return{kind:"type",name:U,text:B,isExported:H,generics:X||void 0,leadingComments:Q,start:J,end:j}}function i(J,H,U){j+=4,O();let X=f();O();let Y=j;if(j<V&&Z.charCodeAt(j)===123)A(123,125);let $=v(J,j),G=C(J);return{kind:"enum",name:X,text:$,isExported:H,modifiers:U?["const"]:void 0,leadingComments:G,start:J,end:j}}function p(J,H,U){j+=5,O();let X=f()||"AnonymousClass";O();let Y=u();O();let $="";if(z("extends")){j+=7,O();let F=j,N=0;while(j<V){if(E())continue;let _=Z.charCodeAt(j);if(_===60)N++;else if(_===62&&!S())N--;else if(N===0&&(_===123||z("implements")))break;j++}$=v(F,j)}let G;if(z("implements")){j+=10,O();let F=j,N=0;while(j<V){if(E())continue;let g=Z.charCodeAt(j);if(g===60)N++;else if(g===62&&!S())N--;else if(N===0&&g===123)break;j++}let _=v(F,j);if(_)G=_.split(",").map((g)=>g.trim())}O();let B=zj(),Q=`${H?"export ":""}declare ${U?"abstract ":""}class ${X}${Y}${$?` extends ${$}`:""}${G&&G.length>0?` implements ${G.join(", ")}`:""} ${B}`,K=C(J);return{kind:"class",name:X,text:Q,isExported:H,extends:$||void 0,implements:G,generics:Y||void 0,modifiers:U?["abstract"]:void 0,leadingComments:K,start:J,end:j}}function zj(){if(j>=V||Z.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<V){if(O(),j>=V)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}if(z("static")&&Dj("static")===123){j+=6,O(),A(123,125);continue}let H=!1,U=!1,X=!1,Y=!1,$=!1,G=!1,B=!1,Q=!1,K=!0;while(K){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){U=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){X=!0,j+=6;continue}if(z("abstract")){Y=!0,j+=8;continue}if(z("readonly")){$=!0,j+=8;continue}if(z("override")){G=!0,j+=8;continue}if(z("accessor")){B=!0,j+=8;continue}if(z("async")){Q=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=V||Z.charCodeAt(j)===125)break;if(Z.charCodeAt(j)===35)H=!0;if(H){Fj();continue}let F=" ";if(U)F+="protected ";if(X)F+="static ";if(Y)F+="abstract ";if($)F+="readonly ";if(z("constructor")){j+=11,O();let N=m();if(O(),uj(N,J),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;let _=n(N);J.push(` constructor${_};`)}else if(z("get"))if(j+=3,O(),j<V&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let N=Oj();if(N.startsWith("#")){if(O(),j<V&&Z.charCodeAt(j)===40)m();if(O(),jj(),O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;continue}O(),m(),O();let _=jj()||"unknown";if(O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;J.push(`${F}get ${N}(): ${_};`)}else Pj("get",F,X,$,Q,J);else if(z("set"))if(j+=3,O(),j<V&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let N=Oj();if(N.startsWith("#")){if(O(),j<V&&Z.charCodeAt(j)===40)m();if(O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;continue}O();let _=m();if(O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;let g=n(_);J.push(`${F}set ${N}${g};`)}else Pj("set",F,X,$,Q,J);else{let N=Z.charCodeAt(j)===42;if(N)j++,O();let _=Oj();if(!_){Fj();continue}bj(_,F,X,$,N,Y,Q,J)}}return`{
19
+ ${J.join(`
20
+ `)}
21
+ }`}function Oj(){if(j>=V)return"";let J=Z.charCodeAt(j);if(J===91){let H=j;return A(91,93),Z.slice(H,j)}if(J===35)return j++,`#${f()}`;return f()}function Dj(J){let H=j+J.length;while(H<V&&y(Z.charCodeAt(H)))H++;return H<V?Z.charCodeAt(H):0}function Fj(){let J=0;while(j<V){if(E())continue;let H=Z.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&e())return;j++}}function Pj(J,H,U,X,Y,$){bj(J,H,U,X,!1,!1,Y,$)}function bj(J,H,U,X,Y,$,G,B){if(O(),j>=V)return;let Q=Z.charCodeAt(j),K=!1;if(Q===63)K=!0,j++,O();if(j<V&&Z.charCodeAt(j)===33)j++,O();let F=j<V?Z.charCodeAt(j):0;if(F===40||F===60){let N=F===60?u():"";O();let _=m();O();let g=jj();if(!g)if(G&&Y)g="AsyncGenerator<unknown, void, unknown>";else if(Y)g="Generator<unknown, void, unknown>";else if(G)g="Promise<void>";else g="void";if(O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;let q=n(_),R=K?"?":"",M=Y?"*":"";B.push(`${H}${M}${J}${R}${N}${q}: ${g};`)}else if(F===58||F===61||F===59||F===125||F===10||F===13){let N="";if(F===58){j++,O();let q=j,R=0;while(j<V){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91||M===60)R++;else if(M===41||M===125||M===93||M===62&&!S()){if(R===0)break;R--}else if(R===0&&(M===59||M===44))break;else if(R===0&&M===61&&!Xj())break;if(R===0&&e())break;j++}N=v(q,j)}let _="";if(j<V&&Z.charCodeAt(j)===61)if(b&&N){j++;let q=0;while(j<V){if(E())continue;let R=Z.charCodeAt(j);if(R===40||R===123||R===91)q++;else if(R===41||R===125||R===93){if(q===0&&R===125)break;q--}else if(q===0&&R===59)break;if(q===0&&e())break;j++}}else{j++,O();let q=j,R=0;while(j<V){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91)R++;else if(M===41||M===125||M===93){if(R===0&&M===125)break;R--}else if(R===0&&M===59)break;if(R===0&&e())break;j++}_=v(q,j)}if(j<V&&Z.charCodeAt(j)===59)j++;if(!N)if(_){let q=Qj(_);if(q)N=q;else N=U&&X?$j(_):Zj(_)}else N="unknown";let g=K?"?":"";B.push(`${H}${J}${g}: ${N};`)}else Fj()}function uj(J,H){let U=J.slice(1,-1).trim();if(!U)return;let X=[],Y=0,$=0,G=!1,B=0;for(let Q=0;Q<=U.length;Q++){if(Q===U.length){X.push(U.slice(Y).trim());break}let K=U.charCodeAt(Q);if(G){if(K===92){Q++;continue}if(K===B)G=!1;continue}if(K===39||K===34||K===96){G=!0,B=K;continue}if(K===40||K===123||K===91||K===60)$++;else if(K===41||K===125||K===93||K===62&&!(Q>0&&U.charCodeAt(Q-1)===61))$--;else if(K===44&&$===0)X.push(U.slice(Y,Q).trim()),Y=Q+1}for(let Q of X){let K=Q.startsWith("public ")||Q.startsWith("public\t"),F=Q.startsWith("protected ")||Q.startsWith("protected\t"),N=Q.startsWith("private ")||Q.startsWith("private\t"),_=Q.includes("readonly ");if(!K&&!F&&!N&&!_)continue;if(N)continue;let g=Q,q=[];if(K){let w=6;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("public")}if(F){let w=9;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("protected")}if(_){let w=g.indexOf("readonly ");if(w!==-1){let s=w+8;while(s<g.length&&y(g.charCodeAt(s)))s++;g=g.slice(0,w)+g.slice(s)}q.push("readonly")}let R=q.length>0?`${q.join(" ")} `:"",M=Lj(g);H.push(` ${R}${M};`)}}function Gj(J=" "){if(j>=V||Z.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<V){if(O(),j>=V)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}let U=!1;if(z("export"))U=!0,j+=6,O();if(z("declare"))j+=7,O();let X=U?"export ":"";if(z("function")||z("async")&&xj("async","function")){let Y=!1;if(z("async"))Y=!0,j+=5,O();if(j+=8,O(),j<V&&Z.charCodeAt(j)===42)j++,O();let G=f();O();let B=u();O();let Q=m();O();let K=jj();if(!K)K=Y?"Promise<void>":"void";if(O(),j<V&&Z.charCodeAt(j)===123)A(123,125);else if(j<V&&Z.charCodeAt(j)===59)j++;let F=n(Q);H.push(`${J}${X}function ${G}${B}${F}: ${K};`)}else if(z("const")||z("let")||z("var")){let Y=z("const")?"const":z("let")?"let":"var";j+=Y.length,O();let $=f();if(!$){I();continue}O();let G="";if(j<V&&Z.charCodeAt(j)===58){j++,O();let Q=j,K=0;while(j<V){if(E())continue;let F=Z.charCodeAt(j);if(F===40||F===123||F===91||F===60)K++;else if(F===41||F===125||F===93||F===62&&!S())K--;else if(K===0&&(F===59||F===44))break;else if(K===0&&F===61&&!Xj())break;if(K===0&&a())break;j++}G=v(Q,j)}let B="";if(j<V&&Z.charCodeAt(j)===61){j++,O();let Q=j,K=0;while(j<V){if(E())continue;let F=Z.charCodeAt(j);if(F===40||F===123||F===91||F===60)K++;else if(F===41||F===125||F===93||F===62&&!S())K--;else if(K===0&&(F===59||F===44))break;if(K===0&&a())break;j++}B=v(Q,j)}if(j<V&&Z.charCodeAt(j)===59)j++;if(!G&&B){let Q=Qj(B);if(Q)G=Q;else if(Y==="const")G=$j(B);else G=Zj(B)}if(!G)G="unknown";H.push(`${J}${X}${Y} ${$}: ${G};`)}else if(z("interface")){j+=9,O();let Y=f();O();let $=u();O();let G="";if(z("extends")){let Q=j;while(j<V&&Z.charCodeAt(j)!==123){if(E())continue;j++}G=Z.slice(Q,j)}let B=gj(Yj());H.push(`${J}${X}interface ${Y}${$}${G} ${B}`)}else if(z("type")){j+=4,O();let Y=f();O();let $=u();if(O(),j<V&&Z.charCodeAt(j)===61){j++,O();let G=j,B=0;while(j<V){if(E())continue;let K=Z.charCodeAt(j);if(K===40||K===123||K===91||K===60)B++;else if(K===41||K===125||K===93||K===62&&!S())B--;else if(B===0&&K===59)break;if(B===0&&a())break;j++}let Q=v(G,j);if(j<V&&Z.charCodeAt(j)===59)j++;H.push(`${J}${X}type ${Y}${$} = ${Q}`)}}else if(z("class")){j+=5,O();let Y=f();O();let $=u();O();let G=j;while(j<V&&Z.charCodeAt(j)!==123){if(E())continue;j++}let B=v(G,j),Q=B?` ${B}`:"",K=zj();H.push(`${J}${X}class ${Y}${$}${Q} ${K}`)}else if(z("enum")){j+=4,O();let Y=f();O();let $=Yj();H.push(`${J}${X}enum ${Y} ${$}`)}else if(z("namespace")||z("module")){let Y=z("namespace")?"namespace":"module";j+=Y.length,O();let $=f();O();let G=Gj(J);H.push(`${J}${X}${Y} ${$} ${G}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Y=f();O();let $=u();O();let G=j;while(j<V&&Z.charCodeAt(j)!==123){if(E())continue;j++}let B=v(G,j),Q=B?` ${B}`:"",K=zj();H.push(`${J}${X}abstract class ${Y}${$}${Q} ${K}`)}else I();else if(U&&z("default")){j+=7,O();let Y=j;I();let $=v(Y,j);if($.charCodeAt($.length-1)===59)$=$.slice(0,-1);if($)H.push(`${J}export default ${$};`)}else if(!U&&(Z.charCodeAt(j)===39||Z.charCodeAt(j)===34||Z.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
22
+ ${H.join(`
23
+ `)}
24
+ }`}function xj(J,H){let U=j+J.length;while(U<V&&y(Z.charCodeAt(U)))U++;for(let X=0;X<H.length;X++)if(U+X>=V||Z.charCodeAt(U+X)!==H.charCodeAt(X))return!1;return U+H.length>=V||!W(Z.charCodeAt(U+H.length))}function o(J,H,U){j+=U.length,O();let X="",Y=Z.charCodeAt(j);if(Y===39||Y===34){let K=j;h(Y),X=Z.slice(K,j)}else{X=f();while(j<V&&Z.charCodeAt(j)===46)j++,X+=`.${f()}`}O();let $=j<V&&Z.charCodeAt(j)===123?Gj():"{}",G=`${H?"export ":""}declare ${U} ${X} ${$}`,B=C(J),Q=X.startsWith("'")||X.startsWith('"');return{kind:"module",name:X,text:G,isExported:H,source:Q?X.slice(1,-1):void 0,leadingComments:B,start:J,end:j}}while(j<V){if(O(),j>=V)break;let J=j,H=Z.charCodeAt(j);if(H===105&&z("import"))L.push(Sj(J));else if(H===101&&z("export")){j+=6,O();let U=Z.charCodeAt(j);if(U===100&&z("default")){j+=7,O();let X=Z.charCodeAt(j);if(X===102&&z("function")){let Y=d(J,!0,!1,!0);if(Y)L.push(Y)}else if(X===97&&z("async")&&Dj("async")!==59)if(j+=5,O(),z("function")){let Y=d(J,!0,!0,!0);if(Y)L.push(Y)}else{I();let Y=v(J,j);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(X===99&&z("class")){let Y=p(J,!0,!1);L.push(Y)}else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let Y=p(J,!0,!0);L.push(Y)}}else{I();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,leadingComments:$,start:J,end:j})}}else if(U===116&&z("type")){let X=j;if(j+=4,O(),j<V&&Z.charCodeAt(j)===123){Nj();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),leadingComments:$,start:J,end:j})}else if(j<V&&Z.charCodeAt(j)===42){Rj();let Y=v(J,j);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),start:J,end:j})}else{j=X;let Y=Vj(J,!0);L.push(Y)}}else if(U===105&&z("interface")){let X=Kj(J,!0);L.push(X)}else if(U===102&&z("function")){let X=d(J,!0,!1,!1);if(X)L.push(X)}else if(U===97&&z("async"))if(j+=5,O(),z("function")){let X=d(J,!0,!0,!1);if(X)L.push(X)}else I();else if(U===99)if(z("class")){let X=p(J,!0,!1);L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let Y=i(J,!0,!0);L.push(Y)}else{j=X;let Y=r(J,"const",!0);for(let $=0;$<Y.length;$++)L.push(Y[$])}}else I();else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let X=p(J,!0,!0);L.push(X)}}else if(U===108&&z("let")){let X=r(J,"let",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===118&&z("var")){let X=r(J,"var",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===101&&z("enum")){let X=i(J,!0,!1);L.push(X)}else if(U===100&&z("declare"))j+=7,O(),wj(J,!0);else if(U===110&&z("namespace")&&Jj(9)){let X=o(J,!0,"namespace");L.push(X)}else if(U===109&&z("module")&&Jj(6)){let X=o(J,!0,"module");L.push(X)}else if(U===123){Nj();let X=v(J,j),Y=X.includes("export type"),$=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:Y,source:Uj(X),leadingComments:$,start:J,end:j})}else if(U===42){Rj();let X=v(J,j),Y=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:!1,source:Uj(X),leadingComments:Y,start:J,end:j})}else{I();let X=v(J,j);if(X)L.push({kind:"export",name:"",text:X,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),wj(J,!1);else if(H===105&&z("interface")){let U=Kj(J,!1);P.set(U.name,U)}else if(H===116&&z("type")){let U=Vj(J,!1);P.set(U.name,U),L.push(U)}else if(H===102&&z("function")){let U=d(J,!1,!1,!1);if(U)P.set(U.name,U);else I()}else if(H===97)if(z("async")){let U=j;if(j+=5,O(),z("function")){let X=d(J,!1,!0,!1);if(X)P.set(X.name,X);else j=U,I()}else j=U,I()}else if(z("abstract"))if(j+=8,O(),z("class")){let U=p(J,!1,!1);P.set(U.name,U),L.push(U)}else I();else j++,I();else if(H===99)if(z("class")){let U=p(J,!1,!1);P.set(U.name,U),L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,!1,!0);P.set(X.name,X),L.push(X)}else{j=U;let X=r(J,"const",!1);for(let Y=0;Y<X.length;Y++)P.set(X[Y].name,X[Y])}}else j++,I();else if(H===101&&z("enum")){let U=i(J,!1,!1);P.set(U.name,U),L.push(U)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")&&Jj(6)){let U=o(J,!1,"module");L.push(U)}else if(H===110&&z("namespace")&&Jj(9)){let U=o(J,!1,"namespace");L.push(U)}else{let U=Z.charCodeAt(j);if(U===39||U===34){if(h(U),j<V&&Z.charCodeAt(j)===59)j++}else if(U===96){if(t(),j<V&&Z.charCodeAt(j)===59)j++}else if(U===64){if(j++,f(),O(),j<V&&Z.charCodeAt(j)===46)j++,f(),O();if(j<V&&Z.charCodeAt(j)===40)A(40,41)}else j++,I()}}if(P.size>0)mj(L,P);if(x.size>0){let J=new Map;for(let U of L)if(U.kind==="function")J.set(U.name,(J.get(U.name)||0)+1);let H=new Set;for(let[U,X]of J)if(X>1)H.add(U);if(H.size>0){let U=new Set;for(let X of H)for(let Y=L.length-1;Y>=0;Y--)if(L[Y].kind==="function"&&L[Y].name===X&&x.has(Y)){U.add(Y);break}if(U.size>0){let X=[...U].sort((Y,$)=>$-Y);for(let Y of X)L.splice(Y,1)}}}return L;function wj(J,H){if(z("function")){let U=d(J,H,!1,!1);if(U)L.push(U)}else if(z("async")){if(j+=5,O(),z("function")){let U=d(J,H,!0,!1);if(U)L.push(U)}}else if(z("class")){let U=p(J,H,!1);L.push(U)}else if(z("abstract")){if(j+=8,O(),z("class")){let U=p(J,H,!0);L.push(U)}}else if(z("interface")){let U=Kj(J,H);L.push(U)}else if(z("type")){let U=Vj(J,H);L.push(U)}else if(z("enum")){let U=i(J,H,!1);L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,H,!0);L.push(X)}else if(H){j=U;let X=r(J,"const",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I()}else if(z("let")||z("var"))if(H){let U=z("let")?"let":"var",X=r(J,U,!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I();else if(z("module")){let U=o(J,H,"module");L.push(U)}else if(z("namespace")){let U=o(J,H,"namespace");L.push(U)}else if(z("global")){j+=6,O();let X=`declare global ${j<V&&Z.charCodeAt(j)===123?Gj():"{}"}`,Y=C(J);L.push({kind:"module",name:"global",text:X,isExported:!1,leadingComments:Y,start:J,end:j})}else I()}}function vj(D,Hj){let T=0,l=D.length;while(T<l){let Z=D.charCodeAt(T);if(Z>=65&&Z<=90||Z>=97&&Z<=122||Z===95||Z===36||Z>127){let c=T;T++;while(T<l){let b=D.charCodeAt(T);if(b>=65&&b<=90||b>=97&&b<=122||b>=48&&b<=57||b===95||b===36||b>127)T++;else break}Hj.add(D.substring(c,T))}else T++}}function mj(D,Hj){let T=new Set,l=new Set;for(let b of D)l.add(b.name);let Z=new Set,c=[];for(let b=0;b<D.length;b++)if(D[b].kind!=="import")c.push(D[b].text),vj(D[b].text,Z);for(;;){let b=[];for(let[P,x]of Hj){if(T.has(P))continue;if(Z.has(P)){if(!l.has(P))b.push(x),l.add(P);T.add(P)}}if(b.length===0)break;b.sort((P,x)=>(P.start??1/0)-(x.start??1/0));let V=[],L=0;for(let P=0;P<D.length;P++){let x=D[P].start??1/0;while(L<b.length&&(b[L].start??1/0)<=x)V.push(b[L++]);V.push(D[P])}while(L<b.length)V.push(b[L++]);D.length=0;for(let P=0;P<V.length;P++)D.push(V[P]);for(let P of b)if(P.kind!=="import")c.push(P.text),vj(P.text,Z)}}
25
+ export{dj as oc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-f4c389mj.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-285mqzvx.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
2
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-fxh731yj.js";import"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-4jw8qvts.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{l as a,m as b,n as c,o as d,p as e,q as f,r as g}from"./chunk-mzq58nw0.js";import"./chunk-x3q42h61.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-4s9jv983.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
2
+ import{l as a,m as b,n as c,o as d,p as e,q as f,r as g}from"./chunk-zn70hw8f.js";import"./chunk-5qqybwef.js";import"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import"./chunk-gc9n9za8.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-mcdb3q06.js";var e="@stacksjs/dtsx",i="module",n="0.9.17",r=!0,o="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",c="MIT",p="https://github.com/stacksjs/dtsx#readme",d={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",g="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},k=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier .","lint:fix":"bunx --bun pickier . --fix",format:"bunx --bun pickier . --format","format:fix":"bunx --bun pickier . --format --write",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.4","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.20","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.11","@typescript/native-preview":"^7.0.0-dev.20260311.1","buddy-bot":"^0.9.18","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.121.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:o,author:u,license:c,homepage:p,repository:d,bugs:a,keywords:b,exports:m,module:l,types:g,bin:x,files:k,scripts:h,devDependencies:v,workspaces:j,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bunx --bun pickier lint --fix"}},"commit-msg":"bunx gitlint --edit .git/COMMIT_EDITMSG"}};export{j as workspaces,n as version,g as types,i as type,h as scripts,d as repository,r as private,e as name,l as module,c as license,b as keywords,p as homepage,k as files,m as exports,v as devDependencies,o as description,y as default,a as bugs,x as bin,u as author};
2
+ import"./chunk-mcdb3q06.js";var e="@stacksjs/dtsx",i="module",n="0.9.18",r=!0,o="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",c="MIT",p="https://github.com/stacksjs/dtsx#readme",d={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",g="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},k=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier .","lint:fix":"bunx --bun pickier . --fix",format:"bunx --bun pickier . --format","format:fix":"bunx --bun pickier . --format --write",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.4","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.20","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.11","@typescript/native-preview":"^7.0.0-dev.20260311.1","buddy-bot":"^0.9.18","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.121.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:o,author:u,license:c,homepage:p,repository:d,bugs:a,keywords:b,exports:m,module:l,types:g,bin:x,files:k,scripts:h,devDependencies:v,workspaces:j,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bunx --bun pickier lint --fix"}},"commit-msg":"bunx gitlint --edit .git/COMMIT_EDITMSG"}};export{j as workspaces,n as version,g as types,i as type,h as scripts,d as repository,r as private,e as name,l as module,c as license,b as keywords,p as homepage,k as files,m as exports,v as devDependencies,o as description,y as default,a as bugs,x as bin,u as author};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-x3q42h61.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
2
+ import{tb as I}from"./chunk-5qqybwef.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
3
3
  export{H as qa,K as ra,M as sa,Q as ta};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{oc as J}from"./chunk-2r21f44d.js";var S=typeof globalThis.Bun?.hash==="function";function z(B){if(S)return Bun.hash(B);let g=0;for(let T=0;T<B.length;T++){let p=B.charCodeAt(T);g=(g<<5)-g+p,g=g&g}return g}var U=100,G=0,f=new Map;function $(B,g,T=!0,p=!1){let b=z(B),j=`${g}:${T?1:0}:${p?1:0}`,w=f.get(j);if(w&&w.contentHash===b)return w.lastAccess=++G,w.declarations;let q=J(B,g,T,p);if(f.set(j,{declarations:q,contentHash:b,lastAccess:++G}),f.size>U){let Q=Math.max(1,Math.ceil(f.size*0.1)),x=[];for(let[u,F]of f)x.push([u,F.lastAccess]);x.sort((u,F)=>u[1]-F[1]);for(let u=0;u<Q&&u<x.length;u++)f.delete(x[u][0])}return q}function v(){f.clear()}
2
+ import{oc as J}from"./chunk-j0rnj1z0.js";var S=typeof globalThis.Bun?.hash==="function";function z(B){if(S)return Bun.hash(B);let g=0;for(let T=0;T<B.length;T++){let p=B.charCodeAt(T);g=(g<<5)-g+p,g=g&g}return g}var U=100,G=0,f=new Map;function $(B,g,T=!0,p=!1){let b=z(B),j=`${g}:${T?1:0}:${p?1:0}`,w=f.get(j);if(w&&w.contentHash===b)return w.lastAccess=++G,w.declarations;let q=J(B,g,T,p);if(f.set(j,{declarations:q,contentHash:b,lastAccess:++G}),f.size>U){let Q=Math.max(1,Math.ceil(f.size*0.1)),x=[];for(let[u,F]of f)x.push([u,F.lastAccess]);x.sort((u,F)=>u[1]-F[1]);for(let u=0;u<Q&&u<x.length;u++)f.delete(x[u][0])}return q}function v(){f.clear()}
3
3
  export{z as lc,$ as mc,v as nc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tb as c,ub as d,vb as e}from"./chunk-5qqybwef.js";import"./chunk-asnnmvct.js";import"./chunk-2n1bbm2c.js";import{ic as a,jc as b}from"./chunk-gc9n9za8.js";import"./chunk-wcdd51hr.js";import"./chunk-j0rnj1z0.js";import"./chunk-7pwy4m0c.js";import"./chunk-4jw8qvts.js";import"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{e as watch,a as processSource,d as processFile,c as generate,b as clearResultCache};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ec as _}from"./chunk-y581wnfe.js";import{existsSync as w,readFileSync as U,writeFileSync as q}from"fs";function Z(G){let j=[],J=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=J.exec(G))!==null){let K=L[1];if(!N(K))j.push(K)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function D(G,j){let J={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((H)=>H.trim()),K=j.extends.split(",").map((H)=>H.trim());J.extends=[...new Set([...L,...K])].join(", ")}else J.extends=G.extends||j.extends;return J}function F(G){let j={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...G].sort((J,L)=>{let K=j[J.kind]??99,H=j[L.kind]??99;if(K!==H)return K-H;return J.name.localeCompare(L.name)})}function k(G){let j=[],J=[];for(let K=0;K<G.length;K++){let H=G[K];if(H.kind==="import")j.push(H);else J.push(H)}return[...[...j].sort((K,H)=>{let M=K.source||"",O=H.source||"",Q=M.startsWith("node:")||M==="bun",V=O.startsWith("node:")||O==="bun";if(Q&&!V)return-1;if(!Q&&V)return 1;let X=!M.startsWith("."),W=!O.startsWith(".");if(X&&!W)return-1;if(!X&&W)return 1;return M.localeCompare(O)}),...J]}function R(G){let j=new Set;for(let K of G){if(K.kind==="import")continue;let H=K.text||"",M=K.typeAnnotation||"",O=K.returnType||"",Q=K.extends||"",V=K.implements?.join(" ")||"",X=`${H} ${M} ${O} ${Q} ${V}`;for(let W of Z(X))j.add(W);if(K.members)for(let W of K.members){let Y=`${W.typeAnnotation||""} ${W.returnType||""}`;for(let $ of Z(Y))j.add($)}if(K.parameters){for(let W of K.parameters)if(W.type)for(let Y of Z(W.type))j.add(Y)}}let J=0;return{declarations:G.map((K)=>{if(K.kind!=="import"||!K.specifiers)return K;let H=K.specifiers.filter((M)=>{let O=M.alias||M.name;return j.has(O)});if(H.length===0){if(!K.isSideEffect)return J++,null}if(H.length<(K.specifiers?.length||0))return J+=(K.specifiers?.length||0)-H.length,{...K,specifiers:H};return K}).filter((K)=>K!==null),removed:J}}function A(G){let j=new Map,J=0;for(let L of G){if(L.kind==="import"){let H=`import:${L.source}`;if(j.has(H)){let M=j.get(H),O=[...M.specifiers||[],...L.specifiers||[]],Q=Array.from(new Map(O.map((V)=>[V.alias||V.name,V])).values());j.set(H,{...M,specifiers:Q}),J++}else j.set(H,L);continue}let K=`${L.kind}:${L.name}`;if(j.has(K))J++;else j.set(K,L)}return{declarations:Array.from(j.values()),removed:J}}function z(G){let j=new Map,J=[];for(let H of G)if(H.kind==="interface"){let M=H.name;if(!j.has(M))j.set(M,[]);j.get(M).push(H)}else J.push(H);let L=0,K=[];for(let[H,M]of j)if(M.length>1){let O=M[0];for(let Q=1;Q<M.length;Q++)O=D(O,M[Q]),L++;K.push(O)}else K.push(M[0]);return{declarations:[...J,...K],merged:L}}function P(G){let j=new Map,J=new Set;for(let H of G)if(C(H))j.set(H.name,H.typeAnnotation||""),J.add(H.name);if(j.size===0)return{declarations:G,inlined:0};function L(H){let M=H;for(let[O,Q]of j){let V=new RegExp(`\\b${O}\\b`,"g");M=M.replace(V,Q)}return M}return{declarations:G.filter((H)=>H.kind!=="type"||!J.has(H.name)).map((H)=>{if(H.typeAnnotation)H={...H,typeAnnotation:L(H.typeAnnotation)};if(H.returnType)H={...H,returnType:L(H.returnType)};if(H.extends)H={...H,extends:L(H.extends)};return H}),inlined:j.size}}function v(G){let j=G.length,J=G.filter((L)=>!E(L));return{declarations:J,removed:j-J.length}}function B(G,j={}){let J=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:K,removed:H}=R(J);J=K,L.removedImports=H}if(j.deduplicateDeclarations){let{declarations:K,removed:H}=A(J);J=K,L.removedDeclarations+=H}if(j.mergeInterfaces){let{declarations:K,merged:H}=z(J);J=K,L.mergedInterfaces=H}if(j.removeEmptyInterfaces){let{declarations:K,removed:H}=v(J);J=K,L.removedDeclarations+=H}if(j.inlineSimpleTypes){let{declarations:K,inlined:H}=P(J);J=K,L.inlinedTypes=H}if(j.sortImports)J=k(J);if(j.sortDeclarations)J=F(J);return{declarations:J,result:L}}async function g(G,j={}){if(!w(G))throw Error(`File not found: ${G}`);let J=U(G,"utf-8"),L=Buffer.byteLength(J,"utf-8"),K=_(J,G,!j.removeComments),{declarations:H,result:M}=B(K,j),O=h(H,j);if(j.minify)O=x(O);let Q=Buffer.byteLength(O,"utf-8");return M.originalSize=L,M.optimizedSize=Q,M.savings=L-Q,M.savingsPercent=Math.round(M.savings/L*100),q(G,O),M}function h(G,j){let J=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let K of L.leadingComments)J.push(K);if(L.text)J.push(L.text);else J.push(S(L));J.push("")}return J.join(`
2
+ import{ec as _}from"./chunk-asnnmvct.js";import{existsSync as w,readFileSync as U,writeFileSync as q}from"fs";function Z(G){let j=[],J=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=J.exec(G))!==null){let K=L[1];if(!N(K))j.push(K)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function D(G,j){let J={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((H)=>H.trim()),K=j.extends.split(",").map((H)=>H.trim());J.extends=[...new Set([...L,...K])].join(", ")}else J.extends=G.extends||j.extends;return J}function F(G){let j={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...G].sort((J,L)=>{let K=j[J.kind]??99,H=j[L.kind]??99;if(K!==H)return K-H;return J.name.localeCompare(L.name)})}function k(G){let j=[],J=[];for(let K=0;K<G.length;K++){let H=G[K];if(H.kind==="import")j.push(H);else J.push(H)}return[...[...j].sort((K,H)=>{let M=K.source||"",O=H.source||"",Q=M.startsWith("node:")||M==="bun",V=O.startsWith("node:")||O==="bun";if(Q&&!V)return-1;if(!Q&&V)return 1;let X=!M.startsWith("."),W=!O.startsWith(".");if(X&&!W)return-1;if(!X&&W)return 1;return M.localeCompare(O)}),...J]}function R(G){let j=new Set;for(let K of G){if(K.kind==="import")continue;let H=K.text||"",M=K.typeAnnotation||"",O=K.returnType||"",Q=K.extends||"",V=K.implements?.join(" ")||"",X=`${H} ${M} ${O} ${Q} ${V}`;for(let W of Z(X))j.add(W);if(K.members)for(let W of K.members){let Y=`${W.typeAnnotation||""} ${W.returnType||""}`;for(let $ of Z(Y))j.add($)}if(K.parameters){for(let W of K.parameters)if(W.type)for(let Y of Z(W.type))j.add(Y)}}let J=0;return{declarations:G.map((K)=>{if(K.kind!=="import"||!K.specifiers)return K;let H=K.specifiers.filter((M)=>{let O=M.alias||M.name;return j.has(O)});if(H.length===0){if(!K.isSideEffect)return J++,null}if(H.length<(K.specifiers?.length||0))return J+=(K.specifiers?.length||0)-H.length,{...K,specifiers:H};return K}).filter((K)=>K!==null),removed:J}}function A(G){let j=new Map,J=0;for(let L of G){if(L.kind==="import"){let H=`import:${L.source}`;if(j.has(H)){let M=j.get(H),O=[...M.specifiers||[],...L.specifiers||[]],Q=Array.from(new Map(O.map((V)=>[V.alias||V.name,V])).values());j.set(H,{...M,specifiers:Q}),J++}else j.set(H,L);continue}let K=`${L.kind}:${L.name}`;if(j.has(K))J++;else j.set(K,L)}return{declarations:Array.from(j.values()),removed:J}}function z(G){let j=new Map,J=[];for(let H of G)if(H.kind==="interface"){let M=H.name;if(!j.has(M))j.set(M,[]);j.get(M).push(H)}else J.push(H);let L=0,K=[];for(let[H,M]of j)if(M.length>1){let O=M[0];for(let Q=1;Q<M.length;Q++)O=D(O,M[Q]),L++;K.push(O)}else K.push(M[0]);return{declarations:[...J,...K],merged:L}}function P(G){let j=new Map,J=new Set;for(let H of G)if(C(H))j.set(H.name,H.typeAnnotation||""),J.add(H.name);if(j.size===0)return{declarations:G,inlined:0};function L(H){let M=H;for(let[O,Q]of j){let V=new RegExp(`\\b${O}\\b`,"g");M=M.replace(V,Q)}return M}return{declarations:G.filter((H)=>H.kind!=="type"||!J.has(H.name)).map((H)=>{if(H.typeAnnotation)H={...H,typeAnnotation:L(H.typeAnnotation)};if(H.returnType)H={...H,returnType:L(H.returnType)};if(H.extends)H={...H,extends:L(H.extends)};return H}),inlined:j.size}}function v(G){let j=G.length,J=G.filter((L)=>!E(L));return{declarations:J,removed:j-J.length}}function B(G,j={}){let J=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:K,removed:H}=R(J);J=K,L.removedImports=H}if(j.deduplicateDeclarations){let{declarations:K,removed:H}=A(J);J=K,L.removedDeclarations+=H}if(j.mergeInterfaces){let{declarations:K,merged:H}=z(J);J=K,L.mergedInterfaces=H}if(j.removeEmptyInterfaces){let{declarations:K,removed:H}=v(J);J=K,L.removedDeclarations+=H}if(j.inlineSimpleTypes){let{declarations:K,inlined:H}=P(J);J=K,L.inlinedTypes=H}if(j.sortImports)J=k(J);if(j.sortDeclarations)J=F(J);return{declarations:J,result:L}}async function g(G,j={}){if(!w(G))throw Error(`File not found: ${G}`);let J=U(G,"utf-8"),L=Buffer.byteLength(J,"utf-8"),K=_(J,G,!j.removeComments),{declarations:H,result:M}=B(K,j),O=h(H,j);if(j.minify)O=x(O);let Q=Buffer.byteLength(O,"utf-8");return M.originalSize=L,M.optimizedSize=Q,M.savings=L-Q,M.savingsPercent=Math.round(M.savings/L*100),q(G,O),M}function h(G,j){let J=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let K of L.leadingComments)J.push(K);if(L.text)J.push(L.text);else J.push(S(L));J.push("")}return J.join(`
3
3
  `)}function S(G){let j=[];if(G.isExported)j.push("export");if(G.isDefault)j.push("default");switch(G.kind){case"import":if(G.isTypeOnly)j.push("import type");else j.push("import");if(G.specifiers&&G.specifiers.length>0){let J=G.specifiers.map((L)=>{let K=L.isType?"type ":"";return L.alias?`${K}${L.name} as ${L.alias}`:`${K}${L.name}`}).join(", ");j.push(`{ ${J} }`)}j.push("from"),j.push(`'${G.source}'`);break;case"function":if(j.push("declare function"),j.push(G.name),G.generics)j.push(G.generics);if(j.push(`(${I(G.parameters)})`),G.returnType)j.push(`: ${G.returnType}`);break;case"variable":if(j.push("declare const"),j.push(G.name),G.typeAnnotation)j.push(`: ${G.typeAnnotation}`);break;case"interface":if(j.push("interface"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(j.push("{"),G.members)for(let J of G.members)j.push(` ${J.name}${J.typeAnnotation?`: ${J.typeAnnotation}`:""}`);j.push("}");break;case"type":if(j.push("type"),j.push(G.name),G.generics)j.push(G.generics);j.push("="),j.push(G.typeAnnotation||"unknown");break;case"class":if(j.push("declare class"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(G.implements?.length)j.push(`implements ${G.implements.join(", ")}`);j.push("{ }");break;case"enum":j.push("declare enum"),j.push(G.name),j.push("{ }");break;default:return G.text||""}return j.join(" ")}function I(G){if(!G)return"";return G.map((j)=>{let J="";if(j.rest)J+="...";if(J+=j.name,j.optional)J+="?";if(j.type)J+=`: ${j.type}`;return J}).join(", ")}function x(G){return G.replace(/(?<!\/\*\*)\/\/[^\n]*/g,"").replace(/^\s*[\r\n]/gm,"").replace(/ {2,}/g," ").replace(/\s*([{}[\]();,:])\s*/g,"$1").replace(/(\w)(\{)/g,"$1 $2").replace(/(\})([a-z])/gi,"$1 $2").replace(/(export|import|type|interface|class|function|const|let|var|extends|implements|declare)\s*/g,"$1 ").trim()}
4
4
  export{B as a,g as b,x as c};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tb as y}from"./chunk-x3q42h61.js";import{Wc as H,Yc as F}from"./chunk-gssantc8.js";import{dd as R}from"./chunk-mcdb3q06.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,O){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let K=G(w,"utf-8"),Q=K.indexOf("//")!==-1||K.indexOf("/*")!==-1?K.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""):K,L=JSON.parse(Q),U=M(w),Y=B(U,O),W=[];if(L.references)for(let D of L.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(L.compilerOptions?.rootDir)Z=L.compilerOptions.rootDir;else if(L.include&&L.include.length>0){if(L.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(L.compilerOptions?.outDir)_=L.compilerOptions.outDir;else if(L.compilerOptions?.declarationDir)_=L.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(K){let Q=K instanceof Error?K.message:String(K);H.warn(`Failed to parse ${w}: ${Q}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),O=JSON.parse(I);if(O.name)return O.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function O(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let K=A.get(w);if(K){for(let Q of K.references)O(Q);z.push(K)}I.delete(w),q.add(w)}for(let w of E)O(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let Q of z){H.info(`
2
+ import{tb as y}from"./chunk-5qqybwef.js";import{Wc as H,Yc as F}from"./chunk-gssantc8.js";import{dd as R}from"./chunk-mcdb3q06.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,O){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let K=G(w,"utf-8"),Q=K.indexOf("//")!==-1||K.indexOf("/*")!==-1?K.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""):K,L=JSON.parse(Q),U=M(w),Y=B(U,O),W=[];if(L.references)for(let D of L.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(L.compilerOptions?.rootDir)Z=L.compilerOptions.rootDir;else if(L.include&&L.include.length>0){if(L.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(L.compilerOptions?.outDir)_=L.compilerOptions.outDir;else if(L.compilerOptions?.declarationDir)_=L.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(K){let Q=K instanceof Error?K.message:String(K);H.warn(`Failed to parse ${w}: ${Q}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),O=JSON.parse(I);if(O.name)return O.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function O(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let K=A.get(w);if(K){for(let Q of K.references)O(Q);z.push(K)}I.delete(w),q.add(w)}for(let w of E)O(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let Q of z){H.info(`
3
3
  [${Q.name}] Generating...`);try{let L={...E.sharedConfig,...Q.config,cwd:Q.root,tsconfigPath:Q.tsconfigPath},U=await y(L),Y=U.filesFailed===0;if(!Y)I=!1;q.push({name:Q.name,stats:U,success:Y}),H.info(`[${Q.name}] Generated ${U.filesGenerated} files`)}catch(L){I=!1;let U=L instanceof Error?L.message:String(L);q.push({name:Q.name,stats:{filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:U}),H.error(`[${Q.name}] Failed: ${U}`)}}let O=Date.now()-A,w=q.filter((Q)=>Q.success).length,K=q.length-w;if(H.info(`
4
4
  --- Workspace Generation Summary ---`),H.info(`Projects processed: ${q.length}`),H.info(`Successful: ${w}`),K>0)H.info(`Failed: ${K}`);return H.info(`Total duration: ${O}ms`),H.info(`------------------------------------
5
5
  `),{success:I,projects:q,durationMs:O}}async function f(E,A){if(A?.logLevel)F(A.logLevel);let z=X(E,"tsconfig.json");if(!V(z))throw Error(`Root tsconfig.json not found at: ${z}`);H.info("Discovering workspace projects...");let q=await S(z);if(q.length===0)return H.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return H.info(`Found ${q.length} projects`),T({root:E,projects:q,sharedConfig:A})}async function v(E){let A=X(E,"package.json");if(!V(A))return[];try{let z=G(A,"utf-8"),q=JSON.parse(z),I=[];if(Array.isArray(q.workspaces))I=q.workspaces;else if(q.workspaces?.packages)I=q.workspaces.packages;return I}catch{return[]}}async function C(E,A){let{Glob:z}=awaitPromise.resolve(globalThis.Bun),q=[];for(let I of A){let O=new z(I);for await(let w of O.scan({cwd:E,absolute:!0,onlyFiles:!1})){let K=X(w,"package.json");if(V(K))q.push(w)}}return q}async function l(E,A){if(A?.logLevel)F(A.logLevel);let z=await v(E);if(z.length===0)return H.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};H.info(`Found workspace patterns: ${z.join(", ")}`);let q=await C(E,z);if(q.length===0)return H.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};H.info(`Found ${q.length} workspace packages`);let I=q.map((O)=>{let w=X(O,"tsconfig.json");return{name:B(O),root:O,tsconfigPath:V(w)?w:"",references:[]}});return T({root:E,projects:I,sharedConfig:A})}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as F}from"./chunk-y581wnfe.js";import{Cc as N}from"./chunk-vpjw38x7.js";import{existsSync as H,readFileSync as P,unwatchFile as T}from"fs";var k;((J)=>{J[J.Error=1]="Error";J[J.Warning=2]="Warning";J[J.Information=3]="Information";J[J.Hint=4]="Hint"})(k||={});var L;((O)=>{O[O.File=1]="File";O[O.Module=2]="Module";O[O.Namespace=3]="Namespace";O[O.Package=4]="Package";O[O.Class=5]="Class";O[O.Method=6]="Method";O[O.Property=7]="Property";O[O.Field=8]="Field";O[O.Constructor=9]="Constructor";O[O.Enum=10]="Enum";O[O.Interface=11]="Interface";O[O.Function=12]="Function";O[O.Variable=13]="Variable";O[O.Constant=14]="Constant";O[O.String=15]="String";O[O.Number=16]="Number";O[O.Boolean=17]="Boolean";O[O.Array=18]="Array";O[O.Object=19]="Object";O[O.Key=20]="Key";O[O.Null=21]="Null";O[O.EnumMember=22]="EnumMember";O[O.Struct=23]="Struct";O[O.Event=24]="Event";O[O.Operator=25]="Operator";O[O.TypeParameter=26]="TypeParameter"})(L||={});var M;((Q)=>{Q[Q.Text=1]="Text";Q[Q.Method=2]="Method";Q[Q.Function=3]="Function";Q[Q.Constructor=4]="Constructor";Q[Q.Field=5]="Field";Q[Q.Variable=6]="Variable";Q[Q.Class=7]="Class";Q[Q.Interface=8]="Interface";Q[Q.Module=9]="Module";Q[Q.Property=10]="Property";Q[Q.Unit=11]="Unit";Q[Q.Value=12]="Value";Q[Q.Enum=13]="Enum";Q[Q.Keyword=14]="Keyword";Q[Q.Snippet=15]="Snippet";Q[Q.Color=16]="Color";Q[Q.File=17]="File";Q[Q.Reference=18]="Reference";Q[Q.Folder=19]="Folder";Q[Q.EnumMember=20]="EnumMember";Q[Q.Constant=21]="Constant";Q[Q.Struct=22]="Struct";Q[Q.Event=23]="Event";Q[Q.Operator=24]="Operator";Q[Q.TypeParameter=25]="TypeParameter"})(M||={});var v;((A)=>{A[A.Text=1]="Text";A[A.Read=2]="Read";A[A.Write=3]="Write"})(v||={});class E{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(j){return this.rootUri=j.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(j){let{uri:z,text:G,version:A}=j.textDocument;this.updateDocument(z,G,A)}didChange(j){let{uri:z,version:G}=j.textDocument,A=j.contentChanges[0]?.text||"";this.updateDocument(z,A,G)}didClose(j){let z=j.textDocument.uri;if(this.documents.delete(z),this.watchers.get(z))T(this.uriToPath(z)),this.watchers.delete(z)}updateDocument(j,z,G){let A=this.uriToPath(j),J=F(z,A,!0);this.documents.set(j,{content:z,version:G,declarations:J})}getDiagnostics(j){let z=this.documents.get(j);if(!z)return[];let G=[];for(let A of z.declarations){if(A.isExported&&A.kind==="variable"&&!A.typeAnnotation)G.push({range:this.getDeclarationRange(A,z.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${A.name}' should have an explicit type annotation for better declaration generation`});if(A.typeAnnotation==="any"||A.returnType==="any")G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(A.kind==="function"&&A.isExported&&!A.returnType)G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${A.name}' should have an explicit return type for better declaration generation`})}return G}hover(j){let z=this.documents.get(j.textDocument.uri);if(!z)return null;let{line:G,character:A}=j.position,R=z.content.split(`
2
+ import{ec as F}from"./chunk-asnnmvct.js";import{Cc as N}from"./chunk-7pwy4m0c.js";import{existsSync as H,readFileSync as P,unwatchFile as T}from"fs";var k;((J)=>{J[J.Error=1]="Error";J[J.Warning=2]="Warning";J[J.Information=3]="Information";J[J.Hint=4]="Hint"})(k||={});var L;((O)=>{O[O.File=1]="File";O[O.Module=2]="Module";O[O.Namespace=3]="Namespace";O[O.Package=4]="Package";O[O.Class=5]="Class";O[O.Method=6]="Method";O[O.Property=7]="Property";O[O.Field=8]="Field";O[O.Constructor=9]="Constructor";O[O.Enum=10]="Enum";O[O.Interface=11]="Interface";O[O.Function=12]="Function";O[O.Variable=13]="Variable";O[O.Constant=14]="Constant";O[O.String=15]="String";O[O.Number=16]="Number";O[O.Boolean=17]="Boolean";O[O.Array=18]="Array";O[O.Object=19]="Object";O[O.Key=20]="Key";O[O.Null=21]="Null";O[O.EnumMember=22]="EnumMember";O[O.Struct=23]="Struct";O[O.Event=24]="Event";O[O.Operator=25]="Operator";O[O.TypeParameter=26]="TypeParameter"})(L||={});var M;((Q)=>{Q[Q.Text=1]="Text";Q[Q.Method=2]="Method";Q[Q.Function=3]="Function";Q[Q.Constructor=4]="Constructor";Q[Q.Field=5]="Field";Q[Q.Variable=6]="Variable";Q[Q.Class=7]="Class";Q[Q.Interface=8]="Interface";Q[Q.Module=9]="Module";Q[Q.Property=10]="Property";Q[Q.Unit=11]="Unit";Q[Q.Value=12]="Value";Q[Q.Enum=13]="Enum";Q[Q.Keyword=14]="Keyword";Q[Q.Snippet=15]="Snippet";Q[Q.Color=16]="Color";Q[Q.File=17]="File";Q[Q.Reference=18]="Reference";Q[Q.Folder=19]="Folder";Q[Q.EnumMember=20]="EnumMember";Q[Q.Constant=21]="Constant";Q[Q.Struct=22]="Struct";Q[Q.Event=23]="Event";Q[Q.Operator=24]="Operator";Q[Q.TypeParameter=25]="TypeParameter"})(M||={});var v;((A)=>{A[A.Text=1]="Text";A[A.Read=2]="Read";A[A.Write=3]="Write"})(v||={});class E{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(j){return this.rootUri=j.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(j){let{uri:z,text:G,version:A}=j.textDocument;this.updateDocument(z,G,A)}didChange(j){let{uri:z,version:G}=j.textDocument,A=j.contentChanges[0]?.text||"";this.updateDocument(z,A,G)}didClose(j){let z=j.textDocument.uri;if(this.documents.delete(z),this.watchers.get(z))T(this.uriToPath(z)),this.watchers.delete(z)}updateDocument(j,z,G){let A=this.uriToPath(j),J=F(z,A,!0);this.documents.set(j,{content:z,version:G,declarations:J})}getDiagnostics(j){let z=this.documents.get(j);if(!z)return[];let G=[];for(let A of z.declarations){if(A.isExported&&A.kind==="variable"&&!A.typeAnnotation)G.push({range:this.getDeclarationRange(A,z.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${A.name}' should have an explicit type annotation for better declaration generation`});if(A.typeAnnotation==="any"||A.returnType==="any")G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(A.kind==="function"&&A.isExported&&!A.returnType)G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${A.name}' should have an explicit return type for better declaration generation`})}return G}hover(j){let z=this.documents.get(j.textDocument.uri);if(!z)return null;let{line:G,character:A}=j.position,R=z.content.split(`
3
3
  `)[G]||"",U=R.slice(0,A).match(/[\w$]+$/),V=R.slice(A).match(/^[\w$]+/);if(!U&&!V)return null;let X=(U?.[0]||"")+(V?.[0]||""),Y=z.declarations.find((W)=>W.name===X);if(!Y)return null;let B=`\`\`\`typescript
4
4
  ${this.buildSignature(Y)}
5
5
  \`\`\``;if(Y.leadingComments&&Y.leadingComments.length>0){let q=Y.leadingComments.join(`
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{a as i$,b as n$,c as r$}from"../chunk-83e9a4fq.js";import{d as S9,e as T9,f as k9,g as v9,h as C9,i as b9,j as P9,k as x9}from"../chunk-f4c389mj.js";import{l as Q2,m as X2,n as q2,o as V2,p as Y2,q as W2,r as K2}from"../chunk-mzq58nw0.js";import{s as p$,t as d$,u as c$,v as l$,w as o$,x as s$,y as a$}from"../chunk-xhs0tsnn.js";import{A as p8,B as d8,C as c8,D as l8,E as o8,F as s8,G as a8,H as i8,z as m8}from"../chunk-mxam9312.js";import{I as Z$,J as $$,K as J$,L as Q$,M as X$,N as q$,O as V$,P as Y$}from"../chunk-d0p3jzwb.js";import{Q as n8,R as r8,S as t8,T as e8,U as Z9,V as $9,W as J9,X as Q9,Y as X9}from"../chunk-nf54b52t.js";import{$ as Z2,Z as t$,_ as e$,aa as $2,ba as J2}from"../chunk-zf17s33e.js";import{$a as t9,Aa as u8,Ba as q9,Ca as V9,Da as Y9,Ea as QZ,Fa as W9,Ga as K9,Ha as H9,Ia as U9,Ja as O9,Ka as G9,La as y9,Ma as h9,Na as g9,Oa as f9,Pa as u9,Qa as m9,Ra as p9,Sa as d9,Ta as c9,Ua as l9,Va as o9,Wa as s9,Xa as a9,Ya as i9,Za as n9,_a as r9,ab as e9,bb as W$,cb as K$,db as H$,eb as U$,fb as O$,gb as G$,hb as uZ,ib as _$,jb as z$,kb as A$,lb as T$,mb as k$,nb as v$,ob as C$,pb as b$,qb as P$,rb as x$,sb as y$,tb as f$,ua as P8,ub as u$,va as x8,vb as m$,wa as y8,xa as h8,ya as g8,za as f8}from"../chunk-x3q42h61.js";import{$b as I8,Ab as s6,Bb as s0,Cb as a0,Db as Q8,Eb as X8,Fb as q8,Gb as V8,Hb as Y8,Ib as W8,Jb as K8,Kb as H8,Lb as U8,Mb as O8,Nb as G8,Ob as _8,Pb as z8,Qb as A8,Rb as B8,Sb as j8,Tb as N8,Ub as R8,Vb as F8,Wb as D8,Xb as E8,Yb as L8,Zb as w8,_b as M8,ac as S8,bc as T8,cc as k8,dc as v8,ec as FZ,fc as C8,gc as b8,wb as d6,xb as c6,yb as l6,zb as o6}from"../chunk-y581wnfe.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-4s9jv983.js";import{lc as KZ}from"../chunk-8z31rkfp.js";import"../chunk-2r21f44d.js";import{Ac as I$,Bc as S$,Cc as DZ,pc as i0,qc as B$,rc as j$,sc as N$,tc as R$,uc as F$,vc as D$,wc as E$,xc as L$,yc as w$,zc as M$}from"../chunk-vpjw38x7.js";import{Fc as a6,Gc as i6,Hc as n6,Ic as r6,Jc as t6,Kc as o0,Lc as e6,Mc as Z8,Nc as $8,Oc as J8}from"../chunk-285mqzvx.js";import{Pc as D9,Qc as E9,Rc as L9,Sc as w9,Tc as M9,Uc as I9}from"../chunk-a3txc27m.js";import{$c as R9,Vc as _9,Wc as z9,Xc as A9,Yc as B9,Zc as j9,_c as N9,ad as F9}from"../chunk-gssantc8.js";import{bd as h0,dd as n0}from"../chunk-mcdb3q06.js";import{basename as rZ,dirname as tZ,isAbsolute as eZ,join as Z0,relative as $0,resolve as J0}from"path";function l1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid file path: must be a non-empty string");return Z}function o1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid directory path: must be a non-empty string");return Z}function s1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return Z}function a1(Z){if(typeof Z!=="string")throw TypeError("Invalid source code: must be a string");return Z}function i1(Z){if(typeof Z!=="string")throw TypeError("Invalid DTS content: must be a string");return Z}function n1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid module specifier: must be a non-empty string");return Z}function r1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(Z)&&!/^[A-Z_$]/.test(Z));return Z}function t1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid declaration name: must be a non-empty string");return Z}function e1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!Z.startsWith("/")&&!/^[A-Z]:/i.test(Z))throw Error("Invalid absolute path: must start with / or drive letter");return Z}function Z3(Z){if(!Z||typeof Z!=="string")throw Error("Invalid relative path: must be a non-empty string");if(Z.startsWith("/")||/^[A-Z]:/i.test(Z))throw Error("Invalid relative path: must not be absolute");return Z}function $3(Z){if(typeof Z!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(Z)}catch{throw Error("Invalid JSON string: must be valid JSON")}return Z}function J3(Z,$){return typeof Z==="string"||typeof Z==="number"}function Q3(Z){return Z}var X3={join(Z,...$){return Z0(Z,...$)},dirname(Z){return tZ(Z)},basename(Z){return rZ(Z)},resolve(...Z){return J0(...Z)},isAbsolute(Z){return eZ(Z)},relative(Z,$){return $0(Z,$)}};function Q0(Z,$){let J=Z.length,Q=$.length,X=Array.from({length:J+1},()=>Array(Q+1).fill(0));for(let q=1;q<=J;q++)for(let V=1;V<=Q;V++)if(Z[q-1]===$[V-1])X[q][V]=X[q-1][V-1]+1;else X[q][V]=Math.max(X[q-1][V],X[q][V-1]);return X}function X0(Z,$,J,Q,X){let q=[];while(Q>0||X>0)if(Q>0&&X>0&&$[Q-1]===J[X-1])q.unshift({op:"equal",oldIdx:Q-1,newIdx:X-1,line:$[Q-1]}),Q--,X--;else if(X>0&&(Q===0||Z[Q][X-1]>=Z[Q-1][X]))q.unshift({op:"add",newIdx:X-1,line:J[X-1]}),X--;else if(Q>0)q.unshift({op:"remove",oldIdx:Q-1,line:$[Q-1]}),Q--;return q}function JZ(Z,$){let J=Z;if($.ignoreWhitespace)J=J.replace(/\s+/g," ").trim();return J}function p(Z,$,J,Q={}){let{context:X=3,ignoreWhitespace:q=!1,ignoreBlankLines:V=!1}=Q,Y=Z.split(`
2
+ import{a as i$,b as n$,c as r$}from"../chunk-zfrp784r.js";import{d as S9,e as T9,f as k9,g as v9,h as C9,i as b9,j as P9,k as x9}from"../chunk-fxh731yj.js";import{l as Q2,m as X2,n as q2,o as V2,p as Y2,q as W2,r as K2}from"../chunk-zn70hw8f.js";import{s as p$,t as d$,u as c$,v as l$,w as o$,x as s$,y as a$}from"../chunk-zs5mk604.js";import{A as p8,B as d8,C as c8,D as l8,E as o8,F as s8,G as a8,H as i8,z as m8}from"../chunk-mxam9312.js";import{I as Z$,J as $$,K as J$,L as Q$,M as X$,N as q$,O as V$,P as Y$}from"../chunk-d0p3jzwb.js";import{Q as n8,R as r8,S as t8,T as e8,U as Z9,V as $9,W as J9,X as Q9,Y as X9}from"../chunk-nf54b52t.js";import{$ as Z2,Z as t$,_ as e$,aa as $2,ba as J2}from"../chunk-zf17s33e.js";import{$a as t9,Aa as u8,Ba as q9,Ca as V9,Da as Y9,Ea as QZ,Fa as W9,Ga as K9,Ha as H9,Ia as U9,Ja as O9,Ka as G9,La as y9,Ma as h9,Na as g9,Oa as f9,Pa as u9,Qa as m9,Ra as p9,Sa as d9,Ta as c9,Ua as l9,Va as o9,Wa as s9,Xa as a9,Ya as i9,Za as n9,_a as r9,ab as e9,bb as W$,cb as K$,db as H$,eb as U$,fb as O$,gb as G$,hb as uZ,ib as _$,jb as z$,kb as A$,lb as T$,mb as k$,nb as v$,ob as C$,pb as b$,qb as P$,rb as x$,sb as y$,tb as f$,ua as P8,ub as u$,va as x8,vb as m$,wa as y8,xa as h8,ya as g8,za as f8}from"../chunk-5qqybwef.js";import{$b as I8,Ab as s6,Bb as s0,Cb as a0,Db as Q8,Eb as X8,Fb as q8,Gb as V8,Hb as Y8,Ib as W8,Jb as K8,Kb as H8,Lb as U8,Mb as O8,Nb as G8,Ob as _8,Pb as z8,Qb as A8,Rb as B8,Sb as j8,Tb as N8,Ub as R8,Vb as F8,Wb as D8,Xb as E8,Yb as L8,Zb as w8,_b as M8,ac as S8,bc as T8,cc as k8,dc as v8,ec as FZ,fc as C8,gc as b8,wb as d6,xb as c6,yb as l6,zb as o6}from"../chunk-asnnmvct.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-gc9n9za8.js";import{lc as KZ}from"../chunk-wcdd51hr.js";import"../chunk-j0rnj1z0.js";import{Ac as I$,Bc as S$,Cc as DZ,pc as i0,qc as B$,rc as j$,sc as N$,tc as R$,uc as F$,vc as D$,wc as E$,xc as L$,yc as w$,zc as M$}from"../chunk-7pwy4m0c.js";import{Fc as a6,Gc as i6,Hc as n6,Ic as r6,Jc as t6,Kc as o0,Lc as e6,Mc as Z8,Nc as $8,Oc as J8}from"../chunk-4jw8qvts.js";import{Pc as D9,Qc as E9,Rc as L9,Sc as w9,Tc as M9,Uc as I9}from"../chunk-a3txc27m.js";import{$c as R9,Vc as _9,Wc as z9,Xc as A9,Yc as B9,Zc as j9,_c as N9,ad as F9}from"../chunk-gssantc8.js";import{bd as h0,dd as n0}from"../chunk-mcdb3q06.js";import{basename as rZ,dirname as tZ,isAbsolute as eZ,join as Z0,relative as $0,resolve as J0}from"path";function l1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid file path: must be a non-empty string");return Z}function o1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid directory path: must be a non-empty string");return Z}function s1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return Z}function a1(Z){if(typeof Z!=="string")throw TypeError("Invalid source code: must be a string");return Z}function i1(Z){if(typeof Z!=="string")throw TypeError("Invalid DTS content: must be a string");return Z}function n1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid module specifier: must be a non-empty string");return Z}function r1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(Z)&&!/^[A-Z_$]/.test(Z));return Z}function t1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid declaration name: must be a non-empty string");return Z}function e1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!Z.startsWith("/")&&!/^[A-Z]:/i.test(Z))throw Error("Invalid absolute path: must start with / or drive letter");return Z}function Z3(Z){if(!Z||typeof Z!=="string")throw Error("Invalid relative path: must be a non-empty string");if(Z.startsWith("/")||/^[A-Z]:/i.test(Z))throw Error("Invalid relative path: must not be absolute");return Z}function $3(Z){if(typeof Z!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(Z)}catch{throw Error("Invalid JSON string: must be valid JSON")}return Z}function J3(Z,$){return typeof Z==="string"||typeof Z==="number"}function Q3(Z){return Z}var X3={join(Z,...$){return Z0(Z,...$)},dirname(Z){return tZ(Z)},basename(Z){return rZ(Z)},resolve(...Z){return J0(...Z)},isAbsolute(Z){return eZ(Z)},relative(Z,$){return $0(Z,$)}};function Q0(Z,$){let J=Z.length,Q=$.length,X=Array.from({length:J+1},()=>Array(Q+1).fill(0));for(let q=1;q<=J;q++)for(let V=1;V<=Q;V++)if(Z[q-1]===$[V-1])X[q][V]=X[q-1][V-1]+1;else X[q][V]=Math.max(X[q-1][V],X[q][V-1]);return X}function X0(Z,$,J,Q,X){let q=[];while(Q>0||X>0)if(Q>0&&X>0&&$[Q-1]===J[X-1])q.unshift({op:"equal",oldIdx:Q-1,newIdx:X-1,line:$[Q-1]}),Q--,X--;else if(X>0&&(Q===0||Z[Q][X-1]>=Z[Q-1][X]))q.unshift({op:"add",newIdx:X-1,line:J[X-1]}),X--;else if(Q>0)q.unshift({op:"remove",oldIdx:Q-1,line:$[Q-1]}),Q--;return q}function JZ(Z,$){let J=Z;if($.ignoreWhitespace)J=J.replace(/\s+/g," ").trim();return J}function p(Z,$,J,Q={}){let{context:X=3,ignoreWhitespace:q=!1,ignoreBlankLines:V=!1}=Q,Y=Z.split(`
3
3
  `),W=$.split(`
4
4
  `);if(Y[Y.length-1]==="")Y.pop();if(W[W.length-1]==="")W.pop();let K=Y.map((F)=>JZ(F,{ignoreWhitespace:q})),H=W.map((F)=>JZ(F,{ignoreWhitespace:q})),A=K,_=H,O=Y.map((F,M)=>M),G=W.map((F,M)=>M);if(V)A=[],_=[],O=[],G=[],K.forEach((F,M)=>{if(F.trim())A.push(F),O.push(M)}),H.forEach((F,M)=>{if(F.trim())_.push(F),G.push(M)});let U=Q0(A,_),z=X0(U,A,_,A.length,_.length),B=z.every((F)=>F.op==="equal"),j=0,N=0,R=0;for(let F of z)if(F.op==="add")j++;else if(F.op==="remove")N++;else R++;let k=q0(z,Y,W,O,G,X);return{filePath:J,identical:B,hunks:k,stats:{additions:j,deletions:N,unchanged:R},oldContent:Z,newContent:$}}function q0(Z,$,J,Q,X,q){let V=[],Y=[];if(Z.forEach((H,A)=>{if(H.op!=="equal")Y.push(A)}),Y.length===0)return V;let W=[],K=[Y[0]];for(let H=1;H<Y.length;H++)if(Y[H]-Y[H-1]<=q*2+1)K.push(Y[H]);else W.push(K),K=[Y[H]];W.push(K);for(let H of W){let A=Math.max(0,H[0]-q),_=Math.min(Z.length-1,H[H.length-1]+q),O=Z.slice(A,_+1),G=[],U=1,z=1,B=0,j=0;for(let N=0;N<A;N++){let R=Z[N];if(R.op==="equal"||R.op==="remove")U++;if(R.op==="equal"||R.op==="add")z++}for(let N of O)if(N.op==="equal")G.push(` ${N.line}`),B++,j++;else if(N.op==="remove")G.push(`-${N.line}`),B++;else if(N.op==="add")G.push(`+${N.line}`),j++;V.push({operation:"equal",lines:G,oldStart:U,oldCount:B,newStart:z,newCount:j})}return V}function Y3(Z){if(Z.identical)return"";let $=[];$.push(`--- a/${Z.filePath}`),$.push(`+++ b/${Z.filePath}`);for(let J of Z.hunks)$.push(`@@ -${J.oldStart},${J.oldCount} +${J.newStart},${J.newCount} @@`),$.push(...J.lines);return $.join(`
5
5
  `)}function V0(Z){if(Z.identical)return`\x1B[32m\u2713 ${Z.filePath} (unchanged)\x1B[0m`;let $=[],J=`+${Z.stats.additions} -${Z.stats.deletions}`;$.push(`\x1B[1m${Z.filePath}\x1B[0m \x1B[90m(${J})\x1B[0m`),$.push("");for(let Q of Z.hunks){$.push(`\x1B[36m@@ -${Q.oldStart},${Q.oldCount} +${Q.newStart},${Q.newCount} @@\x1B[0m`);for(let X of Q.lines)if(X.startsWith("+"))$.push(`\x1B[32m${X}\x1B[0m`);else if(X.startsWith("-"))$.push(`\x1B[31m${X}\x1B[0m`);else $.push(`\x1B[90m${X}\x1B[0m`);$.push("")}return $.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fa as a,ga as b,ha as c}from"../../chunk-6sx8ppfg.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{a as dts,c as default,b as bunDts};
2
+ import{fa as a,ga as b,ha as c}from"../../chunk-1zqrzfqx.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{a as dts,c as default,b as bunDts};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ia as a,ja as b,ka as c,la as d}from"../../chunk-a6tznyxq.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
2
+ import{ia as a,ja as b,ka as c,la as d}from"../../chunk-f7fatmz3.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as s}from"../../chunk-scrtz9j4.js";import{fa as t}from"../../chunk-6sx8ppfg.js";import{ia as i,ka as p}from"../../chunk-a6tznyxq.js";import{ma as e,oa as u}from"../../chunk-jvfvxm5w.js";import{qa as l,ra as a,sa as n}from"../../chunk-8hxrwrsf.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
2
+ import{ca as s}from"../../chunk-4hpfq116.js";import{fa as t}from"../../chunk-1zqrzfqx.js";import{ia as i,ka as p}from"../../chunk-f7fatmz3.js";import{ma as e,oa as u}from"../../chunk-bb28rgpz.js";import{qa as l,ra as a,sa as n}from"../../chunk-w08v45h7.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ma as a,na as b,oa as c,pa as d}from"../../chunk-jvfvxm5w.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
2
+ import{ma as a,na as b,oa as c,pa as d}from"../../chunk-bb28rgpz.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as a,da as b,ea as c}from"../../chunk-scrtz9j4.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as viteDts,a as dts,c as default};
2
+ import{ca as a,da as b,ea as c}from"../../chunk-4hpfq116.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as viteDts,a as dts,c as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-8hxrwrsf.js";import"../../chunk-x3q42h61.js";import"../../chunk-y581wnfe.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-4s9jv983.js";import"../../chunk-8z31rkfp.js";import"../../chunk-2r21f44d.js";import"../../chunk-vpjw38x7.js";import"../../chunk-285mqzvx.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
2
+ import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-w08v45h7.js";import"../../chunk-5qqybwef.js";import"../../chunk-asnnmvct.js";import"../../chunk-2n1bbm2c.js";import"../../chunk-gc9n9za8.js";import"../../chunk-wcdd51hr.js";import"../../chunk-j0rnj1z0.js";import"../../chunk-7pwy4m0c.js";import"../../chunk-4jw8qvts.js";import"../../chunk-a3txc27m.js";import"../../chunk-gssantc8.js";import"../../chunk-mcdb3q06.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.9.17",
4
+ "version": "0.9.18",
5
5
  "description": "A modern, fast .d.ts generation tool, powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -1,16 +0,0 @@
1
- // @bun
2
- var E=!1,M=null;function h(J){if(J.indexOf("/*")===-1)return J.trim();let X=[],$=0,z=0,B=J.length;while(z<B)if(J.charCodeAt(z)===47&&z+1<B&&J.charCodeAt(z+1)===42){if(z>$)X.push(J.substring($,z));z+=2;while(z<B-1){if(J.charCodeAt(z)===42&&J.charCodeAt(z+1)===47){z+=2;break}z++}$=z}else z++;if($<B)X.push(J.substring($));return X.join("").trim()}function $z(){E=!0,M=null}function Qz(){E=!1;let J=M;return M=null,J}function S(J){let Y=J.length;if(Y===0)return!1;let X=0;if(J.charCodeAt(X)===45)X++;if(X>=Y)return!1;let $=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===$)return!1;if(X<Y&&J.charCodeAt(X)===46){X++;let z=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===z)return!1}return X===Y}function o(J){for(let Y=0,X=J.length-1;Y<X;Y++){let $=J.charCodeAt(Y);if($<48||$>57)return!1}return!0}function D(J,Y){let X=0,$=0;while(($=J.indexOf(Y,$))!==-1)X++,$+=Y.length;return X}function _(J){let Y=J.length,X=!1;for(let Z=1;Z<Y;Z++)if(J.charCodeAt(Z)<=32&&J.charCodeAt(Z-1)<=32){X=!0;break}if(!X)for(let Z=0;Z<Y;Z++){let H=J.charCodeAt(Z);if(H===10||H===13||H===9){X=!0;break}}if(!X)return J;let $=[],z=-1,B=!1;for(let Z=0;Z<Y;Z++)if(J.charCodeAt(Z)<=32){if(!B){if(z>=0)$.push(J.substring(z,Z));$.push(" "),B=!0,z=-1}}else{if(B||z<0)z=Z;B=!1}if(z>=0)$.push(J.substring(z));return $.join("")}function V(J,Y=!1,X=!1,$=0){if(!J||typeof J!=="string")return"unknown";if($>=20)return"unknown";let z=J.trim();if(z.startsWith("BigInt("))return"bigint";if(z.startsWith("Symbol.for("))return"symbol";if(z.includes(".raw`")||z.includes("String.raw`"))return"string";if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")||z.startsWith("`")&&z.endsWith("`")){if(!z.includes("${")){if(!Y)return"string";return z}if(Y)return z;return"string"}if(S(z)){if(!Y)return"number";return z}if(z==="true"||z==="false"){if(!Y)return"boolean";return z}if(z==="null")return"null";if(z==="undefined")return"undefined";if(z.startsWith("[")&&z.endsWith("]"))return I(z,Y,$+1);if(z.startsWith("{")&&z.endsWith("}"))return s(z,Y,$+1);if(z.startsWith("class ")||z.startsWith("class{"))return c(z);if(z.startsWith("new "))return d(z);if(z.includes("=>")||z.startsWith("function")||z.startsWith("async"))return y(z,X,$,Y);if(z.endsWith("as const")){let B=z.slice(0,-8).trim();if(B.startsWith("[")&&B.endsWith("]")){let Z=B.slice(1,-1).trim();if(!Z)return"readonly []";let H=w(Z),Q=[];for(let L=0;L<H.length;L++)Q.push(V(H[L].trim(),!0,!1,$+1));return`readonly [${Q.join(", ")}]`}return V(B,!0,X,$+1)}if(z.startsWith("`")&&z.endsWith("`"))return p(z,Y);if(z.startsWith("Promise."))return f(z,Y,$);if(z.startsWith("await "))return"unknown";if(z.charCodeAt(z.length-1)===110&&z.length>1&&o(z)){if(Y)return z;return"bigint"}if(z.startsWith("Symbol(")||z==="Symbol.for")return"symbol";return"unknown"}function l(J,Y=!1,X=0){return V(J,Y,!0,X)}function p(J,Y){if(J.includes(".raw`")||J.includes("String.raw`"))return"string";if(!Y)return"string";if(!J.includes("${"))return J;return"string"}function d(J){let Y=4;while(Y<J.length&&J.charCodeAt(Y)<=32)Y++;let X=Y,$=J.charCodeAt(Y);if($<65||$>90)return"unknown";while(Y<J.length&&(P(J.charCodeAt(Y))||J.charCodeAt(Y)===46))Y++;if(Y===X)return"unknown";let z=J.slice(X,Y);{let B=J.slice(Y),Z=B;if(B.startsWith("<")){let Q=0,L=-1;for(let O=0;O<B.length;O++)if(B[O]==="<")Q++;else if(B[O]===">"){if(Q--,Q===0){L=O;break}}if(L!==-1){let O=B.slice(0,L+1);Z=B.slice(L+1);let G=Z.indexOf("(");if(G!==-1){let W=0,K=-1;for(let F=G;F<Z.length;F++)if(Z[F]==="(")W++;else if(Z[F]===")"){if(W--,W===0){K=F;break}}if(K!==-1){if(Z.slice(K+1).trimStart().startsWith("."))return"unknown"}}return`${z}${O}`}}let H=Z.indexOf("(");if(H!==-1){let Q=0,L=-1;for(let O=H;O<Z.length;O++)if(Z[O]==="(")Q++;else if(Z[O]===")"){if(Q--,Q===0){L=O;break}}if(L!==-1){if(Z.slice(L+1).trimStart().startsWith("."))return"unknown"}}switch(z){case"Date":return"Date";case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"RegExp":return"RegExp";case"Error":return"Error";case"Array":return"any[]";case"Object":return"object";case"Function":return"Function";case"Promise":return"Promise<any>";default:return z}}return"unknown"}function c(J){let Y=J.trimStart(),X=5;while(X<Y.length&&Y.charCodeAt(X)<=32)X++;let $=X;if(X<Y.length&&P(Y.charCodeAt(X))){while(X<Y.length&&P(Y.charCodeAt(X)))X++;return`typeof ${Y.slice($,X)}`}return"{ new (...args: any[]): any }"}function f(J,Y,X=0){if(J.startsWith("Promise.resolve(")){let z=J.indexOf(")",16);if(z!==-1){let B=J.slice(16,z).trim();if(B)return`Promise<${V(B,Y,!1,X+1)}>`}return"Promise<unknown>"}if(J.startsWith("Promise.reject("))return"Promise<never>";if(J.startsWith("Promise.all(")){let $=J.indexOf("[",12),z=J.lastIndexOf("]");if($!==-1&&z>$){let B=J.slice($+1,z).trim(),Z=w(B),H=[];for(let Q=0;Q<Z.length;Q++){let L=Z[Q].trim();if(L.startsWith("Promise.resolve(")){let O=f(L,Y,X+1),G=O.indexOf("<"),W=O.lastIndexOf(">");H.push(G!==-1&&W>G?O.slice(G+1,W):"unknown")}else H.push(V(L,Y,!1,X+1))}return`Promise<[${H.join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function I(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"never[]";if(X>=20)return"unknown[]";let z=w($),B=!1;for(let W=0;W<z.length;W++){let K=z[W],F=K.length;while(F>0&&K.charCodeAt(F-1)<=32)F--;if(F>=8&&K.slice(F-8,F)==="as const"){B=!0;break}}if(B){let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const")){let q=F.slice(0,-8).trim();if(q.startsWith("[")&&q.endsWith("]")){let N=q.slice(1,-1).trim(),U=w(N),R=[];for(let b=0;b<U.length;b++)R.push(V(U[b].trim(),!0,!1,X+1));W.push(`readonly [${R.join(", ")}]`)}else W.push(V(q,!0,!1,X+1))}else if(F.startsWith("[")&&F.endsWith("]"))W.push(I(F,!0,X+1));else W.push(V(F,!0,!1,X+1))}return`readonly [
3
- ${W.join(` |
4
- `)}
5
- ]`}let Z=E&&!Y,H=[],Q=[];for(let W of z){let K=W.trim(),F=M;if(M=null,K.startsWith("[")&&K.endsWith("]"))H.push(I(K,Y,X+1));else H.push(l(K,Y,X+1));if(Z)Q.push(M);M=F}if(Z)if(g(J))M=_(J);else{let W=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const"))continue;if(x(F)||F==="null"||F==="undefined")W.push(F);else if(F.startsWith("[")&&g(F))W.push(_(F));else if(F.startsWith("{")){if(Q[K])W.push(Q[K])}else{let q=V(F,!1,!1,0);if(q!=="unknown")W.push(q)}}if(W.length>0)M=`[${W.join(", ")}]`}if(Y)return`readonly [${H.join(", ")}]`;let L=new Set,O=[],G=!0;for(let W of H){if(!L.has(W))L.add(W),O.push(W);if(G){if(!(S(W)||W==="true"||W==="false"||W.charCodeAt(0)===34&&W.charCodeAt(W.length-1)===34||W.charCodeAt(0)===39&&W.charCodeAt(W.length-1)===39))G=!1}}if(G&&H.length<=10)return`readonly [${H.join(", ")}]`;if(O.length===1)return`${O[0]}[]`;return`(${O.join(" | ")})[]`}function w(J){let Y=[],X=0,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(!z&&(Q===34||Q===39||Q===96))z=!0,B=Q;else if(z&&Q===B&&(H===0||J.charCodeAt(H-1)!==92))z=!1;if(!z){if(Q===91||Q===123||Q===40)$++;else if(Q===93||Q===125||Q===41)$--;else if(Q===44&&$===0){let L=J.substring(X,H).trim();if(L)Y.push(L);X=H+1;continue}}}let Z=J.substring(X).trim();if(Z)Y.push(Z);return Y}function x(J){if(S(J))return!0;if(J==="true"||J==="false")return!0;if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return!0;return!1}function m(J){return J==="number"||J==="string"||J==="boolean"}function g(J){let Y=!1,X=0,$=J.length;for(let z=0;z<$;z++){let B=J.charCodeAt(z);if(Y){if(B===92){z++;continue}if(B===X)Y=!1;continue}if(B===34||B===39||B===96){Y=!0,X=B;continue}if(B===61&&z+1<$&&J.charCodeAt(z+1)===62)return!1;if(B>=97&&B<=122){let Z=z;while(z<$&&(J.charCodeAt(z)>=97&&J.charCodeAt(z)<=122||J.charCodeAt(z)>=65&&J.charCodeAt(z)<=90||J.charCodeAt(z)>=48&&J.charCodeAt(z)<=57||J.charCodeAt(z)===95||J.charCodeAt(z)===36))z++;let H=J.slice(Z,z);if(H==="new"||H==="async"||H==="await"||H==="function"||H==="yield"||H==="console"||H==="process")return!1;let Q=z;while(Q<$&&J.charCodeAt(Q)<=32)Q++;if(Q<$&&J.charCodeAt(Q)===40)return!1;z--}}return!0}function s(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"{}";if(X>=20)return"Record<string, unknown>";let z=a($),B=[],Z=E&&!Y,H=[];for(let[Q,L]of z){let O=M;M=null;let G,W=L.trim();if(e(W))G=zz(Q,W);else if(G=V(L,Y,!1,X+1),G.includes("=>")||G.includes("function")||G.includes("async"))G=i(G);let K=M;M=O;let F=L.trim(),q=r(Q);if(q){let N=t(q.kind,q.name,G);if(N){B.push(N);continue}}if(!Y&&m(G)&&x(F))B.push(`/** @defaultValue ${F} */
6
- ${Q}: ${G}`);else B.push(`${Q}: ${G}`);if(Z){let N=h(Q);if(F.endsWith("as const"));else if(x(F))H.push(`${N}: ${F}`);else if(F.startsWith("[")&&g(F))H.push(`${N}: ${_(F)}`);else if(F.startsWith("{")){if(K)H.push(`${N}: ${K}`)}else if(!F.startsWith("[")&&(F.includes("=>")||F.startsWith("function")||F.startsWith("async"))){let U=y(F,!1,0,!0);H.push(`${N}: ${U}`)}}}if(Z&&H.length>0){let Q=X>0?(X-1)/2:0,L=`{ ${H.join(", ")} }`;if(L.length<=80)M=L;else{let O=" ".repeat((Q+1)*2),G=" ".repeat(Q*2);M=`{
7
- ${O}${H.join(`,
8
- ${O}`)}
9
- ${G}}`}}return`{
10
- ${B.join(`;
11
- `)}
12
- }`}function i(J){let X=J.split(`
13
- `).map((O)=>C(O)).join(`
14
- `),$=X.indexOf("async");if($!==-1){let O=$>0?X.charCodeAt($-1):32,G=$+5<X.length?X.charCodeAt($+5):32;if(!P(O)&&!P(G))X=(X.slice(0,$)+X.slice($+5)).trim()}let z=X.indexOf("(");if(z!==-1){let O=j(X,z,"(",")");if(O!==-1){let G=X.slice(z,O+1),W=k(G);X=X.slice(0,z)+W+X.slice(O+1)}}let B=X.length,Z="",H=[],Q=!1,L=!1;for(let O=0;O<B;O++){let G=X.charCodeAt(O);if(G===123||G===40)H.push(G);else if(G===125||G===41)H.pop();if(G<=32){if(Q=!0,G===10||G===13)L=!0;continue}if(Q&&Z.length>0){let K=(H.length>0?H[H.length-1]:0)===123;if(L&&K){let F=Z.charCodeAt(Z.length-1),q=F===59||F===44||F===123||G===125,N=Z.length>=2&&Z.charCodeAt(Z.length-1)===47&&Z.charCodeAt(Z.length-2)===42;if(!q&&!N)Z+="; ";else Z+=" "}else Z+=" "}Q=!1,L=!1,Z+=X[O]}return Z.trim()}function P(J){return J>=97&&J<=122||J>=65&&J<=90||J>=48&&J<=57||J===95||J===36}function k(J){let Y=J.trim(),X,$=!1;if(Y.startsWith("(")&&Y.endsWith(")"))X=Y.slice(1,-1),$=!0;else X=Y;let z=X.trim();if(!z)return $?"()":"";let B=!1;{let F=0;for(let q=0;q<z.length;q++){let N=z.charCodeAt(q);if(N===40||N===60||N===91||N===123)F++;else if(N===41||N===62||N===93||N===125)F--;else if(F===0&&N===61){let U=q>0?z.charCodeAt(q-1):0,R=q+1<z.length?z.charCodeAt(q+1):0;if(U!==61&&U!==33&&U!==60&&U!==62&&R!==61&&R!==62){B=!0;break}}}}if(!B)return Y;let Z=[],H=[],Q=0,L=0,O=!1,G=0;for(let F=0;F<=z.length;F++){if(F===z.length){Z.push(z.slice(Q));break}let q=z.charCodeAt(F);if(O){if(q===92){F++;continue}if(q===G)O=!1;continue}if(q===39||q===34||q===96){O=!0,G=q;continue}if(q===40||q===60||q===91||q===123)L++;else if(q===41||q===62||q===93||q===125)L--;else if(q===44&&L===0){Z.push(z.slice(Q,F));let N=",",U=F+1;while(U<z.length&&z.charCodeAt(U)<=32)N+=z[U],U++;H.push(N),Q=U}}let W=[];for(let F of Z){let q=F.trim();if(!q){W.push(F);continue}if(q.startsWith("//"))continue;let N=C(q),U=F.slice(0,F.length-F.trimStart().length);W.push(U+n(N))}let K=W[0]||"";for(let F=1;F<W.length;F++)K+=(H[F-1]||", ")+W[F];return $?`(${K})`:K}function C(J){let Y=!1,X=0;for(let $=0;$<J.length-1;$++){let z=J.charCodeAt($);if(Y){if(z===92){$++;continue}if(z===X)Y=!1;continue}if(z===39||z===34||z===96){Y=!0,X=z;continue}if(z===47&&J.charCodeAt($+1)===47)return J.slice(0,$).trimEnd()}return J}function n(J){if(J.startsWith("..."))return J;let Y=-1,X=-1,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(z){if(Q===92){H++;continue}if(Q===B)z=!1;continue}if(Q===39||Q===34||Q===96){z=!0,B=Q;continue}if(Q===40||Q===60||Q===91||Q===123)$++;else if(Q===41||Q===62||Q===93||Q===125)$--;else if($===0){if(Q===58&&Y===-1)Y=H;else if(Q===61&&X===-1&&(H===0||J.charCodeAt(H-1)!==61)&&(H+1>=J.length||J.charCodeAt(H+1)!==61&&J.charCodeAt(H+1)!==62))X=H}}let Z=X!==-1;if(Y!==-1&&(X===-1||Y<X)){let H=J.slice(0,Y).trim(),Q=X!==-1?J.slice(Y+1,X).trim():J.slice(Y+1).trim(),L=Z&&!H.endsWith("?")?"?":"";return`${H}${L}: ${Q}`}else if(X!==-1){let H=J.slice(0,X).trim(),Q=!H.endsWith("?")?"?":"",L=J.slice(X+1).trim(),O="unknown";if(L==="true"||L==="false")O="boolean";else if(/^-?\d+(\.\d+)?$/.test(L))O="number";else if(L.startsWith("'")&&L.endsWith("'")||L.startsWith('"')&&L.endsWith('"'))O="string";else if(L.startsWith("["))O="unknown[]";else if(L.startsWith("{"))O="Record<string, unknown>";return`${H}${Q}: ${O}`}return J}function a(J){let Y=[],X="",$="",z=0,B=!1,Z="",H=!0,Q=!1,L=0;for(let O=0;O<J.length;O++){let G=J.charCodeAt(O),W=O>0?J.charCodeAt(O-1):0,K=O<J.length-1?J.charCodeAt(O+1):0;if(!B&&!Q&&G===47&&K===47){O+=2;while(O<J.length&&J.charCodeAt(O)!==10)O++;continue}if(!B&&!Q&&G===47&&K===42){Q=!0,L=1,X+="/*",O++;continue}else if(Q&&G===42&&K===47){if(L--,X+="*/",O++,L===0)Q=!1;continue}else if(Q&&G===47&&K===42){L++,X+="/*",O++;continue}let F=J[O];if(!B&&(G===34||G===39||G===96))B=!0,Z=F,X+=F;else if(B&&F===Z&&W!==92)B=!1,X+=F;else if(!B&&!Q)if(G===40&&z===0&&H){$=X.trim();let q="";if($.startsWith("async "))$=$.slice(6).trim(),q="async ";if($.startsWith("*"))$=$.slice(1).trim(),q+="*";X=q+F,H=!1,z=1}else if(G===123||G===91||G===40)z++,X+=F;else if(G===125||G===93||G===41)z--,X+=F;else if(G===58&&z===0&&H)$=X.trim(),X="",H=!1;else if(G===44&&z===0){if($&&X.trim()){let q=X.trim();Y.push([$,q])}X="",$="",H=!0}else X+=F;else X+=F}if($&&X.trim()){let O=X.trim();Y.push([$,O])}return Y}function r(J){let Y=J.trim();if(Y.startsWith("get ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"get",name:X}}if(Y.startsWith("set ")&&Y.length>4){let X=Y.slice(4).trim();if(X)return{kind:"set",name:X}}return null}function t(J,Y,X){let $=X.trim();if($.charCodeAt(0)!==40)return null;let z=j($,0,"(",")");if(z===-1)return null;let B=$.slice(1,z).trim(),Z=$.slice(z+1).trimStart();if(!Z.startsWith("=>"))return null;let H=Z.slice(2).trim();if(J==="get")return`get ${Y}(): ${H||"unknown"}`;return`set ${Y}(${B})`}function e(J){let Y=J;if(Y.startsWith("async ")||Y.startsWith("async\t"))Y=Y.slice(5).trimStart();if(Y.startsWith("*"))Y=Y.slice(1).trimStart();if(!Y.startsWith("("))return!1;let X=0;for(let $=0;$<Y.length;$++){let z=Y.charCodeAt($);if(z===40)X++;else if(z===41){if(X--,X===0){let B=Y.slice($+1).trimStart();if(B.startsWith("{"))return!0;if(B.startsWith(":")){let Z=0;for(let H=0;H<B.length;H++){let Q=B.charCodeAt(H);if(Q===40||Q===91)Z++;else if(Q===41||Q===93)Z--;else if(Q===60)Z++;else if(Q===62){if(Z>0)Z--}else if(Z===0&&Q===61&&H+1<B.length&&B.charCodeAt(H+1)===62)return!1;else if(Z===0&&Q===123)return!0}}return!1}}}return!1}function zz(J,Y){let X=Y.trimStart(),$=!1,z=!1;if(X.startsWith("async ")||X.startsWith("async\t"))$=!0,X=X.slice(5).trimStart();if(X.startsWith("*"))z=!0,X=X.slice(1).trimStart();let B="";if(X.charCodeAt(0)===60){let W=0,K=-1;for(let F=0;F<X.length;F++)if(X.charCodeAt(F)===60)W++;else if(X.charCodeAt(F)===62){if(W--,W===0){K=F;break}}if(K!==-1)B=X.slice(0,K+1),X=X.slice(K+1).trimStart()}let Z=X.indexOf("("),H=j(X,Z,"(",")");if(Z===-1||H===-1)return"() => unknown";let Q=X.slice(Z,H+1),L="unknown",O=X.slice(H+1).trimStart();if(O.charCodeAt(0)===58){let W=O.slice(1),K=0,F=-1,q=!1;for(let N=0;N<W.length;N++){let U=W.charCodeAt(N);if(U===40||U===91)K++;else if(U===41||U===93)K--;else if(U===123&&K===0){F=N;break}else if(U===61&&N+1<W.length&&W.charCodeAt(N+1)===62&&K===0){F=N,q=!0;break}}if(F!==-1)L=W.slice(0,F).trim();else L=W.trim()}if(L==="unknown"){if($&&z)L="AsyncGenerator<unknown, void, unknown>";else if(z)L="Generator<unknown, void, unknown>";else if($)L="Promise<void>"}else if($&&!L.startsWith("Promise<")&&!L.startsWith("AsyncGenerator<"))L=`Promise<${L}>`;let G=k(Q);return`${B}${G} => ${L}`}function j(J,Y,X,$){let z=0;for(let B=Y;B<J.length;B++)if(J[B]===X)z++;else if(J[B]===$){if(z--,z===0)return B}return-1}function Jz(J){let Y=0,X=0,$=!1,z="";for(let B=0;B<J.length-1;B++){let Z=J[B],H=J[B+1],Q=B>0?J[B-1]:"";if(!$&&(Z==='"'||Z==="'"||Z==="`"))$=!0,z=Z;else if($&&Z===z&&Q!=="\\")$=!1;if(!$){if(Z==="(")Y++;else if(Z===")")Y--;else if(Z==="[")X++;else if(Z==="]")X--;if(Z==="="&&H===">"&&Y===0&&X===0)return B}}return-1}function y(J,Y=!1,X=0,$=!0){let z=J.trim();if(z.length>200&&D(z,"=>")>2&&D(z,"<")>5&&!z.startsWith("function"))return Y?"((...args: any[]) => any)":"(...args: any[]) => any";if(z.startsWith("async ")&&z.includes("=>")){let Z=z.slice(5).trim(),H=Z.indexOf("=>"),Q=Z.substring(0,H).trim(),L=Z.substring(H+2).trim();if(Q=k(Q),Q==="()"||Q==="")Q="()";else if(!Q.startsWith("("))Q=`(${Q})`;let O="unknown";if(L.startsWith("{"))O="unknown";else O=V(L,$,!1,X+1);let G=`${Q} => Promise<${O}>`;return Y?`(${G})`:G}if(z.includes("=>")){let Z="",H=z;if(z.startsWith("<")){let q=j(z,0,"<",">");if(q!==-1)Z=z.substring(0,q+1),H=z.substring(q+1).trim()}let Q=Jz(H);if(Q===-1)return Y?"(() => unknown)":"() => unknown";let L=H.substring(0,Q).trim(),O=H.substring(Q+2).trim(),G="",W=L.lastIndexOf("):");if(W!==-1){let q=L.substring(W+2).trim();if(q&&!q.includes("=>")&&!q.includes("="))G=q,L=L.substring(0,W+1)}if(L=k(L),L==="()"||L==="")L="()";else if(!L.startsWith("("))L=`(${L})`;let K="unknown";if(G)K=G;else if(O.startsWith("{"))K="unknown";else if(O.includes("=>")){let q=O.trimStart(),N=q.indexOf("("),U=N!==-1?j(q,N,"(",")"):-1,R=U!==-1?q.indexOf("=>",U):-1;if(N===0&&U!==-1&&R!==-1){let b=q.substring(N+1,U).trim(),A=k(b);if(Z.includes("T")&&A.includes("T"))K=`(${A}) => T`;else K=`(${A}) => any`}else K="any"}else if(Y)K="unknown";else K=V(O,$,!1,X+1);let F=`${Z}${L} => ${K}`;return Y?`(${F})`:F}if(z.startsWith("function")){let Z=8,H=z.length;while(Z<H&&z.charCodeAt(Z)<=32)Z++;let Q=!1;if(Z<H&&z.charCodeAt(Z)===42){Q=!0,Z++;while(Z<H&&z.charCodeAt(Z)<=32)Z++}let L="";if(Z<H&&z.charCodeAt(Z)===60){let W=Z,K=1;Z++;while(Z<H&&K>0){let F=z.charCodeAt(Z);if(F===60)K++;else if(F===62)K--;Z++}L=z.substring(W,Z);while(Z<H&&z.charCodeAt(Z)<=32)Z++}let O=z.indexOf("(",Z);if(O!==-1){let W=1,K=O+1;while(K<H&&W>0){let U=z.charCodeAt(K);if(U===40)W++;else if(U===41)W--;K++}let F=z.substring(O+1,K-1).trim(),q=F?`(${F})`:"()";if(Q){let U=z.substring(K).trim(),R=U.indexOf("Generator<");if(R!==-1){let A=R+10,T=U.indexOf(">",A);if(T!==-1){let u=U.substring(A,T),v=`${L}${q} => Generator<${u}>`;return Y?`(${v})`:v}}let b=`${L}${q} => Generator<any, any, any>`;return Y?`(${b})`:b}let N=`${L}${q} => unknown`;return Y?`(${N})`:N}let G="(...args: any[]) => unknown";return Y?`(${G})`:G}if(z.includes("=>")&&z.includes("(")&&z.includes(")")){if(z.length>100||D(z,"=>")>2){let Z="";if(z.charCodeAt(0)===60){let G=j(z,0,"<",">");if(G!==-1)Z=z.substring(0,G+1)}let H=z.indexOf("("),Q=H!==-1?j(z,H,"(",")"):-1,L=H!==-1&&Q!==-1?z.substring(H,Q+1):"(...args: any[])";L=k(L);let O=`${Z}${L} => any`;return Y?`(${O})`:O}return Y?`(${z})`:z}let B="() => unknown";return Y?`(${B})`:B}function Hz(J){let Y=J.trim();if(Y==="any"||Y==="object"||Y==="unknown")return!0;if(Y.startsWith("Record<")&&Y.endsWith(">"))return!0;if(Y.startsWith("Array<")&&Y.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(Y))return!0;return!1}function Fz(J){let Y=J.lastIndexOf(" satisfies ");if(Y===-1)return null;let X=J.slice(Y+11).trim();if(X.endsWith(";"))X=X.slice(0,-1).trim();return X||null}var Xz=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,Yz=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,Zz=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function Lz(J){let Y=[],X=0;for(let $=0;$<=J.length;$++)if($===J.length||J[$]===`
15
- `){let z=X,B=$;while(z<B&&(J[z]===" "||J[z]==="\t"||J[z]==="\r"))z++;while(B>z&&(J[B-1]===" "||J[B-1]==="\t"||J[B-1]==="\r"))B--;let Z=J.slice(z,B);if(X=$+1,Z.startsWith("///")){if(Z.indexOf("<")===-1)continue;if(Xz.test(Z)||Yz.test(Z)||Zz.test(Z))Y.push(Z)}else if(Z===""||Z.startsWith("//"))continue;else break}return Y}
16
- export{$z as Dc,Qz as Ec,V as Fc,l as Gc,I as Hc,w as Ic,s as Jc,j as Kc,y as Lc,Hz as Mc,Fz as Nc,Lz as Oc};
@@ -1,25 +0,0 @@
1
- // @bun
2
- function y(D){return D===32||D===9||D===10||D===13}function Bj(D){return D>=65&&D<=90||D>=97&&D<=122||D===95||D===36||D>127}function W(D){return Bj(D)||D>=48&&D<=57}function lj(D){if(D.charCodeAt(0)===82&&D.startsWith("Record<"))return!0;if(D.charCodeAt(0)===65&&D.startsWith("Array<"))return!0;if(D.charCodeAt(0)===123&&D.includes("[")&&D.includes("]:"))return!0;if(D==="any"||D==="object"||D==="unknown")return!0;return!1}var qj=["public","protected","private","readonly","override"];function dj(D,Hj,T=!0,l=!1){let Z=D,n=T,b=l,K=Z.length,L=[],P=new Map,x=new Set,j=0;if(j<K&&Z.charCodeAt(j)===65279)j++;function v(J,H){if(J<H){let U=Z.charCodeAt(J),X=Z.charCodeAt(H-1);if(U!==32&&U!==9&&U!==10&&U!==13&&X!==32&&X!==9&&X!==10&&X!==13)return Z.slice(J,H)}while(J<H&&y(Z.charCodeAt(J)))J++;while(H>J&&y(Z.charCodeAt(H-1)))H--;return Z.slice(J,H)}function O(){if(j>=K)return;let J=Z.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<K){let H=Z.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<K){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
3
- `,j+2);j=X===-1?K:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?K:X+2;continue}}break}}function Ij(J){let H=J.length,U=0,X=H;for(let Y=0;Y<H;Y++){let $=J.charCodeAt(Y);if(U){if($===92){Y++;continue}if($===U)U=0;continue}if($===39||$===34||$===96){U=$;continue}if($===47&&Y+1<H){let F=J.charCodeAt(Y+1);if(F===47){X=Y;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9))X--;return J.slice(0,X)}if(F===42){let N=J.indexOf("*/",Y+2);if(N!==-1){J=`${J.slice(0,Y)} ${J.slice(N+2)}`,Y--;continue}}}}X=H;while(X>0&&(J.charCodeAt(X-1)===32||J.charCodeAt(X-1)===9||J.charCodeAt(X-1)===13))X--;return X<H?J.slice(0,X):J}function h(J){j++;let H=J===39?"'":'"';while(j<K){let U=Z.indexOf(H,j);if(U===-1){j=K;return}let X=0,Y=U-1;while(Y>=0&&Z.charCodeAt(Y)===92)X++,Y--;if(X%2===0){j=U+1;return}j=U+1}}function t(){j++;let J=[];while(j<K){let H=Z.charCodeAt(j);if(J.length===0){if(H===92){j+=2;continue}if(H===96){j++;return}if(H===36&&j+1<K&&Z.charCodeAt(j+1)===123){j+=2,J.push(0);continue}j++;continue}if(H===39||H===34){h(H);continue}if(H===96){t();continue}if(H===47&&j+1<K){let U=Z.charCodeAt(j+1);if(U===47){let X=Z.indexOf(`
4
- `,j+2);j=X===-1?K:X+1;continue}if(U===42){let X=Z.indexOf("*/",j+2);j=X===-1?K:X+2;continue}j++;continue}if(H===123){J[J.length-1]++,j++;continue}if(H===125){let U=J[J.length-1];if(U===0){J.pop(),j++;continue}J[J.length-1]=U-1,j++;continue}j++}}function E(){let J=Z.charCodeAt(j);if(J===39||J===34)return h(J),!0;if(J===96)return t(),!0;if(J===47&&j+1<K){let H=Z.charCodeAt(j+1);if(H===47){let U=Z.indexOf(`
5
- `,j+2);return j=U===-1?K:U+1,!0}if(H===42){let U=Z.indexOf("*/",j+2);return j=U===-1?K:U+2,!0}if(fj())return Ej(),!0}return!1}function fj(){let J=j-1;while(J>=0&&(Z.charCodeAt(J)===32||Z.charCodeAt(J)===9||Z.charCodeAt(J)===10||Z.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Z.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(W(H)){let U=J;while(U>=0&&W(Z.charCodeAt(U)))U--;let X=Z.slice(U+1,J+1);if(X==="return"||X==="typeof"||X==="void"||X==="delete"||X==="throw"||X==="new"||X==="in"||X==="of"||X==="case"||X==="instanceof"||X==="yield"||X==="await")return!0}return!1}function Ej(){j++;let J=!1;while(j<K){let H=Z.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<K&&W(Z.charCodeAt(j)))j++}function f(){let J=j;while(j<K&&W(Z.charCodeAt(j)))j++;return Z.slice(J,j)}function z(J){if(j+J.length>K)return!1;for(let H=0;H<J.length;H++)if(Z.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<K&&W(Z.charCodeAt(j+J.length)))return!1;return!0}function Jj(J){let H=j+J;while(H<K){let U=Z.charCodeAt(H);if(U===32||U===9||U===10||U===13){H++;continue}return U!==46&&U!==61}return!1}function yj(){if(j>=K)return!1;switch(Z.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function p(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<K){let Y=Z.charCodeAt(j+1);if(Y===47){let $=Z.indexOf(`
6
- `,j+2);j=$===-1?K:$+1;continue}if(Y===42){let $=Z.indexOf("*/",j+2);j=$===-1?K:$+2;continue}}break}let U=j>=K||yj()||Z.charCodeAt(j)===125;return j=H,U}function e(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let X=Z.charCodeAt(j);if(X===32||X===9||X===13||X===10){j++;continue}if(X===47&&j+1<K&&Z.charCodeAt(j+1)===47){let Y=Z.indexOf(`
7
- `,j+2);j=Y===-1?K:Y+1;continue}break}if(j>=K)return j=H,!0;let U=Z.charCodeAt(j);if(U===124||U===38||U===46||U===63||U===58)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Aj=/[{}'"`\/]/g,Tj=/[()'"`\/]/g,kj=/[[\]'"`\/]/g,Cj=/[<>'"`\/]/g;function A(J,H){let U=1;j++;let X=J===123?Aj:J===40?Tj:J===91?kj:Cj;X.lastIndex=j;let Y;while((Y=X.exec(Z))!==null){let $=Y.index,F=Z.charCodeAt($);if(F===39||F===34){j=$,h(F),X.lastIndex=j;continue}if(F===96){j=$,t(),X.lastIndex=j;continue}if(F===47){if(j=$,E()){X.lastIndex=j;continue}X.lastIndex=$+1;continue}if(F===J)U++;else if(F===H){if(H===62&&$>0&&Z.charCodeAt($-1)===61){X.lastIndex=$+1;continue}if(U--,U===0)return j=$+1,j}X.lastIndex=$+1}return j=K,j}function S(){return j>0&&Z.charCodeAt(j-1)===61}function Xj(){return j+1<K&&Z.charCodeAt(j+1)===62}let k=/[{};'"`\/\n\r()[\]]/g;function I(){let J=0,H=0,U=0;k.lastIndex=j;let X;while((X=k.exec(Z))!==null){let Y=X.index,$=Z.charCodeAt(Y);if($===39||$===34){j=Y,h($),k.lastIndex=j;continue}if($===96){j=Y,t(),k.lastIndex=j;continue}if($===47){if(j=Y,E()){k.lastIndex=j;continue}k.lastIndex=Y+1;continue}if($===40){H++,k.lastIndex=Y+1;continue}if($===41){H--,k.lastIndex=Y+1;continue}if($===91){U++,k.lastIndex=Y+1;continue}if($===93){U--,k.lastIndex=Y+1;continue}if($===123){J++,k.lastIndex=Y+1;continue}if($===125){if(J--,J<=0&&H<=0&&U<=0){j=Y+1;return}k.lastIndex=Y+1;continue}if($===59&&J===0&&H===0&&U===0){j=Y+1;return}if(($===10||$===13)&&J===0&&H===0&&U===0){if(j=Y,p())return}k.lastIndex=Y+1}j=K}function Nj(){A(123,125);while(j<K&&y(Z.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function Rj(){j++;while(j<K&&y(Z.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<K&&y(Z.charCodeAt(j)))j++;f();while(j<K&&y(Z.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)h(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function Uj(J){let H=J.indexOf("from ");if(H===-1)return;let U=H+5;while(U<J.length&&(J.charCodeAt(U)===32||J.charCodeAt(U)===9))U++;if(U>=J.length)return;let X=J.charCodeAt(U);if(X!==39&&X!==34)return;let Y=J.indexOf(J[U],U+1);if(Y===-1)return;return J.slice(U+1,Y)}function C(J){if(!n)return;let H=J-1;while(H>=0&&y(Z.charCodeAt(H)))H--;if(H<0)return;let U=[],X=!1;while(H>=0){if(H>=1&&Z.charCodeAt(H)===47&&Z.charCodeAt(H-1)===42){let F=Z.lastIndexOf("/*",H-2);if(F>=0){U.push(Z.slice(F,H+1)),X=!0,H=F-1;while(H>=0&&y(Z.charCodeAt(H)))H--;continue}break}let Y=H;while(Y>0&&Z.charCodeAt(Y-1)!==10)Y--;let $=v(Y,H+1);if($.startsWith("//")){if(X)break;let F=[$];H=Y-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--;while(H>=0){let N=H;while(N>0&&Z.charCodeAt(N-1)!==10)N--;let V=v(N,H+1);if(V.startsWith("//")){F.push(V),H=N-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else if(V===""){H=N-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else break}F.reverse(),U.push(F.join(`
8
- `));continue}break}if(U.length===0)return;return U.reverse(),U}function Sj(J){let H=J,U=!1;while(j<K){let V=Z.charCodeAt(j);if(V===59){j++;break}if(V===39||V===34){h(V),U=!0;while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++;break}if(V===10&&U)break;j++}let X=v(H,j),Y=X.charCodeAt(7)===116&&(X.startsWith("import type ")||X.startsWith("import type{")),$=!1;{let V=6;while(V<X.length&&(X.charCodeAt(V)===32||X.charCodeAt(V)===9))V++;if(V<X.length&&X.charCodeAt(V)===116&&X.startsWith("type",V)){V+=4;while(V<X.length&&(X.charCodeAt(V)===32||X.charCodeAt(V)===9))V++}if(V<X.length){let Q=X.charCodeAt(V);$=Q===39||Q===34}}let F="";{let V=X.indexOf("from ");if(V!==-1){let Q=V+5;while(Q<X.length&&(X.charCodeAt(Q)===32||X.charCodeAt(Q)===9))Q++;if(Q<X.length){let G=X.charCodeAt(Q);if(G===39||G===34){let B=X.indexOf(String.fromCharCode(G),Q+1);if(B!==-1)F=X.slice(Q+1,B)}}}else if($){let Q=6;while(Q<X.length&&X.charCodeAt(Q)!==39&&X.charCodeAt(Q)!==34)Q++;if(Q<X.length){let G=X.charCodeAt(Q),B=X.indexOf(String.fromCharCode(G),Q+1);if(B!==-1)F=X.slice(Q+1,B)}}}let N=C(H);return{kind:"import",name:"",text:X,isExported:!1,isTypeOnly:Y,isSideEffect:$,source:F,leadingComments:N,start:H,end:j}}function Yj(){let J=j;return A(123,125),Z.slice(J,j)}function _j(J){let H=J.indexOf("(");if(H===-1)return J;let U=J.slice(H);if(U.indexOf("=")===-1)return J;let X=!1;for(let V=0;V<U.length;V++)if(U.charCodeAt(V)===61){let G=V>0?U.charCodeAt(V-1):0,B=V+1<U.length?U.charCodeAt(V+1):0;if(G!==61&&G!==33&&G!==60&&G!==62&&B!==61&&B!==62){X=!0;break}}if(!X)return J;let Y=0,$=-1;for(let V=H;V<J.length;V++){let Q=J.charCodeAt(V);if(Q===40)Y++;else if(Q===41){if(Y--,Y===0){$=V;break}}}if($===-1)return J;let F=J.slice(H,$+1),N=c(F);return J.slice(0,H)+N+J.slice($+1)}function gj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,U=J.split(`
9
- `),X=[],Y=[],$=[],F=!1,N=1/0;for(let G=0;G<U.length;G++){let B=U[G];if(H){if(F){if(B.includes("*/"))F=!1;continue}let _=B.trim();if(_.length===0)continue;let g=_.charCodeAt(0);if(g===47){let w=_.charCodeAt(1);if(w===47)continue;if(w===42){if(!_.includes("*/"))F=!0;continue}}if(g===42)continue;let q=Ij(B);if(q.charCodeAt(q.length-1)===59)q=q.slice(0,-1);q=_j(q);let R=q.trim();if(!R)continue;X.push(q),Y.push(R);let M=0;while(M<q.length&&y(q.charCodeAt(M)))M++;if(R!=="{"&&R!=="}"){if(M<N)N=M}$.push(M)}else{let _=B.length;while(_>0&&(B.charCodeAt(_-1)===32||B.charCodeAt(_-1)===9||B.charCodeAt(_-1)===13))_--;if(_===0)continue;let g=_<B.length?B.slice(0,_):B;if(g.charCodeAt(g.length-1)===59)g=g.slice(0,-1);g=_j(g);let q=g.trim();if(!q)continue;X.push(g),Y.push(q);let R=0;while(R<g.length&&y(g.charCodeAt(R)))R++;if(q!=="{"&&q!=="}"){if(R<N)N=R}$.push(R)}}if(X.length===0)return"{}";if(N===1/0||N<=2)return X.join(`
10
- `);let V=N-2,Q=Array(X.length);for(let G=0;G<X.length;G++){let B=Y[G];if(B==="{"){Q[G]=B;continue}let _=$[G];if(_>N)Q[G]=X[G];else if(_===N&&(B.charCodeAt(0)===125||B.charCodeAt(0)===93||B.charCodeAt(0)===41))Q[G]=X[G];else{let g=Math.max(0,_-V);Q[G]=" ".repeat(g)+B}}return Q.join(`
11
- `)}function u(){if(j>=K||Z.charCodeAt(j)!==60)return"";let J=j;A(60,62);let H=Z.slice(J,j);if(H.includes(`
12
- `)){let U="",X=!1;for(let Y=0;Y<H.length;Y++){let $=H.charCodeAt(Y);if($===32||$===9||$===10||$===13){if(!X&&U.length>0)U+=" ",X=!0}else U+=H[Y],X=!1}if(U.charCodeAt(1)===32)U=`<${U.slice(2)}`;if(U.charCodeAt(U.length-2)===32)U=`${U.slice(0,-2)}>`;return U}return H}function m(){if(j>=K||Z.charCodeAt(j)!==40)return"()";let J=j;return A(40,41),Z.slice(J,j)}function c(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
13
- `)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let V=0,Q=0,G=0;for(let B=0;B<H.length;B++){let _=H.charCodeAt(B);if(_===40||_===60||_===123)G++;else if(_===41||_===62||_===125)G--;else if(G===0){if(_===58)V++;else if(_===44)Q++}}if(V>=Q+1){let B=!1;for(let _=0;_<qj.length;_++){let g=qj[_],q=H.indexOf(g);if(q!==-1){let R=q+g.length;if((q===0||!W(H.charCodeAt(q-1)))&&(R>=H.length||!W(H.charCodeAt(R)))){B=!0;break}}}if(!B)return J}}let U=[],X=0,Y=0,$=!1,F=0;for(let V=0;V<=H.length;V++){if(V===H.length){U.push(H.slice(X).trim());break}let Q=H.charCodeAt(V);if($){if(Q===92){V++;continue}if(Q===F)$=!1;continue}if(Q===39||Q===34||Q===96){$=!0,F=Q;continue}if(Q===40||Q===123||Q===91||Q===60)Y++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&H.charCodeAt(V-1)===61))Y--;else if(Q===44&&Y===0)U.push(H.slice(X,V).trim()),X=V+1}let N=[];for(let V of U){if(!V)continue;let Q=V.trim();if(Q.startsWith("//")||Q.startsWith("/*"))continue;let G=V;{let B=!1,_=0,g=0,q=0;for(let R=0;R<G.length-1;R++){let M=G.charCodeAt(R);if(M===10){q=R+1;continue}if(B){if(M===92){R++;continue}if(M===_)B=!1;continue}if(M===39||M===34||M===96){B=!0,_=M;continue}if(M===123||M===91||M===40||M===60){g++;continue}if(M===125||M===93||M===41||M===62){if(g>0)g--;continue}if(M===47&&G.charCodeAt(R+1)===47){if(g===0){G=G.slice(0,R).trimEnd();break}let w=G.indexOf(`
14
- `,R);if(w===-1){G=G.slice(0,q).trimEnd();break}let s=G.slice(0,q),hj=G.slice(w+1);G=`${s}${hj}`,R=q-1}}}if(!G.trim())continue;N.push(Lj(G))}return`(${N.join(", ")})`}function Wj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",U=0,X=0,Y=!1,$=0;while(U<J.length){let F=J.charCodeAt(U);if(Y){if(F===92&&U+1<J.length){H+=J[U]+J[U+1],U+=2;continue}if(F===$)Y=!1;H+=J[U],U++;continue}if(F===39||F===34||F===96){Y=!0,$=F,H+=J[U],U++;continue}if(F===123||F===91||F===40)X++;else if(F===125||F===93||F===41)X--;if(X>=1&&F===61&&(U+1>=J.length||J.charCodeAt(U+1)!==61&&J.charCodeAt(U+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
15
- `))H=H.slice(0,-1);U++;let N=0;while(U<J.length){let V=J.charCodeAt(U);if(V===39||V===34||V===96){let Q=V;U++;while(U<J.length){if(J.charCodeAt(U)===92){U+=2;continue}if(J.charCodeAt(U)===Q){U++;break}U++}continue}if(V===123||V===91||V===40)N++;else if(V===125||V===93||V===41){if(N===0)break;N--}else if(V===44&&N===0)break;U++}continue}if(X===1&&F===46&&U+2<J.length&&J.charCodeAt(U+1)===46&&J.charCodeAt(U+2)===46){U+=3;continue}H+=J[U],U++}return H}function Lj(J){let H=J.trim(),U=H.startsWith("...");if(U)H=H.slice(3).trim();while(H.startsWith("@")){let q=1;while(q<H.length&&W(H.charCodeAt(q)))q++;if(q<H.length&&H.charCodeAt(q)===40){let R=1;q++;while(q<H.length&&R>0){if(H.charCodeAt(q)===40)R++;else if(H.charCodeAt(q)===41)R--;q++}}H=H.slice(q).trim()}let X=!0;while(X){X=!1;for(let q of qj)if(H.startsWith(q)&&H.length>q.length&&!W(H.charCodeAt(q.length))){let R=H.slice(q.length).trim();if(R.charCodeAt(0)===58||R.charCodeAt(0)===63&&R.length>1&&R.charCodeAt(1)===58)break;H=R,X=!0;break}}let Y=-1,$=-1,F=0,N=!1,V=0;for(let q=0;q<H.length;q++){let R=H.charCodeAt(q);if(N){if(R===92){q++;continue}if(R===V)N=!1;continue}if(R===39||R===34||R===96){N=!0,V=R;continue}if(R===40||R===123||R===91||R===60)F++;else if(R===41||R===125||R===93||R===62&&!(q>0&&H.charCodeAt(q-1)===61))F--;else if(F===0){if(R===58&&Y===-1)Y=q;else if(R===61&&$===-1&&(q===0||H.charCodeAt(q-1)!==61)&&(q+1>=H.length||H.charCodeAt(q+1)!==61&&H.charCodeAt(q+1)!==62))$=q}}let Q,G,B=$!==-1;if(Y!==-1&&($===-1||Y<$))if(Q=H.slice(0,Y).trim(),$!==-1)G=H.slice(Y+1,$).trim();else G=H.slice(Y+1).trim();else if($!==-1)Q=H.slice(0,$).trim(),G=Zj(H.slice($+1).trim());else Q=H,G="unknown";if(Q=Wj(Q),(Q.startsWith("{")||Q.startsWith("["))&&Q.includes(`
16
- `)){let q=Q.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(q.length<=40)Q=q;else Q=Q.split(`
17
- `).map((M)=>{let w=M.trim();if(!w)return"";if(w==="{"||w==="}"||w==="["||w==="]"||w.startsWith("}")||w.startsWith("]"))return w;return` ${w}`}).join(`
18
- `)}let _=Q.endsWith("?")||B;if(Q.endsWith("?"))Q=Q.slice(0,-1).trim();let g=_&&!U?"?":"";if(U)return`...${Q}: ${G}`;return`${Q}${g}: ${G}`}function Mj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let U=J.charCodeAt(H);if(U<48||U>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Zj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Mj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function $j(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Mj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Qj(J){if(J.endsWith("as const"))return null;let H=0,U=-1;for(let Y=0;Y<J.length;Y++){let $=J.charCodeAt(Y);if($===123||$===91||$===40)H++;else if($===125||$===93||$===41)H--;else if(H===0&&$===32&&Y+4<=J.length&&J.substring(Y,Y+4)===" as ")U=Y}if(U===-1)return null;return J.slice(U+4).trim()||null}function jj(){if(O(),j<K&&Z.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<K){if(E())continue;let U=Z.charCodeAt(j);if(U===40||U===91||U===60)H++;else if(U===41||U===93||U===62&&!S())H--;else if(U===123)if(H>0)H++;else{let X=v(J,j),Y=($)=>{let F=X.length-$.length;return F>=0&&X.endsWith($)&&(F===0||!W(X.charCodeAt(F-1)))};if(X.length===0||X.endsWith("|")||X.endsWith("&")||Y("is")||Y("extends"))H++;else break}else if(U===125){if(H===0)break;H--}else if(H===0&&U===59)break;if(H===0&&e())break;j++}return v(J,j)}return""}function d(J,H,U,X){j+=8,O();let Y=j<K&&Z.charCodeAt(j)===42;if(Y)j++,O();let $=f();if(!$&&!X)return null;O();let F=u();O();let N=m();O();let V=jj();if(!V)if(U&&Y)V="AsyncGenerator<unknown, void, unknown>";else if(Y)V="Generator<unknown, void, unknown>";else if(U)V="Promise<void>";else V="void";O();let Q=!1;if(j<K&&Z.charCodeAt(j)===123)Q=!0,A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let G=c(N),B=`${H?"export ":""}declare function ${$||"default"}${F}${G}: ${V};`,_=C(J);if(Q)x.add(L.length);return{kind:"function",name:$||"default",text:B,isExported:H,isDefault:X,isAsync:U,isGenerator:Y,returnType:V,generics:F||void 0,leadingComments:_,start:J,end:j}}function r(J,H,U){j+=H.length,O();let X=[];do{if(O(),j>=K)break;let Y=Z.charCodeAt(j);if(Y===123||Y===91)return I(),X;let $=f();if(!$)return I(),X;O();let F,N,V=!1;if(j<K&&Z.charCodeAt(j)===58){j++,O();let B=j,_=0;while(j<K){if(E())continue;let g=Z.charCodeAt(j);if(g===40||g===123||g===91||g===60)_++;else if(g===41||g===125||g===93||g===62&&!S())_--;else if(_===0&&(g===59||g===44))break;else if(_===0&&g===61&&!Xj())break;if(_===0&&p())break;j++}F=v(B,j)}if(j<K&&Z.charCodeAt(j)===61)if(b&&F&&!lj(F))I();else{j++,O();let B=j,_=0,g=0;while(j<K){if(E())continue;let q=Z.charCodeAt(j);if(q===40||q===123||q===91)_++;else if(q===41||q===125||q===93)_--;else if(q===60&&_===0){if(j+1>=K||Z.charCodeAt(j+1)!==61)g++}else if(q===62&&_===0&&!S()){if(g>0&&(j+1>=K||Z.charCodeAt(j+1)!==61))g--}else if(_===0&&g===0&&(q===59||q===44))break;if(_===0&&g===0&&p())break;j++}if(N=v(B,j),N.endsWith(" as const")||N==="const"){if(V=!0,!F){let q=N.endsWith(" as const")?N.slice(0,-9).trim():N,R=$j(q);F=R!=="unknown"?R:void 0}}else if(!F){let q=Qj(N);if(q)F=q}}if(j<K){let B=Z.charCodeAt(j);if(B===44){j++;continue}if(B===59)j++}let Q=C(J),G=`${U?"export ":""}declare ${H} ${$}: ${F||"unknown"};`;X.push({kind:"variable",name:$,text:G,isExported:U,typeAnnotation:F,value:N,modifiers:V?[H,"const assertion"]:[H],leadingComments:Q,start:J,end:j});break}while(j<K);return X}function Kj(J,H){j+=9,O();let U=f();O();let X=u();O();let Y="";if(z("extends")){j+=7,O();let Q=j,G=0;while(j<K){if(E())continue;let B=Z.charCodeAt(j);if(B===60)G++;else if(B===62&&!S())G--;else if(B===123&&G===0)break;j++}Y=v(Q,j)}O();let $=j<K&&Z.charCodeAt(j)===123?Yj():"{}",F=gj($),N=`${H?"export ":""}declare interface ${U}${X}${Y?` extends ${Y}`:""} ${F}`,V=C(J);return{kind:"interface",name:U,text:N,isExported:H,extends:Y||void 0,generics:X||void 0,leadingComments:V,start:J,end:j}}function Vj(J,H){j+=4,O();let U=f();O();let X=u();if(O(),j<K&&Z.charCodeAt(j)===61)j++;O();let Y=j,$=0;while(j<K){if(E())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!S())$--;else if($===0&&Q===59)break;if($===0&&p())break;j++}let F=v(Y,j);if(j<K&&Z.charCodeAt(j)===59)j++;let N=`${H?"export ":""}type ${U}${X} = ${F}`,V=C(J);return{kind:"type",name:U,text:N,isExported:H,generics:X||void 0,leadingComments:V,start:J,end:j}}function i(J,H,U){j+=4,O();let X=f();O();let Y=j;if(j<K&&Z.charCodeAt(j)===123)A(123,125);let $=v(J,j),F=C(J);return{kind:"enum",name:X,text:$,isExported:H,modifiers:U?["const"]:void 0,leadingComments:F,start:J,end:j}}function a(J,H,U){j+=5,O();let X=f()||"AnonymousClass";O();let Y=u();O();let $="";if(z("extends")){j+=7,O();let G=j,B=0;while(j<K){if(E())continue;let _=Z.charCodeAt(j);if(_===60)B++;else if(_===62&&!S())B--;else if(B===0&&(_===123||z("implements")))break;j++}$=v(G,j)}let F;if(z("implements")){j+=10,O();let G=j,B=0;while(j<K){if(E())continue;let g=Z.charCodeAt(j);if(g===60)B++;else if(g===62&&!S())B--;else if(B===0&&g===123)break;j++}let _=v(G,j);if(_)F=_.split(",").map((g)=>g.trim())}O();let N=zj(),V=`${H?"export ":""}declare ${U?"abstract ":""}class ${X}${Y}${$?` extends ${$}`:""}${F&&F.length>0?` implements ${F.join(", ")}`:""} ${N}`,Q=C(J);return{kind:"class",name:X,text:V,isExported:H,extends:$||void 0,implements:F,generics:Y||void 0,modifiers:U?["abstract"]:void 0,leadingComments:Q,start:J,end:j}}function zj(){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}if(z("static")&&Dj("static")===123){j+=6,O(),A(123,125);continue}let H=!1,U=!1,X=!1,Y=!1,$=!1,F=!1,N=!1,V=!1,Q=!0;while(Q){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){U=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){X=!0,j+=6;continue}if(z("abstract")){Y=!0,j+=8;continue}if(z("readonly")){$=!0,j+=8;continue}if(z("override")){F=!0,j+=8;continue}if(z("accessor")){N=!0,j+=8;continue}if(z("async")){V=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=K||Z.charCodeAt(j)===125)break;if(Z.charCodeAt(j)===35)H=!0;if(H){Fj();continue}let G=" ";if(U)G+="protected ";if(X)G+="static ";if(Y)G+="abstract ";if($)G+="readonly ";if(z("constructor")){j+=11,O();let B=m();if(O(),uj(B,J),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let _=c(B);J.push(` constructor${_};`)}else if(z("get"))if(j+=3,O(),j<K&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let B=Oj();if(B.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),jj(),O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O(),m(),O();let _=jj()||"unknown";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;J.push(`${G}get ${B}(): ${_};`)}else Pj("get",G,X,$,V,J);else if(z("set"))if(j+=3,O(),j<K&&(Bj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let B=Oj();if(B.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O();let _=m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let g=c(_);J.push(`${G}set ${B}${g};`)}else Pj("set",G,X,$,V,J);else{let B=Z.charCodeAt(j)===42;if(B)j++,O();let _=Oj();if(!_){Fj();continue}bj(_,G,X,$,B,Y,V,J)}}return`{
19
- ${J.join(`
20
- `)}
21
- }`}function Oj(){if(j>=K)return"";let J=Z.charCodeAt(j);if(J===91){let H=j;return A(91,93),Z.slice(H,j)}if(J===35)return j++,`#${f()}`;return f()}function Dj(J){let H=j+J.length;while(H<K&&y(Z.charCodeAt(H)))H++;return H<K?Z.charCodeAt(H):0}function Fj(){let J=0;while(j<K){if(E())continue;let H=Z.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&e())return;j++}}function Pj(J,H,U,X,Y,$){bj(J,H,U,X,!1,!1,Y,$)}function bj(J,H,U,X,Y,$,F,N){if(O(),j>=K)return;let V=Z.charCodeAt(j),Q=!1;if(V===63)Q=!0,j++,O();if(j<K&&Z.charCodeAt(j)===33)j++,O();let G=j<K?Z.charCodeAt(j):0;if(G===40||G===60){let B=G===60?u():"";O();let _=m();O();let g=jj();if(!g)if(F&&Y)g="AsyncGenerator<unknown, void, unknown>";else if(Y)g="Generator<unknown, void, unknown>";else if(F)g="Promise<void>";else g="void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let q=c(_),R=Q?"?":"",M=Y?"*":"";N.push(`${H}${M}${J}${R}${B}${q}: ${g};`)}else if(G===58||G===61||G===59||G===125||G===10||G===13){let B="";if(G===58){j++,O();let q=j,R=0;while(j<K){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91||M===60)R++;else if(M===41||M===125||M===93||M===62&&!S()){if(R===0)break;R--}else if(R===0&&(M===59||M===44))break;else if(R===0&&M===61&&!Xj())break;if(R===0&&e())break;j++}B=v(q,j)}let _="";if(j<K&&Z.charCodeAt(j)===61)if(b&&B){j++;let q=0;while(j<K){if(E())continue;let R=Z.charCodeAt(j);if(R===40||R===123||R===91)q++;else if(R===41||R===125||R===93){if(q===0&&R===125)break;q--}else if(q===0&&R===59)break;if(q===0&&e())break;j++}}else{j++,O();let q=j,R=0;while(j<K){if(E())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91)R++;else if(M===41||M===125||M===93){if(R===0&&M===125)break;R--}else if(R===0&&M===59)break;if(R===0&&e())break;j++}_=v(q,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!B)if(_){let q=Qj(_);if(q)B=q;else B=U&&X?$j(_):Zj(_)}else B="unknown";let g=Q?"?":"";N.push(`${H}${J}${g}: ${B};`)}else Fj()}function uj(J,H){let U=J.slice(1,-1).trim();if(!U)return;let X=[],Y=0,$=0,F=!1,N=0;for(let V=0;V<=U.length;V++){if(V===U.length){X.push(U.slice(Y).trim());break}let Q=U.charCodeAt(V);if(F){if(Q===92){V++;continue}if(Q===N)F=!1;continue}if(Q===39||Q===34||Q===96){F=!0,N=Q;continue}if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&U.charCodeAt(V-1)===61))$--;else if(Q===44&&$===0)X.push(U.slice(Y,V).trim()),Y=V+1}for(let V of X){let Q=V.startsWith("public ")||V.startsWith("public\t"),G=V.startsWith("protected ")||V.startsWith("protected\t"),B=V.startsWith("private ")||V.startsWith("private\t"),_=V.includes("readonly ");if(!Q&&!G&&!B&&!_)continue;if(B)continue;let g=V,q=[];if(Q){let w=6;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("public")}if(G){let w=9;while(w<g.length&&y(g.charCodeAt(w)))w++;g=g.slice(w),q.push("protected")}if(_){let w=g.indexOf("readonly ");if(w!==-1){let s=w+8;while(s<g.length&&y(g.charCodeAt(s)))s++;g=g.slice(0,w)+g.slice(s)}q.push("readonly")}let R=q.length>0?`${q.join(" ")} `:"",M=Lj(g);H.push(` ${R}${M};`)}}function Gj(J=" "){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}let U=!1;if(z("export"))U=!0,j+=6,O();if(z("declare"))j+=7,O();let X=U?"export ":"";if(z("function")||z("async")&&xj("async","function")){let Y=!1;if(z("async"))Y=!0,j+=5,O();if(j+=8,O(),j<K&&Z.charCodeAt(j)===42)j++,O();let F=f();O();let N=u();O();let V=m();O();let Q=jj();if(!Q)Q=Y?"Promise<void>":"void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let G=c(V);H.push(`${J}${X}function ${F}${N}${G}: ${Q};`)}else if(z("const")||z("let")||z("var")){let Y=z("const")?"const":z("let")?"let":"var";j+=Y.length,O();let $=f();if(!$){I();continue}O();let F="";if(j<K&&Z.charCodeAt(j)===58){j++,O();let V=j,Q=0;while(j<K){if(E())continue;let G=Z.charCodeAt(j);if(G===40||G===123||G===91||G===60)Q++;else if(G===41||G===125||G===93||G===62&&!S())Q--;else if(Q===0&&(G===59||G===44))break;else if(Q===0&&G===61&&!Xj())break;if(Q===0&&p())break;j++}F=v(V,j)}let N="";if(j<K&&Z.charCodeAt(j)===61){j++,O();let V=j,Q=0;while(j<K){if(E())continue;let G=Z.charCodeAt(j);if(G===40||G===123||G===91||G===60)Q++;else if(G===41||G===125||G===93||G===62&&!S())Q--;else if(Q===0&&(G===59||G===44))break;if(Q===0&&p())break;j++}N=v(V,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!F&&N){let V=Qj(N);if(V)F=V;else if(Y==="const")F=$j(N);else F=Zj(N)}if(!F)F="unknown";H.push(`${J}${X}${Y} ${$}: ${F};`)}else if(z("interface")){j+=9,O();let Y=f();O();let $=u();O();let F="";if(z("extends")){let V=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}F=Z.slice(V,j)}let N=gj(Yj());H.push(`${J}${X}interface ${Y}${$}${F} ${N}`)}else if(z("type")){j+=4,O();let Y=f();O();let $=u();if(O(),j<K&&Z.charCodeAt(j)===61){j++,O();let F=j,N=0;while(j<K){if(E())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)N++;else if(Q===41||Q===125||Q===93||Q===62&&!S())N--;else if(N===0&&Q===59)break;if(N===0&&p())break;j++}let V=v(F,j);if(j<K&&Z.charCodeAt(j)===59)j++;H.push(`${J}${X}type ${Y}${$} = ${V}`)}}else if(z("class")){j+=5,O();let Y=f();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}let N=v(F,j),V=N?` ${N}`:"",Q=zj();H.push(`${J}${X}class ${Y}${$}${V} ${Q}`)}else if(z("enum")){j+=4,O();let Y=f();O();let $=Yj();H.push(`${J}${X}enum ${Y} ${$}`)}else if(z("namespace")||z("module")){let Y=z("namespace")?"namespace":"module";j+=Y.length,O();let $=f();O();let F=Gj(J);H.push(`${J}${X}${Y} ${$} ${F}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Y=f();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(E())continue;j++}let N=v(F,j),V=N?` ${N}`:"",Q=zj();H.push(`${J}${X}abstract class ${Y}${$}${V} ${Q}`)}else I();else if(U&&z("default")){j+=7,O();let Y=j;I();let $=v(Y,j);if($.charCodeAt($.length-1)===59)$=$.slice(0,-1);if($)H.push(`${J}export default ${$};`)}else if(!U&&(Z.charCodeAt(j)===39||Z.charCodeAt(j)===34||Z.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
22
- ${H.join(`
23
- `)}
24
- }`}function xj(J,H){let U=j+J.length;while(U<K&&y(Z.charCodeAt(U)))U++;for(let X=0;X<H.length;X++)if(U+X>=K||Z.charCodeAt(U+X)!==H.charCodeAt(X))return!1;return U+H.length>=K||!W(Z.charCodeAt(U+H.length))}function o(J,H,U){j+=U.length,O();let X="",Y=Z.charCodeAt(j);if(Y===39||Y===34){let Q=j;h(Y),X=Z.slice(Q,j)}else{X=f();while(j<K&&Z.charCodeAt(j)===46)j++,X+=`.${f()}`}O();let $=j<K&&Z.charCodeAt(j)===123?Gj():"{}",F=`${H?"export ":""}declare ${U} ${X} ${$}`,N=C(J),V=X.startsWith("'")||X.startsWith('"');return{kind:"module",name:X,text:F,isExported:H,source:V?X.slice(1,-1):void 0,leadingComments:N,start:J,end:j}}while(j<K){if(O(),j>=K)break;let J=j,H=Z.charCodeAt(j);if(H===105&&z("import"))L.push(Sj(J));else if(H===101&&z("export")){j+=6,O();let U=Z.charCodeAt(j);if(U===100&&z("default")){j+=7,O();let X=Z.charCodeAt(j);if(X===102&&z("function")){let Y=d(J,!0,!1,!0);if(Y)L.push(Y)}else if(X===97&&z("async")&&Dj("async")!==59)if(j+=5,O(),z("function")){let Y=d(J,!0,!0,!0);if(Y)L.push(Y)}else{I();let Y=v(J,j);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(X===99&&z("class")){let Y=a(J,!0,!1);L.push(Y)}else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let Y=a(J,!0,!0);L.push(Y)}}else{I();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,leadingComments:$,start:J,end:j})}}else if(U===116&&z("type")){let X=j;if(j+=4,O(),j<K&&Z.charCodeAt(j)===123){Nj();let Y=v(J,j),$=C(J);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),leadingComments:$,start:J,end:j})}else if(j<K&&Z.charCodeAt(j)===42){Rj();let Y=v(J,j);L.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,source:Uj(Y),start:J,end:j})}else{j=X;let Y=Vj(J,!0);L.push(Y)}}else if(U===105&&z("interface")){let X=Kj(J,!0);L.push(X)}else if(U===102&&z("function")){let X=d(J,!0,!1,!1);if(X)L.push(X)}else if(U===97&&z("async"))if(j+=5,O(),z("function")){let X=d(J,!0,!0,!1);if(X)L.push(X)}else I();else if(U===99)if(z("class")){let X=a(J,!0,!1);L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let Y=i(J,!0,!0);L.push(Y)}else{j=X;let Y=r(J,"const",!0);for(let $=0;$<Y.length;$++)L.push(Y[$])}}else I();else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let X=a(J,!0,!0);L.push(X)}}else if(U===108&&z("let")){let X=r(J,"let",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===118&&z("var")){let X=r(J,"var",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else if(U===101&&z("enum")){let X=i(J,!0,!1);L.push(X)}else if(U===100&&z("declare"))j+=7,O(),wj(J,!0);else if(U===110&&z("namespace")&&Jj(9)){let X=o(J,!0,"namespace");L.push(X)}else if(U===109&&z("module")&&Jj(6)){let X=o(J,!0,"module");L.push(X)}else if(U===123){Nj();let X=v(J,j),Y=X.includes("export type"),$=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:Y,source:Uj(X),leadingComments:$,start:J,end:j})}else if(U===42){Rj();let X=v(J,j),Y=C(J);L.push({kind:"export",name:"",text:X,isExported:!0,isTypeOnly:!1,source:Uj(X),leadingComments:Y,start:J,end:j})}else{I();let X=v(J,j);if(X)L.push({kind:"export",name:"",text:X,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),wj(J,!1);else if(H===105&&z("interface")){let U=Kj(J,!1);P.set(U.name,U)}else if(H===116&&z("type")){let U=Vj(J,!1);P.set(U.name,U),L.push(U)}else if(H===102&&z("function")){let U=d(J,!1,!1,!1);if(U)P.set(U.name,U);else I()}else if(H===97)if(z("async")){let U=j;if(j+=5,O(),z("function")){let X=d(J,!1,!0,!1);if(X)P.set(X.name,X);else j=U,I()}else j=U,I()}else if(z("abstract"))if(j+=8,O(),z("class")){let U=a(J,!1,!1);P.set(U.name,U),L.push(U)}else I();else j++,I();else if(H===99)if(z("class")){let U=a(J,!1,!1);P.set(U.name,U),L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,!1,!0);P.set(X.name,X),L.push(X)}else{j=U;let X=r(J,"const",!1);for(let Y=0;Y<X.length;Y++)P.set(X[Y].name,X[Y])}}else j++,I();else if(H===101&&z("enum")){let U=i(J,!1,!1);P.set(U.name,U),L.push(U)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")&&Jj(6)){let U=o(J,!1,"module");L.push(U)}else if(H===110&&z("namespace")&&Jj(9)){let U=o(J,!1,"namespace");L.push(U)}else{let U=Z.charCodeAt(j);if(U===39||U===34){if(h(U),j<K&&Z.charCodeAt(j)===59)j++}else if(U===96){if(t(),j<K&&Z.charCodeAt(j)===59)j++}else if(U===64){if(j++,f(),O(),j<K&&Z.charCodeAt(j)===46)j++,f(),O();if(j<K&&Z.charCodeAt(j)===40)A(40,41)}else j++,I()}}if(P.size>0)mj(L,P);if(x.size>0){let J=new Map;for(let U of L)if(U.kind==="function")J.set(U.name,(J.get(U.name)||0)+1);let H=new Set;for(let[U,X]of J)if(X>1)H.add(U);if(H.size>0){let U=new Set;for(let X of H)for(let Y=L.length-1;Y>=0;Y--)if(L[Y].kind==="function"&&L[Y].name===X&&x.has(Y)){U.add(Y);break}if(U.size>0){let X=[...U].sort((Y,$)=>$-Y);for(let Y of X)L.splice(Y,1)}}}return L;function wj(J,H){if(z("function")){let U=d(J,H,!1,!1);if(U)L.push(U)}else if(z("async")){if(j+=5,O(),z("function")){let U=d(J,H,!0,!1);if(U)L.push(U)}}else if(z("class")){let U=a(J,H,!1);L.push(U)}else if(z("abstract")){if(j+=8,O(),z("class")){let U=a(J,H,!0);L.push(U)}}else if(z("interface")){let U=Kj(J,H);L.push(U)}else if(z("type")){let U=Vj(J,H);L.push(U)}else if(z("enum")){let U=i(J,H,!1);L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let X=i(J,H,!0);L.push(X)}else if(H){j=U;let X=r(J,"const",!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I()}else if(z("let")||z("var"))if(H){let U=z("let")?"let":"var",X=r(J,U,!0);for(let Y=0;Y<X.length;Y++)L.push(X[Y])}else I();else if(z("module")){let U=o(J,H,"module");L.push(U)}else if(z("namespace")){let U=o(J,H,"namespace");L.push(U)}else if(z("global")){j+=6,O();let X=`declare global ${j<K&&Z.charCodeAt(j)===123?Gj():"{}"}`,Y=C(J);L.push({kind:"module",name:"global",text:X,isExported:!1,leadingComments:Y,start:J,end:j})}else I()}}function vj(D,Hj){let T=0,l=D.length;while(T<l){let Z=D.charCodeAt(T);if(Z>=65&&Z<=90||Z>=97&&Z<=122||Z===95||Z===36||Z>127){let n=T;T++;while(T<l){let b=D.charCodeAt(T);if(b>=65&&b<=90||b>=97&&b<=122||b>=48&&b<=57||b===95||b===36||b>127)T++;else break}Hj.add(D.substring(n,T))}else T++}}function mj(D,Hj){let T=new Set,l=new Set;for(let b of D)l.add(b.name);let Z=new Set,n=[];for(let b=0;b<D.length;b++)if(D[b].kind!=="import")n.push(D[b].text),vj(D[b].text,Z);for(;;){let b=[];for(let[P,x]of Hj){if(T.has(P))continue;if(Z.has(P)){if(!l.has(P))b.push(x),l.add(P);T.add(P)}}if(b.length===0)break;b.sort((P,x)=>(P.start??1/0)-(x.start??1/0));let K=[],L=0;for(let P=0;P<D.length;P++){let x=D[P].start??1/0;while(L<b.length&&(b[L].start??1/0)<=x)K.push(b[L++]);K.push(D[P])}while(L<b.length)K.push(b[L++]);D.length=0;for(let P=0;P<K.length;P++)D.push(K[P]);for(let P of b)if(P.kind!=="import")n.push(P.text),vj(P.text,Z)}}
25
- export{dj as oc};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ic as a,jc as b,kc as c}from"./chunk-4s9jv983.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{oc as a}from"./chunk-2r21f44d.js";import"./chunk-mcdb3q06.js";export{a as scanDeclarations};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tb as c,ub as d,vb as e}from"./chunk-x3q42h61.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import{ic as a,jc as b}from"./chunk-4s9jv983.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-vpjw38x7.js";import"./chunk-285mqzvx.js";import"./chunk-a3txc27m.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{e as watch,a as processSource,d as processFile,c as generate,b as clearResultCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{a,b,c}from"./chunk-83e9a4fq.js";import"./chunk-y581wnfe.js";import"./chunk-2n1bbm2c.js";import"./chunk-8z31rkfp.js";import"./chunk-2r21f44d.js";import"./chunk-285mqzvx.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};