@dtsx/dtsx 0.11.37 → 0.11.38

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 (179) hide show
  1. package/dist/bin/cli.js +3 -3
  2. package/dist/{chunk-wrnz0e76.js → chunk-082w7zvy.js} +3 -3
  3. package/dist/{chunk-psrgw9f8.js → chunk-0k0fhq13.js} +7 -7
  4. package/dist/{chunk-69dbf6de.js → chunk-0rmbc5zp.js} +2 -2
  5. package/dist/{chunk-nn9tpxx3.js → chunk-0yg5mcrf.js} +2 -2
  6. package/dist/chunk-0zfzhn19.js +31 -0
  7. package/dist/chunk-189nn4fc.js +3 -0
  8. package/dist/{chunk-cen2t56g.js → chunk-1qtghb2x.js} +2 -2
  9. package/dist/{chunk-r4zkf9ag.js → chunk-2436cnmb.js} +2 -2
  10. package/dist/{chunk-py7pj8aj.js → chunk-2qd3axyx.js} +4 -4
  11. package/dist/{chunk-n2nyd0ck.js → chunk-32qexm3w.js} +2 -2
  12. package/dist/{chunk-1pz7zxhc.js → chunk-3fbt79hx.js} +2 -2
  13. package/dist/{chunk-gpq2kggq.js → chunk-3t57mzvf.js} +2 -2
  14. package/dist/{chunk-2kwjbk55.js → chunk-42j9cfte.js} +2 -2
  15. package/dist/{chunk-vtskg4r2.js → chunk-4fygcxtb.js} +2 -2
  16. package/dist/{chunk-437g8zz6.js → chunk-50h54rax.js} +3 -3
  17. package/dist/{chunk-aw48mk3t.js → chunk-6yvk3q1e.js} +2 -2
  18. package/dist/chunk-73dzve1s.js +3 -0
  19. package/dist/chunk-7tremqhs.js +14 -0
  20. package/dist/{chunk-mt9219xc.js → chunk-83qnrx0m.js} +5 -5
  21. package/dist/{chunk-ckq8g1ck.js → chunk-88gwzbew.js} +3 -3
  22. package/dist/{chunk-90aptjh6.js → chunk-8d3sdkv4.js} +19 -19
  23. package/dist/{chunk-srg5qhch.js → chunk-8tzd98q8.js} +4 -4
  24. package/dist/{chunk-fy97syc2.js → chunk-96atbsd3.js} +2 -2
  25. package/dist/{chunk-h7k9wamx.js → chunk-9gts9ymh.js} +2 -2
  26. package/dist/{chunk-sq34kkhy.js → chunk-9menejdz.js} +2 -2
  27. package/dist/{chunk-1h6ycqza.js → chunk-a7nvyxpg.js} +4 -4
  28. package/dist/{chunk-j6pfxvy8.js → chunk-ag1b6d30.js} +2 -2
  29. package/dist/{chunk-0ke9xh7t.js → chunk-bnry23ve.js} +3 -3
  30. package/dist/{chunk-wzcwctba.js → chunk-bxc2herz.js} +3 -3
  31. package/dist/{chunk-pzedkn7z.js → chunk-cpmqa8kd.js} +2 -2
  32. package/dist/{chunk-rdzfdjkb.js → chunk-cv29b4zb.js} +3 -3
  33. package/dist/{chunk-xr1h3tv2.js → chunk-cyr45de1.js} +2 -2
  34. package/dist/{chunk-m1khpcqb.js → chunk-d0bazr3p.js} +1 -1
  35. package/dist/{chunk-vae5wxar.js → chunk-danfamyx.js} +2 -2
  36. package/dist/{chunk-853ftm92.js → chunk-davy89dj.js} +5 -5
  37. package/dist/{chunk-n6nw7sn2.js → chunk-e29rp5xj.js} +5 -5
  38. package/dist/{chunk-p7w9ydhe.js → chunk-eba562w8.js} +2 -2
  39. package/dist/{chunk-v44crx69.js → chunk-ebjafajx.js} +11 -11
  40. package/dist/{chunk-g9d5r6a8.js → chunk-ft2zk7jx.js} +2 -2
  41. package/dist/chunk-g2120ysy.js +3 -0
  42. package/dist/chunk-ghfd34r7.js +3 -0
  43. package/dist/{chunk-sjneg7p7.js → chunk-gspsxc9d.js} +8 -8
  44. package/dist/{chunk-n3p7wedp.js → chunk-h3n6256r.js} +2 -2
  45. package/dist/{chunk-4f2mwn7p.js → chunk-hnqm1zb3.js} +4 -4
  46. package/dist/{chunk-gs7wfk8b.js → chunk-htgy94y3.js} +1 -1
  47. package/dist/{chunk-knrtwppp.js → chunk-hv8bx8xx.js} +6 -6
  48. package/dist/chunk-hzn9kmq7.js +3 -0
  49. package/dist/{chunk-nchp0pqa.js → chunk-ja7bp731.js} +2 -2
  50. package/dist/chunk-jcckwgb9.js +3 -0
  51. package/dist/{chunk-s0mvstt0.js → chunk-kfk554fj.js} +2 -2
  52. package/dist/{chunk-1e10w914.js → chunk-kkshxyex.js} +3 -3
  53. package/dist/{chunk-bdxq6500.js → chunk-kpbz61yy.js} +3 -3
  54. package/dist/{chunk-w9av39jy.js → chunk-mkakbjvs.js} +2 -2
  55. package/dist/{chunk-xsf941gw.js → chunk-mwyjxjqa.js} +2 -2
  56. package/dist/{chunk-n37yj3xv.js → chunk-p023fhce.js} +3 -3
  57. package/dist/chunk-p9vfxn8g.js +3 -0
  58. package/dist/{chunk-q0hn0ymb.js → chunk-pjqzkgzk.js} +4 -4
  59. package/dist/chunk-qzjzw9p2.js +3 -0
  60. package/dist/{chunk-acyj1dev.js → chunk-rbx6q1r0.js} +2 -2
  61. package/dist/{chunk-fgbdm1y6.js → chunk-rkstz4w1.js} +4 -4
  62. package/dist/{chunk-gsv5yc32.js → chunk-rz060wxt.js} +4 -4
  63. package/dist/{chunk-z4mvkazp.js → chunk-sd8bywh9.js} +11 -11
  64. package/dist/{chunk-dv5hhg1a.js → chunk-sv8h007a.js} +2 -2
  65. package/dist/{chunk-1bpv3tck.js → chunk-t4va49p3.js} +4 -4
  66. package/dist/{chunk-bqabznps.js → chunk-tka2m4af.js} +2 -2
  67. package/dist/{chunk-7610h2tf.js → chunk-v93389xm.js} +1 -1
  68. package/dist/{chunk-wnk9yjw2.js → chunk-vf3ybe5r.js} +2 -2
  69. package/dist/{chunk-ezbp8tss.js → chunk-vkahj2ab.js} +8 -8
  70. package/dist/chunk-wnqg6hem.js +27 -0
  71. package/dist/chunk-xa6rsd4b.js +29 -0
  72. package/dist/{chunk-gsb3ty07.js → chunk-xfjfhe9d.js} +2 -2
  73. package/dist/{chunk-5n0tfrpc.js → chunk-xwpn40p0.js} +3 -3
  74. package/dist/chunk-y1g6v96c.js +10 -0
  75. package/dist/{chunk-r4s18nn5.js → chunk-y5k0szq6.js} +2 -2
  76. package/dist/{chunk-km8t8gqg.js → chunk-yay68832.js} +2 -2
  77. package/dist/{chunk-strqhcqs.js → chunk-yrv6z221.js} +2 -2
  78. package/dist/chunk-yx1jy7fx.js +37 -0
  79. package/dist/{chunk-ggbahdr2.js → chunk-zgcdx773.js} +3 -3
  80. package/dist/{chunk-60ssvwc8.js → chunk-zk3w5sqv.js} +2 -2
  81. package/dist/src/augmentation-graph.js +1 -1
  82. package/dist/src/binding-patterns.js +1 -1
  83. package/dist/src/branded-types.js +1 -1
  84. package/dist/src/bundle-linker.js +1 -1
  85. package/dist/src/bundler.js +1 -1
  86. package/dist/src/cache.js +1 -1
  87. package/dist/src/call-signatures.js +1 -1
  88. package/dist/src/circular.js +1 -1
  89. package/dist/src/compat.js +1 -1
  90. package/dist/src/computed-keys.js +1 -1
  91. package/dist/src/config.js +1 -1
  92. package/dist/src/dangling-refs.js +1 -1
  93. package/dist/src/declaration-project.js +1 -1
  94. package/dist/src/declaration-publication.js +1 -1
  95. package/dist/src/declaration-references.js +1 -1
  96. package/dist/src/diff.js +1 -1
  97. package/dist/src/docs.js +1 -1
  98. package/dist/src/enum-declarations.js +1 -1
  99. package/dist/src/errors.js +1 -1
  100. package/dist/src/extractor/directives.js +1 -1
  101. package/dist/src/extractor/extract.js +1 -1
  102. package/dist/src/extractor/scanner.js +1 -1
  103. package/dist/src/extractor.js +1 -1
  104. package/dist/src/formats.js +1 -1
  105. package/dist/src/formatter.js +1 -1
  106. package/dist/src/function-properties.js +1 -1
  107. package/dist/src/generator.js +1 -1
  108. package/dist/src/global-types.js +1 -1
  109. package/dist/src/import-sorter.js +1 -1
  110. package/dist/src/incremental.js +1 -1
  111. package/dist/src/index.js +1 -1
  112. package/dist/src/inferred-imports.js +1 -1
  113. package/dist/src/json-config.js +1 -1
  114. package/dist/src/logger.js +1 -1
  115. package/dist/src/lsp.js +1 -1
  116. package/dist/src/memory.js +1 -1
  117. package/dist/src/merger.js +1 -1
  118. package/dist/src/module-graph.js +1 -1
  119. package/dist/src/native-checker.js +1 -1
  120. package/dist/src/native-engine.js +1 -1
  121. package/dist/src/native-extractor.js +1 -1
  122. package/dist/src/native-generation.js +1 -1
  123. package/dist/src/native-project.js +1 -1
  124. package/dist/src/optimizer.js +1 -1
  125. package/dist/src/output-normalizer.js +1 -1
  126. package/dist/src/parallel-processor.js +1 -1
  127. package/dist/src/parameters.js +1 -1
  128. package/dist/src/parser.js +1 -1
  129. package/dist/src/plugins/bun.js +1 -1
  130. package/dist/src/plugins/esbuild.js +1 -1
  131. package/dist/src/plugins/index.js +1 -1
  132. package/dist/src/plugins/tsdown.js +1 -1
  133. package/dist/src/plugins/tsup.js +1 -1
  134. package/dist/src/plugins/vite.js +1 -1
  135. package/dist/src/plugins/webpack.js +1 -1
  136. package/dist/src/plugins.js +1 -1
  137. package/dist/src/process-source.js +1 -1
  138. package/dist/src/processor/cache.js +1 -1
  139. package/dist/src/processor/comments.js +1 -1
  140. package/dist/src/processor/declarations.js +1 -1
  141. package/dist/src/processor/import-usage.js +1 -1
  142. package/dist/src/processor/imports.js +1 -1
  143. package/dist/src/processor/index.js +1 -1
  144. package/dist/src/processor/type-inference.js +1 -1
  145. package/dist/src/processor.js +1 -1
  146. package/dist/src/profiling.js +1 -1
  147. package/dist/src/return-type-scope.js +1 -1
  148. package/dist/src/security.js +1 -1
  149. package/dist/src/source-cache.js +1 -1
  150. package/dist/src/sourcemap.js +1 -1
  151. package/dist/src/stx.js +1 -1
  152. package/dist/src/syntax-validator.js +1 -1
  153. package/dist/src/tracking.js +1 -1
  154. package/dist/src/transformers.js +1 -1
  155. package/dist/src/tree-shaker.js +1 -1
  156. package/dist/src/tsconfig.js +1 -1
  157. package/dist/src/type-mappings.js +1 -1
  158. package/dist/src/utils.js +1 -1
  159. package/dist/src/value-inference.js +1 -1
  160. package/dist/src/vue.js +1 -1
  161. package/dist/src/watcher.js +1 -1
  162. package/dist/src/worker-thread.js +1 -1
  163. package/dist/src/worker.js +1 -1
  164. package/dist/src/workspace.js +1 -1
  165. package/package.json +1 -1
  166. package/dist/chunk-0azm93j9.js +0 -31
  167. package/dist/chunk-25vyhfzh.js +0 -3
  168. package/dist/chunk-79nv7twc.js +0 -14
  169. package/dist/chunk-cs4gwz1k.js +0 -27
  170. package/dist/chunk-d43bpfk6.js +0 -3
  171. package/dist/chunk-dfye109x.js +0 -3
  172. package/dist/chunk-n94729d9.js +0 -3
  173. package/dist/chunk-p2qz2nk2.js +0 -3
  174. package/dist/chunk-qnf4byak.js +0 -3
  175. package/dist/chunk-rmdwvzgn.js +0 -3
  176. package/dist/chunk-s6c98nad.js +0 -29
  177. package/dist/chunk-t1jtn2r0.js +0 -10
  178. package/dist/chunk-ttc5pr8y.js +0 -37
  179. package/dist/chunk-xb92nrsm.js +0 -3
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"../chunk-pga5m4wm.js";import"../chunk-z4mvkazp.js";import"../chunk-mt9219xc.js";import"../chunk-zq93f8ca.js";import"../chunk-1j6092xz.js";import"../chunk-v6fwy63g.js";import"../chunk-cen2t56g.js";import"../chunk-2kwjbk55.js";import"../chunk-n2nyd0ck.js";import"../chunk-j6pfxvy8.js";import"../chunk-gsb3ty07.js";import"../chunk-69dbf6de.js";import"../chunk-rdzfdjkb.js";import"../chunk-90aptjh6.js";import"../chunk-xr1h3tv2.js";import"../chunk-s6c98nad.js";import"../chunk-ttc5pr8y.js";import"../chunk-gpq2kggq.js";import"../chunk-wnk9yjw2.js";import"../chunk-g9d5r6a8.js";import"../chunk-25vyhfzh.js";import"../chunk-1pz7zxhc.js";import{r}from"../chunk-qnf4byak.js";import"../chunk-60ssvwc8.js";import"../chunk-vtskg4r2.js";import{l}from"../chunk-t1jtn2r0.js";import"../chunk-w9av39jy.js";import{Ue}from"../chunk-n94729d9.js";import*as E from"fs";import{parentPort as M}from"worker_threads";var P=typeof Bun<"u"?Bun:null,S=P?null:E,R=Promise.resolve({extractDeclarations:r,processDeclarations:l});async function T(e){let u=Date.now();try{let{extractDeclarations:m,processDeclarations:A}=await R,f=e.config?.keepComments,C=e.config?.isolatedDeclarations,v=e.config?.importOrder;if(e.type==="process-batch"){let{filePaths:o,outPaths:D}=e,p=o?null:e.files||[],d=o?o.length:p.length,w=e.writeOutput===!0,y=w?null:Array(d),c=null,b=e.sources;if(!b&&d>0){let t=Array(d);for(let s=0;s<d;s++){let i=p?p[s]:null,h=i?i.sourceCode:void 0,n=o?o[s]:i.filePath;if(h!=null)t[s]=Promise.resolve(h);else if(P)t[s]=P.file(n).text();else t[s]=Promise.resolve(S.readFileSync(n,"utf-8"))}b=await Promise.all(t)}let x={filePath:"",sourceCode:"",declarations:[]},O=w&&P?Array(d):null,F=!0;for(let t=0;t<d;t++){let s=p?p[t]:null,i=o?o[t]:s.filePath,h=D?D[t]:s?s.outPath:void 0;try{let n=b?b[t]:s?.sourceCode||"",a=null,g=Ue(n,i,f??!0,v??["bun"],C??!1);if(g===null)a=m(n,i,f,C),x.filePath=i,x.sourceCode=n,x.declarations=a,g=A(a,x,f??!0,v);if(w){if(!h)throw Error(`Missing outPath for ${i}`);if(P)O[t]=P.write(h,g);else S.writeFileSync(h,g)}else if(y)y[t]={filePath:i,success:!0,content:g,declarations:a}}catch(n){let a=n&&n.message?n.message:String(n);if(w){if(!c)c=[];c.push({filePath:i,success:!1,error:a})}else if(y)y[t]={filePath:i,success:!1,error:a};F=!1}}if(O)await Promise.all(O);let B=c?.length?`${c[0].filePath}: ${c[0].error||"Worker batch failed"}`:void 0;return{id:e.id,success:F,filePath:e.filePath,batchResults:w?c||void 0:y,error:B,duration:Date.now()-u}}if(e.type==="extract"){let o=m(e.sourceCode,e.filePath,f,C);return{id:e.id,success:!0,filePath:e.filePath,declarations:o,duration:Date.now()-u}}if(e.type==="process"){let o=m(e.sourceCode,e.filePath,f,C),D=A(o,{filePath:e.filePath,sourceCode:e.sourceCode,declarations:o},f??!0,v);return{id:e.id,success:!0,filePath:e.filePath,content:D,declarations:o,duration:Date.now()-u}}throw Error(`Unknown task type: ${e.type}`)}catch(m){return{id:e.id,success:!1,filePath:e.filePath,error:m.message,duration:Date.now()-u}}}M?.on("message",async(e)=>{let u=await T(e);M.postMessage(u)});
2
+ import"../chunk-pga5m4wm.js";import"../chunk-sd8bywh9.js";import"../chunk-83qnrx0m.js";import"../chunk-zq93f8ca.js";import"../chunk-1j6092xz.js";import"../chunk-v6fwy63g.js";import"../chunk-1qtghb2x.js";import"../chunk-42j9cfte.js";import"../chunk-32qexm3w.js";import"../chunk-ag1b6d30.js";import"../chunk-xfjfhe9d.js";import"../chunk-0rmbc5zp.js";import"../chunk-cv29b4zb.js";import"../chunk-8d3sdkv4.js";import"../chunk-cyr45de1.js";import"../chunk-xa6rsd4b.js";import"../chunk-yx1jy7fx.js";import"../chunk-3t57mzvf.js";import"../chunk-vf3ybe5r.js";import"../chunk-ft2zk7jx.js";import"../chunk-189nn4fc.js";import"../chunk-3fbt79hx.js";import{r}from"../chunk-jcckwgb9.js";import"../chunk-zk3w5sqv.js";import"../chunk-4fygcxtb.js";import{l}from"../chunk-y1g6v96c.js";import"../chunk-mkakbjvs.js";import{je}from"../chunk-hzn9kmq7.js";import*as E from"fs";import{parentPort as M}from"worker_threads";var P=typeof Bun<"u"?Bun:null,S=P?null:E,R=Promise.resolve({extractDeclarations:r,processDeclarations:l});async function T(e){let u=Date.now();try{let{extractDeclarations:m,processDeclarations:A}=await R,f=e.config?.keepComments,C=e.config?.isolatedDeclarations,v=e.config?.importOrder;if(e.type==="process-batch"){let{filePaths:o,outPaths:D}=e,p=o?null:e.files||[],d=o?o.length:p.length,w=e.writeOutput===!0,y=w?null:Array(d),c=null,b=e.sources;if(!b&&d>0){let t=Array(d);for(let s=0;s<d;s++){let i=p?p[s]:null,h=i?i.sourceCode:void 0,n=o?o[s]:i.filePath;if(h!=null)t[s]=Promise.resolve(h);else if(P)t[s]=P.file(n).text();else t[s]=Promise.resolve(S.readFileSync(n,"utf-8"))}b=await Promise.all(t)}let x={filePath:"",sourceCode:"",declarations:[]},O=w&&P?Array(d):null,F=!0;for(let t=0;t<d;t++){let s=p?p[t]:null,i=o?o[t]:s.filePath,h=D?D[t]:s?s.outPath:void 0;try{let n=b?b[t]:s?.sourceCode||"",a=null,g=je(n,i,f??!0,v??["bun"],C??!1);if(g===null)a=m(n,i,f,C),x.filePath=i,x.sourceCode=n,x.declarations=a,g=A(a,x,f??!0,v);if(w){if(!h)throw Error(`Missing outPath for ${i}`);if(P)O[t]=P.write(h,g);else S.writeFileSync(h,g)}else if(y)y[t]={filePath:i,success:!0,content:g,declarations:a}}catch(n){let a=n&&n.message?n.message:String(n);if(w){if(!c)c=[];c.push({filePath:i,success:!1,error:a})}else if(y)y[t]={filePath:i,success:!1,error:a};F=!1}}if(O)await Promise.all(O);let B=c?.length?`${c[0].filePath}: ${c[0].error||"Worker batch failed"}`:void 0;return{id:e.id,success:F,filePath:e.filePath,batchResults:w?c||void 0:y,error:B,duration:Date.now()-u}}if(e.type==="extract"){let o=m(e.sourceCode,e.filePath,f,C);return{id:e.id,success:!0,filePath:e.filePath,declarations:o,duration:Date.now()-u}}if(e.type==="process"){let o=m(e.sourceCode,e.filePath,f,C),D=A(o,{filePath:e.filePath,sourceCode:e.sourceCode,declarations:o},f??!0,v);return{id:e.id,success:!0,filePath:e.filePath,content:D,declarations:o,duration:Date.now()-u}}throw Error(`Unknown task type: ${e.type}`)}catch(m){return{id:e.id,success:!1,filePath:e.filePath,error:m.message,duration:Date.now()-u}}}M?.on("message",async(e)=>{let u=await T(e);M.postMessage(u)});
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Lt,er,Ei,ki,Ti}from"../chunk-437g8zz6.js";import"../chunk-km8t8gqg.js";export{Lt as WorkerPool,ki as batchFiles,Ti as calculateOptimalBatchSize,er as createWorkerPool,Ei as parallelProcess};
2
+ import{Nt,lr,qi,Ji,Yi}from"../chunk-50h54rax.js";import"../chunk-yay68832.js";export{Nt as WorkerPool,Ji as batchFiles,Yi as calculateOptimalBatchSize,lr as createWorkerPool,qi as parallelProcess};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Hr,Kr,nn,oo,qr,Jr,ao}from"../chunk-5n0tfrpc.js";import"../chunk-0azm93j9.js";import"../chunk-psrgw9f8.js";import"../chunk-nn9tpxx3.js";import"../chunk-acyj1dev.js";import"../chunk-wzcwctba.js";import"../chunk-p2qz2nk2.js";import"../chunk-bqabznps.js";import"../chunk-s0mvstt0.js";import"../chunk-79nv7twc.js";import"../chunk-n37yj3xv.js";import"../chunk-aw48mk3t.js";import"../chunk-853ftm92.js";import"../chunk-xb92nrsm.js";import"../chunk-v44crx69.js";import"../chunk-n94729d9.js";import"../chunk-w9av39jy.js";import"../chunk-vae5wxar.js";import"../chunk-t1jtn2r0.js";import"../chunk-60ssvwc8.js";import"../chunk-vtskg4r2.js";import"../chunk-qnf4byak.js";import"../chunk-1pz7zxhc.js";import"../chunk-pga5m4wm.js";import"../chunk-25vyhfzh.js";import"../chunk-mt9219xc.js";import"../chunk-ezbp8tss.js";import"../chunk-v6fwy63g.js";import"../chunk-cs4gwz1k.js";import"../chunk-ttc5pr8y.js";import"../chunk-xr1h3tv2.js";import"../chunk-gsb3ty07.js";import"../chunk-s6c98nad.js";import"../chunk-z4mvkazp.js";import"../chunk-g9d5r6a8.js";import"../chunk-wnk9yjw2.js";import"../chunk-gpq2kggq.js";import"../chunk-90aptjh6.js";import"../chunk-rdzfdjkb.js";import"../chunk-n2nyd0ck.js";import"../chunk-j6pfxvy8.js";import"../chunk-2kwjbk55.js";import"../chunk-69dbf6de.js";import"../chunk-cen2t56g.js";import"../chunk-d43bpfk6.js";import"../chunk-rmdwvzgn.js";import"../chunk-pzedkn7z.js";import"../chunk-km8t8gqg.js";import"../chunk-dfye109x.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{qr as discoverWorkspaceFromPackageJson,Hr as discoverWorkspaceProjects,ao as generateFromPackageWorkspaces,oo as generateMonorepo,nn as generateWorkspace,Jr as resolveWorkspacePatterns,Kr as sortProjectsByDependencies};
2
+ import{jr,_r,nn,qs,Gr,Vr,Js}from"../chunk-xwpn40p0.js";import"../chunk-0zfzhn19.js";import"../chunk-rbx6q1r0.js";import"../chunk-0k0fhq13.js";import"../chunk-hzn9kmq7.js";import"../chunk-y1g6v96c.js";import"../chunk-zk3w5sqv.js";import"../chunk-vkahj2ab.js";import"../chunk-tka2m4af.js";import"../chunk-kfk554fj.js";import"../chunk-mkakbjvs.js";import"../chunk-7tremqhs.js";import"../chunk-danfamyx.js";import"../chunk-wnqg6hem.js";import"../chunk-0yg5mcrf.js";import"../chunk-p023fhce.js";import"../chunk-6yvk3q1e.js";import"../chunk-ghfd34r7.js";import"../chunk-bxc2herz.js";import"../chunk-davy89dj.js";import"../chunk-g2120ysy.js";import"../chunk-4fygcxtb.js";import"../chunk-ebjafajx.js";import"../chunk-p9vfxn8g.js";import"../chunk-qzjzw9p2.js";import"../chunk-cpmqa8kd.js";import"../chunk-73dzve1s.js";import"../chunk-yay68832.js";import"../chunk-jcckwgb9.js";import"../chunk-189nn4fc.js";import"../chunk-83qnrx0m.js";import"../chunk-sd8bywh9.js";import"../chunk-3fbt79hx.js";import"../chunk-pga5m4wm.js";import"../chunk-v6fwy63g.js";import"../chunk-yx1jy7fx.js";import"../chunk-cyr45de1.js";import"../chunk-xfjfhe9d.js";import"../chunk-xa6rsd4b.js";import"../chunk-ft2zk7jx.js";import"../chunk-vf3ybe5r.js";import"../chunk-3t57mzvf.js";import"../chunk-ag1b6d30.js";import"../chunk-8d3sdkv4.js";import"../chunk-cv29b4zb.js";import"../chunk-32qexm3w.js";import"../chunk-0rmbc5zp.js";import"../chunk-42j9cfte.js";import"../chunk-1qtghb2x.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{Gr as discoverWorkspaceFromPackageJson,jr as discoverWorkspaceProjects,Js as generateFromPackageWorkspaces,qs as generateMonorepo,nn as generateWorkspace,Vr as resolveWorkspacePatterns,_r as sortProjectsByDependencies};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dtsx/dtsx",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.11.37",
5
+ "version": "0.11.38",
6
6
  "description": "A modern, fast .d.ts generation tool, powered by Bun.",
