@dtsx/dtsx 0.11.41 → 0.11.43

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 (150) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-jvaqq9fq.js → chunk-0h9dz87w.js} +1 -1
  3. package/dist/{chunk-6yn2edca.js → chunk-0xam980d.js} +3 -3
  4. package/dist/{chunk-7bt7x8sy.js → chunk-0zj4xkky.js} +3 -3
  5. package/dist/{chunk-a2dn9j88.js → chunk-1721pyws.js} +2 -2
  6. package/dist/{chunk-x3arymvk.js → chunk-1903h3dm.js} +2 -2
  7. package/dist/{chunk-q4ph9qa2.js → chunk-1dqa0tex.js} +1 -1
  8. package/dist/{chunk-73qsp464.js → chunk-1hhk0zm6.js} +2 -2
  9. package/dist/{chunk-zf96k060.js → chunk-23w57jk5.js} +2 -2
  10. package/dist/{chunk-rajfxka5.js → chunk-2p8za6vr.js} +2 -2
  11. package/dist/{chunk-pq1n1xqh.js → chunk-36xenw6z.js} +2 -2
  12. package/dist/chunk-3pcxxgwq.js +3 -0
  13. package/dist/{chunk-v55m1ae1.js → chunk-44zq3xnw.js} +6 -6
  14. package/dist/{chunk-qzb5pswc.js → chunk-4n2mpvmb.js} +2 -2
  15. package/dist/{chunk-twrcd0q6.js → chunk-51cdjc3e.js} +2 -2
  16. package/dist/{chunk-8qvphjgv.js → chunk-5v7drjwg.js} +1 -1
  17. package/dist/{chunk-7387m006.js → chunk-62bqxy6j.js} +2 -2
  18. package/dist/{chunk-geqv8t08.js → chunk-7fytm1ya.js} +1 -1
  19. package/dist/{chunk-hqph3vnd.js → chunk-7k0e2h9b.js} +3 -3
  20. package/dist/{chunk-5mbfgcvp.js → chunk-8pfyd95y.js} +2 -2
  21. package/dist/{chunk-veh8ks5v.js → chunk-9c0k2b8n.js} +2 -2
  22. package/dist/{chunk-qnwcsmsg.js → chunk-9dkjzqm0.js} +5 -5
  23. package/dist/{chunk-6vz1grv8.js → chunk-9fz5erbq.js} +3 -3
  24. package/dist/{chunk-k4pkkkmh.js → chunk-9mtn8sk3.js} +1 -1
  25. package/dist/{chunk-ves9h7g2.js → chunk-9vj0g89m.js} +2 -2
  26. package/dist/chunk-a2666k9r.js +3 -0
  27. package/dist/{chunk-khyg6w62.js → chunk-a3px4jga.js} +4 -4
  28. package/dist/{chunk-059gzhxc.js → chunk-ah3pwsh5.js} +4 -4
  29. package/dist/{chunk-epjq1edf.js → chunk-aqcjv2v5.js} +9 -9
  30. package/dist/{chunk-yf6v2p6x.js → chunk-b0cdncp3.js} +2 -2
  31. package/dist/{chunk-ywv56grs.js → chunk-b2j236p3.js} +2 -2
  32. package/dist/{chunk-3f3byyqp.js → chunk-b79vtkkt.js} +1 -1
  33. package/dist/{chunk-w8ws29dq.js → chunk-bhqpdftq.js} +2 -2
  34. package/dist/{chunk-8fg11pr7.js → chunk-cd26g482.js} +3 -3
  35. package/dist/{chunk-01jwgm2m.js → chunk-e37cbaq7.js} +1 -1
  36. package/dist/{chunk-8wk7nw3c.js → chunk-ep3575a9.js} +1 -1
  37. package/dist/{chunk-btwfkzt5.js → chunk-ettcbmzw.js} +3 -3
  38. package/dist/{chunk-550teag8.js → chunk-eyc0tk75.js} +8 -8
  39. package/dist/{chunk-grqy03qp.js → chunk-fhbwwm79.js} +3 -3
  40. package/dist/{chunk-jfsj0sd2.js → chunk-fka5apgq.js} +1 -1
  41. package/dist/{chunk-kv3x5jrs.js → chunk-j3egtn0s.js} +2 -2
  42. package/dist/{chunk-13tjnp25.js → chunk-km03xc8j.js} +6 -6
  43. package/dist/{chunk-7g0hjhqy.js → chunk-ksc4xgdz.js} +2 -2
  44. package/dist/{chunk-85d82vn3.js → chunk-m3ysqm3b.js} +2 -2
  45. package/dist/{chunk-g0dxj89b.js → chunk-m9x72e5j.js} +4 -4
  46. package/dist/chunk-mp86smwc.js +38 -0
  47. package/dist/{chunk-fv3x086v.js → chunk-n1p62kwx.js} +2 -2
  48. package/dist/{chunk-aq7y0s2v.js → chunk-n4hj7rs6.js} +4 -4
  49. package/dist/{chunk-j0p7bwj6.js → chunk-p3n0wx32.js} +3 -3
  50. package/dist/{chunk-df8p90w4.js → chunk-pebt9j6c.js} +2 -2
  51. package/dist/{chunk-2ck79rny.js → chunk-pekphr39.js} +1 -1
  52. package/dist/{chunk-00m9cbar.js → chunk-pfvjr5bg.js} +3 -3
  53. package/dist/{chunk-7khy25x0.js → chunk-pwdmw567.js} +2 -2
  54. package/dist/{chunk-q11f576t.js → chunk-rmg7jdhj.js} +2 -2
  55. package/dist/{chunk-yyqay3jp.js → chunk-rwwrrxtc.js} +2 -2
  56. package/dist/{chunk-8kj9pkw5.js → chunk-rz5jszhe.js} +2 -2
  57. package/dist/{chunk-9pharkp0.js → chunk-tvhg9v4f.js} +6 -6
  58. package/dist/{chunk-k0mqnrc1.js → chunk-vsa6gbmz.js} +1 -1
  59. package/dist/{chunk-sp0k32m0.js → chunk-vv5jdqfj.js} +2 -2
  60. package/dist/{chunk-m0tacjrk.js → chunk-w4fj9m56.js} +3 -3
  61. package/dist/{chunk-9gp0e3kn.js → chunk-xewmepxp.js} +2 -2
  62. package/dist/{chunk-gn3zapr9.js → chunk-xgj6rxmd.js} +3 -3
  63. package/dist/{chunk-2ngfncfx.js → chunk-xst4jpr9.js} +9 -9
  64. package/dist/{chunk-1vc3eend.js → chunk-y78fsxjf.js} +2 -2
  65. package/dist/{chunk-wma315wm.js → chunk-y83jhbpr.js} +8 -8
  66. package/dist/{chunk-dh3y4pf7.js → chunk-ygpyce6w.js} +3 -3
  67. package/dist/{chunk-vgdsxnc2.js → chunk-zgj8xq4x.js} +1 -1
  68. package/dist/{chunk-asqkc0bw.js → chunk-znd7w376.js} +3 -3
  69. package/dist/src/augmentation-graph.js +1 -1
  70. package/dist/src/binding-patterns.js +1 -1
  71. package/dist/src/bundle-linker.js +1 -1
  72. package/dist/src/bundler.js +1 -1
  73. package/dist/src/cache.js +1 -1
  74. package/dist/src/call-signatures.js +1 -1
  75. package/dist/src/circular.js +1 -1
  76. package/dist/src/compat.js +1 -1
  77. package/dist/src/computed-keys.js +1 -1
  78. package/dist/src/dangling-refs.js +1 -1
  79. package/dist/src/declaration-project.js +1 -1
  80. package/dist/src/declaration-publication.js +1 -1
  81. package/dist/src/declaration-references.js +1 -1
  82. package/dist/src/diff.js +1 -1
  83. package/dist/src/docs.js +1 -1
  84. package/dist/src/enum-declarations.js +1 -1
  85. package/dist/src/errors.js +1 -1
  86. package/dist/src/extractor/directives.js +1 -1
  87. package/dist/src/extractor/extract.js +1 -1
  88. package/dist/src/extractor/scanner.js +1 -1
  89. package/dist/src/extractor.js +1 -1
  90. package/dist/src/function-properties.js +1 -1
  91. package/dist/src/generator.js +1 -1
  92. package/dist/src/global-types.js +1 -1
  93. package/dist/src/import-sorter.js +1 -1
  94. package/dist/src/index.js +1 -1
  95. package/dist/src/inferred-imports.js +1 -1
  96. package/dist/src/lexical.js +1 -1
  97. package/dist/src/lsp.js +1 -1
  98. package/dist/src/memory.js +1 -1
  99. package/dist/src/module-graph.js +1 -1
  100. package/dist/src/module-references.js +1 -1
  101. package/dist/src/native-checker.js +1 -1
  102. package/dist/src/native-extractor.js +1 -1
  103. package/dist/src/native-generation.js +1 -1
  104. package/dist/src/native-project.js +1 -1
  105. package/dist/src/optimizer.js +1 -1
  106. package/dist/src/output-normalizer.js +1 -1
  107. package/dist/src/parallel-processor.js +1 -1
  108. package/dist/src/parameters.js +1 -1
  109. package/dist/src/parser.js +1 -1
  110. package/dist/src/plugins/bun.js +1 -1
  111. package/dist/src/plugins/esbuild.js +1 -1
  112. package/dist/src/plugins/index.js +1 -1
  113. package/dist/src/plugins/tsdown.js +1 -1
  114. package/dist/src/plugins/tsup.js +1 -1
  115. package/dist/src/plugins/vite.js +1 -1
  116. package/dist/src/plugins/webpack.js +1 -1
  117. package/dist/src/process-source.js +1 -1
  118. package/dist/src/processor/cache.js +1 -1
  119. package/dist/src/processor/declarations.js +1 -1
  120. package/dist/src/processor/import-usage.js +1 -1
  121. package/dist/src/processor/imports.js +1 -1
  122. package/dist/src/processor/index.js +1 -1
  123. package/dist/src/processor/type-inference.js +1 -1
  124. package/dist/src/processor.js +1 -1
  125. package/dist/src/profiling.js +1 -1
  126. package/dist/src/return-type-scope.js +1 -1
  127. package/dist/src/security.js +1 -1
  128. package/dist/src/source-cache.js +1 -1
  129. package/dist/src/sourcemap.js +1 -1
  130. package/dist/src/stx.js +1 -1
  131. package/dist/src/tracking.js +1 -1
  132. package/dist/src/transformers.js +1 -1
  133. package/dist/src/tree-shaker.js +1 -1
  134. package/dist/src/type-mappings.js +1 -1
  135. package/dist/src/utils.js +1 -1
  136. package/dist/src/value-inference.js +1 -1
  137. package/dist/src/vue.js +1 -1
  138. package/dist/src/worker-thread.js +1 -1
  139. package/dist/src/worker.js +1 -1
  140. package/dist/src/workspace.js +1 -1
  141. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  142. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  143. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  144. package/native/linux-arm64/libzig-dtsx.so +0 -0
  145. package/native/linux-x64/libzig-dtsx.so +0 -0
  146. package/native/windows-x64/zig-dtsx.dll +0 -0
  147. package/package.json +1 -1
  148. package/dist/chunk-8g4wk8mm.js +0 -38
  149. package/dist/chunk-dpanh3p5.js +0 -3
  150. package/dist/chunk-xmj05115.js +0 -3
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{kt,Tt,a,Ae,Ze,At,Pt,Qe,et,tt,Dt,nt,Rt,Mt}from"./chunk-2ngfncfx.js";function P(t){return t.endsWith(".stx")}function h(t){let n=[],s=/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,o;while((o=s.exec(t))!==null){let r=o[1]??"",i=/\blang\s*=\s*["']([^"']+)["']/i.exec(r)?.[1]?.toLowerCase()??(/\b(?:type\s*=\s*["'](?:text\/)?typescript["']|typescript)\b/i.test(r)?"ts":"js"),e=/\bserver\b/i.test(r)?"server":/\bclient\b/i.test(r)?"client":"universal";n.push({content:o[2]??"",kind:"script",attrs:r,context:e,lang:i,start:o.index})}return n}function y(t){let n=[],s=/^[ \t]*@ts[ \t]*(?:\r?\n|$)/gm,o;while((o=s.exec(t))!==null){let r=s.lastIndex,i=/^[ \t]*@endts[ \t]*(?:\r?\n|$)/gm;i.lastIndex=r;let e=i.exec(t),l=e?.index??t.length;if(n.push({content:t.slice(r,l),kind:"ts",attrs:"",context:"universal",lang:"ts",start:o.index}),!e)break;s.lastIndex=i.lastIndex}return n}function da(t){return[...h(t),...y(t)].sort((n,s)=>n.start-s.start)}function k(t){if(t.kind==="ts"||t.context!=="universal"||t.lang==="ts")return!0;return/\b(?:defineProps|defineEmits|defineExpose|defineSlots)\b|\bexport\s|\b(?:interface|type)\s+[A-Za-z_$]/.test(t.content)}function _(t){let n=/(?:\$?props)\s+as\s+/g,s;while((s=n.exec(t))!==null){let o=n.lastIndex;while(o<t.length&&/\s/.test(t[o]))o++;if(t[o]==="{"){let e=a(t,o,"{","}");if(e!==-1)return t.slice(o,e+1).trim();continue}let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(o))?.[0];if(!r)continue;let i=o+r.length;while(i<t.length&&/\s/.test(t[i]))i++;if(t[i]==="<"){let e=a(t,i,"<",">");if(e!==-1)i=e+1}return t.slice(o,i).trim()}return null}function w(t){return/\b(?:const|let|var)\s+\$?props\s*:\s*([^=;\n]+)/.exec(t)?.[1]?.trim()??null}function T(t){let n=/^\s*(?:\|\||\?\?)\s*([^;\n]+)/.exec(t)?.[1]?.trim();if(/^['"`]/.test(n??""))return"string";if(/^(?:true|false)\b/.test(n??""))return"boolean";if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)\b/.test(n??""))return"number";if(/^\[/.test(n??""))return"unknown[]";if(/^\{/.test(n??""))return"Record<string, unknown>";if(/^\s*(?:===?|!==?)\s*(?:true|false)\b/.test(t))return"boolean";return"unknown"}function E(t,n){if(!t||t==="unknown")return n;if(n==="unknown"||t===n)return t;return[...new Set([...t.split(" | "),...n.split(" | ")])].join(" | ")}function v(t){let n=Tt(t),s=new Map,o=/\$props(?:\.([A-Za-z_$][\w$]*)|\[\s*(['"])([^'"\n]+)\2\s*\])/g,r;while((r=o.exec(t))!==null){if(n.slice(r.index,r.index+6)!=="$props")continue;let e=r[1]??r[3],l=T(t.slice(o.lastIndex));s.set(e,E(s.get(e),l))}if(s.size===0)return null;return{type:`{ ${[...s].map(([e,l])=>`${/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}?: ${l}`).join(", ")} }`}}function A(t){let n=nt(t,null);if(n)return n;let s=_(t)??w(t);if(!s)return v(t);if(/^[A-Za-z_$][\w$]*$/.test(s)){let o=s.replace(/[$]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:declare\\s+)?(?:interface|type)\\s+${o}\\b`).test(t))return{type:s}}return nt(`${t}
3
- defineProps<${s}>()`,null)}function C(t){return At(t)}function S(t){let n=Tt(t).trimStart();if(n==="")return!0;return/^(?:import\b|export\b|declare\b|interface\b|type\b|(?:export\s+)?namespace\b|(?:export\s+)?module\b|(?:abstract\s+)?class\b|const\b|let\b|var\b|(?:async\s+)?function\b)/.test(n)}function R(t){let n=[],s=0,o=0,r=0;while(r<t.length){let e=t[r],l=kt(t,r);if(l>r){r=l;continue}if(e==="{"||e==="["||e==="(")o++;else if(e==="}"||e==="]"||e===")")o=Math.max(0,o-1);if((e===";"||e===`
2
+ import{Tt,At,a,Ae,Qe,Pt,Dt,et,tt,nt,Rt,rt,Mt,Ot}from"./chunk-xst4jpr9.js";function P(t){return t.endsWith(".stx")}function h(t){let n=[],s=/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,o;while((o=s.exec(t))!==null){let r=o[1]??"",i=/\blang\s*=\s*["']([^"']+)["']/i.exec(r)?.[1]?.toLowerCase()??(/\b(?:type\s*=\s*["'](?:text\/)?typescript["']|typescript)\b/i.test(r)?"ts":"js"),e=/\bserver\b/i.test(r)?"server":/\bclient\b/i.test(r)?"client":"universal";n.push({content:o[2]??"",kind:"script",attrs:r,context:e,lang:i,start:o.index})}return n}function y(t){let n=[],s=/^[ \t]*@ts[ \t]*(?:\r?\n|$)/gm,o;while((o=s.exec(t))!==null){let r=s.lastIndex,i=/^[ \t]*@endts[ \t]*(?:\r?\n|$)/gm;i.lastIndex=r;let e=i.exec(t),l=e?.index??t.length;if(n.push({content:t.slice(r,l),kind:"ts",attrs:"",context:"universal",lang:"ts",start:o.index}),!e)break;s.lastIndex=i.lastIndex}return n}function da(t){return[...h(t),...y(t)].sort((n,s)=>n.start-s.start)}function k(t){if(t.kind==="ts"||t.context!=="universal"||t.lang==="ts")return!0;return/\b(?:defineProps|defineEmits|defineExpose|defineSlots)\b|\bexport\s|\b(?:interface|type)\s+[A-Za-z_$]/.test(t.content)}function _(t){let n=/(?:\$?props)\s+as\s+/g,s;while((s=n.exec(t))!==null){let o=n.lastIndex;while(o<t.length&&/\s/.test(t[o]))o++;if(t[o]==="{"){let e=a(t,o,"{","}");if(e!==-1)return t.slice(o,e+1).trim();continue}let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(o))?.[0];if(!r)continue;let i=o+r.length;while(i<t.length&&/\s/.test(t[i]))i++;if(t[i]==="<"){let e=a(t,i,"<",">");if(e!==-1)i=e+1}return t.slice(o,i).trim()}return null}function w(t){return/\b(?:const|let|var)\s+\$?props\s*:\s*([^=;\n]+)/.exec(t)?.[1]?.trim()??null}function T(t){let n=/^\s*(?:\|\||\?\?)\s*([^;\n]+)/.exec(t)?.[1]?.trim();if(/^['"`]/.test(n??""))return"string";if(/^(?:true|false)\b/.test(n??""))return"boolean";if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)\b/.test(n??""))return"number";if(/^\[/.test(n??""))return"unknown[]";if(/^\{/.test(n??""))return"Record<string, unknown>";if(/^\s*(?:===?|!==?)\s*(?:true|false)\b/.test(t))return"boolean";return"unknown"}function E(t,n){if(!t||t==="unknown")return n;if(n==="unknown"||t===n)return t;return[...new Set([...t.split(" | "),...n.split(" | ")])].join(" | ")}function v(t){let n=At(t),s=new Map,o=/\$props(?:\.([A-Za-z_$][\w$]*)|\[\s*(['"])([^'"\n]+)\2\s*\])/g,r;while((r=o.exec(t))!==null){if(n.slice(r.index,r.index+6)!=="$props")continue;let e=r[1]??r[3],l=T(t.slice(o.lastIndex));s.set(e,E(s.get(e),l))}if(s.size===0)return null;return{type:`{ ${[...s].map(([e,l])=>`${/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}?: ${l}`).join(", ")} }`}}function A(t){let n=rt(t,null);if(n)return n;let s=_(t)??w(t);if(!s)return v(t);if(/^[A-Za-z_$][\w$]*$/.test(s)){let o=s.replace(/[$]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:declare\\s+)?(?:interface|type)\\s+${o}\\b`).test(t))return{type:s}}return rt(`${t}
3
+ defineProps<${s}>()`,null)}function C(t){return Pt(t)}function S(t){let n=At(t).trimStart();if(n==="")return!0;return/^(?:import\b|export\b|declare\b|interface\b|type\b|(?:export\s+)?namespace\b|(?:export\s+)?module\b|(?:abstract\s+)?class\b|const\b|let\b|var\b|(?:async\s+)?function\b)/.test(n)}function R(t){let n=[],s=0,o=0,r=0;while(r<t.length){let e=t[r],l=Tt(t,r);if(l>r){r=l;continue}if(e==="{"||e==="["||e==="(")o++;else if(e==="}"||e==="]"||e===")")o=Math.max(0,o-1);if((e===";"||e===`
4
4
  `)&&o===0){let c=r+1;if(!S(t.slice(s,c)))n.push([s,c]);s=c}r++}if(s<t.length&&!S(t.slice(s)))n.push([s,t.length]);let i=t;for(let e=n.length-1;e>=0;e--)i=i.slice(0,n[e][0])+i.slice(n[e][1]);return i}function D(t){let s=da(t).filter(k).map((f)=>f.content).join(`
5
- `),o=null,r=Pt(s);if(r.passthrough)return s;if(s=r.script,r.options){let f=Qe(r.options,"props");if(f)o=Ze(f)}let i=s,e=C(s),l=A(i),c=l?.type??o??"{}",m=Rt(i,null),d=Mt(i,null),g=Ae(i,"defineSlots")?.generic??null,x=l?.inlinedLocal;if(x)e=tt(e,x.name,x.declText);let p=`DefineComponent<${c}>`,u=[];if(m)u.push(`readonly __stxEmits?: ${m}`);if(g)u.push(`readonly __stxSlots?: ${g}`);if(d)u.push(`readonly __stxExposed?: ${d}`);if(u.length>0)p+=` & { ${u.join(", ")} }`;p=Dt(p),e=R(et(e,p));let b=["import type { DefineComponent } from '@stacksjs/stx'",`type __DtsxStxComponentType = ${p}`,"const __dtsx_component__: __DtsxStxComponentType = null as unknown as __DtsxStxComponentType","export default __dtsx_component__"];if(e.trim()!=="")b.push(e);return b.join(`
5
+ `),o=null,r=Dt(s);if(r.passthrough)return s;if(s=r.script,r.options){let f=et(r.options,"props");if(f)o=Qe(f)}let i=s,e=C(s),l=A(i),c=l?.type??o??"{}",m=Mt(i,null),d=Ot(i,null),g=Ae(i,"defineSlots")?.generic??null,x=l?.inlinedLocal;if(x)e=nt(e,x.name,x.declText);let p=`DefineComponent<${c}>`,u=[];if(m)u.push(`readonly __stxEmits?: ${m}`);if(g)u.push(`readonly __stxSlots?: ${g}`);if(d)u.push(`readonly __stxExposed?: ${d}`);if(u.length>0)p+=` & { ${u.join(", ")} }`;p=Rt(p),e=R(tt(e,p));let b=["import type { DefineComponent } from '@stacksjs/stx'",`type __DtsxStxComponentType = ${p}`,"const __dtsx_component__: __DtsxStxComponentType = null as unknown as __DtsxStxComponentType","export default __dtsx_component__"];if(e.trim()!=="")b.push(e);return b.join(`
6
6
  `)}
7
7
  export{P,da,D};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{R,M}from"./chunk-2ngfncfx.js";import{P,D}from"./chunk-hqph3vnd.js";import{nr}from"./chunk-g0dxj89b.js";import{p}from"./chunk-v6fwy63g.js";import{T,O}from"./chunk-epjq1edf.js";var y=100,h=0,s=new Map;function Te(n,a,c=!0,i=!1,l){if(R(a))n=M(n);else if(P(a))n=D(n);let f=p(n),m=`${a}:${c?1:0}:${i?1:0}:${JSON.stringify([...l??[]].sort())}`,r=s.get(m);if(r&&r.contentHash===f)return r.lastAccess=++h,r.declarations;let g=i?T(n,a,c):O(n,a,c,l);if(s.set(m,{declarations:g,contentHash:f,lastAccess:++h}),s.size>y){let S=Math.max(1,Math.ceil(s.size*0.1)),e=[];for(let[t,o]of s)e.push([t,o.lastAccess]);e.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<e.length;t++)s.delete(e[t][0])}return g}function Rn(){s.clear(),nr()}
3
- export{Te,Rn};
2
+ import{R,M}from"./chunk-xst4jpr9.js";import{P,D}from"./chunk-7k0e2h9b.js";import{nr}from"./chunk-m9x72e5j.js";import{p}from"./chunk-v6fwy63g.js";import{T,O}from"./chunk-aqcjv2v5.js";var y=100,h=0,s=new Map;function Te(n,a,c=!0,i=!1,l){if(R(a))n=M(n);else if(P(a))n=D(n);let f=p(n),m=`${a}:${c?1:0}:${i?1:0}:${JSON.stringify([...l??[]].sort())}`,r=s.get(m);if(r&&r.contentHash===f)return r.lastAccess=++h,r.declarations;let g=i?T(n,a,c):O(n,a,c,l);if(s.set(m,{declarations:g,contentHash:f,lastAccess:++h}),s.size>y){let S=Math.max(1,Math.ceil(s.size*0.1)),e=[];for(let[t,o]of s)e.push([t,o.lastAccess]);e.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<e.length;t++)s.delete(e[t][0])}return g}function Mn(){s.clear(),nr()}
3
+ export{Te,Mn};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- var r=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,E=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,f=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function bn(t){let l=[],a=0;for(let e=0;e<=t.length;e++)if(e===t.length||t[e]===`
2
+ var r=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,E=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,f=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function xn(t){let l=[],a=0;for(let e=0;e<=t.length;e++)if(e===t.length||t[e]===`
3
3
  `){let n=a,i=e;while(n<i&&(t[n]===" "||t[n]==="\t"||t[n]==="\r"))n++;while(i>n&&(t[i-1]===" "||t[i-1]==="\t"||t[i-1]==="\r"))i--;let s=t.slice(n,i);if(a=e+1,s.startsWith("///")){if(s.indexOf("<")===-1)continue;if(r.test(s)||E.test(s)||f.test(s))l.push(s)}else if(s===""||s.startsWith("//"))continue;else break}return l}
4
- export{bn};
4
+ export{xn};
@@ -1,16 +1,16 @@
1
1
  // @bun
2
- import{f,ue}from"./chunk-a3apthex.js";import{Ft,Nt,n,Me,j}from"./chunk-8g4wk8mm.js";function g(t){if(t.includes(`
2
+ import{f,ue}from"./chunk-a3apthex.js";import{Nt,Bt,n,Me,j}from"./chunk-mp86smwc.js";function g(t){if(t.includes(`
3
3
  `))return`/**
4
4
  * ${t}
5
5
  */
6
6
  `;return`/** ${t} */
7
- `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function re(t,o=!0){return f(t.leadingComments,o)+t.text}function h(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?j(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Ft();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Nt();if(m)if(m.includes(`
7
+ `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function re(t,o=!0){return f(t.leadingComments,o)+t.text}function h(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?j(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Nt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Bt();if(m)if(m.includes(`
8
8
  `))u=`@defaultValue
9
9
  * \`\`\`ts
10
10
  ${m.split(`
11
11
  `).map((p)=>` * ${p}`).join(`
12
12
  `)}
13
- * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&Me(t.typeAnnotation)){Ft();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Nt();if(x)if(x.includes(`
13
+ * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&Me(t.typeAnnotation)){Nt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Bt();if(x)if(x.includes(`
14
14
  `))u=`@defaultValue
15
15
  * \`\`\`ts
16
16
  ${x.split(`
@@ -25,5 +25,5 @@ ${x.split(`
25
25
  * ${c.replace(/^\/\/\s*/,"")}
26
26
  * ${u}
27
27
  */
28
- ${e}`}if(u)return`${g(u)}${e}`;return s+e}function ie(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function se(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function oe(t,o=!0){return f(t.leadingComments,o)+t.text}function ae(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function Wn(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function _n(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function ce(t,o=!0){let s=f(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let l=t.text.indexOf("{");if(l!==-1)i+=` ${t.text.slice(l)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
29
- export{re,h,ie,se,oe,ae,Wn,_n,ce};
28
+ ${e}`}if(u)return`${g(u)}${e}`;return s+e}function ie(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function se(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function oe(t,o=!0){return f(t.leadingComments,o)+t.text}function ae(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function _n(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function jn(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function ce(t,o=!0){let s=f(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let l=t.text.indexOf("{");if(l!==-1)i+=` ${t.text.slice(l)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
29
+ export{re,h,ie,se,oe,ae,_n,jn,ce};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  var ge={PARSE_ERROR:"PARSE_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",FILE_NOT_FOUND:"FILE_NOT_FOUND",FILE_READ_ERROR:"FILE_READ_ERROR",FILE_WRITE_ERROR:"FILE_WRITE_ERROR",TYPE_INFERENCE_ERROR:"TYPE_INFERENCE_ERROR",UNRESOLVED_TYPE:"UNRESOLVED_TYPE",EXTRACTION_ERROR:"EXTRACTION_ERROR",PROCESSING_ERROR:"PROCESSING_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_DECLARATION:"INVALID_DECLARATION",CONFIG_ERROR:"CONFIG_ERROR",INVALID_ENTRYPOINT:"INVALID_ENTRYPOINT",CIRCULAR_DEPENDENCY:"CIRCULAR_DEPENDENCY",TIMEOUT_ERROR:"TIMEOUT_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",UNKNOWN_ERROR:"UNKNOWN_ERROR"};class v extends Error{code;context;constructor(n,e="UNKNOWN_ERROR",t){super(n);if(this.name="DtsxError",this.code=e,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(){let n=`${this.name} [${this.code}]: ${this.message}`;if(this.context)n+=`
3
- Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class xn extends v{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class ri extends v{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class ii extends v{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class wn extends v{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class Cn extends v{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class si extends v{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function fo(n){return n instanceof v}function po(n){return n instanceof xn}function mo(n){return n instanceof wn}function go(n){return n instanceof Cn}function ho(n,e="UNKNOWN_ERROR",t){if(n instanceof v)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new v(s,e);if(n instanceof Error)r.cause=n;return r}function yo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
3
+ Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class wn extends v{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class ri extends v{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class ii extends v{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class Cn extends v{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class vn extends v{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class si extends v{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function fo(n){return n instanceof v}function po(n){return n instanceof wn}function mo(n){return n instanceof Cn}function go(n){return n instanceof vn}function ho(n,e="UNKNOWN_ERROR",t){if(n instanceof v)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new v(s,e);if(n instanceof Error)r.cause=n;return r}function yo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
4
4
  `)t++,s=1;else s++;r++}return{line:t,column:s,offset:e}}function bo(n,e,t,s){let r=n.split(`
5
5
  `),i=e.line-1,o=[];if(s)o.push(`${s}:${e.line}:${e.column}`);else o.push(`Line ${e.line}, Column ${e.column}`);o.push(`Error: ${t}`),o.push("");let E=Math.max(0,i-1),c=Math.min(r.length-1,i+1);for(let a=E;a<=c;a++){let R=(a+1).toString().padStart(4," "),u=a===i?">":" ";if(o.push(`${u} ${R} | ${r[a]}`),a===i){let l=" ".repeat(8+e.column-1);o.push(`${l}^`)}}return o.join(`
6
- `)}function ze(n,e,t){let s={file:e,message:"Unknown error",code:ge.UNKNOWN_ERROR};if(n instanceof Error){s.message=n.message,s.stack=n.stack;let r=n.message.match(/\((\d+),(\d+)\)/);if(r)s.location={line:Number.parseInt(r[1],10),column:Number.parseInt(r[2],10)};if(n.message.includes("Cannot find")||n.message.includes("not found"))s.code=ge.FILE_NOT_FOUND,s.suggestion="Check that the file path is correct and the file exists.";else if(n.message.includes("syntax")||n.message.includes("Unexpected token"))s.code=ge.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=ge.TYPE_INFERENCE_ERROR,s.suggestion="Add explicit type annotations to help with type inference.";else if(n.message.includes("parse")||n.message.includes("Parse"))s.code=ge.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function bt(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
6
+ `)}function He(n,e,t){let s={file:e,message:"Unknown error",code:ge.UNKNOWN_ERROR};if(n instanceof Error){s.message=n.message,s.stack=n.stack;let r=n.message.match(/\((\d+),(\d+)\)/);if(r)s.location={line:Number.parseInt(r[1],10),column:Number.parseInt(r[2],10)};if(n.message.includes("Cannot find")||n.message.includes("not found"))s.code=ge.FILE_NOT_FOUND,s.suggestion="Check that the file path is correct and the file exists.";else if(n.message.includes("syntax")||n.message.includes("Unexpected token"))s.code=ge.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=ge.TYPE_INFERENCE_ERROR,s.suggestion="Add explicit type annotations to help with type inference.";else if(n.message.includes("parse")||n.message.includes("Parse"))s.code=ge.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function xt(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
7
7
  `),i=n.location.line-1;if(i>=0&&i<r.length){let o=Math.max(0,i-1),E=Math.min(r.length-1,i+1);for(let c=o;c<=E;c++){let a=(c+1).toString().padStart(4," "),R=c===i?">":" ";if(t.push(` ${R} ${a} | ${r[c]}`),c===i&&n.location.column>0){let u=" ".repeat(10+n.location.column-1);t.push(` ${u}^`)}}}}if(n.suggestion)t.push(""),t.push(` Suggestion: ${n.suggestion}`);return t.join(`
8
8
  `)}function xo(n){if(n.length===0)return"No errors";let e=new Map;for(let s of n){let r=s.code||"UNKNOWN";e.set(r,(e.get(r)||0)+1)}let t=[`${n.length} error(s) found:`];for(let[s,r]of e.entries())t.push(` - ${s}: ${r}`);return t.join(`
9
9
  `)}
10
- export{ge,v,xn,ri,ii,wn,Cn,si,fo,po,mo,go,ho,yo,bo,ze,bt,xo};
10
+ export{ge,v,wn,ri,ii,Cn,vn,si,fo,po,mo,go,ho,yo,bo,He,xt,xo};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";function me(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=me,sr=me,Pa=me;
2
+ import{s}from"./chunk-y83jhbpr.js";function me(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=me,sr=me,Pa=me;
3
3
  export{me,Aa,sr,Pa};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function We(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var va=We,Sa=We;
3
- export{We,va,Sa};
2
+ import{s}from"./chunk-y83jhbpr.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function _e(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var va=_e,Sa=_e;
3
+ export{_e,va,Sa};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{R,M}from"./chunk-xst4jpr9.js";import{P,D}from"./chunk-7k0e2h9b.js";import{p}from"./chunk-v6fwy63g.js";import{T,O}from"./chunk-aqcjv2v5.js";import{Te}from"./chunk-8pfyd95y.js";import{l}from"./chunk-rwwrrxtc.js";import{ye}from"./chunk-4q78f5pg.js";function ze(t,n,s,r,i){if(r.length!==1||r[0]!=="bun")return null;let o=R(n)?M(t):P(n)?D(t):t;return ye(o,{keepComments:s,isolatedDeclarations:i})}var S=100,h=0,c=new Map;function bt(t,n="stdin.ts",s=!0,r=["bun"],i=!1){let o=p(t),a=JSON.stringify([n,s,i,r]),g=c.get(a);if(g&&g.contentHash===o)return g.lastAccess=++h,g.result;let b=ze(t,n,s,r,i)??y(t,n,s,r,i);if(c.set(a,{result:b,contentHash:o,lastAccess:++h}),c.size>S){let x=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[e,f]of c)u.push([e,f.lastAccess]);u.sort((e,f)=>e[1]-f[1]);for(let e=0;e<x&&e<u.length;e++)c.delete(u[e][0])}return b}function ei(t,n="stdin.ts",s=!0,r=["bun"]){return bt(t,n,s,r,!0)}function ti(t,n="stdin.ts",s=!0,r=["bun"]){return bt(t,n,s,r,!1)}function y(t,n,s,r,i){let o=Te(t,n,s,i);return l(o,{filePath:n,sourceCode:t,declarations:o},s,r)}function ni(){c.clear()}function Da(t,n="stdin.ts",s=!0,r=["bun"],i=!1){return ze(t,n,s,r,i)??bn(t,n,s,r,i)}function bn(t,n="stdin.ts",s=!0,r=["bun"],i=!1){if(R(n))t=M(t);else if(P(n))t=D(t);let o=i?T(t,n,s):O(t,n,s);return l(o,{filePath:n,sourceCode:t,declarations:o},s,r)}
3
+ export{ze,bt,ei,ti,ni,Da,bn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var Jt=["builtin","external","internal","parent","sibling","index","type","unknown"];function Yt(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:pt(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:pt(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function pt(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function Xt(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=Jt,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=Yt(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Pr(e,i={}){let u=e.split(`
3
- `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=Xt(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
- `)}function Ps(e={}){return{sort:(i)=>Xt(i,e),sortContent:(i)=>Pr(i,e),parse:Yt,detectGroup:pt}}var Ds={default:{groupByType:!0,groups:Jt,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
- export{Jt,Yt,pt,Xt,Pr,Ps,Ds};
2
+ var Yt=["builtin","external","internal","parent","sibling","index","type","unknown"];function Xt(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:mt(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:mt(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function mt(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function Zt(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=Yt,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=Xt(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Pr(e,i={}){let u=e.split(`
3
+ `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=Zt(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
+ `)}function Ps(e={}){return{sort:(i)=>Zt(i,e),sortContent:(i)=>Pr(i,e),parse:Xt,detectGroup:mt}}var Ds={default:{groupByType:!0,groups:Yt,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
+ export{Yt,Xt,mt,Zt,Pr,Ps,Ds};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function ls(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
2
+ import{r}from"./chunk-3pcxxgwq.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function ls(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
3
3
  `);return{content:d,files:t,declarationCount:D,importCount:w,exportCount:S,size:Buffer.byteLength(d,"utf8"),warnings:[]}}function F(t){if(t.text){let n=t.text.trim();if(t.isExported&&!n.startsWith("export"))n=`export ${n}`;if(!n.endsWith(";")&&!n.endsWith("}"))n+=";";return n}let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${V(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 n of t.members)e.push(` ${n.name}${n.typeAnnotation?`: ${n.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&&t.implements.length>0)e.push(`implements ${t.implements.join(", ")}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${F(n)}`);e.push("}");break;case"enum":if(e.push("declare enum"),e.push(t.name),e.push("{"),t.members){let n=t.members.map((u)=>u.value!==void 0?`${u.name} = ${u.value}`:u.name);e.push(` ${n.join(`,
4
- `)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function Kt(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
4
+ `)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function qt(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
5
5
  `),m=[],d=0,i=!1;for(let o of b){let s=o.trim();if(!s&&!i)continue;if(s.startsWith("import ")){S++;let l=s.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(l){let[,h,W,q,H,A]=l;if(e.externals?.some((P)=>A.startsWith(P))){f.push(s);continue}if(A.startsWith("."))continue;if(!u.has(A))u.set(A,{source:A,specifiers:new Map,isTypeOnly:!!h,isSideEffect:!1});let E=u.get(A);if(W){let P=W.split(",").map((k)=>k.trim());for(let k of P){let[I,v]=k.split(/\s+as\s+/).map((M)=>M.trim()),R=I.startsWith("type "),O=R?I.replace("type ",""):I;E.specifiers.set(v||O,{name:O,alias:v!==O?v:void 0,isType:R})}}if(!h)E.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(s)){if(i=!0,m=[o],d=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d===0&&(s.endsWith(";")||!s.includes("{"))){let l=B(s);if(!D.has(l)||!e.mergeDuplicates){if(D.add(l),f.push(o),w++,s.startsWith("export"))C++}i=!1,m=[]}}else if(i){if(m.push(o),d+=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d<=0){let l=m.join(`
6
6
  `),h=B(m[0]);if(!D.has(h)||!e.mergeDuplicates){if(D.add(h),f.push(l),w++,m[0].trim().startsWith("export"))C++}i=!1,m=[]}}else if(s.startsWith("export ")&&!s.includes("declare"))f.push(o),C++}}let a=[];if(e.banner)a.push(e.banner),a.push("");if(e.includeReferences&&e.references){for(let p of e.references)a.push(`/// <reference types="${p}" />`);a.push("")}let T=Array.from(u.values()).sort((p,g)=>p.source.localeCompare(g.source));for(let p of T)if(p.specifiers.size>0){let b=Array.from(p.specifiers.values()).map((d)=>{let i=d.isType?"type ":"";return d.alias?`${i}${d.name} as ${d.alias}`:`${i}${d.name}`}),m=p.isTypeOnly?"type ":"";a.push(`import ${m}{ ${b.join(", ")} } from '${p.source}';`)}if(T.length>0)a.push("");if(e.ambient&&e.moduleName){a.push(`declare module '${e.moduleName}' {`);for(let p of f){let g=p.split(`
7
7
  `).map((b)=>` ${b.replace(/^(\s*)(export\s+)?declare\s+/,"$1$2")}`).join(`
8
8
  `);a.push(g)}a.push("}")}else{if(e.sortDeclarations)f.sort((p,g)=>{let b=B(p),m=B(g);return b.localeCompare(m)});for(let p of f)a.push(p)}if(e.footer)a.push(""),a.push(e.footer);let y=a.join(`
9
- `);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function wr(t,e,n={}){let u=await Kt(t,n),f=K(e);if(!j(f))N(f,{recursive:!0});return G(e,u.content),u}function us(t={}){return{bundle:(e)=>Kt(e,t),bundleAndWrite:(e,n)=>wr(e,n,{...t,output:n})}}async function fs(t,e=process.cwd()){let n=Array.isArray(t)?t:[t],u=[];for(let f of n){if(f.includes("*"))continue;let x=_(e,f);if(j(x))u.push(x)}return u}
10
- export{ls,Kt,wr,us,fs};
9
+ `);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function wr(t,e,n={}){let u=await qt(t,n),f=K(e);if(!j(f))N(f,{recursive:!0});return G(e,u.content),u}function us(t={}){return{bundle:(e)=>qt(e,t),bundleAndWrite:(e,n)=>wr(e,n,{...t,output:n})}}async function fs(t,e=process.cwd()){let n=Array.isArray(t)?t:[t],u=[];for(let f of n){if(f.includes("*"))continue;let x=_(e,f);if(j(x))u.push(x)}return u}
10
+ export{ls,qt,wr,us,fs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{c,i,Ne,de}from"./chunk-8kj9pkw5.js";import{t,d,Fe,m}from"./chunk-g0dxj89b.js";import{Le}from"./chunk-ywv56grs.js";import{tr}from"./chunk-73qsp464.js";import{Yn}from"./chunk-fv3x086v.js";import{_,qn}from"./chunk-zf96k060.js";import{Bn}from"./chunk-7g0hjhqy.js";import{Oe,fe,Ie}from"./chunk-8wk7nw3c.js";import{z,it,n,I,L,Jn,Wt,Re,j}from"./chunk-8g4wk8mm.js";import{Nn}from"./chunk-w8ws29dq.js";import{h}from"./chunk-qnwcsmsg.js";import{jn}from"./chunk-df8p90w4.js";function Ei(S,Z,H,G,te=""){let ne=new Map,f={start:0,end:S.length,header:0,name:"",children:[],results:new Map},K=t(S),me=[],g=[],ce=[],P=new Map;for(let e=0;e<K.length;e++){let le=K[e];if(le.kind!=="punctuation")continue;let he=S.slice(le.start,le.end);if(he==="(")ce.push(e);else if(he===")"){let ue=ce.pop();if(ue!==void 0)P.set(e,ue)}else if(he==="{")g.push(e);else if(he==="}"){let ue=g.pop();if(ue===void 0)continue;let se=K[ue].start,Y=ue-1,ee=Y>=0?S.slice(K[Y].start,K[Y].end):"";if(ee===")"){let V=P.get(Y);if(V!==void 0&&V>0&&["if","for","while","switch","catch","with"].includes(S.slice(K[V-1].start,K[V-1].end)))se=K[V-1].start}else if(["else","try","finally","do"].includes(ee))se=K[Y].start;me.push({open:K[ue].start,close:le.start,header:se})}}let ae=0,Q=(e,le=new Set)=>{let he=new Set(le),ue=t(S.slice(e.start,e.end)),se=0;for(let re=0;re+1<ue.length;re++){let qe=S.slice(e.start+ue[re].start,e.start+ue[re].end);if(qe==="{")se++;else if(qe==="}")se--;else if(!se&&["type","interface"].includes(qe))he.add(S.slice(e.start+ue[re+1].start,e.start+ue[re+1].end))}let Y="",ee=e.start,V=[...e.results].map(([re,qe])=>({type:re,name:qe}));for(let re of e.children.sort((qe,Ge)=>qe.header-Ge.header)){let qe=Q(re,he);Y+=S.slice(ee,re.header)+`
2
+ import{c,i,Be,de}from"./chunk-rz5jszhe.js";import{t,d,Ne,m}from"./chunk-m9x72e5j.js";import{Fe}from"./chunk-b2j236p3.js";import{tr}from"./chunk-1hhk0zm6.js";import{Xn}from"./chunk-n1p62kwx.js";import{_,Jn}from"./chunk-23w57jk5.js";import{Wn}from"./chunk-ksc4xgdz.js";import{Oe,fe,Ie}from"./chunk-ep3575a9.js";import{z,st,n,I,L,Yn,_t,Re,j}from"./chunk-mp86smwc.js";import{Bn}from"./chunk-bhqpdftq.js";import{h}from"./chunk-9dkjzqm0.js";import{Gn}from"./chunk-pebt9j6c.js";function Ei(S,Z,H,G,te=""){let ne=new Map,f={start:0,end:S.length,header:0,name:"",children:[],results:new Map},K=t(S),me=[],g=[],ce=[],P=new Map;for(let e=0;e<K.length;e++){let le=K[e];if(le.kind!=="punctuation")continue;let he=S.slice(le.start,le.end);if(he==="(")ce.push(e);else if(he===")"){let ue=ce.pop();if(ue!==void 0)P.set(e,ue)}else if(he==="{")g.push(e);else if(he==="}"){let ue=g.pop();if(ue===void 0)continue;let se=K[ue].start,Y=ue-1,ee=Y>=0?S.slice(K[Y].start,K[Y].end):"";if(ee===")"){let V=P.get(Y);if(V!==void 0&&V>0&&["if","for","while","switch","catch","with"].includes(S.slice(K[V-1].start,K[V-1].end)))se=K[V-1].start}else if(["else","try","finally","do"].includes(ee))se=K[Y].start;me.push({open:K[ue].start,close:le.start,header:se})}}let ae=0,Q=(e,le=new Set)=>{let he=new Set(le),ue=t(S.slice(e.start,e.end)),se=0;for(let re=0;re+1<ue.length;re++){let qe=S.slice(e.start+ue[re].start,e.start+ue[re].end);if(qe==="{")se++;else if(qe==="}")se--;else if(!se&&["type","interface"].includes(qe))he.add(S.slice(e.start+ue[re+1].start,e.start+ue[re+1].end))}let Y="",ee=e.start,V=[...e.results].map(([re,qe])=>({type:re,name:qe}));for(let re of e.children.sort((qe,Ge)=>qe.header-Ge.header)){let qe=Q(re,he);Y+=S.slice(ee,re.header)+`
3
3
  declare namespace ${re.name} {
4
4
  ${qe.text}
5
5
  }
@@ -9,12 +9,12 @@ ${V.map((re)=>`export type ${re.name} = ${re.type};`).join(`
9
9
  `)}`;let ze=O(Y,Z,!1);for(let re of V)he.add(re.name);let ie=te?Bt(te).map((re,qe)=>[re,`${xe}_capture_${qe}`]):[],x=ze.map((re)=>te&&["type","interface"].includes(re.kind)?vn(re,te,ie,he):(re.kind==="variable"?h(re,!1):re.text).replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
10
10
  `);return{declarations:ze,text:x,exports:V}},xe;return{resolve(e,le){xe??=H();let he=f;for(let se of me.filter((Y)=>Y.open<le&&le<Y.close).sort((Y,ee)=>Y.open-ee.open)){let Y=he.children.find((ee)=>ee.start===se.open+1);if(!Y)Y={start:se.open+1,end:se.close,header:se.header,name:`${xe}_scope_${ae++}`,children:[],results:new Map},he.children.push(Y);he=Y}let ue=he.results.get(e);if(!ue)ue=`${xe}_result_${ne.size}`,he.results.set(e,ue),ne.set(ue,e);return`${xe}.${ue}`},finish(e){if(!xe)return e;let le=Q(f),he=le.declarations,ue=new Set(ne.keys());if(he.every((Y)=>ue.has(Y.name))){let Y=new Map(ne),ee=t(e),V="",ze=0;for(let ie=0;ie+2<ee.length;ie++){if(e.slice(ee[ie].start,ee[ie].end)!==xe||e.slice(ee[ie+1].start,ee[ie+1].end)!==".")continue;let x=Y.get(e.slice(ee[ie+2].start,ee[ie+2].end));if(!x)continue;V+=e.slice(ze,ee[ie].start)+`(${x})`,ze=ee[ie+2].end,ie+=2}return V+e.slice(ze)}if(te){let Y=Bt(te).join(", "),ee=t(e),V="",ze=0;for(let ie=0;ie+2<ee.length;ie++){if(e.slice(ee[ie].start,ee[ie].end)!==xe||e.slice(ee[ie+1].start,ee[ie+1].end)!=="."||!ue.has(e.slice(ee[ie+2].start,ee[ie+2].end)))continue;V+=`${e.slice(ze,ee[ie+2].end)}<${Y}>`,ze=ee[ie+2].end,ie+=2}e=V+e.slice(ze)}let se=le.text;return G({kind:"module",name:xe,text:`declare namespace ${xe} {
11
11
  ${se}
12
- }`,moduleForm:"namespace",isExported:!1}),e}}}function Bt(S){let Z=t(S),H=[],G=0,te=0,ne=!1;for(let f of Z){let K=S.slice(f.start,f.end);if(K==="<"){if(G++,G===1)ne=!0}else if(K===">"&&S[f.start-1]!=="=")G--;else if(["(","[","{"].includes(K))te++;else if([")","]","}"].includes(K))te--;else if(K===","&&G===1&&!te)ne=!0;else if(ne&&f.kind==="word"&&!["const","in","out"].includes(K))H.push(K),ne=!1}return H}function vn(S,Z,H,G){let te=new Set(Bt(S.generics||"")),ne=(Q,xe,e)=>{let le=t(Q),he="",ue=0;for(let se=0;se<le.length;se++){let Y=le[se],ee=Q.slice(Y.start,Y.end),V=le[se+1]&&Q.slice(le[se+1].start,le[se+1].end),ze=le[se+2]&&Q.slice(le[se+2].start,le[se+2].end),ie=le[se-1]&&Q.slice(le[se-1].start,le[se-1].end);if(Y.kind!=="word"||V===":"||V==="?"&&ze===":")continue;let x=!e.has(ee)&&ie!=="."&&H.find(([re])=>re===ee)?.[1];if(x)he+=Q.slice(ue,Y.start)+x,ue=Y.end;else if(xe&&G.has(ee)&&!e.has(ee)){let re=H.map(([,qe])=>qe).join(", ");he+=`${Q.slice(ue,Y.end)}<${re}${V==="<"?", ":">"}`,ue=V==="<"?le[++se].end:Y.end}}return he+Q.slice(ue)},f=t(S.text),K=f.findIndex((Q)=>["type","interface"].includes(S.text.slice(Q.start,Q.end))),me=f[K+1],g=S.generics||"",ce=g?S.text.indexOf(g,me.end)+g.length:me.end,P=ne(Sn(Z),!1,new Set),ae=g?`, ${ne(g.slice(1,-1),!0,te)}`:"";return`${S.text.slice(0,me.end)}<${P}${ae}>${ne(S.text.slice(ce),!0,te)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function Sn(S){let Z=S.slice(1,-1),H=t(Z),G=0,te=0,ne=!1,f="";for(let K=0;K<H.length;K++){let me=H[K],g=Z.slice(me.start,me.end);if(["(","[","{","<"].includes(g))G++;else if([")","]","}"].includes(g)||g===">"&&Z[me.start-1]!=="=")G--;else if(!G&&g==="const")f+=Z.slice(te,me.start),te=me.end;else if(!G&&g==="="&&Z.slice(H[K+1]?.start,H[K+1]?.end)!==">")f+=Z.slice(te,me.start),ne=!0;else if(!G&&g===","&&ne)te=me.start,ne=!1}return f+(ne?"":Z.slice(te))}var He=32,je=9,be=10,ve=13,F=47,we=42,pe=39,Ae=34,Ee=96,Qe=92,W=123,U=125,X=40,ge=41,Se=91,_e=93,ke=60,Ce=62,J=59,Ze=58,$e=61,Je=44,Ye=46,$t=63,on=35,Dn=64,Tn=36;function We(S){return S===He||S===je||S===be||S===ve}function In(S){let Z=!0;for(let H=0;H<S.length;H++){let G=S.charCodeAt(H);if(G===Ye){if(Z)return!1;Z=!0}else if(Z){if(!c(G))return!1;Z=!1}else if(!i(G))return!1}return S.length>0&&!Z}function pt(S,Z,H){let G=Z+1;while(G<S.length){let te=S.charCodeAt(G);if(te===Qe){G+=2;continue}if(G++,te===H)break}return G}function _n(S){if(S==="any"||S==="object"||S==="unknown")return!0;if(S.startsWith("Record<")||S.startsWith("Array<"))return!0;return S.charCodeAt(0)===W&&S.includes("[")&&S.includes("]:")}var Ht=["public","protected","private","readonly","override"];function Ra(S,Z,H=!0,G=!1){return G?T(S,Z,H):O(S,Z,H)}function T(S,Z,H=!0){return Nt(S,Z,H,!0)}function O(S,Z,H=!0,G){return Nt(S,Z,H,!1,!1,G)}function It(S,Z,H=!0){return Nt(S,Z,H,!0,!0)}function Nt(S,Z,H,G,te=!1,ne){let f=S,K=H,me=G,g=f.length,ce=_(f),P=[],ae=new Map,Q=new Map,xe=new Set,e=0,le=0,he=[];function ue(s){let o=/^this\.([\w$]+)$/.exec(s);if(o){let C=he.at(-1);return C?.fields.get(`${C.isStatic?"static:":""}${o[1]}`)}let r=/^([\w$]+)\s*\(/.exec(s);if(!r||!s.endsWith(")"))return;let a=t(s),l=0;for(let C=1;C<a.length;C++){let A=s.slice(a[C].start,a[C].end);if(A==="(")l++;else if(A===")"&&--l===0&&C!==a.length-1)return}let u=[...P,...ae.values()].filter((C)=>C.kind==="function"&&C.name===r[1]);if(u.length!==1||u[0].generics||Le(f,r[1])!==1)return;return u[0].returnType}function se(s){let o=s.trim(),r=ue(o);if(r)return r;if(!o.startsWith("class"))return;let a=t(o);if(a[0]?.kind!=="word"||o.slice(a[0].start,a[0].end)!=="class")return;let l;do l=`__dtsx_class_${le++}`;while(f.includes(l));let u=a[1],C=u?o.slice(u.start,u.end):"",A=u?.kind==="word"&&!["extends","implements"].includes(C),b=A?C:`${l}_value`,p=A?`export ${o}`:`export class ${b} ${o.slice(5)}`,k=O(p,Z,K),D=k.find((y)=>y.kind==="class");if(!D)throw Error("Cannot extract the class expression declaration");if(t(p.slice(D.end??p.length)).some((y)=>p.slice((D.end??0)+y.start,(D.end??0)+y.end)!==";"))return;let M=k.map((y)=>y.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
12
+ }`,moduleForm:"namespace",isExported:!1}),e}}}function Bt(S){let Z=t(S),H=[],G=0,te=0,ne=!1;for(let f of Z){let K=S.slice(f.start,f.end);if(K==="<"){if(G++,G===1)ne=!0}else if(K===">"&&S[f.start-1]!=="=")G--;else if(["(","[","{"].includes(K))te++;else if([")","]","}"].includes(K))te--;else if(K===","&&G===1&&!te)ne=!0;else if(ne&&f.kind==="word"&&!["const","in","out"].includes(K))H.push(K),ne=!1}return H}function vn(S,Z,H,G){let te=new Set(Bt(S.generics||"")),ne=(Q,xe,e)=>{let le=t(Q),he="",ue=0;for(let se=0;se<le.length;se++){let Y=le[se],ee=Q.slice(Y.start,Y.end),V=le[se+1]&&Q.slice(le[se+1].start,le[se+1].end),ze=le[se+2]&&Q.slice(le[se+2].start,le[se+2].end),ie=le[se-1]&&Q.slice(le[se-1].start,le[se-1].end);if(Y.kind!=="word"||V===":"||V==="?"&&ze===":")continue;let x=!e.has(ee)&&ie!=="."&&H.find(([re])=>re===ee)?.[1];if(x)he+=Q.slice(ue,Y.start)+x,ue=Y.end;else if(xe&&G.has(ee)&&!e.has(ee)){let re=H.map(([,qe])=>qe).join(", ");he+=`${Q.slice(ue,Y.end)}<${re}${V==="<"?", ":">"}`,ue=V==="<"?le[++se].end:Y.end}}return he+Q.slice(ue)},f=t(S.text),K=f.findIndex((Q)=>["type","interface"].includes(S.text.slice(Q.start,Q.end))),me=f[K+1],g=S.generics||"",ce=g?S.text.indexOf(g,me.end)+g.length:me.end,P=ne(Sn(Z),!1,new Set),ae=g?`, ${ne(g.slice(1,-1),!0,te)}`:"";return`${S.text.slice(0,me.end)}<${P}${ae}>${ne(S.text.slice(ce),!0,te)}`.replace(/^export\s+/,"").replace(/^declare\s+/,"")}function Sn(S){let Z=S.slice(1,-1),H=t(Z),G=0,te=0,ne=!1,f="";for(let K=0;K<H.length;K++){let me=H[K],g=Z.slice(me.start,me.end);if(["(","[","{","<"].includes(g))G++;else if([")","]","}"].includes(g)||g===">"&&Z[me.start-1]!=="=")G--;else if(!G&&g==="const")f+=Z.slice(te,me.start),te=me.end;else if(!G&&g==="="&&Z.slice(H[K+1]?.start,H[K+1]?.end)!==">")f+=Z.slice(te,me.start),ne=!0;else if(!G&&g===","&&ne)te=me.start,ne=!1}return f+(ne?"":Z.slice(te))}var He=32,je=9,be=10,ve=13,F=47,we=42,pe=39,Ae=34,Ee=96,Qe=92,W=123,U=125,X=40,ge=41,Se=91,_e=93,ke=60,Ce=62,J=59,Ze=58,$e=61,Je=44,Ye=46,$t=63,on=35,Dn=64,Tn=36;function We(S){return S===He||S===je||S===be||S===ve}function In(S){let Z=!0;for(let H=0;H<S.length;H++){let G=S.charCodeAt(H);if(G===Ye){if(Z)return!1;Z=!0}else if(Z){if(!c(G))return!1;Z=!1}else if(!i(G))return!1}return S.length>0&&!Z}function pt(S,Z,H){let G=Z+1;while(G<S.length){let te=S.charCodeAt(G);if(te===Qe){G+=2;continue}if(G++,te===H)break}return G}function _n(S){if(S==="any"||S==="object"||S==="unknown")return!0;if(S.startsWith("Record<")||S.startsWith("Array<"))return!0;return S.charCodeAt(0)===W&&S.includes("[")&&S.includes("]:")}var Ht=["public","protected","private","readonly","override"];function Ra(S,Z,H=!0,G=!1){return G?T(S,Z,H):O(S,Z,H)}function T(S,Z,H=!0){return Nt(S,Z,H,!0)}function O(S,Z,H=!0,G){return Nt(S,Z,H,!1,!1,G)}function Lt(S,Z,H=!0){return Nt(S,Z,H,!0,!0)}function Nt(S,Z,H,G,te=!1,ne){let f=S,K=H,me=G,g=f.length,ce=_(f),P=[],ae=new Map,Q=new Map,xe=new Set,e=0,le=0,he=[];function ue(s){let o=/^this\.([\w$]+)$/.exec(s);if(o){let C=he.at(-1);return C?.fields.get(`${C.isStatic?"static:":""}${o[1]}`)}let r=/^([\w$]+)\s*\(/.exec(s);if(!r||!s.endsWith(")"))return;let a=t(s),l=0;for(let C=1;C<a.length;C++){let A=s.slice(a[C].start,a[C].end);if(A==="(")l++;else if(A===")"&&--l===0&&C!==a.length-1)return}let u=[...P,...ae.values()].filter((C)=>C.kind==="function"&&C.name===r[1]);if(u.length!==1||u[0].generics||Fe(f,r[1])!==1)return;return u[0].returnType}function se(s){let o=s.trim(),r=ue(o);if(r)return r;if(!o.startsWith("class"))return;let a=t(o);if(a[0]?.kind!=="word"||o.slice(a[0].start,a[0].end)!=="class")return;let l;do l=`__dtsx_class_${le++}`;while(f.includes(l));let u=a[1],C=u?o.slice(u.start,u.end):"",A=u?.kind==="word"&&!["extends","implements"].includes(C),b=A?C:`${l}_value`,p=A?`export ${o}`:`export class ${b} ${o.slice(5)}`,k=O(p,Z,K),D=k.find((y)=>y.kind==="class");if(!D)throw Error("Cannot extract the class expression declaration");if(t(p.slice(D.end??p.length)).some((y)=>p.slice((D.end??0)+y.start,(D.end??0)+y.end)!==";"))return;let M=k.map((y)=>y.text.replace(/^export\s+/,"").replace(/^declare\s+/,"")).join(`
13
13
  `);return ae.set(l,{kind:"module",name:l,text:`declare namespace ${l} {
14
14
  ${M}
15
- }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${b}`}function Y(s,o){let r=/^this\.([\w$]+)$/.exec(s);if(r)return he.at(-1)?.fields.get(`${o?"static:":""}${r[1]}`);return se(s)}function ee(s){let o=Q.get(s.name);if(o)o.push(s);else Q.set(s.name,[s]);ae.set(s.name,s)}if(e<g&&f.charCodeAt(e)===65279)e++;function V(s,o){if(s<o){let r=f.charCodeAt(s),a=f.charCodeAt(o-1);if(r!==He&&r!==je&&r!==be&&r!==ve&&a!==He&&a!==je&&a!==be&&a!==ve)return f.slice(s,o)}while(s<o&&We(f.charCodeAt(s)))s++;while(o>s&&We(f.charCodeAt(o-1)))o--;return f.slice(s,o)}let ze=/[\r\n]/g;function ie(s){return ze.lastIndex=s,ze.exec(f)?.index??g}function x(){if(e>=g)return;let s=f.charCodeAt(e);if(s!==He&&s!==je&&s!==be&&s!==ve&&s!==F)return;while(e<g){let o=f.charCodeAt(e);if(o===He||o===je||o===be||o===ve){e++;continue}if(o===F&&e+1<g){let r=f.charCodeAt(e+1);if(r===F){e=ie(e+2);continue}if(r===we){let a=f.indexOf("*/",e+2);e=a===-1?g:a+2;continue}}break}}function re(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let o=0,r=0;while(r<s.length){let a=s.charCodeAt(r);if(a===pe||a===Ae||a===Ee){r=pt(s,r,a),o=r;continue}if(a===Qe){r+=2,o=Math.min(r,s.length);continue}if(a===F&&s.charCodeAt(r+1)===F){while(r<s.length&&s.charCodeAt(r)!==be&&s.charCodeAt(r)!==ve)r++;continue}if(a===F&&s.charCodeAt(r+1)===we){let l=s.indexOf("*/",r+2);r=l===-1?s.length:l+2;continue}if(r++,a>32)o=r}return o<s.length?s.slice(0,o).trimEnd():s}function qe(s){let o=s.length,r=0,a=o;for(let l=0;l<o;l++){let u=s.charCodeAt(l);if(r){if(u===Qe){l++;continue}if(u===r)r=0;continue}if(u===pe||u===Ae||u===Ee){r=u;continue}if(u===F&&l+1<o){let C=s.charCodeAt(l+1);if(C===F){a=l;while(a>0&&(s.charCodeAt(a-1)===He||s.charCodeAt(a-1)===je))a--;return s.slice(0,a)}if(C===we){let A=s.indexOf("*/",l+2);if(A!==-1){s=`${s.slice(0,l)} ${s.slice(A+2)}`,l--;continue}}}}a=o;while(a>0&&(s.charCodeAt(a-1)===He||s.charCodeAt(a-1)===je||s.charCodeAt(a-1)===ve))a--;return a<o?s.slice(0,a):s}function Ge(s){e++;let o=s===pe?"'":'"';while(e<g){let r=f.indexOf(o,e);if(r===-1){e=g;return}let a=0,l=r-1;while(l>=0&&f.charCodeAt(l)===Qe)a++,l--;if(a%2===0){e=r+1;return}e=r+1}}function lt(){e++;let s=[];while(e<g){let o=f.charCodeAt(e);if(s.length===0){if(o===Qe){e+=2;continue}if(o===Ee){e++;return}if(o===Tn&&e+1<g&&f.charCodeAt(e+1)===W){e+=2,s.push(0);continue}e++;continue}if(o===pe||o===Ae){Ge(o);continue}if(o===Ee){lt();continue}if(o===F&&e+1<g){let r=f.charCodeAt(e+1);if(r===F){e=ie(e+2);continue}if(r===we){let a=f.indexOf("*/",e+2);e=a===-1?g:a+2;continue}if(jt()){qt();continue}e++;continue}if(o===W){s[s.length-1]++,e++;continue}if(o===U){let r=s[s.length-1];if(r===0){s.pop(),e++;continue}s[s.length-1]=r-1,e++;continue}e++}}let xt=!1;function Be(){xt=!1;let s=f.charCodeAt(e);if(s===pe||s===Ae)return Ge(s),!0;if(s===Ee)return lt(),!0;if(s===F&&e+1<g){let o=f.charCodeAt(e+1);if(o===F)return e=ie(e+2),!0;if(o===we){let r=f.indexOf("*/",e+2);return xt=ie(e+2)<(r===-1?g:r),e=r===-1?g:r+2,!0}if(jt())return qt(),!0}return!1}function jt(){return Ne(f,e)}function qt(){e=de(f,e)}function Te(){let s=e;while(e<g&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function w(s){if(e+s.length>g)return!1;for(let o=0;o<s.length;o++)if(f.charCodeAt(e+o)!==s.charCodeAt(o))return!1;if(e+s.length<g&&i(f.charCodeAt(e+s.length)))return!1;return!0}function mt(s){let o=e+s;while(o<g){let r=f.charCodeAt(o);if(r===He||r===je||r===be||r===ve){o++;continue}return r!==Ye&&r!==$e}return!1}function yt(){if(!xt)return!1;let s=e;x();let o=e>=g||vt()||f.charCodeAt(e)===U;return e=s,o}function vt(){if(e>=g)return!1;switch(f.charCodeAt(e)){case 101:return w("export")||w("enum");case 105:return w("import")||w("interface");case 102:return w("function");case 99:return w("class")||w("const");case 116:return w("type");case 108:return w("let");case 118:return w("var");case 100:return w("declare")||w("default");case 109:return w("module");case 110:return w("namespace");case 97:return w("abstract")||w("async");default:return!1}}function st(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;let o=e;if(e++,s===ve&&e<g&&f.charCodeAt(e)===be)e++;while(e<g){let a=f.charCodeAt(e);if(a===He||a===je||a===ve||a===be){e++;continue}if(a===F&&e+1<g){let l=f.charCodeAt(e+1);if(l===F){e=ie(e+2);continue}if(l===we){let u=f.indexOf("*/",e+2);e=u===-1?g:u+2;continue}}break}let r=e>=g||vt()||f.charCodeAt(e)===U;return e=o,r}function zt(s){let o=s-1;while(o>=0){let b=f.charCodeAt(o);if(b===He||b===je||b===ve||b===be){o--;continue}break}if(o<0)return!0;let r=f[o];if("+-*/%=<>&|^!~?:,.([{".includes(r))return!0;let a=o;while(a>0&&f.charCodeAt(a-1)!==be)a--;let l=f.slice(a,o+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let C=o;while(C>=0&&/[a-z]/i.test(f[C]))C--;let A=f.slice(C+1,o+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(A)}function ln(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;if(zt(e))return!1;let o=e;e++;while(e<g){let u=f.charCodeAt(e);if(u===He||u===je||u===ve||u===be){e++;continue}if(u===F&&e+1<g){let C=f.charCodeAt(e+1);if(C===F){e=ie(e+2);continue}if(C===we){let A=f.indexOf("*/",e+2);e=A===-1?g:A+2;continue}}break}let r=e<g?f[e]:"",a=f.slice(e,e+2),l=r==="."||r==="?"||r===":"||r===")"||r==="]"||r==="}"||r===","||r==="+"||r==="-"||r==="*"||r==="/"||r==="%"||r==="<"||r===">"||r==="="||r==="&"||r==="|"||r==="^"||r==="`"||a==="=>"||w("as")||w("satisfies")||w("instanceof")||w("in");return e=o,!l}function Ft(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;if(zt(e))return!1;let o=e;e++;while(e<g){let l=f.charCodeAt(e);if(l===He||l===je||l===ve||l===be){e++;continue}if(l===F&&e+1<g){let u=f.charCodeAt(e+1);if(u===F){e=ie(e+2);continue}if(u===we){let C=f.indexOf("*/",e+2);e=C===-1?g:C+2;continue}}break}let r=e<g?f[e]:"",a=r==="|"||r==="&"||r==="["||r==="."||r==="?"||r===":"||r===">"||r===")"||r===","||w("extends");return e=o,!a}function ft(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;let o=e;if(e++,s===ve&&e<g&&f.charCodeAt(e)===be)e++;while(e<g){let a=f.charCodeAt(e);if(a===He||a===je||a===ve||a===be){e++;continue}if(a===F&&e+1<g&&f.charCodeAt(e+1)===F){e=ie(e+2);continue}break}if(e>=g)return e=o,!0;let r=f.charCodeAt(e);if(r===124||r===38||r===Ye||r===$t||r===Ze)return e=o,!1;if(w("extends")||w("keyof")||w("typeof")||w("infer")||w("is")||w("as")||w("in"))return e=o,!1;return e=o,!0}let fn=/[{}'"`\/]/g,dn=/[()'"`\/]/g,un=/[[\]'"`\/]/g,hn=/[<>'"`\/]/g;function Pe(s,o){let r=1;e++;let a=s===W?fn:s===X?dn:s===Se?un:hn;a.lastIndex=e;let l;while((l=a.exec(f))!==null){let u=l.index,C=f.charCodeAt(u);if(C===pe||C===Ae){e=u,Ge(C),a.lastIndex=e;continue}if(C===Ee){e=u,lt(),a.lastIndex=e;continue}if(C===F){if(e=u,Be()){a.lastIndex=e;continue}a.lastIndex=u+1;continue}if(C===s)r++;else if(C===o){if(o===Ce&&u>0&&f.charCodeAt(u-1)===$e){a.lastIndex=u+1;continue}if(r--,r===0)return e=u+1,e}a.lastIndex=u+1}return e=g,e}function Ue(){return e>0&&f.charCodeAt(e-1)===$e}function St(){return e+1<g&&f.charCodeAt(e+1)===Ce}let Ke=/[<{};'"`\/\n\r()[\]]/g;function Me(s=!1){let o=0,r=0,a=0,l=0,u=f.charCodeAt(e)===W;Ke.lastIndex=e;let C;while((C=Ke.exec(f))!==null){let A=C.index,b=f.charCodeAt(A);if(b===pe||b===Ae){e=A,Ge(b),Ke.lastIndex=e;continue}if(b===Ee){e=A,lt(),Ke.lastIndex=e;continue}if(b===F){if(A>0&&f.charCodeAt(A-1)===ke){Ke.lastIndex=A+1;continue}if(e=A,Be()){if(o===0&&r===0&&a===0&&l===0&&yt())return;Ke.lastIndex=e;continue}Ke.lastIndex=A+1;continue}if(b===ke){let p=Jt(A);if(p!==null)l=Math.max(0,l+p);Ke.lastIndex=A+1;continue}if(b===X){r++,Ke.lastIndex=A+1;continue}if(b===ge){r--,Ke.lastIndex=A+1;continue}if(b===Se){a++,Ke.lastIndex=A+1;continue}if(b===_e){a--,Ke.lastIndex=A+1;continue}if(b===W){o++,Ke.lastIndex=A+1;continue}if(b===U){let p=o>0;if(!p&&s&&r===0&&a===0&&l===0){e=A;return}if(p)o--;if((!p||u)&&o===0&&r===0&&a===0&&l===0){e=A+1;return}if(p&&o===0&&r===0&&a===0&&l===0){e=A+1;let k=e;x();let D=vt();if(e=k,D)return}Ke.lastIndex=A+1;continue}if(b===J&&o===0&&r===0&&a===0&&l===0){e=A+1;return}if((b===be||b===ve)&&o===0&&r===0&&a===0&&l===0){if(e=A,st())return}Ke.lastIndex=A+1}e=g}function pn(){e++;while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;let s=f.indexOf(`
15
+ }`,moduleForm:"namespace",isExported:!1,start:e,end:e}),`typeof ${l}.${b}`}function Y(s,o){let r=/^this\.([\w$]+)$/.exec(s);if(r)return he.at(-1)?.fields.get(`${o?"static:":""}${r[1]}`);return se(s)}function ee(s){let o=Q.get(s.name);if(o)o.push(s);else Q.set(s.name,[s]);ae.set(s.name,s)}if(e<g&&f.charCodeAt(e)===65279)e++;function V(s,o){if(s<o){let r=f.charCodeAt(s),a=f.charCodeAt(o-1);if(r!==He&&r!==je&&r!==be&&r!==ve&&a!==He&&a!==je&&a!==be&&a!==ve)return f.slice(s,o)}while(s<o&&We(f.charCodeAt(s)))s++;while(o>s&&We(f.charCodeAt(o-1)))o--;return f.slice(s,o)}let ze=/[\r\n]/g;function ie(s){return ze.lastIndex=s,ze.exec(f)?.index??g}function x(){if(e>=g)return;let s=f.charCodeAt(e);if(s!==He&&s!==je&&s!==be&&s!==ve&&s!==F)return;while(e<g){let o=f.charCodeAt(e);if(o===He||o===je||o===be||o===ve){e++;continue}if(o===F&&e+1<g){let r=f.charCodeAt(e+1);if(r===F){e=ie(e+2);continue}if(r===we){let a=f.indexOf("*/",e+2);e=a===-1?g:a+2;continue}}break}}function re(s){if(s.indexOf("//")===-1&&s.indexOf("/*")===-1)return s;let o=0,r=0;while(r<s.length){let a=s.charCodeAt(r);if(a===pe||a===Ae||a===Ee){r=pt(s,r,a),o=r;continue}if(a===Qe){r+=2,o=Math.min(r,s.length);continue}if(a===F&&s.charCodeAt(r+1)===F){while(r<s.length&&s.charCodeAt(r)!==be&&s.charCodeAt(r)!==ve)r++;continue}if(a===F&&s.charCodeAt(r+1)===we){let l=s.indexOf("*/",r+2);r=l===-1?s.length:l+2;continue}if(r++,a>32)o=r}return o<s.length?s.slice(0,o).trimEnd():s}function qe(s){let o=s.length,r=0,a=o;for(let l=0;l<o;l++){let u=s.charCodeAt(l);if(r){if(u===Qe){l++;continue}if(u===r)r=0;continue}if(u===pe||u===Ae||u===Ee){r=u;continue}if(u===F&&l+1<o){let C=s.charCodeAt(l+1);if(C===F){a=l;while(a>0&&(s.charCodeAt(a-1)===He||s.charCodeAt(a-1)===je))a--;return s.slice(0,a)}if(C===we){let A=s.indexOf("*/",l+2);if(A!==-1){s=`${s.slice(0,l)} ${s.slice(A+2)}`,l--;continue}}}}a=o;while(a>0&&(s.charCodeAt(a-1)===He||s.charCodeAt(a-1)===je||s.charCodeAt(a-1)===ve))a--;return a<o?s.slice(0,a):s}function Ge(s){e++;let o=s===pe?"'":'"';while(e<g){let r=f.indexOf(o,e);if(r===-1){e=g;return}let a=0,l=r-1;while(l>=0&&f.charCodeAt(l)===Qe)a++,l--;if(a%2===0){e=r+1;return}e=r+1}}function lt(){e++;let s=[];while(e<g){let o=f.charCodeAt(e);if(s.length===0){if(o===Qe){e+=2;continue}if(o===Ee){e++;return}if(o===Tn&&e+1<g&&f.charCodeAt(e+1)===W){e+=2,s.push(0);continue}e++;continue}if(o===pe||o===Ae){Ge(o);continue}if(o===Ee){lt();continue}if(o===F&&e+1<g){let r=f.charCodeAt(e+1);if(r===F){e=ie(e+2);continue}if(r===we){let a=f.indexOf("*/",e+2);e=a===-1?g:a+2;continue}if(jt()){qt();continue}e++;continue}if(o===W){s[s.length-1]++,e++;continue}if(o===U){let r=s[s.length-1];if(r===0){s.pop(),e++;continue}s[s.length-1]=r-1,e++;continue}e++}}let xt=!1;function Le(){xt=!1;let s=f.charCodeAt(e);if(s===pe||s===Ae)return Ge(s),!0;if(s===Ee)return lt(),!0;if(s===F&&e+1<g){let o=f.charCodeAt(e+1);if(o===F)return e=ie(e+2),!0;if(o===we){let r=f.indexOf("*/",e+2);return xt=ie(e+2)<(r===-1?g:r),e=r===-1?g:r+2,!0}if(jt())return qt(),!0}return!1}function jt(){return Be(f,e)}function qt(){e=de(f,e)}function Te(){let s=e;while(e<g&&i(f.charCodeAt(e)))e++;return f.slice(s,e)}function w(s){if(e+s.length>g)return!1;for(let o=0;o<s.length;o++)if(f.charCodeAt(e+o)!==s.charCodeAt(o))return!1;if(e+s.length<g&&i(f.charCodeAt(e+s.length)))return!1;return!0}function mt(s){let o=e+s;while(o<g){let r=f.charCodeAt(o);if(r===He||r===je||r===be||r===ve){o++;continue}return r!==Ye&&r!==$e}return!1}function yt(){if(!xt)return!1;let s=e;x();let o=e>=g||vt()||f.charCodeAt(e)===U;return e=s,o}function vt(){if(e>=g)return!1;switch(f.charCodeAt(e)){case 101:return w("export")||w("enum");case 105:return w("import")||w("interface");case 102:return w("function");case 99:return w("class")||w("const");case 116:return w("type");case 108:return w("let");case 118:return w("var");case 100:return w("declare")||w("default");case 109:return w("module");case 110:return w("namespace");case 97:return w("abstract")||w("async");default:return!1}}function it(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;let o=e;if(e++,s===ve&&e<g&&f.charCodeAt(e)===be)e++;while(e<g){let a=f.charCodeAt(e);if(a===He||a===je||a===ve||a===be){e++;continue}if(a===F&&e+1<g){let l=f.charCodeAt(e+1);if(l===F){e=ie(e+2);continue}if(l===we){let u=f.indexOf("*/",e+2);e=u===-1?g:u+2;continue}}break}let r=e>=g||vt()||f.charCodeAt(e)===U;return e=o,r}function zt(s){let o=s-1;while(o>=0){let b=f.charCodeAt(o);if(b===He||b===je||b===ve||b===be){o--;continue}break}if(o<0)return!0;let r=f[o];if("+-*/%=<>&|^!~?:,.([{".includes(r))return!0;let a=o;while(a>0&&f.charCodeAt(a-1)!==be)a--;let l=f.slice(a,o+1),u=l.lastIndexOf("<");if(u!==-1&&/^<[A-Za-z]/.test(l.slice(u))&&!l.slice(u).includes(">"))return!0;let C=o;while(C>=0&&/[a-z]/i.test(f[C]))C--;let A=f.slice(C+1,o+1);return["as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","return","yield","void"].includes(A)}function ln(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;if(zt(e))return!1;let o=e;e++;while(e<g){let u=f.charCodeAt(e);if(u===He||u===je||u===ve||u===be){e++;continue}if(u===F&&e+1<g){let C=f.charCodeAt(e+1);if(C===F){e=ie(e+2);continue}if(C===we){let A=f.indexOf("*/",e+2);e=A===-1?g:A+2;continue}}break}let r=e<g?f[e]:"",a=f.slice(e,e+2),l=r==="."||r==="?"||r===":"||r===")"||r==="]"||r==="}"||r===","||r==="+"||r==="-"||r==="*"||r==="/"||r==="%"||r==="<"||r===">"||r==="="||r==="&"||r==="|"||r==="^"||r==="`"||a==="=>"||w("as")||w("satisfies")||w("instanceof")||w("in");return e=o,!l}function Ft(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;if(zt(e))return!1;let o=e;e++;while(e<g){let l=f.charCodeAt(e);if(l===He||l===je||l===ve||l===be){e++;continue}if(l===F&&e+1<g){let u=f.charCodeAt(e+1);if(u===F){e=ie(e+2);continue}if(u===we){let C=f.indexOf("*/",e+2);e=C===-1?g:C+2;continue}}break}let r=e<g?f[e]:"",a=r==="|"||r==="&"||r==="["||r==="."||r==="?"||r===":"||r===">"||r===")"||r===","||w("extends");return e=o,!a}function ft(){let s=f.charCodeAt(e);if(s!==be&&s!==ve)return!1;let o=e;if(e++,s===ve&&e<g&&f.charCodeAt(e)===be)e++;while(e<g){let a=f.charCodeAt(e);if(a===He||a===je||a===ve||a===be){e++;continue}if(a===F&&e+1<g&&f.charCodeAt(e+1)===F){e=ie(e+2);continue}break}if(e>=g)return e=o,!0;let r=f.charCodeAt(e);if(r===124||r===38||r===Ye||r===$t||r===Ze)return e=o,!1;if(w("extends")||w("keyof")||w("typeof")||w("infer")||w("is")||w("as")||w("in"))return e=o,!1;return e=o,!0}let fn=/[{}'"`\/]/g,dn=/[()'"`\/]/g,un=/[[\]'"`\/]/g,hn=/[<>'"`\/]/g;function Pe(s,o){let r=1;e++;let a=s===W?fn:s===X?dn:s===Se?un:hn;a.lastIndex=e;let l;while((l=a.exec(f))!==null){let u=l.index,C=f.charCodeAt(u);if(C===pe||C===Ae){e=u,Ge(C),a.lastIndex=e;continue}if(C===Ee){e=u,lt(),a.lastIndex=e;continue}if(C===F){if(e=u,Le()){a.lastIndex=e;continue}a.lastIndex=u+1;continue}if(C===s)r++;else if(C===o){if(o===Ce&&u>0&&f.charCodeAt(u-1)===$e){a.lastIndex=u+1;continue}if(r--,r===0)return e=u+1,e}a.lastIndex=u+1}return e=g,e}function Ue(){return e>0&&f.charCodeAt(e-1)===$e}function St(){return e+1<g&&f.charCodeAt(e+1)===Ce}let Ke=/[<{};'"`\/\n\r()[\]]/g;function Me(s=!1){let o=0,r=0,a=0,l=0,u=f.charCodeAt(e)===W;Ke.lastIndex=e;let C;while((C=Ke.exec(f))!==null){let A=C.index,b=f.charCodeAt(A);if(b===pe||b===Ae){e=A,Ge(b),Ke.lastIndex=e;continue}if(b===Ee){e=A,lt(),Ke.lastIndex=e;continue}if(b===F){if(A>0&&f.charCodeAt(A-1)===ke){Ke.lastIndex=A+1;continue}if(e=A,Le()){if(o===0&&r===0&&a===0&&l===0&&yt())return;Ke.lastIndex=e;continue}Ke.lastIndex=A+1;continue}if(b===ke){let p=Jt(A);if(p!==null)l=Math.max(0,l+p);Ke.lastIndex=A+1;continue}if(b===X){r++,Ke.lastIndex=A+1;continue}if(b===ge){r--,Ke.lastIndex=A+1;continue}if(b===Se){a++,Ke.lastIndex=A+1;continue}if(b===_e){a--,Ke.lastIndex=A+1;continue}if(b===W){o++,Ke.lastIndex=A+1;continue}if(b===U){let p=o>0;if(!p&&s&&r===0&&a===0&&l===0){e=A;return}if(p)o--;if((!p||u)&&o===0&&r===0&&a===0&&l===0){e=A+1;return}if(p&&o===0&&r===0&&a===0&&l===0){e=A+1;let k=e;x();let D=vt();if(e=k,D)return}Ke.lastIndex=A+1;continue}if(b===J&&o===0&&r===0&&a===0&&l===0){e=A+1;return}if((b===be||b===ve)&&o===0&&r===0&&a===0&&l===0){if(e=A,it())return}Ke.lastIndex=A+1}e=g}function pn(){e++;while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;let s=f.indexOf(`
16
16
  `,e),o=s===-1?g:s,r=f.indexOf(";",e);if(r!==-1&&r<o){let a=r-1;while(a>=e&&(f.charCodeAt(a)===He||f.charCodeAt(a)===je))a--;let l=f.charCodeAt(e),u=f.charCodeAt(a);if(l===W&&u===U||l===Se&&u===_e||l===pe&&u===pe||l===Ae&&u===Ae||l===Ee&&u===Ee){e=r+1;return}}Me()}function Gt(){Pe(W,U);while(e<g&&We(f.charCodeAt(e)))e++;if(w("from")){e+=4;while(e<g&&We(f.charCodeAt(e)))e++;if(e<g){let s=f.charCodeAt(e);if(s===pe||s===Ae)Ge(s)}}while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;if(e<g&&f.charCodeAt(e)===J)e++}function Kt(){e++;while(e<g&&We(f.charCodeAt(e)))e++;if(w("as")){e+=2;while(e<g&&We(f.charCodeAt(e)))e++;Te();while(e<g&&We(f.charCodeAt(e)))e++}if(w("from")){e+=4;while(e<g&&We(f.charCodeAt(e)))e++;if(e<g){let s=f.charCodeAt(e);if(s===pe||s===Ae)Ge(s)}}while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;if(e<g&&f.charCodeAt(e)===J)e++}function gt(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 a=s.charCodeAt(r);if(a!==39&&a!==34)return;let l=s.indexOf(s[r],r+1);if(l===-1)return;return s.slice(r+1,l)}function Ve(s){if(!K)return;let o=s-1;while(o>=0&&We(f.charCodeAt(o)))o--;if(o<0)return;let r=[],a=!1;while(o>=0){if(o>=1&&f.charCodeAt(o)===F&&f.charCodeAt(o-1)===we){let C=f.lastIndexOf("/*",o-2);if(C>=0){r.push(f.slice(C,o+1)),a=!0,o=C-1;while(o>=0&&We(f.charCodeAt(o)))o--;continue}break}let l=o;while(l>0&&f.charCodeAt(l-1)!==be)l--;let u=V(l,o+1);if(u.startsWith("//")){if(a)break;let C=[u];o=l-1;while(o>=0&&(f.charCodeAt(o)===be||f.charCodeAt(o)===ve))o--;while(o>=0){let A=o;while(A>0&&f.charCodeAt(A-1)!==be)A--;let b=V(A,o+1);if(b.startsWith("//")){C.push(b),o=A-1;while(o>=0&&(f.charCodeAt(o)===be||f.charCodeAt(o)===ve))o--}else if(b===""){o=A-1;while(o>=0&&(f.charCodeAt(o)===be||f.charCodeAt(o)===ve))o--}else break}C.reverse(),r.push(C.join(`
17
- `));continue}break}if(r.length===0)return;return r.reverse(),r}function mn(s){let o=s,r=!1,a=0,l;while(e<g){let E=f.charCodeAt(e);if(E===F&&(f.charCodeAt(e+1)===F||f.charCodeAt(e+1)===we)){x();continue}if(E===J){e++;break}if(E===W)a++;else if(E===U&&a>0)a--;if(E===pe||E===Ae){if(Ge(E),a>0)continue;r=!0;let M=e;if(x(),f.charCodeAt(e)===ge){let y=e+1;l=Fe(f.slice(o,y)),e=l?y:M}else e=M;while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;if(e<g&&f.charCodeAt(e)===J)e++;break}if(E===be&&r)break;e++}let u=V(o,e),C=m(u).find((E)=>E.category==="static-import"),A=t(u),b=l?.isTypeOnly??C?.isTypeOnly??!1,p=A[1]?.kind==="quoted",k=l?.source??C?.specifier??"",D=Ve(o);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:b,isSideEffect:p,source:k,leadingComments:D,start:o,end:e}}function Dt(){let s=e;return Pe(W,U),f.slice(s,e)}function Ut(s){let o=s.indexOf("(");if(o===-1)return s;let r=s.slice(o);if(r.indexOf("=")===-1)return s;let a=!1;for(let b=0;b<r.length;b++)if(r.charCodeAt(b)===61){let k=b>0?r.charCodeAt(b-1):0,D=b+1<r.length?r.charCodeAt(b+1):0;if(k!==61&&k!==33&&k!==60&&k!==62&&D!==61&&D!==62){a=!0;break}}if(!a)return s;let l=0,u=-1;for(let b=o;b<s.length;b++){let p=s.charCodeAt(b);if(p===40)l++;else if(p===41){if(l--,l===0){u=b;break}}}if(u===-1)return s;let C=s.slice(o,u+1),A=ot(C);return s.slice(0,o)+A+s.slice(u+1)}function Vt(s){let o=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,r=s.split(`
17
+ `));continue}break}if(r.length===0)return;return r.reverse(),r}function mn(s){let o=s,r=!1,a=0,l;while(e<g){let E=f.charCodeAt(e);if(E===F&&(f.charCodeAt(e+1)===F||f.charCodeAt(e+1)===we)){x();continue}if(E===J){e++;break}if(E===W)a++;else if(E===U&&a>0)a--;if(E===pe||E===Ae){if(Ge(E),a>0)continue;r=!0;let M=e;if(x(),f.charCodeAt(e)===ge){let y=e+1;l=Ne(f.slice(o,y)),e=l?y:M}else e=M;while(e<g&&(f.charCodeAt(e)===He||f.charCodeAt(e)===je))e++;if(e<g&&f.charCodeAt(e)===J)e++;break}if(E===be&&r)break;e++}let u=V(o,e),C=m(u).find((E)=>E.category==="static-import"),A=t(u),b=l?.isTypeOnly??C?.isTypeOnly??!1,p=A[1]?.kind==="quoted",k=l?.source??C?.specifier??"",D=Ve(o);return{kind:"import",name:"",text:u,isExported:!1,isTypeOnly:b,isSideEffect:p,source:k,leadingComments:D,start:o,end:e}}function Dt(){let s=e;return Pe(W,U),f.slice(s,e)}function Ut(s){let o=s.indexOf("(");if(o===-1)return s;let r=s.slice(o);if(r.indexOf("=")===-1)return s;let a=!1;for(let b=0;b<r.length;b++)if(r.charCodeAt(b)===61){let k=b>0?r.charCodeAt(b-1):0,D=b+1<r.length?r.charCodeAt(b+1):0;if(k!==61&&k!==33&&k!==60&&k!==62&&D!==61&&D!==62){a=!0;break}}if(!a)return s;let l=0,u=-1;for(let b=o;b<s.length;b++){let p=s.charCodeAt(b);if(p===40)l++;else if(p===41){if(l--,l===0){u=b;break}}}if(u===-1)return s;let C=s.slice(o,u+1),A=ot(C);return s.slice(0,o)+A+s.slice(u+1)}function Vt(s){let o=s.indexOf("//")!==-1||s.indexOf("/*")!==-1,r=s.split(`
18
18
  `),a=[],l=[],u=[],C=!1,A=1/0;for(let k=0;k<r.length;k++){let D=r[k];if(o){if(C){if(D.includes("*/"))C=!1;continue}let E=D.trim();if(E.length===0)continue;let M=E.charCodeAt(0);if(M===F){let N=E.charCodeAt(1);if(N===F)continue;if(N===we){if(!E.includes("*/"))C=!0;continue}}if(M===we)continue;let y=qe(D);if(y.charCodeAt(y.length-1)===J)y=y.slice(0,-1);y=Ut(y);let v=y.trim();if(!v)continue;a.push(y),l.push(v);let q=0;while(q<y.length&&We(y.charCodeAt(q)))q++;if(v!=="{"&&v!=="}"){if(q<A)A=q}u.push(q)}else{let E=D.length;while(E>0&&(D.charCodeAt(E-1)===He||D.charCodeAt(E-1)===je||D.charCodeAt(E-1)===ve))E--;if(E===0)continue;let M=E<D.length?D.slice(0,E):D;if(M.charCodeAt(M.length-1)===J)M=M.slice(0,-1);M=Ut(M);let y=M.trim();if(!y)continue;a.push(M),l.push(y);let v=0;while(v<M.length&&We(M.charCodeAt(v)))v++;if(y!=="{"&&y!=="}"){if(v<A)A=v}u.push(v)}}if(a.length===0)return"{}";if(A===1/0||A<=2)return a.join(`
19
19
  `);let b=A-2,p=Array(a.length);for(let k=0;k<a.length;k++){let D=l[k];if(D==="{"){p[k]=D;continue}let E=u[k];if(E>A)p[k]=a[k];else if(E===A&&(D.charCodeAt(0)===U||D.charCodeAt(0)===_e||D.charCodeAt(0)===ge))p[k]=a[k];else{let M=Math.max(0,E-b);p[k]=" ".repeat(M)+D}}return p.join(`
20
20
  `)}function Xe(){if(e>=g||f.charCodeAt(e)!==ke)return"";let s=e;Pe(ke,Ce);let o=f.slice(s,e);if(o.includes(`
@@ -25,13 +25,13 @@ ${M}
25
25
  `))o=o.slice(0,-1);r++;let A=0;while(r<s.length){let b=s.charCodeAt(r);if(b===pe||b===Ae||b===Ee){let p=b;r++;while(r<s.length){if(s.charCodeAt(r)===Qe){r+=2;continue}if(s.charCodeAt(r)===p){r++;break}r++}continue}if(b===W||b===Se||b===X)A++;else if(b===U||b===_e||b===ge){if(A===0)break;A--}else if(b===Je&&A===0)break;r++}continue}if(a===1&&C===Ye&&r+2<s.length&&s.charCodeAt(r+1)===Ye&&s.charCodeAt(r+2)===Ye){r+=3;continue}o+=s[r],r++}return o}function Qt(s){let o=s.trim(),r=o.startsWith("...");if(r)o=o.slice(3).trim();while(o.startsWith("@")){let y=1;while(y<o.length&&i(o.charCodeAt(y)))y++;if(y<o.length&&o.charCodeAt(y)===X){let v=1;y++;while(y<o.length&&v>0){if(o.charCodeAt(y)===X)v++;else if(o.charCodeAt(y)===ge)v--;y++}}o=o.slice(y).trim()}let a=!0;while(a){a=!1;for(let y of Ht)if(o.startsWith(y)&&o.length>y.length&&!i(o.charCodeAt(y.length))){let v=o.slice(y.length).trim();if(v.charCodeAt(0)===Ze||v.charCodeAt(0)===$t&&v.length>1&&v.charCodeAt(1)===Ze)break;o=v,a=!0;break}}let l=-1,u=-1,C=0,A=!1,b=0;for(let y=0;y<o.length;y++){let v=o.charCodeAt(y);if(A){if(v===Qe){y++;continue}if(v===b)A=!1;continue}if(v===F&&y+1<o.length){let q=o.charCodeAt(y+1);if(q===we){y+=2;while(y+1<o.length&&!(o.charCodeAt(y)===we&&o.charCodeAt(y+1)===F))y++;y++;continue}if(q===F){while(y<o.length&&o.charCodeAt(y)!==10)y++;continue}}if(v===pe||v===Ae||v===Ee){A=!0,b=v;continue}if(v===X||v===W||v===Se||v===ke)C++;else if(v===ge||v===U||v===_e||v===Ce&&!(y>0&&o.charCodeAt(y-1)===$e))C--;else if(C===0){if(v===Ze&&l===-1)l=y;else if(v===$e&&u===-1&&(y===0||o.charCodeAt(y-1)!==$e)&&(y+1>=o.length||o.charCodeAt(y+1)!==$e&&o.charCodeAt(y+1)!==Ce))u=y}}let p,k,D=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 y=r?null:fe(p,o.slice(u+1));if(y)return Ie(y,dt);k=dt(o.slice(u+1).trim())}else p=o,k="unknown";if(p=gn(p),(p.startsWith("{")||p.startsWith("["))&&p.includes(`
26
26
  `)){let y=p.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(y.length<=40)p=y;else p=p.split(`
27
27
  `).map((q)=>{let N=q.trim();if(!N)return"";if(N==="{"||N==="}"||N==="["||N==="]"||N.startsWith("}")||N.startsWith("]"))return N;return` ${N}`}).join(`
28
- `)}let E=p.endsWith("?")||D;if(p.endsWith("?"))p=p.slice(0,-1).trim();let M=E&&!r?"?":"";if(r)return`...${p}: ${k}`;return`${p}${M}: ${k}`}function dt(s){let o=s.trim(),r=ue(o);if(r)return r;if(o==="true"||o==="false")return"boolean";if(z(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 Re(o)??"unknown"}function Tt(s){let o=s.trim();if(o.endsWith("as const"))o=o.slice(0,-8).trim();if(o==="true"||o==="false")return o;if(z(o))return it(o);let r=Cn(o);if(r!==null)return r;return Re(o)??"unknown"}function Cn(s){if(s==="")return null;if(s.charCodeAt(0)===pe||s.charCodeAt(0)===Ae){if(pt(s,0,s.charCodeAt(0))===s.length)return s}let o=An(s,"+");if(o.length>1){let r=!1,a=!0,l=[];for(let u of o){let C=u.trim(),A=C.charCodeAt(0);if((A===pe||A===Ae)&&pt(C,0,A)===C.length)r=!0,l.push(bn(C));else a=!1}if(a)return kn(l.join(""));if(r)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function An(s,o){let r=[],a=0,l="",u=0;while(u<s.length){let C=s.charCodeAt(u);if(C===pe||C===Ae||C===Ee){let A=pt(s,u,C);l+=s.slice(u,A),u=A;continue}if(C===F&&(s.charCodeAt(u+1)===F||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===F){let p=s.indexOf(`
28
+ `)}let E=p.endsWith("?")||D;if(p.endsWith("?"))p=p.slice(0,-1).trim();let M=E&&!r?"?":"";if(r)return`...${p}: ${k}`;return`${p}${M}: ${k}`}function dt(s){let o=s.trim(),r=ue(o);if(r)return r;if(o==="true"||o==="false")return"boolean";if(z(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 Re(o)??"unknown"}function Tt(s){let o=s.trim();if(o.endsWith("as const"))o=o.slice(0,-8).trim();if(o==="true"||o==="false")return o;if(z(o))return st(o);let r=Cn(o);if(r!==null)return r;return Re(o)??"unknown"}function Cn(s){if(s==="")return null;if(s.charCodeAt(0)===pe||s.charCodeAt(0)===Ae){if(pt(s,0,s.charCodeAt(0))===s.length)return s}let o=An(s,"+");if(o.length>1){let r=!1,a=!0,l=[];for(let u of o){let C=u.trim(),A=C.charCodeAt(0);if((A===pe||A===Ae)&&pt(C,0,A)===C.length)r=!0,l.push(bn(C));else a=!1}if(a)return kn(l.join(""));if(r)return"string";return null}if(/^[\d\s()+*/%.\-]+$/.test(s)&&/\d/.test(s)&&/[+*/%\-\s]/.test(s))return"number";return null}function An(s,o){let r=[],a=0,l="",u=0;while(u<s.length){let C=s.charCodeAt(u);if(C===pe||C===Ae||C===Ee){let A=pt(s,u,C);l+=s.slice(u,A),u=A;continue}if(C===F&&(s.charCodeAt(u+1)===F||s.charCodeAt(u+1)===42)){if(s.charCodeAt(u+1)===F){let p=s.indexOf(`
29
29
  `,u+2),k=p===-1?s.length:p;l+=s.slice(u,k),u=k;continue}let A=s.indexOf("*/",u+2),b=A===-1?s.length:A+2;l+=s.slice(u,b),u=b;continue}if(C===X||C===Se||C===W)a++;else if(C===ge||C===_e||C===U)a--;if(s[u]===o&&a===0){r.push(l),l="",u++;continue}l+=s[u],u++}return r.push(l),r}function bn(s){return s.slice(1,-1).replace(/\\(.)/g,(r,a)=>{if(a==="n")return`
30
- `;if(a==="t")return"\t";if(a==="r")return"\r";if(a==="0")return"\x00";return a})}function kn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function At(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===pe||u===Ae||u===Ee)l=pt(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 ut(){if(x(),e<g&&f.charCodeAt(e)===Ze){let a=function(){let l=V(s,r),u=(C)=>{let A=l.length-C.length;return A>=0&&l.endsWith(C)&&(A===0||!i(l.charCodeAt(A-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,x();let s=e,o=0,r=s;while(e<g){let l=e;if(Be()){if(f.charCodeAt(l)!==F)r=e;continue}let u=f.charCodeAt(e);if(u===X||u===Se||u===ke)o++;else if(u===ge||u===_e||u===Ce&&!Ue())o--;else if(u===W)if(o>0)o++;else if(a())o++;else break;else if(u===U){if(o===0)break;o--}else if(o===0&&u===J)break;if(o===0&&ft()&&!a())break;if(!We(u))r=e+1;e++}return V(s,e)}return""}function tt(s,o,r,a){e+=8,x();let l=e<g&&f.charCodeAt(e)===we;if(l)e++,x();let u=Te();if(!u&&!a)return null;x();let C=Xe();x();let A=et();x();let b=ut(),p=b.length>0;if(!b)if(r&&l)b="AsyncGenerator<unknown, void, unknown>";else if(l)b="Generator<unknown, void, unknown>";else if(r)b="Promise<void>";else b="void";x();let k=!1;if(e<g&&f.charCodeAt(e)===W){k=!0;let N=e+1;if(Pe(W,U),!p&&!l){let B=f.slice(N,e-1),R=Ei(B,Z,()=>{let ye;do ye=`__dtsx_return_${le++}`;while(f.includes(ye));return ye},(ye)=>ae.set(ye.name,{...ye,start:e,end:e}),C);b=R.finish(I(B,r,A,se,R.resolve))}}else if(e<g&&f.charCodeAt(e)===J)e++;let D=ot(A),y=`${o?a?"export default function ":"export declare function ":"declare function "}${u||(a?"":"default")}${C}${D}: ${b};`,v=Ve(s),q={kind:"function",name:u||"default",text:y,isExported:o,isDefault:a,isAsync:r,isGenerator:l,returnType:b,generics:C||void 0,leadingComments:v,start:s,end:e};if(k)xe.add(q);return q}let _t,wn=0;function Zt(){_t??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${wn++}`;if(_t.has(s))continue;return _t.add(s),s}}function rt(s,o,r){e+=o.length,x();let a=[];do{if(x(),e>=g)break;let l=f.charCodeAt(e),u,C=e;if(l===W||l===Se)Pe(l,l===W?U:_e),u=f.slice(C,e);let A=u?Zt():Te();if(!A)return Me(),a;x();let b,p,k,D=!1;if(e<g&&f.charCodeAt(e)===Ze){e++,x();let N=e,B=0;while(e<g){if(Be()){if(B===0&&yt())break;continue}let R=f.charCodeAt(e);if(R===X||R===W||R===Se||R===ke)B++;else if(R===ge||R===U||R===_e||R===Ce&&!Ue())B--;else if(B===0&&(R===J||R===Je))break;else if(B===0&&R===$e&&!St())break;if(B===0&&(st()||Ft()))break;e++}b=V(N,e)}if(e<g&&f.charCodeAt(e)===$e)if(me&&b&&(!K||!_n(b)))pn();else{e++,x();let N=e;k=N;let B=0,R=0,ye=0,oe=!0;for(;;){e=N,B=0,R=0,ye=0;while(e<g){if(Be()){if(B===0&&R===0&&ye===0&&yt())break;continue}let De=f.charCodeAt(e);if(De===X||De===W||De===Se)B++;else if(De===ge||De===U||De===_e)B--;else if(De===ke&&B===0){let ht=Jt(e);if(ht!==null)ye=Math.max(0,ye+ht);else if(oe&&(e+1>=g||f.charCodeAt(e+1)!==$e))R++}else if(De===Ce&&B===0&&ye===0&&!Ue()){if(R>0&&(e+1>=g||f.charCodeAt(e+1)!==$e))R--}else if(B===0&&R===0&&ye===0&&(De===J||De===Je))break;if(B===0&&R===0&&ye===0&&(st()||ln()))break;e++}if(R>0&&oe){oe=!1;continue}break}if(p=re(V(N,e)),p.endsWith(" as const")||p==="const"){if(D=!0,!b){let De=p.endsWith(" as const")?p.slice(0,-9).trim():p,ht=Tt(De);b=ht!=="unknown"?ht:void 0}}else if(!b){let De=j(p)??At(p)??se(p);if(De)b=De}}let E=a.length===0?Ve(s):void 0,M=u?"const":o,y=u?!1:r,v=`${y?"export ":""}declare ${M} ${A}: ${b||"unknown"};`,q={kind:"variable",name:A,text:v,isExported:y,typeAnnotation:b,value:p,initializerStart:k,modifiers:D?[M,"const assertion"]:[M],leadingComments:u?void 0:E,start:s,end:e};if(u)a.push(...tr({pattern:u,patternOffset:C,root:q,kind:o,exported:r,comments:E,allocateName:Zt}));else a.push(q);if(f.charCodeAt(e)===Je){e++;continue}if(f.charCodeAt(e)===J)e++;break}while(e<g);return a}function Jt(s){if(f.charCodeAt(s)!==ke||s+1>=g)return null;let o=f.charCodeAt(s+1);if(o===Ce)return 1;if(o===F)return-1;if(!c(o))return null;let r=s+2;while(r<g){let p=f.charCodeAt(r);if(!i(p)&&p!==Ye&&p!==58&&p!==45)break;r++}let a=f.slice(s+1,r),l=f.charCodeAt(r);if(l>32&&l!==Ce&&l!==F)return null;let u=0,C=0,A=r;for(;A<g;A++){let p=f.charCodeAt(A);if(C!==0){if(p===Qe)A++;else if(p===C)C=0;continue}if(p===pe||p===Ae||p===Ee)C=p;else if(p===W)u++;else if(p===U&&u>0)u--;else if(p===Ce&&u===0)break}if(A>=g)return null;let b=A-1;while(b>s&&f.charCodeAt(b)<=32)b--;if(f.charCodeAt(b)===F)return 0;return f.indexOf(`</${a}`,A+1)===-1?null:1}function Ot(s,o){e+=9,x();let r=Te();x();let a=Xe();x();let l="";if(w("extends")){e+=7,x();let p=e,k=0;while(e<g){if(Be())continue;let D=f.charCodeAt(e);if(D===ke)k++;else if(D===Ce&&!Ue())k--;else if(D===W&&k===0)break;e++}l=V(p,e)}x();let u=e<g&&f.charCodeAt(e)===W?Dt():"{}",C=Vt(u),A=`${o?"export ":""}declare interface ${r}${a}${l?` extends ${l}`:""} ${C}`,b=Ve(s);return{kind:"interface",name:r,text:A,isExported:o,extends:l||void 0,generics:a||void 0,leadingComments:b,start:s,end:e}}function Et(s,o){e+=4,x();let r=Te();x();let a=Xe();if(x(),e<g&&f.charCodeAt(e)===$e)e++;x();let l=e,u=0;while(e<g){if(Be())continue;let p=f.charCodeAt(e);if(p===X||p===W||p===Se||p===ke)u++;else if(p===ge||p===U||p===_e||p===Ce&&!Ue())u--;else if(u===0&&p===J)break;if(u===0&&(st()||Ft()))break;e++}let C=V(l,e);if(e<g&&f.charCodeAt(e)===J)e++;let A=`${o?"export ":""}type ${r}${a} = ${C}`,b=Ve(s);return{kind:"type",name:r,text:A,isExported:o,generics:a||void 0,leadingComments:b,start:s,end:e}}function ct(s,o,r){e+=4,x();let a=Te();x();let l=e;if(e<g&&f.charCodeAt(e)===W)Pe(W,U);let u=V(s,e),C=Ve(s);return{kind:"enum",name:a,text:u,isExported:o,modifiers:r?["const"]:void 0,leadingComments:C,start:s,end:e}}function nt(s,o,r,a=!1){e+=5,x();let l=Te()||"AnonymousClass";x();let u=Xe();x();let C="";if(w("extends")){e+=7,x();let E=e,M=0;while(e<g){if(Be())continue;let y=f.charCodeAt(e);if(y===ke)M++;else if(y===Ce&&!Ue())M--;else if(M===0&&(y===W||w("implements")))break;e++}C=V(E,e)}let A;if(w("implements")){e+=10,x();let E=e,M=0;while(e<g){if(Be())continue;let v=f.charCodeAt(e);if(v===ke)M++;else if(v===Ce&&!Ue())M--;else if(M===0&&v===W)break;e++}let y=V(E,e);if(y)A=y.split(",").map((v)=>v.trim())}x();let b=Pt(),k=`${o?a?"export default ":"export declare ":"declare "}${r?"abstract ":""}class ${l}${u}${C?` extends ${C}`:""}${A&&A.length>0?` implements ${A.join(", ")}`:""} ${b}`,D=Ve(s);return{kind:"class",name:l,text:k,isExported:o,isDefault:a,extends:C||void 0,implements:A,generics:u||void 0,modifiers:r?["abstract"]:void 0,leadingComments:D,start:s,end:e}}let Rt;function Pt(){if(e>=g||f.charCodeAt(e)!==W)return"{}";e++;let s={fields:new Map,pending:[],isStatic:!1};he.push(s);let o=[],r=new Set;while(e<g){if(x(),e>=g)break;if(f.charCodeAt(e)===U){e++;break}if(f.charCodeAt(e)===J){e++;continue}if(Rt=Ve(e),w("static")&&kt("static")===W){e+=6,x(),Pe(W,U);continue}let a=!1,l=!1,u=!1,C=!1,A=!1,b=!1,p=!1,k=!1,D=!0;while(D){x();let N=e,B=Te();if(e=N,B){let R=kt(B);if(R===X||R===ke||R===$t||R===33||R===Ze||R===$e||R===J||R===U)break}if(w("private")){a=!0,e+=7;continue}if(w("protected")){l=!0,e+=9;continue}if(w("public")){e+=6;continue}if(w("static")){u=!0,e+=6;continue}if(w("abstract")){C=!0,e+=8;continue}if(w("readonly")){A=!0,e+=8;continue}if(w("override")){b=!0,e+=8;continue}if(w("accessor")){p=!0,e+=8;continue}if(w("async")){k=!0,e+=5;continue}if(w("declare")){e+=7;continue}break}if(x(),e>=g||f.charCodeAt(e)===U)break;let E=e;if(s.isStatic=u,(w("get")||w("set"))&&Mt(kt(f.slice(e,e+3))))e+=3,x();if(f.charCodeAt(e)===we)e++,x();let M=bt();e=E;let y=M.startsWith("#");if(y)a=!0;if(a&&M&&M!=="constructor"){let N=y?u?" static #private_static;":" #private;":` private ${u?"static ":""}${M};`,R=M[0]==="'"||M[0]==='"'?d(M)??M:M,ye=y?`${u?"static":"instance"}#`:`${u?"static:":"instance:"}${R}`;if(!r.has(ye))r.add(ye),o.push(N)}let v=a?[]:o,q=" ";if(l)q+="protected ";if(u)q+="static ";if(C)q+="abstract ";if(A)q+="readonly ";if(w("constructor")){e+=11,x();let N=et();if(x(),xn(N,o),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let B=ot(N);o.push(a?" private constructor();":` ${l?"protected ":""}constructor${B};`)}else if(w("get"))if(e+=3,x(),e<g&&Mt(f.charCodeAt(e))){let N=bt();if(N.startsWith("#")){if(x(),e<g&&f.charCodeAt(e)===X)et();if(x(),ut(),x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;continue}x(),et(),x();let B=ut(),R;if(x(),e<g&&f.charCodeAt(e)===W){let oe=e+1;if(Pe(W,U),!B&&!me)R=f.slice(oe,e-1),B=I(R,!1,"()",(De)=>Y(De,u))}else if(e<g&&f.charCodeAt(e)===J)e++;let ye=v.length;if(v.push(`${q}get ${N}(): ${R?L(B):B||"unknown"};`),R)s.pending.push(()=>{let oe=I(R,!1,"()",(De)=>Y(De,u));v[ye]=`${q}get ${N}(): ${L(oe)};`})}else Yt("get",q,u,A,k,v);else if(w("set"))if(e+=3,x(),e<g&&Mt(f.charCodeAt(e))){let N=bt();if(N.startsWith("#")){if(x(),e<g&&f.charCodeAt(e)===X)et();if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;continue}x();let B=et();if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let R=ot(B);v.push(`${q}set ${N}${R};`)}else Yt("set",q,u,A,k,v);else{let N=f.charCodeAt(e)===we;if(N)e++,x();let B=bt();if(!B){Xt();continue}en(B,q,u,A,N,C,k,v)}}for(let a of s.pending)a();return he.pop(),`{
30
+ `;if(a==="t")return"\t";if(a==="r")return"\r";if(a==="0")return"\x00";return a})}function kn(s){return`'${s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function At(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===pe||u===Ae||u===Ee)l=pt(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 ut(){if(x(),e<g&&f.charCodeAt(e)===Ze){let a=function(){let l=V(s,r),u=(C)=>{let A=l.length-C.length;return A>=0&&l.endsWith(C)&&(A===0||!i(l.charCodeAt(A-1)))};return l.length===0||l.endsWith("=>")||l.endsWith("|")||l.endsWith("&")||u("is")||u("extends")};e++,x();let s=e,o=0,r=s;while(e<g){let l=e;if(Le()){if(f.charCodeAt(l)!==F)r=e;continue}let u=f.charCodeAt(e);if(u===X||u===Se||u===ke)o++;else if(u===ge||u===_e||u===Ce&&!Ue())o--;else if(u===W)if(o>0)o++;else if(a())o++;else break;else if(u===U){if(o===0)break;o--}else if(o===0&&u===J)break;if(o===0&&ft()&&!a())break;if(!We(u))r=e+1;e++}return V(s,e)}return""}function tt(s,o,r,a){e+=8,x();let l=e<g&&f.charCodeAt(e)===we;if(l)e++,x();let u=Te();if(!u&&!a)return null;x();let C=Xe();x();let A=et();x();let b=ut(),p=b.length>0;if(!b)if(r&&l)b="AsyncGenerator<unknown, void, unknown>";else if(l)b="Generator<unknown, void, unknown>";else if(r)b="Promise<void>";else b="void";x();let k=!1;if(e<g&&f.charCodeAt(e)===W){k=!0;let N=e+1;if(Pe(W,U),!p&&!l){let B=f.slice(N,e-1),R=Ei(B,Z,()=>{let ye;do ye=`__dtsx_return_${le++}`;while(f.includes(ye));return ye},(ye)=>ae.set(ye.name,{...ye,start:e,end:e}),C);b=R.finish(I(B,r,A,se,R.resolve))}}else if(e<g&&f.charCodeAt(e)===J)e++;let D=ot(A),y=`${o?a?"export default function ":"export declare function ":"declare function "}${u||(a?"":"default")}${C}${D}: ${b};`,v=Ve(s),q={kind:"function",name:u||"default",text:y,isExported:o,isDefault:a,isAsync:r,isGenerator:l,returnType:b,generics:C||void 0,leadingComments:v,start:s,end:e};if(k)xe.add(q);return q}let It,wn=0;function Zt(){It??=new Set(t(f).filter((s)=>s.kind==="word").map((s)=>f.slice(s.start,s.end)));for(;;){let s=`__dtsx_binding_${wn++}`;if(It.has(s))continue;return It.add(s),s}}function rt(s,o,r){e+=o.length,x();let a=[];do{if(x(),e>=g)break;let l=f.charCodeAt(e),u,C=e;if(l===W||l===Se)Pe(l,l===W?U:_e),u=f.slice(C,e);let A=u?Zt():Te();if(!A)return Me(),a;x();let b,p,k,D=!1;if(e<g&&f.charCodeAt(e)===Ze){e++,x();let N=e,B=0;while(e<g){if(Le()){if(B===0&&yt())break;continue}let R=f.charCodeAt(e);if(R===X||R===W||R===Se||R===ke)B++;else if(R===ge||R===U||R===_e||R===Ce&&!Ue())B--;else if(B===0&&(R===J||R===Je))break;else if(B===0&&R===$e&&!St())break;if(B===0&&(it()||Ft()))break;e++}b=V(N,e)}if(e<g&&f.charCodeAt(e)===$e)if(me&&b&&(!K||!_n(b)))pn();else{e++,x();let N=e;k=N;let B=0,R=0,ye=0,oe=!0;for(;;){e=N,B=0,R=0,ye=0;while(e<g){if(Le()){if(B===0&&R===0&&ye===0&&yt())break;continue}let De=f.charCodeAt(e);if(De===X||De===W||De===Se)B++;else if(De===ge||De===U||De===_e)B--;else if(De===ke&&B===0){let ht=Jt(e);if(ht!==null)ye=Math.max(0,ye+ht);else if(oe&&(e+1>=g||f.charCodeAt(e+1)!==$e))R++}else if(De===Ce&&B===0&&ye===0&&!Ue()){if(R>0&&(e+1>=g||f.charCodeAt(e+1)!==$e))R--}else if(B===0&&R===0&&ye===0&&(De===J||De===Je))break;if(B===0&&R===0&&ye===0&&(it()||ln()))break;e++}if(R>0&&oe){oe=!1;continue}break}if(p=re(V(N,e)),p.endsWith(" as const")||p==="const"){if(D=!0,!b){let De=p.endsWith(" as const")?p.slice(0,-9).trim():p,ht=Tt(De);b=ht!=="unknown"?ht:void 0}}else if(!b){let De=j(p)??At(p)??se(p);if(De)b=De}}let E=a.length===0?Ve(s):void 0,M=u?"const":o,y=u?!1:r,v=`${y?"export ":""}declare ${M} ${A}: ${b||"unknown"};`,q={kind:"variable",name:A,text:v,isExported:y,typeAnnotation:b,value:p,initializerStart:k,modifiers:D?[M,"const assertion"]:[M],leadingComments:u?void 0:E,start:s,end:e};if(u)a.push(...tr({pattern:u,patternOffset:C,root:q,kind:o,exported:r,comments:E,allocateName:Zt}));else a.push(q);if(f.charCodeAt(e)===Je){e++;continue}if(f.charCodeAt(e)===J)e++;break}while(e<g);return a}function Jt(s){if(f.charCodeAt(s)!==ke||s+1>=g)return null;let o=f.charCodeAt(s+1);if(o===Ce)return 1;if(o===F)return-1;if(!c(o))return null;let r=s+2;while(r<g){let p=f.charCodeAt(r);if(!i(p)&&p!==Ye&&p!==58&&p!==45)break;r++}let a=f.slice(s+1,r),l=f.charCodeAt(r);if(l>32&&l!==Ce&&l!==F)return null;let u=0,C=0,A=r;for(;A<g;A++){let p=f.charCodeAt(A);if(C!==0){if(p===Qe)A++;else if(p===C)C=0;continue}if(p===pe||p===Ae||p===Ee)C=p;else if(p===W)u++;else if(p===U&&u>0)u--;else if(p===Ce&&u===0)break}if(A>=g)return null;let b=A-1;while(b>s&&f.charCodeAt(b)<=32)b--;if(f.charCodeAt(b)===F)return 0;return f.indexOf(`</${a}`,A+1)===-1?null:1}function Ot(s,o){e+=9,x();let r=Te();x();let a=Xe();x();let l="";if(w("extends")){e+=7,x();let p=e,k=0;while(e<g){if(Le())continue;let D=f.charCodeAt(e);if(D===ke)k++;else if(D===Ce&&!Ue())k--;else if(D===W&&k===0)break;e++}l=V(p,e)}x();let u=e<g&&f.charCodeAt(e)===W?Dt():"{}",C=Vt(u),A=`${o?"export ":""}declare interface ${r}${a}${l?` extends ${l}`:""} ${C}`,b=Ve(s);return{kind:"interface",name:r,text:A,isExported:o,extends:l||void 0,generics:a||void 0,leadingComments:b,start:s,end:e}}function Et(s,o){e+=4,x();let r=Te();x();let a=Xe();if(x(),e<g&&f.charCodeAt(e)===$e)e++;x();let l=e,u=0;while(e<g){if(Le())continue;let p=f.charCodeAt(e);if(p===X||p===W||p===Se||p===ke)u++;else if(p===ge||p===U||p===_e||p===Ce&&!Ue())u--;else if(u===0&&p===J)break;if(u===0&&(it()||Ft()))break;e++}let C=V(l,e);if(e<g&&f.charCodeAt(e)===J)e++;let A=`${o?"export ":""}type ${r}${a} = ${C}`,b=Ve(s);return{kind:"type",name:r,text:A,isExported:o,generics:a||void 0,leadingComments:b,start:s,end:e}}function ct(s,o,r){e+=4,x();let a=Te();x();let l=e;if(e<g&&f.charCodeAt(e)===W)Pe(W,U);let u=V(s,e),C=Ve(s);return{kind:"enum",name:a,text:u,isExported:o,modifiers:r?["const"]:void 0,leadingComments:C,start:s,end:e}}function nt(s,o,r,a=!1){e+=5,x();let l=Te()||"AnonymousClass";x();let u=Xe();x();let C="";if(w("extends")){e+=7,x();let E=e,M=0;while(e<g){if(Le())continue;let y=f.charCodeAt(e);if(y===ke)M++;else if(y===Ce&&!Ue())M--;else if(M===0&&(y===W||w("implements")))break;e++}C=V(E,e)}let A;if(w("implements")){e+=10,x();let E=e,M=0;while(e<g){if(Le())continue;let v=f.charCodeAt(e);if(v===ke)M++;else if(v===Ce&&!Ue())M--;else if(M===0&&v===W)break;e++}let y=V(E,e);if(y)A=y.split(",").map((v)=>v.trim())}x();let b=Pt(),k=`${o?a?"export default ":"export declare ":"declare "}${r?"abstract ":""}class ${l}${u}${C?` extends ${C}`:""}${A&&A.length>0?` implements ${A.join(", ")}`:""} ${b}`,D=Ve(s);return{kind:"class",name:l,text:k,isExported:o,isDefault:a,extends:C||void 0,implements:A,generics:u||void 0,modifiers:r?["abstract"]:void 0,leadingComments:D,start:s,end:e}}let Rt;function Pt(){if(e>=g||f.charCodeAt(e)!==W)return"{}";e++;let s={fields:new Map,pending:[],isStatic:!1};he.push(s);let o=[],r=new Set;while(e<g){if(x(),e>=g)break;if(f.charCodeAt(e)===U){e++;break}if(f.charCodeAt(e)===J){e++;continue}if(Rt=Ve(e),w("static")&&kt("static")===W){e+=6,x(),Pe(W,U);continue}let a=!1,l=!1,u=!1,C=!1,A=!1,b=!1,p=!1,k=!1,D=!0;while(D){x();let N=e,B=Te();if(e=N,B){let R=kt(B);if(R===X||R===ke||R===$t||R===33||R===Ze||R===$e||R===J||R===U)break}if(w("private")){a=!0,e+=7;continue}if(w("protected")){l=!0,e+=9;continue}if(w("public")){e+=6;continue}if(w("static")){u=!0,e+=6;continue}if(w("abstract")){C=!0,e+=8;continue}if(w("readonly")){A=!0,e+=8;continue}if(w("override")){b=!0,e+=8;continue}if(w("accessor")){p=!0,e+=8;continue}if(w("async")){k=!0,e+=5;continue}if(w("declare")){e+=7;continue}break}if(x(),e>=g||f.charCodeAt(e)===U)break;let E=e;if(s.isStatic=u,(w("get")||w("set"))&&Mt(kt(f.slice(e,e+3))))e+=3,x();if(f.charCodeAt(e)===we)e++,x();let M=bt();e=E;let y=M.startsWith("#");if(y)a=!0;if(a&&M&&M!=="constructor"){let N=y?u?" static #private_static;":" #private;":` private ${u?"static ":""}${M};`,R=M[0]==="'"||M[0]==='"'?d(M)??M:M,ye=y?`${u?"static":"instance"}#`:`${u?"static:":"instance:"}${R}`;if(!r.has(ye))r.add(ye),o.push(N)}let v=a?[]:o,q=" ";if(l)q+="protected ";if(u)q+="static ";if(C)q+="abstract ";if(A)q+="readonly ";if(w("constructor")){e+=11,x();let N=et();if(x(),xn(N,o),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let B=ot(N);o.push(a?" private constructor();":` ${l?"protected ":""}constructor${B};`)}else if(w("get"))if(e+=3,x(),e<g&&Mt(f.charCodeAt(e))){let N=bt();if(N.startsWith("#")){if(x(),e<g&&f.charCodeAt(e)===X)et();if(x(),ut(),x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;continue}x(),et(),x();let B=ut(),R;if(x(),e<g&&f.charCodeAt(e)===W){let oe=e+1;if(Pe(W,U),!B&&!me)R=f.slice(oe,e-1),B=I(R,!1,"()",(De)=>Y(De,u))}else if(e<g&&f.charCodeAt(e)===J)e++;let ye=v.length;if(v.push(`${q}get ${N}(): ${R?L(B):B||"unknown"};`),R)s.pending.push(()=>{let oe=I(R,!1,"()",(De)=>Y(De,u));v[ye]=`${q}get ${N}(): ${L(oe)};`})}else Yt("get",q,u,A,k,v);else if(w("set"))if(e+=3,x(),e<g&&Mt(f.charCodeAt(e))){let N=bt();if(N.startsWith("#")){if(x(),e<g&&f.charCodeAt(e)===X)et();if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;continue}x();let B=et();if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let R=ot(B);v.push(`${q}set ${N}${R};`)}else Yt("set",q,u,A,k,v);else{let N=f.charCodeAt(e)===we;if(N)e++,x();let B=bt();if(!B){Xt();continue}en(B,q,u,A,N,C,k,v)}}for(let a of s.pending)a();return he.pop(),`{
31
31
  ${o.join(`
32
32
  `)}
33
- }`}function Mt(s){return c(s)||s===Se||s===on||s===pe||s===Ae}function bt(){if(e>=g)return"";let s=f.charCodeAt(e);if(s===Se){let o=e;return Pe(Se,_e),f.slice(o,e)}if(s===on)return e++,`#${Te()}`;if(s===pe||s===Ae){let o=e;return Ge(s),f.slice(o,e)}return Te()}function kt(s){let o=e;e+=s.length,x();let r=e<g?f.charCodeAt(e):0;return e=o,r}function Xt(){let s=0;while(e<g){if(Be())continue;let o=f.charCodeAt(e);if(o===W||o===X)s++;else if(o===U||o===ge){if(s===0)return;s--}else if(o===J&&s===0){e++;return}if(s===0&&ft())return;e++}}function Yt(s,o,r,a,l,u){en(s,o,r,a,!1,!1,l,u)}function en(s,o,r,a,l,u,C,A){let b=Rt;if(Rt=void 0,x(),e>=g)return;let p=f.charCodeAt(e),k=!1;if(p===$t)k=!0,e++,x();if(e<g&&f.charCodeAt(e)===33)e++,x();let D=e<g?f.charCodeAt(e):0;if(D===X||D===ke){let E=D===ke?Xe():"";x();let M=et();x();let y=ut(),v,q=y.length>0;if(!y)if(C&&l)y="AsyncGenerator<unknown, void, unknown>";else if(l)y="Generator<unknown, void, unknown>";else if(C)y="Promise<void>";else y="void";if(x(),e<g&&f.charCodeAt(e)===W){let ye=e+1;if(Pe(W,U),!q&&!l)v=f.slice(ye,e-1),y=I(v,C,M,(oe)=>Y(oe,r))}else if(e<g&&f.charCodeAt(e)===J)e++;let N=ot(M),B=k?"?":"",R=A.length;if(A.push(`${o}${s}${B}${E}${N}: ${v?L(y):y};`),v)he.at(-1)?.pending.push(()=>{let ye=I(v,C,M,(oe)=>Y(oe,r));A[R]=`${o}${s}${B}${E}${N}: ${L(ye)};`})}else if(D===Ze||D===$e||D===J||D===U||D===be||D===ve){let E="";if(D===Ze){e++,x();let N=e,B=0;while(e<g){if(Be())continue;let R=f.charCodeAt(e);if(R===X||R===W||R===Se||R===ke)B++;else if(R===ge||R===U||R===_e||R===Ce&&!Ue()){if(B===0)break;B--}else if(B===0&&(R===J||R===Je))break;else if(B===0&&R===$e&&!St())break;if(B===0&&ft())break;e++}E=V(N,e)}let M="";if(e<g&&f.charCodeAt(e)===$e)if(me&&E){e++;let N=0;while(e<g){if(Be())continue;let B=f.charCodeAt(e);if(B===X||B===W||B===Se)N++;else if(B===ge||B===U||B===_e){if(N===0&&B===U)break;N--}else if(N===0&&B===J)break;if(N===0&&ft())break;e++}}else{e++,x();let N=e,B=0;while(e<g){if(Be())continue;let R=f.charCodeAt(e);if(R===X||R===W||R===Se)B++;else if(R===ge||R===U||R===_e){if(B===0&&R===U)break;B--}else if(B===0&&R===J)break;if(B===0&&ft())break;e++}M=V(N,e)}if(e<g&&f.charCodeAt(e)===J)e++;let y=E.length>0;if(!E)if(M){let N=At(M);if(N)E=N;else E=M.endsWith("as const")||r&&a?Tt(M):dt(M)}else E="unknown";let v=k?"?":"";he.at(-1)?.fields.set(`${r?"static:":""}${s}`,k?`(${E}) | undefined`:E);let q=K&&!y&&M?Wt(b,M,E):"";A.push(`${q}${o}${s}${v}: ${E};`)}else Xt()}function $n(s){let o=0;for(let r=0;r<s.length;r++){let a=s.charCodeAt(r);if(a===X||a===W||a===Se||a===ke)o++;else if(a===ge||a===U||a===_e||a===Ce&&s.charCodeAt(r-1)!==$e)o--;else if(a===$e&&o===0&&s.charCodeAt(r+1)!==Ce&&s.charCodeAt(r+1)!==$e)return!0}return!1}function xn(s,o){let r=s.slice(1,-1).trim();if(!r)return;let a=[],l=0,u=0,C=!1,A=0,b=[];for(let p=0;p<=r.length;p++){if(p===r.length){b.push(r.slice(l)),a.push(Ct(r.slice(l).trim()));break}let k=r.charCodeAt(p);if(C){if(k===Qe){p++;continue}if(k===A)C=!1;continue}if(k===F&&p+1<r.length){let D=r.charCodeAt(p+1);if(D===we){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===we&&r.charCodeAt(p+1)===F))p++;p++;continue}if(D===F){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(k===pe||k===Ae||k===Ee){C=!0,A=k;continue}if(k===X||k===W||k===Se||k===ke)u++;else if(k===ge||k===U||k===_e||k===Ce&&!(p>0&&r.charCodeAt(p-1)===$e))u--;else if(k===Je&&u===0)b.push(r.slice(l,p)),a.push(Ct(r.slice(l,p).trim())),l=p+1}for(let[p,k]of a.entries()){let D=k.startsWith("public ")||k.startsWith("public\t"),E=k.startsWith("protected ")||k.startsWith("protected\t"),M=k.startsWith("private ")||k.startsWith("private\t"),y=k.includes("readonly ");if(!D&&!E&&!M&&!y)continue;let v=k,q=[];if(M){let oe=7;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("private")}if(D){let oe=6;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("public")}if(E){let oe=9;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("protected")}if(y){let oe=v.indexOf("readonly ");if(oe!==-1){let De=oe+8;while(De<v.length&&We(v.charCodeAt(De)))De++;v=v.slice(0,oe)+v.slice(De)}q.push("readonly")}let N=q.length>0?`${q.join(" ")} `:"",B=Qt(v),R=v.search(/[?:=]/);if(R!==-1&&v.charCodeAt(R)!==63&&$n(v))B=B.replace(/^([\w$]+)\?:/,"$1:");let ye="";if(K&&!M&&R!==-1&&v.charCodeAt(R)===$e){let oe=v.slice(R+1);ye=Wt(Jn(b[p]),oe,dt(oe))}o.push(M?` private ${B.split(/[?:]/,1)[0]};`:`${ye} ${N}${B};`)}}function Lt(s=" "){if(e>=g||f.charCodeAt(e)!==W)return"{}";e++;let o=[];while(e<g){if(x(),e>=g)break;if(f.charCodeAt(e)===U){e++;break}if(f.charCodeAt(e)===J){e++;continue}let r=!1;if(w("export"))r=!0,e+=6,x();if(w("declare"))e+=7,x();let a=r?"export ":"";if(w("function")||w("async")&&yn("async","function")){let l=!1;if(w("async"))l=!0,e+=5,x();if(e+=8,x(),e<g&&f.charCodeAt(e)===we)e++,x();let C=Te();x();let A=Xe();x();let b=et();x();let p=ut();if(!p)p=l?"Promise<void>":"void";if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let k=ot(b);o.push(`${s}${a}function ${C}${A}${k}: ${p};`)}else if(w("const")||w("let")||w("var")){let l=w("const")?"const":w("let")?"let":"var";e+=l.length,x();let u=Te();if(!u){Me(!0);continue}x();let C="";if(e<g&&f.charCodeAt(e)===Ze){e++,x();let b=e,p=0;while(e<g){if(Be())continue;let k=f.charCodeAt(e);if(k===X||k===W||k===Se||k===ke)p++;else if(k===U&&p===0)break;else if(k===ge||k===U||k===_e||k===Ce&&!Ue())p--;else if(p===0&&(k===J||k===Je))break;else if(p===0&&k===$e&&!St())break;if(p===0&&st())break;e++}C=V(b,e)}let A="";if(e<g&&f.charCodeAt(e)===$e){e++,x();let b=e,p=0;while(e<g){if(Be())continue;let k=f.charCodeAt(e);if(k===X||k===W||k===Se||k===ke)p++;else if(k===U&&p===0)break;else if(k===ge||k===U||k===_e||k===Ce&&!Ue())p--;else if(p===0&&(k===J||k===Je))break;if(p===0&&st())break;e++}A=V(b,e)}if(e<g&&f.charCodeAt(e)===J)e++;if(!C&&A){let b=At(A);if(b)C=b;else if(l==="const")C=Tt(A);else C=dt(A)}if(!C)C="unknown";o.push(`${s}${a}${l} ${u}: ${C};`)}else if(w("interface")){e+=9,x();let l=Te();x();let u=Xe();x();let C="";if(w("extends")){e+=7,x();let b=e,p=0;while(e<g){if(Be())continue;let k=f.charCodeAt(e);if(k===ke)p++;else if(k===Ce&&!Ue())p--;else if(k===W&&p===0)break;e++}C=V(b,e)}let A=Vt(Dt());o.push(`${s}${a}interface ${l}${u}${C?` extends ${C}`:""} ${A}`)}else if(w("type")){e+=4,x();let l=Te();x();let u=Xe();if(x(),e<g&&f.charCodeAt(e)===$e){e++,x();let C=e,A=0;while(e<g){if(Be())continue;let p=f.charCodeAt(e);if(p===X||p===W||p===Se||p===ke)A++;else if(p===U&&A===0)break;else if(p===ge||p===U||p===_e||p===Ce&&!Ue())A--;else if(A===0&&p===J)break;if(A===0&&st())break;e++}let b=V(C,e);if(e<g&&f.charCodeAt(e)===J)e++;o.push(`${s}${a}type ${l}${u} = ${b}`)}}else if(w("class")){e+=5,x();let l=Te();x();let u=Xe();x();let C=e,A=0;while(e<g){if(Be())continue;let D=f.charCodeAt(e);if(D===ke)A++;else if(D===Ce&&!Ue())A--;else if(D===W&&A===0)break;e++}let b=V(C,e),p=b?` ${b}`:"",k=Pt();o.push(`${s}${a}class ${l}${u}${p} ${k}`)}else if(w("enum")){e+=4,x();let l=Te();x();let u=Dt();o.push(`${s}${a}enum ${l} ${u}`)}else if(w("namespace")||w("module")){let l=w("namespace")?"namespace":"module";e+=l.length,x();let u=Te();x();let C=Lt(s);o.push(`${s}${a}${l} ${u} ${C}`)}else if(w("abstract"))if(e+=8,x(),w("class")){e+=5,x();let l=Te();x();let u=Xe();x();let C=e,A=0;while(e<g){if(Be())continue;let D=f.charCodeAt(e);if(D===ke)A++;else if(D===Ce&&!Ue())A--;else if(D===W&&A===0)break;e++}let b=V(C,e),p=b?` ${b}`:"",k=Pt();o.push(`${s}${a}abstract class ${l}${u}${p} ${k}`)}else Me(!0);else if(r&&w("default")){e+=7,x();let l=e;Me(!0);let u=V(l,e);if(u.charCodeAt(u.length-1)===J)u=u.slice(0,-1);if(u)o.push(`${s}export default ${u};`)}else if(!r&&(f.charCodeAt(e)===pe||f.charCodeAt(e)===Ae||f.charCodeAt(e)===Ee))Me(!0);else Me(!0)}if(o.length===0)return"{}";return`{
33
+ }`}function Mt(s){return c(s)||s===Se||s===on||s===pe||s===Ae}function bt(){if(e>=g)return"";let s=f.charCodeAt(e);if(s===Se){let o=e;return Pe(Se,_e),f.slice(o,e)}if(s===on)return e++,`#${Te()}`;if(s===pe||s===Ae){let o=e;return Ge(s),f.slice(o,e)}return Te()}function kt(s){let o=e;e+=s.length,x();let r=e<g?f.charCodeAt(e):0;return e=o,r}function Xt(){let s=0;while(e<g){if(Le())continue;let o=f.charCodeAt(e);if(o===W||o===X)s++;else if(o===U||o===ge){if(s===0)return;s--}else if(o===J&&s===0){e++;return}if(s===0&&ft())return;e++}}function Yt(s,o,r,a,l,u){en(s,o,r,a,!1,!1,l,u)}function en(s,o,r,a,l,u,C,A){let b=Rt;if(Rt=void 0,x(),e>=g)return;let p=f.charCodeAt(e),k=!1;if(p===$t)k=!0,e++,x();if(e<g&&f.charCodeAt(e)===33)e++,x();let D=e<g?f.charCodeAt(e):0;if(D===X||D===ke){let E=D===ke?Xe():"";x();let M=et();x();let y=ut(),v,q=y.length>0;if(!y)if(C&&l)y="AsyncGenerator<unknown, void, unknown>";else if(l)y="Generator<unknown, void, unknown>";else if(C)y="Promise<void>";else y="void";if(x(),e<g&&f.charCodeAt(e)===W){let ye=e+1;if(Pe(W,U),!q&&!l)v=f.slice(ye,e-1),y=I(v,C,M,(oe)=>Y(oe,r))}else if(e<g&&f.charCodeAt(e)===J)e++;let N=ot(M),B=k?"?":"",R=A.length;if(A.push(`${o}${s}${B}${E}${N}: ${v?L(y):y};`),v)he.at(-1)?.pending.push(()=>{let ye=I(v,C,M,(oe)=>Y(oe,r));A[R]=`${o}${s}${B}${E}${N}: ${L(ye)};`})}else if(D===Ze||D===$e||D===J||D===U||D===be||D===ve){let E="";if(D===Ze){e++,x();let N=e,B=0;while(e<g){if(Le())continue;let R=f.charCodeAt(e);if(R===X||R===W||R===Se||R===ke)B++;else if(R===ge||R===U||R===_e||R===Ce&&!Ue()){if(B===0)break;B--}else if(B===0&&(R===J||R===Je))break;else if(B===0&&R===$e&&!St())break;if(B===0&&ft())break;e++}E=V(N,e)}let M="";if(e<g&&f.charCodeAt(e)===$e)if(me&&E){e++;let N=0;while(e<g){if(Le())continue;let B=f.charCodeAt(e);if(B===X||B===W||B===Se)N++;else if(B===ge||B===U||B===_e){if(N===0&&B===U)break;N--}else if(N===0&&B===J)break;if(N===0&&ft())break;e++}}else{e++,x();let N=e,B=0;while(e<g){if(Le())continue;let R=f.charCodeAt(e);if(R===X||R===W||R===Se)B++;else if(R===ge||R===U||R===_e){if(B===0&&R===U)break;B--}else if(B===0&&R===J)break;if(B===0&&ft())break;e++}M=V(N,e)}if(e<g&&f.charCodeAt(e)===J)e++;let y=E.length>0;if(!E)if(M){let N=At(M);if(N)E=N;else E=M.endsWith("as const")||r&&a?Tt(M):dt(M)}else E="unknown";let v=k?"?":"";he.at(-1)?.fields.set(`${r?"static:":""}${s}`,k?`(${E}) | undefined`:E);let q=K&&!y&&M?_t(b,M,E):"";A.push(`${q}${o}${s}${v}: ${E};`)}else Xt()}function $n(s){let o=0;for(let r=0;r<s.length;r++){let a=s.charCodeAt(r);if(a===X||a===W||a===Se||a===ke)o++;else if(a===ge||a===U||a===_e||a===Ce&&s.charCodeAt(r-1)!==$e)o--;else if(a===$e&&o===0&&s.charCodeAt(r+1)!==Ce&&s.charCodeAt(r+1)!==$e)return!0}return!1}function xn(s,o){let r=s.slice(1,-1).trim();if(!r)return;let a=[],l=0,u=0,C=!1,A=0,b=[];for(let p=0;p<=r.length;p++){if(p===r.length){b.push(r.slice(l)),a.push(Ct(r.slice(l).trim()));break}let k=r.charCodeAt(p);if(C){if(k===Qe){p++;continue}if(k===A)C=!1;continue}if(k===F&&p+1<r.length){let D=r.charCodeAt(p+1);if(D===we){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===we&&r.charCodeAt(p+1)===F))p++;p++;continue}if(D===F){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(k===pe||k===Ae||k===Ee){C=!0,A=k;continue}if(k===X||k===W||k===Se||k===ke)u++;else if(k===ge||k===U||k===_e||k===Ce&&!(p>0&&r.charCodeAt(p-1)===$e))u--;else if(k===Je&&u===0)b.push(r.slice(l,p)),a.push(Ct(r.slice(l,p).trim())),l=p+1}for(let[p,k]of a.entries()){let D=k.startsWith("public ")||k.startsWith("public\t"),E=k.startsWith("protected ")||k.startsWith("protected\t"),M=k.startsWith("private ")||k.startsWith("private\t"),y=k.includes("readonly ");if(!D&&!E&&!M&&!y)continue;let v=k,q=[];if(M){let oe=7;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("private")}if(D){let oe=6;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("public")}if(E){let oe=9;while(oe<v.length&&We(v.charCodeAt(oe)))oe++;v=v.slice(oe),q.push("protected")}if(y){let oe=v.indexOf("readonly ");if(oe!==-1){let De=oe+8;while(De<v.length&&We(v.charCodeAt(De)))De++;v=v.slice(0,oe)+v.slice(De)}q.push("readonly")}let N=q.length>0?`${q.join(" ")} `:"",B=Qt(v),R=v.search(/[?:=]/);if(R!==-1&&v.charCodeAt(R)!==63&&$n(v))B=B.replace(/^([\w$]+)\?:/,"$1:");let ye="";if(K&&!M&&R!==-1&&v.charCodeAt(R)===$e){let oe=v.slice(R+1);ye=_t(Yn(b[p]),oe,dt(oe))}o.push(M?` private ${B.split(/[?:]/,1)[0]};`:`${ye} ${N}${B};`)}}function Wt(s=" "){if(e>=g||f.charCodeAt(e)!==W)return"{}";e++;let o=[];while(e<g){if(x(),e>=g)break;if(f.charCodeAt(e)===U){e++;break}if(f.charCodeAt(e)===J){e++;continue}let r=!1;if(w("export"))r=!0,e+=6,x();if(w("declare"))e+=7,x();let a=r?"export ":"";if(w("function")||w("async")&&yn("async","function")){let l=!1;if(w("async"))l=!0,e+=5,x();if(e+=8,x(),e<g&&f.charCodeAt(e)===we)e++,x();let C=Te();x();let A=Xe();x();let b=et();x();let p=ut();if(!p)p=l?"Promise<void>":"void";if(x(),e<g&&f.charCodeAt(e)===W)Pe(W,U);else if(e<g&&f.charCodeAt(e)===J)e++;let k=ot(b);o.push(`${s}${a}function ${C}${A}${k}: ${p};`)}else if(w("const")||w("let")||w("var")){let l=w("const")?"const":w("let")?"let":"var";e+=l.length,x();let u=Te();if(!u){Me(!0);continue}x();let C="";if(e<g&&f.charCodeAt(e)===Ze){e++,x();let b=e,p=0;while(e<g){if(Le())continue;let k=f.charCodeAt(e);if(k===X||k===W||k===Se||k===ke)p++;else if(k===U&&p===0)break;else if(k===ge||k===U||k===_e||k===Ce&&!Ue())p--;else if(p===0&&(k===J||k===Je))break;else if(p===0&&k===$e&&!St())break;if(p===0&&it())break;e++}C=V(b,e)}let A="";if(e<g&&f.charCodeAt(e)===$e){e++,x();let b=e,p=0;while(e<g){if(Le())continue;let k=f.charCodeAt(e);if(k===X||k===W||k===Se||k===ke)p++;else if(k===U&&p===0)break;else if(k===ge||k===U||k===_e||k===Ce&&!Ue())p--;else if(p===0&&(k===J||k===Je))break;if(p===0&&it())break;e++}A=V(b,e)}if(e<g&&f.charCodeAt(e)===J)e++;if(!C&&A){let b=At(A);if(b)C=b;else if(l==="const")C=Tt(A);else C=dt(A)}if(!C)C="unknown";o.push(`${s}${a}${l} ${u}: ${C};`)}else if(w("interface")){e+=9,x();let l=Te();x();let u=Xe();x();let C="";if(w("extends")){e+=7,x();let b=e,p=0;while(e<g){if(Le())continue;let k=f.charCodeAt(e);if(k===ke)p++;else if(k===Ce&&!Ue())p--;else if(k===W&&p===0)break;e++}C=V(b,e)}let A=Vt(Dt());o.push(`${s}${a}interface ${l}${u}${C?` extends ${C}`:""} ${A}`)}else if(w("type")){e+=4,x();let l=Te();x();let u=Xe();if(x(),e<g&&f.charCodeAt(e)===$e){e++,x();let C=e,A=0;while(e<g){if(Le())continue;let p=f.charCodeAt(e);if(p===X||p===W||p===Se||p===ke)A++;else if(p===U&&A===0)break;else if(p===ge||p===U||p===_e||p===Ce&&!Ue())A--;else if(A===0&&p===J)break;if(A===0&&it())break;e++}let b=V(C,e);if(e<g&&f.charCodeAt(e)===J)e++;o.push(`${s}${a}type ${l}${u} = ${b}`)}}else if(w("class")){e+=5,x();let l=Te();x();let u=Xe();x();let C=e,A=0;while(e<g){if(Le())continue;let D=f.charCodeAt(e);if(D===ke)A++;else if(D===Ce&&!Ue())A--;else if(D===W&&A===0)break;e++}let b=V(C,e),p=b?` ${b}`:"",k=Pt();o.push(`${s}${a}class ${l}${u}${p} ${k}`)}else if(w("enum")){e+=4,x();let l=Te();x();let u=Dt();o.push(`${s}${a}enum ${l} ${u}`)}else if(w("namespace")||w("module")){let l=w("namespace")?"namespace":"module";e+=l.length,x();let u=Te();x();let C=Wt(s);o.push(`${s}${a}${l} ${u} ${C}`)}else if(w("abstract"))if(e+=8,x(),w("class")){e+=5,x();let l=Te();x();let u=Xe();x();let C=e,A=0;while(e<g){if(Le())continue;let D=f.charCodeAt(e);if(D===ke)A++;else if(D===Ce&&!Ue())A--;else if(D===W&&A===0)break;e++}let b=V(C,e),p=b?` ${b}`:"",k=Pt();o.push(`${s}${a}abstract class ${l}${u}${p} ${k}`)}else Me(!0);else if(r&&w("default")){e+=7,x();let l=e;Me(!0);let u=V(l,e);if(u.charCodeAt(u.length-1)===J)u=u.slice(0,-1);if(u)o.push(`${s}export default ${u};`)}else if(!r&&(f.charCodeAt(e)===pe||f.charCodeAt(e)===Ae||f.charCodeAt(e)===Ee))Me(!0);else Me(!0)}if(o.length===0)return"{}";return`{
34
34
  ${o.join(`
35
35
  `)}
36
- }`}function yn(s,o){let r=e+s.length;while(r<g&&We(f.charCodeAt(r)))r++;for(let a=0;a<o.length;a++)if(r+a>=g||f.charCodeAt(r+a)!==o.charCodeAt(a))return!1;return r+o.length>=g||!i(f.charCodeAt(r+o.length))}function at(s,o,r){e+=r.length,x();let a="",l=f.charCodeAt(e);if(l===pe||l===Ae){let p=e;Ge(l),a=f.slice(p,e)}else{a=Te();while(e<g&&f.charCodeAt(e)===Ye)e++,a+=`.${Te()}`}x();let u=e<g&&f.charCodeAt(e)===W?Lt():"{}",C=`${o?"export ":""}declare ${r} ${a} ${u}`,A=Ve(s),b=a.startsWith("'")||a.startsWith('"');return{kind:"module",name:a,text:C,isExported:o,moduleForm:b?"quoted":r==="namespace"?"namespace":"identifier",source:b?a.slice(1,-1):void 0,leadingComments:A,start:s,end:e}}function tn(s,o){Me();let r=V(o,e);if(r.charCodeAt(r.length-1)===J)r=r.slice(0,-1).trimEnd();if(!r)return;let a=c(r.charCodeAt(0));for(let k=1;a&&k<r.length;k++)a=i(r.charCodeAt(k));let l=Ve(s);if(a){P.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__",C=1;while(f.includes(u))u=`__dtsx_default_export_${C++}__`;let b=At(r)||se(r)||n(r,!1),p=b==="unknown"&&In(r)?`typeof ${r}`:b;P.push({kind:"variable",name:u,text:`declare const ${u}: ${p};`,isExported:!1,typeAnnotation:p,modifiers:["const"],start:s,end:e}),P.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function nn(){if(f.charCodeAt(e)===W)return Pe(W,U),!0;let s=w("if"),o=w("do"),r=w("try"),a=w("for");if(!s&&!o&&!r&&!a&&!w("while")&&!w("switch")&&!w("with"))return!1;if(Te(),x(),a&&w("await"))e+=5,x();if(!o&&!r&&f.charCodeAt(e)===X)Pe(X,ge);if(wt(),x(),s&&w("else"))e+=4,wt();else if(o&&w("while")){if(e+=5,x(),f.charCodeAt(e)===X)Pe(X,ge);if(x(),f.charCodeAt(e)===J)e++}else if(r){if(w("catch")){if(e+=5,x(),f.charCodeAt(e)===X)Pe(X,ge);wt(),x()}if(w("finally"))e+=7,wt()}return!0}function wt(){if(x(),!nn())Me()}while(e<g){if(x(),e>=g)break;if(nn())continue;let s=e,o=f.charCodeAt(e);if(o===105&&w("import"))P.push(mn(s));else if(o===101&&w("export")){e+=6,x();let r=f.charCodeAt(e);if(r===100&&w("default")){e+=7,x();let a=e,l=f.charCodeAt(e);if(l===102&&w("function")){let u=tt(s,!0,!1,!0);if(u)P.push(u)}else if(l===97&&w("async")&&kt("async")!==J)if(e+=5,x(),w("function")){let u=tt(s,!0,!0,!0);if(u)P.push(u)}else tn(s,a);else if(l===99&&w("class")){let u=nt(s,!0,!1,!0);P.push(u)}else if(l===97&&w("abstract")){if(e+=8,x(),w("class")){let u=nt(s,!0,!0,!0);P.push(u)}}else tn(s,a)}else if(r===116&&w("type")){let a=e;if(e+=4,x(),e<g&&f.charCodeAt(e)===W){Gt();let l=V(s,e),u=Ve(s);P.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:gt(l),leadingComments:u,start:s,end:e})}else if(e<g&&f.charCodeAt(e)===we){Kt();let l=V(s,e);P.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:gt(l),start:s,end:e})}else{e=a;let l=Et(s,!0);P.push(l)}}else if(r===105&&w("interface")){let a=Ot(s,!0);P.push(a)}else if(r===102&&w("function")){let a=tt(s,!0,!1,!1);if(a)P.push(a)}else if(r===97&&w("async"))if(e+=5,x(),w("function")){let a=tt(s,!0,!0,!1);if(a)P.push(a)}else Me();else if(r===99)if(w("class")){let a=nt(s,!0,!1);P.push(a)}else if(w("const")){let a=e;if(e+=5,x(),w("enum")){e=a+5,x();let l=ct(s,!0,!0);P.push(l)}else{e=a;let l=rt(s,"const",!0);for(let u=0;u<l.length;u++)P.push(l[u])}}else Me();else if(r===97&&w("abstract")){if(e+=8,x(),w("class")){let a=nt(s,!0,!0);P.push(a)}}else if(r===108&&w("let")){let a=rt(s,"let",!0);for(let l=0;l<a.length;l++)P.push(a[l])}else if(r===118&&w("var")){let a=rt(s,"var",!0);for(let l=0;l<a.length;l++)P.push(a[l])}else if(r===101&&w("enum")){let a=ct(s,!0,!1);P.push(a)}else if(r===100&&w("declare"))e+=7,x(),rn(s,!0);else if(r===110&&w("namespace")&&mt(9)){let a=at(s,!0,"namespace");P.push(a)}else if(r===109&&w("module")&&mt(6)){let a=at(s,!0,"module");P.push(a)}else if(r===W){Gt();let a=V(s,e),l=a.includes("export type"),u=Ve(s);P.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:l,source:gt(a),leadingComments:u,start:s,end:e})}else if(r===we){Kt();let a=V(s,e),l=Ve(s);P.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:!1,source:gt(a),leadingComments:l,start:s,end:e})}else{Me();let a=V(s,e);if(a)P.push({kind:"export",name:"",text:a,isExported:!0,start:s,end:e})}}else if(o===100&&w("declare"))e+=7,x(),rn(s,!1);else if(o===105&&w("interface")){let r=Ot(s,!1);ae.set(r.name,r)}else if(o===116&&w("type")){let r=Et(s,!1);ae.set(r.name,r),P.push(r)}else if(o===102&&w("function")){let r=tt(s,!1,!1,!1);if(r)ee(r);else Me()}else if(o===97)if(w("async")){let r=e;if(e+=5,x(),w("function")){let a=tt(s,!1,!0,!1);if(a)ee(a);else e=r,Me()}else e=r,Me()}else if(w("abstract"))if(e+=8,x(),w("class")){let r=nt(s,!1,!1);ae.set(r.name,r),P.push(r)}else Me();else e++,Me();else if(o===99)if(w("class")){let r=nt(s,!1,!1);ae.set(r.name,r),P.push(r)}else if(w("const")){let r=e;if(e+=5,x(),w("enum")){e=r+5,x();let a=ct(s,!1,!0);ae.set(a.name,a),P.push(a)}else{e=r;let a=rt(s,"const",!1);for(let l=0;l<a.length;l++)ae.set(a[l].name,a[l])}}else e++,Me();else if(o===101&&w("enum")){let r=ct(s,!1,!1);ae.set(r.name,r),P.push(r)}else if(o===108&&w("let")||o===118&&w("var")){let r=w("let")?"let":"var",a=rt(s,r,!1);for(let l=0;l<a.length;l++)ae.set(a[l].name,a[l])}else if(o===109&&w("module")&&mt(6)){let r=at(s,!1,"module");P.push(r)}else if(o===110&&w("namespace")&&mt(9)){let r=at(s,!1,"namespace");P.push(r)}else{let r=f.charCodeAt(e);if(r===J)e++;else if(r===pe||r===Ae){if(Ge(r),e<g&&f.charCodeAt(e)===J)e++}else if(r===Ee){if(lt(),e<g&&f.charCodeAt(e)===J)e++}else if(r===Dn){if(e++,Te(),x(),e<g&&f.charCodeAt(e)===Ye)e++,Te(),x();if(e<g&&f.charCodeAt(e)===X)Pe(X,ge)}else e++,Me()}}if(xe.size>0){sn(P);for(let s of Q.values())sn(s)}if(Nn(f,P,ae,Q),Bn(P,ae),Yn(P,ae),!me)jn(f,P,ae,ne);if(te){let s=new Set(P);for(let o of[...ae.values(),...[...Q.values()].flat()])if(!s.has(o))P.push(o),s.add(o);return P.sort((o,r)=>(o.start??0)-(r.start??0))}if(ae.size>0)On(P,ae,Q);return P;function sn(s){let o=new Map;for(let a of s)if(a.kind==="function")o.set(a.name,(o.get(a.name)||0)+1);let r=new Set;for(let[a,l]of o)if(l>1)r.add(a);if(r.size>0){let a=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&&xe.has(s[u])){a.add(u);break}if(a.size>0){let l=[...a].sort((u,C)=>C-u);for(let u of l)s.splice(u,1)}}}function rn(s,o){if(w("function")){let r=tt(s,o,!1,!1);if(r)P.push(r)}else if(w("async")){if(e+=5,x(),w("function")){let r=tt(s,o,!0,!1);if(r)P.push(r)}}else if(w("class")){let r=nt(s,o,!1);P.push(r)}else if(w("abstract")){if(e+=8,x(),w("class")){let r=nt(s,o,!0);P.push(r)}}else if(w("interface")){let r=Ot(s,o);P.push(r)}else if(w("type")){let r=Et(s,o);P.push(r)}else if(w("enum")){let r=ct(s,o,!1);P.push(r)}else if(w("const")){let r=e;if(e+=5,x(),w("enum")){e=r+5,x();let a=ct(s,o,!0);P.push(a)}else{e=r;let a=rt(s,"const",o);for(let l=0;l<a.length;l++)if(o||!ce)P.push(a[l]);else ae.set(a[l].name,a[l])}}else if(w("let")||w("var")){let r=w("let")?"let":"var",a=rt(s,r,o);for(let l=0;l<a.length;l++)if(o||!ce)P.push(a[l]);else ae.set(a[l].name,a[l])}else if(w("module")){let r=at(s,o,"module");P.push(r)}else if(w("namespace")){let r=at(s,o,"namespace");P.push(r)}else if(w("global")){e+=6,x();let a=`declare global ${e<g&&f.charCodeAt(e)===W?Lt():"{}"}`,l=Ve(s);P.push({kind:"module",name:"global",text:a,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else Me()}}class an{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(S){this.names=S;for(let Z of S.keys()){if(!Z)continue;this.lengths[Math.min(Z.length,64)]=1,this.firstUnits[Z.charCodeAt(0)]=1}this.size=S.size}scan(S,Z){if(this.size===0)return!1;let H=!1,G=0,te=S.length;while(G<te){let ne=S.charCodeAt(G);if(ne>=65&&ne<=90||ne>=97&&ne<=122||ne===95||ne===36||ne>127){let f=G;G++;while(G<te){let K=S.charCodeAt(G);if(K>=65&&K<=90||K>=97&&K<=122||K>=48&&K<=57||K===95||K===36||K>127)G++;else break}if(this.firstUnits[ne]===1&&this.lengths[Math.min(G-f,64)]===1){let K=S.substring(f,G),me=this.names.get(K);if(me!==void 0){if(Z.add(K),me.kind==="function"||me.kind==="variable")H=!0}}}else G++}return H}}function cn(S,Z){let H=0;while(H<S.length){let G=S.charCodeAt(H);if(G===pe||G===Ae||G===Ee){let ce=G;H++;while(H<S.length)if(S.charCodeAt(H)===Qe)H+=2;else if(S.charCodeAt(H++)===ce)break;continue}if(G===F&&S.charCodeAt(H+1)===F){H+=2;while(H<S.length&&S.charCodeAt(H)!==be&&S.charCodeAt(H)!==ve)H++;continue}if(G===F&&S.charCodeAt(H+1)===we){let ce=S.indexOf("*/",H+2);H=ce===-1?S.length:ce+2;continue}if(!c(G)){H++;continue}let te=H++;while(H<S.length&&i(S.charCodeAt(H)))H++;let ne=te-1,f=H;while(ne>=0&&We(S.charCodeAt(ne)))ne--;while(f<S.length&&We(S.charCodeAt(f)))f++;let K=ne>=0?S.charCodeAt(ne):0,me=f<S.length?S.charCodeAt(f):0,g=te>=3&&S.slice(te-3,te)==="...";if(me===Ze||K===Ye&&!g)continue;if(me===X&&(K===W||K===Je))continue;Z.add(S.slice(te,H))}}function On(S,Z,H){let G=new Set,te=new Set;for(let ce of S)te.add(ce.name);let ne=new an(Z),f=new Set,K=new Set,me=(ce)=>{if(ne.scan(ce.text,f))qn(ce,K)},g=new Set;for(let ce=0;ce<S.length;ce++){let P=S[ce];if(P.kind!=="import"){if(me(P),typeof P.value==="string")cn(P.value,g)}}for(;;){let ce=[];for(let[Q,xe]of Z){if(G.has(Q))continue;if((xe.kind==="function"||xe.kind==="variable"?K:f).has(Q)||xe.kind!=="function"&&g.has(Q)){if(!te.has(Q)){let le=xe.kind==="function"?H.get(Q):void 0;if(le)for(let he of le)ce.push(he);else ce.push(xe);te.add(Q)}G.add(Q)}}if(ce.length===0)break;ce.sort((Q,xe)=>(Q.start??1/0)-(xe.start??1/0));let P=[],ae=0;for(let Q=0;Q<S.length;Q++){let xe=S[Q].start??1/0;while(ae<ce.length&&(ce[ae].start??1/0)<=xe)P.push(ce[ae++]);P.push(S[Q])}while(ae<ce.length)P.push(ce[ae++]);S.length=0;for(let Q=0;Q<P.length;Q++)S.push(P[Q]);for(let Q of ce)if(Q.kind!=="import"){if(me(Q),typeof Q.value==="string")cn(Q.value,g)}}}
37
- export{Ei,Ra,T,O,It};
36
+ }`}function yn(s,o){let r=e+s.length;while(r<g&&We(f.charCodeAt(r)))r++;for(let a=0;a<o.length;a++)if(r+a>=g||f.charCodeAt(r+a)!==o.charCodeAt(a))return!1;return r+o.length>=g||!i(f.charCodeAt(r+o.length))}function at(s,o,r){e+=r.length,x();let a="",l=f.charCodeAt(e);if(l===pe||l===Ae){let p=e;Ge(l),a=f.slice(p,e)}else{a=Te();while(e<g&&f.charCodeAt(e)===Ye)e++,a+=`.${Te()}`}x();let u=e<g&&f.charCodeAt(e)===W?Wt():"{}",C=`${o?"export ":""}declare ${r} ${a} ${u}`,A=Ve(s),b=a.startsWith("'")||a.startsWith('"');return{kind:"module",name:a,text:C,isExported:o,moduleForm:b?"quoted":r==="namespace"?"namespace":"identifier",source:b?a.slice(1,-1):void 0,leadingComments:A,start:s,end:e}}function tn(s,o){Me();let r=V(o,e);if(r.charCodeAt(r.length-1)===J)r=r.slice(0,-1).trimEnd();if(!r)return;let a=c(r.charCodeAt(0));for(let k=1;a&&k<r.length;k++)a=i(r.charCodeAt(k));let l=Ve(s);if(a){P.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__",C=1;while(f.includes(u))u=`__dtsx_default_export_${C++}__`;let b=At(r)||se(r)||n(r,!1),p=b==="unknown"&&In(r)?`typeof ${r}`:b;P.push({kind:"variable",name:u,text:`declare const ${u}: ${p};`,isExported:!1,typeAnnotation:p,modifiers:["const"],start:s,end:e}),P.push({kind:"export",name:"default",text:`export default ${u};`,isExported:!0,isTypeOnly:!1,leadingComments:l,start:s,end:e})}function nn(){if(f.charCodeAt(e)===W)return Pe(W,U),!0;let s=w("if"),o=w("do"),r=w("try"),a=w("for");if(!s&&!o&&!r&&!a&&!w("while")&&!w("switch")&&!w("with"))return!1;if(Te(),x(),a&&w("await"))e+=5,x();if(!o&&!r&&f.charCodeAt(e)===X)Pe(X,ge);if(wt(),x(),s&&w("else"))e+=4,wt();else if(o&&w("while")){if(e+=5,x(),f.charCodeAt(e)===X)Pe(X,ge);if(x(),f.charCodeAt(e)===J)e++}else if(r){if(w("catch")){if(e+=5,x(),f.charCodeAt(e)===X)Pe(X,ge);wt(),x()}if(w("finally"))e+=7,wt()}return!0}function wt(){if(x(),!nn())Me()}while(e<g){if(x(),e>=g)break;if(nn())continue;let s=e,o=f.charCodeAt(e);if(o===105&&w("import"))P.push(mn(s));else if(o===101&&w("export")){e+=6,x();let r=f.charCodeAt(e);if(r===100&&w("default")){e+=7,x();let a=e,l=f.charCodeAt(e);if(l===102&&w("function")){let u=tt(s,!0,!1,!0);if(u)P.push(u)}else if(l===97&&w("async")&&kt("async")!==J)if(e+=5,x(),w("function")){let u=tt(s,!0,!0,!0);if(u)P.push(u)}else tn(s,a);else if(l===99&&w("class")){let u=nt(s,!0,!1,!0);P.push(u)}else if(l===97&&w("abstract")){if(e+=8,x(),w("class")){let u=nt(s,!0,!0,!0);P.push(u)}}else tn(s,a)}else if(r===116&&w("type")){let a=e;if(e+=4,x(),e<g&&f.charCodeAt(e)===W){Gt();let l=V(s,e),u=Ve(s);P.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:gt(l),leadingComments:u,start:s,end:e})}else if(e<g&&f.charCodeAt(e)===we){Kt();let l=V(s,e);P.push({kind:"export",name:"",text:l,isExported:!0,isTypeOnly:!0,source:gt(l),start:s,end:e})}else{e=a;let l=Et(s,!0);P.push(l)}}else if(r===105&&w("interface")){let a=Ot(s,!0);P.push(a)}else if(r===102&&w("function")){let a=tt(s,!0,!1,!1);if(a)P.push(a)}else if(r===97&&w("async"))if(e+=5,x(),w("function")){let a=tt(s,!0,!0,!1);if(a)P.push(a)}else Me();else if(r===99)if(w("class")){let a=nt(s,!0,!1);P.push(a)}else if(w("const")){let a=e;if(e+=5,x(),w("enum")){e=a+5,x();let l=ct(s,!0,!0);P.push(l)}else{e=a;let l=rt(s,"const",!0);for(let u=0;u<l.length;u++)P.push(l[u])}}else Me();else if(r===97&&w("abstract")){if(e+=8,x(),w("class")){let a=nt(s,!0,!0);P.push(a)}}else if(r===108&&w("let")){let a=rt(s,"let",!0);for(let l=0;l<a.length;l++)P.push(a[l])}else if(r===118&&w("var")){let a=rt(s,"var",!0);for(let l=0;l<a.length;l++)P.push(a[l])}else if(r===101&&w("enum")){let a=ct(s,!0,!1);P.push(a)}else if(r===100&&w("declare"))e+=7,x(),rn(s,!0);else if(r===110&&w("namespace")&&mt(9)){let a=at(s,!0,"namespace");P.push(a)}else if(r===109&&w("module")&&mt(6)){let a=at(s,!0,"module");P.push(a)}else if(r===W){Gt();let a=V(s,e),l=a.includes("export type"),u=Ve(s);P.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:l,source:gt(a),leadingComments:u,start:s,end:e})}else if(r===we){Kt();let a=V(s,e),l=Ve(s);P.push({kind:"export",name:"",text:a,isExported:!0,isTypeOnly:!1,source:gt(a),leadingComments:l,start:s,end:e})}else{Me();let a=V(s,e);if(a)P.push({kind:"export",name:"",text:a,isExported:!0,start:s,end:e})}}else if(o===100&&w("declare"))e+=7,x(),rn(s,!1);else if(o===105&&w("interface")){let r=Ot(s,!1);ae.set(r.name,r)}else if(o===116&&w("type")){let r=Et(s,!1);ae.set(r.name,r),P.push(r)}else if(o===102&&w("function")){let r=tt(s,!1,!1,!1);if(r)ee(r);else Me()}else if(o===97)if(w("async")){let r=e;if(e+=5,x(),w("function")){let a=tt(s,!1,!0,!1);if(a)ee(a);else e=r,Me()}else e=r,Me()}else if(w("abstract"))if(e+=8,x(),w("class")){let r=nt(s,!1,!1);ae.set(r.name,r),P.push(r)}else Me();else e++,Me();else if(o===99)if(w("class")){let r=nt(s,!1,!1);ae.set(r.name,r),P.push(r)}else if(w("const")){let r=e;if(e+=5,x(),w("enum")){e=r+5,x();let a=ct(s,!1,!0);ae.set(a.name,a),P.push(a)}else{e=r;let a=rt(s,"const",!1);for(let l=0;l<a.length;l++)ae.set(a[l].name,a[l])}}else e++,Me();else if(o===101&&w("enum")){let r=ct(s,!1,!1);ae.set(r.name,r),P.push(r)}else if(o===108&&w("let")||o===118&&w("var")){let r=w("let")?"let":"var",a=rt(s,r,!1);for(let l=0;l<a.length;l++)ae.set(a[l].name,a[l])}else if(o===109&&w("module")&&mt(6)){let r=at(s,!1,"module");P.push(r)}else if(o===110&&w("namespace")&&mt(9)){let r=at(s,!1,"namespace");P.push(r)}else{let r=f.charCodeAt(e);if(r===J)e++;else if(r===pe||r===Ae){if(Ge(r),e<g&&f.charCodeAt(e)===J)e++}else if(r===Ee){if(lt(),e<g&&f.charCodeAt(e)===J)e++}else if(r===Dn){if(e++,Te(),x(),e<g&&f.charCodeAt(e)===Ye)e++,Te(),x();if(e<g&&f.charCodeAt(e)===X)Pe(X,ge)}else e++,Me()}}if(xe.size>0){sn(P);for(let s of Q.values())sn(s)}if(Bn(f,P,ae,Q),Wn(P,ae),Xn(P,ae),!me)Gn(f,P,ae,ne);if(te){let s=new Set(P);for(let o of[...ae.values(),...[...Q.values()].flat()])if(!s.has(o))P.push(o),s.add(o);return P.sort((o,r)=>(o.start??0)-(r.start??0))}if(ae.size>0)On(P,ae,Q);return P;function sn(s){let o=new Map;for(let a of s)if(a.kind==="function")o.set(a.name,(o.get(a.name)||0)+1);let r=new Set;for(let[a,l]of o)if(l>1)r.add(a);if(r.size>0){let a=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&&xe.has(s[u])){a.add(u);break}if(a.size>0){let l=[...a].sort((u,C)=>C-u);for(let u of l)s.splice(u,1)}}}function rn(s,o){if(w("function")){let r=tt(s,o,!1,!1);if(r)P.push(r)}else if(w("async")){if(e+=5,x(),w("function")){let r=tt(s,o,!0,!1);if(r)P.push(r)}}else if(w("class")){let r=nt(s,o,!1);P.push(r)}else if(w("abstract")){if(e+=8,x(),w("class")){let r=nt(s,o,!0);P.push(r)}}else if(w("interface")){let r=Ot(s,o);P.push(r)}else if(w("type")){let r=Et(s,o);P.push(r)}else if(w("enum")){let r=ct(s,o,!1);P.push(r)}else if(w("const")){let r=e;if(e+=5,x(),w("enum")){e=r+5,x();let a=ct(s,o,!0);P.push(a)}else{e=r;let a=rt(s,"const",o);for(let l=0;l<a.length;l++)if(o||!ce)P.push(a[l]);else ae.set(a[l].name,a[l])}}else if(w("let")||w("var")){let r=w("let")?"let":"var",a=rt(s,r,o);for(let l=0;l<a.length;l++)if(o||!ce)P.push(a[l]);else ae.set(a[l].name,a[l])}else if(w("module")){let r=at(s,o,"module");P.push(r)}else if(w("namespace")){let r=at(s,o,"namespace");P.push(r)}else if(w("global")){e+=6,x();let a=`declare global ${e<g&&f.charCodeAt(e)===W?Wt():"{}"}`,l=Ve(s);P.push({kind:"module",name:"global",text:a,isExported:!1,moduleForm:"global",leadingComments:l,start:s,end:e})}else Me()}}class an{names;lengths=new Uint8Array(65);firstUnits=new Uint8Array(65536);size;constructor(S){this.names=S;for(let Z of S.keys()){if(!Z)continue;this.lengths[Math.min(Z.length,64)]=1,this.firstUnits[Z.charCodeAt(0)]=1}this.size=S.size}scan(S,Z){if(this.size===0)return!1;let H=!1,G=0,te=S.length;while(G<te){let ne=S.charCodeAt(G);if(ne>=65&&ne<=90||ne>=97&&ne<=122||ne===95||ne===36||ne>127){let f=G;G++;while(G<te){let K=S.charCodeAt(G);if(K>=65&&K<=90||K>=97&&K<=122||K>=48&&K<=57||K===95||K===36||K>127)G++;else break}if(this.firstUnits[ne]===1&&this.lengths[Math.min(G-f,64)]===1){let K=S.substring(f,G),me=this.names.get(K);if(me!==void 0){if(Z.add(K),me.kind==="function"||me.kind==="variable")H=!0}}}else G++}return H}}function cn(S,Z){let H=0;while(H<S.length){let G=S.charCodeAt(H);if(G===pe||G===Ae||G===Ee){let ce=G;H++;while(H<S.length)if(S.charCodeAt(H)===Qe)H+=2;else if(S.charCodeAt(H++)===ce)break;continue}if(G===F&&S.charCodeAt(H+1)===F){H+=2;while(H<S.length&&S.charCodeAt(H)!==be&&S.charCodeAt(H)!==ve)H++;continue}if(G===F&&S.charCodeAt(H+1)===we){let ce=S.indexOf("*/",H+2);H=ce===-1?S.length:ce+2;continue}if(!c(G)){H++;continue}let te=H++;while(H<S.length&&i(S.charCodeAt(H)))H++;let ne=te-1,f=H;while(ne>=0&&We(S.charCodeAt(ne)))ne--;while(f<S.length&&We(S.charCodeAt(f)))f++;let K=ne>=0?S.charCodeAt(ne):0,me=f<S.length?S.charCodeAt(f):0,g=te>=3&&S.slice(te-3,te)==="...";if(me===Ze||K===Ye&&!g)continue;if(me===X&&(K===W||K===Je))continue;Z.add(S.slice(te,H))}}function On(S,Z,H){let G=new Set,te=new Set;for(let ce of S)te.add(ce.name);let ne=new an(Z),f=new Set,K=new Set,me=(ce)=>{if(ne.scan(ce.text,f))Jn(ce,K)},g=new Set;for(let ce=0;ce<S.length;ce++){let P=S[ce];if(P.kind!=="import"){if(me(P),typeof P.value==="string")cn(P.value,g)}}for(;;){let ce=[];for(let[Q,xe]of Z){if(G.has(Q))continue;if((xe.kind==="function"||xe.kind==="variable"?K:f).has(Q)||xe.kind!=="function"&&g.has(Q)){if(!te.has(Q)){let le=xe.kind==="function"?H.get(Q):void 0;if(le)for(let he of le)ce.push(he);else ce.push(xe);te.add(Q)}G.add(Q)}}if(ce.length===0)break;ce.sort((Q,xe)=>(Q.start??1/0)-(xe.start??1/0));let P=[],ae=0;for(let Q=0;Q<S.length;Q++){let xe=S[Q].start??1/0;while(ae<ce.length&&(ce[ae].start??1/0)<=xe)P.push(ce[ae++]);P.push(S[Q])}while(ae<ce.length)P.push(ce[ae++]);S.length=0;for(let Q=0;Q<P.length;Q++)S.push(P[Q]);for(let Q of ce)if(Q.kind!=="import"){if(me(Q),typeof Q.value==="string")cn(Q.value,g)}}}
37
+ export{Ei,Ra,T,O,Lt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function at(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var $a=at;
3
- export{at,$a};
2
+ import{s}from"./chunk-y83jhbpr.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function ct(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var $a=ct;
3
+ export{ct,$a};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t}from"./chunk-g0dxj89b.js";function Le(e,d){let i=t(e),o=0,r=0;for(let n=0;n<i.length;n++){let l=i[n],s=e.slice(l.start,l.end),c=i[n+1];if(o===0&&s==="function"&&c?.kind==="word"&&e.slice(c.start,c.end)===d)r++;if(["{","(","["].includes(s))o++;else if(["}",")","]"].includes(s))o--}return r}
3
- export{Le};
2
+ import{t}from"./chunk-m9x72e5j.js";function Fe(e,d){let i=t(e),o=0,r=0;for(let n=0;n<i.length;n++){let l=i[n],s=e.slice(l.start,l.end),c=i[n+1];if(o===0&&s==="function"&&c?.kind==="word"&&e.slice(c.start,c.end)===d)r++;if(["{","(","["].includes(s))o++;else if(["}",")","]"].includes(s))o--}return r}
3
+ export{Fe};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{l}from"./chunk-yyqay3jp.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function yr(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function is(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await yr(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function ss(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function br(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function xr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function os(e){let o=xr(e),i=br(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
2
+ import{r}from"./chunk-3pcxxgwq.js";import{l}from"./chunk-rwwrrxtc.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function yr(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function is(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await yr(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function ss(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function br(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function xr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function os(e){let o=xr(e),i=br(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
3
3
  export{yr,is,ss,br,xr,os};