@dtsx/dtsx 0.11.48 → 0.11.51

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 (130) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-8qpzh9yc.js → chunk-0v6vmemf.js} +3 -3
  3. package/dist/{chunk-4e02xmrg.js → chunk-19626hwq.js} +2 -2
  4. package/dist/{chunk-mjaf2je8.js → chunk-1jmwmc2a.js} +1 -1
  5. package/dist/{chunk-znsgvx9t.js → chunk-2q641ekp.js} +1 -1
  6. package/dist/{chunk-1dnqddk9.js → chunk-3e6q952c.js} +1 -1
  7. package/dist/{chunk-qmg1535a.js → chunk-3mp0jaa7.js} +2 -2
  8. package/dist/{chunk-bxjswrak.js → chunk-3z75j224.js} +2 -2
  9. package/dist/{chunk-nqdc6n5d.js → chunk-4nrrjn7g.js} +15 -15
  10. package/dist/{chunk-29m9mhwt.js → chunk-4sasxrdr.js} +2 -2
  11. package/dist/{chunk-ex02f2vm.js → chunk-4xvx77zs.js} +6 -6
  12. package/dist/{chunk-adhnnbe1.js → chunk-5mh2gqd4.js} +1 -1
  13. package/dist/{chunk-8hwmssy9.js → chunk-5ym0xgg0.js} +1 -1
  14. package/dist/{chunk-nf10pph8.js → chunk-6e5dyfx2.js} +2 -2
  15. package/dist/{chunk-d0dbet9n.js → chunk-6ekgn7sc.js} +3 -3
  16. package/dist/{chunk-hzybfasv.js → chunk-7ryea8wn.js} +1 -1
  17. package/dist/{chunk-r2h572w9.js → chunk-7xgwvv94.js} +1 -1
  18. package/dist/{chunk-pp9aevcb.js → chunk-90jwk3zy.js} +2 -2
  19. package/dist/{chunk-rnvqc8st.js → chunk-937czex4.js} +2 -2
  20. package/dist/{chunk-p458sykz.js → chunk-9b0jah2a.js} +1 -1
  21. package/dist/{chunk-jjdjk59m.js → chunk-9wxhpnya.js} +1 -1
  22. package/dist/{chunk-wrvgt39b.js → chunk-a04yhmwb.js} +1 -1
  23. package/dist/{chunk-h6ngkqg7.js → chunk-anr9ncep.js} +1 -1
  24. package/dist/{chunk-h5esm323.js → chunk-b6xcyrnx.js} +5 -5
  25. package/dist/{chunk-y3vhsctr.js → chunk-b7g1pyea.js} +3 -3
  26. package/dist/{chunk-rkdyetby.js → chunk-bj3r4j0a.js} +1 -1
  27. package/dist/{chunk-8dyz1cte.js → chunk-bkrftw1s.js} +3 -3
  28. package/dist/{chunk-fkngq7na.js → chunk-bsj770f8.js} +2 -2
  29. package/dist/chunk-cgqg1br8.js +5 -0
  30. package/dist/{chunk-cgz4sy6k.js → chunk-cq5zpg9c.js} +1 -1
  31. package/dist/{chunk-zerajrvv.js → chunk-cx4rq49z.js} +1 -1
  32. package/dist/{chunk-h2007n8k.js → chunk-cyzr3xat.js} +1 -1
  33. package/dist/{chunk-xs0ke3f2.js → chunk-czgjmefa.js} +3 -3
  34. package/dist/{chunk-agq858s0.js → chunk-dc0059dr.js} +1 -1
  35. package/dist/{chunk-qpahzkm0.js → chunk-dq0nmept.js} +1 -1
  36. package/dist/{chunk-gqk2s9wt.js → chunk-e29deb0h.js} +2 -2
  37. package/dist/{chunk-fn2xxavw.js → chunk-e4f5kxrh.js} +1 -1
  38. package/dist/{chunk-d27xpsa4.js → chunk-fjkswqq2.js} +1 -1
  39. package/dist/{chunk-w5m9qv5k.js → chunk-jkeqyj50.js} +1 -1
  40. package/dist/{chunk-pkdrq4sh.js → chunk-kf4sza0n.js} +1 -1
  41. package/dist/{chunk-kdz4gxdq.js → chunk-m7jndt3v.js} +4 -4
  42. package/dist/{chunk-475bjqea.js → chunk-m8w98p7p.js} +3 -3
  43. package/dist/chunk-m9b6cqn7.js +38 -0
  44. package/dist/{chunk-564pr6v4.js → chunk-n0tw6p7g.js} +1 -1
  45. package/dist/{chunk-x5bspdyq.js → chunk-p99myphf.js} +2 -2
  46. package/dist/{chunk-c87yyjv7.js → chunk-r9gdz351.js} +1 -1
  47. package/dist/chunk-sbmdk35p.js +4 -0
  48. package/dist/{chunk-atzh1g6f.js → chunk-t4cdpfrr.js} +1 -1
  49. package/dist/{chunk-4kn7y9ns.js → chunk-taa77k3y.js} +1 -1
  50. package/dist/{chunk-g4eb5tgt.js → chunk-tpjz15nc.js} +1 -1
  51. package/dist/{chunk-cgrta603.js → chunk-vekg5zy6.js} +1 -1
  52. package/dist/{chunk-0kvy1dh8.js → chunk-w60gzzxc.js} +2 -2
  53. package/dist/{chunk-zesjexqf.js → chunk-x67zh0tr.js} +1 -1
  54. package/dist/{chunk-689tfwjh.js → chunk-xph91r7p.js} +1 -1
  55. package/dist/{chunk-a8djrg2n.js → chunk-xsaw8abt.js} +2 -2
  56. package/dist/{chunk-vwn5fx4f.js → chunk-zbrj37wa.js} +1 -1
  57. package/dist/{chunk-vhna4qch.js → chunk-zpvcnc7c.js} +1 -1
  58. package/dist/src/augmentation-graph.js +1 -1
  59. package/dist/src/binding-patterns.js +1 -1
  60. package/dist/src/branded-types.js +1 -1
  61. package/dist/src/bundle-linker.js +1 -1
  62. package/dist/src/bundler.js +1 -1
  63. package/dist/src/cache.js +1 -1
  64. package/dist/src/call-signatures.js +1 -1
  65. package/dist/src/circular.js +1 -1
  66. package/dist/src/computed-keys.js +1 -1
  67. package/dist/src/config.js +1 -1
  68. package/dist/src/declaration-project.js +1 -1
  69. package/dist/src/declaration-publication.js +1 -1
  70. package/dist/src/declaration-references.d.ts +1 -1
  71. package/dist/src/declaration-references.js +1 -1
  72. package/dist/src/docs.js +1 -1
  73. package/dist/src/enum-declarations.js +1 -1
  74. package/dist/src/errors.js +1 -1
  75. package/dist/src/extractor/extract.js +1 -1
  76. package/dist/src/extractor/scanner.js +1 -1
  77. package/dist/src/extractor.js +1 -1
  78. package/dist/src/function-properties.js +1 -1
  79. package/dist/src/generator.js +1 -1
  80. package/dist/src/incremental.js +1 -1
  81. package/dist/src/index.js +1 -1
  82. package/dist/src/inferred-imports.js +1 -1
  83. package/dist/src/initializer-type-spans.js +1 -1
  84. package/dist/src/lexical.js +1 -1
  85. package/dist/src/logger.js +1 -1
  86. package/dist/src/lsp.js +1 -1
  87. package/dist/src/memory.js +1 -1
  88. package/dist/src/module-graph.js +1 -1
  89. package/dist/src/module-references.js +1 -1
  90. package/dist/src/native-checker.js +1 -1
  91. package/dist/src/native-extractor.js +1 -1
  92. package/dist/src/native-generation.js +1 -1
  93. package/dist/src/native-project.js +1 -1
  94. package/dist/src/optimizer.js +1 -1
  95. package/dist/src/parallel-processor.js +1 -1
  96. package/dist/src/parameters.js +1 -1
  97. package/dist/src/parser.js +1 -1
  98. package/dist/src/plugins/bun.js +1 -1
  99. package/dist/src/plugins/esbuild.js +1 -1
  100. package/dist/src/plugins/index.js +1 -1
  101. package/dist/src/plugins/tsdown.js +1 -1
  102. package/dist/src/plugins/tsup.js +1 -1
  103. package/dist/src/plugins/vite.js +1 -1
  104. package/dist/src/plugins/webpack.js +1 -1
  105. package/dist/src/process-source.js +1 -1
  106. package/dist/src/processor/declarations.js +1 -1
  107. package/dist/src/processor/import-usage.js +1 -1
  108. package/dist/src/processor/imports.js +1 -1
  109. package/dist/src/processor/index.js +1 -1
  110. package/dist/src/processor/type-inference.js +1 -1
  111. package/dist/src/processor.js +1 -1
  112. package/dist/src/return-type-scope.js +1 -1
  113. package/dist/src/source-cache.js +1 -1
  114. package/dist/src/sourcemap.js +1 -1
  115. package/dist/src/transformers.js +1 -1
  116. package/dist/src/utils.js +1 -1
  117. package/dist/src/value-inference.js +1 -1
  118. package/dist/src/worker-thread.js +1 -1
  119. package/dist/src/worker.js +1 -1
  120. package/dist/src/workspace.js +1 -1
  121. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  122. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  123. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  124. package/native/linux-arm64/libzig-dtsx.so +0 -0
  125. package/native/linux-x64/libzig-dtsx.so +0 -0
  126. package/native/windows-x64/zig-dtsx.dll +0 -0
  127. package/package.json +1 -1
  128. package/dist/chunk-hnw7mwcw.js +0 -3
  129. package/dist/chunk-hzjesnf1.js +0 -38
  130. package/dist/chunk-mm1cfz16.js +0 -5
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{Re}from"./chunk-p458sykz.js";import{e}from"./chunk-qmg1535a.js";import{Oe,Z}from"./chunk-29m9mhwt.js";import{existsSync as x}from"fs";import{basename as O,dirname as D,extname as S,isAbsolute as v,relative as p,resolve as m}from"path";var{Glob:R}=globalThis.Bun;async function Pe(r,o){let s=await C(r);G(r,s);let n=s.slice(),a=await(o?o():Oe(r)),t=null;if(r.autoIncludeReExports!==!1&&n.length>0){t=await Z(n,{includeImports:!0,resolveSpecifier:a});let l=m(r.cwd,r.root),u=r.exclude||[],f=[];for(let c of t.reachable){if(n.includes(c))continue;if(!b(c))continue;if(c.endsWith(".d.ts"))continue;if(c.includes("node_modules"))continue;let j=r.outputStructure==="flat"&&s.some((E)=>a.isPackageLocal?.(E,c));if(!A(c,l)&&!j){e.warn(`Skipping auto-included source outside root: ${p(r.cwd,c)}`);continue}if(oe(c,u,l))continue;f.push(c)}if(f.length>0)n=[...n,...f],e.debug(`Auto-included ${f.length} file(s) reached via relative re-exports`)}let i=F(n,r),d=t??await Z(n,{includeImports:!0,resolveSpecifier:a}),g=await Re([...d.sources.keys()],a,r.isolatedDeclarations??!1,d.sources),h=new Set(n);for(let[l,u]of g){if(!h.has(l))continue;for(let f of u){let c=a(f,l).resolved;if(c&&!h.has(c))throw Error(`Module augmentation import ${JSON.stringify(f)} from ${l} requires a source not emitted by this package build: ${c}`)}}let y=[...g].map(([l,u])=>[l,[...u].sort()]).sort(([l],[u])=>l.localeCompare(u));return Object.freeze({entryFiles:Object.freeze(s),files:Object.freeze(n),outputBySource:i,resolver:a,reachability:t,augmentationImports:g,getResolutionFingerprint:()=>JSON.stringify({resolution:a.cacheKey?.(n),augmentations:y})})}var M=50,w=new Map;function P(r){let o=w.get(r);if(!o){if(o=new R(r),w.set(r,o),w.size>M){let s=w.keys().next().value;if(s!==void 0)w.delete(s)}}return o}function oe(r,o,s){if(!o||o.length===0)return!1;let n=p(s,r);for(let a of o){let t=P(a);if(t.match(n)||t.match(r))return!0}return!1}var k=/[*?[\]{}!]/;function G(r,o){let s=m(r.cwd,r.root),n=` root: ${s}
2
+ import{Re}from"./chunk-9b0jah2a.js";import{e}from"./chunk-3mp0jaa7.js";import{Oe,Z}from"./chunk-4sasxrdr.js";import{existsSync as x}from"fs";import{basename as O,dirname as D,extname as S,isAbsolute as v,relative as p,resolve as m}from"path";var{Glob:R}=globalThis.Bun;async function De(r,o){let s=await C(r);G(r,s);let n=s.slice(),a=await(o?o():Oe(r)),t=null;if(r.autoIncludeReExports!==!1&&n.length>0){t=await Z(n,{includeImports:!0,resolveSpecifier:a});let l=m(r.cwd,r.root),u=r.exclude||[],f=[];for(let c of t.reachable){if(n.includes(c))continue;if(!b(c))continue;if(c.endsWith(".d.ts"))continue;if(c.includes("node_modules"))continue;let j=r.outputStructure==="flat"&&s.some((E)=>a.isPackageLocal?.(E,c));if(!A(c,l)&&!j){e.warn(`Skipping auto-included source outside root: ${p(r.cwd,c)}`);continue}if(oe(c,u,l))continue;f.push(c)}if(f.length>0)n=[...n,...f],e.debug(`Auto-included ${f.length} file(s) reached via relative re-exports`)}let i=F(n,r),d=t??await Z(n,{includeImports:!0,resolveSpecifier:a}),g=await Re([...d.sources.keys()],a,r.isolatedDeclarations??!1,d.sources),h=new Set(n);for(let[l,u]of g){if(!h.has(l))continue;for(let f of u){let c=a(f,l).resolved;if(c&&!h.has(c))throw Error(`Module augmentation import ${JSON.stringify(f)} from ${l} requires a source not emitted by this package build: ${c}`)}}let y=[...g].map(([l,u])=>[l,[...u].sort()]).sort(([l],[u])=>l.localeCompare(u));return Object.freeze({entryFiles:Object.freeze(s),files:Object.freeze(n),outputBySource:i,resolver:a,reachability:t,augmentationImports:g,getResolutionFingerprint:()=>JSON.stringify({resolution:a.cacheKey?.(n),augmentations:y})})}var M=50,w=new Map;function P(r){let o=w.get(r);if(!o){if(o=new R(r),w.set(r,o),w.size>M){let s=w.keys().next().value;if(s!==void 0)w.delete(s)}}return o}function oe(r,o,s){if(!o||o.length===0)return!1;let n=p(s,r);for(let a of o){let t=P(a);if(t.match(n)||t.match(r))return!0}return!1}var k=/[*?[\]{}!]/;function G(r,o){let s=m(r.cwd,r.root),n=` root: ${s}
3
3
  entrypoints: ${r.entrypoints.map((t)=>JSON.stringify(t)).join(", ")||"(none)"}
4
4
  `+(r.exclude?.length?` exclude: ${r.exclude.map((t)=>JSON.stringify(t)).join(", ")}
5
5
  `:"")+"Entrypoints are resolved relative to --root. Pass several by repeating --entrypoints or separating them with commas.";if(o.length===0){if(r.entrypoints.filter((i)=>v(i)&&x(i)&&!A(i,s)).length===r.entrypoints.length)return;throw Error(`No source files matched. Nothing was generated.
6
6
  ${n}`)}let a=r.entrypoints.filter((t)=>{if(k.test(t))return!1;return!x(v(t)?t:m(s,t))});if(a.length>0)throw Error(`Entrypoint${a.length>1?"s":""} not found: ${a.map((t)=>JSON.stringify(t)).join(", ")}
7
- ${n}`)}async function C(r){let o=[],s=m(r.cwd,r.root),n=r.exclude||[],a=[...r.entrypoints,...r.include??[]];for(let t of a)if(v(t)&&b(t)){if(!t.includes("node_modules")){if(!A(t,s)&&r.outputStructure!=="flat")e.warn(`Skipping entrypoint outside root: ${p(r.cwd,t)}`);else if(!oe(t,n,s))o.push(t)}}else{let i=new R(t);for await(let d of i.scan({cwd:s,absolute:!0,onlyFiles:!0}))if(b(d)&&!d.includes("node_modules")){if(!oe(d,n,s))o.push(d)}}return[...new Set(o.map((t)=>m(t)))].sort()}function A(r,o){let s=p(o,r);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!v(s)}function F(r,o){let s=new Map,n=new Map;for(let a of r){let t=X(a,o),i=s.get(t);if(i&&i!==a)throw Error(`Output path collision: ${p(o.cwd,i)} and ${p(o.cwd,a)} both emit ${p(o.cwd,t)}`);s.set(t,a),n.set(a,t)}return n}function b(r){return/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/.test(r)&&!/\.d\.(?:ts|mts|cts)$/.test(r)}function X(r,o){let s=m(o.cwd,o.root),n=p(s,r),a=/\.d\.(?:ts|mts|cts)$/.test(n)?n:n.replace(/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/,(t)=>{if(t===".mts"||t===".mjs")return".d.mts";if(t===".cts"||t===".cjs")return".d.cts";return".d.ts"});if(o.outputStructure==="mirror")return m(o.cwd,o.outdir,a);else{let t=O(a);return m(o.cwd,o.outdir,t)}}function ia(r,o,s=""){let n=p(D(r),o).replace(/\\/g,"/");if(n=n.replace(/\.d\.mts$/,"").replace(/\.d\.cts$/,"").replace(/\.d\.ts$/,""),s)n+=s;if(!n.startsWith("."))n=`./${n}`;return n}function De(r,o,s,n){let a=X(r,o);return(t)=>{let i=s(t,r);if(!i.isRelative||!i.resolved)return{kind:"unchanged",reason:i.isRelative?"unresolved":"external",specifier:t,emittedSpecifier:t};if(/\.d\.(?:ts|mts|cts)$/.test(i.resolved)){if(o.moduleSpecifierMode!=="node")return{kind:"unchanged",reason:"preserved-declaration",specifier:t,emittedSpecifier:t};if(n&&!n.has(i.resolved))throw Error(`Local declaration ${JSON.stringify(t)} from ${r} targets an authored declaration not emitted by this package build: ${i.resolved}. Declaration-only dependencies must be delivered with the package before this importer can be emitted.`)}if(i.isAlias&&n&&!n.has(i.resolved))throw Error(`Local alias ${JSON.stringify(t)} from ${r} targets a declaration excluded from this package build: ${i.resolved}`);if(n&&!n.has(i.resolved)&&oe(i.resolved,o.exclude??[],m(o.cwd,o.root)))throw Error(`Local reference ${JSON.stringify(t)} from ${r} targets a source excluded from this package build: ${i.resolved}`);let d=i.isAlias?i.suffix??"":t.match(/[?#].*$/)?.[0]??"",g=d?t.slice(0,-d.length):t,h=S(g),y=/^(?:\.js|\.jsx|\.mjs|\.cjs)$/.test(h)?h:"";if(!y&&o.moduleSpecifierMode==="node"){let u=S(i.resolved);y=u===".mts"||u===".mjs"?".mjs":u===".cts"||u===".cjs"?".cjs":".js"}let l=X(i.resolved,o);return{kind:"local",specifier:t,resolvedSource:i.resolved,declarationOutput:l,emittedSpecifier:ia(a,l,y)+d}}}
8
- export{Pe,oe,A,X,ia,De};
7
+ ${n}`)}async function C(r){let o=[],s=m(r.cwd,r.root),n=r.exclude||[],a=[...r.entrypoints,...r.include??[]];for(let t of a)if(v(t)&&b(t)){if(!t.includes("node_modules")){if(!A(t,s)&&r.outputStructure!=="flat")e.warn(`Skipping entrypoint outside root: ${p(r.cwd,t)}`);else if(!oe(t,n,s))o.push(t)}}else{let i=new R(t);for await(let d of i.scan({cwd:s,absolute:!0,onlyFiles:!0}))if(b(d)&&!d.includes("node_modules")){if(!oe(d,n,s))o.push(d)}}return[...new Set(o.map((t)=>m(t)))].sort()}function A(r,o){let s=p(o,r);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!v(s)}function F(r,o){let s=new Map,n=new Map;for(let a of r){let t=X(a,o),i=s.get(t);if(i&&i!==a)throw Error(`Output path collision: ${p(o.cwd,i)} and ${p(o.cwd,a)} both emit ${p(o.cwd,t)}`);s.set(t,a),n.set(a,t)}return n}function b(r){return/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/.test(r)&&!/\.d\.(?:ts|mts|cts)$/.test(r)}function X(r,o){let s=m(o.cwd,o.root),n=p(s,r),a=/\.d\.(?:ts|mts|cts)$/.test(n)?n:n.replace(/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/,(t)=>{if(t===".mts"||t===".mjs")return".d.mts";if(t===".cts"||t===".cjs")return".d.cts";return".d.ts"});if(o.outputStructure==="mirror")return m(o.cwd,o.outdir,a);else{let t=O(a);return m(o.cwd,o.outdir,t)}}function ia(r,o,s=""){let n=p(D(r),o).replace(/\\/g,"/");if(n=n.replace(/\.d\.mts$/,"").replace(/\.d\.cts$/,"").replace(/\.d\.ts$/,""),s)n+=s;if(!n.startsWith("."))n=`./${n}`;return n}function Pe(r,o,s,n){let a=X(r,o);return(t)=>{let i=s(t,r);if(!i.isRelative||!i.resolved)return{kind:"unchanged",reason:i.isRelative?"unresolved":"external",specifier:t,emittedSpecifier:t};if(/\.d\.(?:ts|mts|cts)$/.test(i.resolved)){if(o.moduleSpecifierMode!=="node")return{kind:"unchanged",reason:"preserved-declaration",specifier:t,emittedSpecifier:t};if(n&&!n.has(i.resolved))throw Error(`Local declaration ${JSON.stringify(t)} from ${r} targets an authored declaration not emitted by this package build: ${i.resolved}. Declaration-only dependencies must be delivered with the package before this importer can be emitted.`)}if(i.isAlias&&n&&!n.has(i.resolved))throw Error(`Local alias ${JSON.stringify(t)} from ${r} targets a declaration excluded from this package build: ${i.resolved}`);if(n&&!n.has(i.resolved)&&oe(i.resolved,o.exclude??[],m(o.cwd,o.root)))throw Error(`Local reference ${JSON.stringify(t)} from ${r} targets a source excluded from this package build: ${i.resolved}`);let d=i.isAlias?i.suffix??"":t.match(/[?#].*$/)?.[0]??"",g=d?t.slice(0,-d.length):t,h=S(g),y=/^(?:\.js|\.jsx|\.mjs|\.cjs)$/.test(h)?h:"";if(!y&&o.moduleSpecifierMode==="node"){let u=S(i.resolved);y=u===".mts"||u===".mjs"?".mjs":u===".cts"||u===".cjs"?".cjs":".js"}let l=X(i.resolved,o);return{kind:"local",specifier:t,resolvedSource:i.resolved,declarationOutput:l,emittedSpecifier:ia(a,l,y)+d}}}
8
+ export{De,oe,A,X,ia,Pe};
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ import{a,i,h,g,xe,Ue}from"./chunk-cgqg1br8.js";import{t,m,d,ze,b}from"./chunk-6ekgn7sc.js";import{cr}from"./chunk-cyzr3xat.js";import{Ve}from"./chunk-2q641ekp.js";import{ir}from"./chunk-r9gdz351.js";import{V,nr}from"./chunk-sbmdk35p.js";import{Hn}from"./chunk-e4f5kxrh.js";import{y,K}from"./chunk-vk5r6pgx.js";import{H}from"./chunk-fjkswqq2.js";import{_e,we,je}from"./chunk-n0tw6p7g.js";import{n,B,W,Ht,rr,Kt,z,U}from"./chunk-4nrrjn7g.js";import{Un}from"./chunk-3z75j224.js";import{x}from"./chunk-bkrftw1s.js";import{Jn}from"./chunk-zbrj37wa.js";function Oi(E,ie,Q,Y,ue=""){let le=new Map,f={start:0,end:E.length,header:0,name:"",children:[],results:new Map},ee=t(E),ge=[],S=[],Ze=[],Ye=new Map;for(let J=0;J<ee.length;J++){let he=ee[J];if(he.kind!=="punctuation")continue;let Ce=E.slice(he.start,he.end);if(Ce==="(")Ze.push(J);else if(Ce===")"){let e=Ze.pop();if(e!==void 0)Ye.set(J,e)}else if(Ce==="{")S.push(J);else if(Ce==="}"){let e=S.pop();if(e===void 0)continue;let Z=ee[e].start,se=e-1,P=se>=0?E.slice(ee[se].start,ee[se].end):"";if(P===")"){let ce=Ye.get(se);if(ce!==void 0&&ce>0&&["if","for","while","switch","catch","with"].includes(E.slice(ee[ce-1].start,ee[ce-1].end)))Z=ee[ce-1].start}else if(["else","try","finally","do"].includes(P))Z=ee[se].start;ge.push({open:ee[e].start,close:he.start,header:Z})}}let q=0,me=(J,he=new Set)=>{let Ce=new Set(he),e=t(E.slice(J.start,J.end)),Z=0;for(let de=0;de+1<e.length;de++){let Qe=E.slice(J.start+e[de].start,J.start+e[de].end);if(Qe==="{")Z++;else if(Qe==="}")Z--;else if(!Z&&["type","interface"].includes(Qe))Ce.add(E.slice(J.start+e[de+1].start,J.start+e[de+1].end))}let se="",P=J.start,ce=[...J.results].map(([de,Qe])=>({type:de,name:Qe}));for(let de of J.children.sort((Qe,ot)=>Qe.header-ot.header)){let Qe=me(de,Ce);se+=E.slice(P,de.header)+`
3
+ declare namespace ${de.name} {
4
+ ${Qe.text}
5
+ }
6
+ `,P=de.end+1;for(let ot of Qe.exports)ce.push({type:`${de.name}.${ot.name}`,name:ot.name})}se+=`${E.slice(P,J.end)}
7
+ ;
8
+ ${ce.map((de)=>`export type ${de.name} = ${de.type};`).join(`
9
+ `)}`;let Ee=F(se,ie,!1);for(let de of ce)Ce.add(de.name);let pe=ue?Vt(ue).map((de,Qe)=>[de,`${Le}_capture_${Qe}`]):[],Ke=Ee.map((de)=>ue&&["type","interface"].includes(de.kind)?Nn(de,ue,pe,Ce):(de.kind==="variable"?x(de,!1):de.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
+ `);return{declarations:Ee,text:Ke,exports:ce}},Le;return{resolve(J,he){Le??=Q();let Ce=f;for(let Z of ge.filter((se)=>se.open<he&&he<se.close).sort((se,P)=>se.open-P.open)){let se=Ce.children.find((P)=>P.start===Z.open+1);if(!se)se={start:Z.open+1,end:Z.close,header:Z.header,name:`${Le}_scope_${q++}`,children:[],results:new Map},Ce.children.push(se);Ce=se}let e=Ce.results.get(J);if(!e)e=`${Le}_result_${le.size}`,Ce.results.set(J,e),le.set(e,J);return`${Le}.${e}`},finish(J){if(!Le)return J;let he=me(f),Ce=he.declarations,e=new Set(le.keys());if(Ce.every((se)=>e.has(se.name))){let se=new Map(le),P=t(J),ce="",Ee=0;for(let pe=0;pe+2<P.length;pe++){if(J.slice(P[pe].start,P[pe].end)!==Le||J.slice(P[pe+1].start,P[pe+1].end)!==".")continue;let Ke=se.get(J.slice(P[pe+2].start,P[pe+2].end));if(!Ke)continue;ce+=J.slice(Ee,P[pe].start)+`(${Ke})`,Ee=P[pe+2].end,pe+=2}return ce+J.slice(Ee)}if(ue){let se=Vt(ue).join(", "),P=t(J),ce="",Ee=0;for(let pe=0;pe+2<P.length;pe++){if(J.slice(P[pe].start,P[pe].end)!==Le||J.slice(P[pe+1].start,P[pe+1].end)!=="."||!e.has(J.slice(P[pe+2].start,P[pe+2].end)))continue;ce+=`${J.slice(Ee,P[pe+2].end)}<${se}>`,Ee=P[pe+2].end,pe+=2}J=ce+J.slice(Ee)}let Z=he.text;return Y({kind:"module",name:Le,text:`declare namespace ${Le} {
11
+ ${Z}
12
+ }`,moduleForm:"namespace",isExported:!1}),J}}}function Vt(E){let ie=t(E),Q=[],Y=0,ue=0,le=!1;for(let f of ie){let ee=E.slice(f.start,f.end);if(ee==="<"){if(Y++,Y===1)le=!0}else if(ee===">"&&E[f.start-1]!=="=")Y--;else if(["(","[","{"].includes(ee))ue++;else if([")","]","}"].includes(ee))ue--;else if(ee===","&&Y===1&&!ue)le=!0;else if(le&&f.kind==="word"&&!["const","in","out"].includes(ee))Q.push(ee),le=!1}return Q}function Nn(E,ie,Q,Y){let ue=new Set(Vt(E.generics||"")),le=(me,Le,J)=>{let he=t(me),Ce="",e=0;for(let Z=0;Z<he.length;Z++){let se=he[Z],P=me.slice(se.start,se.end),ce=he[Z+1]&&me.slice(he[Z+1].start,he[Z+1].end),Ee=he[Z+2]&&me.slice(he[Z+2].start,he[Z+2].end),pe=he[Z-1]&&me.slice(he[Z-1].start,he[Z-1].end);if(se.kind!=="word"||ce===":"||ce==="?"&&Ee===":")continue;let Ke=!J.has(P)&&pe!=="."&&Q.find(([de])=>de===P)?.[1];if(Ke)Ce+=me.slice(e,se.start)+Ke,e=se.end;else if(Le&&Y.has(P)&&!J.has(P)){let de=Q.map(([,Qe])=>Qe).join(", ");Ce+=`${me.slice(e,se.end)}<${de}${ce==="<"?", ":">"}`,e=ce==="<"?he[++Z].end:se.end}}return Ce+me.slice(e)},f=t(E.text),ee=f.findIndex((me)=>["type","interface"].includes(E.text.slice(me.start,me.end))),ge=f[ee+1],S=E.generics||"",Ze=S?E.text.indexOf(S,ge.end)+S.length:ge.end,Ye=le(zn(ie),!1,new Set),q=S?`, ${le(S.slice(1,-1),!0,ue)}`:"";return`${E.text.slice(0,ge.end)}<${Ye}${q}>${le(E.text.slice(Ze),!0,ue)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function zn(E){let ie=E.slice(1,-1),Q=t(ie),Y=0,ue=0,le=!1,f="";for(let ee=0;ee<Q.length;ee++){let ge=Q[ee],S=ie.slice(ge.start,ge.end);if(["(","[","{","<"].includes(S))Y++;else if([")","]","}"].includes(S)||S===">"&&ie[ge.start-1]!=="=")Y--;else if(!Y&&S==="const")f+=ie.slice(ue,ge.start),ue=ge.end;else if(!Y&&S==="="&&ie.slice(Q[ee+1]?.start,Q[ee+1]?.end)!==">")f+=ie.slice(ue,ge.start),le=!0;else if(!Y&&S===","&&le)ue=ge.start,le=!1}return f+(le?"":ie.slice(ue))}var Fe=32,Ge=9,ye=10,Oe=13,te=47,ke=42,be=39,$e=34,We=96,tt=92,N=123,ne=125,ae=40,Ae=41,De=91,Me=93,Se=60,Te=62,oe=59,nt=58,Ie=61,it=44,Ct=46,Ot=63,mn=35,qn=64,jn=36;function He(E){return E===Fe||E===Ge||E===ye||E===Oe}function Cn(E){let ie=!0;for(let Q=0;Q<E.length;Q++){let Y=E.charCodeAt(Q);if(Y===Ct){if(ie)return!1;ie=!0}else if(ie){if(!a(Y))return!1;ie=!1}else if(!i(Y))return!1}return E.length>0&&!ie}function $t(E,ie,Q){let Y=ie+1;while(Y<E.length){let ue=E.charCodeAt(Y);if(ue===tt){Y+=2;continue}if(Y++,ue===Q)break}return Y}function Fn(E){if(E==="any"||E==="object"||E==="unknown")return!0;if(E.startsWith("Record<")||E.startsWith("Array<"))return!0;return E.charCodeAt(0)===N&&E.includes("[")&&E.includes("]:")}var Ut=["public","protected","private","readonly","override"];function Ba(E,ie,Q=!0,Y=!1){return Y?R(E,ie,Q):F(E,ie,Q)}function R(E,ie,Q=!0){return Qt(E,ie,Q,!0)}function F(E,ie,Q=!0,Y){return Qt(E,ie,Q,!1,!1,Y)}function jt(E,ie,Q=!0){return Qt(E,ie,Q,!0,!0)}function Qt(E,ie,Q,Y,ue=!1,le){let f=E,ee=Q,ge=Y,S=f.length,Ze=Ue(f),Ye=V(f),q=[],me=new Map,Le=new Map;function J(s,o){let r=o.kind==="interface"||o.kind==="type";if(r){let l=Le.get(s);if(l)l.push(o);else Le.set(s,[o])}let c=me.get(s);if(!r||!c||c.kind!=="variable"&&c.kind!=="function")me.set(s,o)}let he=new Map,Ce=new Set,e=0,Z,se=0,P=[],ce=[],Ee=[],pe=[],Ke;function de(s,o=!1){let r=`__dtsx_constructor_field_${pe.length}__`;Ke??=new Set(m(f).filter((c)=>c.kind==="word").map((c)=>f.slice(c.start,c.end)).filter((c)=>c.startsWith("__dtsx_constructor_field_")));while(Ke.has(r))r+="_";return pe.push({marker:r,initializer:s,classes:P.map((c)=>c.name),namespaces:[...Ee],binding:o}),r}function Qe(s){let o=/^this\.([\w$]+)$/.exec(s);if(o){let w=P.at(-1);return w?.fields.get(`${w.isStatic?"static:":""}${o[1]}`)}let r=/^([\w$]+)\s*\(/.exec(s);if(!r||!s.endsWith(")"))return;let c=t(s),l=0;for(let w=1;w<c.length;w++){let C=s.slice(c[w].start,c[w].end);if(C==="(")l++;else if(C===")"&&--l===0&&w!==c.length-1)return}let u=[...q,...me.values()].filter((w)=>w.kind==="function"&&w.name===r[1]);if(u.length!==1||u[0].generics||Ve(f,r[1])!==1)return;return u[0].returnType}function ot(s){let o=s.trim(),r=Qe(o);if(r)return r;if(!o.startsWith("class"))return;let c=t(o);if(c[0]?.kind!=="word"||o.slice(c[0].start,c[0].end)!=="class")return;let l;do l=`__dtsx_class_${se++}`;while(f.includes(l));let u=c[1],w=u?o.slice(u.start,u.end):"",C=u?.kind==="word"&&!["extends","implements"].includes(w),A=C?w:`${l}_value`,p=C?`export ${o}`:`export class ${A} ${o.slice(5)}`,k=F(p,ie,ee),O=k.find((v)=>v.kind==="class");if(!O)throw Error("Cannot extract the class expression declaration");if(t(p.slice(O.end??p.length)).some((v)=>p.slice((O.end??0)+v.start,(O.end??0)+v.end)!==";"))return;let M=k.map((v)=>v.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
+ `);return J(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
+ ${M}
15
+ }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${A}`}function xt(s,o){let r=/^this\.([\w$]+)$/.exec(s);if(r)return P.at(-1)?.fields.get(`${o?"static:":""}${r[1]}`);return ot(s)}function Jt(s){let o=he.get(s.name);if(o)o.push(s);else he.set(s.name,[s]);J(s.name,s)}if(e<S&&f.charCodeAt(e)===65279)e++;function ve(s,o){if(s<o){let r=f.charCodeAt(s),c=f.charCodeAt(o-1);if(r!==Fe&&r!==Ge&&r!==ye&&r!==Oe&&c!==Fe&&c!==Ge&&c!==ye&&c!==Oe)return f.slice(s,o)}while(s<o&&He(f.charCodeAt(s)))s++;while(o>s&&He(f.charCodeAt(o-1)))o--;return f.slice(s,o)}let Zt=/[\r\n]/g;function ft(s){return Zt.lastIndex=s,Zt.exec(f)?.index??S}function T(){if(e>=S)return;let s=f.charCodeAt(e);if(s!==Fe&&s!==Ge&&s!==ye&&s!==Oe&&s!==te)return;while(e<S){let o=f.charCodeAt(e);if(o===Fe||o===Ge||o===ye||o===Oe){e++;continue}if(o===te&&e+1<S){let r=f.charCodeAt(e+1);if(r===te){e=ft(e+2);continue}if(r===ke){let c=f.indexOf("*/",e+2);e=c===-1?S:c+2;continue}}break}}function kn(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let o=0,r=0;while(r<s.length){let c=s.charCodeAt(r);if(c===be||c===$e||c===We){r=$t(s,r,c),o=r;continue}if(c===tt){r+=2,o=Math.min(r,s.length);continue}if(c===te&&s.charCodeAt(r+1)===te){while(r<s.length&&s.charCodeAt(r)!==ye&&s.charCodeAt(r)!==Oe)r++;continue}if(c===te&&s.charCodeAt(r+1)===ke){let l=s.indexOf("*/",r+2);r=l===-1?s.length:l+2;continue}if(r++,c>32)o=r}return o<s.length?s.slice(0,o).trimEnd():s}function wn(s){let o=s.length,r=0,c=o;for(let l=0;l<o;l++){let u=s.charCodeAt(l);if(r){if(u===tt){l++;continue}if(u===r)r=0;continue}if(u===be||u===$e||u===We){r=u;continue}if(u===te&&l+1<o){let w=s.charCodeAt(l+1);if(w===te){c=l;while(c>0&&(s.charCodeAt(c-1)===Fe||s.charCodeAt(c-1)===Ge))c--;return s.slice(0,c)}if(w===ke){let C=s.indexOf("*/",l+2);if(C!==-1){s=`${s.slice(0,l)} ${s.slice(C+2)}`,l--;continue}}}}c=o;while(c>0&&(s.charCodeAt(c-1)===Fe||s.charCodeAt(c-1)===Ge||s.charCodeAt(c-1)===Oe))c--;return c<o?s.slice(0,c):s}function st(s){e++;let o=s===be?"'":'"';while(e<S){let r=f.indexOf(o,e);if(r===-1){e=S;return}let c=0,l=r-1;while(l>=0&&f.charCodeAt(l)===tt)c++,l--;if(c%2===0){e=r+1;return}e=r+1}}function At(){e++;let s=[];while(e<S){let o=f.charCodeAt(e);if(s.length===0){if(o===tt){e+=2;continue}if(o===We){e++;return}if(o===jn&&e+1<S&&f.charCodeAt(e+1)===N){e+=2,s.push(0);continue}e++;continue}if(o===be||o===$e){st(o);continue}if(o===We){At();continue}if(o===te&&e+1<S){let r=f.charCodeAt(e+1);if(r===te){e=ft(e+2);continue}if(r===ke){let c=f.indexOf("*/",e+2);e=c===-1?S:c+2;continue}if(Xt()){Yt();continue}e++;continue}if(o===N){s[s.length-1]++,e++;continue}if(o===ne){let r=s[s.length-1];if(r===0){s.pop(),e++;continue}s[s.length-1]=r-1,e++;continue}e++}}let Et=!1;function qe(){Et=!1;let s=f.charCodeAt(e);if(s===be||s===$e)return st(s),!0;if(s===We)return At(),!0;if(s===te&&e+1<S){let o=f.charCodeAt(e+1);if(o===te)return e=ft(e+2),!0;if(o===ke){let r=f.indexOf("*/",e+2);return Et=ft(e+2)<(r===-1?S:r),e=r===-1?S:r+2,!0}if(Xt())return Yt(),!0}return!1}function Xt(){return h(f,e)}function Yt(){e=g(f,e)}function Re(){let s=e;while(e<S&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function _(s){if(e+s.length>S)return!1;for(let o=0;o<s.length;o++)if(f.charCodeAt(e+o)!==s.charCodeAt(o))return!1;if(e+s.length<S&&i(f.charCodeAt(e+s.length)))return!1;return!0}function yt(s){let o=e+s;while(o<S){let r=f.charCodeAt(o);if(r===Fe||r===Ge||r===ye||r===Oe){o++;continue}return r!==Ct&&r!==Ie}return!1}function en(){if(!Et)return!1;let s=e;T();let o=e>=S||Rt()||f.charCodeAt(e)===ne;return e=s,o}function Rt(){if(e>=S)return!1;switch(f.charCodeAt(e)){case 101:return _("export")||_("enum");case 105:return _("import")||_("interface");case 102:return _("function");case 99:return _("class")||_("const");case 116:return _("type");case 108:return _("let");case 118:return _("var");case 100:return _("declare")||_("default");case 109:return _("module");case 110:return _("namespace");case 97:return _("abstract")||_("async");default:return!1}}function ht(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<S&&f.charCodeAt(e)===ye)e++;while(e<S){let c=f.charCodeAt(e);if(c===Fe||c===Ge||c===Oe||c===ye){e++;continue}if(c===te&&e+1<S){let l=f.charCodeAt(e+1);if(l===te){e=ft(e+2);continue}if(l===ke){let u=f.indexOf("*/",e+2);e=u===-1?S:u+2;continue}}break}let r=e>=S||Rt()||f.charCodeAt(e)===ne;return e=o,r}function $n(s){let o=s-1;while(o>=0){let A=f.charCodeAt(o);if(A===Fe||A===Ge||A===Oe||A===ye){o--;continue}break}if(o<0)return!0;let r=f[o];if("+-*/%=<>&|^!~?:,.([{".includes(r))return!0;let c=o;while(c>0&&f.charCodeAt(c-1)!==ye)c--;let l=f.slice(c,o+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let w=o;while(w>=0&&/[a-z]/i.test(f[w]))w--;let C=f.slice(w+1,o+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(C)}function xn(s,o){let r=f.charCodeAt(e);if(r!==ye&&r!==Oe&&!(r===te&&(f[e+1]==="/"||f[e+1]==="*")))return!1;let c=m(f),l=0,u=c.length;while(l<u){let k=l+u>>>1;if(c[k].start<e)l=k+1;else u=k}let w=c[l-1],C=c[l];if(!w||w.start<s||!/[\r\n]/.test(f.slice(e,C?.start??S)))return!1;let A=f.slice(w.start,w.end);if(w.end!==o&&w.kind==="punctuation"&&"+-*/%=<>&|^!~?:,.([{".includes(A))return!1;if(w.kind==="word"&&["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(A))return!1;if(!C)return!0;let p=f.slice(C.start,C.end);return!(".?:)]},+-*/%<>=&|^`([".includes(p)||C.kind==="literal"&&f.charCodeAt(C.start)===We||["as","satisfies","instanceof","in"].includes(p))}function tn(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;if($n(e))return!1;let o=e;e++;while(e<S){let l=f.charCodeAt(e);if(l===Fe||l===Ge||l===Oe||l===ye){e++;continue}if(l===te&&e+1<S){let u=f.charCodeAt(e+1);if(u===te){e=ft(e+2);continue}if(u===ke){let w=f.indexOf("*/",e+2);e=w===-1?S:w+2;continue}}break}let r=e<S?f[e]:"",c=r==="|"||r==="&"||r==="["||r==="."||r==="?"||r===":"||r===">"||r===")"||r===","||_("extends");return e=o,!c}function bt(){let s=f.charCodeAt(e);if(s!==ye&&s!==Oe)return!1;let o=e;if(e++,s===Oe&&e<S&&f.charCodeAt(e)===ye)e++;while(e<S){let c=f.charCodeAt(e);if(c===Fe||c===Ge||c===Oe||c===ye){e++;continue}if(c===te&&e+1<S&&f.charCodeAt(e+1)===te){e=ft(e+2);continue}break}if(e>=S)return e=o,!0;let r=f.charCodeAt(e);if(r===124||r===38||r===Ct||r===Ot||r===nt)return e=o,!1;if(_("extends")||_("keyof")||_("typeof")||_("infer")||_("is")||_("as")||_("in"))return e=o,!1;return e=o,!0}let yn=/[{}'"`\/]/g,vn=/[()'"`\/]/g,Sn=/[[\]'"`\/]/g,_n=/[<>'"`\/]/g;function Be(s,o){let r=1;e++;let c=s===N?yn:s===ae?vn:s===De?Sn:_n;c.lastIndex=e;let l;while((l=c.exec(f))!==null){let u=l.index,w=f.charCodeAt(u);if(w===be||w===$e){e=u,st(w),c.lastIndex=e;continue}if(w===We){e=u,At(),c.lastIndex=e;continue}if(w===te){if(e=u,qe()){c.lastIndex=e;continue}c.lastIndex=u+1;continue}if(w===s)r++;else if(w===o){if(o===Te&&u>0&&f.charCodeAt(u-1)===Ie){c.lastIndex=u+1;continue}if(r--,r===0)return e=u+1,e}c.lastIndex=u+1}return e=S,e}function et(){return e>0&&f.charCodeAt(e-1)===Ie}function Mt(){return e+1<S&&f.charCodeAt(e+1)===Te}let Je=/[<{};'"`\/\n\r()[\]]/g;function Ne(s=!1){let o=0,r=0,c=0,l=0,u=f.charCodeAt(e)===N;Je.lastIndex=e;let w;while((w=Je.exec(f))!==null){let C=w.index,A=f.charCodeAt(C);if(A===be||A===$e){e=C,st(A),Je.lastIndex=e;continue}if(A===We){e=C,At(),Je.lastIndex=e;continue}if(A===te){if(C>0&&f.charCodeAt(C-1)===Se){Je.lastIndex=C+1;continue}if(e=C,qe()){if(o===0&&r===0&&c===0&&l===0&&en())return;Je.lastIndex=e;continue}Je.lastIndex=C+1;continue}if(A===Se){let p=Ze(C)?.delta??null;if(p!==null)l=Math.max(0,l+p);Je.lastIndex=C+1;continue}if(A===ae){r++,Je.lastIndex=C+1;continue}if(A===Ae){r--,Je.lastIndex=C+1;continue}if(A===De){c++,Je.lastIndex=C+1;continue}if(A===Me){c--,Je.lastIndex=C+1;continue}if(A===N){o++,Je.lastIndex=C+1;continue}if(A===ne){let p=o>0;if(!p&&s&&r===0&&c===0&&l===0){e=C;return}if(p)o--;if((!p||u)&&o===0&&r===0&&c===0&&l===0){e=C+1;return}if(p&&o===0&&r===0&&c===0&&l===0){e=C+1;let k=e;T();let O=Rt();if(e=k,O)return}Je.lastIndex=C+1;continue}if(A===oe&&o===0&&r===0&&c===0&&l===0){e=C+1;return}if((A===ye||A===Oe)&&o===0&&r===0&&c===0&&l===0){if(e=C,ht())return}Je.lastIndex=C+1}e=S}function Dn(){e++;while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;let s=f.indexOf(`
16
+ `,e),o=s===-1?S:s,r=f.indexOf(";",e);if(r!==-1&&r<o){let c=r-1;while(c>=e&&(f.charCodeAt(c)===Fe||f.charCodeAt(c)===Ge))c--;let l=f.charCodeAt(e),u=f.charCodeAt(c);if(l===N&&u===ne||l===De&&u===Me||l===be&&u===be||l===$e&&u===$e||l===We&&u===We){e=r+1;return}}Ne()}function nn(){Be(N,ne);while(e<S&&He(f.charCodeAt(e)))e++;if(_("from")){e+=4;while(e<S&&He(f.charCodeAt(e)))e++;if(e<S){let s=f.charCodeAt(e);if(s===be||s===$e)st(s)}}while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++}function sn(){e++;while(e<S&&He(f.charCodeAt(e)))e++;if(_("as")){e+=2;while(e<S&&He(f.charCodeAt(e)))e++;Re();while(e<S&&He(f.charCodeAt(e)))e++}if(_("from")){e+=4;while(e<S&&He(f.charCodeAt(e)))e++;if(e<S){let s=f.charCodeAt(e);if(s===be||s===$e)st(s)}}while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++}function vt(s){let o=s.indexOf("from ");if(o===-1)return;let r=o+5;while(r<s.length&&(s.charCodeAt(r)===32||s.charCodeAt(r)===9))r++;if(r>=s.length)return;let c=s.charCodeAt(r);if(c!==39&&c!==34)return;let l=s.indexOf(s[r],r+1);if(l===-1)return;return s.slice(r+1,l)}function Xe(s){if(!ee)return;let o=s-1;while(o>=0&&He(f.charCodeAt(o)))o--;if(o<0)return;let r=[],c=!1;while(o>=0){if(o>=1&&f.charCodeAt(o)===te&&f.charCodeAt(o-1)===ke){let w=f.lastIndexOf("/*",o-2);if(w>=0){r.push(f.slice(w,o+1)),c=!0,o=w-1;while(o>=0&&He(f.charCodeAt(o)))o--;continue}break}let l=o;while(l>0&&f.charCodeAt(l-1)!==ye)l--;let u=ve(l,o+1);if(u.startsWith("//")){if(c)break;let w=[u];o=l-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--;while(o>=0){let C=o;while(C>0&&f.charCodeAt(C-1)!==ye)C--;let A=ve(C,o+1);if(A.startsWith("//")){w.push(A),o=C-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--}else if(A===""){o=C-1;while(o>=0&&(f.charCodeAt(o)===ye||f.charCodeAt(o)===Oe))o--}else break}w.reverse(),r.push(w.join(`
17
+ `));continue}break}if(r.length===0)return;return r.reverse(),r}function Tn(s){let o=s,r=!1,c=0,l;while(e<S){let I=f.charCodeAt(e);if(I===te&&(f.charCodeAt(e+1)===te||f.charCodeAt(e+1)===ke)){T();continue}if(I===oe){e++;break}if(I===N)c++;else if(I===ne&&c>0)c--;if(I===be||I===$e){if(st(I),c>0)continue;r=!0;let M=e;if(T(),f.charCodeAt(e)===Ae){let v=e+1;l=ze(f.slice(o,v)),e=l?v:M}else e=M;while(e<S&&(f.charCodeAt(e)===Fe||f.charCodeAt(e)===Ge))e++;if(e<S&&f.charCodeAt(e)===oe)e++;break}if(I===ye&&r)break;e++}let u=ve(o,e),w=b(u).find((I)=>I.category==="static-import"),C=t(u),A=l?.isTypeOnly??w?.isTypeOnly??!1,p=C[1]?.kind==="quoted",k=l?.source??w?.specifier??"",O=Xe(o);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:A,isSideEffect:p,source:k,leadingComments:O,start:o,end:e}}function Pt(){let s=e;return Be(N,ne),f.slice(s,e)}function rn(s){let o=s.indexOf("(");if(o===-1)return s;let r=s.slice(o);if(r.indexOf("=")===-1)return s;let c=!1;for(let A=0;A<r.length;A++)if(r.charCodeAt(A)===61){let k=A>0?r.charCodeAt(A-1):0,O=A+1<r.length?r.charCodeAt(A+1):0;if(k!==61&&k!==33&&k!==60&&k!==62&&O!==61&&O!==62){c=!0;break}}if(!c)return s;let l=0,u=-1;for(let A=o;A<s.length;A++){let p=s.charCodeAt(A);if(p===40)l++;else if(p===41){if(l--,l===0){u=A;break}}}if(u===-1)return s;let w=s.slice(o,u+1),C=pt(w);return s.slice(0,o)+C+s.slice(u+1)}function on(s){let o=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,r=s.split(`
18
+ `),c=[],l=[],u=[],w=!1,C=1/0;for(let k=0;k<r.length;k++){let O=r[k];if(o){if(w){if(O.includes("*/"))w=!1;continue}let I=O.trim();if(I.length===0)continue;let M=I.charCodeAt(0);if(M===te){let X=I.charCodeAt(1);if(X===te)continue;if(X===ke){if(!I.includes("*/"))w=!0;continue}}if(M===ke)continue;let v=wn(O);if(v.charCodeAt(v.length-1)===oe)v=v.slice(0,-1);v=rn(v);let D=v.trim();if(!D)continue;c.push(v),l.push(D);let G=0;while(G<v.length&&He(v.charCodeAt(G)))G++;if(D!=="{"&&D!=="}"){if(G<C)C=G}u.push(G)}else{let I=O.length;while(I>0&&(O.charCodeAt(I-1)===Fe||O.charCodeAt(I-1)===Ge||O.charCodeAt(I-1)===Oe))I--;if(I===0)continue;let M=I<O.length?O.slice(0,I):O;if(M.charCodeAt(M.length-1)===oe)M=M.slice(0,-1);M=rn(M);let v=M.trim();if(!v)continue;c.push(M),l.push(v);let D=0;while(D<M.length&&He(M.charCodeAt(D)))D++;if(v!=="{"&&v!=="}"){if(D<C)C=D}u.push(D)}}if(c.length===0)return"{}";if(C===1/0||C<=2)return c.join(`
19
+ `);let A=C-2,p=Array(c.length);for(let k=0;k<c.length;k++){let O=l[k];if(O==="{"){p[k]=O;continue}let I=u[k];if(I>C)p[k]=c[k];else if(I===C&&(O.charCodeAt(0)===ne||O.charCodeAt(0)===Me||O.charCodeAt(0)===Ae))p[k]=c[k];else{let M=Math.max(0,I-A);p[k]=" ".repeat(M)+O}}return p.join(`
20
+ `)}function rt(){if(e>=S||f.charCodeAt(e)!==Se)return"";let s=e;Be(Se,Te);let o=f.slice(s,e);if(o.includes(`
21
+ `)){let r="",c=!1;for(let l=0;l<o.length;l++){let u=o.charCodeAt(l);if(u===32||u===9||u===10||u===13){if(!c&&r.length>0)r+=" ",c=!0}else r+=o[l],c=!1}if(r.charCodeAt(1)===32)r=`<${r.slice(2)}`;if(r.charCodeAt(r.length-2)===32)r=`${r.slice(0,-2)}>`;return r}return o}function ct(){if(e>=S||f.charCodeAt(e)!==ae)return"()";let s=e;return Be(ae,Ae),f.slice(s,e)}function St(s){if(s.indexOf("/")===-1)return s;let o="",r=!1,c=0;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(r){if(o+=s[l],u===tt&&l+1<s.length){o+=s[++l];continue}if(u===c)r=!1;continue}if(u===be||u===$e||u===We){r=!0,c=u,o+=s[l];continue}if(u===te&&l+1<s.length){let w=s.charCodeAt(l+1);if(w===ke){let C=s.indexOf("*/",l+2);l=C===-1?s.length:C+1,o+=" ";continue}if(w===te){let C=s.indexOf(`
22
+ `,l+2);l=C===-1?s.length:C-1;continue}if(h(s,l)){let C=g(s,l);o+=s.slice(l,C),l=C-1;continue}}o+=s[l]}return o.trim()}function pt(s){let o=s.slice(1,-1).trim();if(!o)return"()";if(s.indexOf(`
23
+ `)===-1&&o.indexOf(":")!==-1&&o.indexOf("{")===-1&&o.indexOf("[")===-1&&o.indexOf("=")===-1&&o.indexOf("@")===-1&&o.indexOf("...")===-1){let A=0,p=0,k=0;for(let O=0;O<o.length;O++){let I=o.charCodeAt(O);if(I===ae||I===Se||I===N)k++;else if(I===Ae||I===Te||I===ne)k--;else if(k===0){if(I===nt)A++;else if(I===it)p++}}if(A>=p+1){let O=!1;for(let I=0;I<Ut.length;I++){let M=Ut[I],v=o.indexOf(M);if(v!==-1){let D=v+M.length;if((v===0||!i(o.charCodeAt(v-1)))&&(D>=o.length||!i(o.charCodeAt(D)))){O=!0;break}}}if(!O)return s}}let r=[],c=0,l=0,u=!1,w=0;for(let A=0;A<=o.length;A++){if(A===o.length){r.push(St(o.slice(c).trim()));break}let p=o.charCodeAt(A);if(u){if(p===tt){A++;continue}if(p===w)u=!1;continue}if(p===te&&A+1<o.length){let k=o.charCodeAt(A+1);if(k===ke){A+=2;while(A+1<o.length&&!(o.charCodeAt(A)===ke&&o.charCodeAt(A+1)===te))A++;A++;continue}if(k===te){while(A<o.length&&o.charCodeAt(A)!==10)A++;continue}if(h(o,A)){A=g(o,A)-1;continue}}if(p===be||p===$e||p===We){u=!0,w=p;continue}if(p===ae||p===N||p===De||p===Se)l++;else if(p===Ae||p===ne||p===Me||p===Te&&!(A>0&&o.charCodeAt(A-1)===Ie))l--;else if(p===it&&l===0)r.push(St(o.slice(c,A).trim())),c=A+1}let C=[];for(let A of r){if(!A)continue;let p=A.trim();if(p.startsWith("//")||p.startsWith("/*"))continue;let k=A;{let O=!1,I=0,M=0,v=0;for(let D=0;D<k.length-1;D++){let G=k.charCodeAt(D);if(G===ye){v=D+1;continue}if(O){if(G===tt){D++;continue}if(G===I)O=!1;continue}if(G===be||G===$e||G===We){O=!0,I=G;continue}if(G===N||G===De||G===ae||G===Se){M++;continue}if(G===ne||G===Me||G===Ae||G===Te){if(M>0)M--;continue}if(G===te&&h(k,D)){D=g(k,D)-1;continue}if(G===te&&k.charCodeAt(D+1)===te){if(M===0){k=k.slice(0,D).trimEnd();break}let X=k.indexOf(`
24
+ `,D);if(X===-1){k=k.slice(0,v).trimEnd();break}let j=k.slice(0,v),L=k.slice(X+1);k=`${j}${L}`,D=v-1}}}if(!k.trim())continue;C.push(cn(k))}return _e(`(${C.join(", ")})`)}function In(s){if(!s.startsWith("{")&&!s.startsWith("["))return s;let o="",r=0,c=0,l=!1,u=0;while(r<s.length){let w=s.charCodeAt(r);if(l){if(w===tt&&r+1<s.length){o+=s[r]+s[r+1],r+=2;continue}if(w===u)l=!1;o+=s[r],r++;continue}if(w===te&&r+1<s.length){let C=s.charCodeAt(r+1);if(C===ke){let A=r;r+=2;while(r+1<s.length&&!(s.charCodeAt(r)===ke&&s.charCodeAt(r+1)===te))r++;r=Math.min(r+2,s.length),o+=s.slice(A,r);continue}if(C===te){let A=r;while(r<s.length&&s.charCodeAt(r)!==10)r++;o+=s.slice(A,r);continue}}if(w===be||w===$e||w===We){l=!0,u=w,o+=s[r],r++;continue}if(w===N||w===De||w===ae)c++;else if(w===ne||w===Me||w===Ae)c--;if(c>=1&&w===Ie&&(r+1>=s.length||s.charCodeAt(r+1)!==Ie&&s.charCodeAt(r+1)!==Te)){while(o.length>0&&(o[o.length-1]===" "||o[o.length-1]==="\t"||o[o.length-1]===`
25
+ `))o=o.slice(0,-1);r++;let C=0;while(r<s.length){let A=s.charCodeAt(r);if(A===te){if(s.charCodeAt(r+1)===te){let p=s.indexOf(`
26
+ `,r+2);r=p===-1?s.length:p+1;continue}if(s.charCodeAt(r+1)===ke){let p=s.indexOf("*/",r+2);r=p===-1?s.length:p+2;continue}if(h(s,r)){r=g(s,r);continue}}if(A===be||A===$e||A===We){let p=A;r++;while(r<s.length){if(s.charCodeAt(r)===tt){r+=2;continue}if(s.charCodeAt(r)===p){r++;break}r++}continue}if(A===N||A===De||A===ae)C++;else if(A===ne||A===Me||A===Ae){if(C===0)break;C--}else if(A===it&&C===0)break;r++}continue}o+=s[r],r++}return o}function cn(s){let o=s.trim(),r=o.startsWith("...");if(r)o=o.slice(3).trim();while(o.startsWith("@")){let v=1;while(v<o.length&&i(o.charCodeAt(v)))v++;if(v<o.length&&o.charCodeAt(v)===ae){let D=1;v++;while(v<o.length&&D>0){if(o.charCodeAt(v)===ae)D++;else if(o.charCodeAt(v)===Ae)D--;v++}}o=o.slice(v).trim()}let c=!0;while(c){c=!1;for(let v of Ut)if(o.startsWith(v)&&o.length>v.length&&!i(o.charCodeAt(v.length))){let D=o.slice(v.length).trim();if(D.charCodeAt(0)===nt||D.charCodeAt(0)===Ot&&D.length>1&&D.charCodeAt(1)===nt)break;o=D,c=!0;break}}let l=-1,u=-1,w=0,C=!1,A=0;for(let v=0;v<o.length;v++){let D=o.charCodeAt(v);if(C){if(D===tt){v++;continue}if(D===A)C=!1;continue}if(D===te&&v+1<o.length){let G=o.charCodeAt(v+1);if(G===ke){v+=2;while(v+1<o.length&&!(o.charCodeAt(v)===ke&&o.charCodeAt(v+1)===te))v++;v++;continue}if(G===te){while(v<o.length&&o.charCodeAt(v)!==10)v++;continue}if(h(o,v)){v=g(o,v)-1;continue}}if(D===be||D===$e||D===We){C=!0,A=D;continue}if(D===ae||D===N||D===De||D===Se)w++;else if(D===Ae||D===ne||D===Me||D===Te&&!(v>0&&o.charCodeAt(v-1)===Ie))w--;else if(w===0){if(D===nt&&l===-1)l=v;else if(D===Ie&&u===-1&&(v===0||o.charCodeAt(v-1)!==Ie)&&(v+1>=o.length||o.charCodeAt(v+1)!==Ie&&o.charCodeAt(v+1)!==Te))u=v}}let p,k,O=u!==-1;if(l!==-1&&(u===-1||l<u))if(p=o.slice(0,l).trim(),u!==-1)k=o.slice(l+1,u).trim();else k=o.slice(l+1).trim();else if(u!==-1){p=o.slice(0,u).trim();let v=r?null:we(p,o.slice(u+1));if(v)return je(v,kt);k=kt(o.slice(u+1).trim())}else p=o,k="unknown";if(p=In(p),(p.startsWith("{")||p.startsWith("["))&&p.includes(`
27
+ `)){let v=p.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(v.length<=40)p=v;else p=p.split(`
28
+ `).map((G)=>{let X=G.trim();if(!X)return"";if(X==="{"||X==="}"||X==="["||X==="]"||X.startsWith("}")||X.startsWith("]"))return X;return` ${X}`}).join(`
29
+ `)}let I=p.endsWith("?")||O;if(p.endsWith("?"))p=p.slice(0,-1).trim();let M=I&&!r?"?":"";if(r)return`...${p}: ${k}`;return`${p}${M}: ${k}`}function kt(s){let o=s.trim(),r=Qe(o);if(r)return r;if(o==="true"||o==="false")return"boolean";if(y(o))return"number";if(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))return"string";if(o.startsWith("["))return"unknown[]";if(o.startsWith("{"))return"Record<string, unknown>";return z(o)??"unknown"}function Wt(s){let o=s.trim();if(o.endsWith("as const"))o=o.slice(0,-8).trim();if(o==="true"||o==="false")return o;if(y(o))return K(o);let r=On(o);if(r!==null)return r;return z(o)??"unknown"}function On(s){if(s==="")return null;if(s.charCodeAt(0)===be||s.charCodeAt(0)===$e){if($t(s,0,s.charCodeAt(0))===s.length)return s}let o=En(s,"+");if(o.length>1){let r=!1,c=!0,l=[];for(let u of o){let w=u.trim(),C=w.charCodeAt(0);if((C===be||C===$e)&&$t(w,0,C)===w.length)r=!0,l.push(Rn(w));else c=!1}if(c)return Mn(l.join(""));if(r)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function En(s,o){let r=[],c=0,l="",u=0;while(u<s.length){let w=s.charCodeAt(u);if(w===be||w===$e||w===We){let C=$t(s,u,w);l+=s.slice(u,C),u=C;continue}if(w===te&&(s.charCodeAt(u+1)===te||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===te){let p=s.indexOf(`
30
+ `,u+2),k=p===-1?s.length:p;l+=s.slice(u,k),u=k;continue}let C=s.indexOf("*/",u+2),A=C===-1?s.length:C+2;l+=s.slice(u,A),u=A;continue}if(w===ae||w===De||w===N)c++;else if(w===Ae||w===Me||w===ne)c--;if(s[u]===o&&c===0){r.push(l),l="",u++;continue}l+=s[u],u++}return r.push(l),r}function Rn(s){return s.slice(1,-1).replace(/\\(.)/g,(r,c)=>{if(c==="n")return`
31
+ `;if(c==="t")return"\t";if(c==="r")return"\r";if(c==="0")return"\x00";return c})}function Mn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function _t(s){if(s.endsWith("as const"))return null;let o=0,r=-1;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(u===be||u===$e||u===We)l=$t(s,l,u)-1;else if(u===123||u===91||u===40)o++;else if(u===125||u===93||u===41)o--;else if(o===0&&u===32&&l+4<=s.length&&s.substring(l,l+4)===" as ")r=l}if(r===-1)return null;return s.slice(r+4).trim()||null}function wt(){if(T(),e<S&&f.charCodeAt(e)===nt){let c=function(){let l=ve(s,r),u=(w)=>{let C=l.length-w.length;return C>=0&&l.endsWith(w)&&(C===0||!i(l.charCodeAt(C-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,T();let s=e,o=0,r=s;while(e<S){let l=e;if(qe()){if(f.charCodeAt(l)!==te)r=e;continue}let u=f.charCodeAt(e);if(u===ae||u===De||u===Se)o++;else if(u===Ae||u===Me||u===Te&&!et())o--;else if(u===N)if(o>0)o++;else if(c())o++;else break;else if(u===ne){if(o===0)break;o--}else if(o===0&&u===oe)break;if(o===0&&bt()&&!c())break;if(!He(u))r=e+1;e++}return ve(s,e)}return""}function at(s,o,r,c){e+=8,T();let l=e<S&&f.charCodeAt(e)===ke;if(l)e++,T();let u=Re();if(!u&&!c)return null;T();let w=rt();T();let C=ct();T();let A=wt(),p=A.length>0;if(!A)if(r&&l)A="AsyncGenerator<unknown, void, unknown>";else if(l)A="Generator<unknown, void, unknown>";else if(r)A="Promise<void>";else A="void";T();let k=!1;if(e<S&&f.charCodeAt(e)===N){k=!0;let X=e+1;if(Be(N,ne),!p&&!l){let j=f.slice(X,e-1),L=Oi(j,ie??"stdin.ts",()=>{let fe;do fe=`__dtsx_return_${se++}`;while(f.includes(fe));return fe},(fe)=>J(fe.name,{...fe,start:e,end:e}),w);A=L.finish(B(j,r,C,ot,L.resolve))}}else if(e<S&&f.charCodeAt(e)===oe)e++;let O=pt(C),v=`${o?c?"export default function ":"export declare function ":"declare function "}${u||(c?"":"default")}${w}${O}: ${A};`,D=Xe(s),G={kind:"function",name:u||"default",text:v,isExported:o,isDefault:c,isAsync:r,isGenerator:l,returnType:A,generics:w||void 0,leadingComments:D,start:s,end:e};if(k)Ce.add(G);return G}let Bt,Pn=0;function an(){Bt??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${Pn++}`;if(Bt.has(s))continue;return Bt.add(s),s}}function dt(s,o,r){e+=o.length,T();let c=[];do{if(T(),e>=S)break;let l=f.charCodeAt(e),u,w=e;if(l===N||l===De)Be(l,l===N?ne:Me),u=f.slice(w,e);let C=u?an():Re();if(!C)return Ne(),c;T();let A,p,k,O=!1;if(e<S&&f.charCodeAt(e)===nt){e++,T();let X=e,j=0;while(e<S){if(qe()){if(j===0&&en())break;continue}let L=f.charCodeAt(e);if(L===ae||L===N||L===De||L===Se)j++;else if(L===Ae||L===ne||L===Me||L===Te&&!et())j--;else if(j===0&&(L===oe||L===it))break;else if(j===0&&L===Ie&&!Mt())break;if(j===0&&(ht()||tn()))break;e++}A=ve(X,e)}if(e<S&&f.charCodeAt(e)===Ie)if(ge&&A&&(!ee||!Fn(A)))Dn();else{e++,T();let X=e;k=X;let j=0,L=0,fe;while(e<S){if(j===0&&L===0&&xn(X,fe))break;if(qe())continue;let re=f.charCodeAt(e);if(re===ae||re===N||re===De)j++;else if(re===Ae||re===ne||re===Me)j--;else if(re===Se){Z??=H(f);let Pe=j===0&&L===0?Z(e,X,fe):void 0;if(Pe?.parameters||Pe?.completeOperand||Pe&&ie!==void 0&&!/\.[jt]sx$/.test(ie)){e=Pe.end,fe=Pe.completeOperand?Pe.end:void 0;continue}let ut=L>0||f[e+1]!=="/"&&xe(f,e)?Ze(e):null;if(ut){if(L=Math.max(0,L+ut.delta),e=ut.end+1,L===0)fe=e;continue}else if(L===0){if(Pe){e=Pe.end,fe=Pe.completeOperand?Pe.end:void 0;continue}}}else if(j===0&&L===0&&(re===oe||re===it))break;e++}if(p=kn(ve(X,e)),p.endsWith(" as const")||p==="const"){if(O=!0,!A){let re=p.endsWith(" as const")?p.slice(0,-9).trim():p,Pe=Wt(re);A=Pe!=="unknown"?Pe:void 0}}else if(!A){let re=U(p)??_t(p)??ot(p);if(re)A=re}}let I=c.length===0?Xe(s):void 0,M=u?"const":o,v=u?!1:r,D=`${v?"export ":""}declare ${M} ${C}: ${A||"unknown"};`,G={kind:"variable",name:C,text:D,isExported:v,typeAnnotation:A,value:p,initializerStart:k,modifiers:O?[M,"const assertion"]:[M],leadingComments:u?void 0:I,start:s,end:e};if(u)c.push(...cr({pattern:u,patternOffset:w,root:G,kind:o,exported:r,comments:I,allocateName:an}));else c.push(G);if(f.charCodeAt(e)===it){e++;continue}if(f.charCodeAt(e)===oe)e++;break}while(e<S);return c}function Lt(s,o){e+=9,T();let r=Re();T();let c=rt();T();let l="";if(_("extends")){e+=7,T();let p=e,k=0;while(e<S){if(qe())continue;let O=f.charCodeAt(e);if(O===Se)k++;else if(O===Te&&!et())k--;else if(O===N&&k===0)break;e++}l=ve(p,e)}T();let u=e<S&&f.charCodeAt(e)===N?Pt():"{}",w=on(u),C=`${o?"export ":""}declare interface ${r}${c}${l?` extends ${l}`:""} ${w}`,A=Xe(s);return{kind:"interface",name:r,text:C,isExported:o,extends:l||void 0,generics:c||void 0,leadingComments:A,start:s,end:e}}function Nt(s,o){e+=4,T();let r=Re();T();let c=rt();if(T(),e<S&&f.charCodeAt(e)===Ie)e++;T();let l=e,u=0;while(e<S){if(qe())continue;let p=f.charCodeAt(e);if(p===ae||p===N||p===De||p===Se)u++;else if(p===Ae||p===ne||p===Me||p===Te&&!et())u--;else if(u===0&&p===oe)break;if(u===0&&(ht()||tn()))break;e++}let w=ve(l,e);if(e<S&&f.charCodeAt(e)===oe)e++;let C=`${o?"export ":""}type ${r}${c} = ${w}`,A=Xe(s);return{kind:"type",name:r,text:C,isExported:o,generics:c||void 0,leadingComments:A,start:s,end:e}}function gt(s,o,r){e+=4,T();let c=Re();T();let l=e;if(e<S&&f.charCodeAt(e)===N)Be(N,ne);let u=ve(s,e),w=Xe(s);return{kind:"enum",name:c,text:u,isExported:o,modifiers:r?["const"]:void 0,leadingComments:w,start:s,end:e}}function lt(s,o,r,c=!1){e+=5,T();let l=Re()||"AnonymousClass";T();let u=rt();T();let w="";if(_("extends")){e+=7,T();let I=e,M=0;while(e<S){if(qe())continue;let v=f.charCodeAt(e);if(v===Se)M++;else if(v===Te&&!et())M--;else if(M===0&&(v===N||_("implements")))break;e++}w=ve(I,e)}let C;if(_("implements")){e+=10,T();let I=e,M=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===Se)M++;else if(D===Te&&!et())M--;else if(M===0&&D===N)break;e++}let v=ve(I,e);if(v)C=v.split(",").map((D)=>D.trim())}T();let A=qt(l),k=`${o?c?"export default ":"export declare ":"declare "}${r?"abstract ":""}class ${l}${u}${w?` extends ${w}`:""}${C&&C.length>0?` implements ${C.join(", ")}`:""} ${A}`,O=Xe(s);return{kind:"class",name:l,text:k,isExported:o,isDefault:c,extends:w||void 0,implements:C,generics:u||void 0,modifiers:r?["abstract"]:void 0,leadingComments:O,start:s,end:e}}let zt;function qt(s){if(e>=S||f.charCodeAt(e)!==N)return"{}";e++;let o={name:s,fields:new Map,pending:[],isStatic:!1};P.push(o);let r=[],c=new Set;while(e<S){if(T(),e>=S)break;if(f.charCodeAt(e)===ne){e++;break}if(f.charCodeAt(e)===oe){e++;continue}if(zt=Xe(e),_("static")&&Tt("static")===N){e+=6,T(),Be(N,ne);continue}let l=!1,u=!1,w=!1,C=!1,A=!1,p=!1,k=!1,O=!1,I=!0;while(I){T();let j=e,L=Re();if(e=j,L){let fe=Tt(L);if(fe===ae||fe===Se||fe===Ot||fe===33||fe===nt||fe===Ie||fe===oe||fe===ne)break}if(_("private")){l=!0,e+=7;continue}if(_("protected")){u=!0,e+=9;continue}if(_("public")){e+=6;continue}if(_("static")){w=!0,e+=6;continue}if(_("abstract")){C=!0,e+=8;continue}if(_("readonly")){A=!0,e+=8;continue}if(_("override")){p=!0,e+=8;continue}if(_("accessor")){k=!0,e+=8;continue}if(_("async")){O=!0,e+=5;continue}if(_("declare")){e+=7;continue}break}if(T(),e>=S||f.charCodeAt(e)===ne)break;let M=e;if(o.isStatic=w,(_("get")||_("set"))&&Ft(Tt(f.slice(e,e+3))))e+=3,T();if(f.charCodeAt(e)===ke)e++,T();let v=Dt();e=M;let D=v.startsWith("#");if(D)l=!0;if(l&&v&&v!=="constructor"){let j=D?w?" static #private_static;":" #private;":` private ${w?"static ":""}${v};`,fe=v[0]==="'"||v[0]==='"'?d(v)??v:v,re=D?`${w?"static":"instance"}#`:`${w?"static:":"instance:"}${fe}`;if(!c.has(re))c.add(re),r.push(j)}let G=l?[]:r,X=" ";if(u)X+="protected ";if(w)X+="static ";if(C)X+="abstract ";if(A)X+="readonly ";if(_("constructor")){e+=11,T();let j=ct();if(T(),Bn(j,r),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let L=pt(j);r.push(l?" private constructor();":` ${u?"protected ":""}constructor${L};`)}else if(_("get"))if(e+=3,T(),e<S&&Ft(f.charCodeAt(e))){let j=Dt();if(j.startsWith("#")){if(T(),e<S&&f.charCodeAt(e)===ae)ct();if(T(),wt(),T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;continue}T(),ct(),T();let L=wt(),fe;if(T(),e<S&&f.charCodeAt(e)===N){let Pe=e+1;if(Be(N,ne),!L&&!ge)fe=f.slice(Pe,e-1),L=B(fe,!1,"()",(ut)=>xt(ut,w))}else if(e<S&&f.charCodeAt(e)===oe)e++;let re=G.length;if(G.push(`${X}get ${j}(): ${fe?W(L):L||"unknown"};`),fe)o.pending.push(()=>{let Pe=B(fe,!1,"()",(ut)=>xt(ut,w));G[re]=`${X}get ${j}(): ${W(Pe)};`})}else fn("get",X,w,A,O,G);else if(_("set"))if(e+=3,T(),e<S&&Ft(f.charCodeAt(e))){let j=Dt();if(j.startsWith("#")){if(T(),e<S&&f.charCodeAt(e)===ae)ct();if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;continue}T();let L=ct();if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let fe=pt(L);G.push(`${X}set ${j}${fe};`)}else fn("set",X,w,A,O,G);else{let j=f.charCodeAt(e)===ke;if(j)e++,T();let L=Dt();if(!L){ln();continue}dn(L,X,w,A,j,C,O,G)}}for(let l of o.pending)l();return P.pop(),`{
32
+ ${r.join(`
33
+ `)}
34
+ }`}function Ft(s){return a(s)||s===De||s===mn||s===be||s===$e}function Dt(){if(e>=S)return"";let s=f.charCodeAt(e);if(s===De){let o=e;return Be(De,Me),f.slice(o,e)}if(s===mn)return e++,`#${Re()}`;if(s===be||s===$e){let o=e;return st(s),f.slice(o,e)}return Re()}function Tt(s){let o=e;e+=s.length,T();let r=e<S?f.charCodeAt(e):0;return e=o,r}function ln(){let s=0;while(e<S){if(qe())continue;let o=f.charCodeAt(e);if(o===N||o===ae)s++;else if(o===ne||o===Ae){if(s===0)return;s--}else if(o===oe&&s===0){e++;return}if(s===0&&bt())return;e++}}function fn(s,o,r,c,l,u){dn(s,o,r,c,!1,!1,l,u)}function dn(s,o,r,c,l,u,w,C){let A=zt;if(zt=void 0,T(),e>=S)return;let p=f.charCodeAt(e),k=!1;if(p===Ot)k=!0,e++,T();if(e<S&&f.charCodeAt(e)===33)e++,T();let O=e<S?f.charCodeAt(e):0;if(O===ae||O===Se){let I=O===Se?rt():"";T();let M=ct();T();let v=wt(),D,G=v.length>0;if(!v)if(w&&l)v="AsyncGenerator<unknown, void, unknown>";else if(l)v="Generator<unknown, void, unknown>";else if(w)v="Promise<void>";else v="void";if(T(),e<S&&f.charCodeAt(e)===N){let fe=e+1;if(Be(N,ne),!G&&!l)D=f.slice(fe,e-1),v=B(D,w,M,(re)=>xt(re,r))}else if(e<S&&f.charCodeAt(e)===oe)e++;let X=pt(M),j=k?"?":"",L=C.length;if(C.push(`${o}${s}${j}${I}${X}: ${D?W(v):v};`),D)P.at(-1)?.pending.push(()=>{let fe=B(D,w,M,(re)=>xt(re,r));C[L]=`${o}${s}${j}${I}${X}: ${W(fe)};`})}else if(O===nt||O===Ie||O===oe||O===ne||O===ye||O===Oe){let I="";if(O===nt){e++,T();let X=e,j=0;while(e<S){if(qe())continue;let L=f.charCodeAt(e);if(L===ae||L===N||L===De||L===Se)j++;else if(L===Ae||L===ne||L===Me||L===Te&&!et()){if(j===0)break;j--}else if(j===0&&(L===oe||L===it))break;else if(j===0&&L===Ie&&!Mt())break;if(j===0&&bt())break;e++}I=ve(X,e)}let M="";if(e<S&&f.charCodeAt(e)===Ie)if(ge&&I){e++;let X=0;while(e<S){if(qe())continue;let j=f.charCodeAt(e);if(j===ae||j===N||j===De)X++;else if(j===Ae||j===ne||j===Me){if(X===0&&j===ne)break;X--}else if(X===0&&j===oe)break;if(X===0&&bt())break;e++}}else{e++,T();let X=e,j=0;while(e<S){if(qe())continue;let L=f.charCodeAt(e);if(L===ae||L===N||L===De)j++;else if(L===Ae||L===ne||L===Me){if(j===0&&L===ne)break;j--}else if(j===0&&L===oe)break;if(j===0&&bt())break;e++}M=ve(X,e)}if(e<S&&f.charCodeAt(e)===oe)e++;let v=I.length>0;if(!I)if(M){let X=_t(M);if(X)I=X;else if(M.startsWith("new "))I=de(M);else if(I=M.endsWith("as const")||r&&c?Wt(M):kt(M),I==="unknown"&&Cn(M)&&!M.includes("."))I=de(M,!0)}else I="unknown";let D=k?"?":"";P.at(-1)?.fields.set(`${r?"static:":""}${s}`,k?`(${I}) | undefined`:I);let G=ee&&!v&&M?Kt(A,M,I):"";C.push(`${G}${o}${s}${D}: ${I};`)}else ln()}function Wn(s){let o=0;for(let r=0;r<s.length;r++){let c=s.charCodeAt(r);if(c===ae||c===N||c===De||c===Se)o++;else if(c===Ae||c===ne||c===Me||c===Te&&s.charCodeAt(r-1)!==Ie)o--;else if(c===Ie&&o===0&&s.charCodeAt(r+1)!==Te&&s.charCodeAt(r+1)!==Ie)return!0}return!1}function Bn(s,o){let r=s.slice(1,-1).trim();if(!r)return;let c=[],l=0,u=0,w=!1,C=0,A=[];for(let p=0;p<=r.length;p++){if(p===r.length){A.push(r.slice(l)),c.push(St(r.slice(l).trim()));break}let k=r.charCodeAt(p);if(w){if(k===tt){p++;continue}if(k===C)w=!1;continue}if(k===te&&p+1<r.length){let O=r.charCodeAt(p+1);if(O===ke){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===ke&&r.charCodeAt(p+1)===te))p++;p++;continue}if(O===te){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(k===be||k===$e||k===We){w=!0,C=k;continue}if(k===ae||k===N||k===De||k===Se)u++;else if(k===Ae||k===ne||k===Me||k===Te&&!(p>0&&r.charCodeAt(p-1)===Ie))u--;else if(k===it&&u===0)A.push(r.slice(l,p)),c.push(St(r.slice(l,p).trim())),l=p+1}for(let[p,k]of c.entries()){let O=k.startsWith("public ")||k.startsWith("public\t"),I=k.startsWith("protected ")||k.startsWith("protected\t"),M=k.startsWith("private ")||k.startsWith("private\t"),v=k.includes("readonly ");if(!O&&!I&&!M&&!v)continue;let D=k,G=[];if(M){let re=7;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("private")}if(O){let re=6;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("public")}if(I){let re=9;while(re<D.length&&He(D.charCodeAt(re)))re++;D=D.slice(re),G.push("protected")}if(v){let re=D.indexOf("readonly ");if(re!==-1){let Pe=re+8;while(Pe<D.length&&He(D.charCodeAt(Pe)))Pe++;D=D.slice(0,re)+D.slice(Pe)}G.push("readonly")}let X=G.length>0?`${G.join(" ")} `:"",j=cn(D),L=D.search(/[?:=]/);if(L!==-1&&D.charCodeAt(L)!==63&&Wn(D))j=j.replace(/^([\w$]+)\?:/,"$1:");let fe="";if(ee&&!M&&L!==-1&&D.charCodeAt(L)===Ie){let re=D.slice(L+1);fe=Kt(rr(A[p]),re,kt(re))}o.push(M?` private ${j.split(/[?:]/,1)[0]};`:`${fe} ${X}${j};`)}}function Gt(s=" ",o="",r=!1){if(e>=S||f.charCodeAt(e)!==N)return"{}";e++;let c=Ee.at(-1)?.path,l={path:c?`${c}.${o}`:o,bindings:new Map,exports:new Set,annotatedValues:new Set,ambient:r||Ee.at(-1)?.ambient===!0};ce.push(l),Ee.push(l);let u=[];while(e<S){if(T(),e>=S)break;if(f.charCodeAt(e)===ne){e++;break}if(f.charCodeAt(e)===oe){e++;continue}let w=!1;if(_("export"))w=!0,e+=6,T();let C=!1;if(_("declare"))C=!0,e+=7,T();let A=w?"export ":"";if(_("function")||_("async")&&Ln("async","function")){let p=!1;if(_("async"))p=!0,e+=5,T();if(e+=8,T(),e<S&&f.charCodeAt(e)===ke)e++,T();let O=Re();T();let I=rt();T();let M=ct();T();let v=wt();if(!v)v=p?"Promise<void>":"void";if(T(),e<S&&f.charCodeAt(e)===N)Be(N,ne);else if(e<S&&f.charCodeAt(e)===oe)e++;let D=pt(M);u.push(`${s}${A}function ${O}${I}${D}: ${v};`)}else if(_("const")||_("let")||_("var")){let p=_("const")?"const":_("let")?"let":"var";e+=p.length,T();let k=Re();if(l.bindings.set(k,"value"),w||l.ambient)l.exports.add(k);if(!k){Ne(!0);continue}T();let O="";if(e<S&&f.charCodeAt(e)===nt){e++,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===ae||D===N||D===De||D===Se)v++;else if(D===ne&&v===0)break;else if(D===Ae||D===ne||D===Me||D===Te&&!et())v--;else if(v===0&&(D===oe||D===it))break;else if(v===0&&D===Ie&&!Mt())break;if(v===0&&ht())break;e++}O=ve(M,e)}if(O)l.annotatedValues.add(k);let I="";if(e<S&&f.charCodeAt(e)===Ie){e++,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===ae||D===N||D===De||D===Se)v++;else if(D===ne&&v===0)break;else if(D===Ae||D===ne||D===Me||D===Te&&!et())v--;else if(v===0&&(D===oe||D===it))break;if(v===0&&ht())break;e++}I=ve(M,e)}if(e<S&&f.charCodeAt(e)===oe)e++;if(!O&&I){let M=_t(I);if(M)O=M;else if(p==="const")O=Wt(I);else O=kt(I)}if(!O)O="unknown";u.push(`${s}${A}${p} ${k}: ${O};`)}else if(_("interface")){e+=9,T();let p=Re();T();let k=rt();T();let O="";if(_("extends")){e+=7,T();let M=e,v=0;while(e<S){if(qe())continue;let D=f.charCodeAt(e);if(D===Se)v++;else if(D===Te&&!et())v--;else if(D===N&&v===0)break;e++}O=ve(M,e)}let I=on(Pt());u.push(`${s}${A}interface ${p}${k}${O?` extends ${O}`:""} ${I}`)}else if(_("type")){e+=4,T();let p=Re();T();let k=rt();if(T(),e<S&&f.charCodeAt(e)===Ie){e++,T();let O=e,I=0;while(e<S){if(qe())continue;let v=f.charCodeAt(e);if(v===ae||v===N||v===De||v===Se)I++;else if(v===ne&&I===0)break;else if(v===Ae||v===ne||v===Me||v===Te&&!et())I--;else if(I===0&&v===oe)break;if(I===0&&ht())break;e++}let M=ve(O,e);if(e<S&&f.charCodeAt(e)===oe)e++;u.push(`${s}${A}type ${p}${k} = ${M}`)}}else if(_("class")){e+=5,T();let p=Re();T();let k=rt();T();let O=e,I=0;while(e<S){if(qe())continue;let G=f.charCodeAt(e);if(G===Se)I++;else if(G===Te&&!et())I--;else if(G===N&&I===0)break;e++}let M=ve(O,e),v=M?` ${M}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let D=qt(p);u.push(`${s}${A}class ${p}${k}${v} ${D}`)}else if(_("enum")){e+=4,T();let p=Re();T();let k=Pt();u.push(`${s}${A}enum ${p} ${k}`)}else if(_("namespace")||_("module")){let p=_("namespace")?"namespace":"module";e+=p.length,T();let k=Re();if(!l.bindings.has(k))l.bindings.set(k,"namespace");if(w||l.ambient)l.exports.add(k);T();let O=Gt(s,k,C);u.push(`${s}${A}${p} ${k} ${O}`)}else if(_("abstract"))if(e+=8,T(),_("class")){e+=5,T();let p=Re();T();let k=rt();T();let O=e,I=0;while(e<S){if(qe())continue;let G=f.charCodeAt(e);if(G===Se)I++;else if(G===Te&&!et())I--;else if(G===N&&I===0)break;e++}let M=ve(O,e),v=M?` ${M}`:"";if(l.bindings.set(p,"class"),w||l.ambient)l.exports.add(p);let D=qt(p);u.push(`${s}${A}abstract class ${p}${k}${v} ${D}`)}else Ne(!0);else if(w&&_("default")){e+=7,T();let p=e;Ne(!0);let k=ve(p,e);if(k.charCodeAt(k.length-1)===oe)k=k.slice(0,-1);if(k)u.push(`${s}export default ${k};`)}else if(!w&&(f.charCodeAt(e)===be||f.charCodeAt(e)===$e||f.charCodeAt(e)===We))Ne(!0);else Ne(!0)}if(Ee.pop(),u.length===0)return"{}";return`{
35
+ ${u.join(`
36
+ `)}
37
+ }`}function Ln(s,o){let r=e+s.length;while(r<S&&He(f.charCodeAt(r)))r++;for(let c=0;c<o.length;c++)if(r+c>=S||f.charCodeAt(r+c)!==o.charCodeAt(c))return!1;return r+o.length>=S||!i(f.charCodeAt(r+o.length))}function mt(s,o,r){e+=r.length,T();let c="",l=f.charCodeAt(e);if(l===be||l===$e){let I=e;st(l),c=f.slice(I,e)}else{c=Re();while(e<S&&f.charCodeAt(e)===Ct)e++,c+=`.${Re()}`}T();let u=t(f.slice(s,e)),w=u.findIndex((I)=>I.kind==="word"&&["namespace","module"].includes(f.slice(s+I.start,s+I.end))),C=u.slice(0,w).some((I)=>I.kind==="word"&&f.slice(s+I.start,s+I.end)==="declare"),A=e<S&&f.charCodeAt(e)===N?Gt(" ",c,C):"{}",p=`${o?"export ":""}declare ${r} ${c} ${A}`,k=Xe(s),O=c.startsWith("'")||c.startsWith('"');return{kind:"module",name:c,text:p,isExported:o,moduleForm:O?"quoted":r==="namespace"?"namespace":"identifier",source:O?c.slice(1,-1):void 0,leadingComments:k,start:s,end:e}}function un(s,o){Ne();let r=ve(o,e);if(r.charCodeAt(r.length-1)===oe)r=r.slice(0,-1).trimEnd();if(!r)return;let c=a(r.charCodeAt(0));for(let k=1;c&&k<r.length;k++)c=i(r.charCodeAt(k));let l=Xe(s);if(c){q.push({kind:"export",name:"default",text:`export default ${r};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e});return}let u="__dtsx_default_export__",w=1;while(f.includes(u))u=`__dtsx_default_export_${w++}__`;let A=_t(r)||ot(r)||n(r,!1),p=A==="unknown"&&Cn(r)?`typeof ${r}`:A;q.push({kind:"variable",name:u,text:`declare const ${u}: ${p};`,isExported:!1,typeAnnotation:p,modifiers:["const"],start:s,end:e}),q.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function hn(){if(f.charCodeAt(e)===N)return Be(N,ne),!0;let s=_("if"),o=_("do"),r=_("try"),c=_("for");if(!s&&!o&&!r&&!c&&!_("while")&&!_("switch")&&!_("with"))return!1;if(Re(),T(),c&&_("await"))e+=5,T();if(!o&&!r&&f.charCodeAt(e)===ae)Be(ae,Ae);if(It(),T(),s&&_("else"))e+=4,It();else if(o&&_("while")){if(e+=5,T(),f.charCodeAt(e)===ae)Be(ae,Ae);if(T(),f.charCodeAt(e)===oe)e++}else if(r){if(_("catch")){if(e+=5,T(),f.charCodeAt(e)===ae)Be(ae,Ae);It(),T()}if(_("finally"))e+=7,It()}return!0}function It(){if(T(),!hn())Ne()}while(e<S){if(T(),e>=S)break;if(hn())continue;let s=e,o=f.charCodeAt(e);if(o===105&&_("import"))q.push(Tn(s));else if(o===101&&_("export")){e+=6,T();let r=f.charCodeAt(e);if(r===100&&_("default")){e+=7,T();let c=e,l=f.charCodeAt(e);if(l===102&&_("function")){let u=at(s,!0,!1,!0);if(u)q.push(u)}else if(l===97&&_("async")&&Tt("async")!==oe)if(e+=5,T(),_("function")){let u=at(s,!0,!0,!0);if(u)q.push(u)}else un(s,c);else if(l===99&&_("class")){let u=lt(s,!0,!1,!0);q.push(u)}else if(l===97&&_("abstract")){if(e+=8,T(),_("class")){let u=lt(s,!0,!0,!0);q.push(u)}}else un(s,c)}else if(r===116&&_("type")){let c=e;if(e+=4,T(),e<S&&f.charCodeAt(e)===N){nn();let l=ve(s,e),u=Xe(s);q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:vt(l),leadingComments:u,start:s,end:e})}else if(e<S&&f.charCodeAt(e)===ke){sn();let l=ve(s,e);q.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:vt(l),start:s,end:e})}else{e=c;let l=Nt(s,!0);q.push(l)}}else if(r===105&&_("interface")){let c=Lt(s,!0);q.push(c)}else if(r===102&&_("function")){let c=at(s,!0,!1,!1);if(c)q.push(c)}else if(r===97&&_("async"))if(e+=5,T(),_("function")){let c=at(s,!0,!0,!1);if(c)q.push(c)}else Ne();else if(r===99)if(_("class")){let c=lt(s,!0,!1);q.push(c)}else if(_("const")){let c=e;if(e+=5,T(),_("enum")){e=c+5,T();let l=gt(s,!0,!0);q.push(l)}else{e=c;let l=dt(s,"const",!0);for(let u=0;u<l.length;u++)q.push(l[u])}}else Ne();else if(r===97&&_("abstract")){if(e+=8,T(),_("class")){let c=lt(s,!0,!0);q.push(c)}}else if(r===108&&_("let")){let c=dt(s,"let",!0);for(let l=0;l<c.length;l++)q.push(c[l])}else if(r===118&&_("var")){let c=dt(s,"var",!0);for(let l=0;l<c.length;l++)q.push(c[l])}else if(r===101&&_("enum")){let c=gt(s,!0,!1);q.push(c)}else if(r===100&&_("declare"))e+=7,T(),gn(s,!0);else if(r===110&&_("namespace")&&yt(9)){let c=mt(s,!0,"namespace");q.push(c)}else if(r===109&&_("module")&&yt(6)){let c=mt(s,!0,"module");q.push(c)}else if(r===N){nn();let c=ve(s,e),l=c.includes("export type"),u=Xe(s);q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:l,source:vt(c),leadingComments:u,start:s,end:e})}else if(r===ke){sn();let c=ve(s,e),l=Xe(s);q.push({kind:"export",name:"",text:c,isExported:!0,isTypeOnly:!1,source:vt(c),leadingComments:l,start:s,end:e})}else{Ne();let c=ve(s,e);if(c)q.push({kind:"export",name:"",text:c,isExported:!0,start:s,end:e})}}else if(o===100&&_("declare"))e+=7,T(),gn(s,!1);else if(o===105&&_("interface")){let r=Lt(s,!1);J(r.name,r)}else if(o===116&&_("type")){let r=Nt(s,!1);J(r.name,r),q.push(r)}else if(o===102&&_("function")){let r=at(s,!1,!1,!1);if(r)Jt(r);else Ne()}else if(o===97)if(_("async")){let r=e;if(e+=5,T(),_("function")){let c=at(s,!1,!0,!1);if(c)Jt(c);else e=r,Ne()}else e=r,Ne()}else if(_("abstract"))if(e+=8,T(),_("class")){let r=lt(s,!1,!1);J(r.name,r),q.push(r)}else Ne();else e++,Ne();else if(o===99)if(_("class")){let r=lt(s,!1,!1);J(r.name,r),q.push(r)}else if(_("const")){let r=e;if(e+=5,T(),_("enum")){e=r+5,T();let c=gt(s,!1,!0);J(c.name,c),q.push(c)}else{e=r;let c=dt(s,"const",!1);for(let l=0;l<c.length;l++)J(c[l].name,c[l])}}else e++,Ne();else if(o===101&&_("enum")){let r=gt(s,!1,!1);J(r.name,r),q.push(r)}else if(o===108&&_("let")||o===118&&_("var")){let r=_("let")?"let":"var",c=dt(s,r,!1);for(let l=0;l<c.length;l++)J(c[l].name,c[l])}else if(o===109&&_("module")&&yt(6)){let r=mt(s,!1,"module");q.push(r)}else if(o===110&&_("namespace")&&yt(9)){let r=mt(s,!1,"namespace");q.push(r)}else{let r=f.charCodeAt(e);if(r===oe)e++;else if(r===be||r===$e){if(st(r),e<S&&f.charCodeAt(e)===oe)e++}else if(r===We){if(At(),e<S&&f.charCodeAt(e)===oe)e++}else if(r===qn){if(e++,Re(),T(),e<S&&f.charCodeAt(e)===Ct)e++,Re(),T();if(e<S&&f.charCodeAt(e)===ae)Be(ae,Ae)}else e++,Ne()}}if(pe.length){let s=new Set([...q,...me.values()]),o=new Set([...s].filter((C)=>C.kind==="class").map((C)=>C.name)),r=new Set([...s].filter((C)=>C.kind==="variable"&&!!C.typeAnnotation).map((C)=>C.name)),c=new Set,l=new Map;for(let C of ce)for(let[A,p]of C.bindings){let k=C.path?`${C.path}.${A}`:A;if(C.exports.has(A)&&(p!=="namespace"||!l.has(k)))l.set(k,p);if(C.exports.has(A)&&C.annotatedValues.has(A))c.add(k)}let u=new Map;for(let C of pe){if(C.binding){let A=r.has(C.initializer);for(let p=C.namespaces.length-1;p>=0;p--){let k=C.namespaces[p],O=k.path?`${k.path}.${C.initializer}`:C.initializer;if(k.bindings.has(C.initializer)||l.has(O)){A=k.bindings.has(C.initializer)?k.annotatedValues.has(C.initializer):c.has(O);break}}u.set(C.marker,A?`typeof ${C.initializer}`:"unknown");continue}u.set(C.marker,Ht(C.initializer,(A)=>{if(C.classes.includes(A))return!0;for(let p=C.namespaces.length-1;p>=0;p--){let k=C.namespaces[p],O=k.path?`${k.path}.${A}`:A,I=A.split(".")[0],M=k.bindings.get(I);if(M){if(A===I&&M!=="namespace")return M==="class";return l.get(O)==="class"}let v=k.path?`${k.path}.${I}`:I;if(l.has(v))return l.get(O)==="class"}return l.has(A)?l.get(A)==="class":o.has(A)}))}let w=(C)=>{if(!C.includes("__dtsx_constructor_field_"))return C;let A="",p=0;for(let k of t(C)){if(k.kind!=="word")continue;let O=u.get(C.slice(k.start,k.end));if(!O)continue;A+=C.slice(p,k.start)+O,p=k.end}return A+C.slice(p)};for(let C of s){C.text=w(C.text);for(let A of["typeAnnotation","inferredType","returnType"])if(C[A])C[A]=w(C[A])}}if(Ce.size>0){pn(q);for(let s of he.values())pn(s)}if(Un(f,q,me,he),Hn(q,me),ir(q,me),!ge)Jn(f,q,me,le);if(ue){let s=new Set(q);for(let o of[...me.values(),...[...he.values()].flat(),...[...Le.values()].flat()])if(!s.has(o))q.push(o),s.add(o);return q.sort((o,r)=>(o.start??0)-(r.start??0))}if(me.size>0)Gn(q,me,he,Le,Ye);return q;function pn(s){let o=new Map;for(let c of s)if(c.kind==="function")o.set(c.name,(o.get(c.name)||0)+1);let r=new Set;for(let[c,l]of o)if(l>1)r.add(c);if(r.size>0){let c=new Set;for(let l of r)for(let u=s.length-1;u>=0;u--)if(s[u].kind==="function"&&s[u].name===l&&Ce.has(s[u])){c.add(u);break}if(c.size>0){let l=[...c].sort((u,w)=>w-u);for(let u of l)s.splice(u,1)}}}function gn(s,o){if(_("function")){let r=at(s,o,!1,!1);if(r)q.push(r)}else if(_("async")){if(e+=5,T(),_("function")){let r=at(s,o,!0,!1);if(r)q.push(r)}}else if(_("class")){let r=lt(s,o,!1);q.push(r)}else if(_("abstract")){if(e+=8,T(),_("class")){let r=lt(s,o,!0);q.push(r)}}else if(_("interface")){let r=Lt(s,o);q.push(r)}else if(_("type")){let r=Nt(s,o);q.push(r)}else if(_("enum")){let r=gt(s,o,!1);q.push(r)}else if(_("const")){let r=e;if(e+=5,T(),_("enum")){e=r+5,T();let c=gt(s,o,!0);q.push(c)}else{e=r;let c=dt(s,"const",o);for(let l=0;l<c.length;l++)if(o||!Ye)q.push(c[l]);else J(c[l].name,c[l])}}else if(_("let")||_("var")){let r=_("let")?"let":"var",c=dt(s,r,o);for(let l=0;l<c.length;l++)if(o||!Ye)q.push(c[l]);else J(c[l].name,c[l])}else if(_("module")){let r=mt(s,o,"module");q.push(r)}else if(_("namespace")){let r=mt(s,o,"namespace");q.push(r)}else if(_("global")){e+=6,T();let c=`declare global ${e<S&&f.charCodeAt(e)===N?Gt(" ","",!0):"{}"}`,l=Xe(s);q.push({kind:"module",name:"global",text:c,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else Ne()}}class bn{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(E){this.names=E;for(let ie of E.keys()){if(!ie)continue;this.lengths[Math.min(ie.length,64)]=1,this.firstUnits[ie.charCodeAt(0)]=1}this.size=E.size}scan(E,ie){if(this.size===0)return!1;let Q=!1,Y=0,ue=E.length;while(Y<ue){let le=E.charCodeAt(Y);if(le>=65&&le<=90||le>=97&&le<=122||le===95||le===36||le>127){let f=Y;Y++;while(Y<ue){let ee=E.charCodeAt(Y);if(ee>=65&&ee<=90||ee>=97&&ee<=122||ee>=48&&ee<=57||ee===95||ee===36||ee>127)Y++;else break}if(this.firstUnits[le]===1&&this.lengths[Math.min(Y-f,64)]===1){let ee=E.substring(f,Y),ge=this.names.get(ee);if(ge!==void 0){if(ie.add(ee),ge.kind==="function"||ge.kind==="variable")Q=!0}}}else Y++}return Q}}function An(E,ie){let Q=0;while(Q<E.length){let Y=E.charCodeAt(Q);if(Y===be||Y===$e||Y===We){let Ze=Y;Q++;while(Q<E.length)if(E.charCodeAt(Q)===tt)Q+=2;else if(E.charCodeAt(Q++)===Ze)break;continue}if(Y===te&&E.charCodeAt(Q+1)===te){Q+=2;while(Q<E.length&&E.charCodeAt(Q)!==ye&&E.charCodeAt(Q)!==Oe)Q++;continue}if(Y===te&&E.charCodeAt(Q+1)===ke){let Ze=E.indexOf("*/",Q+2);Q=Ze===-1?E.length:Ze+2;continue}if(!a(Y)){Q++;continue}let ue=Q++;while(Q<E.length&&i(E.charCodeAt(Q)))Q++;let le=ue-1,f=Q;while(le>=0&&He(E.charCodeAt(le)))le--;while(f<E.length&&He(E.charCodeAt(f)))f++;let ee=le>=0?E.charCodeAt(le):0,ge=f<E.length?E.charCodeAt(f):0,S=ue>=3&&E.slice(ue-3,ue)==="...";if(ge===nt||ee===Ct&&!S)continue;if(ge===ae&&(ee===N||ee===it))continue;ie.add(E.slice(ue,Q))}}function Gn(E,ie,Q,Y,ue){let le=new Map;if(ue){let e=0;for(let Z of E)if(Z.kind==="class"&&!Z.isExported){if(le.set(Z.name,Z),!ie.has(Z.name))ie.set(Z.name,Z)}else if(!Z.isExported&&(Z.kind==="type"||Z.kind==="interface")&&["variable","function"].includes(ie.get(Z.name)?.kind??""));else E[e++]=Z;E.length=e}let f=new Set(E),ee=new Set,ge=new Set,S=new Set;for(let e of E)if(ge.add(e.name),e.kind!=="type"&&e.kind!=="interface")S.add(e.name);let Ze=new bn(ie),Ye=new Map;for(let[e,Z]of Y){let se=ie.get(e);if(se?.kind==="variable"||se?.kind==="function")Ye.set(e,Z[0])}let q=new Set,me=new Set,Le=new Set,J=new Set,he=(e)=>{if(Ze.scan(e.text,Le))nr(e,J,Ye.size?{candidates:Ye,references:q}:void 0)},Ce=new Set;for(let e=0;e<E.length;e++){let Z=E[e];if(Z.kind!=="import"){if(he(Z),typeof Z.value==="string")An(Z.value,Ce)}}for(;;){let e=[];for(let[P,ce]of ie){if(ee.has(P))continue;if((ce.kind==="function"||ce.kind==="variable"?J:Le).has(P)||ce.kind!=="function"&&Ce.has(P)){let pe=le.get(P);if(pe){for(let Ke of[pe,ce])if(!f.has(Ke))e.push(Ke),f.add(Ke);ge.add(P)}else if(!(ce.kind==="function"||ce.kind==="variable"?S:ge).has(P)){let Ke=ce.kind==="function"?Q.get(P):void 0;if(Ke)for(let de of Ke)e.push(de);else e.push(ce);if(ge.add(P),ce.kind==="function"||ce.kind==="variable")S.add(P)}ee.add(P)}}for(let[P,ce]of Y){if(!Ye.has(P)||me.has(P)||!q.has(P))continue;for(let Ee of ce)if(!f.has(Ee))e.push(Ee),f.add(Ee);me.add(P)}if(e.length===0)break;e.sort((P,ce)=>(P.start??1/0)-(ce.start??1/0));let Z=[],se=0;for(let P=0;P<E.length;P++){let ce=E[P].start??1/0;while(se<e.length&&(e[se].start??1/0)<=ce)Z.push(e[se++]);Z.push(E[P])}while(se<e.length)Z.push(e[se++]);E.length=0;for(let P=0;P<Z.length;P++)E.push(Z[P]);for(let P of e)if(P.kind!=="import"){if(he(P),typeof P.value==="string")An(P.value,Ce)}}}
38
+ export{Oi,Ba,R,F,jt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t}from"./chunk-d0dbet9n.js";function C(n,o){if(o.kind!=="punctuation")return 0;let r=n.slice(o.start,o.end);if("([{<".includes(r))return 1;if(")]}".includes(r)||r===">"&&n[o.start-1]!=="=")return-1;return 0}function _e(n){if(!n.includes("?"))return n;let o=n.trim(),r=o.startsWith("(")&&o.endsWith(")"),u=n.indexOf(o)+(r?1:0),s=r?o.slice(1,-1):o,a=[[]],h=0;for(let i of t(s)){if(i.kind==="punctuation"&&s[i.start]===","&&h===0)a.push([]);else a[a.length-1].push(i);h+=C(s,i)}let m=a.map((i)=>{let l=0,d=-1;for(let[D,A]of i.entries()){if(l===0&&A.kind==="punctuation"&&s[A.start]===":"){d=D;break}l+=C(s,A)}let f=d>0&&s[i[d-1].start]==="?"?i[d-1]:void 0,y=i[0]?s.slice(i[0].start,i[0].end):"",q=i[0]&&s.startsWith("...",i[0].start);return{tokens:i,colon:d,question:f,required:i.length>0&&!f&&!q&&y!=="this"}}),c=-1;for(let[i,l]of m.entries())if(l.required)c=i;let e=[];for(let[i,l]of m.entries()){if(i>=c||!l.question||l.colon<0)continue;let d=l.tokens[l.colon+1],f=l.tokens.at(-1);if(!d||!f)continue;e.push({start:u+l.question.start,end:u+l.question.end,text:""},{start:u+d.start,end:u+d.start,text:"("},{start:u+f.end,end:u+f.end,text:") | undefined"})}if(!e.length)return n;let g=[],p=0;for(let i of e)g.push(n.slice(p,i.start),i.text),p=i.end;return g.push(n.slice(p)),g.join("")}function x(n){return n>=65&&n<=90||n>=97&&n<=122||n===95||n===36}function k(n,o){if(o>=n.length||!x(n.charCodeAt(o)))return o;let r=o+1;while(r<n.length&&(x(n.charCodeAt(r))||n.charCodeAt(r)>=48&&n.charCodeAt(r)<=57))r++;return r}function b(n,o){let r=o;while(r<n.length&&n.charCodeAt(r)<=32)r++;return r}function we(n,o){if(o.trim()!=="{}")return null;let r=n.trim();if(r.length<2||r[0]!=="{"||r[r.length-1]!=="}")return null;let u=r.slice(1,-1),s=[],a=0,h=0;for(let c=0;c<u.length;c++){let e=u.charCodeAt(c);if(e===34||e===39||e===96){c++;while(c<u.length&&u.charCodeAt(c)!==e){if(u.charCodeAt(c)===92)c++;c++}if(c>=u.length)return null;continue}if(e===47&&(u.charCodeAt(c+1)===47||u.charCodeAt(c+1)===42))return null;if(e===40||e===91||e===123)a++;else if(e===41||e===93||e===125){if(--a<0)return null}else if(e===44&&a===0)s.push(u.slice(h,c)),h=c+1}if(a!==0)return null;if(u.slice(h).trim()||s.length===0)s.push(u.slice(h));let m=[];for(let c of s){let e=c.trim(),g=k(e,0);if(g===0)return null;let p=e.slice(0,g),i=p,l=b(e,g);if(e.charCodeAt(l)===58){let f=b(e,l+1),y=k(e,f);if(y===f)return null;i=e.slice(f,y),l=b(e,y)}if(e.charCodeAt(l)!==61||e.charCodeAt(l+1)===61||e.charCodeAt(l+1)===62)return null;let d=e.slice(l+1).trim();if(!d)return null;m.push({key:p,alias:i,value:d})}return m}function je(n,o){let r=n.map((s)=>s.key===s.alias?s.key:`${s.key}: ${s.alias}`).join(", "),u=n.map((s)=>{let a=o(s.value),h=a==="unknown"||a==="any"?a:`${a.includes("=>")?`(${a})`:a} | undefined`;return`${s.key}?: ${h}`}).join("; ");return`{ ${r} }?: { ${u} }`}
2
+ import{t}from"./chunk-6ekgn7sc.js";function C(n,o){if(o.kind!=="punctuation")return 0;let r=n.slice(o.start,o.end);if("([{<".includes(r))return 1;if(")]}".includes(r)||r===">"&&n[o.start-1]!=="=")return-1;return 0}function _e(n){if(!n.includes("?"))return n;let o=n.trim(),r=o.startsWith("(")&&o.endsWith(")"),u=n.indexOf(o)+(r?1:0),s=r?o.slice(1,-1):o,a=[[]],h=0;for(let i of t(s)){if(i.kind==="punctuation"&&s[i.start]===","&&h===0)a.push([]);else a[a.length-1].push(i);h+=C(s,i)}let m=a.map((i)=>{let l=0,d=-1;for(let[D,A]of i.entries()){if(l===0&&A.kind==="punctuation"&&s[A.start]===":"){d=D;break}l+=C(s,A)}let f=d>0&&s[i[d-1].start]==="?"?i[d-1]:void 0,y=i[0]?s.slice(i[0].start,i[0].end):"",q=i[0]&&s.startsWith("...",i[0].start);return{tokens:i,colon:d,question:f,required:i.length>0&&!f&&!q&&y!=="this"}}),c=-1;for(let[i,l]of m.entries())if(l.required)c=i;let e=[];for(let[i,l]of m.entries()){if(i>=c||!l.question||l.colon<0)continue;let d=l.tokens[l.colon+1],f=l.tokens.at(-1);if(!d||!f)continue;e.push({start:u+l.question.start,end:u+l.question.end,text:""},{start:u+d.start,end:u+d.start,text:"("},{start:u+f.end,end:u+f.end,text:") | undefined"})}if(!e.length)return n;let g=[],p=0;for(let i of e)g.push(n.slice(p,i.start),i.text),p=i.end;return g.push(n.slice(p)),g.join("")}function x(n){return n>=65&&n<=90||n>=97&&n<=122||n===95||n===36}function k(n,o){if(o>=n.length||!x(n.charCodeAt(o)))return o;let r=o+1;while(r<n.length&&(x(n.charCodeAt(r))||n.charCodeAt(r)>=48&&n.charCodeAt(r)<=57))r++;return r}function b(n,o){let r=o;while(r<n.length&&n.charCodeAt(r)<=32)r++;return r}function we(n,o){if(o.trim()!=="{}")return null;let r=n.trim();if(r.length<2||r[0]!=="{"||r[r.length-1]!=="}")return null;let u=r.slice(1,-1),s=[],a=0,h=0;for(let c=0;c<u.length;c++){let e=u.charCodeAt(c);if(e===34||e===39||e===96){c++;while(c<u.length&&u.charCodeAt(c)!==e){if(u.charCodeAt(c)===92)c++;c++}if(c>=u.length)return null;continue}if(e===47&&(u.charCodeAt(c+1)===47||u.charCodeAt(c+1)===42))return null;if(e===40||e===91||e===123)a++;else if(e===41||e===93||e===125){if(--a<0)return null}else if(e===44&&a===0)s.push(u.slice(h,c)),h=c+1}if(a!==0)return null;if(u.slice(h).trim()||s.length===0)s.push(u.slice(h));let m=[];for(let c of s){let e=c.trim(),g=k(e,0);if(g===0)return null;let p=e.slice(0,g),i=p,l=b(e,g);if(e.charCodeAt(l)===58){let f=b(e,l+1),y=k(e,f);if(y===f)return null;i=e.slice(f,y),l=b(e,y)}if(e.charCodeAt(l)!==61||e.charCodeAt(l+1)===61||e.charCodeAt(l+1)===62)return null;let d=e.slice(l+1).trim();if(!d)return null;m.push({key:p,alias:i,value:d})}return m}function je(n,o){let r=n.map((s)=>s.key===s.alias?s.key:`${s.key}: ${s.alias}`).join(", "),u=n.map((s)=>{let a=o(s.value),h=a==="unknown"||a==="any"?a:`${a.includes("=>")?`(${a})`:a} | undefined`;return`${s.key}?: ${h}`}).join("; ");return`{ ${r} }?: { ${u} }`}
3
3
  export{_e,we,je};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-ex02f2vm.js";function Ce(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Aa=Ce,fr=Ce,Pa=Ce;
3
- export{Ce,Aa,fr,Pa};
2
+ import{s}from"./chunk-4xvx77zs.js";function Ce(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Aa=Ce,fr=Ce,Da=Ce;
3
+ export{Ce,Aa,fr,Da};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t,d,E}from"./chunk-d0dbet9n.js";var K={kind:"symbol"},k=/^(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|(?:[\d_]+(?:\.[\d_]*)?|\.[\d_]+)(?:[eE][+-]?[\d_]+)?)/,v={"|":1,"^":2,"&":3,"<<":4,">>":4,">>>":4,"+":5,"-":5,"*":6,"/":6,"%":6,"**":7},C=[">>>","<<",">>","**","+","-","*","/","%","|","^","&"];function S(l,c,o=0){if(o>=64)return;let n=l.trim(),r=t(n);if(!r.length)return;if(r[0].start!==0||r[r.length-1].end!==n.length)return S(n.slice(r[0].start,r[r.length-1].end),c,o+1);if(r.length===1&&r[0].kind==="quoted")return d(n);if(r.length===1&&r[0].kind==="word"){let e=c.get(n);return typeof e==="object"?void 0:e}if(k.exec(n)?.[0].length===n.length){let e=Number(n.replaceAll("_",""));return Number.isFinite(e)?e:void 0}let i=0,a;for(let e=0;e<r.length;e++){let s=r[e],u=n.slice(s.start,s.end);if(s.kind!=="punctuation")continue;if(["(","[","{"].includes(u)){i++;continue}if([")","]","}"].includes(u)){i--;continue}let m=k.exec(n.slice(s.start));if(m){while(r[e+1]?.start<s.start+m[0].length)e++;continue}if(i)continue;let f=C.find((w)=>n.startsWith(w,s.start));if(!f)continue;let p=r[e-1],h=p?n.slice(p.start,p.end):"";if(!(!p||p.kind==="punctuation"&&![")","]"].includes(h)&&!/\d/.test(h))&&(!a||v[f]<a.priority||v[f]===a.priority&&f!=="**"))a={start:s.start,operator:f,priority:v[f]};while(r[e+1]?.start<s.start+f.length)e++}if(a){let e=S(n.slice(0,a.start),c,o+1),s=S(n.slice(a.start+a.operator.length),c,o+1);if(e===void 0||s===void 0)return;if(a.operator==="+"&&(typeof e==="string"||typeof s==="string"))return String(e)+String(s);if(typeof e!=="number"||typeof s!=="number")return;let u;switch(a.operator){case"+":u=e+s;break;case"-":u=e-s;break;case"*":u=e*s;break;case"/":u=e/s;break;case"%":u=e%s;break;case"**":u=e**s;break;case"<<":u=e<<s;break;case">>":u=e>>s;break;case">>>":u=e>>>s;break;case"|":u=e|s;break;case"^":u=e^s;break;case"&":u=e&s;break;default:return}return Number.isFinite(u)?u:void 0}if(n.startsWith("(")&&n.endsWith(")")){let e=0;if(r.every((u,m)=>{let f=n.slice(u.start,u.end);if(f==="(")e++;if(f===")")e--;return e!==0||m===r.length-1}))return S(n.slice(1,-1),c,o+1)}if(["+","-","~"].includes(n[0])){let e=S(n.slice(1),c,o+1);if(typeof e!=="number")return;return n[0]==="-"?-e:n[0]==="~"?~e:e}if(!n.startsWith("`")||!n.endsWith("`"))return;let y="",b=1;for(let e=1;e<n.length-1;e++){if(n[e]==="\\"){e++;continue}if(n[e]!=="$"||n[e+1]!=="{")continue;let s=d(`\`${n.slice(b,e)}\``);if(s===void 0)return;y+=s;let u=0,m=r.find((p)=>{if(p.start<e+2||p.kind!=="punctuation")return!1;let h=n.slice(p.start,p.end);if(h==="{")u++;if(h!=="}")return!1;if(u===0)return!0;return u--,!1});if(!m)return;let f=S(n.slice(e+2,m.start),c,o+1);if(f===void 0)return;y+=String(f),e=m.start,b=e+1}let g=d(`\`${n.slice(b,-1)}\``);return g===void 0?void 0:y+g}function ir(l,c){let o=[...new Set([...l,...c.values()])];if(!o.some((i)=>i.kind==="variable"&&typeof i.value==="string"&&/[\[{]/.test(i.value)))return;o.sort((i,a)=>(i.start??0)-(a.start??0));let n=new Map,r=new Map,x=o.some((i)=>i.name==="Symbol");for(let i of o){if(i.kind!=="variable"||typeof i.value!=="string")continue;if(i.value.includes("{")||i.value.includes("[")){let g=new Map(n);g.mutableBindingTypes=new Map(r),i.computedKeyConstants=g}let a=t(i.value),y=a.length===1&&a[0].kind==="word"?n.get(i.value.slice(a[0].start,a[0].end)):void 0;if(i.typeAnnotation==="unique symbol"||i.typeAnnotation==="symbol"||typeof y==="object"||!x&&a[0]?.kind==="word"&&i.value.slice(a[0].start,a[0].end)==="Symbol"&&["(","."].includes(i.value.slice(a[1]?.start,a[1]?.end))){n.set(i.name,K);continue}if(i.modifiers?.[0]!=="const"||i.typeAnnotation||i.modifiers.includes("const assertion"))continue;let b=S(i.value,n);if(b!==void 0){if(n.set(i.name,b),!(a.length===1&&a[0].kind==="word")||r.has(i.value.trim()))r.set(i.name,typeof b)}else if(i.value.trim()==="true"||i.value.trim()==="false")r.set(i.name,"boolean");else if(a.length===1&&a[0].kind==="word"){let g=r.get(i.value.trim());if(g)r.set(i.name,g)}}}function sr(l,c){if(!l.trimStart().startsWith("[")||!l.includes("`"))return;let o=t(l);if(l[o[0]?.start]!=="["||l[o[1]?.start]!=="`"||l[o.at(-1)?.start??-1]!=="]")return;let n=l.slice(o[0].end,o.at(-1).start).trim(),r=S(n,c??new Map);return typeof r==="string"?{name:E(r,"'")}:{index:!0}}function or(l,c){if(!c||!l.trimStart().startsWith("["))return!1;let o=t(l);return o.length===3&&l[o[0].start]==="["&&o[1].kind==="word"&&l[o[2].start]==="]"&&typeof c.get(l.slice(o[1].start,o[1].end))==="object"}function ar(l){if(!l.trimStart().startsWith("[")||!l.includes("`"))return!1;let c=t(l);return l[c[1]?.start]==="`"&&c.some((o)=>o.kind==="punctuation"&&l[o.start]==="{")}
2
+ import{t,d,E}from"./chunk-6ekgn7sc.js";var K={kind:"symbol"},k=/^(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|(?:[\d_]+(?:\.[\d_]*)?|\.[\d_]+)(?:[eE][+-]?[\d_]+)?)/,v={"|":1,"^":2,"&":3,"<<":4,">>":4,">>>":4,"+":5,"-":5,"*":6,"/":6,"%":6,"**":7},C=[">>>","<<",">>","**","+","-","*","/","%","|","^","&"];function S(l,c,o=0){if(o>=64)return;let n=l.trim(),r=t(n);if(!r.length)return;if(r[0].start!==0||r[r.length-1].end!==n.length)return S(n.slice(r[0].start,r[r.length-1].end),c,o+1);if(r.length===1&&r[0].kind==="quoted")return d(n);if(r.length===1&&r[0].kind==="word"){let e=c.get(n);return typeof e==="object"?void 0:e}if(k.exec(n)?.[0].length===n.length){let e=Number(n.replaceAll("_",""));return Number.isFinite(e)?e:void 0}let i=0,a;for(let e=0;e<r.length;e++){let s=r[e],u=n.slice(s.start,s.end);if(s.kind!=="punctuation")continue;if(["(","[","{"].includes(u)){i++;continue}if([")","]","}"].includes(u)){i--;continue}let m=k.exec(n.slice(s.start));if(m){while(r[e+1]?.start<s.start+m[0].length)e++;continue}if(i)continue;let f=C.find((w)=>n.startsWith(w,s.start));if(!f)continue;let p=r[e-1],h=p?n.slice(p.start,p.end):"";if(!(!p||p.kind==="punctuation"&&![")","]"].includes(h)&&!/\d/.test(h))&&(!a||v[f]<a.priority||v[f]===a.priority&&f!=="**"))a={start:s.start,operator:f,priority:v[f]};while(r[e+1]?.start<s.start+f.length)e++}if(a){let e=S(n.slice(0,a.start),c,o+1),s=S(n.slice(a.start+a.operator.length),c,o+1);if(e===void 0||s===void 0)return;if(a.operator==="+"&&(typeof e==="string"||typeof s==="string"))return String(e)+String(s);if(typeof e!=="number"||typeof s!=="number")return;let u;switch(a.operator){case"+":u=e+s;break;case"-":u=e-s;break;case"*":u=e*s;break;case"/":u=e/s;break;case"%":u=e%s;break;case"**":u=e**s;break;case"<<":u=e<<s;break;case">>":u=e>>s;break;case">>>":u=e>>>s;break;case"|":u=e|s;break;case"^":u=e^s;break;case"&":u=e&s;break;default:return}return Number.isFinite(u)?u:void 0}if(n.startsWith("(")&&n.endsWith(")")){let e=0;if(r.every((u,m)=>{let f=n.slice(u.start,u.end);if(f==="(")e++;if(f===")")e--;return e!==0||m===r.length-1}))return S(n.slice(1,-1),c,o+1)}if(["+","-","~"].includes(n[0])){let e=S(n.slice(1),c,o+1);if(typeof e!=="number")return;return n[0]==="-"?-e:n[0]==="~"?~e:e}if(!n.startsWith("`")||!n.endsWith("`"))return;let y="",b=1;for(let e=1;e<n.length-1;e++){if(n[e]==="\\"){e++;continue}if(n[e]!=="$"||n[e+1]!=="{")continue;let s=d(`\`${n.slice(b,e)}\``);if(s===void 0)return;y+=s;let u=0,m=r.find((p)=>{if(p.start<e+2||p.kind!=="punctuation")return!1;let h=n.slice(p.start,p.end);if(h==="{")u++;if(h!=="}")return!1;if(u===0)return!0;return u--,!1});if(!m)return;let f=S(n.slice(e+2,m.start),c,o+1);if(f===void 0)return;y+=String(f),e=m.start,b=e+1}let g=d(`\`${n.slice(b,-1)}\``);return g===void 0?void 0:y+g}function ir(l,c){let o=[...new Set([...l,...c.values()])];if(!o.some((i)=>i.kind==="variable"&&typeof i.value==="string"&&/[\[{]/.test(i.value)))return;o.sort((i,a)=>(i.start??0)-(a.start??0));let n=new Map,r=new Map,x=o.some((i)=>i.name==="Symbol");for(let i of o){if(i.kind!=="variable"||typeof i.value!=="string")continue;if(i.value.includes("{")||i.value.includes("[")){let g=new Map(n);g.mutableBindingTypes=new Map(r),i.computedKeyConstants=g}let a=t(i.value),y=a.length===1&&a[0].kind==="word"?n.get(i.value.slice(a[0].start,a[0].end)):void 0;if(i.typeAnnotation==="unique symbol"||i.typeAnnotation==="symbol"||typeof y==="object"||!x&&a[0]?.kind==="word"&&i.value.slice(a[0].start,a[0].end)==="Symbol"&&["(","."].includes(i.value.slice(a[1]?.start,a[1]?.end))){n.set(i.name,K);continue}if(i.modifiers?.[0]!=="const"||i.typeAnnotation||i.modifiers.includes("const assertion"))continue;let b=S(i.value,n);if(b!==void 0){if(n.set(i.name,b),!(a.length===1&&a[0].kind==="word")||r.has(i.value.trim()))r.set(i.name,typeof b)}else if(i.value.trim()==="true"||i.value.trim()==="false")r.set(i.name,"boolean");else if(a.length===1&&a[0].kind==="word"){let g=r.get(i.value.trim());if(g)r.set(i.name,g)}}}function sr(l,c){if(!l.trimStart().startsWith("[")||!l.includes("`"))return;let o=t(l);if(l[o[0]?.start]!=="["||l[o[1]?.start]!=="`"||l[o.at(-1)?.start??-1]!=="]")return;let n=l.slice(o[0].end,o.at(-1).start).trim(),r=S(n,c??new Map);return typeof r==="string"?{name:E(r,"'")}:{index:!0}}function or(l,c){if(!c||!l.trimStart().startsWith("["))return!1;let o=t(l);return o.length===3&&l[o[0].start]==="["&&o[1].kind==="word"&&l[o[2].start]==="]"&&typeof c.get(l.slice(o[1].start,o[1].end))==="object"}function ar(l){if(!l.trimStart().startsWith("[")||!l.includes("`"))return!1;let c=t(l);return l[c[1]?.start]==="`"&&c.some((o)=>o.kind==="punctuation"&&l[o.start]==="{")}
3
3
  export{S,ir,sr,or,ar};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{t,m}from"./chunk-6ekgn7sc.js";import{Ge}from"./chunk-cyzr3xat.js";function ft(l){let u=t(l);if(u.length!==1||u[0].kind!=="word")return;let f=l.slice(u[0].start,u[0].end);return["true","false","null","undefined","this","super"].includes(f)?void 0:f}function Gt(l){let u=t(l);if(u.length===0)return!0;let f=u[u.length-1],g=l.slice(f.start,f.end);if(f.kind==="word"&&(g==="is"||g==="extends"))return!0;if(g==="|"||g==="&")return!0;let o=u[u.length-2];return g===">"&&o!==void 0&&l.slice(o.start,o.end)==="="}function V(l){return C(l,m(l))}function er(l){for(let u=1024;u<l.length;u*=8){let f=l.slice(0,u),g=I(f,t(f),u);if(g!==void 0)return g}return C(l,t(l))}function C(l,u){return I(l,u,1/0)??!1}function I(l,u,f){let g=0;for(let o=0;o<u.length;o++){let e=u[o];if(e.end>=f)return;if(e.kind==="punctuation"){let a=l.charCodeAt(e.start);if(a===123||a===40||a===91)g++;else if(a===125||a===41||a===93)g--;continue}if(g!==0||e.kind!=="word"||e.end-e.start!==6)continue;let b=l.slice(e.start,e.end);if(b==="export")return!0;if(b==="import"){let a=u[o+1];if(a===void 0?f!==1/0:a.end>=f)return;let w=a?l.slice(a.start,a.end):"";if(w!=="("&&w!==".")return!0}}return f===1/0?!1:void 0}function tr(l){if(l.isExported)return!1;if(["function","variable","interface","type","class","enum","namespace"].includes(l.kind))return!0;return l.kind==="module"&&(l.moduleForm==="namespace"||l.moduleForm==="identifier")}function nr(l,u,f){let g=l.text,o=t(g),e=(s)=>o[s]?g.slice(o[s].start,o[s].end):"",b=(s)=>o[s]?.kind==="word",a=new Map,w=new Map,y=[];for(let s=0;s<o.length;s++){let n=e(s);if(n==="("||n==="["||n==="{"||n==="<")y.push(s);else if(n===")"||n==="]"||n==="}"||n===">"&&e(s-1)!=="="){let i=y.at(-1);if(i!==void 0&&(e(i)==="("&&n===")"||e(i)==="["&&n==="]"||e(i)==="{"&&n==="}"||e(i)==="<"&&n===">")){if(y.pop(),a.set(i,s),e(i)==="<")w.set(s,i)}}}let O=(s)=>{let n=s;while(["readonly","public","private","protected","static","abstract","override","declare","accessor","get","set","async"].includes(e(n))&&(b(n+1)||o[n+1]?.kind==="quoted"||e(n+1)==="["||/^[0-9]/.test(e(n+1))))n++;if(e(n)==="(")return e((a.get(n)??o.length)+1)===":";if(e(n)==="<")return e((a.get(n)??o.length)+1)==="(";let i=n+1;if(e(n)==="[")i=(a.get(n)??o.length)+1;else if(g.charCodeAt(o[n]?.start??g.length)>=48&&g.charCodeAt(o[n]?.start??g.length)<=57)while(i<o.length&&o[i-1].end===o[i].start&&/^[\da-fxob_e.+-]+$/i.test(e(i)))i++;else if(!b(n)&&o[n]?.kind!=="quoted"&&o[n]?.kind!=="literal")return!1;if(e(i)==="?")i++;if(e(i)==="<")i=(a.get(i)??o.length)+1;return e(i)===":"||e(i)==="("},D=[],A=[];for(let s=0;s<o.length;s++){if(e(s)!=="(")continue;let n=a.get(s);if(n===void 0||!(e(n+1)===":"||e(n+1)==="="&&e(n+2)===">"))continue;let i=new Set,h=s+1;while(h<n){let p=h;while(p<n&&e(p)!==","){let x=a.get(p);if(x!==void 0)p=x+1;else p++}let r=h;while(r<p&&e(r)!==":"&&e(r)!=="="){let x=a.get(r);if(x!==void 0)r=x+1;else r++}let c=h;while([".","public","private","protected","readonly","override"].includes(e(c)))c++;if(e(c)==="{"||e(c)==="[")for(let x of Ge(g.slice(o[c].start,o[r-1].end)))i.add(x);else if(b(c))i.add(e(c));h=p+1}let d=n+(e(n+1)===":"?2:3);while(d<o.length){if(d>n+2&&g.slice(o[d-1].end,o[d].start).includes(`
3
+ `)&&!["|","&","?","extends","keyof","typeof","readonly","new","infer","is"].includes(e(d-1))&&O(d))break;if([";",",",")","]","}"].includes(e(d))||e(d)===">"&&e(d-1)!=="=")break;let p=a.get(d);if(p!==void 0)d=p+1;else d++}D.push({start:s,end:d,names:i});let k=w.get(s-1);if(f&&k!==void 0){let p=new Set,r=k+1;while(r<s-1){while(["const","in","out"].includes(e(r)))r++;if(b(r))p.add(e(r));while(r<s-1&&e(r)!==",")r=(a.get(r)??r)+1;r++}A.push({start:k,end:d,names:p})}}let v=f?new Set:void 0,S=(s)=>{if(!b(s))return;v?.add(o[s].start);let n=e(s);if(!D.some((i)=>s>=i.start&&s<i.end&&i.names.has(n)))u.add(n)},T=(s,n)=>{for(let i=s;i<n;i++){if(e(i)==="<"&&a.has(i)){i=a.get(i);continue}if(!b(i)||e(i-1)==="."||e(i+1)===":")continue;if(["true","false","null","undefined","new","this","super","as","satisfies","typeof","void","keyof"].includes(e(i)))continue;S(i)}};for(let s=0;s<o.length;s++){if(e(s)==="typeof")S(s+1);if(e(s)==="export"){let n=s+1;if(e(n)==="default"){if(!["function","class","abstract"].includes(e(n+1))){if(T(n+1,o.length),b(n+1)&&f?.candidates.has(e(n+1))&&(e(n+2)===";"||n+2===o.length))f.references.add(e(n+1))}continue}let i=e(n)==="type";if(i)n++;if(e(n)==="{"){let h=a.get(n);if(h===void 0||e(h+1)==="from")continue;for(let d=n+1;d<h;){let k=e(d)==="type"&&b(d+1)&&e(d+1)!=="as";if(k)d++;let p=f?.candidates.has(e(d));if(p)f.references.add(e(d));if(!p||!i&&!k)S(d);else v?.add(o[d].start);while(d<h&&e(d)!==",")d++;d++}}}if(e(s)==="["){let n=a.get(s);if(n!==void 0&&[":","?","("].includes(e(n+1))&&e(s+2)!==":"&&e(s+2)!=="in")T(s+1,n)}}if(l.kind==="class"){let s=-1;for(let n=0;n<o.length&&e(n)!=="{";n++)if(e(n)==="<"&&a.has(n))n=a.get(n);else if(e(n)==="extends"){s=n;break}if(s!==-1){let n=s+1;while(n<o.length&&e(n)!=="{"&&e(n)!=="implements"){let i=a.get(n);if(i!==void 0)n=i+1;else n++}T(s+1,n)}}if(f){let s=new Set,n=t(l.generics??""),i=0,h=!1;for(let r of n){let c=(l.generics??"").slice(r.start,r.end);if(["<","(","[","{"].includes(c)){if(i++,c==="<"&&i===1)h=!0}else if([">",")","]","}"].includes(c)&&!(c===">"&&(l.generics??"").slice(r.start-1,r.start)==="="))i--;else if(c===","&&i===1)h=!0;else if(h&&i===1&&r.kind==="word"&&!["const","in","out"].includes(c))s.add(c),h=!1}let d=A.flatMap((r)=>[...r.names].flatMap((c)=>[{index:r.start,name:c,delta:1},{index:r.end,name:c,delta:-1}])).sort((r,c)=>r.index-c.index),k=new Map,p=0;for(let r=0;r<o.length;r++){while(p<d.length&&d[p].index<=r){let M=d[p++];k.set(M.name,(k.get(M.name)??0)+M.delta)}if(!b(r)||v?.has(o[r].start)||!f.candidates.has(e(r))||s.has(e(r))||(k.get(e(r))??0)>0)continue;let c=e(r-1),x=e(r+1);if(c==="."||c==="as"&&l.kind==="export"||["const","let","var","function","class","interface","type","enum","namespace","module"].includes(c))continue;if(x===":"&&c!=="?"||x==="?"&&[":","("].includes(e(r+2))||x==="("||x==="<"&&e((a.get(r+1)??o.length)+1)==="(")continue;f.references.add(e(r))}}}
4
+ export{ft,Gt,V,er,tr,nr};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{a,i}from"./chunk-mm1cfz16.js";import{x}from"./chunk-8dyz1cte.js";import{C}from"./chunk-vhna4qch.js";function Me(f){let r=new Set,n=[];for(let t of f)if(t.kind==="import")for(let o of C(t.text))r.add(o);else if(t.kind!=="unknown"){if(n.push(t.text),t.kind==="variable"){if(t.typeAnnotation)n.push(t.typeAnnotation);else if(t.value)n.push(x(t,!1))}}let e=n.join(`
2
+ import{a,i}from"./chunk-cgqg1br8.js";import{x}from"./chunk-bkrftw1s.js";import{C}from"./chunk-zpvcnc7c.js";function Me(f){let r=new Set,n=[];for(let t of f)if(t.kind==="import")for(let o of C(t.text))r.add(o);else if(t.kind!=="unknown"){if(n.push(t.text),t.kind==="variable"){if(t.typeAnnotation)n.push(t.typeAnnotation);else if(t.value)n.push(x(t,!1))}}let e=n.join(`
3
3
  `),s=new Set;for(let t=0;t<e.length;){if(!a(e.charCodeAt(t))){t++;continue}let o=t++;while(t<e.length&&i(e.charCodeAt(t)))t++;let c=e.slice(o,t);if(r.has(c))s.add(c)}return{usedItems:s,referenceText:e}}
4
4
  export{Me};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{e}from"./chunk-qmg1535a.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Jt{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
2
+ import{e}from"./chunk-3mp0jaa7.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Jt{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
3
3
  const { parentPort } = require('worker_threads');
4
4
  const bun = typeof Bun !== 'undefined' ? Bun : null;
5
5
  const fs = bun ? null : require('node:fs');
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var e="@dtsx/dtsx",i="module",n="0.11.48",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
2
+ var e="@dtsx/dtsx",i="module",n="0.11.51",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{A}from"./chunk-475bjqea.js";import{Y}from"./chunk-h5esm323.js";import{chmod as G,lstat as P,mkdir as y,readdir as j,realpath as q,rename as D,rm as N,rmdir as L,stat as R,writeFile as W}from"fs/promises";import{basename as _,dirname as m,isAbsolute as M,parse as B,relative as F,resolve as l}from"path";function f(a,e){return a instanceof Error&&"code"in a&&a.code===e}async function w(a){try{return await P(a)}catch(e){if(f(e,"ENOENT"))return;throw e}}async function g(a){let e=l(a);try{return await q(e)}catch(n){if(!f(n,"ENOENT")||m(e)===e)throw n;return l(await g(m(e)),_(e))}}async function ne(a){let e=l(a.cwd,a.outdir);if(a.bundle&&a.bundleOutput){if(M(a.bundleOutput))throw Error("bundleOutput must be relative to outdir");if(!A(l(e,a.bundleOutput),e))throw Error("bundleOutput must stay within outdir")}if(!a.clean||a.dryRun)return;if(e===B(e).root)throw Error("Refusing to clean declarations from the filesystem root");let[n,r]=await Promise.all([g(e),g(l(a.cwd,a.root))]);if(A(r,n))throw Error("Refusing to clean an outdir that contains the source root")}function z(a){return[".d.ts",".d.mts",".d.cts",".d.ts.map",".d.mts.map",".d.cts.map"].some((e)=>a.endsWith(e))}function k(a,e){return a.dev===e.dev&&a.ino===e.ino}async function S(a,e){try{if(!(await R(a)).isDirectory())throw Error(`Declaration output parent is not a directory: ${a}`);return}catch(r){if(!f(r,"ENOENT"))throw r}let n=m(a);if(n===a)throw Error(`Cannot create declaration output directory: ${a}`);await S(n,e);try{await y(a),e.push(a)}catch(r){if(!f(r,"EEXIST")||!(await R(a)).isDirectory())throw r}}async function X(a,e,n){for(let r of(await j(a,{withFileTypes:!0})).sort((s,p)=>s.name.localeCompare(p.name))){let s=l(a,r.name);if(s===e)continue;if(r.isDirectory())await X(s,e,n);else if(z(r.name)){let p=await w(s);if(!p)throw Error(`Declaration output changed during inventory: ${s}`);n.set(s,p)}}}function O(a,e,n,r,s){return Object.assign(AggregateError(e,a),{code:"DTSX_PUBLICATION_FAILED",phase:n,recoveryDirectory:r,outputsCommitted:s})}async function $e(a,e){if(a.dryRun||e.size===0&&!a.clean)return;await ne(a);let n=l(a.cwd,a.outdir);if(e.size===0&&!await w(n))return;let r=l(n,".dtsx-publication"),s=new Map;for(let[o,c]of e){let t=l(o);if(!M(o)||t===n||!A(t,n)||A(t,r)||!z(t))throw Error(`Invalid declaration publication target: ${o}`);if(s.has(t))throw Error(`Duplicate declaration publication target: ${o}`);s.set(t,c)}let p=[],x=[],T=[],b=!1,E,d,I=!1;async function h(o,c){let t=await g(m(o));if(!A(t,c))throw Error(`Declaration publication parent escapes outdir: ${o}`);if(A(t,l(c,".dtsx-publication")))throw Error(`Declaration publication target overlaps its transaction directory: ${o}`)}async function C(){if(!b)return;if(!E)throw Error(`Cannot verify declaration publication ownership: ${r}`);let o=await w(r);if(!o||!k(o,E))throw Error(`Declaration publication ownership changed: ${r}`);if(d&&await g(r)!==l(d,".dtsx-publication"))throw Error(`Declaration publication location changed: ${r}`);await N(r,{recursive:!0})}try{await S(n,p);try{await y(r)}catch(t){if(f(t,"EEXIST"))throw Error(`Declaration publication is active or requires recovery at ${r}`,{cause:t});throw t}b=!0,E=await P(r),d=await g(n);let o=new Map;if(a.clean)await X(n,r,o);for(let t of s.keys()){await h(t,d);let i=await w(t);if(i&&!i.isFile())throw Error(`Declaration publication target is not a regular file: ${t}`);if(i)o.set(t,i)}for(let t of o.keys())await h(t,d);await y(l(r,"staged")),await y(l(r,"backups"));let c=new Map;for(let t of new Set([...o.keys(),...s.keys()])){let i=c.size.toString();c.set(t,{path:t,existing:o.get(t),backup:l(r,"backups",i),staged:s.has(t)?l(r,"staged",i):void 0})}await W(l(r,"manifest.json"),JSON.stringify({version:1,outdir:n,targets:[...c.values()].map((t)=>({path:F(n,t.path),backup:F(r,t.backup),hadPrevious:!!t.existing}))}));for(let[t,i]of s){let u=c.get(t),v=u.staged;if(await Y(v,i.content,i.lineEnding),!a.clean&&u.existing)await G(v,u.existing.mode&511);u.stagedIdentity=await P(v)}for(let t of c.values()){if(!t.existing)continue;await h(t.path,d);let i=await w(t.path);if(!i||!k(i,t.existing))throw Error(`Declaration output changed before commit: ${t.path}`);await D(t.path,t.backup),x.push(t)}for(let t of c.values()){if(!t.staged||!t.stagedIdentity)continue;if(await h(t.path,d),await S(m(t.path),p),await h(t.path,d),await w(t.path))throw Error(`Declaration output appeared during commit: ${t.path}`);await D(t.staged,t.path),T.push({path:t.path,identity:t.stagedIdentity})}I=!0;try{await C()}catch(t){throw O(`Declaration outputs committed, but transaction cleanup failed at ${r}`,[t],"finalize",r,!0)}}catch(o){if(I)throw o;let c=[];for(let i of T.toReversed())try{if(d)await h(i.path,d);let u=await w(i.path);if(!u)continue;if(!k(u,i.identity))throw Error(`Installed declaration changed before rollback: ${i.path}`);await N(i.path)}catch(u){c.push(u)}for(let i of x.toReversed())try{if(d)await h(i.path,d);if(await w(i.path))throw Error(`Cannot restore declaration over an existing path: ${i.path}`);await D(i.backup,i.path)}catch(u){c.push(u)}if(c.length>0)throw O(`Declaration rollback failed; recovery data retained at ${r}`,[o,...c],"rollback",r,!1);let t=[];try{await C()}catch(i){t.push(i)}for(let i of p.toReversed())try{await L(i)}catch(u){if(!f(u,"ENOENT")&&!f(u,"ENOTEMPTY")&&!f(u,"EEXIST"))t.push(u)}if(t.length>0)throw O(`Prior declarations retained, but publication cleanup failed at ${r}`,[o,...t],"cleanup",b?r:void 0,!1);throw o}}
2
+ import{A}from"./chunk-m8w98p7p.js";import{Y}from"./chunk-b6xcyrnx.js";import{chmod as G,lstat as P,mkdir as y,readdir as j,realpath as q,rename as D,rm as N,rmdir as L,stat as R,writeFile as W}from"fs/promises";import{basename as _,dirname as m,isAbsolute as M,parse as B,relative as F,resolve as l}from"path";function f(a,e){return a instanceof Error&&"code"in a&&a.code===e}async function w(a){try{return await P(a)}catch(e){if(f(e,"ENOENT"))return;throw e}}async function g(a){let e=l(a);try{return await q(e)}catch(n){if(!f(n,"ENOENT")||m(e)===e)throw n;return l(await g(m(e)),_(e))}}async function ne(a){let e=l(a.cwd,a.outdir);if(a.bundle&&a.bundleOutput){if(M(a.bundleOutput))throw Error("bundleOutput must be relative to outdir");if(!A(l(e,a.bundleOutput),e))throw Error("bundleOutput must stay within outdir")}if(!a.clean||a.dryRun)return;if(e===B(e).root)throw Error("Refusing to clean declarations from the filesystem root");let[n,r]=await Promise.all([g(e),g(l(a.cwd,a.root))]);if(A(r,n))throw Error("Refusing to clean an outdir that contains the source root")}function z(a){return[".d.ts",".d.mts",".d.cts",".d.ts.map",".d.mts.map",".d.cts.map"].some((e)=>a.endsWith(e))}function k(a,e){return a.dev===e.dev&&a.ino===e.ino}async function S(a,e){try{if(!(await R(a)).isDirectory())throw Error(`Declaration output parent is not a directory: ${a}`);return}catch(r){if(!f(r,"ENOENT"))throw r}let n=m(a);if(n===a)throw Error(`Cannot create declaration output directory: ${a}`);await S(n,e);try{await y(a),e.push(a)}catch(r){if(!f(r,"EEXIST")||!(await R(a)).isDirectory())throw r}}async function X(a,e,n){for(let r of(await j(a,{withFileTypes:!0})).sort((s,p)=>s.name.localeCompare(p.name))){let s=l(a,r.name);if(s===e)continue;if(r.isDirectory())await X(s,e,n);else if(z(r.name)){let p=await w(s);if(!p)throw Error(`Declaration output changed during inventory: ${s}`);n.set(s,p)}}}function O(a,e,n,r,s){return Object.assign(AggregateError(e,a),{code:"DTSX_PUBLICATION_FAILED",phase:n,recoveryDirectory:r,outputsCommitted:s})}async function $e(a,e){if(a.dryRun||e.size===0&&!a.clean)return;await ne(a);let n=l(a.cwd,a.outdir);if(e.size===0&&!await w(n))return;let r=l(n,".dtsx-publication"),s=new Map;for(let[o,c]of e){let t=l(o);if(!M(o)||t===n||!A(t,n)||A(t,r)||!z(t))throw Error(`Invalid declaration publication target: ${o}`);if(s.has(t))throw Error(`Duplicate declaration publication target: ${o}`);s.set(t,c)}let p=[],x=[],T=[],b=!1,E,d,I=!1;async function h(o,c){let t=await g(m(o));if(!A(t,c))throw Error(`Declaration publication parent escapes outdir: ${o}`);if(A(t,l(c,".dtsx-publication")))throw Error(`Declaration publication target overlaps its transaction directory: ${o}`)}async function C(){if(!b)return;if(!E)throw Error(`Cannot verify declaration publication ownership: ${r}`);let o=await w(r);if(!o||!k(o,E))throw Error(`Declaration publication ownership changed: ${r}`);if(d&&await g(r)!==l(d,".dtsx-publication"))throw Error(`Declaration publication location changed: ${r}`);await N(r,{recursive:!0})}try{await S(n,p);try{await y(r)}catch(t){if(f(t,"EEXIST"))throw Error(`Declaration publication is active or requires recovery at ${r}`,{cause:t});throw t}b=!0,E=await P(r),d=await g(n);let o=new Map;if(a.clean)await X(n,r,o);for(let t of s.keys()){await h(t,d);let i=await w(t);if(i&&!i.isFile())throw Error(`Declaration publication target is not a regular file: ${t}`);if(i)o.set(t,i)}for(let t of o.keys())await h(t,d);await y(l(r,"staged")),await y(l(r,"backups"));let c=new Map;for(let t of new Set([...o.keys(),...s.keys()])){let i=c.size.toString();c.set(t,{path:t,existing:o.get(t),backup:l(r,"backups",i),staged:s.has(t)?l(r,"staged",i):void 0})}await W(l(r,"manifest.json"),JSON.stringify({version:1,outdir:n,targets:[...c.values()].map((t)=>({path:F(n,t.path),backup:F(r,t.backup),hadPrevious:!!t.existing}))}));for(let[t,i]of s){let u=c.get(t),v=u.staged;if(await Y(v,i.content,i.lineEnding),!a.clean&&u.existing)await G(v,u.existing.mode&511);u.stagedIdentity=await P(v)}for(let t of c.values()){if(!t.existing)continue;await h(t.path,d);let i=await w(t.path);if(!i||!k(i,t.existing))throw Error(`Declaration output changed before commit: ${t.path}`);await D(t.path,t.backup),x.push(t)}for(let t of c.values()){if(!t.staged||!t.stagedIdentity)continue;if(await h(t.path,d),await S(m(t.path),p),await h(t.path,d),await w(t.path))throw Error(`Declaration output appeared during commit: ${t.path}`);await D(t.staged,t.path),T.push({path:t.path,identity:t.stagedIdentity})}I=!0;try{await C()}catch(t){throw O(`Declaration outputs committed, but transaction cleanup failed at ${r}`,[t],"finalize",r,!0)}}catch(o){if(I)throw o;let c=[];for(let i of T.toReversed())try{if(d)await h(i.path,d);let u=await w(i.path);if(!u)continue;if(!k(u,i.identity))throw Error(`Installed declaration changed before rollback: ${i.path}`);await N(i.path)}catch(u){c.push(u)}for(let i of x.toReversed())try{if(d)await h(i.path,d);if(await w(i.path))throw Error(`Cannot restore declaration over an existing path: ${i.path}`);await D(i.backup,i.path)}catch(u){c.push(u)}if(c.length>0)throw O(`Declaration rollback failed; recovery data retained at ${r}`,[o,...c],"rollback",r,!1);let t=[];try{await C()}catch(i){t.push(i)}for(let i of p.toReversed())try{await L(i)}catch(u){if(!f(u,"ENOENT")&&!f(u,"ENOTEMPTY")&&!f(u,"EEXIST"))t.push(u)}if(t.length>0)throw O(`Prior declarations retained, but publication cleanup failed at ${r}`,[o,...t],"cleanup",b?r:void 0,!1);throw o}}
3
3
  export{ne,$e};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{readFile as M,writeFile as S}from"fs/promises";import{basename as x,dirname as d,relative as b,resolve as C}from"path";function f(e){return`${String.fromCharCode(47,47,35)} sourceMappingURL=${e}`}class dn{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(e){this.file=e.file,this.sourceRoot=e.sourceRoot}addSource(e,n){let r=this.sourceIndexMap.get(e);if(r===void 0)r=this.sources.length,this.sources.push(e),this.sourcesContent.push(n??null),this.sourceIndexMap.set(e,r);else if(n&&!this.sourcesContent[r])this.sourcesContent[r]=n;return r}addName(e){let n=this.nameIndexMap.get(e);if(n===void 0)n=this.names.length,this.names.push(e),this.nameIndexMap.set(e,n);return n}addMapping(e){let n=this.addSource(e.source),r;if(e.name)r=this.addName(e.name);this.mappings.push({generated:e.generated,original:e.original,sourceIndex:n,nameIndex:r})}generate(e=!1){this.mappings.sort((r,t)=>{if(r.generated.line!==t.generated.line)return r.generated.line-t.generated.line;return r.generated.column-t.generated.column});let n={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)n.sourceRoot=this.sourceRoot;if(e)n.sourcesContent=this.sourcesContent;return n}encodeMappings(){let e=[],n=0,r=0,t=0,i=0,o=0,s=0,u=[];for(let a of this.mappings){while(n<a.generated.line)e.push(u.join(",")),u=[],n++,r=0;let l=[];if(l.push(a.generated.column-r),r=a.generated.column,l.push(a.sourceIndex-t),t=a.sourceIndex,l.push(a.original.line-i),i=a.original.line,l.push(a.original.column-o),o=a.original.column,a.nameIndex!==void 0)l.push(a.nameIndex-s),s=a.nameIndex;u.push(I(l))}return e.push(u.join(",")),e.join(";")}toString(e=!1){return JSON.stringify(this.generate(e))}toDataUrl(e=!1){let n=this.toString(e);return`data:application/json;charset=utf-8;base64,${Buffer.from(n).toString("base64")}`}toComment(e=!1){return f(this.toDataUrl(e))}}class Ct{map;decodedMappings=null;constructor(e){this.map=typeof e==="string"?JSON.parse(e):e}originalPositionFor(e){let n=this.getMappings(),r=0,t=n.length-1,i=null;while(r<=t){let o=Math.floor((r+t)/2),s=n[o];if(s.generated.line===e.line)if(s.generated.column===e.column){i=s;break}else if(s.generated.column<e.column)i=s,r=o+1;else t=o-1;else if(s.generated.line<e.line)r=o+1;else t=o-1}if(!i)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[i.sourceIndex]||null,line:i.original.line,column:i.original.column,name:i.nameIndex!==void 0?this.map.names[i.nameIndex]:null}}generatedPositionFor(e){let n=this.map.sources.indexOf(e.source);if(n===-1)return null;let r=this.getMappings();for(let t of r)if(t.sourceIndex===n&&t.original.line===e.line&&t.original.column<=e.column)return t.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=v(this.map.mappings);return this.decodedMappings}sourceContentFor(e){let n=this.map.sources.indexOf(e);if(n===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[n]}}function I(e){return e.map(L).join("")}function L(e){let o="",s=e<0?-e<<1|1:e<<1;do{let u=s&31;if(s>>>=5,s>0)u|=32;o+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u]}while(s>0);return o}function v(e){let n=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=0,o=0,s=0,u=0,a=0,l=e.split(";");for(let g of l){if(i=0,g){let h=g.split(",");for(let p of h){if(!p)continue;let c=N(p,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(c.length>=1)i+=c[0];if(c.length>=4){o+=c[1],s+=c[2],u+=c[3];let m={generated:{line:t,column:i},original:{line:s,column:u},sourceIndex:o};if(c.length>=5)a+=c[4],m.nameIndex=a;n.push(m)}}}t++}return n}function N(e,n){let t=[],i=0,o=0;for(let s of e){let u=n.indexOf(s);if(u===-1)continue;let a=u&32;if(o+=(u&31)<<i,a)i+=5;else{let l=o&1;o>>=1,t.push(l?-o:o),o=0,i=0}}return t}function zs(e){let n=new dn({file:x(e.generatedFile),sourceRoot:e.sourceRoot}),r=b(d(e.generatedFile),e.sourceFile);n.addSource(r,e.sourceContent);for(let t of e.mappings)n.addMapping({generated:{line:t.generatedLine,column:t.generatedColumn},original:{line:t.originalLine,column:t.originalColumn},source:r,name:t.name});return n}function Hs(e,n){return`${e}
2
+ import{readFile as M,writeFile as S}from"fs/promises";import{basename as x,dirname as d,relative as b,resolve as C}from"path";function f(e){return`${String.fromCharCode(47,47,35)} sourceMappingURL=${e}`}class dn{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(e){this.file=e.file,this.sourceRoot=e.sourceRoot}addSource(e,n){let r=this.sourceIndexMap.get(e);if(r===void 0)r=this.sources.length,this.sources.push(e),this.sourcesContent.push(n??null),this.sourceIndexMap.set(e,r);else if(n&&!this.sourcesContent[r])this.sourcesContent[r]=n;return r}addName(e){let n=this.nameIndexMap.get(e);if(n===void 0)n=this.names.length,this.names.push(e),this.nameIndexMap.set(e,n);return n}addMapping(e){let n=this.addSource(e.source),r;if(e.name)r=this.addName(e.name);this.mappings.push({generated:e.generated,original:e.original,sourceIndex:n,nameIndex:r})}generate(e=!1){this.mappings.sort((r,t)=>{if(r.generated.line!==t.generated.line)return r.generated.line-t.generated.line;return r.generated.column-t.generated.column});let n={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)n.sourceRoot=this.sourceRoot;if(e)n.sourcesContent=this.sourcesContent;return n}encodeMappings(){let e=[],n=0,r=0,t=0,i=0,o=0,s=0,u=[];for(let a of this.mappings){while(n<a.generated.line)e.push(u.join(",")),u=[],n++,r=0;let l=[];if(l.push(a.generated.column-r),r=a.generated.column,l.push(a.sourceIndex-t),t=a.sourceIndex,l.push(a.original.line-i),i=a.original.line,l.push(a.original.column-o),o=a.original.column,a.nameIndex!==void 0)l.push(a.nameIndex-s),s=a.nameIndex;u.push(I(l))}return e.push(u.join(",")),e.join(";")}toString(e=!1){return JSON.stringify(this.generate(e))}toDataUrl(e=!1){let n=this.toString(e);return`data:application/json;charset=utf-8;base64,${Buffer.from(n).toString("base64")}`}toComment(e=!1){return f(this.toDataUrl(e))}}class Ct{map;decodedMappings=null;constructor(e){this.map=typeof e==="string"?JSON.parse(e):e}originalPositionFor(e){let n=this.getMappings(),r=0,t=n.length-1,i=null;while(r<=t){let o=Math.floor((r+t)/2),s=n[o];if(s.generated.line===e.line)if(s.generated.column===e.column){i=s;break}else if(s.generated.column<e.column)i=s,r=o+1;else t=o-1;else if(s.generated.line<e.line)r=o+1;else t=o-1}if(!i)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[i.sourceIndex]||null,line:i.original.line,column:i.original.column,name:i.nameIndex!==void 0?this.map.names[i.nameIndex]:null}}generatedPositionFor(e){let n=this.map.sources.indexOf(e.source);if(n===-1)return null;let r=this.getMappings();for(let t of r)if(t.sourceIndex===n&&t.original.line===e.line&&t.original.column<=e.column)return t.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=v(this.map.mappings);return this.decodedMappings}sourceContentFor(e){let n=this.map.sources.indexOf(e);if(n===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[n]}}function I(e){return e.map(L).join("")}function L(e){let o="",s=e<0?-e<<1|1:e<<1;do{let u=s&31;if(s>>>=5,s>0)u|=32;o+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u]}while(s>0);return o}function v(e){let n=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=0,o=0,s=0,u=0,a=0,l=e.split(";");for(let g of l){if(i=0,g){let h=g.split(",");for(let p of h){if(!p)continue;let c=N(p,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(c.length>=1)i+=c[0];if(c.length>=4){o+=c[1],s+=c[2],u+=c[3];let m={generated:{line:t,column:i},original:{line:s,column:u},sourceIndex:o};if(c.length>=5)a+=c[4],m.nameIndex=a;n.push(m)}}}t++}return n}function N(e,n){let t=[],i=0,o=0;for(let s of e){let u=n.indexOf(s);if(u===-1)continue;let a=u&32;if(o+=(u&31)<<i,a)i+=5;else{let l=o&1;o>>=1,t.push(l?-o:o),o=0,i=0}}return t}function Us(e){let n=new dn({file:x(e.generatedFile),sourceRoot:e.sourceRoot}),r=b(d(e.generatedFile),e.sourceFile);n.addSource(r,e.sourceContent);for(let t of e.mappings)n.addMapping({generated:{line:t.generatedLine,column:t.generatedColumn},original:{line:t.originalLine,column:t.originalColumn},source:r,name:t.name});return n}function Hs(e,n){return`${e}
3
3
  ${f(n)}`}function Ks(e,n,r=!1){return`${e}
4
4
  ${n.toComment(r)}`}async function qs(e,n,r=!1){await S(e,n.toString(r))}async function qr(e){let n=await M(e,"utf-8");return new Ct(n)}async function Js(e,n){let r=e.match(/\/\/# sourceMappingURL=data:application\/json[^,]+,(\S+)/);if(r){let i=r[1],o=Buffer.from(i,"base64").toString("utf-8");return new Ct(o)}let t=e.match(/\/\/# sourceMappingURL=(.+)$/);if(t){let i=C(d(n),t[1].trim());try{return await qr(i)}catch{return null}}return null}function Ys(e,n){let r=e,t=n,i=r.split(`
5
5
  `),o=[],s=0,u=0;for(let a of t){while(s+i[u].length+1<=a.generatedStart&&u<i.length-1)s+=i[u].length+1,u++;let l=a.generatedStart-s;o.push({generatedLine:u,generatedColumn:Math.max(0,l),originalLine:a.originalLine,originalColumn:a.originalColumn,name:a.name})}return o}
6
- export{dn,Ct,zs,Hs,Ks,qs,qr,Js,Ys};
6
+ export{dn,Ct,Us,Hs,Ks,qs,qr,Js,Ys};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{P}from"./chunk-kdz4gxdq.js";import{re}from"./chunk-h5esm323.js";import{ne,$e}from"./chunk-cgrta603.js";import{Nn}from"./chunk-8hwmssy9.js";import{spawn as j}from"child_process";var N=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function x(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=j(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),b=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),E=(t,w)=>{if(v)return;if(v=!0,clearTimeout(b),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>E(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);E(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function Vi(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!N.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...P,...f};if(await ne(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await re(n);let u=await Nn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await x(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await $e(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
2
+ import{D}from"./chunk-m7jndt3v.js";import{re}from"./chunk-b6xcyrnx.js";import{ne,$e}from"./chunk-vekg5zy6.js";import{Nn}from"./chunk-5ym0xgg0.js";import{spawn as j}from"child_process";var N=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function x(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=j(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),b=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),E=(t,w)=>{if(v)return;if(v=!0,clearTimeout(b),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>E(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);E(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function Vi(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!N.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...D,...f};if(await ne(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await re(n);let u=await Nn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await x(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await $e(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
3
  export{Vi};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{r}from"./chunk-wrvgt39b.js";import{existsSync as g,readFileSync as h,writeFileSync as b}from"fs";function d(t){let e=[],s=/\b([A-Z][a-zA-Z0-9]*)\b/g,o;while((o=s.exec(t))!==null){let i=o[1];if(!D(i))e.push(i)}return[...new Set(e)]}function D(t){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(t)}function x(t){if(t.kind!=="type")return!1;let e=t.typeAnnotation||"";if(t.generics)return!1;if(e.includes("{")||e.includes("(")||e.includes("<"))return!1;return/^[\w\s|&]+$/.test(e)}function v(t){if(t.kind!=="interface")return!1;if(!t.members||t.members.length===0){if(!t.extends)return!0}return!1}function I(t,e){let s={...t,members:[...t.members||[],...e.members||[]],leadingComments:[...t.leadingComments||[],...e.leadingComments||[]]};if(t.extends&&e.extends){let o=t.extends.split(",").map((n)=>n.trim()),i=e.extends.split(",").map((n)=>n.trim());s.extends=[...new Set([...o,...i])].join(", ")}else s.extends=t.extends||e.extends;return s}function A(t){let e={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...t].sort((s,o)=>{let i=e[s.kind]??99,n=e[o.kind]??99;if(i!==n)return i-n;return s.name.localeCompare(o.name)})}function T(t){let e=[],s=[];for(let i=0;i<t.length;i++){let n=t[i];if(n.kind==="import")e.push(n);else s.push(n)}return[...[...e].sort((i,n)=>{let a=i.source||"",c=n.source||"",p=a.startsWith("node:")||a==="bun",m=c.startsWith("node:")||c==="bun";if(p&&!m)return-1;if(!p&&m)return 1;let l=!a.startsWith("."),u=!c.startsWith(".");if(l&&!u)return-1;if(!l&&u)return 1;return a.localeCompare(c)}),...s]}function S(t){let e=new Set;for(let i of t){if(i.kind==="import")continue;let n=i.text||"",a=i.typeAnnotation||"",c=i.returnType||"",p=i.extends||"",m=i.implements?.join(" ")||"",l=`${n} ${a} ${c} ${p} ${m}`;for(let u of d(l))e.add(u);if(i.members)for(let u of i.members){let f=`${u.typeAnnotation||""} ${u.returnType||""}`;for(let y of d(f))e.add(y)}if(i.parameters){for(let u of i.parameters)if(u.type)for(let f of d(u.type))e.add(f)}}let s=0;return{declarations:t.map((i)=>{if(i.kind!=="import"||!i.specifiers)return i;let n=i.specifiers.filter((a)=>{let c=a.alias||a.name;return e.has(c)});if(n.length===0){if(!i.isSideEffect)return s++,null}if(n.length<(i.specifiers?.length||0))return s+=(i.specifiers?.length||0)-n.length,{...i,specifiers:n};return i}).filter((i)=>i!==null),removed:s}}function k(t){let e=new Map,s=0;for(let o of t){if(o.kind==="import"){let n=`import:${o.source}`;if(e.has(n)){let a=e.get(n),c=[...a.specifiers||[],...o.specifiers||[]],p=Array.from(new Map(c.map((m)=>[m.alias||m.name,m])).values());e.set(n,{...a,specifiers:p}),s++}else e.set(n,o);continue}let i=`${o.kind}:${o.name}`;if(e.has(i))s++;else e.set(i,o)}return{declarations:Array.from(e.values()),removed:s}}function z(t){let e=new Map,s=[];for(let n of t)if(n.kind==="interface"){let a=n.name;if(!e.has(a))e.set(a,[]);e.get(a).push(n)}else s.push(n);let o=0,i=[];for(let[n,a]of e)if(a.length>1){let c=a[0];for(let p=1;p<a.length;p++)c=I(c,a[p]),o++;i.push(c)}else i.push(a[0]);return{declarations:[...s,...i],merged:o}}function w(t){let e=new Map,s=new Set;for(let n of t)if(x(n))e.set(n.name,n.typeAnnotation||""),s.add(n.name);if(e.size===0)return{declarations:t,inlined:0};function o(n){let a=n;for(let[c,p]of e){let m=new RegExp(`\\b${c}\\b`,"g");a=a.replace(m,p)}return a}return{declarations:t.filter((n)=>n.kind!=="type"||!s.has(n.name)).map((n)=>{if(n.typeAnnotation)n={...n,typeAnnotation:o(n.typeAnnotation)};if(n.returnType)n={...n,returnType:o(n.returnType)};if(n.extends)n={...n,extends:o(n.extends)};return n}),inlined:e.size}}function R(t){let e=t.length,s=t.filter((o)=>!v(o));return{declarations:s,removed:e-s.length}}function mr(t,e={}){let s=[...t],o={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(e.removeUnusedImports){let{declarations:i,removed:n}=S(s);s=i,o.removedImports=n}if(e.deduplicateDeclarations){let{declarations:i,removed:n}=k(s);s=i,o.removedDeclarations+=n}if(e.mergeInterfaces){let{declarations:i,merged:n}=z(s);s=i,o.mergedInterfaces=n}if(e.removeEmptyInterfaces){let{declarations:i,removed:n}=R(s);s=i,o.removedDeclarations+=n}if(e.inlineSimpleTypes){let{declarations:i,inlined:n}=w(s);s=i,o.inlinedTypes=n}if(e.sortImports)s=T(s);if(e.sortDeclarations)s=A(s);return{declarations:s,result:o}}async function Gi(t,e={}){if(!g(t))throw Error(`File not found: ${t}`);let s=h(t,"utf-8"),o=Buffer.byteLength(s,"utf-8"),i=r(s,t,!e.removeComments),{declarations:n,result:a}=mr(i,e),c=C(n,e);if(e.minify)c=gr(c);let p=Buffer.byteLength(c,"utf-8");return a.originalSize=o,a.optimizedSize=p,a.savings=o-p,a.savingsPercent=Math.round(a.savings/o*100),b(t,c),a}function C(t,e){let s=[];for(let o of t){if(!e.removeComments&&o.leadingComments)for(let i of o.leadingComments)s.push(i);if(o.text)s.push(o.text);else s.push(E(o));s.push("")}return s.join(`
2
+ import{r}from"./chunk-a04yhmwb.js";import{existsSync as g,readFileSync as h,writeFileSync as b}from"fs";function d(t){let e=[],s=/\b([A-Z][a-zA-Z0-9]*)\b/g,o;while((o=s.exec(t))!==null){let i=o[1];if(!D(i))e.push(i)}return[...new Set(e)]}function D(t){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(t)}function x(t){if(t.kind!=="type")return!1;let e=t.typeAnnotation||"";if(t.generics)return!1;if(e.includes("{")||e.includes("(")||e.includes("<"))return!1;return/^[\w\s|&]+$/.test(e)}function v(t){if(t.kind!=="interface")return!1;if(!t.members||t.members.length===0){if(!t.extends)return!0}return!1}function I(t,e){let s={...t,members:[...t.members||[],...e.members||[]],leadingComments:[...t.leadingComments||[],...e.leadingComments||[]]};if(t.extends&&e.extends){let o=t.extends.split(",").map((n)=>n.trim()),i=e.extends.split(",").map((n)=>n.trim());s.extends=[...new Set([...o,...i])].join(", ")}else s.extends=t.extends||e.extends;return s}function A(t){let e={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...t].sort((s,o)=>{let i=e[s.kind]??99,n=e[o.kind]??99;if(i!==n)return i-n;return s.name.localeCompare(o.name)})}function T(t){let e=[],s=[];for(let i=0;i<t.length;i++){let n=t[i];if(n.kind==="import")e.push(n);else s.push(n)}return[...[...e].sort((i,n)=>{let a=i.source||"",c=n.source||"",p=a.startsWith("node:")||a==="bun",m=c.startsWith("node:")||c==="bun";if(p&&!m)return-1;if(!p&&m)return 1;let l=!a.startsWith("."),u=!c.startsWith(".");if(l&&!u)return-1;if(!l&&u)return 1;return a.localeCompare(c)}),...s]}function S(t){let e=new Set;for(let i of t){if(i.kind==="import")continue;let n=i.text||"",a=i.typeAnnotation||"",c=i.returnType||"",p=i.extends||"",m=i.implements?.join(" ")||"",l=`${n} ${a} ${c} ${p} ${m}`;for(let u of d(l))e.add(u);if(i.members)for(let u of i.members){let f=`${u.typeAnnotation||""} ${u.returnType||""}`;for(let y of d(f))e.add(y)}if(i.parameters){for(let u of i.parameters)if(u.type)for(let f of d(u.type))e.add(f)}}let s=0;return{declarations:t.map((i)=>{if(i.kind!=="import"||!i.specifiers)return i;let n=i.specifiers.filter((a)=>{let c=a.alias||a.name;return e.has(c)});if(n.length===0){if(!i.isSideEffect)return s++,null}if(n.length<(i.specifiers?.length||0))return s+=(i.specifiers?.length||0)-n.length,{...i,specifiers:n};return i}).filter((i)=>i!==null),removed:s}}function k(t){let e=new Map,s=0;for(let o of t){if(o.kind==="import"){let n=`import:${o.source}`;if(e.has(n)){let a=e.get(n),c=[...a.specifiers||[],...o.specifiers||[]],p=Array.from(new Map(c.map((m)=>[m.alias||m.name,m])).values());e.set(n,{...a,specifiers:p}),s++}else e.set(n,o);continue}let i=`${o.kind}:${o.name}`;if(e.has(i))s++;else e.set(i,o)}return{declarations:Array.from(e.values()),removed:s}}function z(t){let e=new Map,s=[];for(let n of t)if(n.kind==="interface"){let a=n.name;if(!e.has(a))e.set(a,[]);e.get(a).push(n)}else s.push(n);let o=0,i=[];for(let[n,a]of e)if(a.length>1){let c=a[0];for(let p=1;p<a.length;p++)c=I(c,a[p]),o++;i.push(c)}else i.push(a[0]);return{declarations:[...s,...i],merged:o}}function w(t){let e=new Map,s=new Set;for(let n of t)if(x(n))e.set(n.name,n.typeAnnotation||""),s.add(n.name);if(e.size===0)return{declarations:t,inlined:0};function o(n){let a=n;for(let[c,p]of e){let m=new RegExp(`\\b${c}\\b`,"g");a=a.replace(m,p)}return a}return{declarations:t.filter((n)=>n.kind!=="type"||!s.has(n.name)).map((n)=>{if(n.typeAnnotation)n={...n,typeAnnotation:o(n.typeAnnotation)};if(n.returnType)n={...n,returnType:o(n.returnType)};if(n.extends)n={...n,extends:o(n.extends)};return n}),inlined:e.size}}function R(t){let e=t.length,s=t.filter((o)=>!v(o));return{declarations:s,removed:e-s.length}}function mr(t,e={}){let s=[...t],o={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(e.removeUnusedImports){let{declarations:i,removed:n}=S(s);s=i,o.removedImports=n}if(e.deduplicateDeclarations){let{declarations:i,removed:n}=k(s);s=i,o.removedDeclarations+=n}if(e.mergeInterfaces){let{declarations:i,merged:n}=z(s);s=i,o.mergedInterfaces=n}if(e.removeEmptyInterfaces){let{declarations:i,removed:n}=R(s);s=i,o.removedDeclarations+=n}if(e.inlineSimpleTypes){let{declarations:i,inlined:n}=w(s);s=i,o.inlinedTypes=n}if(e.sortImports)s=T(s);if(e.sortDeclarations)s=A(s);return{declarations:s,result:o}}async function Gi(t,e={}){if(!g(t))throw Error(`File not found: ${t}`);let s=h(t,"utf-8"),o=Buffer.byteLength(s,"utf-8"),i=r(s,t,!e.removeComments),{declarations:n,result:a}=mr(i,e),c=C(n,e);if(e.minify)c=gr(c);let p=Buffer.byteLength(c,"utf-8");return a.originalSize=o,a.optimizedSize=p,a.savings=o-p,a.savingsPercent=Math.round(a.savings/o*100),b(t,c),a}function C(t,e){let s=[];for(let o of t){if(!e.removeComments&&o.leadingComments)for(let i of o.leadingComments)s.push(i);if(o.text)s.push(o.text);else s.push(E(o));s.push("")}return s.join(`
3
3
  `)}function E(t){let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"import":if(t.isTypeOnly)e.push("import type");else e.push("import");if(t.specifiers&&t.specifiers.length>0){let s=t.specifiers.map((o)=>{let i=o.isType?"type ":"";return o.alias?`${i}${o.name} as ${o.alias}`:`${i}${o.name}`}).join(", ");e.push(`{ ${s} }`)}e.push("from"),e.push(`'${t.source}'`);break;case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${B(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let s of t.members)e.push(` ${s.name}${s.typeAnnotation?`: ${s.typeAnnotation}`:""}`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements?.length)e.push(`implements ${t.implements.join(", ")}`);e.push("{ }");break;case"enum":e.push("declare enum"),e.push(t.name),e.push("{ }");break;default:return t.text||""}return e.join(" ")}function B(t){if(!t)return"";return t.map((e)=>{let s="";if(e.rest)s+="...";if(s+=e.name,e.optional)s+="?";if(e.type)s+=`: ${e.type}`;return s}).join(", ")}function gr(t){return t.replace(/(?<!\/\*\*)\/\/[^\n]*/g,"").replace(/^\s*[\r\n]/gm,"").replace(/ {2,}/g," ").replace(/\s*([{}[\]();,:])\s*/g,"$1").replace(/(\w)(\{)/g,"$1 $2").replace(/(\})([a-z])/gi,"$1 $2").replace(/(export|import|type|interface|class|function|const|let|var|extends|implements|declare)\s*/g,"$1 ").trim()}
4
4
  export{mr,Gi,gr};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class mi{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function Ao(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function Po(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function Do(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
2
+ import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class mi{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function Ao(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function Do(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function Po(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
3
3
  `)}function Ro(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
4
- export{mi,Ao,Po,Do,Ro};
4
+ export{mi,Ao,Do,Po,Ro};