7
7
  "author": "Chris Breuer <chris@stacksjs.org>",
8
8
  "license": "MIT",
@@ -1,31 +0,0 @@
1
- // @bun
2
- import{b,ae,Ot,f}from"./chunk-dfye109x.js";import{B}from"./chunk-pga5m4wm.js";import{R,M}from"./chunk-z4mvkazp.js";import{A,P}from"./chunk-mt9219xc.js";import{r}from"./chunk-qnf4byak.js";import{he}from"./chunk-xb92nrsm.js";import{e,I}from"./chunk-km8t8gqg.js";import{De,T,qn,V}from"./chunk-d43bpfk6.js";import{Tn}from"./chunk-cs4gwz1k.js";import{Ge,pt}from"./chunk-bqabznps.js";import{S}from"./chunk-v44crx69.js";import{me,J,G,ge}from"./chunk-853ftm92.js";import{Ve,_,q,mt,gt,ht,yt}from"./chunk-79nv7twc.js";import{K,pe}from"./chunk-s0mvstt0.js";import{ze,xt}from"./chunk-ezbp8tss.js";import{z}from"./chunk-acyj1dev.js";import{dn,_e}from"./chunk-p2qz2nk2.js";import{ye}from"./chunk-w9av39jy.js";import{je}from"./chunk-psrgw9f8.js";import{de}from"./chunk-wzcwctba.js";import{l}from"./chunk-t1jtn2r0.js";import{U,dt}from"./chunk-nn9tpxx3.js";import{mkdir as xe}from"fs/promises";import{availableParallelism as Pe}from"os";import{basename as fe,dirname as we,relative as H,resolve as oe}from"path";var re=new WeakMap,ce=new WeakMap;function ie(d){let a=re.get(d);if(!a)a=De(d),re.set(d,a),a.catch(()=>re.delete(d));return a}async function le(d,a,t,u,h,g=_){let o=fe(d)||"output.d.ts",w=H(we(d),a),W=`${o}.map`,Y=t.lastIndexOf(`
3
- ${Ve()}`),p=Y===-1?t:t.slice(0,Y),y=ht(p,o,w,u),C=`${d}.map`;return await g(C,JSON.stringify(y)),e.debug(` Generated source map: ${H(h,C)}`),W}async function s(d){let a=Date.now(),t={...S,...d};if(t.logLevel)I(t.logLevel);else if(t.verbose)I("debug");let u=new de;if(t.plugins&&t.plugins.length>0){for(let n of t.plugins)u.register(n),e.debug(`Registered plugin: ${n.name}`);t=await u.runOnStart(t)}if(t.moduleSpecifierMode!==void 0&&t.moduleSpecifierMode!=="preserve"&&t.moduleSpecifierMode!=="node")throw Error("moduleSpecifierMode must be preserve or node");if(await K(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await q(t);let h=t.typeMappings?U(t.typeMappings):void 0,g=null,o={generationMode:t.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},w=0;e.debug("Starting DTS generation..."),e.debug(`Using ${o.generationMode} declaration generation path`),e.debug("Config:",t);let W=await me(t,()=>ie(t)),Y=W.entryFiles,p=[...W.files],{resolver:y,reachability:C}=W;if(ce.set(t,new Set(p)),t.incremental){let n=W.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let v of p){let F=await f(v);m.set(v,_e(F));for(let ee of T(F,{includeImports:!0})){let O=y(ee.specifier,v).resolved;if(O&&!O.split(/[/\\]/).includes("node_modules")&&!i.has(O))i.add(O),m.set(O,_e(await f(O)))}}let c=[...m].sort(([v],[F])=>v.localeCompare(F));n=JSON.stringify([n,c])}if(g=new Ge(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)g.clear()}else if(g.load()){let m=g.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)pt(t.cwd)}if(g&&!t.dryRun){let n=g.prune(new Set(p),t.cwd);if(n>0)e.debug(`Pruned ${n} deleted files from cache`)}if(e.debug(`Found ${p.length} TypeScript files`),t.progress&&p.length>0){let n=t.parallel?"parallel":"sequential";e.info(`Processing ${p.length} files (${n})...`)}let L=new Map,N=new Map,E=async(n,i,m="lf")=>{N.set(n,{content:i,lineEnding:m})},D=async(n,i)=>{let m;try{let c=G(n,t),v=async(x)=>{if(!t.diff)return;try{let Q=await f(c),X=gt(Q,x,H(t.cwd,c));if(X)e.info(`
4
- ${X}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${H(t.cwd,c)}`)}},F=(x)=>{if(!t.validate)return 0;let Q=mt(x,c);if(Q.isValid)return e.debug(`[validation] ${c} - OK`),0;e.warn(`[validation] ${H(t.cwd,c)} has ${Q.errors.length} error(s):`);for(let X of Q.errors){let se=` Line ${X.line}:${X.column}`;if(X.code)se+=` [${X.code}]`;if(se+=` - ${X.message}`,e.warn(se),X.suggestion)e.warn(` Suggestion: ${X.suggestion}`)}return Q.errors.length},ee=(x)=>{e.info(`[dry-run] Would generate: ${c}`),e.debug("--- Content preview ---"),e.debug(x.slice(0,500)+(x.length>500?`
5
- ...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)L.set(n,x);await v(x);let Q=F(x);if(t.dryRun)ee(x);else{if(t.declarationMap)m=i??await f(n),await le(c,n,x,m,t.cwd,E);await E(c,x,t.lineEnding)}return e.debug(`[cached] ${H(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:Q}}}m=i??await f(n);let{content:O,declarationCount:Se,importCount:$e,exportCount:ve}=await be(n,m,t,u,h,W.augmentationImports.get(n));if(t.bundle)L.set(n,O);let j=O;if(t.prettier||t.indentStyle||t.indentSize){let x=await z(j,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);j=x.content;for(let Q of x.warnings??[])e.warn(`[format] ${Q}`)}if(t.declarationMap){let x=`${fe(c)||"output.d.ts"}.map`;j=yt(j,x)}await v(j);let Ee=F(j);if(t.dryRun)ee(j);else{if(t.declarationMap&&m)await le(c,n,j,m,t.cwd,E);if(await E(c,j,t.lineEnding),g&&m)g.update(n,m,j,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:Se,importCount:$e,exportCount:ve,validationErrorCount:Ee}}catch(c){let v=ze(c,n,m);if(t.plugins&&t.plugins.length>0)await u.runOnError(c instanceof Error?c:Error(String(c)),n,m||"");return{success:!1,file:n,declarationCount:0,importCount:0,exportCount:0,dtsError:v,validationErrorCount:0}}},k=t.parallel||t.parallel!==!1&&p.length>=10,Z=B(t.concurrency,Pe?.()??8),te=new Map;if(k&&p.length>1){let n=p.map(async(i)=>{try{let m=await f(i);return{file:i,source:m}}catch{return{file:i,source:null}}});for(let i of await Promise.all(n))if(i.source!==null)te.set(i.file,i.source)}let ne=(n)=>{if(o.filesProcessed++,n.success){if(n.cached)w++;else o.filesGenerated++,o.declarationsFound+=n.declarationCount,o.importsProcessed+=n.importCount,o.exportsProcessed+=n.exportCount;if(t.validate){if(o.filesValidated++,n.validationErrorCount)o.validationErrors+=n.validationErrorCount}}else if(o.filesFailed++,n.dtsError){o.errors.push(n.dtsError);let i=xt(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(k)for(let n=0;n<p.length;n+=Z){let i=p.slice(n,n+Z),m=await Promise.all(i.map((c)=>D(c,te.get(c))));for(let c of m)ne(c);if(t.progress){let c=Math.round(o.filesProcessed/p.length*100);e.info(`[${o.filesProcessed}/${p.length}] ${c}%`)}}else for(let n of p){let i=await D(n);if(ne(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${H(t.cwd,n)} ${c}`)}}if(!t.bundle){let n=[];if(C)for(let i of C.unresolved)n.push({from:i.from,specifier:i.specifier,reason:"missing"});if(t.autoIncludeReExports===!1&&p.length>0){let i=new Set(p);for(let m of p){let c;try{c=await f(m)}catch{continue}for(let v of T(c)){let F=y(v.specifier,m);if(!F.isRelative)continue;if(!F.resolved)n.push({from:m,specifier:v.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(F.resolved)&&!i.has(F.resolved))n.push({from:m,specifier:v.specifier,reason:"not-emitted"})}}}if(n.length>0){let i=[];i.push(`Found ${n.length} re-export(s) pointing at siblings that won't be in the output:`);for(let c of n){let v=H(t.cwd,c.from);if(c.reason==="missing")i.push(` ${v} \u2192 '${c.specifier}' (path not found on disk)`);else i.push(` ${v} \u2192 '${c.specifier}' (resolved but not in entrypoints; set autoIncludeReExports: true or add to entrypoints)`)}let m=i.join(`
6
- `);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||w>0)&&Y.length>0)try{e.debug("Bundling declarations...");let n=Y.length===1&&!!t.bundleOutput;for(let i of Y){let m=await V([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let O of m.reachable){if(O.endsWith(".d.ts"))continue;if(O.includes("node_modules"))continue;c.add(O)}let v=p.filter((O)=>c.has(O));if(!v.includes(i))v.push(i);let F=Tn(i,v,L,{cwd:t.cwd,keepComments:t.keepComments});for(let O of new Set(F.warnings))e.warn(`[bundle] ${O}`);let ee=n?oe(t.cwd,t.outdir,t.bundleOutput):G(i,t);if(t.dryRun)e.info(`[dry-run] Would bundle ${F.files.length} files to: ${H(t.cwd,ee)}`);else await E(ee,F.content,t.lineEnding),e.debug(`Prepared ${F.files.length} bundled files for: ${H(t.cwd,ee)}`);if(n)break}}catch(n){let i=n instanceof Error?n.message:String(n);throw e.error(`Bundle failed: ${i}`),n}if(!t.dryRun)await pe(t,N);if(g&&!t.dryRun)g.save(),e.debug("Saved build cache");if(o.durationMs=Date.now()-a,t.stats)if(t.outputFormat==="json")console.log(JSON.stringify(o,null,2));else{if(e.info(`
7
- --- Generation Statistics ---`),e.info(`Files processed: ${o.filesProcessed}`),e.info(`Files generated: ${o.filesGenerated}`),w>0)e.info(`Files cached: ${w}`);if(o.filesFailed>0)e.info(`Files failed: ${o.filesFailed}`);if(e.info(`Declarations found: ${o.declarationsFound}`),e.info(`Imports processed: ${o.importsProcessed}`),e.info(`Exports processed: ${o.exportsProcessed}`),o.filesValidated>0){if(e.info(`Files validated: ${o.filesValidated}`),o.validationErrors>0)e.info(`Validation errors: ${o.validationErrors}`)}if(e.info(`Duration: ${o.durationMs}ms`),o.errors.length>0){e.info(`
8
- Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.location.line}:${n.location.column}`;if(n.code)i+=` [${n.code}]`;if(i+=`: ${n.message}`,e.info(i),n.suggestion)e.info(` Suggestion: ${n.suggestion}`)}}e.info(`-----------------------------
9
- `)}if(t.plugins&&t.plugins.length>0)await u.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function Me(d,a,t){let u=await ie(t),h=ge(a,t,u,ce.get(t));return qn(d,(g)=>h(g).emittedSpecifier)}async function co(d,a){re.delete(a),ce.delete(a);let t=await ie(a),u=await V([d],{includeImports:!0,resolveSpecifier:t}),h=await he([...u.sources.keys()],t,a.isolatedDeclarations??!1,u.sources);return(await Ce(d,a,void 0,h.get(oe(d)))).content}async function Ce(d,a,t,u){let h=await f(d),g=a.typeMappings?U(a.typeMappings):void 0;return be(d,h,a,t,g,u)}async function be(d,a,t,u,h,g){let o=a;if(u)o=await u.runOnBeforeFile(d,a);let w=new Map;if(!t.isolatedDeclarations){let E=await ie(t);for(let D of T(o,{includeImports:!0})){let k=E(D.specifier,d).resolved;if(k&&!k.split(/[/\\]/).includes("node_modules"))w.set(D.specifier,await f(k))}}let W=u?.hasDeclarationHooks()?null:Re(o,d,t,w,g);if(W!==null)return ue(W,d,o,t,u,h,Fe(W));let Y=w.size?dn(o,w):void 0,p=r(o,d,t.keepComments,t.isolatedDeclarations??!1,Y);if(u)p=await u.runOnDeclarations(d,o,p);let y=0,C=0;for(let E=0;E<p.length;E++){let D=p[E];if(D.kind==="import")y++;if(D.kind==="export"||D.isExported)C++}let N=l(p,{filePath:d,sourceCode:o,declarations:p,augmentationImports:g},t.keepComments,t.importOrder);return ue(N,d,o,t,u,h,{declarationCount:p.length,importCount:y,exportCount:C})}function Fe(d){let a=0,t=0,u=0;for(let h of d.split(`
10
- `)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))u++}return{declarationCount:a,importCount:t,exportCount:u}}function Re(d,a,t,u,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=R(a)?M(d):A(a)?P(d):d;return ye(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,sourceFile:a,inferenceSources:u,augmentationImports:h})}async function ue(d,a,t,u,h,g,o){let w=await Me(d,a,u);if(g)w=dt(w,g,{filePath:a});if(u.normalizeOutput===!0||u.declarationOrder)w=je(w,{lineEnding:"lf",declarationOrder:u.declarationOrder,indent:{style:u.indentStyle??"spaces",size:u.indentSize??2}});if(h)w=await h.runOnAfterFile(a,t,w);return{content:w,...o}}async function lo(d){let a={...S,...d};if(a.logLevel)I(a.logLevel);let t=oe(a.cwd,a.root),u=150,h=5,g=1e4,o={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};e.info(`Watching for changes in ${t}...`),e.info(`Press Ctrl+C to stop
11
- `);try{await s(a),e.info(`[watch] Initial generation complete
12
- `)}catch(y){let C=y instanceof Error?y.message:String(y);e.error(`[watch] Initial generation failed: ${C}`),e.info(`[watch] Continuing to watch for changes...
13
- `)}async function w(){if(o.isProcessing||o.pendingChanges.size===0)return;let y=Date.now();if(o.errorCount>=h){if(y-o.lastErrorTime<g){e.warn(`[watch] Too many errors, pausing for ${Math.ceil((g-(y-o.lastErrorTime))/1000)}s...`);return}o.errorCount=0}o.isProcessing=!0;let C=Array.from(o.pendingChanges);o.pendingChanges.clear();let L=new Date().toLocaleTimeString();if(C.length===1)e.info(`
14
- [${L}] File changed: ${C[0]}`);else e.info(`
15
- [${L}] ${C.length} files changed`);let N=0,E=0;for(let D of C){let k=oe(t,D);try{let Z=a.exclude||[];if(J(k,Z,t)){e.debug(` Skipping excluded file: ${D}`);continue}if(!await ae(k).exists()){e.debug(` Skipping deleted file: ${D}`);continue}let ne=G(k,a),{content:n}=await Ce(k,a);await xe(we(ne),{recursive:!0}),await _(ne,n,a.lineEnding),e.info(` \u2713 ${H(a.cwd,ne)}`),N++}catch(Z){E++,o.errorCount++,o.lastErrorTime=Date.now();let te=ze(Z,k);if(e.error(` \u2717 ${D}: ${te.message}`),te.suggestion)e.error(` Suggestion: ${te.suggestion}`)}}if(C.length>1)e.info(` Done: ${N} generated, ${E} failed`);if(E===0)o.errorCount=0;if(o.isProcessing=!1,o.pendingChanges.size>0)o.debounceTimer=setTimeout(w,u)}function W(y){if(o.pendingChanges.add(y),o.debounceTimer)clearTimeout(o.debounceTimer);o.debounceTimer=setTimeout(w,u)}let p=Ot([b?"bun":"node","-e",`
16
- const fs = require('fs');
17
-
18
- const rootPath = '${t}';
19
-
20
- fs.watch(rootPath, { recursive: true }, (eventType, filename) => {
21
- if (filename && /.(?:[cm]?[jt]sx?|vue|stx)$/.test(filename) && !/.d.(?:ts|mts|cts)$/.test(filename)) {
22
- console.log(\`CHANGED:\${filename}\`);
23
- }
24
- });
25
-
26
- // Keep process alive
27
- setInterval(() => {}, 1000);
28
- `],{stdout:"pipe",stderr:"inherit"});if(b){let y=p.stdout.getReader(),C=new TextDecoder,L="";while(!0){let{done:N,value:E}=await y.read();if(N)break;L+=C.decode(E,{stream:!0});let D=L.split(`
29
- `);L=D.pop()||"";for(let k of D)if(k.startsWith("CHANGED:")){let Z=k.slice(8);W(Z)}}}else{let y=p.stdout,C="";y.on("data",(L)=>{C+=L.toString();let N=C.split(`
30
- `);C=N.pop()||"";for(let E of N)if(E.startsWith("CHANGED:")){let D=E.slice(8);W(D)}}),await p.exited}}
31
- export{s,co,lo};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{R,M}from"./chunk-z4mvkazp.js";import{A,P}from"./chunk-mt9219xc.js";import{Jn}from"./chunk-1j6092xz.js";import{p}from"./chunk-v6fwy63g.js";import{k,D}from"./chunk-ttc5pr8y.js";var y=100,h=0,s=new Map;function xe(n,a,c=!0,i=!1,l){if(R(a))n=M(n);else if(A(a))n=P(n);let f=p(n),m=`${a}:${c?1:0}:${i?1:0}:${JSON.stringify([...l??[]].sort())}`,r=s.get(m);if(r&&r.contentHash===f)return r.lastAccess=++h,r.declarations;let g=i?k(n,a,c):D(n,a,c,l);if(s.set(m,{declarations:g,contentHash:f,lastAccess:++h}),s.size>y){let S=Math.max(1,Math.ceil(s.size*0.1)),e=[];for(let[t,o]of s)e.push([t,o.lastAccess]);e.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<e.length;t++)s.delete(e[t][0])}return g}function Sn(){s.clear(),Jn()}
3
- export{xe,Sn};
@@ -1,14 +0,0 @@
1
- // @bun
2
- import{tt}from"./chunk-dfye109x.js";import{S}from"./chunk-v44crx69.js";import{pn}from"./chunk-n37yj3xv.js";import{be}from"./chunk-vae5wxar.js";import{oe}from"./chunk-rmdwvzgn.js";import y from"process";import{readdir as v}from"fs/promises";import{join as C,resolve as D}from"path";function Ve(){return`${String.fromCharCode(47,47,35)} sourceMappingURL=`}function $o(n,r){throw Error(r||`Unexpected value: ${n}`)}async function _(n,r,o="lf"){let t=r.replace(/\r\n/g,`
3
- `);if(!t.endsWith(`
4
- `))t+=`
5
- `;if(o==="crlf")t=t.replace(/\n/g,`\r
6
- `);if(await tt(n,t)!==Buffer.byteLength(t,"utf8"))throw Error(`Incomplete declaration write: ${n}`)}async function si(n){let r=n??S.root,o=await v(r,{withFileTypes:!0});return(await Promise.all(o.map((i)=>{let c=C(r,i.name);return i.isDirectory()?si(c):c}))).flat(1/0).filter((i)=>{if(typeof i!=="string")return!1;return/\.(?:ts|tsx|mts|cts)$/.test(i)&&!/\.d\.(?:ts|mts|cts)$/.test(i)})}async function q(n){try{let r=n?.cwd||y.cwd();return(await oe(D(r,n?.tsconfigPath||"tsconfig.json"),{allowCircular:!0}))?.isolatedDeclarations??!1}catch{return!1}}function mt(n,r){let o={isValid:!0,errors:[]};for(let t of be(n))o.errors.push({line:t.line,column:t.column,message:t.message,code:t.code});for(let t of pn(n))o.errors.push({line:t.line,column:1,message:`'${t.name}' is used but never declared or imported here, so it resolves to an error type for anything consuming this file. It is most likely an ambient global in the source project \u2014 import it explicitly. Referenced by: ${t.context}`,code:"dangling-type-reference"});return o.isValid=o.errors.length===0,o}function gt(n,r,o){if(n===r)return"";let t=n.split(`
7
- `),i=r.split(`
8
- `),c=new Map,a=new Map;for(let e=0;e<t.length;e++)c.set(t[e],(c.get(t[e])??0)+1);for(let e=0;e<i.length;e++)a.set(i[e],(a.get(i[e])??0)+1);let g=[],u=[];for(let[e,s]of c){let m=s-(a.get(e)??0);for(let l=0;l<m;l++)g.push(e)}for(let[e,s]of a){let m=s-(c.get(e)??0);for(let l=0;l<m;l++)u.push(e)}if(g.length===0&&u.length===0)return"";let p=[`--- ${o}`,`+++ ${o}`];for(let e=0;e<g.length;e++)p.push(`- ${g[e]}`);for(let e=0;e<u.length;e++)p.push(`+ ${u[e]}`);return p.join(`
9
- `)}function ht(n,r,o,t){let i=n.split(`
10
- `),c=[];function a(s){let l="",f=s<0?-s<<1|1:s<<1;do{let d=f&31;if(f>>>=5,f>0)d|=32;l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d]}while(f>0);return l}let g=0,u=0,p=0,e=t.split(`
11
- `).length;for(let s=0;s<i.length;s++){if(i[s].trim()===""){c.push("");continue}g=0;let l=Math.min(s,e-1),f=[],d=0-g,h=0,w=l-u,x=0-p;f.push(a(d)+a(h)+a(w)+a(x)),g=0,u=l,p=0,c.push(f.join(","))}return{version:3,file:r,sourceRoot:"",sources:[o],sourcesContent:[t],mappings:c.join(";")}}function yt(n,r){return`${n}
12
- ${Ve()}${r}
13
- `}
14
- export{Ve,$o,_,si,q,mt,gt,ht,yt};
@@ -1,27 +0,0 @@
1
- // @bun
2
- import{t,d}from"./chunk-1j6092xz.js";import{j}from"./chunk-j6pfxvy8.js";import{Ct}from"./chunk-ttc5pr8y.js";import{y}from"./chunk-wnk9yjw2.js";import{se}from"./chunk-d43bpfk6.js";import{relative as W}from"path";function J(n){let k=t(n),c=(l)=>k[l]?n.slice(k[l].start,k[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&k[i+1]?.kind==="quoted"){if(f=d(c(i+1)),f===void 0)return;i+=2}else if(c(i++)!=="global")return;if(c(i)!=="{")return;let h=k[i].end,S=1;for(i++;i<k.length;i++)if(c(i)==="{")S++;else if(c(i)==="}"&&--S===0)return{specifier:f,body:n.slice(h,k[i].start),start:h,end:k[i].start};return}var te=/^[A-Z_$][\w$]*$/i;function qo(n){let k=[],c=[],i=0,f=0,h=[],S=!1,l=0,E=n.length,R=(a)=>{let b=n.slice(i,a).trim();if(i=a,!b)return;if(ne(b)){c.push(b);return}k.push({text:b,comments:c}),c=[]};while(l<E){let a=n[l];if(S){if(a==="\\"){l+=2;continue}if(a==="`"){S=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,S=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let b=n.indexOf("*/",l+2);l=b===-1?E:b+2;continue}if(a==="/"&&n[l+1]==="/"){let b=n.indexOf(`
3
- `,l);l=b===-1?E:b;continue}if(a==="'"||a==='"'){l++;while(l<E&&n[l]!==a&&n[l]!==`
4
- `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){S=!0,l++;continue}if(a==="("||a==="["||a==="{"){f++,l++;continue}if(a===")"||a==="]"||a==="}"){if(f--,h.length>0&&a==="}"&&f===h[h.length-1])h.pop(),S=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
- `){let b=n[l+1];if(b!==void 0&&/[\w$@/]/.test(b))R(l+1);l++;continue}l++}return R(E),k}function ne(n){let k=0;while(k<n.length){while(k<n.length&&/\s/.test(n[k]))k++;if(k>=n.length)return!0;if(n.startsWith("//",k)){let c=n.indexOf(`
6
- `,k);k=c===-1?n.length:c;continue}if(n.startsWith("/*",k)){let c=n.indexOf("*/",k+2);if(c===-1)return!0;k=c+2;continue}return!1}return!0}function X(n){let k=[];for(let c of n.split(",")){let i=c.replace(/\/\*[\s\S]*?\*\//g,"").trim().replace(/^type\s+/,"");if(!i)continue;let f=i.match(/^([\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!f)continue;k.push({local:f[1],exported:f[2]??f[1]})}return k}var ie=/^(?:export\s+)?(default\s+)?(?:declare\s+)?(abstract\s+)?(class|interface|type|function\s*\*?|enum|const\s+enum|namespace|module|const|let|var|async\s+function)\b\s*([\w$]+)?/;function oe(n,k){let c=n.replace(/^export\s+/,""),i=/^default\s+/.test(c);if(c=c.replace(/^default\s+/,""),i)c=c.replace(/^((?:declare\s+)?(?:abstract\s+)?(?:class|function\s*\*?|async\s+function\s*\*?))\s*(?=[(<{])/,(f,h)=>`${h.trimEnd()} ${k}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function F(n,k,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?Ct(k,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):qo(k);for(let h of f){h.comments=h.comments.filter((b)=>{if(/^\/\/\/\s*</.test(b))return i.directives.push(...b.split(`
7
- `).map((v)=>v.trim()).filter((v)=>v.startsWith("///"))),!1;return!0});let S=h.text.replace(/;\s*$/,"").trim(),l=S.startsWith("import")?y(S):null;if(l&&!l.isImportEquals){let b=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:b,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:b,imported:"*"});for(let v of l.namedItems)i.imports.set(v.name,{specifier:b,imported:/^['"]/.test(v.originalName)?d(v.originalName):v.originalName});continue}if(/^import\s+['"]/.test(S)){i.verbatim.push(h);continue}let E=S.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(E){i.namespaceReExports.push({specifier:E[3],exported:E[1]});continue}if(E=S.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),E){i.starReExports.push(E[2]);continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),E){for(let b of X(E[1]))i.namedReExports.push({specifier:E[3],imported:b.local,exported:b.exported});continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),E){for(let b of X(E[1]))i.localExports.set(b.exported,b.local);continue}if(E=S.match(/^export\s+default\s+([\w$]+)$/),E&&te.test(E[1])){i.localExports.set("default",E[1]);continue}let R=J(S);if(R?.specifier!==void 0&&j(k)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(S)||R){i.verbatim.push(h);continue}let a=S.match(ie);if(a){let b=!!a[1],v=a[4]??(b?"_default":null);if(v){if(i.declared.add(v),/^export\s/.test(S))i.localExports.set(b?"default":v,v);i.declarations.push({statement:h,name:v,emit:oe(h.text,v)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function He(n,k){if(k.size===0)return n;let c=t(n),i=new Map(c.filter((m)=>m.kind==="literal").map((m)=>[m.start,m.end])),f=(m)=>c[m]?n.slice(c[m].start,c[m].end):"",h=new Map,S=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))S.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let w=S.at(-1);if(w!==void 0&&["()","[]","{}","<>"].includes(f(w)+x))S.pop(),h.set(w,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let w=h.get(x);if(w!==void 0)x=w}return c.length},E=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let w=["class","interface","type"].includes(f(m-2));if(!w&&f(x+1)!=="(")continue;let N=new Set;for(let u=m+1;u<x;u++){if(u===m+1||f(u-1)===","){while(["const","in","out"].includes(f(u)))u++;if(c[u]?.kind==="word")N.add(f(u))}let D=h.get(u);if(D!==void 0)u=D}let I=l(x+1);if(w&&f(m-2)!=="type")for(let u=x+1;u<c.length;u++){if(f(u)==="{"){I=h.get(u)??I;break}let D=h.get(u);if(D!==void 0)u=D}for(let u=m+1;u<I;u++){let D=f(m-2)==="class"&&u>x&&f(u-1)==="extends";if(N.has(f(u))&&f(u-1)!=="typeof"&&!D)E.add(c[u].start)}}for(let m=0;m<c.length;m++){if(!["namespace","module"].includes(f(m))||c[m+1]?.kind!=="word"||f(m+2)!=="{")continue;let x=h.get(m+2);if(x===void 0)continue;let w=Ct(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(w.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(w.filter((u)=>["class","variable","function","enum","module","namespace"].includes(u.kind)).map((u)=>u.name));for(let u=m+3;u<x;u++)if((f(u-1)==="typeof"?I:N).has(f(u)))E.add(c[u].start)}let R="",a=0,b=n.length,v=`
8
- `;while(a<b){let m=i.get(a);if(m!==void 0){R+=n.slice(a,m),a=m,v="`";continue}let x=n[a];if(x==="/"&&n[a+1]==="*"){let w=n.indexOf("*/",a+2),N=w===-1?b:w+2;R+=n.slice(a,N),a=N;continue}if(x==="/"&&n[a+1]==="/"){let w=n.indexOf(`
9
- `,a),N=w===-1?b:w;R+=n.slice(a,N),a=N;continue}if(x==="'"||x==='"'){let w=a+1;while(w<b&&n[w]!==x&&n[w]!==`
10
- `){if(n[w]==="\\")w++;w++}R+=n.slice(a,w+1),a=w+1,v=x;continue}if(/[A-Z_$]/i.test(x)){let w=a+1;while(w<b&&/[\w$]/.test(n[w]))w++;let N=n.slice(a,w),I=k.get(N);if(I!==void 0&&v!=="."&&!E.has(a)){let u=w;while(u<b&&(n[u]===" "||n[u]==="\t"))u++;let D=(n[u]===":"||n[u]==="?"&&n[u+1]===":")&&/[{;,(\n]/.test(v);R+=D?N:I}else R+=N;v="a",a=w;continue}if(R+=x,x===`
11
- `||!/\s/.test(x))v=x;a++}return R}function Tn(n,k,c,i){let f=[],h=new Map,S=[n,...k.filter((e)=>e!==n)];for(let e of S){let s=c.get(e);if(s===void 0){f.push(`No declarations were generated for ${W(i.cwd,e)}; it is left out of the bundle`);continue}h.set(e,F(e,s))}let l=(e,s)=>{if(!e.startsWith(".")&&!e.startsWith("/"))return null;let o=se(e,s).resolved;return o&&h.has(o)?o:null},E=(e)=>e.startsWith(".")||e.startsWith("/"),R=new Set,a=(e)=>{let s=e;for(let o=1;R.has(s);o++)s=`${e}_${o}`;return R.add(s),s},b=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));b.set(e,o)}let v=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=v.get(g);if(!r)r=a(o),v.set(g,r);return r},x=new Map,w=new Map,N=new Set,I=new Map,u=!0,D=(e,s,o)=>{let g=l(s,e.file);if(g){if(o==="*")return{kind:"namespace",file:g};let r=A(g).get(o);if(!r&&!u)f.push(`${W(i.cwd,e.file)}: '${o}' is not exported by '${s}'`);return r??null}if(E(s))return f.push(`${W(i.cwd,e.file)}: '${s}' is not part of the bundle`),null;return o==="*"?{kind:"external-namespace",source:s}:{kind:"external",source:s,imported:o}},Y=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:b.get(e.file).get(s)};let o=e.imports.get(s);if(o)return D(e,o.specifier,o.imported);return f.push(`${W(i.cwd,e.file)}: cannot resolve exported name '${s}'`),null};function A(e){let s=x.get(e);if(s)return s;let o=new Map,g=h.get(e);if(!g||N.has(e))return o;N.add(e);let r=new Set;for(let[p,M]of g.localExports){let B=Y(g,M);if(B)o.set(p,B)}for(let p of g.namedReExports){let M=D(g,p.specifier,p.imported);if(M)o.set(p.exported,M)}for(let p of g.namespaceReExports){let M=D(g,p.specifier,"*");if(M)o.set(p.exported,M)}for(let p of g.starReExports){let M=l(p,e);if(M){for(let[B,C]of A(M))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of w.get(M)??[])r.add(B)}else if(E(p))f.push(`${W(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,M]of I.get(e)??[])o.set(p,M);return N.delete(e),x.set(e,o),w.set(e,r),o}for(let[e,s]of h)for(let o of s.augmentations){let g=l(o.specifier,e);if(!g)continue;for(let r of F(e,o.body,!0).declared){if(A(g).has(r))continue;let p=I.get(g);if(!p)p=new Map,I.set(g,p);p.set(r,{kind:"local",name:a(r)}),x.clear()}}u=!1,x.clear(),w.clear();let Q=new Map,H=[],T=(e,s)=>{switch(e.kind){case"local":return e.name;case"external":return m(e.source,e.imported,e.imported==="default"?s:e.imported);case"external-namespace":return m(e.source,"*",s);case"namespace":return ee(e.file,s)}};function ee(e,s){let o=Q.get(e);if(o)return o;let g=a(s);Q.set(e,g);let r=[];for(let[p,M]of A(e)){if(p==="default")continue;let B=T(M,p);r.push(B===p?p:`${B} as ${p}`)}if(w.get(e)?.size)f.push(`${W(i.cwd,e)}: 'export * from' an external module cannot be expressed inside namespace '${g}'`);return H.push(`declare namespace ${g} {
12
- export { ${r.join(", ")} };
13
- }`),g}let U=[],O=[],Z=new Set;for(let[e,s]of h){for(let r of s.directives)Z.add(r);let o=new Map;for(let[r,p]of b.get(e))if(r!==p)o.set(r,p);for(let[r,p]of s.imports){if(s.declared.has(r))continue;let M=D(s,p.specifier,p.imported);if(!M)continue;let B=T(M,r);if(B!==r)o.set(r,B)}let g=[];for(let r of s.declarations){if(i.keepComments)g.push(...r.statement.comments);let p=He(r.emit,o);if(!/[;}]$/.test(p))p+=";";g.push(p)}for(let r of s.verbatim){if(i.keepComments)O.push(...r.comments);let p=J(r.text);if(p){let M=new Map(o);for(let B of F(e,p.body,!0).declared)M.delete(B);O.push(r.text.slice(0,p.start)+He(p.body,M)+r.text.slice(p.end))}else{let M=t(r.text),B=M[1]?.kind==="quoted"?d(r.text.slice(M[1].start,M[1].end)):void 0;if(B===void 0||!l(B,e))O.push(He(r.text,o))}}for(let r of s.augmentations){let p=l(r.specifier,e),M=F(e,r.body,!0),B=new Map(o);if(!p){for(let P of M.declared)B.delete(P);let C=J(r.statement.text);if(i.keepComments)O.push(...r.statement.comments);O.push(r.statement.text.slice(0,C.start)+He(C.body,B)+r.statement.text.slice(C.end));continue}for(let[C,P]of A(p))B.set(C,T(P,C));if(i.keepComments)g.push(...r.statement.comments);for(let C of M.declarations){if(!C.name||!A(p).has(C.name))throw Error(`Cannot link augmentation '${r.specifier}' member '${C.name??C.emit}'`);if(i.keepComments)g.push(...C.statement.comments);g.push(He(C.emit,B))}}if(g.length>0)U.push(`// From: ${W(i.cwd,e)}
14
- ${g.join(`
15
- `)}`)}let V=A(n),G=[],q=[];for(let[e,s]of V){if(s.kind==="external"){q.push(`export { ${s.imported===e?e:`${s.imported} as ${e}`} } from '${s.source}';`);continue}if(s.kind==="external-namespace"){q.push(`export * as ${e} from '${s.source}';`);continue}let o=T(s,e==="default"?"_default":e);G.push(o===e?e:`${o} as ${e}`)}for(let e of w.get(n)??[])q.push(`export * from '${e}';`);let K=new Map;for(let[e,s]of v){let[o,g]=e.split("\x00"),r=K.get(o)??{named:[],defaults:[],namespaces:[]};if(K.set(o,r),g==="*")r.namespaces.push(s);else if(g==="default")r.defaults.push(s);else r.named.push(g===s?s:`${g} as ${s}`)}let _=[];for(let[e,s]of[...K].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)_.push(`import ${o} from '${e}';`);for(let o of s.namespaces)_.push(`import * as ${o} from '${e}';`);if(s.named.length>0)_.push(`import { ${s.named.join(", ")} } from '${e}';`)}let L=[];if(Z.size>0)L.push([...Z].join(`
16
- `));if(L.push(`/**
17
- * Bundled TypeScript declarations
18
- * Generated from ${h.size} source files
19
- */`),_.length>0)L.push(_.join(`
20
- `));if(L.push(...U),H.length>0)L.push(H.join(`
21
- `));if(O.length>0)L.push(O.join(`
22
- `));let z=[];if(G.length>0)z.push(`export { ${G.join(", ")} };`);if(z.push(...q),z.length===0)z.push("export {};");return L.push(z.join(`
23
- `)),{content:`${L.join(`
24
-
25
- `)}
26
- `,files:[...h.keys()],exportCount:V.size,warnings:f}}
27
- export{qo,He,Tn};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{f}from"./chunk-dfye109x.js";import{e}from"./chunk-km8t8gqg.js";import{x,m}from"./chunk-1j6092xz.js";import{oe}from"./chunk-rmdwvzgn.js";import{existsSync as W,readFileSync as P,realpathSync as w,statSync as q}from"fs";import{builtinModules as X}from"module";import{dirname as I,extname as F,isAbsolute as A,join as J,relative as U,resolve as O}from"path";var B=[".ts",".tsx",".mts",".cts",".vue",".stx",".js",".jsx",".mjs",".cjs",".d.ts",".d.mts",".d.cts"],z={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".ts",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function k(t){try{return q(t).isFile()}catch{return!1}}function se(t,i){let s=t.replace(/[?#].*$/,"");if(!(s.startsWith("./")||s.startsWith("../")||s==="."||s==="..")&&!A(s))return{resolved:null,isRelative:!1};let a=I(i),c=O(a,s);if(k(c))return{resolved:c,isRelative:!0};let p=F(c),u=z[p];if(u){let d=c.slice(0,-p.length);for(let r of u){let o=d+r;if(k(o))return{resolved:o,isRelative:!0}}}for(let d of B){let r=c+d;if(k(r))return{resolved:r,isRelative:!0}}if(W(c))for(let d of B){let r=J(c,`index${d}`);if(k(r))return{resolved:r,isRelative:!0}}return{resolved:null,isRelative:!0}}function C(t,i){let s=t.indexOf("*");return s===-1?i===t:i.startsWith(t.slice(0,s))&&i.endsWith(t.slice(s+1))&&i.length>=t.length-1}function K(t,i){if(Object.hasOwn(t,i))return t[i]!==null;let s=Object.keys(t).filter((l)=>l.includes("*")&&C(l,i)).sort((l,a)=>a.indexOf("*")-l.indexOf("*")||a.length-l.length)[0];return s!==void 0&&t[s]!==null}function D(t,i){if(!t.name||i!==t.name&&!i.startsWith(`${t.name}/`))return!1;if(t.exports===void 0)return!0;let s=i===t.name?".":`.${i.slice(t.name.length)}`;if(typeof t.exports==="string"||Array.isArray(t.exports))return s===".";if(!t.exports||typeof t.exports!=="object")return!1;let l=t.exports;if(!Object.keys(l).some((c)=>c.startsWith(".")))return s===".";return K(l,s)}function N(t,i){let s=U(t,i);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!A(s)}async function De(t){let i=await oe(O(t.cwd,t.tsconfigPath||"tsconfig.json")),s=Object.entries(i?.paths??{});if(s.length===0){let r=(o,n)=>se(o,n);return r.cacheKey=(o)=>JSON.stringify(o.map((n)=>({file:n,references:T(P(n,"utf8"),{includeImports:!0}).map((g)=>({specifier:g.specifier,resolution:r(g.specifier,n)}))}))),r}let l=i?.baseUrl??i?.pathsBasePath??t.cwd,a=O(t.cwd,t.root),c=new Map,p=new Set([...X,"bun"]),u=(r)=>{let o=I(r),n=[];while(!0){if(c.has(o)){let R=c.get(o);for(let b of n)c.set(b,R);return R}n.push(o);let g=J(o,"package.json");if(W(g)){let b={...JSON.parse(P(g,"utf8")),directory:w(o)};for(let E of n)c.set(E,b);return b}let v=I(o);if(v===o)return;o=v}},d=(r,o)=>{if(r.startsWith(".")||A(r))return se(r,o);if(r.startsWith("node:")||r.startsWith("bun:")||p.has(r))return{resolved:null,isRelative:!1};let n=u(o),g=r.startsWith("@")?/^@[^/]+\/[^/]+/.exec(r)?.[0]:r.split("/")[0];if(n&&(D(n,r)||K(n.imports??{},r)||g&&[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies].some((h)=>Object.hasOwn(h??{},g))))return{resolved:null,isRelative:!1};let v=s.filter(([h])=>C(h,r)).sort(([h],[S])=>{if(!h.includes("*"))return-1;if(!S.includes("*"))return 1;return S.indexOf("*")-h.indexOf("*")})[0];if(!v)return{resolved:null,isRelative:!1};let[R,b]=v,E=R.indexOf("*"),L=E===-1?"":r.slice(E,r.length-(R.length-E-1));for(let h of b){let S=O(l,h.replace("*",L)),M=u(S);if(M&&D(M,r)&&!M.private&&M.directory!==n?.directory)return{resolved:null,isRelative:!1};let j=se(S,o);if(!j.resolved)continue;let y=w(j.resolved),_=t.outputStructure==="flat"||W(a)&&N(w(a),y);if(!n||!N(n.directory,y)||!_||u(y)?.directory!==n.directory||/\.d\.(?:ts|mts|cts)$/.test(y))throw Error(`Local alias ${JSON.stringify(r)} from ${o} resolves outside its emitted package source: ${y}`);return e.debug(`Resolved local declaration alias ${r} from ${o} to ${y}`),{resolved:t.outputStructure==="flat"?j.resolved:O(a,U(w(a),y)),isRelative:!0,isAlias:!0,suffix:S.match(/[?#].*$/)?.[0]??""}}throw Error(`Cannot resolve local alias ${JSON.stringify(r)} from ${o} using ${t.tsconfigPath||"tsconfig.json"} (${JSON.stringify(R)})`)};return d.isPackageLocal=(r,o)=>{let n=u(r);return!!n&&u(o)?.directory===n.directory&&N(n.directory,w(o))},d.cacheKey=(r)=>{let o=r.map((g)=>({file:g,references:T(P(g,"utf8"),{includeImports:!0}).map((v)=>({specifier:v.specifier,resolution:d(v.specifier,g)}))})),n=[...new Set(c.values())].filter((g)=>g!==void 0).sort((g,v)=>g.directory.localeCompare(v.directory));return JSON.stringify({root:a,compilerOptions:i,packages:n,edges:o})},d}function T(t,i={}){let s=m(t);return(i.includeImports?["export","static-import","import-type","augmentation"]:["export"]).flatMap((a)=>s.filter((c)=>c.category===a).map(({specifier:c,kind:p,isTypeOnly:u})=>({specifier:c,kind:p,isTypeOnly:u})))}function qn(t,i){let s=[];for(let a of m(t)){let c=i(a.specifier);if(c!==a.specifier)s.push({start:a.start,end:a.end,value:x(c,t[a.start])})}let l=t;for(let a of s.reverse())l=l.slice(0,a.start)+a.value+l.slice(a.end);return l}async function V(t,i={}){let s=new Set,l=new Map,a=[],c=new Map,p=[];for(let u of t){let d=O(u);if(!s.has(d))s.add(d),p.push(d)}while(p.length>0){let u=p.shift(),d;try{d=await f(u)}catch{continue}c.set(u,d);let r=T(d,i);l.set(u,r);for(let o of r){let n=(i.resolveSpecifier??se)(o.specifier,u);if(!n.isRelative)continue;if(n.resolved){if(!s.has(n.resolved))s.add(n.resolved),p.push(n.resolved)}else a.push({from:u,specifier:o.specifier,isTypeOnly:o.isTypeOnly})}}return{reachable:s,reExports:l,unresolved:a,sources:c}}
3
- export{se,De,T,qn,V};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{spawn as m}from"child_process";import{readFile as i,stat as n,writeFile as p}from"fs/promises";var b=typeof globalThis.Bun<"u",oa=!b&&typeof process<"u"&&!!process.versions?.node,aa=b?"bun":"node";class s{name;_size=-1;constructor(e){this.name=e}async exists(){try{return await n(this.name),!0}catch{return!1}}async text(){return i(this.name,"utf-8")}async arrayBuffer(){let e=await i(this.name);return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}get size(){if(this._size===-1)return-1;return this._size}}class a{pid;stdout;stderr;stdin;exited;process;constructor(e){this.process=e,this.pid=e.pid??0,this.stdout=e.stdout,this.stderr=e.stderr,this.stdin=e.stdin,this.exited=new Promise((r)=>{e.on("exit",(t)=>{r(t??0)}),e.on("error",()=>{r(1)})})}kill(e){this.process.kill(e)}ref(){this.process.ref()}unref(){this.process.unref()}}function ae(e){if(b)return globalThis.Bun.file(e);return new s(e)}async function tt(e,r){if(b)return globalThis.Bun.write(e,r);let t=typeof r==="string"?r:r instanceof ArrayBuffer?Buffer.from(r):r;return await p(e,t),typeof r==="string"?Buffer.byteLength(r):r.byteLength}function Ot(e,r={}){if(b)return globalThis.Bun.spawn(e,r);let t=Array.isArray(e)?e:[e],[o,...u]=t,d={cwd:r.cwd,env:r.env,stdio:[r.stdin??"pipe",r.stdout??"pipe",r.stderr??"pipe"]},l=m(o,u,d);return new a(l)}async function f(e){if(b)return globalThis.Bun.file(e).text();return i(e,"utf-8")}async function ca(e){if(b)return globalThis.Bun.file(e).exists();try{return await n(e),!0}catch{return!1}}async function la(e,r){await tt(e,r)}function ua(){if(b)return{name:"bun",version:globalThis.Bun.version,isBun:!0,isNode:!1};return{name:"node",version:process.versions.node,isBun:!1,isNode:!0}}
3
- export{b,oa,aa,ae,tt,Ot,f,ca,la,ua};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{R,M}from"./chunk-z4mvkazp.js";import{A,P}from"./chunk-mt9219xc.js";import{p}from"./chunk-v6fwy63g.js";import{k,D}from"./chunk-ttc5pr8y.js";import{xe}from"./chunk-25vyhfzh.js";import{l}from"./chunk-t1jtn2r0.js";import{ye}from"./chunk-w9av39jy.js";function Ue(t,n,s,r,i){if(r.length!==1||r[0]!=="bun")return null;let o=R(n)?M(t):A(n)?P(t):t;return ye(o,{keepComments:s,isolatedDeclarations:i})}var S=100,h=0,c=new Map;function bt(t,n="stdin.ts",s=!0,r=["bun"],i=!1){let o=p(t),a=JSON.stringify([n,s,i,r]),g=c.get(a);if(g&&g.contentHash===o)return g.lastAccess=++h,g.result;let b=Ue(t,n,s,r,i)??y(t,n,s,r,i);if(c.set(a,{result:b,contentHash:o,lastAccess:++h}),c.size>S){let x=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[e,f]of c)u.push([e,f.lastAccess]);u.sort((e,f)=>e[1]-f[1]);for(let e=0;e<x&&e<u.length;e++)c.delete(u[e][0])}return b}function oi(t,n="stdin.ts",s=!0,r=["bun"]){return bt(t,n,s,r,!0)}function ai(t,n="stdin.ts",s=!0,r=["bun"]){return bt(t,n,s,r,!1)}function y(t,n,s,r,i){let o=xe(t,n,s,i);return l(o,{filePath:n,sourceCode:t,declarations:o},s,r)}function ci(){c.clear()}function Ca(t,n="stdin.ts",s=!0,r=["bun"],i=!1){return Ue(t,n,s,r,i)??gn(t,n,s,r,i)}function gn(t,n="stdin.ts",s=!0,r=["bun"],i=!1){if(R(n))t=M(t);else if(A(n))t=P(t);let o=i?k(t,n,s):D(t,n,s);return l(o,{filePath:n,sourceCode:t,declarations:o},s,r)}
3
- export{Ue,bt,oi,ai,ci,Ca,gn};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Pe}from"./chunk-cen2t56g.js";import{k}from"./chunk-ttc5pr8y.js";import{y}from"./chunk-wnk9yjw2.js";function dn(i,r){let n=new Set;for(let e of k(i,"imports.ts",!1)){if(e.kind!=="import")continue;let t=y(e.text),a=t&&r.get(t.source);if(!t||t.isTypeOnly||!a)continue;let s=_e(a);for(let o of t.namedItems)if(!o.isTypeOnly&&s.some((m)=>m.name===o.originalName))n.add(o.name);if(t.defaultName&&s.some((o)=>o.isDefault))n.add(t.defaultName)}return n}function _e(i){let r=k(i,"dependency.ts",!1).filter((n)=>n.kind==="function");return r.filter((n)=>n.isExported&&!n.generics&&r.filter((e)=>e.name===n.name).length===1&&Pe(i,n.name)===1).map((n)=>({name:n.name,isDefault:Boolean(n.isDefault)})).sort((n,e)=>n.name.localeCompare(e.name))}
3
- export{dn,_e};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{B}from"./chunk-pga5m4wm.js";import{xe,Sn}from"./chunk-25vyhfzh.js";import{Y,wn}from"./chunk-1pz7zxhc.js";function ui(){wn(),Sn()}function r(e,t,c=!0,n=!1,o){return xe(e,t,c,n,o)}async function yn(e,t,c=!0,n={}){return await Y(t,e,n),r(e,t,c)}async function fi(e,t={}){let c=B(t.concurrency,4),n=new Map;for(let o=0;o<e.length;o+=c){let s=e.slice(o,o+c),i=await Promise.all(s.map(async(a)=>({path:a.filePath,declarations:await yn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
3
- export{ui,r,yn,fi};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Re}from"./chunk-pzedkn7z.js";import{readFileSync as m,statSync as w}from"fs";import{readFile as y}from"fs/promises";import{createRequire as v}from"module";import{dirname as g,isAbsolute as b,join as u,resolve as p}from"path";function l(t){let o=[t];if(!t.endsWith(".json"))o.push(`${t}.json`);o.push(u(t,"tsconfig.json"));for(let a of o)try{if(w(a).isFile())return a}catch{}return null}function E(t,o){if(b(t)||t.startsWith("."))return l(p(g(o),t));let a=v(o),n=t.startsWith("@")?/^@[^/]+\/[^/]+/.exec(t)?.[0]:t.split("/")[0];if(n)for(let d of a.resolve.paths(n)??[]){let e=l(u(d,n,"package.json"));if(!e)continue;let i=JSON.parse(m(e,"utf8"));if(t===n){if(i.tsconfig!==void 0){if(typeof i.tsconfig!=="string")throw Error(`Invalid tsconfig field in ${e}`);let r=l(p(g(e),i.tsconfig));if(!r)throw Error(`Cannot resolve tsconfig ${JSON.stringify(i.tsconfig)} from ${e}`);return r}let s=l(u(g(e),"tsconfig.json"));if(s)return s}break}for(let d of[`${t}/tsconfig.json`,t])try{let e=a.resolve(d),i=e.endsWith(".json")?l(e):null;if(i)return i}catch{}return null}async function oe(t,o={},a=new Set){let n=l(t);if(!n)return;if(a.has(n)){if(o.allowCircular)return;throw Error(`Circular tsconfig extends: ${n}`)}let d=new Set(a).add(n),e=JSON.parse(Re(await y(n,"utf8"))),i=typeof e.extends==="string"?[e.extends]:e.extends??[];if(!Array.isArray(i)||i.some((f)=>typeof f!=="string"))throw Error(`Invalid tsconfig extends in ${n}`);let s={};for(let f of i){let c=E(f,n);if(!c)throw Error(`Cannot resolve tsconfig extends ${JSON.stringify(f)} from ${n}`);s={...s,...await oe(c,o,d)}}let r=e.compilerOptions??{};if(r.isolatedDeclarations!==void 0)s.isolatedDeclarations=r.isolatedDeclarations;if(r.baseUrl!==void 0){if(typeof r.baseUrl!=="string")throw Error(`Invalid baseUrl in ${n}`);s.baseUrl=p(g(n),r.baseUrl)}if(r.paths!==void 0){if(!r.paths||typeof r.paths!=="object"||Array.isArray(r.paths))throw Error(`Invalid paths in ${n}`);for(let[f,c]of Object.entries(r.paths))if(f.split("*").length>2||!Array.isArray(c)||c.length===0||c.some((h)=>typeof h!=="string"||h.split("*").length>2))throw Error(`Invalid path mapping ${JSON.stringify(f)} in ${n}`);s.paths=r.paths,s.pathsBasePath=g(n)}return s}
3
- export{oe};
@@ -1,29 +0,0 @@
1
- // @bun
2
- import{u,Te}from"./chunk-rdzfdjkb.js";import{Pt,Dt,n,ke,W}from"./chunk-90aptjh6.js";function h(t){if(t.includes(`
3
- `))return`/**
4
- * ${t}
5
- */
6
- `;return`/** ${t} */
7
- `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let f=t[i],l=i>0?t[i-1]:"";if(!r&&(f==='"'||f==="'"||f==="`"))r=!0,a=f;else if(r&&f===a&&l!=="\\")r=!1;if(!r){if(f==="<")e++;else if(f===">")e--;else if(f==="{"&&e===0)return i}}return-1}function X(t,o=!0){return u(t.leadingComments,o)+t.text}function g(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=u(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,f=!a&&i?W(i):null;if(f)a=f;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Pt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let l="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)l=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Dt();if(m)if(m.includes(`
8
- `))l=`@defaultValue
9
- * \`\`\`ts
10
- ${m.split(`
11
- `).map((p)=>` * ${p}`).join(`
12
- `)}
13
- * \`\`\``;else l=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&ke(t.typeAnnotation)){Pt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Dt();if(x)if(x.includes(`
14
- `))l=`@defaultValue
15
- * \`\`\`ts
16
- ${x.split(`
17
- `).map((d)=>` * ${d}`).join(`
18
- `)}
19
- * \`\`\``;else l=`@defaultValue \`${x}\``}if(l=Te(l),e+=`: ${a};`,l&&s&&s.includes("@defaultValue"))l="";if(l&&s){let c=s.trimEnd(),m=c.lastIndexOf("*/");if(m!==-1){let p=c.slice(0,m).trimEnd();if(p.startsWith("/** ")&&!p.includes(`
20
- `))p=`/**
21
- * ${p.slice(4)}`;return`${p}
22
- * ${l}
23
- */
24
- `+e}return`/**
25
- * ${c.replace(/^\/\/\s*/,"")}
26
- * ${l}
27
- */
28
- ${e}`}if(l)return`${h(l)}${e}`;return s+e}function Z(t,o=!0){let s=u(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function Q(t,o=!0){let s=u(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),f=i.length;while(f>0&&(i.charCodeAt(f-1)===59||i.charCodeAt(f-1)===32||i.charCodeAt(f-1)===10||i.charCodeAt(f-1)===13))f--;if(f<i.length)i=i.slice(0,f);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function ee(t,o=!0){return u(t.leadingComments,o)+t.text}function te(t,o=!0){let s=u(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function Dn(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function Rn(t,o=!0){return u(t.leadingComments,o)+t.text.trim()}function ne(t,o=!0){let s=u(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let f=t.text.indexOf("{");if(f!==-1)i+=` ${t.text.slice(f)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
29
- export{X,g,Z,Q,ee,te,Dn,Rn,ne};
@@ -1,10 +0,0 @@
1
- // @bun
2
- import{j,Vn,Un}from"./chunk-j6pfxvy8.js";import{hn}from"./chunk-60ssvwc8.js";import{u}from"./chunk-rdzfdjkb.js";import{X,g,Z,Q,ee,te,ne}from"./chunk-s6c98nad.js";import{Se,y}from"./chunk-wnk9yjw2.js";import{we}from"./chunk-vtskg4r2.js";function L(k,x){throw Error(x||`Unexpected value: ${k}`)}var V=null,q=[],z=[];function l(k,x,d=!0,b=["bun"]){let o="",f=x.sourceCode;if(f){let e=0;while(e<f.length&&(f.charCodeAt(e)===32||f.charCodeAt(e)===9||f.charCodeAt(e)===10||f.charCodeAt(e)===13))e++;if(e<f.length-2&&f.charCodeAt(e)===47&&f.charCodeAt(e+1)===47&&f.charCodeAt(e+2)===47){let i=hn(f);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
- `;o+=i[r]}}}let w=[],N=[],M=[],P=[],U=[],W=[],_=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":W.push(e);break;case"enum":_.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:L(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],F=new Set;for(let e of T){let i=u(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!F.has(a))if(F.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let m=[];if(w.length>0){let{usedItems:e}=we(k);for(let r of w){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;m.push(p);continue}let a=y(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:h,namespaceName:c}=a,D=s?e.has(s):!1,G=c?e.has(c):!1;if(a.isImportEquals){if(D){let t=r.text.trim();m.push(t.endsWith(";")?t:`${t};`)}else if(x.augmentationImports?.has(a.source)){let t=Se(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");m.push(`import ${t};`)}continue}let I="",E=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(E>0)I+=", ";if(!h&&p.isTypeOnly)I+="type ";I+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,E++}}if(D||G||E>0){let t=h?"import type ":"import ";if(G&&c){if(D&&s)t+=`${s}, `;t+=`* as ${c}`}else if(D&&s)t+=E>0?`${s}, { ${I} }`:s;else if(E>0)t+=`{ ${I} }`;let p=Se(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,m.push(t)}else if(x.augmentationImports?.has(a.source)){let t=Se(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");m.push(`import ${t};`)}}let i=b.length;if(m.length>1){if(V!==b)V=b,q=b.map((n)=>`from '${n}`),z=b.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of m){let h=i;for(let c=0;c<b.length;c++)if(n.includes(r[c])||n.includes(a[c])){h=c;break}s.set(n,h)}m.sort((n,h)=>{let c=s.get(n),D=s.get(h);return c!==D?c-D:n.localeCompare(h)})}}for(let e=0;e<m.length;e++){if(o)o+=`
4
- `;o+=m[e]}for(let e=0;e<S.length;e++){if(o)o+=`
5
- `;o+=S[e]}let K=[N,M,P,U,W,_,C];for(let e=0;e<K.length;e++){let i=K[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=X(a,d);break;case"variable":s=g(a,d);break;case"interface":s=Z(a,d);break;case"type":s=Q(a,d);break;case"class":s=ee(a,d);break;case"enum":s=te(a,d);break;case"module":case"namespace":s=ne(a,d);break;case"import":case"export":case"unknown":break;default:L(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
6
- `;o+=s}}}for(let e=0;e<v.length;e++){if(o)o+=`
7
- `;o+=v[e]}for(let e=0;e<A.length;e++){if(o)o+=`
8
- `;o+=A[e]}if(T.length===0&&j(x.sourceCode)&&(k.some(Un)||!Vn(o)))o+=`${o?`
9
- `:""}export {};`;return o}
10
- export{l};
@@ -1,37 +0,0 @@
1
- // @bun
2
- import{c,i,Oe,ce}from"./chunk-zq93f8ca.js";import{t,d,Me,m}from"./chunk-1j6092xz.js";import{Pe}from"./chunk-cen2t56g.js";import{Kn}from"./chunk-2kwjbk55.js";import{Wn}from"./chunk-n2nyd0ck.js";import{j,zn}from"./chunk-j6pfxvy8.js";import{Pn}from"./chunk-gsb3ty07.js";import{Ae}from"./chunk-69dbf6de.js";import{n,O,Ee,W}from"./chunk-90aptjh6.js";import{An}from"./chunk-xr1h3tv2.js";import{g}from"./chunk-s6c98nad.js";import{In}from"./chunk-g9d5r6a8.js";function bi(_,V,L,N,Y=""){let ee=new Map,f={start:0,end:_.length,header:0,name:"",children:[],results:new Map},F=t(_),de=[],C=[],se=[],R=new Map;for(let e=0;e<F.length;e++){let oe=F[e];if(oe.kind!=="punctuation")continue;let le=_.slice(oe.start,oe.end);if(le==="(")se.push(e);else if(le===")"){let ae=se.pop();if(ae!==void 0)R.set(e,ae)}else if(le==="{")C.push(e);else if(le==="}"){let ae=C.pop();if(ae===void 0)continue;let ne=F[ae].start,J=ae-1,X=J>=0?_.slice(F[J].start,F[J].end):"";if(X===")"){let G=R.get(J);if(G!==void 0&&G>0&&["if","for","while","switch","catch","with"].includes(_.slice(F[G-1].start,F[G-1].end)))ne=F[G-1].start}else if(["else","try","finally","do"].includes(X))ne=F[J].start;de.push({open:F[ae].start,close:oe.start,header:ne})}}let re=0,U=(e,oe=new Set)=>{let le=new Set(oe),ae=t(_.slice(e.start,e.end)),ne=0;for(let ie=0;ie+1<ae.length;ie++){let Be=_.slice(e.start+ae[ie].start,e.start+ae[ie].end);if(Be==="{")ne++;else if(Be==="}")ne--;else if(!ne&&["type","interface"].includes(Be))le.add(_.slice(e.start+ae[ie+1].start,e.start+ae[ie+1].end))}let J="",X=e.start,G=[...e.results].map(([ie,Be])=>({type:ie,name:Be}));for(let ie of e.children.sort((Be,Ne)=>Be.header-Ne.header)){let Be=U(ie,le);J+=_.slice(X,ie.header)+`
3
- declare namespace ${ie.name} {
4
- ${Be.text}
5
- }
6
- `,X=ie.end+1;for(let Ne of Be.exports)G.push({type:`${ie.name}.${Ne.name}`,name:Ne.name})}J+=`${_.slice(X,e.end)}
7
- ;
8
- ${G.map((ie)=>`export type ${ie.name} = ${ie.type};`).join(`
9
- `)}`;let He=D(J,V,!1);for(let ie of G)le.add(ie.name);let te=Y?Ot(Y).map((ie,Be)=>[ie,`${be}_capture_${Be}`]):[],x=He.map((ie)=>Y&&["type","interface"].includes(ie.kind)?kn(ie,Y,te,le):(ie.kind==="variable"?g(ie,!1):ie.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
- `);return{declarations:He,text:x,exports:G}},be;return{resolve(e,oe){be??=L();let le=f;for(let ne of de.filter((J)=>J.open<oe&&oe<J.close).sort((J,X)=>J.open-X.open)){let J=le.children.find((X)=>X.start===ne.open+1);if(!J)J={start:ne.open+1,end:ne.close,header:ne.header,name:`${be}_scope_${re++}`,children:[],results:new Map},le.children.push(J);le=J}let ae=le.results.get(e);if(!ae)ae=`${be}_result_${ee.size}`,le.results.set(e,ae),ee.set(ae,e);return`${be}.${ae}`},finish(e){if(!be)return e;let oe=U(f),le=oe.declarations,ae=new Set(ee.keys());if(le.every((J)=>ae.has(J.name))){let J=new Map(ee),X=t(e),G="",He=0;for(let te=0;te+2<X.length;te++){if(e.slice(X[te].start,X[te].end)!==be||e.slice(X[te+1].start,X[te+1].end)!==".")continue;let x=J.get(e.slice(X[te+2].start,X[te+2].end));if(!x)continue;G+=e.slice(He,X[te].start)+`(${x})`,He=X[te+2].end,te+=2}return G+e.slice(He)}if(Y){let J=Ot(Y).join(", "),X=t(e),G="",He=0;for(let te=0;te+2<X.length;te++){if(e.slice(X[te].start,X[te].end)!==be||e.slice(X[te+1].start,X[te+1].end)!=="."||!ae.has(e.slice(X[te+2].start,X[te+2].end)))continue;G+=`${e.slice(He,X[te+2].end)}<${J}>`,He=X[te+2].end,te+=2}e=G+e.slice(He)}let ne=oe.text;return N({kind:"module",name:be,text:`declare namespace ${be} {
11
- ${ne}
12
- }`,moduleForm:"namespace",isExported:!1}),e}}}function Ot(_){let V=t(_),L=[],N=0,Y=0,ee=!1;for(let f of V){let F=_.slice(f.start,f.end);if(F==="<"){if(N++,N===1)ee=!0}else if(F===">"&&_[f.start-1]!=="=")N--;else if(["(","[","{"].includes(F))Y++;else if([")","]","}"].includes(F))Y--;else if(F===","&&N===1&&!Y)ee=!0;else if(ee&&f.kind==="word"&&!["const","in","out"].includes(F))L.push(F),ee=!1}return L}function kn(_,V,L,N){let Y=new Set(Ot(_.generics||"")),ee=(U,be,e)=>{let oe=t(U),le="",ae=0;for(let ne=0;ne<oe.length;ne++){let J=oe[ne],X=U.slice(J.start,J.end),G=oe[ne+1]&&U.slice(oe[ne+1].start,oe[ne+1].end),He=oe[ne+2]&&U.slice(oe[ne+2].start,oe[ne+2].end),te=oe[ne-1]&&U.slice(oe[ne-1].start,oe[ne-1].end);if(J.kind!=="word"||G===":"||G==="?"&&He===":")continue;let x=!e.has(X)&&te!=="."&&L.find(([ie])=>ie===X)?.[1];if(x)le+=U.slice(ae,J.start)+x,ae=J.end;else if(be&&N.has(X)&&!e.has(X)){let ie=L.map(([,Be])=>Be).join(", ");le+=`${U.slice(ae,J.end)}<${ie}${G==="<"?", ":">"}`,ae=G==="<"?oe[++ne].end:J.end}}return le+U.slice(ae)},f=t(_.text),F=f.findIndex((U)=>["type","interface"].includes(_.text.slice(U.start,U.end))),de=f[F+1],C=_.generics||"",se=C?_.text.indexOf(C,de.end)+C.length:de.end,R=ee(wn(V),!1,new Set),re=C?`, ${ee(C.slice(1,-1),!0,Y)}`:"";return`${_.text.slice(0,de.end)}<${R}${re}>${ee(_.text.slice(se),!0,Y)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function wn(_){let V=_.slice(1,-1),L=t(V),N=0,Y=0,ee=!1,f="";for(let F=0;F<L.length;F++){let de=L[F],C=V.slice(de.start,de.end);if(["(","[","{","<"].includes(C))N++;else if([")","]","}"].includes(C)||C===">"&&V[de.start-1]!=="=")N--;else if(!N&&C==="const")f+=V.slice(Y,de.start),Y=de.end;else if(!N&&C==="="&&V.slice(L[F+1]?.start,L[F+1]?.end)!==">")f+=V.slice(Y,de.start),ee=!0;else if(!N&&C===","&&ee)Y=de.start,ee=!1}return f+(ee?"":V.slice(Y))}var We=32,Le=9,me=10,we=13,H=47,Ce=42,fe=39,pe=34,ve=96,ze=92,P=123,z=125,Z=40,ue=41,$e=91,Se=93,ge=60,he=62,Q=59,Ge=58,ke=61,Ke=44,Ve=46,gt=63,Yt=35,$n=64,xn=36;function Ie(_){return _===We||_===Le||_===me||_===we}function yn(_){let V=!0;for(let L=0;L<_.length;L++){let N=_.charCodeAt(L);if(N===Ve){if(V)return!1;V=!0}else if(V){if(!c(N))return!1;V=!1}else if(!i(N))return!1}return _.length>0&&!V}function at(_,V,L){let N=V+1;while(N<_.length){let Y=_.charCodeAt(N);if(Y===ze){N+=2;continue}if(N++,Y===L)break}return N}function Sn(_){if(_==="any"||_==="object"||_==="unknown")return!0;if(_.startsWith("Record<")||_.startsWith("Array<"))return!0;return _.charCodeAt(0)===P&&_.includes("[")&&_.includes("]:")}var Et=["public","protected","private","readonly","override"];function va(_,V,L=!0,N=!1){return N?k(_,V,L):D(_,V,L)}function k(_,V,L=!0){return Rt(_,V,L,!0)}function D(_,V,L=!0,N){return Rt(_,V,L,!1,!1,N)}function Ct(_,V,L=!0){return Rt(_,V,L,!0,!0)}function Rt(_,V,L,N,Y=!1,ee){let f=_,F=L,de=N,C=f.length,se=j(f),R=[],re=new Map,U=new Map,be=new Set,e=0,oe=0,le=[];function ae(s){let r=/^this\.([\w$]+)$/.exec(s);if(r){let A=le.at(-1);return A?.fields.get(`${A.isStatic?"static:":""}${r[1]}`)}let o=/^([\w$]+)\s*\(/.exec(s);if(!o||!s.endsWith(")"))return;let a=t(s),l=0;for(let A=1;A<a.length;A++){let b=s.slice(a[A].start,a[A].end);if(b==="(")l++;else if(b===")"&&--l===0&&A!==a.length-1)return}let u=[...R,...re.values()].filter((A)=>A.kind==="function"&&A.name===o[1]);if(u.length!==1||u[0].generics||Pe(f,o[1])!==1)return;return u[0].returnType}function ne(s){let r=s.trim(),o=ae(r);if(o)return o;if(!r.startsWith("class"))return;let a=t(r);if(a[0]?.kind!=="word"||r.slice(a[0].start,a[0].end)!=="class")return;let l;do l=`__dtsx_class_${oe++}`;while(f.includes(l));let u=a[1],A=u?r.slice(u.start,u.end):"",b=u?.kind==="word"&&!["extends","implements"].includes(A),h=b?A:`${l}_value`,p=b?`export ${r}`:`export class ${h} ${r.slice(5)}`,y=D(p,V,F),T=y.find((S)=>S.kind==="class");if(!T)throw Error("Cannot extract the class expression declaration");if(t(p.slice(T.end??p.length)).some((S)=>p.slice((T.end??0)+S.start,(T.end??0)+S.end)!==";"))return;let I=y.map((S)=>S.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
- `);return re.set(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
- ${I}
15
- }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${h}`}function J(s,r){let o=/^this\.([\w$]+)$/.exec(s);if(o)return le.at(-1)?.fields.get(`${r?"static:":""}${o[1]}`);return ne(s)}function X(s){let r=U.get(s.name);if(r)r.push(s);else U.set(s.name,[s]);re.set(s.name,s)}if(e<C&&f.charCodeAt(e)===65279)e++;function G(s,r){if(s<r){let o=f.charCodeAt(s),a=f.charCodeAt(r-1);if(o!==We&&o!==Le&&o!==me&&o!==we&&a!==We&&a!==Le&&a!==me&&a!==we)return f.slice(s,r)}while(s<r&&Ie(f.charCodeAt(s)))s++;while(r>s&&Ie(f.charCodeAt(r-1)))r--;return f.slice(s,r)}let He=/[\r\n]/g;function te(s){return He.lastIndex=s,He.exec(f)?.index??C}function x(){if(e>=C)return;let s=f.charCodeAt(e);if(s!==We&&s!==Le&&s!==me&&s!==we&&s!==H)return;while(e<C){let r=f.charCodeAt(e);if(r===We||r===Le||r===me||r===we){e++;continue}if(r===H&&e+1<C){let o=f.charCodeAt(e+1);if(o===H){e=te(e+2);continue}if(o===Ce){let a=f.indexOf("*/",e+2);e=a===-1?C:a+2;continue}}break}}function ie(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let r=0,o=0;while(o<s.length){let a=s.charCodeAt(o);if(a===fe||a===pe||a===ve){o=at(s,o,a),r=o;continue}if(a===ze){o+=2,r=Math.min(o,s.length);continue}if(a===H&&s.charCodeAt(o+1)===H){while(o<s.length&&s.charCodeAt(o)!==me&&s.charCodeAt(o)!==we)o++;continue}if(a===H&&s.charCodeAt(o+1)===Ce){let l=s.indexOf("*/",o+2);o=l===-1?s.length:l+2;continue}if(o++,a>32)r=o}return r<s.length?s.slice(0,r).trimEnd():s}function Be(s){let r=s.length,o=0,a=r;for(let l=0;l<r;l++){let u=s.charCodeAt(l);if(o){if(u===ze){l++;continue}if(u===o)o=0;continue}if(u===fe||u===pe||u===ve){o=u;continue}if(u===H&&l+1<r){let A=s.charCodeAt(l+1);if(A===H){a=l;while(a>0&&(s.charCodeAt(a-1)===We||s.charCodeAt(a-1)===Le))a--;return s.slice(0,a)}if(A===Ce){let b=s.indexOf("*/",l+2);if(b!==-1){s=`${s.slice(0,l)} ${s.slice(b+2)}`,l--;continue}}}}a=r;while(a>0&&(s.charCodeAt(a-1)===We||s.charCodeAt(a-1)===Le||s.charCodeAt(a-1)===we))a--;return a<r?s.slice(0,a):s}function Ne(s){e++;let r=s===fe?"'":'"';while(e<C){let o=f.indexOf(r,e);if(o===-1){e=C;return}let a=0,l=o-1;while(l>=0&&f.charCodeAt(l)===ze)a++,l--;if(a%2===0){e=o+1;return}e=o+1}}function st(){e++;let s=[];while(e<C){let r=f.charCodeAt(e);if(s.length===0){if(r===ze){e+=2;continue}if(r===ve){e++;return}if(r===xn&&e+1<C&&f.charCodeAt(e+1)===P){e+=2,s.push(0);continue}e++;continue}if(r===fe||r===pe){Ne(r);continue}if(r===ve){st();continue}if(r===H&&e+1<C){let o=f.charCodeAt(e+1);if(o===H){e=te(e+2);continue}if(o===Ce){let a=f.indexOf("*/",e+2);e=a===-1?C:a+2;continue}if(Mt()){Pt();continue}e++;continue}if(r===P){s[s.length-1]++,e++;continue}if(r===z){let o=s[s.length-1];if(o===0){s.pop(),e++;continue}s[s.length-1]=o-1,e++;continue}e++}}let At=!1;function Te(){At=!1;let s=f.charCodeAt(e);if(s===fe||s===pe)return Ne(s),!0;if(s===ve)return st(),!0;if(s===H&&e+1<C){let r=f.charCodeAt(e+1);if(r===H)return e=te(e+2),!0;if(r===Ce){let o=f.indexOf("*/",e+2);return At=te(e+2)<(o===-1?C:o),e=o===-1?C:o+2,!0}if(Mt())return Pt(),!0}return!1}function Mt(){return Oe(f,e)}function Pt(){e=ce(f,e)}function xe(){let s=e;while(e<C&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function w(s){if(e+s.length>C)return!1;for(let r=0;r<s.length;r++)if(f.charCodeAt(e+r)!==s.charCodeAt(r))return!1;if(e+s.length<C&&i(f.charCodeAt(e+s.length)))return!1;return!0}function lt(s){let r=e+s;while(r<C){let o=f.charCodeAt(r);if(o===We||o===Le||o===me||o===we){r++;continue}return o!==Ve&&o!==ke}return!1}function bt(){if(!At)return!1;let s=e;x();let r=e>=C||kt()||f.charCodeAt(e)===z;return e=s,r}function kt(){if(e>=C)return!1;switch(f.charCodeAt(e)){case 101:return w("export")||w("enum");case 105:return w("import")||w("interface");case 102:return w("function");case 99:return w("class")||w("const");case 116:return w("type");case 108:return w("let");case 118:return w("var");case 100:return w("declare")||w("default");case 109:return w("module");case 110:return w("namespace");case 97:return w("abstract")||w("async");default:return!1}}function Xe(){let s=f.charCodeAt(e);if(s!==me&&s!==we)return!1;let r=e;if(e++,s===we&&e<C&&f.charCodeAt(e)===me)e++;while(e<C){let a=f.charCodeAt(e);if(a===We||a===Le||a===we||a===me){e++;continue}if(a===H&&e+1<C){let l=f.charCodeAt(e+1);if(l===H){e=te(e+2);continue}if(l===Ce){let u=f.indexOf("*/",e+2);e=u===-1?C:u+2;continue}}break}let o=e>=C||kt()||f.charCodeAt(e)===z;return e=r,o}function Wt(s){let r=s-1;while(r>=0){let h=f.charCodeAt(r);if(h===We||h===Le||h===we||h===me){r--;continue}break}if(r<0)return!0;let o=f[r];if("+-*/%=<>&|^!~?:,.([{".includes(o))return!0;let a=r;while(a>0&&f.charCodeAt(a-1)!==me)a--;let l=f.slice(a,r+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let A=r;while(A>=0&&/[a-z]/i.test(f[A]))A--;let b=f.slice(A+1,r+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(b)}function nn(){let s=f.charCodeAt(e);if(s!==me&&s!==we)return!1;if(Wt(e))return!1;let r=e;e++;while(e<C){let u=f.charCodeAt(e);if(u===We||u===Le||u===we||u===me){e++;continue}if(u===H&&e+1<C){let A=f.charCodeAt(e+1);if(A===H){e=te(e+2);continue}if(A===Ce){let b=f.indexOf("*/",e+2);e=b===-1?C:b+2;continue}}break}let o=e<C?f[e]:"",a=f.slice(e,e+2),l=o==="."||o==="?"||o===":"||o===")"||o==="]"||o==="}"||o===","||o==="+"||o==="-"||o==="*"||o==="/"||o==="%"||o==="<"||o===">"||o==="="||o==="&"||o==="|"||o==="^"||o==="`"||a==="=>"||w("as")||w("satisfies")||w("instanceof")||w("in");return e=r,!l}function Lt(){let s=f.charCodeAt(e);if(s!==me&&s!==we)return!1;if(Wt(e))return!1;let r=e;e++;while(e<C){let l=f.charCodeAt(e);if(l===We||l===Le||l===we||l===me){e++;continue}if(l===H&&e+1<C){let u=f.charCodeAt(e+1);if(u===H){e=te(e+2);continue}if(u===Ce){let A=f.indexOf("*/",e+2);e=A===-1?C:A+2;continue}}break}let o=e<C?f[e]:"",a=o==="|"||o==="&"||o==="["||o==="."||o==="?"||o===":"||o===">"||o===")"||o===","||w("extends");return e=r,!a}function rt(){let s=f.charCodeAt(e);if(s!==me&&s!==we)return!1;let r=e;if(e++,s===we&&e<C&&f.charCodeAt(e)===me)e++;while(e<C){let a=f.charCodeAt(e);if(a===We||a===Le||a===we||a===me){e++;continue}if(a===H&&e+1<C&&f.charCodeAt(e+1)===H){e=te(e+2);continue}break}if(e>=C)return e=r,!0;let o=f.charCodeAt(e);if(o===124||o===38||o===Ve||o===gt||o===Ge)return e=r,!1;if(w("extends")||w("keyof")||w("typeof")||w("infer")||w("is")||w("as")||w("in"))return e=r,!1;return e=r,!0}let sn=/[{}'"`\/]/g,rn=/[()'"`\/]/g,on=/[[\]'"`\/]/g,cn=/[<>'"`\/]/g;function De(s,r){let o=1;e++;let a=s===P?sn:s===Z?rn:s===$e?on:cn;a.lastIndex=e;let l;while((l=a.exec(f))!==null){let u=l.index,A=f.charCodeAt(u);if(A===fe||A===pe){e=u,Ne(A),a.lastIndex=e;continue}if(A===ve){e=u,st(),a.lastIndex=e;continue}if(A===H){if(e=u,Te()){a.lastIndex=e;continue}a.lastIndex=u+1;continue}if(A===s)o++;else if(A===r){if(r===he&&u>0&&f.charCodeAt(u-1)===ke){a.lastIndex=u+1;continue}if(o--,o===0)return e=u+1,e}a.lastIndex=u+1}return e=C,e}function qe(){return e>0&&f.charCodeAt(e-1)===ke}function wt(){return e+1<C&&f.charCodeAt(e+1)===he}let je=/[<{};'"`\/\n\r()[\]]/g;function _e(s=!1){let r=0,o=0,a=0,l=0,u=f.charCodeAt(e)===P;je.lastIndex=e;let A;while((A=je.exec(f))!==null){let b=A.index,h=f.charCodeAt(b);if(h===fe||h===pe){e=b,Ne(h),je.lastIndex=e;continue}if(h===ve){e=b,st(),je.lastIndex=e;continue}if(h===H){if(b>0&&f.charCodeAt(b-1)===ge){je.lastIndex=b+1;continue}if(e=b,Te()){if(r===0&&o===0&&a===0&&l===0&&bt())return;je.lastIndex=e;continue}je.lastIndex=b+1;continue}if(h===ge){let p=Gt(b);if(p!==null)l=Math.max(0,l+p);je.lastIndex=b+1;continue}if(h===Z){o++,je.lastIndex=b+1;continue}if(h===ue){o--,je.lastIndex=b+1;continue}if(h===$e){a++,je.lastIndex=b+1;continue}if(h===Se){a--,je.lastIndex=b+1;continue}if(h===P){r++,je.lastIndex=b+1;continue}if(h===z){let p=r>0;if(!p&&s&&o===0&&a===0&&l===0){e=b;return}if(p)r--;if((!p||u)&&r===0&&o===0&&a===0&&l===0){e=b+1;return}if(p&&r===0&&o===0&&a===0&&l===0){e=b+1;let y=e;x();let T=kt();if(e=y,T)return}je.lastIndex=b+1;continue}if(h===Q&&r===0&&o===0&&a===0&&l===0){e=b+1;return}if((h===me||h===we)&&r===0&&o===0&&a===0&&l===0){if(e=b,Xe())return}je.lastIndex=b+1}e=C}function an(){e++;while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;let s=f.indexOf(`
16
- `,e),r=s===-1?C:s,o=f.indexOf(";",e);if(o!==-1&&o<r){let a=o-1;while(a>=e&&(f.charCodeAt(a)===We||f.charCodeAt(a)===Le))a--;let l=f.charCodeAt(e),u=f.charCodeAt(a);if(l===P&&u===z||l===$e&&u===Se||l===fe&&u===fe||l===pe&&u===pe||l===ve&&u===ve){e=o+1;return}}_e()}function Bt(){De(P,z);while(e<C&&Ie(f.charCodeAt(e)))e++;if(w("from")){e+=4;while(e<C&&Ie(f.charCodeAt(e)))e++;if(e<C){let s=f.charCodeAt(e);if(s===fe||s===pe)Ne(s)}}while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++}function Ht(){e++;while(e<C&&Ie(f.charCodeAt(e)))e++;if(w("as")){e+=2;while(e<C&&Ie(f.charCodeAt(e)))e++;xe();while(e<C&&Ie(f.charCodeAt(e)))e++}if(w("from")){e+=4;while(e<C&&Ie(f.charCodeAt(e)))e++;if(e<C){let s=f.charCodeAt(e);if(s===fe||s===pe)Ne(s)}}while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++}function ft(s){let r=s.indexOf("from ");if(r===-1)return;let o=r+5;while(o<s.length&&(s.charCodeAt(o)===32||s.charCodeAt(o)===9))o++;if(o>=s.length)return;let a=s.charCodeAt(o);if(a!==39&&a!==34)return;let l=s.indexOf(s[o],o+1);if(l===-1)return;return s.slice(o+1,l)}function Fe(s){if(!F)return;let r=s-1;while(r>=0&&Ie(f.charCodeAt(r)))r--;if(r<0)return;let o=[],a=!1;while(r>=0){if(r>=1&&f.charCodeAt(r)===H&&f.charCodeAt(r-1)===Ce){let A=f.lastIndexOf("/*",r-2);if(A>=0){o.push(f.slice(A,r+1)),a=!0,r=A-1;while(r>=0&&Ie(f.charCodeAt(r)))r--;continue}break}let l=r;while(l>0&&f.charCodeAt(l-1)!==me)l--;let u=G(l,r+1);if(u.startsWith("//")){if(a)break;let A=[u];r=l-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===we))r--;while(r>=0){let b=r;while(b>0&&f.charCodeAt(b-1)!==me)b--;let h=G(b,r+1);if(h.startsWith("//")){A.push(h),r=b-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===we))r--}else if(h===""){r=b-1;while(r>=0&&(f.charCodeAt(r)===me||f.charCodeAt(r)===we))r--}else break}A.reverse(),o.push(A.join(`
17
- `));continue}break}if(o.length===0)return;return o.reverse(),o}function ln(s){let r=s,o=!1,a=0,l;while(e<C){let M=f.charCodeAt(e);if(M===H&&(f.charCodeAt(e+1)===H||f.charCodeAt(e+1)===Ce)){x();continue}if(M===Q){e++;break}if(M===P)a++;else if(M===z&&a>0)a--;if(M===fe||M===pe){if(Ne(M),a>0)continue;o=!0;let I=e;if(x(),f.charCodeAt(e)===ue){let S=e+1;l=Me(f.slice(r,S)),e=l?S:I}else e=I;while(e<C&&(f.charCodeAt(e)===We||f.charCodeAt(e)===Le))e++;if(e<C&&f.charCodeAt(e)===Q)e++;break}if(M===me&&o)break;e++}let u=G(r,e),A=m(u).find((M)=>M.category==="static-import"),b=t(u),h=l?.isTypeOnly??A?.isTypeOnly??!1,p=b[1]?.kind==="quoted",y=l?.source??A?.specifier??"",T=Fe(r);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:h,isSideEffect:p,source:y,leadingComments:T,start:r,end:e}}function $t(){let s=e;return De(P,z),f.slice(s,e)}function Nt(s){let r=s.indexOf("(");if(r===-1)return s;let o=s.slice(r);if(o.indexOf("=")===-1)return s;let a=!1;for(let h=0;h<o.length;h++)if(o.charCodeAt(h)===61){let y=h>0?o.charCodeAt(h-1):0,T=h+1<o.length?o.charCodeAt(h+1):0;if(y!==61&&y!==33&&y!==60&&y!==62&&T!==61&&T!==62){a=!0;break}}if(!a)return s;let l=0,u=-1;for(let h=r;h<s.length;h++){let p=s.charCodeAt(h);if(p===40)l++;else if(p===41){if(l--,l===0){u=h;break}}}if(u===-1)return s;let A=s.slice(r,u+1),b=tt(A);return s.slice(0,r)+b+s.slice(u+1)}function jt(s){let r=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,o=s.split(`
18
- `),a=[],l=[],u=[],A=!1,b=1/0;for(let y=0;y<o.length;y++){let T=o[y];if(r){if(A){if(T.includes("*/"))A=!1;continue}let M=T.trim();if(M.length===0)continue;let I=M.charCodeAt(0);if(I===H){let K=M.charCodeAt(1);if(K===H)continue;if(K===Ce){if(!M.includes("*/"))A=!0;continue}}if(I===Ce)continue;let S=Be(T);if(S.charCodeAt(S.length-1)===Q)S=S.slice(0,-1);S=Nt(S);let v=S.trim();if(!v)continue;a.push(S),l.push(v);let E=0;while(E<S.length&&Ie(S.charCodeAt(E)))E++;if(v!=="{"&&v!=="}"){if(E<b)b=E}u.push(E)}else{let M=T.length;while(M>0&&(T.charCodeAt(M-1)===We||T.charCodeAt(M-1)===Le||T.charCodeAt(M-1)===we))M--;if(M===0)continue;let I=M<T.length?T.slice(0,M):T;if(I.charCodeAt(I.length-1)===Q)I=I.slice(0,-1);I=Nt(I);let S=I.trim();if(!S)continue;a.push(I),l.push(S);let v=0;while(v<I.length&&Ie(I.charCodeAt(v)))v++;if(S!=="{"&&S!=="}"){if(v<b)b=v}u.push(v)}}if(a.length===0)return"{}";if(b===1/0||b<=2)return a.join(`
19
- `);let h=b-2,p=Array(a.length);for(let y=0;y<a.length;y++){let T=l[y];if(T==="{"){p[y]=T;continue}let M=u[y];if(M>b)p[y]=a[y];else if(M===b&&(T.charCodeAt(0)===z||T.charCodeAt(0)===Se||T.charCodeAt(0)===ue))p[y]=a[y];else{let I=Math.max(0,M-h);p[y]=" ".repeat(I)+T}}return p.join(`
20
- `)}function Ue(){if(e>=C||f.charCodeAt(e)!==ge)return"";let s=e;De(ge,he);let r=f.slice(s,e);if(r.includes(`
21
- `)){let o="",a=!1;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);if(u===32||u===9||u===10||u===13){if(!a&&o.length>0)o+=" ",a=!0}else o+=r[l],a=!1}if(o.charCodeAt(1)===32)o=`<${o.slice(2)}`;if(o.charCodeAt(o.length-2)===32)o=`${o.slice(0,-2)}>`;return o}return r}function Qe(){if(e>=C||f.charCodeAt(e)!==Z)return"()";let s=e;return De(Z,ue),f.slice(s,e)}function dt(s){if(s.indexOf("/")===-1)return s;let r="",o=!1,a=0;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(o){if(r+=s[l],u===ze&&l+1<s.length){r+=s[++l];continue}if(u===a)o=!1;continue}if(u===fe||u===pe||u===ve){o=!0,a=u,r+=s[l];continue}if(u===H&&l+1<s.length){let A=s.charCodeAt(l+1);if(A===Ce){let b=s.indexOf("*/",l+2);l=b===-1?s.length:b+1,r+=" ";continue}if(A===H){let b=s.indexOf(`
22
- `,l+2);l=b===-1?s.length:b-1;continue}}r+=s[l]}return r.trim()}function tt(s){let r=s.slice(1,-1).trim();if(!r)return"()";if(s.indexOf(`
23
- `)===-1&&r.indexOf(":")!==-1&&r.indexOf("{")===-1&&r.indexOf("[")===-1&&r.indexOf("=")===-1&&r.indexOf("@")===-1&&r.indexOf("...")===-1){let h=0,p=0,y=0;for(let T=0;T<r.length;T++){let M=r.charCodeAt(T);if(M===Z||M===ge||M===P)y++;else if(M===ue||M===he||M===z)y--;else if(y===0){if(M===Ge)h++;else if(M===Ke)p++}}if(h>=p+1){let T=!1;for(let M=0;M<Et.length;M++){let I=Et[M],S=r.indexOf(I);if(S!==-1){let v=S+I.length;if((S===0||!i(r.charCodeAt(S-1)))&&(v>=r.length||!i(r.charCodeAt(v)))){T=!0;break}}}if(!T)return s}}let o=[],a=0,l=0,u=!1,A=0;for(let h=0;h<=r.length;h++){if(h===r.length){o.push(dt(r.slice(a).trim()));break}let p=r.charCodeAt(h);if(u){if(p===ze){h++;continue}if(p===A)u=!1;continue}if(p===H&&h+1<r.length){let y=r.charCodeAt(h+1);if(y===Ce){h+=2;while(h+1<r.length&&!(r.charCodeAt(h)===Ce&&r.charCodeAt(h+1)===H))h++;h++;continue}if(y===H){while(h<r.length&&r.charCodeAt(h)!==10)h++;continue}}if(p===fe||p===pe||p===ve){u=!0,A=p;continue}if(p===Z||p===P||p===$e||p===ge)l++;else if(p===ue||p===z||p===Se||p===he&&!(h>0&&r.charCodeAt(h-1)===ke))l--;else if(p===Ke&&l===0)o.push(dt(r.slice(a,h).trim())),a=h+1}let b=[];for(let h of o){if(!h)continue;let p=h.trim();if(p.startsWith("//")||p.startsWith("/*"))continue;let y=h;{let T=!1,M=0,I=0,S=0;for(let v=0;v<y.length-1;v++){let E=y.charCodeAt(v);if(E===me){S=v+1;continue}if(T){if(E===ze){v++;continue}if(E===M)T=!1;continue}if(E===fe||E===pe||E===ve){T=!0,M=E;continue}if(E===P||E===$e||E===Z||E===ge){I++;continue}if(E===z||E===Se||E===ue||E===he){if(I>0)I--;continue}if(E===H&&y.charCodeAt(v+1)===H){if(I===0){y=y.slice(0,v).trimEnd();break}let K=y.indexOf(`
24
- `,v);if(K===-1){y=y.slice(0,S).trimEnd();break}let B=y.slice(0,S),q=y.slice(K+1);y=`${B}${q}`,v=S-1}}}if(!y.trim())continue;b.push(qt(y))}return Ae(`(${b.join(", ")})`)}function fn(s){if(!s.startsWith("{")&&!s.startsWith("["))return s;let r="",o=0,a=0,l=!1,u=0;while(o<s.length){let A=s.charCodeAt(o);if(l){if(A===ze&&o+1<s.length){r+=s[o]+s[o+1],o+=2;continue}if(A===u)l=!1;r+=s[o],o++;continue}if(A===H&&o+1<s.length){let b=s.charCodeAt(o+1);if(b===Ce){let h=o;o+=2;while(o+1<s.length&&!(s.charCodeAt(o)===Ce&&s.charCodeAt(o+1)===H))o++;o=Math.min(o+2,s.length),r+=s.slice(h,o);continue}if(b===H){let h=o;while(o<s.length&&s.charCodeAt(o)!==10)o++;r+=s.slice(h,o);continue}}if(A===fe||A===pe||A===ve){l=!0,u=A,r+=s[o],o++;continue}if(A===P||A===$e||A===Z)a++;else if(A===z||A===Se||A===ue)a--;if(a>=1&&A===ke&&(o+1>=s.length||s.charCodeAt(o+1)!==ke&&s.charCodeAt(o+1)!==he)){while(r.length>0&&(r[r.length-1]===" "||r[r.length-1]==="\t"||r[r.length-1]===`
25
- `))r=r.slice(0,-1);o++;let b=0;while(o<s.length){let h=s.charCodeAt(o);if(h===fe||h===pe||h===ve){let p=h;o++;while(o<s.length){if(s.charCodeAt(o)===ze){o+=2;continue}if(s.charCodeAt(o)===p){o++;break}o++}continue}if(h===P||h===$e||h===Z)b++;else if(h===z||h===Se||h===ue){if(b===0)break;b--}else if(h===Ke&&b===0)break;o++}continue}if(a===1&&A===Ve&&o+2<s.length&&s.charCodeAt(o+1)===Ve&&s.charCodeAt(o+2)===Ve){o+=3;continue}r+=s[o],o++}return r}function qt(s){let r=s.trim(),o=r.startsWith("...");if(o)r=r.slice(3).trim();while(r.startsWith("@")){let S=1;while(S<r.length&&i(r.charCodeAt(S)))S++;if(S<r.length&&r.charCodeAt(S)===Z){let v=1;S++;while(S<r.length&&v>0){if(r.charCodeAt(S)===Z)v++;else if(r.charCodeAt(S)===ue)v--;S++}}r=r.slice(S).trim()}let a=!0;while(a){a=!1;for(let S of Et)if(r.startsWith(S)&&r.length>S.length&&!i(r.charCodeAt(S.length))){let v=r.slice(S.length).trim();if(v.charCodeAt(0)===Ge||v.charCodeAt(0)===gt&&v.length>1&&v.charCodeAt(1)===Ge)break;r=v,a=!0;break}}let l=-1,u=-1,A=0,b=!1,h=0;for(let S=0;S<r.length;S++){let v=r.charCodeAt(S);if(b){if(v===ze){S++;continue}if(v===h)b=!1;continue}if(v===H&&S+1<r.length){let E=r.charCodeAt(S+1);if(E===Ce){S+=2;while(S+1<r.length&&!(r.charCodeAt(S)===Ce&&r.charCodeAt(S+1)===H))S++;S++;continue}if(E===H){while(S<r.length&&r.charCodeAt(S)!==10)S++;continue}}if(v===fe||v===pe||v===ve){b=!0,h=v;continue}if(v===Z||v===P||v===$e||v===ge)A++;else if(v===ue||v===z||v===Se||v===he&&!(S>0&&r.charCodeAt(S-1)===ke))A--;else if(A===0){if(v===Ge&&l===-1)l=S;else if(v===ke&&u===-1&&(S===0||r.charCodeAt(S-1)!==ke)&&(S+1>=r.length||r.charCodeAt(S+1)!==ke&&r.charCodeAt(S+1)!==he))u=S}}let p,y,T=u!==-1;if(l!==-1&&(u===-1||l<u))if(p=r.slice(0,l).trim(),u!==-1)y=r.slice(l+1,u).trim();else y=r.slice(l+1).trim();else if(u!==-1)p=r.slice(0,u).trim(),y=xt(r.slice(u+1).trim());else p=r,y="unknown";if(p=fn(p),(p.startsWith("{")||p.startsWith("["))&&p.includes(`
26
- `)){let S=p.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(S.length<=40)p=S;else p=p.split(`
27
- `).map((E)=>{let K=E.trim();if(!K)return"";if(K==="{"||K==="}"||K==="["||K==="]"||K.startsWith("}")||K.startsWith("]"))return K;return` ${K}`}).join(`
28
- `)}let M=p.endsWith("?")||T;if(p.endsWith("?"))p=p.slice(0,-1).trim();let I=M&&!o?"?":"";if(o)return`...${p}: ${y}`;return`${p}${I}: ${y}`}function zt(s){let r=0;if(r<s.length&&s.charCodeAt(r)===45)r++;if(r>=s.length)return!1;let o=s.charCodeAt(r);if(o<48||o>57)return!1;while(r<s.length&&s.charCodeAt(r)>=48&&s.charCodeAt(r)<=57)r++;if(r<s.length&&s.charCodeAt(r)===46){if(r++,r>=s.length||s.charCodeAt(r)<48||s.charCodeAt(r)>57)return!1;while(r<s.length&&s.charCodeAt(r)>=48&&s.charCodeAt(r)<=57)r++}return r===s.length}function xt(s){let r=s.trim(),o=ae(r);if(o)return o;if(r==="true"||r==="false")return"boolean";if(zt(r))return"number";if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return"string";if(r.startsWith("["))return"unknown[]";if(r.startsWith("{"))return"Record<string, unknown>";return Ee(r)??"unknown"}function yt(s){let r=s.trim();if(r.endsWith("as const"))r=r.slice(0,-8).trim();if(r==="true"||r==="false")return r;if(zt(r))return r;let o=dn(r);if(o!==null)return o;return Ee(r)??"unknown"}function dn(s){if(s==="")return null;if(s.charCodeAt(0)===fe||s.charCodeAt(0)===pe){if(at(s,0,s.charCodeAt(0))===s.length)return s}let r=un(s,"+");if(r.length>1){let o=!1,a=!0,l=[];for(let u of r){let A=u.trim(),b=A.charCodeAt(0);if((b===fe||b===pe)&&at(A,0,b)===A.length)o=!0,l.push(hn(A));else a=!1}if(a)return pn(l.join(""));if(o)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function un(s,r){let o=[],a=0,l="",u=0;while(u<s.length){let A=s.charCodeAt(u);if(A===fe||A===pe||A===ve){let b=at(s,u,A);l+=s.slice(u,b),u=b;continue}if(A===H&&(s.charCodeAt(u+1)===H||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===H){let p=s.indexOf(`
29
- `,u+2),y=p===-1?s.length:p;l+=s.slice(u,y),u=y;continue}let b=s.indexOf("*/",u+2),h=b===-1?s.length:b+2;l+=s.slice(u,h),u=h;continue}if(A===Z||A===$e||A===P)a++;else if(A===ue||A===Se||A===z)a--;if(s[u]===r&&a===0){o.push(l),l="",u++;continue}l+=s[u],u++}return o.push(l),o}function hn(s){return s.slice(1,-1).replace(/\\(.)/g,(o,a)=>{if(a==="n")return`
30
- `;if(a==="t")return"\t";if(a==="r")return"\r";if(a==="0")return"\x00";return a})}function pn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function ut(s){if(s.endsWith("as const"))return null;let r=0,o=-1;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(u===fe||u===pe||u===ve)l=at(s,l,u)-1;else if(u===123||u===91||u===40)r++;else if(u===125||u===93||u===41)r--;else if(r===0&&u===32&&l+4<=s.length&&s.substring(l,l+4)===" as ")o=l}if(o===-1)return null;return s.slice(o+4).trim()||null}function ot(){if(x(),e<C&&f.charCodeAt(e)===Ge){let a=function(){let l=G(s,o),u=(A)=>{let b=l.length-A.length;return b>=0&&l.endsWith(A)&&(b===0||!i(l.charCodeAt(b-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,x();let s=e,r=0,o=s;while(e<C){let l=e;if(Te()){if(f.charCodeAt(l)!==H)o=e;continue}let u=f.charCodeAt(e);if(u===Z||u===$e||u===ge)r++;else if(u===ue||u===Se||u===he&&!qe())r--;else if(u===P)if(r>0)r++;else if(a())r++;else break;else if(u===z){if(r===0)break;r--}else if(r===0&&u===Q)break;if(r===0&&rt()&&!a())break;if(!Ie(u))o=e+1;e++}return G(s,e)}return""}function Ze(s,r,o,a){e+=8,x();let l=e<C&&f.charCodeAt(e)===Ce;if(l)e++,x();let u=xe();if(!u&&!a)return null;x();let A=Ue();x();let b=Qe();x();let h=ot(),p=h.length>0;if(!h)if(o&&l)h="AsyncGenerator<unknown, void, unknown>";else if(l)h="Generator<unknown, void, unknown>";else if(o)h="Promise<void>";else h="void";x();let y=!1;if(e<C&&f.charCodeAt(e)===P){y=!0;let K=e+1;if(De(P,z),!p&&!l){let B=f.slice(K,e-1),q=bi(B,V,()=>{let ye;do ye=`__dtsx_return_${oe++}`;while(f.includes(ye));return ye},(ye)=>re.set(ye.name,{...ye,start:e,end:e}),A);h=q.finish(O(B,o,b,ne,q.resolve))}}else if(e<C&&f.charCodeAt(e)===Q)e++;let T=tt(b),S=`${r?a?"export default function ":"export declare function ":"declare function "}${u||(a?"":"default")}${A}${T}: ${h};`,v=Fe(s),E={kind:"function",name:u||"default",text:S,isExported:r,isDefault:a,isAsync:o,isGenerator:l,returnType:h,generics:A||void 0,leadingComments:v,start:s,end:e};if(y)be.add(E);return E}let St,mn=0;function Ft(){St??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${mn++}`;if(St.has(s))continue;return St.add(s),s}}function Ye(s,r,o){e+=r.length,x();let a=[];do{if(x(),e>=C)break;let l=f.charCodeAt(e),u,A=e;if(l===P||l===$e)De(l,l===P?z:Se),u=f.slice(A,e);let b=u?Ft():xe();if(!b)return _e(),a;x();let h,p,y,T=!1;if(e<C&&f.charCodeAt(e)===Ge){e++,x();let K=e,B=0;while(e<C){if(Te()){if(B===0&&bt())break;continue}let q=f.charCodeAt(e);if(q===Z||q===P||q===$e||q===ge)B++;else if(q===ue||q===z||q===Se||q===he&&!qe())B--;else if(B===0&&(q===Q||q===Ke))break;else if(B===0&&q===ke&&!wt())break;if(B===0&&(Xe()||Lt()))break;e++}h=G(K,e)}if(e<C&&f.charCodeAt(e)===ke)if(de&&h&&(!F||!Sn(h)))an();else{e++,x();let K=e;y=K;let B=0,q=0,ye=0,et=!0;for(;;){e=K,B=0,q=0,ye=0;while(e<C){if(Te()){if(B===0&&q===0&&ye===0&&bt())break;continue}let Re=f.charCodeAt(e);if(Re===Z||Re===P||Re===$e)B++;else if(Re===ue||Re===z||Re===Se)B--;else if(Re===ge&&B===0){let ct=Gt(e);if(ct!==null)ye=Math.max(0,ye+ct);else if(et&&(e+1>=C||f.charCodeAt(e+1)!==ke))q++}else if(Re===he&&B===0&&ye===0&&!qe()){if(q>0&&(e+1>=C||f.charCodeAt(e+1)!==ke))q--}else if(B===0&&q===0&&ye===0&&(Re===Q||Re===Ke))break;if(B===0&&q===0&&ye===0&&(Xe()||nn()))break;e++}if(q>0&&et){et=!1;continue}break}if(p=ie(G(K,e)),p.endsWith(" as const")||p==="const"){if(T=!0,!h){let Re=p.endsWith(" as const")?p.slice(0,-9).trim():p,ct=yt(Re);h=ct!=="unknown"?ct:void 0}}else if(!h){let Re=W(p)??ut(p)??ne(p);if(Re)h=Re}}let M=a.length===0?Fe(s):void 0,I=u?"const":r,S=u?!1:o,v=`${S?"export ":""}declare ${I} ${b}: ${h||"unknown"};`,E={kind:"variable",name:b,text:v,isExported:S,typeAnnotation:h,value:p,initializerStart:y,modifiers:T?[I,"const assertion"]:[I],leadingComments:u?void 0:M,start:s,end:e};if(u)a.push(...Kn({pattern:u,patternOffset:A,root:E,kind:r,exported:o,comments:M,allocateName:Ft}));else a.push(E);if(f.charCodeAt(e)===Ke){e++;continue}if(f.charCodeAt(e)===Q)e++;break}while(e<C);return a}function Gt(s){if(f.charCodeAt(s)!==ge||s+1>=C)return null;let r=f.charCodeAt(s+1);if(r===he)return 1;if(r===H)return-1;if(!c(r))return null;let o=s+2;while(o<C){let p=f.charCodeAt(o);if(!i(p)&&p!==Ve&&p!==58&&p!==45)break;o++}let a=f.slice(s+1,o),l=f.charCodeAt(o);if(l>32&&l!==he&&l!==H)return null;let u=0,A=0,b=o;for(;b<C;b++){let p=f.charCodeAt(b);if(A!==0){if(p===ze)b++;else if(p===A)A=0;continue}if(p===fe||p===pe||p===ve)A=p;else if(p===P)u++;else if(p===z&&u>0)u--;else if(p===he&&u===0)break}if(b>=C)return null;let h=b-1;while(h>s&&f.charCodeAt(h)<=32)h--;if(f.charCodeAt(h)===H)return 0;return f.indexOf(`</${a}`,b+1)===-1?null:1}function vt(s,r){e+=9,x();let o=xe();x();let a=Ue();x();let l="";if(w("extends")){e+=7,x();let p=e,y=0;while(e<C){if(Te())continue;let T=f.charCodeAt(e);if(T===ge)y++;else if(T===he&&!qe())y--;else if(T===P&&y===0)break;e++}l=G(p,e)}x();let u=e<C&&f.charCodeAt(e)===P?$t():"{}",A=jt(u),b=`${r?"export ":""}declare interface ${o}${a}${l?` extends ${l}`:""} ${A}`,h=Fe(s);return{kind:"interface",name:o,text:b,isExported:r,extends:l||void 0,generics:a||void 0,leadingComments:h,start:s,end:e}}function Dt(s,r){e+=4,x();let o=xe();x();let a=Ue();if(x(),e<C&&f.charCodeAt(e)===ke)e++;x();let l=e,u=0;while(e<C){if(Te())continue;let p=f.charCodeAt(e);if(p===Z||p===P||p===$e||p===ge)u++;else if(p===ue||p===z||p===Se||p===he&&!qe())u--;else if(u===0&&p===Q)break;if(u===0&&(Xe()||Lt()))break;e++}let A=G(l,e);if(e<C&&f.charCodeAt(e)===Q)e++;let b=`${r?"export ":""}type ${o}${a} = ${A}`,h=Fe(s);return{kind:"type",name:o,text:b,isExported:r,generics:a||void 0,leadingComments:h,start:s,end:e}}function nt(s,r,o){e+=4,x();let a=xe();x();let l=e;if(e<C&&f.charCodeAt(e)===P)De(P,z);let u=G(s,e),A=Fe(s);return{kind:"enum",name:a,text:u,isExported:r,modifiers:o?["const"]:void 0,leadingComments:A,start:s,end:e}}function Je(s,r,o,a=!1){e+=5,x();let l=xe()||"AnonymousClass";x();let u=Ue();x();let A="";if(w("extends")){e+=7,x();let M=e,I=0;while(e<C){if(Te())continue;let S=f.charCodeAt(e);if(S===ge)I++;else if(S===he&&!qe())I--;else if(I===0&&(S===P||w("implements")))break;e++}A=G(M,e)}let b;if(w("implements")){e+=10,x();let M=e,I=0;while(e<C){if(Te())continue;let v=f.charCodeAt(e);if(v===ge)I++;else if(v===he&&!qe())I--;else if(I===0&&v===P)break;e++}let S=G(M,e);if(S)b=S.split(",").map((v)=>v.trim())}x();let h=_t(),y=`${r?a?"export default ":"export declare ":"declare "}${o?"abstract ":""}class ${l}${u}${A?` extends ${A}`:""}${b&&b.length>0?` implements ${b.join(", ")}`:""} ${h}`,T=Fe(s);return{kind:"class",name:l,text:y,isExported:r,isDefault:a,extends:A||void 0,implements:b,generics:u||void 0,modifiers:o?["abstract"]:void 0,leadingComments:T,start:s,end:e}}function _t(){if(e>=C||f.charCodeAt(e)!==P)return"{}";e++;let s={fields:new Map,pending:[],isStatic:!1};le.push(s);let r=[],o=new Set;while(e<C){if(x(),e>=C)break;if(f.charCodeAt(e)===z){e++;break}if(f.charCodeAt(e)===Q){e++;continue}if(w("static")&&pt("static")===P){e+=6,x(),De(P,z);continue}let a=!1,l=!1,u=!1,A=!1,b=!1,h=!1,p=!1,y=!1,T=!0;while(T){x();let K=e,B=xe();if(e=K,B){let q=pt(B);if(q===Z||q===ge||q===gt||q===33||q===Ge||q===ke||q===Q||q===z)break}if(w("private")){a=!0,e+=7;continue}if(w("protected")){l=!0,e+=9;continue}if(w("public")){e+=6;continue}if(w("static")){u=!0,e+=6;continue}if(w("abstract")){A=!0,e+=8;continue}if(w("readonly")){b=!0,e+=8;continue}if(w("override")){h=!0,e+=8;continue}if(w("accessor")){p=!0,e+=8;continue}if(w("async")){y=!0,e+=5;continue}if(w("declare")){e+=7;continue}break}if(x(),e>=C||f.charCodeAt(e)===z)break;let M=e;if(s.isStatic=u,(w("get")||w("set"))&&It(pt(f.slice(e,e+3))))e+=3,x();if(f.charCodeAt(e)===Ce)e++,x();let I=ht();e=M;let S=I.startsWith("#");if(S)a=!0;if(a&&I&&I!=="constructor"){let K=S?u?" static #private_static;":" #private;":` private ${u?"static ":""}${I};`,q=I[0]==="'"||I[0]==='"'?d(I)??I:I,ye=S?`${u?"static":"instance"}#`:`${u?"static:":"instance:"}${q}`;if(!o.has(ye))o.add(ye),r.push(K)}let v=a?[]:r,E=" ";if(l)E+="protected ";if(u)E+="static ";if(A)E+="abstract ";if(b)E+="readonly ";if(w("constructor")){e+=11,x();let K=Qe();if(x(),Cn(K,r),e<C&&f.charCodeAt(e)===P)De(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let B=tt(K);r.push(a?" private constructor();":` ${l?"protected ":""}constructor${B};`)}else if(w("get"))if(e+=3,x(),e<C&&It(f.charCodeAt(e))){let K=ht();if(K.startsWith("#")){if(x(),e<C&&f.charCodeAt(e)===Z)Qe();if(x(),ot(),x(),e<C&&f.charCodeAt(e)===P)De(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;continue}x(),Qe(),x();let B=ot(),q;if(x(),e<C&&f.charCodeAt(e)===P){let et=e+1;if(De(P,z),!B&&!de)q=f.slice(et,e-1),B=O(q,!1,"()",(Re)=>J(Re,u))}else if(e<C&&f.charCodeAt(e)===Q)e++;let ye=v.length;if(v.push(`${E}get ${K}(): ${B||"unknown"};`),q)s.pending.push(()=>{let et=O(q,!1,"()",(Re)=>J(Re,u));v[ye]=`${E}get ${K}(): ${et};`})}else Ut("get",E,u,b,y,v);else if(w("set"))if(e+=3,x(),e<C&&It(f.charCodeAt(e))){let K=ht();if(K.startsWith("#")){if(x(),e<C&&f.charCodeAt(e)===Z)Qe();if(x(),e<C&&f.charCodeAt(e)===P)De(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;continue}x();let B=Qe();if(x(),e<C&&f.charCodeAt(e)===P)De(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let q=tt(B);v.push(`${E}set ${K}${q};`)}else Ut("set",E,u,b,y,v);else{let K=f.charCodeAt(e)===Ce;if(K)e++,x();let B=ht();if(!B){Kt();continue}Vt(B,E,u,b,K,A,y,v)}}for(let a of s.pending)a();return le.pop(),`{
31
- ${r.join(`
32
- `)}
33
- }`}function It(s){return c(s)||s===$e||s===Yt||s===fe||s===pe}function ht(){if(e>=C)return"";let s=f.charCodeAt(e);if(s===$e){let r=e;return De($e,Se),f.slice(r,e)}if(s===Yt)return e++,`#${xe()}`;if(s===fe||s===pe){let r=e;return Ne(s),f.slice(r,e)}return xe()}function pt(s){let r=e;e+=s.length,x();let o=e<C?f.charCodeAt(e):0;return e=r,o}function Kt(){let s=0;while(e<C){if(Te())continue;let r=f.charCodeAt(e);if(r===P||r===Z)s++;else if(r===z||r===ue){if(s===0)return;s--}else if(r===Q&&s===0){e++;return}if(s===0&&rt())return;e++}}function Ut(s,r,o,a,l,u){Vt(s,r,o,a,!1,!1,l,u)}function Vt(s,r,o,a,l,u,A,b){if(x(),e>=C)return;let h=f.charCodeAt(e),p=!1;if(h===gt)p=!0,e++,x();if(e<C&&f.charCodeAt(e)===33)e++,x();let y=e<C?f.charCodeAt(e):0;if(y===Z||y===ge){let T=y===ge?Ue():"";x();let M=Qe();x();let I=ot(),S,v=I.length>0;if(!I)if(A&&l)I="AsyncGenerator<unknown, void, unknown>";else if(l)I="Generator<unknown, void, unknown>";else if(A)I="Promise<void>";else I="void";if(x(),e<C&&f.charCodeAt(e)===P){let q=e+1;if(De(P,z),!v&&!l)S=f.slice(q,e-1),I=O(S,A,M,(ye)=>J(ye,o))}else if(e<C&&f.charCodeAt(e)===Q)e++;let E=tt(M),K=p?"?":"",B=b.length;if(b.push(`${r}${s}${K}${T}${E}: ${I};`),S)le.at(-1)?.pending.push(()=>{let q=O(S,A,M,(ye)=>J(ye,o));b[B]=`${r}${s}${K}${T}${E}: ${q};`})}else if(y===Ge||y===ke||y===Q||y===z||y===me||y===we){let T="";if(y===Ge){e++,x();let S=e,v=0;while(e<C){if(Te())continue;let E=f.charCodeAt(e);if(E===Z||E===P||E===$e||E===ge)v++;else if(E===ue||E===z||E===Se||E===he&&!qe()){if(v===0)break;v--}else if(v===0&&(E===Q||E===Ke))break;else if(v===0&&E===ke&&!wt())break;if(v===0&&rt())break;e++}T=G(S,e)}let M="";if(e<C&&f.charCodeAt(e)===ke)if(de&&T){e++;let S=0;while(e<C){if(Te())continue;let v=f.charCodeAt(e);if(v===Z||v===P||v===$e)S++;else if(v===ue||v===z||v===Se){if(S===0&&v===z)break;S--}else if(S===0&&v===Q)break;if(S===0&&rt())break;e++}}else{e++,x();let S=e,v=0;while(e<C){if(Te())continue;let E=f.charCodeAt(e);if(E===Z||E===P||E===$e)v++;else if(E===ue||E===z||E===Se){if(v===0&&E===z)break;v--}else if(v===0&&E===Q)break;if(v===0&&rt())break;e++}M=G(S,e)}if(e<C&&f.charCodeAt(e)===Q)e++;if(!T)if(M){let S=ut(M);if(S)T=S;else T=M.endsWith("as const")||o&&a?yt(M):xt(M)}else T="unknown";let I=p?"?":"";le.at(-1)?.fields.set(`${o?"static:":""}${s}`,p?`(${T}) | undefined`:T),b.push(`${r}${s}${I}: ${T};`)}else Kt()}function gn(s){let r=0;for(let o=0;o<s.length;o++){let a=s.charCodeAt(o);if(a===Z||a===P||a===$e||a===ge)r++;else if(a===ue||a===z||a===Se||a===he&&s.charCodeAt(o-1)!==ke)r--;else if(a===ke&&r===0&&s.charCodeAt(o+1)!==he&&s.charCodeAt(o+1)!==ke)return!0}return!1}function Cn(s,r){let o=s.slice(1,-1).trim();if(!o)return;let a=[],l=0,u=0,A=!1,b=0;for(let h=0;h<=o.length;h++){if(h===o.length){a.push(dt(o.slice(l).trim()));break}let p=o.charCodeAt(h);if(A){if(p===ze){h++;continue}if(p===b)A=!1;continue}if(p===H&&h+1<o.length){let y=o.charCodeAt(h+1);if(y===Ce){h+=2;while(h+1<o.length&&!(o.charCodeAt(h)===Ce&&o.charCodeAt(h+1)===H))h++;h++;continue}if(y===H){while(h<o.length&&o.charCodeAt(h)!==10)h++;continue}}if(p===fe||p===pe||p===ve){A=!0,b=p;continue}if(p===Z||p===P||p===$e||p===ge)u++;else if(p===ue||p===z||p===Se||p===he&&!(h>0&&o.charCodeAt(h-1)===ke))u--;else if(p===Ke&&u===0)a.push(dt(o.slice(l,h).trim())),l=h+1}for(let h of a){let p=h.startsWith("public ")||h.startsWith("public\t"),y=h.startsWith("protected ")||h.startsWith("protected\t"),T=h.startsWith("private ")||h.startsWith("private\t"),M=h.includes("readonly ");if(!p&&!y&&!T&&!M)continue;let I=h,S=[];if(T){let B=7;while(B<I.length&&Ie(I.charCodeAt(B)))B++;I=I.slice(B),S.push("private")}if(p){let B=6;while(B<I.length&&Ie(I.charCodeAt(B)))B++;I=I.slice(B),S.push("public")}if(y){let B=9;while(B<I.length&&Ie(I.charCodeAt(B)))B++;I=I.slice(B),S.push("protected")}if(M){let B=I.indexOf("readonly ");if(B!==-1){let q=B+8;while(q<I.length&&Ie(I.charCodeAt(q)))q++;I=I.slice(0,B)+I.slice(q)}S.push("readonly")}let v=S.length>0?`${S.join(" ")} `:"",E=qt(I),K=I.search(/[?:=]/);if(K!==-1&&I.charCodeAt(K)!==63&&gn(I))E=E.replace(/^([\w$]+)\?:/,"$1:");r.push(T?` private ${E.split(/[?:]/,1)[0]};`:` ${v}${E};`)}}function Tt(s=" "){if(e>=C||f.charCodeAt(e)!==P)return"{}";e++;let r=[];while(e<C){if(x(),e>=C)break;if(f.charCodeAt(e)===z){e++;break}if(f.charCodeAt(e)===Q){e++;continue}let o=!1;if(w("export"))o=!0,e+=6,x();if(w("declare"))e+=7,x();let a=o?"export ":"";if(w("function")||w("async")&&bn("async","function")){let l=!1;if(w("async"))l=!0,e+=5,x();if(e+=8,x(),e<C&&f.charCodeAt(e)===Ce)e++,x();let A=xe();x();let b=Ue();x();let h=Qe();x();let p=ot();if(!p)p=l?"Promise<void>":"void";if(x(),e<C&&f.charCodeAt(e)===P)De(P,z);else if(e<C&&f.charCodeAt(e)===Q)e++;let y=tt(h);r.push(`${s}${a}function ${A}${b}${y}: ${p};`)}else if(w("const")||w("let")||w("var")){let l=w("const")?"const":w("let")?"let":"var";e+=l.length,x();let u=xe();if(!u){_e(!0);continue}x();let A="";if(e<C&&f.charCodeAt(e)===Ge){e++,x();let h=e,p=0;while(e<C){if(Te())continue;let y=f.charCodeAt(e);if(y===Z||y===P||y===$e||y===ge)p++;else if(y===z&&p===0)break;else if(y===ue||y===z||y===Se||y===he&&!qe())p--;else if(p===0&&(y===Q||y===Ke))break;else if(p===0&&y===ke&&!wt())break;if(p===0&&Xe())break;e++}A=G(h,e)}let b="";if(e<C&&f.charCodeAt(e)===ke){e++,x();let h=e,p=0;while(e<C){if(Te())continue;let y=f.charCodeAt(e);if(y===Z||y===P||y===$e||y===ge)p++;else if(y===z&&p===0)break;else if(y===ue||y===z||y===Se||y===he&&!qe())p--;else if(p===0&&(y===Q||y===Ke))break;if(p===0&&Xe())break;e++}b=G(h,e)}if(e<C&&f.charCodeAt(e)===Q)e++;if(!A&&b){let h=ut(b);if(h)A=h;else if(l==="const")A=yt(b);else A=xt(b)}if(!A)A="unknown";r.push(`${s}${a}${l} ${u}: ${A};`)}else if(w("interface")){e+=9,x();let l=xe();x();let u=Ue();x();let A="";if(w("extends")){e+=7,x();let h=e,p=0;while(e<C){if(Te())continue;let y=f.charCodeAt(e);if(y===ge)p++;else if(y===he&&!qe())p--;else if(y===P&&p===0)break;e++}A=G(h,e)}let b=jt($t());r.push(`${s}${a}interface ${l}${u}${A?` extends ${A}`:""} ${b}`)}else if(w("type")){e+=4,x();let l=xe();x();let u=Ue();if(x(),e<C&&f.charCodeAt(e)===ke){e++,x();let A=e,b=0;while(e<C){if(Te())continue;let p=f.charCodeAt(e);if(p===Z||p===P||p===$e||p===ge)b++;else if(p===z&&b===0)break;else if(p===ue||p===z||p===Se||p===he&&!qe())b--;else if(b===0&&p===Q)break;if(b===0&&Xe())break;e++}let h=G(A,e);if(e<C&&f.charCodeAt(e)===Q)e++;r.push(`${s}${a}type ${l}${u} = ${h}`)}}else if(w("class")){e+=5,x();let l=xe();x();let u=Ue();x();let A=e,b=0;while(e<C){if(Te())continue;let T=f.charCodeAt(e);if(T===ge)b++;else if(T===he&&!qe())b--;else if(T===P&&b===0)break;e++}let h=G(A,e),p=h?` ${h}`:"",y=_t();r.push(`${s}${a}class ${l}${u}${p} ${y}`)}else if(w("enum")){e+=4,x();let l=xe();x();let u=$t();r.push(`${s}${a}enum ${l} ${u}`)}else if(w("namespace")||w("module")){let l=w("namespace")?"namespace":"module";e+=l.length,x();let u=xe();x();let A=Tt(s);r.push(`${s}${a}${l} ${u} ${A}`)}else if(w("abstract"))if(e+=8,x(),w("class")){e+=5,x();let l=xe();x();let u=Ue();x();let A=e,b=0;while(e<C){if(Te())continue;let T=f.charCodeAt(e);if(T===ge)b++;else if(T===he&&!qe())b--;else if(T===P&&b===0)break;e++}let h=G(A,e),p=h?` ${h}`:"",y=_t();r.push(`${s}${a}abstract class ${l}${u}${p} ${y}`)}else _e(!0);else if(o&&w("default")){e+=7,x();let l=e;_e(!0);let u=G(l,e);if(u.charCodeAt(u.length-1)===Q)u=u.slice(0,-1);if(u)r.push(`${s}export default ${u};`)}else if(!o&&(f.charCodeAt(e)===fe||f.charCodeAt(e)===pe||f.charCodeAt(e)===ve))_e(!0);else _e(!0)}if(r.length===0)return"{}";return`{
34
- ${r.join(`
35
- `)}
36
- }`}function bn(s,r){let o=e+s.length;while(o<C&&Ie(f.charCodeAt(o)))o++;for(let a=0;a<r.length;a++)if(o+a>=C||f.charCodeAt(o+a)!==r.charCodeAt(a))return!1;return o+r.length>=C||!i(f.charCodeAt(o+r.length))}function it(s,r,o){e+=o.length,x();let a="",l=f.charCodeAt(e);if(l===fe||l===pe){let p=e;Ne(l),a=f.slice(p,e)}else{a=xe();while(e<C&&f.charCodeAt(e)===Ve)e++,a+=`.${xe()}`}x();let u=e<C&&f.charCodeAt(e)===P?Tt():"{}",A=`${r?"export ":""}declare ${o} ${a} ${u}`,b=Fe(s),h=a.startsWith("'")||a.startsWith('"');return{kind:"module",name:a,text:A,isExported:r,moduleForm:h?"quoted":o==="namespace"?"namespace":"identifier",source:h?a.slice(1,-1):void 0,leadingComments:b,start:s,end:e}}function Qt(s,r){_e();let o=G(r,e);if(o.charCodeAt(o.length-1)===Q)o=o.slice(0,-1).trimEnd();if(!o)return;let a=c(o.charCodeAt(0));for(let y=1;a&&y<o.length;y++)a=i(o.charCodeAt(y));let l=Fe(s);if(a){R.push({kind:"export",name:"default",text:`export default ${o};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e});return}let u="__dtsx_default_export__",A=1;while(f.includes(u))u=`__dtsx_default_export_${A++}__`;let h=ut(o)||ne(o)||n(o,!1),p=h==="unknown"&&yn(o)?`typeof ${o}`:h;R.push({kind:"variable",name:u,text:`declare const ${u}: ${p};`,isExported:!1,typeAnnotation:p,modifiers:["const"],start:s,end:e}),R.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function Zt(){if(f.charCodeAt(e)===P)return De(P,z),!0;let s=w("if"),r=w("do"),o=w("try"),a=w("for");if(!s&&!r&&!o&&!a&&!w("while")&&!w("switch")&&!w("with"))return!1;if(xe(),x(),a&&w("await"))e+=5,x();if(!r&&!o&&f.charCodeAt(e)===Z)De(Z,ue);if(mt(),x(),s&&w("else"))e+=4,mt();else if(r&&w("while")){if(e+=5,x(),f.charCodeAt(e)===Z)De(Z,ue);if(x(),f.charCodeAt(e)===Q)e++}else if(o){if(w("catch")){if(e+=5,x(),f.charCodeAt(e)===Z)De(Z,ue);mt(),x()}if(w("finally"))e+=7,mt()}return!0}function mt(){if(x(),!Zt())_e()}while(e<C){if(x(),e>=C)break;if(Zt())continue;let s=e,r=f.charCodeAt(e);if(r===105&&w("import"))R.push(ln(s));else if(r===101&&w("export")){e+=6,x();let o=f.charCodeAt(e);if(o===100&&w("default")){e+=7,x();let a=e,l=f.charCodeAt(e);if(l===102&&w("function")){let u=Ze(s,!0,!1,!0);if(u)R.push(u)}else if(l===97&&w("async")&&pt("async")!==Q)if(e+=5,x(),w("function")){let u=Ze(s,!0,!0,!0);if(u)R.push(u)}else Qt(s,a);else if(l===99&&w("class")){let u=Je(s,!0,!1,!0);R.push(u)}else if(l===97&&w("abstract")){if(e+=8,x(),w("class")){let u=Je(s,!0,!0,!0);R.push(u)}}else Qt(s,a)}else if(o===116&&w("type")){let a=e;if(e+=4,x(),e<C&&f.charCodeAt(e)===P){Bt();let l=G(s,e),u=Fe(s);R.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:ft(l),leadingComments:u,start:s,end:e})}else if(e<C&&f.charCodeAt(e)===Ce){Ht();let l=G(s,e);R.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:ft(l),start:s,end:e})}else{e=a;let l=Dt(s,!0);R.push(l)}}else if(o===105&&w("interface")){let a=vt(s,!0);R.push(a)}else if(o===102&&w("function")){let a=Ze(s,!0,!1,!1);if(a)R.push(a)}else if(o===97&&w("async"))if(e+=5,x(),w("function")){let a=Ze(s,!0,!0,!1);if(a)R.push(a)}else _e();else if(o===99)if(w("class")){let a=Je(s,!0,!1);R.push(a)}else if(w("const")){let a=e;if(e+=5,x(),w("enum")){e=a+5,x();let l=nt(s,!0,!0);R.push(l)}else{e=a;let l=Ye(s,"const",!0);for(let u=0;u<l.length;u++)R.push(l[u])}}else _e();else if(o===97&&w("abstract")){if(e+=8,x(),w("class")){let a=Je(s,!0,!0);R.push(a)}}else if(o===108&&w("let")){let a=Ye(s,"let",!0);for(let l=0;l<a.length;l++)R.push(a[l])}else if(o===118&&w("var")){let a=Ye(s,"var",!0);for(let l=0;l<a.length;l++)R.push(a[l])}else if(o===101&&w("enum")){let a=nt(s,!0,!1);R.push(a)}else if(o===100&&w("declare"))e+=7,x(),Xt(s,!0);else if(o===110&&w("namespace")&&lt(9)){let a=it(s,!0,"namespace");R.push(a)}else if(o===109&&w("module")&&lt(6)){let a=it(s,!0,"module");R.push(a)}else if(o===P){Bt();let a=G(s,e),l=a.includes("export type"),u=Fe(s);R.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:l,source:ft(a),leadingComments:u,start:s,end:e})}else if(o===Ce){Ht();let a=G(s,e),l=Fe(s);R.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:!1,source:ft(a),leadingComments:l,start:s,end:e})}else{_e();let a=G(s,e);if(a)R.push({kind:"export",name:"",text:a,isExported:!0,start:s,end:e})}}else if(r===100&&w("declare"))e+=7,x(),Xt(s,!1);else if(r===105&&w("interface")){let o=vt(s,!1);re.set(o.name,o)}else if(r===116&&w("type")){let o=Dt(s,!1);re.set(o.name,o),R.push(o)}else if(r===102&&w("function")){let o=Ze(s,!1,!1,!1);if(o)X(o);else _e()}else if(r===97)if(w("async")){let o=e;if(e+=5,x(),w("function")){let a=Ze(s,!1,!0,!1);if(a)X(a);else e=o,_e()}else e=o,_e()}else if(w("abstract"))if(e+=8,x(),w("class")){let o=Je(s,!1,!1);re.set(o.name,o),R.push(o)}else _e();else e++,_e();else if(r===99)if(w("class")){let o=Je(s,!1,!1);re.set(o.name,o),R.push(o)}else if(w("const")){let o=e;if(e+=5,x(),w("enum")){e=o+5,x();let a=nt(s,!1,!0);re.set(a.name,a),R.push(a)}else{e=o;let a=Ye(s,"const",!1);for(let l=0;l<a.length;l++)re.set(a[l].name,a[l])}}else e++,_e();else if(r===101&&w("enum")){let o=nt(s,!1,!1);re.set(o.name,o),R.push(o)}else if(r===108&&w("let")||r===118&&w("var")){let o=w("let")?"let":"var",a=Ye(s,o,!1);for(let l=0;l<a.length;l++)re.set(a[l].name,a[l])}else if(r===109&&w("module")&&lt(6)){let o=it(s,!1,"module");R.push(o)}else if(r===110&&w("namespace")&&lt(9)){let o=it(s,!1,"namespace");R.push(o)}else{let o=f.charCodeAt(e);if(o===Q)e++;else if(o===fe||o===pe){if(Ne(o),e<C&&f.charCodeAt(e)===Q)e++}else if(o===ve){if(st(),e<C&&f.charCodeAt(e)===Q)e++}else if(o===$n){if(e++,xe(),x(),e<C&&f.charCodeAt(e)===Ve)e++,xe(),x();if(e<C&&f.charCodeAt(e)===Z)De(Z,ue)}else e++,_e()}}if(be.size>0){Jt(R);for(let s of U.values())Jt(s)}if(An(f,R,re,U),Pn(R,re),Wn(R,re),!de)In(f,R,re,ee);if(Y){let s=new Set(R);for(let r of[...re.values(),...[...U.values()].flat()])if(!s.has(r))R.push(r),s.add(r);return R.sort((r,o)=>(r.start??0)-(o.start??0))}if(re.size>0)vn(R,re,U);return R;function Jt(s){let r=new Map;for(let a of s)if(a.kind==="function")r.set(a.name,(r.get(a.name)||0)+1);let o=new Set;for(let[a,l]of r)if(l>1)o.add(a);if(o.size>0){let a=new Set;for(let l of o)for(let u=s.length-1;u>=0;u--)if(s[u].kind==="function"&&s[u].name===l&&be.has(s[u])){a.add(u);break}if(a.size>0){let l=[...a].sort((u,A)=>A-u);for(let u of l)s.splice(u,1)}}}function Xt(s,r){if(w("function")){let o=Ze(s,r,!1,!1);if(o)R.push(o)}else if(w("async")){if(e+=5,x(),w("function")){let o=Ze(s,r,!0,!1);if(o)R.push(o)}}else if(w("class")){let o=Je(s,r,!1);R.push(o)}else if(w("abstract")){if(e+=8,x(),w("class")){let o=Je(s,r,!0);R.push(o)}}else if(w("interface")){let o=vt(s,r);R.push(o)}else if(w("type")){let o=Dt(s,r);R.push(o)}else if(w("enum")){let o=nt(s,r,!1);R.push(o)}else if(w("const")){let o=e;if(e+=5,x(),w("enum")){e=o+5,x();let a=nt(s,r,!0);R.push(a)}else{e=o;let a=Ye(s,"const",r);for(let l=0;l<a.length;l++)if(r||!se)R.push(a[l]);else re.set(a[l].name,a[l])}}else if(w("let")||w("var")){let o=w("let")?"let":"var",a=Ye(s,o,r);for(let l=0;l<a.length;l++)if(r||!se)R.push(a[l]);else re.set(a[l].name,a[l])}else if(w("module")){let o=it(s,r,"module");R.push(o)}else if(w("namespace")){let o=it(s,r,"namespace");R.push(o)}else if(w("global")){e+=6,x();let a=`declare global ${e<C&&f.charCodeAt(e)===P?Tt():"{}"}`,l=Fe(s);R.push({kind:"module",name:"global",text:a,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else _e()}}class tn{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(_){this.names=_;for(let V of _.keys()){if(!V)continue;this.lengths[Math.min(V.length,64)]=1,this.firstUnits[V.charCodeAt(0)]=1}this.size=_.size}scan(_,V){if(this.size===0)return!1;let L=!1,N=0,Y=_.length;while(N<Y){let ee=_.charCodeAt(N);if(ee>=65&&ee<=90||ee>=97&&ee<=122||ee===95||ee===36||ee>127){let f=N;N++;while(N<Y){let F=_.charCodeAt(N);if(F>=65&&F<=90||F>=97&&F<=122||F>=48&&F<=57||F===95||F===36||F>127)N++;else break}if(this.firstUnits[ee]===1&&this.lengths[Math.min(N-f,64)]===1){let F=_.substring(f,N),de=this.names.get(F);if(de!==void 0){if(V.add(F),de.kind==="function"||de.kind==="variable")L=!0}}}else N++}return L}}function en(_,V){let L=0;while(L<_.length){let N=_.charCodeAt(L);if(N===fe||N===pe||N===ve){let se=N;L++;while(L<_.length)if(_.charCodeAt(L)===ze)L+=2;else if(_.charCodeAt(L++)===se)break;continue}if(N===H&&_.charCodeAt(L+1)===H){L+=2;while(L<_.length&&_.charCodeAt(L)!==me&&_.charCodeAt(L)!==we)L++;continue}if(N===H&&_.charCodeAt(L+1)===Ce){let se=_.indexOf("*/",L+2);L=se===-1?_.length:se+2;continue}if(!c(N)){L++;continue}let Y=L++;while(L<_.length&&i(_.charCodeAt(L)))L++;let ee=Y-1,f=L;while(ee>=0&&Ie(_.charCodeAt(ee)))ee--;while(f<_.length&&Ie(_.charCodeAt(f)))f++;let F=ee>=0?_.charCodeAt(ee):0,de=f<_.length?_.charCodeAt(f):0,C=Y>=3&&_.slice(Y-3,Y)==="...";if(de===Ge||F===Ve&&!C)continue;if(de===Z&&(F===P||F===Ke))continue;V.add(_.slice(Y,L))}}function vn(_,V,L){let N=new Set,Y=new Set;for(let se of _)Y.add(se.name);let ee=new tn(V),f=new Set,F=new Set,de=(se)=>{if(ee.scan(se.text,f))zn(se,F)},C=new Set;for(let se=0;se<_.length;se++){let R=_[se];if(R.kind!=="import"){if(de(R),typeof R.value==="string")en(R.value,C)}}for(;;){let se=[];for(let[U,be]of V){if(N.has(U))continue;if((be.kind==="function"||be.kind==="variable"?F:f).has(U)||be.kind!=="function"&&C.has(U)){if(!Y.has(U)){let oe=be.kind==="function"?L.get(U):void 0;if(oe)for(let le of oe)se.push(le);else se.push(be);Y.add(U)}N.add(U)}}if(se.length===0)break;se.sort((U,be)=>(U.start??1/0)-(be.start??1/0));let R=[],re=0;for(let U=0;U<_.length;U++){let be=_[U].start??1/0;while(re<se.length&&(se[re].start??1/0)<=be)R.push(se[re++]);R.push(_[U])}while(re<se.length)R.push(se[re++]);_.length=0;for(let U=0;U<R.length;U++)_.push(R[U]);for(let U of se)if(U.kind!=="import"){if(de(U),typeof U.value==="string")en(U.value,C)}}}
37
- export{bi,va,k,D,Ct};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{f}from"./chunk-dfye109x.js";import{m}from"./chunk-1j6092xz.js";import{h}from"./chunk-wnk9yjw2.js";import{r}from"./chunk-qnf4byak.js";import{we}from"./chunk-vtskg4r2.js";function ko(d){if(!d.includes("declare")||!d.includes("module"))return[];return m(d).filter((g)=>g.category==="augmentation").map((g)=>g.specifier)}function E(d,g){let p=new Set([d]);for(let y of p)for(let w of g(y))p.add(w);return p}async function he(d,g,p=!1,y){let w=new Map,x=new Map;for(let e of d){let l=y?.get(e)??await f(e);w.set(e,l);let s=ko(l);if(s.length)x.set(e,s)}let S=new Map;if(x.size===0)return S;let u=new Map,b=(e,l)=>{let s=g(e,l);if(s.resolved)return s.resolved;if(!s.isRelative&&!s.isAlias)return`external:${e}`;return};for(let[e,l]of w){let s=r(l,e,!1,p),a=we(s),c={edges:[],declarations:new Set,augmentations:new Set},M=(n,i,t)=>{let o=b(n.specifier,e);if(!o)return;if(w.has(o))c.edges.push({specifier:n.specifier,target:o,import:i});if(t)c.declarations.add(o)};for(let n of s){if(n.kind!=="import")continue;let i=n.isSideEffect||h(n.text).some((t)=>a.usedItems.has(t));for(let t of m(n.text))M(t,!0,!!i)}for(let n of m(a.referenceText))M(n,!1,!0);for(let n of x.get(e)??[]){let i=b(n,e);if(i)c.augmentations.add(i),c.declarations.add(i)}u.set(e,c)}let R=!0;while(R){R=!1;for(let[e,l]of u){let s=E(e,(a)=>u.get(a)?.declarations??[]);for(let[a,c]of u){if(s.has(a)||!c.augmentations.size||![...c.augmentations].some((t)=>s.has(t)))continue;let M=[e],n=new Map,i=new Set([e]);for(let t of M){if(t===a)break;for(let o of u.get(t).edges){if(i.has(o.target))continue;i.add(o.target),n.set(o.target,{from:t,edge:o}),M.push(o.target)}}if(!n.has(a))continue;for(let t=a;t!==e;){let{from:o,edge:I}=n.get(t),A=u.get(o);if(I.import){let v=S.get(o);if(!v)v=new Set,S.set(o,v);v.add(I.specifier)}if(!A.declarations.has(t))A.declarations.add(t),R=!0;t=o}}}}return S}
3
- export{ko,he};