@dtsx/dtsx 0.11.38 → 0.11.39

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 (191) hide show
  1. package/README.md +18 -12
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/{chunk-xfjfhe9d.js → chunk-0c03j9eq.js} +2 -2
  4. package/dist/{chunk-32qexm3w.js → chunk-0m1wt3db.js} +2 -2
  5. package/dist/{chunk-g2120ysy.js → chunk-2dstvjpv.js} +2 -2
  6. package/dist/{chunk-sd8bywh9.js → chunk-2ngfncfx.js} +11 -11
  7. package/dist/{chunk-88gwzbew.js → chunk-31kbs9mj.js} +3 -3
  8. package/dist/{chunk-d0bazr3p.js → chunk-3dweac93.js} +2 -2
  9. package/dist/{chunk-7tremqhs.js → chunk-3jjrn16z.js} +6 -6
  10. package/dist/chunk-3mcz22q8.js +37 -0
  11. package/dist/{chunk-gspsxc9d.js → chunk-3s37g6bh.js} +8 -8
  12. package/dist/{chunk-y5k0szq6.js → chunk-45fpbdw3.js} +2 -2
  13. package/dist/{chunk-mkakbjvs.js → chunk-4q78f5pg.js} +2 -2
  14. package/dist/{chunk-0k0fhq13.js → chunk-550teag8.js} +10 -10
  15. package/dist/{chunk-ebjafajx.js → chunk-60wrxcjt.js} +7 -7
  16. package/dist/{chunk-bnry23ve.js → chunk-6epjc5rj.js} +3 -3
  17. package/dist/{chunk-p023fhce.js → chunk-7bt7x8sy.js} +3 -3
  18. package/dist/{chunk-ag1b6d30.js → chunk-7j4cgkb4.js} +2 -2
  19. package/dist/{chunk-xa6rsd4b.js → chunk-7ynrmx5b.js} +6 -6
  20. package/dist/{chunk-p9vfxn8g.js → chunk-7z8pykqp.js} +2 -2
  21. package/dist/{chunk-rbx6q1r0.js → chunk-8dvxjzhy.js} +2 -2
  22. package/dist/{chunk-50h54rax.js → chunk-8fg11pr7.js} +3 -3
  23. package/dist/{chunk-zq93f8ca.js → chunk-8kj9pkw5.js} +2 -2
  24. package/dist/chunk-8zvjkzsv.js +3 -0
  25. package/dist/{chunk-ft2zk7jx.js → chunk-996gqrz6.js} +2 -2
  26. package/dist/{chunk-6yvk3q1e.js → chunk-9gp0e3kn.js} +2 -2
  27. package/dist/{chunk-cv29b4zb.js → chunk-a3apthex.js} +2 -2
  28. package/dist/{chunk-xwpn40p0.js → chunk-a3vfqhnp.js} +3 -3
  29. package/dist/{chunk-kfk554fj.js → chunk-aak9xzy7.js} +2 -2
  30. package/dist/{chunk-eba562w8.js → chunk-aq7y0s2v.js} +4 -4
  31. package/dist/{chunk-ja7bp731.js → chunk-axj2w6hp.js} +2 -2
  32. package/dist/chunk-ayyb1jpe.js +3 -0
  33. package/dist/{chunk-8tzd98q8.js → chunk-bc7ahgxz.js} +4 -4
  34. package/dist/{chunk-cpmqa8kd.js → chunk-bkbsg2bv.js} +2 -2
  35. package/dist/{chunk-yay68832.js → chunk-btc6zbyj.js} +2 -2
  36. package/dist/{chunk-1j6092xz.js → chunk-c7a07a26.js} +4 -4
  37. package/dist/{chunk-htgy94y3.js → chunk-cyw59tgm.js} +1 -1
  38. package/dist/{chunk-hnqm1zb3.js → chunk-dh3y4pf7.js} +4 -4
  39. package/dist/{chunk-yrv6z221.js → chunk-dpcvehxp.js} +2 -2
  40. package/dist/{chunk-hv8bx8xx.js → chunk-ee109s3r.js} +6 -6
  41. package/dist/{chunk-1qtghb2x.js → chunk-ex03kbwr.js} +2 -2
  42. package/dist/{chunk-2436cnmb.js → chunk-fay5vymp.js} +2 -2
  43. package/dist/{chunk-mwyjxjqa.js → chunk-g3zt5h6d.js} +2 -2
  44. package/dist/{chunk-rz060wxt.js → chunk-hgscwj1y.js} +4 -4
  45. package/dist/{chunk-83qnrx0m.js → chunk-hqph3vnd.js} +5 -5
  46. package/dist/chunk-hvy1zvk6.js +3 -0
  47. package/dist/{chunk-vf3ybe5r.js → chunk-jfygtm4r.js} +2 -2
  48. package/dist/{chunk-cyr45de1.js → chunk-jhpfmjnx.js} +2 -2
  49. package/dist/chunk-js4m0y2m.js +3 -0
  50. package/dist/{chunk-bxc2herz.js → chunk-jswvvjkr.js} +3 -3
  51. package/dist/{chunk-kkshxyex.js → chunk-jvqczw2k.js} +3 -3
  52. package/dist/{chunk-v93389xm.js → chunk-jyq39qjt.js} +2 -2
  53. package/dist/{chunk-pga5m4wm.js → chunk-k5wz43yh.js} +2 -2
  54. package/dist/{chunk-tka2m4af.js → chunk-ka8mbyjb.js} +2 -2
  55. package/dist/{chunk-42j9cfte.js → chunk-kccc6p2t.js} +2 -2
  56. package/dist/{chunk-2qd3axyx.js → chunk-khyg6w62.js} +4 -4
  57. package/dist/{chunk-9menejdz.js → chunk-kv0bpgyw.js} +2 -2
  58. package/dist/{chunk-3t57mzvf.js → chunk-kv3x5jrs.js} +2 -2
  59. package/dist/{chunk-zgcdx773.js → chunk-m0tacjrk.js} +3 -3
  60. package/dist/{chunk-kpbz61yy.js → chunk-nd0sbh5r.js} +3 -3
  61. package/dist/{chunk-rkstz4w1.js → chunk-nqgfrehj.js} +4 -4
  62. package/dist/{chunk-vkahj2ab.js → chunk-p4hf9bwj.js} +6 -6
  63. package/dist/{chunk-e29rp5xj.js → chunk-phwfth21.js} +5 -5
  64. package/dist/chunk-qq5x44y9.js +38 -0
  65. package/dist/{chunk-pjqzkgzk.js → chunk-qrwst9bb.js} +4 -4
  66. package/dist/{chunk-0yg5mcrf.js → chunk-sgcne5bb.js} +2 -2
  67. package/dist/{chunk-sv8h007a.js → chunk-t6ds7drh.js} +2 -2
  68. package/dist/{chunk-082w7zvy.js → chunk-tm2j0feh.js} +3 -3
  69. package/dist/{chunk-danfamyx.js → chunk-vae5wxar.js} +2 -2
  70. package/dist/{chunk-189nn4fc.js → chunk-vbzchjvq.js} +2 -2
  71. package/dist/{chunk-zk3w5sqv.js → chunk-veh8ks5v.js} +2 -2
  72. package/dist/{chunk-qzjzw9p2.js → chunk-vf8jmdsp.js} +2 -2
  73. package/dist/{chunk-wnqg6hem.js → chunk-vgmnxnjf.js} +14 -14
  74. package/dist/{chunk-a7nvyxpg.js → chunk-w26wgqh8.js} +4 -4
  75. package/dist/{chunk-h3n6256r.js → chunk-x3arymvk.js} +2 -2
  76. package/dist/{chunk-96atbsd3.js → chunk-y3x7p6jf.js} +2 -2
  77. package/dist/{chunk-davy89dj.js → chunk-y4wykrya.js} +4 -4
  78. package/dist/{chunk-9gts9ymh.js → chunk-ybzz1jg7.js} +2 -2
  79. package/dist/chunk-yde8rmfm.js +31 -0
  80. package/dist/{chunk-y1g6v96c.js → chunk-yzdh207n.js} +4 -4
  81. package/dist/chunk-z6mpxpxt.js +3 -0
  82. package/dist/{chunk-ghfd34r7.js → chunk-zbe06f63.js} +2 -2
  83. package/dist/{chunk-4fygcxtb.js → chunk-zk55g2cb.js} +2 -2
  84. package/dist/{chunk-t4va49p3.js → chunk-zn2gvwve.js} +4 -4
  85. package/dist/src/augmentation-graph.js +1 -1
  86. package/dist/src/binding-patterns.js +1 -1
  87. package/dist/src/branded-types.d.ts +0 -11
  88. package/dist/src/branded-types.js +1 -1
  89. package/dist/src/bundle-linker.js +1 -1
  90. package/dist/src/bundler.js +1 -1
  91. package/dist/src/cache.js +1 -1
  92. package/dist/src/call-signatures.js +1 -1
  93. package/dist/src/circular.js +1 -1
  94. package/dist/src/compat.js +1 -1
  95. package/dist/src/computed-keys.js +1 -1
  96. package/dist/src/concurrency.js +1 -1
  97. package/dist/src/config.js +1 -1
  98. package/dist/src/dangling-refs.js +1 -1
  99. package/dist/src/declaration-project.js +1 -1
  100. package/dist/src/declaration-publication.js +1 -1
  101. package/dist/src/declaration-references.js +1 -1
  102. package/dist/src/diff.js +1 -1
  103. package/dist/src/docs.js +1 -1
  104. package/dist/src/enum-declarations.js +1 -1
  105. package/dist/src/errors.js +1 -1
  106. package/dist/src/extractor/directives.js +1 -1
  107. package/dist/src/extractor/extract.js +1 -1
  108. package/dist/src/extractor/scanner.js +1 -1
  109. package/dist/src/extractor.js +1 -1
  110. package/dist/src/formats.js +1 -1
  111. package/dist/src/formatter.js +1 -1
  112. package/dist/src/function-properties.js +1 -1
  113. package/dist/src/generator.js +1 -1
  114. package/dist/src/global-types.js +1 -1
  115. package/dist/src/import-sorter.js +1 -1
  116. package/dist/src/incremental.d.ts +4 -4
  117. package/dist/src/incremental.js +1 -1
  118. package/dist/src/index.js +1 -1
  119. package/dist/src/inferred-imports.js +1 -1
  120. package/dist/src/json-config.js +1 -1
  121. package/dist/src/lexical.js +1 -1
  122. package/dist/src/logger.js +1 -1
  123. package/dist/src/lsp.js +1 -1
  124. package/dist/src/memory.js +1 -1
  125. package/dist/src/merger.js +1 -1
  126. package/dist/src/module-graph.js +1 -1
  127. package/dist/src/module-references.js +1 -1
  128. package/dist/src/native-checker.js +1 -1
  129. package/dist/src/native-engine.js +1 -1
  130. package/dist/src/native-extractor.js +1 -1
  131. package/dist/src/native-generation.js +1 -1
  132. package/dist/src/native-project.js +1 -1
  133. package/dist/src/optimizer.js +1 -1
  134. package/dist/src/output-normalizer.js +1 -1
  135. package/dist/src/parallel-processor.js +1 -1
  136. package/dist/src/parameters.d.ts +18 -0
  137. package/dist/src/parameters.js +1 -1
  138. package/dist/src/parser.js +1 -1
  139. package/dist/src/plugins/bun.js +1 -1
  140. package/dist/src/plugins/esbuild.js +1 -1
  141. package/dist/src/plugins/index.js +1 -1
  142. package/dist/src/plugins/tsdown.js +1 -1
  143. package/dist/src/plugins/tsup.js +1 -1
  144. package/dist/src/plugins/vite.js +1 -1
  145. package/dist/src/plugins/webpack.js +1 -1
  146. package/dist/src/plugins.js +1 -1
  147. package/dist/src/process-source.js +1 -1
  148. package/dist/src/processor/cache.js +1 -1
  149. package/dist/src/processor/comments.js +1 -1
  150. package/dist/src/processor/declarations.js +1 -1
  151. package/dist/src/processor/import-usage.js +1 -1
  152. package/dist/src/processor/imports.js +1 -1
  153. package/dist/src/processor/index.js +1 -1
  154. package/dist/src/processor/type-inference.d.ts +29 -0
  155. package/dist/src/processor/type-inference.js +1 -1
  156. package/dist/src/processor.js +1 -1
  157. package/dist/src/profiling.js +1 -1
  158. package/dist/src/return-type-scope.js +1 -1
  159. package/dist/src/security.js +1 -1
  160. package/dist/src/source-cache.js +1 -1
  161. package/dist/src/sourcemap.js +1 -1
  162. package/dist/src/stx.js +1 -1
  163. package/dist/src/syntax-validator.js +1 -1
  164. package/dist/src/tracking.js +1 -1
  165. package/dist/src/transformers.js +1 -1
  166. package/dist/src/tree-shaker.js +1 -1
  167. package/dist/src/tsconfig.js +1 -1
  168. package/dist/src/type-mappings.d.ts +0 -13
  169. package/dist/src/type-mappings.js +1 -1
  170. package/dist/src/utils.js +1 -1
  171. package/dist/src/value-inference.js +1 -1
  172. package/dist/src/vue.js +1 -1
  173. package/dist/src/watcher.js +1 -1
  174. package/dist/src/worker-thread.js +1 -1
  175. package/dist/src/worker.js +1 -1
  176. package/dist/src/workspace.js +1 -1
  177. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  178. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  179. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  180. package/native/linux-arm64/libzig-dtsx.so +0 -0
  181. package/native/linux-x64/libzig-dtsx.so +0 -0
  182. package/native/windows-x64/zig-dtsx.dll +0 -0
  183. package/package.json +1 -1
  184. package/dist/chunk-0rmbc5zp.js +0 -3
  185. package/dist/chunk-0zfzhn19.js +0 -31
  186. package/dist/chunk-3fbt79hx.js +0 -3
  187. package/dist/chunk-73dzve1s.js +0 -3
  188. package/dist/chunk-8d3sdkv4.js +0 -24
  189. package/dist/chunk-hzn9kmq7.js +0 -3
  190. package/dist/chunk-jcckwgb9.js +0 -3
  191. package/dist/chunk-yx1jy7fx.js +0 -37
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ import{c,i,Ne,de}from"./chunk-8kj9pkw5.js";import{t,d,Fe,m}from"./chunk-c7a07a26.js";import{Le}from"./chunk-ex03kbwr.js";import{tr}from"./chunk-kccc6p2t.js";import{Yn}from"./chunk-0m1wt3db.js";import{j,qn}from"./chunk-7j4cgkb4.js";import{Bn}from"./chunk-0c03j9eq.js";import{Oe,fe,Ie}from"./chunk-hvy1zvk6.js";import{z,it,n,I,L,Jn,Wt,Re,_}from"./chunk-qq5x44y9.js";import{Nn}from"./chunk-jhpfmjnx.js";import{h}from"./chunk-7ynrmx5b.js";import{_n}from"./chunk-996gqrz6.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
+ declare namespace ${re.name} {
4
+ ${qe.text}
5
+ }
6
+ `,ee=re.end+1;for(let Ge of qe.exports)V.push({type:`${re.name}.${Ge.name}`,name:Ge.name})}Y+=`${S.slice(ee,e.end)}
7
+ ;
8
+ ${V.map((re)=>`export type ${re.name} = ${re.type};`).join(`
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
+ `);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
+ ${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 On(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=j(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(`
13
+ `);return ae.set(l,{kind:"module",name:l,text:`declare namespace ${l} {
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(`
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(`
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
+ `);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
+ `)}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(`
21
+ `)){let r="",a=!1;for(let l=0;l<o.length;l++){let u=o.charCodeAt(l);if(u===32||u===9||u===10||u===13){if(!a&&r.length>0)r+=" ",a=!0}else r+=o[l],a=!1}if(r.charCodeAt(1)===32)r=`<${r.slice(2)}`;if(r.charCodeAt(r.length-2)===32)r=`${r.slice(0,-2)}>`;return r}return o}function et(){if(e>=g||f.charCodeAt(e)!==X)return"()";let s=e;return Pe(X,ge),f.slice(s,e)}function Ct(s){if(s.indexOf("/")===-1)return s;let o="",r=!1,a=0;for(let l=0;l<s.length;l++){let u=s.charCodeAt(l);if(r){if(o+=s[l],u===Qe&&l+1<s.length){o+=s[++l];continue}if(u===a)r=!1;continue}if(u===pe||u===Ae||u===Ee){r=!0,a=u,o+=s[l];continue}if(u===F&&l+1<s.length){let C=s.charCodeAt(l+1);if(C===we){let A=s.indexOf("*/",l+2);l=A===-1?s.length:A+1,o+=" ";continue}if(C===F){let A=s.indexOf(`
22
+ `,l+2);l=A===-1?s.length:A-1;continue}}o+=s[l]}return o.trim()}function ot(s){let o=s.slice(1,-1).trim();if(!o)return"()";if(s.indexOf(`
23
+ `)===-1&&o.indexOf(":")!==-1&&o.indexOf("{")===-1&&o.indexOf("[")===-1&&o.indexOf("=")===-1&&o.indexOf("@")===-1&&o.indexOf("...")===-1){let b=0,p=0,k=0;for(let D=0;D<o.length;D++){let E=o.charCodeAt(D);if(E===X||E===ke||E===W)k++;else if(E===ge||E===Ce||E===U)k--;else if(k===0){if(E===Ze)b++;else if(E===Je)p++}}if(b>=p+1){let D=!1;for(let E=0;E<Ht.length;E++){let M=Ht[E],y=o.indexOf(M);if(y!==-1){let v=y+M.length;if((y===0||!i(o.charCodeAt(y-1)))&&(v>=o.length||!i(o.charCodeAt(v)))){D=!0;break}}}if(!D)return s}}let r=[],a=0,l=0,u=!1,C=0;for(let b=0;b<=o.length;b++){if(b===o.length){r.push(Ct(o.slice(a).trim()));break}let p=o.charCodeAt(b);if(u){if(p===Qe){b++;continue}if(p===C)u=!1;continue}if(p===F&&b+1<o.length){let k=o.charCodeAt(b+1);if(k===we){b+=2;while(b+1<o.length&&!(o.charCodeAt(b)===we&&o.charCodeAt(b+1)===F))b++;b++;continue}if(k===F){while(b<o.length&&o.charCodeAt(b)!==10)b++;continue}}if(p===pe||p===Ae||p===Ee){u=!0,C=p;continue}if(p===X||p===W||p===Se||p===ke)l++;else if(p===ge||p===U||p===_e||p===Ce&&!(b>0&&o.charCodeAt(b-1)===$e))l--;else if(p===Je&&l===0)r.push(Ct(o.slice(a,b).trim())),a=b+1}let A=[];for(let b of r){if(!b)continue;let p=b.trim();if(p.startsWith("//")||p.startsWith("/*"))continue;let k=b;{let D=!1,E=0,M=0,y=0;for(let v=0;v<k.length-1;v++){let q=k.charCodeAt(v);if(q===be){y=v+1;continue}if(D){if(q===Qe){v++;continue}if(q===E)D=!1;continue}if(q===pe||q===Ae||q===Ee){D=!0,E=q;continue}if(q===W||q===Se||q===X||q===ke){M++;continue}if(q===U||q===_e||q===ge||q===Ce){if(M>0)M--;continue}if(q===F&&k.charCodeAt(v+1)===F){if(M===0){k=k.slice(0,v).trimEnd();break}let N=k.indexOf(`
24
+ `,v);if(N===-1){k=k.slice(0,y).trimEnd();break}let B=k.slice(0,y),R=k.slice(N+1);k=`${B}${R}`,v=y-1}}}if(!k.trim())continue;A.push(Qt(k))}return Oe(`(${A.join(", ")})`)}function gn(s){if(!s.startsWith("{")&&!s.startsWith("["))return s;let o="",r=0,a=0,l=!1,u=0;while(r<s.length){let C=s.charCodeAt(r);if(l){if(C===Qe&&r+1<s.length){o+=s[r]+s[r+1],r+=2;continue}if(C===u)l=!1;o+=s[r],r++;continue}if(C===F&&r+1<s.length){let A=s.charCodeAt(r+1);if(A===we){let b=r;r+=2;while(r+1<s.length&&!(s.charCodeAt(r)===we&&s.charCodeAt(r+1)===F))r++;r=Math.min(r+2,s.length),o+=s.slice(b,r);continue}if(A===F){let b=r;while(r<s.length&&s.charCodeAt(r)!==10)r++;o+=s.slice(b,r);continue}}if(C===pe||C===Ae||C===Ee){l=!0,u=C,o+=s[r],r++;continue}if(C===W||C===Se||C===X)a++;else if(C===U||C===_e||C===ge)a--;if(a>=1&&C===$e&&(r+1>=s.length||s.charCodeAt(r+1)!==$e&&s.charCodeAt(r+1)!==Ce)){while(o.length>0&&(o[o.length-1]===" "||o[o.length-1]==="\t"||o[o.length-1]===`
25
+ `))o=o.slice(0,-1);r++;let 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
+ `)){let y=p.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(y.length<=40)p=y;else p=p.split(`
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(`
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||!On(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=_(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(),`{
31
+ ${o.join(`
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`{
34
+ ${o.join(`
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)_n(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)En(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 En(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};
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- function p(r,t){let e=r.trim();if(e==="string")return{type:"string"};if(e==="number")return{type:"number"};if(e==="boolean")return{type:"boolean"};if(e==="null")return{type:"null"};if(e==="undefined")return{type:"null"};if(e==="any"||e==="unknown")return{};if(e==="never")return{not:{}};if(e==="void")return{type:"null"};if(e==="bigint")return{type:"integer"};if(e==="symbol")return{type:"string",description:"Symbol type"};if(e==="object")return{type:"object"};if(e.startsWith("'")||e.startsWith('"'))return{const:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{const:Number.parseFloat(e)};if(e==="true")return{const:!0};if(e==="false")return{const:!1};let n=e.match(/^(.+)\[\]$/)||e.match(/^Array<(.+)>$/i);if(n)return{type:"array",items:p(n[1],t)};let i=e.match(/^\[(.+)\]$/);if(i){let f=l(i[1],",").map((d)=>p(d.trim(),t));return{type:"array",items:f,minItems:f.length,maxItems:f.length}}if(e.includes("|")){let f=l(e,"|");if(f.length>1){let d=f.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined");if(f.some((a)=>a.trim()==="null"||a.trim()==="undefined")&&d.length===1){let a=p(d[0],t);if(a.type&&typeof a.type==="string")return{...a,type:[a.type,"null"]};return{oneOf:[a,{type:"null"}]}}return{oneOf:f.map((a)=>p(a.trim(),t))}}}if(e.includes("&")){let f=l(e,"&");if(f.length>1)return{allOf:f.map((d)=>p(d.trim(),t))}}let s=e.match(/^Record<(.+),\s*(.+)>$/i);if(s)return{type:"object",additionalProperties:p(s[2],t)};let o=e.match(/^Promise<(.+)>$/i);if(o)return p(o[1],t);let u=e.match(/^Partial<(.+)>$/i);if(u)return{...p(u[1],t),required:[]};let h=e.match(/^Required<(.+)>$/i);if(h)return p(h[1],t);let c=e.match(/^Readonly<(.+)>$/i);if(c)return p(c[1],t);let y=e.match(/^Pick<(.+),\s*(.+)>$/i);if(y)return p(y[1],t);let b=e.match(/^Omit<(.+),\s*(.+)>$/i);if(b)return p(b[1],t);if(e==="Date")return{type:"string",format:"date-time"};if(/^[A-Z]\w*$/.test(e))return{$ref:`#/$defs/${e}`};return{type:"object"}}function $r(r,t={}){let e=t.indent??2,n=t.jsonSchemaDraft??"2020-12",i={"2020-12":"https://json-schema.org/draft/2020-12/schema","2019-09":"https://json-schema.org/draft/2019-09/schema","draft-07":"http://json-schema.org/draft-07/schema#"}[n],s=new Map,o={$schema:t.includeSchema!==!1?i:void 0,$defs:{}};for(let u of r)if(u.kind==="interface"||u.kind==="type"){let h=N(u,s,t);if(o.$defs)o.$defs[u.name]=h}if(o.$defs&&Object.keys(o.$defs).length===1){let[u,h]=Object.entries(o.$defs)[0];return JSON.stringify({$schema:o.$schema,title:u,...h},null,e)}return JSON.stringify(o,null,e)}function N(r,t,e){let n={type:"object"};if(e.includeDescriptions&&r.leadingComments?.length){let i=v(r.leadingComments);if(i)n.description=i}if(r.members&&r.members.length>0){n.properties={},n.required=[];for(let i of r.members)if(i.name&&i.typeAnnotation){let s=p(i.typeAnnotation,t);if(e.includeDescriptions&&i.leadingComments?.length){let u=v(i.leadingComments);if(u)s.description=u}if(n.properties[i.name]=s,!(i.modifiers?.includes("?")||i.text?.includes("?:")||e.allOptional))n.required.push(i.name)}if(n.required.length===0)delete n.required}else if(r.typeAnnotation)return p(r.typeAnnotation,t);return n}function Er(r,t={}){let e=["import { z } from 'zod'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=x(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = z.infer<typeof ${i}>`),e.push("")}return e.join(`
2
+ function p(r,t){let e=r.trim();if(e==="string")return{type:"string"};if(e==="number")return{type:"number"};if(e==="boolean")return{type:"boolean"};if(e==="null")return{type:"null"};if(e==="undefined")return{type:"null"};if(e==="any"||e==="unknown")return{};if(e==="never")return{not:{}};if(e==="void")return{type:"null"};if(e==="bigint")return{type:"integer"};if(e==="symbol")return{type:"string",description:"Symbol type"};if(e==="object")return{type:"object"};if(e.startsWith("'")||e.startsWith('"'))return{const:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{const:Number.parseFloat(e)};if(e==="true")return{const:!0};if(e==="false")return{const:!1};let n=e.match(/^(.+)\[\]$/)||e.match(/^Array<(.+)>$/i);if(n)return{type:"array",items:p(n[1],t)};let i=e.match(/^\[(.+)\]$/);if(i){let f=l(i[1],",").map((d)=>p(d.trim(),t));return{type:"array",items:f,minItems:f.length,maxItems:f.length}}if(e.includes("|")){let f=l(e,"|");if(f.length>1){let d=f.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined");if(f.some((a)=>a.trim()==="null"||a.trim()==="undefined")&&d.length===1){let a=p(d[0],t);if(a.type&&typeof a.type==="string")return{...a,type:[a.type,"null"]};return{oneOf:[a,{type:"null"}]}}return{oneOf:f.map((a)=>p(a.trim(),t))}}}if(e.includes("&")){let f=l(e,"&");if(f.length>1)return{allOf:f.map((d)=>p(d.trim(),t))}}let s=e.match(/^Record<(.+),\s*(.+)>$/i);if(s)return{type:"object",additionalProperties:p(s[2],t)};let o=e.match(/^Promise<(.+)>$/i);if(o)return p(o[1],t);let u=e.match(/^Partial<(.+)>$/i);if(u)return{...p(u[1],t),required:[]};let h=e.match(/^Required<(.+)>$/i);if(h)return p(h[1],t);let c=e.match(/^Readonly<(.+)>$/i);if(c)return p(c[1],t);let y=e.match(/^Pick<(.+),\s*(.+)>$/i);if(y)return p(y[1],t);let b=e.match(/^Omit<(.+),\s*(.+)>$/i);if(b)return p(b[1],t);if(e==="Date")return{type:"string",format:"date-time"};if(/^[A-Z]\w*$/.test(e))return{$ref:`#/$defs/${e}`};return{type:"object"}}function Rr(r,t={}){let e=t.indent??2,n=t.jsonSchemaDraft??"2020-12",i={"2020-12":"https://json-schema.org/draft/2020-12/schema","2019-09":"https://json-schema.org/draft/2019-09/schema","draft-07":"http://json-schema.org/draft-07/schema#"}[n],s=new Map,o={$schema:t.includeSchema!==!1?i:void 0,$defs:{}};for(let u of r)if(u.kind==="interface"||u.kind==="type"){let h=N(u,s,t);if(o.$defs)o.$defs[u.name]=h}if(o.$defs&&Object.keys(o.$defs).length===1){let[u,h]=Object.entries(o.$defs)[0];return JSON.stringify({$schema:o.$schema,title:u,...h},null,e)}return JSON.stringify(o,null,e)}function N(r,t,e){let n={type:"object"};if(e.includeDescriptions&&r.leadingComments?.length){let i=v(r.leadingComments);if(i)n.description=i}if(r.members&&r.members.length>0){n.properties={},n.required=[];for(let i of r.members)if(i.name&&i.typeAnnotation){let s=p(i.typeAnnotation,t);if(e.includeDescriptions&&i.leadingComments?.length){let u=v(i.leadingComments);if(u)s.description=u}if(n.properties[i.name]=s,!(i.modifiers?.includes("?")||i.text?.includes("?:")||e.allOptional))n.required.push(i.name)}if(n.required.length===0)delete n.required}else if(r.typeAnnotation)return p(r.typeAnnotation,t);return n}function Mr(r,t={}){let e=["import { z } from 'zod'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=x(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = z.infer<typeof ${i}>`),e.push("")}return e.join(`
3
3
  `)}function x(r,t){if(r.members&&r.members.length>0)return`z.object({
4
4
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=m(n.typeAnnotation);if(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional)i=`${i}.optional()`;if(t.includeDescriptions&&n.leadingComments?.length){let o=v(n.leadingComments);if(o)i=`${i}.describe(${JSON.stringify(o)})`}return` ${n.name}: ${i}`}).join(`,
5
5
  `)}
6
- })`;if(r.typeAnnotation)return m(r.typeAnnotation);return"z.unknown()"}function m(r){let t=r.trim();if(t==="string")return"z.string()";if(t==="number")return"z.number()";if(t==="boolean")return"z.boolean()";if(t==="null")return"z.null()";if(t==="undefined")return"z.undefined()";if(t==="any")return"z.any()";if(t==="unknown")return"z.unknown()";if(t==="never")return"z.never()";if(t==="void")return"z.void()";if(t==="bigint")return"z.bigint()";if(t==="symbol")return"z.symbol()";if(t==="Date")return"z.date()";if(t.startsWith("'")||t.startsWith('"'))return`z.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`z.literal(${t})`;if(t==="true"||t==="false")return`z.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`z.array(${m(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`z.tuple([${l(n[1],",").map((b)=>m(b.trim())).join(", ")}])`;if(t.includes("|")){let y=l(t,"|");if(y.length>1){let b=y.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined"),f=y.some((a)=>a.trim()==="null"),d=y.some((a)=>a.trim()==="undefined");if((f||d)&&b.length===1){let a=m(b[0]);if(f)a=`${a}.nullable()`;if(d)a=`${a}.optional()`;return a}return`z.union([${y.map((a)=>m(a.trim())).join(", ")}])`}}if(t.includes("&")){let y=l(t,"&");if(y.length>1)return y.map((f)=>m(f.trim())).reduce((f,d)=>`${f}.and(${d})`)}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`z.record(${m(i[1])}, ${m(i[2])})`;let s=t.match(/^Promise<(.+)>$/i);if(s)return`z.promise(${m(s[1])})`;let o=t.match(/^Map<(.+),\s*(.+)>$/i);if(o)return`z.map(${m(o[1])}, ${m(o[2])})`;let u=t.match(/^Set<(.+)>$/i);if(u)return`z.set(${m(u[1])})`;let h=t.match(/^Partial<(.+)>$/i);if(h)return`${m(h[1])}.partial()`;let c=t.match(/^Required<(.+)>$/i);if(c)return`${m(c[1])}.required()`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"z.unknown()"}function kr(r,t={}){let e=["import * as v from 'valibot'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=j(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = v.InferOutput<typeof ${i}>`),e.push("")}return e.join(`
6
+ })`;if(r.typeAnnotation)return m(r.typeAnnotation);return"z.unknown()"}function m(r){let t=r.trim();if(t==="string")return"z.string()";if(t==="number")return"z.number()";if(t==="boolean")return"z.boolean()";if(t==="null")return"z.null()";if(t==="undefined")return"z.undefined()";if(t==="any")return"z.any()";if(t==="unknown")return"z.unknown()";if(t==="never")return"z.never()";if(t==="void")return"z.void()";if(t==="bigint")return"z.bigint()";if(t==="symbol")return"z.symbol()";if(t==="Date")return"z.date()";if(t.startsWith("'")||t.startsWith('"'))return`z.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`z.literal(${t})`;if(t==="true"||t==="false")return`z.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`z.array(${m(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`z.tuple([${l(n[1],",").map((b)=>m(b.trim())).join(", ")}])`;if(t.includes("|")){let y=l(t,"|");if(y.length>1){let b=y.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined"),f=y.some((a)=>a.trim()==="null"),d=y.some((a)=>a.trim()==="undefined");if((f||d)&&b.length===1){let a=m(b[0]);if(f)a=`${a}.nullable()`;if(d)a=`${a}.optional()`;return a}return`z.union([${y.map((a)=>m(a.trim())).join(", ")}])`}}if(t.includes("&")){let y=l(t,"&");if(y.length>1)return y.map((f)=>m(f.trim())).reduce((f,d)=>`${f}.and(${d})`)}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`z.record(${m(i[1])}, ${m(i[2])})`;let s=t.match(/^Promise<(.+)>$/i);if(s)return`z.promise(${m(s[1])})`;let o=t.match(/^Map<(.+),\s*(.+)>$/i);if(o)return`z.map(${m(o[1])}, ${m(o[2])})`;let u=t.match(/^Set<(.+)>$/i);if(u)return`z.set(${m(u[1])})`;let h=t.match(/^Partial<(.+)>$/i);if(h)return`${m(h[1])}.partial()`;let c=t.match(/^Required<(.+)>$/i);if(c)return`${m(c[1])}.required()`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"z.unknown()"}function Or(r,t={}){let e=["import * as v from 'valibot'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=j(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = v.InferOutput<typeof ${i}>`),e.push("")}return e.join(`
7
7
  `)}function j(r,t){if(r.members&&r.members.length>0)return`v.object({
8
8
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=g(n.typeAnnotation);if(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional)i=`v.optional(${i})`;return` ${n.name}: ${i}`}).join(`,
9
9
  `)}
10
- })`;if(r.typeAnnotation)return g(r.typeAnnotation);return"v.unknown()"}function g(r){let t=r.trim();if(t==="string")return"v.string()";if(t==="number")return"v.number()";if(t==="boolean")return"v.boolean()";if(t==="null")return"v.null_()";if(t==="undefined")return"v.undefined_()";if(t==="any")return"v.any()";if(t==="unknown")return"v.unknown()";if(t==="never")return"v.never()";if(t==="void")return"v.void_()";if(t==="bigint")return"v.bigint()";if(t==="symbol")return"v.symbol()";if(t==="Date")return"v.date()";if(t.startsWith("'")||t.startsWith('"'))return`v.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`v.literal(${t})`;if(t==="true"||t==="false")return`v.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`v.array(${g(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`v.tuple([${l(n[1],",").map((o)=>g(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1){let o=s.filter((c)=>c.trim()!=="null"&&c.trim()!=="undefined"),u=s.some((c)=>c.trim()==="null"),h=s.some((c)=>c.trim()==="undefined");if((u||h)&&o.length===1){let c=g(o[0]);if(u)c=`v.nullable(${c})`;if(h)c=`v.optional(${c})`;return c}return`v.union([${s.map((c)=>g(c.trim())).join(", ")}])`}}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`v.intersect([${s.map((o)=>g(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`v.record(${g(i[1])}, ${g(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"v.unknown()"}function Tr(r,t={}){let e=["import * as t from 'io-ts'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Codec`,s=A(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = t.TypeOf<typeof ${i}>`),e.push("")}return e.join(`
10
+ })`;if(r.typeAnnotation)return g(r.typeAnnotation);return"v.unknown()"}function g(r){let t=r.trim();if(t==="string")return"v.string()";if(t==="number")return"v.number()";if(t==="boolean")return"v.boolean()";if(t==="null")return"v.null_()";if(t==="undefined")return"v.undefined_()";if(t==="any")return"v.any()";if(t==="unknown")return"v.unknown()";if(t==="never")return"v.never()";if(t==="void")return"v.void_()";if(t==="bigint")return"v.bigint()";if(t==="symbol")return"v.symbol()";if(t==="Date")return"v.date()";if(t.startsWith("'")||t.startsWith('"'))return`v.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`v.literal(${t})`;if(t==="true"||t==="false")return`v.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`v.array(${g(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`v.tuple([${l(n[1],",").map((o)=>g(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1){let o=s.filter((c)=>c.trim()!=="null"&&c.trim()!=="undefined"),u=s.some((c)=>c.trim()==="null"),h=s.some((c)=>c.trim()==="undefined");if((u||h)&&o.length===1){let c=g(o[0]);if(u)c=`v.nullable(${c})`;if(h)c=`v.optional(${c})`;return c}return`v.union([${s.map((c)=>g(c.trim())).join(", ")}])`}}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`v.intersect([${s.map((o)=>g(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`v.record(${g(i[1])}, ${g(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"v.unknown()"}function Ir(r,t={}){let e=["import * as t from 'io-ts'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Codec`,s=A(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = t.TypeOf<typeof ${i}>`),e.push("")}return e.join(`
11
11
  `)}function A(r,t){if(r.members&&r.members.length>0){let e=[],n=[];for(let i of r.members){if(!i.name||!i.typeAnnotation)continue;let s=O(i.typeAnnotation),o=i.modifiers?.includes("?")||i.text?.includes("?:")||t.allOptional,u=` ${i.name}: ${s}`;if(o)n.push(u);else e.push(u)}if(n.length>0)return`t.intersection([
12
12
  t.type({
13
13
  ${e.join(`,
@@ -20,15 +20,15 @@ ${n.join(`,
20
20
  ])`;return`t.type({
21
21
  ${e.join(`,
22
22
  `)}
23
- })`}if(r.typeAnnotation)return O(r.typeAnnotation);return"t.unknown"}function O(r){let t=r.trim();if(t==="string")return"t.string";if(t==="number")return"t.number";if(t==="boolean")return"t.boolean";if(t==="null")return"t.null";if(t==="undefined")return"t.undefined";if(t==="any")return"t.unknown";if(t==="unknown")return"t.unknown";if(t==="never")return"t.never";if(t==="void")return"t.void";if(t.startsWith("'")||t.startsWith('"'))return`t.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`t.literal(${t})`;if(t==="true"||t==="false")return`t.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`t.array(${O(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`t.tuple([${l(n[1],",").map((o)=>O(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1)return`t.union([${s.map((o)=>O(o.trim())).join(", ")}])`}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`t.intersection([${s.map((o)=>O(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`t.record(${O(i[1])}, ${O(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Codec`;return"t.unknown"}function Ar(r,t={}){let e=["import * as yup from 'yup'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=z(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = yup.InferType<typeof ${i}>`),e.push("")}return e.join(`
23
+ })`}if(r.typeAnnotation)return O(r.typeAnnotation);return"t.unknown"}function O(r){let t=r.trim();if(t==="string")return"t.string";if(t==="number")return"t.number";if(t==="boolean")return"t.boolean";if(t==="null")return"t.null";if(t==="undefined")return"t.undefined";if(t==="any")return"t.unknown";if(t==="unknown")return"t.unknown";if(t==="never")return"t.never";if(t==="void")return"t.void";if(t.startsWith("'")||t.startsWith('"'))return`t.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`t.literal(${t})`;if(t==="true"||t==="false")return`t.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`t.array(${O(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`t.tuple([${l(n[1],",").map((o)=>O(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1)return`t.union([${s.map((o)=>O(o.trim())).join(", ")}])`}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`t.intersection([${s.map((o)=>O(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`t.record(${O(i[1])}, ${O(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Codec`;return"t.unknown"}function Lr(r,t={}){let e=["import * as yup from 'yup'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=z(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = yup.InferType<typeof ${i}>`),e.push("")}return e.join(`
24
24
  `)}function z(r,t){if(r.members&&r.members.length>0)return`yup.object({
25
25
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=T(n.typeAnnotation);if(!(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional))i=`${i}.required()`;return` ${n.name}: ${i}`}).join(`,
26
26
  `)}
27
- })`;if(r.typeAnnotation)return T(r.typeAnnotation);return"yup.mixed()"}function T(r){let t=r.trim();if(t==="string")return"yup.string()";if(t==="number")return"yup.number()";if(t==="boolean")return"yup.boolean()";if(t==="Date")return"yup.date()";if(t==="any"||t==="unknown")return"yup.mixed()";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`yup.array().of(${T(e[1])})`;if(t.includes("|")){let n=l(t,"|");if(n.length>1){let i=n.filter((o)=>o.trim()!=="null"&&o.trim()!=="undefined");if(n.some((o)=>o.trim()==="null"||o.trim()==="undefined")&&i.length===1)return`${T(i[0])}.nullable()`}}if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"yup.mixed()"}function Pr(r,t={}){let e=["import { type } from 'arktype'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||n.name,s=w(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name}Type = typeof ${i}.infer`),e.push("")}return e.join(`
27
+ })`;if(r.typeAnnotation)return T(r.typeAnnotation);return"yup.mixed()"}function T(r){let t=r.trim();if(t==="string")return"yup.string()";if(t==="number")return"yup.number()";if(t==="boolean")return"yup.boolean()";if(t==="Date")return"yup.date()";if(t==="any"||t==="unknown")return"yup.mixed()";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`yup.array().of(${T(e[1])})`;if(t.includes("|")){let n=l(t,"|");if(n.length>1){let i=n.filter((o)=>o.trim()!=="null"&&o.trim()!=="undefined");if(n.some((o)=>o.trim()==="null"||o.trim()==="undefined")&&i.length===1)return`${T(i[0])}.nullable()`}}if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"yup.mixed()"}function Fr(r,t={}){let e=["import { type } from 'arktype'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||n.name,s=w(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name}Type = typeof ${i}.infer`),e.push("")}return e.join(`
28
28
  `)}function w(r,t){if(r.members&&r.members.length>0)return`type({
29
29
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=S(n.typeAnnotation);return` ${n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional?`'${n.name}?'`:`${n.name}`}: ${i}`}).join(`,
30
30
  `)}
31
- })`;if(r.typeAnnotation)return`type(${S(r.typeAnnotation)})`;return"type('unknown')"}function S(r){let t=r.trim();if(t==="string")return"'string'";if(t==="number")return"'number'";if(t==="boolean")return"'boolean'";if(t==="null")return"'null'";if(t==="undefined")return"'undefined'";if(t==="bigint")return"'bigint'";if(t==="symbol")return"'symbol'";if(t==="Date")return"'Date'";if(t==="any"||t==="unknown")return"'unknown'";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`${S(e[1])}.array()`;if(t.includes("|")){let n=l(t,"|");if(n.length>1)return`'${n.map((i)=>i.trim()).join(" | ")}'`}if(t.startsWith("'")||t.startsWith('"'))return`'${t}'`;return`'${t}'`}function l(r,t){let e=[],n="",i=0;for(let s=0;s<r.length;s++){let o=r[s];if(o==="<"||o==="("||o==="["||o==="{")i++,n+=o;else if(o===">"||o===")"||o==="]"||o==="}")i--,n+=o;else if(i===0&&r.slice(s,s+t.length)===t)e.push(n.trim()),n="",s+=t.length-1;else n+=o}if(n.trim())e.push(n.trim());return e}function v(r){for(let t of r){let e=t.replace(/^\/\*\*|\*\/$/g,"").replace(/^\s*\*\s?/gm,"").replace(/@\w.*/g,"").trim();if(e)return e}return null}function ks(r,t){switch(t.format){case"json-schema":return $r(r,t);case"zod":return Er(r,t);case"valibot":return kr(r,t);case"io-ts":return Tr(r,t);case"yup":return Ar(r,t);case"arktype":return Pr(r,t);case"dts":default:return r.map((e)=>e.text).join(`
31
+ })`;if(r.typeAnnotation)return`type(${S(r.typeAnnotation)})`;return"type('unknown')"}function S(r){let t=r.trim();if(t==="string")return"'string'";if(t==="number")return"'number'";if(t==="boolean")return"'boolean'";if(t==="null")return"'null'";if(t==="undefined")return"'undefined'";if(t==="bigint")return"'bigint'";if(t==="symbol")return"'symbol'";if(t==="Date")return"'Date'";if(t==="any"||t==="unknown")return"'unknown'";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`${S(e[1])}.array()`;if(t.includes("|")){let n=l(t,"|");if(n.length>1)return`'${n.map((i)=>i.trim()).join(" | ")}'`}if(t.startsWith("'")||t.startsWith('"'))return`'${t}'`;return`'${t}'`}function l(r,t){let e=[],n="",i=0;for(let s=0;s<r.length;s++){let o=r[s];if(o==="<"||o==="("||o==="["||o==="{")i++,n+=o;else if(o===">"||o===")"||o==="]"||o==="}")i--,n+=o;else if(i===0&&r.slice(s,s+t.length)===t)e.push(n.trim()),n="",s+=t.length-1;else n+=o}if(n.trim())e.push(n.trim());return e}function v(r){for(let t of r){let e=t.replace(/^\/\*\*|\*\/$/g,"").replace(/^\s*\*\s?/gm,"").replace(/@\w.*/g,"").trim();if(e)return e}return null}function Os(r,t){switch(t.format){case"json-schema":return Rr(r,t);case"zod":return Mr(r,t);case"valibot":return Or(r,t);case"io-ts":return Ir(r,t);case"yup":return Lr(r,t);case"arktype":return Fr(r,t);case"dts":default:return r.map((e)=>e.text).join(`
32
32
 
33
- `)}}function Ts(r){switch(r){case"json-schema":return".schema.json";case"zod":case"valibot":case"io-ts":case"yup":case"arktype":return".schema.ts";case"dts":default:return".d.ts"}}
34
- export{$r,Er,kr,Tr,Ar,Pr,ks,Ts};
33
+ `)}}function Is(r){switch(r){case"json-schema":return".schema.json";case"zod":case"valibot":case"io-ts":case"yup":case"arktype":return".schema.ts";case"dts":default:return".d.ts"}}
34
+ export{Rr,Mr,Or,Ir,Lr,Fr,Os,Is};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{E}from"./chunk-ebjafajx.js";import{H}from"./chunk-7tremqhs.js";import{z,de}from"./chunk-kfk554fj.js";import{vn}from"./chunk-96atbsd3.js";import{spawn as N}from"child_process";var x=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function y(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=N(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),j=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),b=(t,w)=>{if(v)return;if(v=!0,clearTimeout(j),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>b(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);b(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function Si(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!x.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...E,...f};if(await z(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await H(n);let u=await vn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await y(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await de(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
- export{Si};
2
+ import{E}from"./chunk-60wrxcjt.js";import{q}from"./chunk-3jjrn16z.js";import{K,he}from"./chunk-aak9xzy7.js";import{An}from"./chunk-y3x7p6jf.js";import{spawn as N}from"child_process";var x=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function y(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=N(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),j=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),b=(t,w)=>{if(v)return;if(v=!0,clearTimeout(j),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>b(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);b(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function Di(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!x.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...E,...f};if(await K(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await q(n);let u=await An(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await y(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await he(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
+ export{Di};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{existsSync as L}from"fs";import{arch as N,platform as w}from"os";import{fileURLToPath as I}from"url";var b;function _(){return`${w()==="win32"?"windows":w()}-${N()}`}function z(r){let t=[],e=process.env.DTSX_NATIVE_LIBRARY;if(e)t.push(e);for(let n of[`../native/${_()}/${r}`,`../../native/${_()}/${r}`,`../../zig-dtsx/zig-out/lib/${r}`,`../../zig-dtsx/zig-out/bin/${r}`])try{t.push(I(new URL(n,import.meta.url)))}catch{}return t}function E(){if(process.env.DTSX_ENGINE==="typescript"||typeof globalThis.Bun>"u")return null;let r;try{r=import.meta.require("bun:ffi")}catch{return null}let{dlopen:t,FFIType:e,ptr:n,suffix:u,toArrayBuffer:s}=r,d=u==="dll"?`zig-dtsx.${u}`:`libzig-dtsx.${u}`;for(let c of z(d)){if(!L(c))continue;try{let f=t(c,{process_source_checked_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.ptr],returns:e.ptr},process_source_with_context_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.u64,e.ptr,e.ptr],returns:e.ptr},free_result:{args:[e.ptr,e.u64],returns:e.void}}),{symbols:l}=f,g=new TextDecoder;return{checked:(o,i,p,m,y,h)=>l.process_source_checked_v1(n(o),i,p,m,n(y),n(h)),contextual:(o,i,p,m,y,h,S,U)=>l.process_source_with_context_v1(n(o),i,p,m,n(y),h,n(S),n(U)),read:(o,i)=>{if(!o)return"";let p=i?g.decode(s(o,0,i)):"";return l.free_result(o,i),p}}}catch{continue}}return null}function k(){if(b===void 0)b=E();return b}function ti(){return k()!==null}var A=new TextEncoder,a=new Uint8Array(65536),x=new BigUint64Array(1),v=new Uint32Array(1);function pe(r,t){let e=k();if(!e)return null;if(r.length*3>a.length)a=new Uint8Array(r.length*3);let{written:n}=A.encodeInto(r,a),u=(t.inferenceSources?.size??0)>0||(t.augmentationImports?.size??0)>0,s;if(u){let c=t.sourceFile??"source.ts",f=A.encode(JSON.stringify({version:1,moduleSpecifierMode:"preserve",sourceFile:c,outputFile:c.replace(/\.[cm]?tsx?$/,".d.ts"),sourceHash:new Bun.CryptoHasher("sha256").update(a.subarray(0,n)).digest("hex"),rewrites:[],augmentationImports:[...t.augmentationImports??[]],inferenceSources:[...t.inferenceSources??[]].map(([l,g])=>({specifier:l,source:g}))}));s=e.contextual(a,n,t.keepComments,t.isolatedDeclarations,f,f.length,x,v)}else s=e.checked(a,n,t.keepComments,t.isolatedDeclarations,x,v);let d=Number(x[0]);if(v[0]!==0)return e.read(s,d),null;return e.read(s,d)}
3
- export{ti,pe};
2
+ import{existsSync as L}from"fs";import{arch as N,platform as w}from"os";import{fileURLToPath as I}from"url";var b;function _(){return`${w()==="win32"?"windows":w()}-${N()}`}function z(r){let t=[],e=process.env.DTSX_NATIVE_LIBRARY;if(e)t.push(e);for(let n of[`../native/${_()}/${r}`,`../../native/${_()}/${r}`,`../../zig-dtsx/zig-out/lib/${r}`,`../../zig-dtsx/zig-out/bin/${r}`])try{t.push(I(new URL(n,import.meta.url)))}catch{}return t}function E(){if(process.env.DTSX_ENGINE==="typescript"||typeof globalThis.Bun>"u")return null;let r;try{r=import.meta.require("bun:ffi")}catch{return null}let{dlopen:t,FFIType:e,ptr:n,suffix:u,toArrayBuffer:s}=r,d=u==="dll"?`zig-dtsx.${u}`:`libzig-dtsx.${u}`;for(let c of z(d)){if(!L(c))continue;try{let f=t(c,{process_source_checked_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.ptr],returns:e.ptr},process_source_with_context_v1:{args:[e.ptr,e.u64,e.bool,e.bool,e.ptr,e.u64,e.ptr,e.ptr],returns:e.ptr},free_result:{args:[e.ptr,e.u64],returns:e.void}}),{symbols:l}=f,g=new TextDecoder;return{checked:(o,i,p,m,y,h)=>l.process_source_checked_v1(n(o),i,p,m,n(y),n(h)),contextual:(o,i,p,m,y,h,S,U)=>l.process_source_with_context_v1(n(o),i,p,m,n(y),h,n(S),n(U)),read:(o,i)=>{if(!o)return"";let p=i?g.decode(s(o,0,i)):"";return l.free_result(o,i),p}}}catch{continue}}return null}function k(){if(b===void 0)b=E();return b}function ci(){return k()!==null}var A=new TextEncoder,a=new Uint8Array(65536),x=new BigUint64Array(1),v=new Uint32Array(1);function ye(r,t){let e=k();if(!e)return null;if(r.length*3>a.length)a=new Uint8Array(r.length*3);let{written:n}=A.encodeInto(r,a),u=(t.inferenceSources?.size??0)>0||(t.augmentationImports?.size??0)>0,s;if(u){let c=t.sourceFile??"source.ts",f=A.encode(JSON.stringify({version:1,moduleSpecifierMode:"preserve",sourceFile:c,outputFile:c.replace(/\.[cm]?tsx?$/,".d.ts"),sourceHash:new Bun.CryptoHasher("sha256").update(a.subarray(0,n)).digest("hex"),rewrites:[],augmentationImports:[...t.augmentationImports??[]],inferenceSources:[...t.inferenceSources??[]].map(([l,g])=>({specifier:l,source:g}))}));s=e.contextual(a,n,t.keepComments,t.isolatedDeclarations,f,f.length,x,v)}else s=e.checked(a,n,t.keepComments,t.isolatedDeclarations,x,v);let d=Number(x[0]);if(v[0]!==0)return e.read(s,d),null;return e.read(s,d)}
3
+ export{ci,ye};
@@ -1,19 +1,19 @@
1
1
  // @bun
2
- var rn=["import","type","interface","enum","class","function","variable","export","module","namespace","unknown"],zr=["builtin","external","scoped","internal","parent","sibling","index","type"];function We(e,n={}){let{lineEnding:t="lf",trailingNewline:i=!0,maxBlankLines:u=1,trimTrailingWhitespace:a=!0,normalizeIndentation:l=!0,indent:x={style:"spaces",size:2},declarationOrder:f,importGrouping:p,preserveComments:d=!0,insertFinalNewline:b=!0}=n,r=e;if(r=sn(r,t),p?.enabled!==!1)r=ln(r,p||{});if(f)r=un(r,f);if(a)r=on(r);if(r=an(r,u),l)r=Hr(r,x);if(i||b)r=cn(r);return r}function sn(e,n){let t=e;if(e.indexOf("\r")!==-1){if(e.indexOf(`\r
2
+ var un=["import","type","interface","enum","class","function","variable","export","module","namespace","unknown"],Zr=["builtin","external","scoped","internal","parent","sibling","index","type"];function Ve(e,n={}){let{lineEnding:t="lf",trailingNewline:i=!0,maxBlankLines:u=1,trimTrailingWhitespace:a=!0,normalizeIndentation:l=!0,indent:x={style:"spaces",size:2},declarationOrder:f,importGrouping:p,preserveComments:d=!0,insertFinalNewline:b=!0}=n,r=e;if(r=fn(r,t),p?.enabled!==!1)r=gn(r,p||{});if(f)r=hn(r,f);if(a)r=dn(r);if(r=pn(r,u),l)r=Qr(r,x);if(i||b)r=mn(r);return r}function fn(e,n){let t=e;if(e.indexOf("\r")!==-1){if(e.indexOf(`\r
3
3
  `)!==-1)t=t.replace(/\r\n/g,`
4
4
  `);if(t.indexOf("\r")!==-1)t=t.replace(/\r/g,`
5
5
  `)}if(n==="crlf")t=t.replace(/\n/g,`\r
6
- `);return t}function eo(e){let n=(e.match(/\r\n/g)||[]).length,t=(e.match(/(?<!\r)\n/g)||[]).length;if(n>t)return"crlf";return"lf"}function on(e){return e.split(`
6
+ `);return t}function ao(e){let n=(e.match(/\r\n/g)||[]).length,t=(e.match(/(?<!\r)\n/g)||[]).length;if(n>t)return"crlf";return"lf"}function dn(e){return e.split(`
7
7
  `).map((n)=>n.replace(/[\t ]+$/,"")).join(`
8
- `)}function an(e,n){let t=new RegExp(`\\n{${n+2},}`,"g");return e.replace(t,`
9
- `.repeat(n+1))}function cn(e){return`${e.replace(/\s+$/,"")}
10
- `}function Hr(e,n){let{style:t="spaces",size:i=2}=n,u=t==="tabs"?"\t":" ".repeat(i),a=e.split(`
8
+ `)}function pn(e,n){let t=new RegExp(`\\n{${n+2},}`,"g");return e.replace(t,`
9
+ `.repeat(n+1))}function mn(e){return`${e.replace(/\s+$/,"")}
10
+ `}function Qr(e,n){let{style:t="spaces",size:i=2}=n,u=t==="tabs"?"\t":" ".repeat(i),a=e.split(`
11
11
  `),l=[];for(let x of a){let f=x.match(/^([\t ]*)(.*)$/);if(!f){l.push(x);continue}let[,p,d]=f;if(!d){l.push("");continue}let b=p.replace(/\t/g," "),r=Math.floor(b.length/2);l.push(u.repeat(r)+d)}return l.join(`
12
- `)}function ln(e,n){let{groups:t=zr,separateGroups:i=!0,alphabetize:u=!0}=n,a=e.split(`
12
+ `)}function gn(e,n){let{groups:t=Zr,separateGroups:i=!0,alphabetize:u=!0}=n,a=e.split(`
13
13
  `),l=[],x=[],f=-1;for(let s=0;s<a.length;s++){let c=a[s],o=E(c);if(o)l.push({line:c,source:o.source,group:o.group,isType:o.isType}),f=s;else if(l.length>0&&c.trim()==="")continue;else if(l.length>0||c.trim()!==""){if(l.length===0||s>f+1)x.push(c)}}if(l.length===0)return e;let p=new Map;for(let s of t)p.set(s,[]);for(let s of l)(p.get(s.group)||p.get("external")||[]).push(s);if(u)for(let[,s]of p)s.sort((c,o)=>{if(c.isType!==o.isType)return c.isType?1:-1;return c.source.localeCompare(o.source)});let d=[],b=null;for(let s of t){let c=p.get(s)||[];if(c.length===0)continue;if(i&&b!==null)d.push("");for(let o of c)d.push(o.line);b=s}let r=a.slice(0,a.findIndex((s)=>E(s)!==null)),m=x;while(m.length>0&&m[0].trim()==="")m.shift();return[...r,...d,"",...m].join(`
14
- `)}function E(e){let n=e.trim(),t=n.match(/^import\s+(type\s+)?.*from\s+['"]([^'"]+)['"]/);if(!t){let a=n.match(/^import\s+['"]([^'"]+)['"]/);if(a)return{source:a[1],group:k(a[1]),isType:!1};return null}let i=!!t[1],u=t[2];return{source:u,group:i?"type":k(u),isType:i}}function k(e){if(e.startsWith("node:"))return"builtin";let n=["assert","buffer","child_process","cluster","crypto","dgram","dns","events","fs","http","https","net","os","path","querystring","readline","stream","url","util","zlib"];if(n.includes(e)||n.includes(e.split("/")[0]))return"builtin";if(e==="."||e==="./index"||e==="./index.js"||e==="./index.ts")return"index";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@"))return"scoped";return"external"}function un(e,n){let{kinds:t=rn,alphabetize:i=!1,groupExports:u=!0}=n,a=e.split(`
14
+ `)}function E(e){let n=e.trim(),t=n.match(/^import\s+(type\s+)?.*from\s+['"]([^'"]+)['"]/);if(!t){let a=n.match(/^import\s+['"]([^'"]+)['"]/);if(a)return{source:a[1],group:k(a[1]),isType:!1};return null}let i=!!t[1],u=t[2];return{source:u,group:i?"type":k(u),isType:i}}function k(e){if(e.startsWith("node:"))return"builtin";let n=["assert","buffer","child_process","cluster","crypto","dgram","dns","events","fs","http","https","net","os","path","querystring","readline","stream","url","util","zlib"];if(n.includes(e)||n.includes(e.split("/")[0]))return"builtin";if(e==="."||e==="./index"||e==="./index.js"||e==="./index.ts")return"index";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@"))return"scoped";return"external"}function hn(e,n){let{kinds:t=un,alphabetize:i=!1,groupExports:u=!0}=n,a=e.split(`
15
15
  `),l=[],x=[],f=[],p=null,d=0,b=!0,r=!1,m=[];for(let o=0;o<a.length;o++){let g=a[o],h=g.trim(),y=d,z=h.startsWith("///"),I=y===0&&!z&&(h.startsWith("//")||h.startsWith("/*"));if(r||I){if(m.push(g),!r&&h.startsWith("/*")&&!h.includes("*/"))r=!0;else if(r&&h.includes("*/"))r=!1;continue}if(y===0&&m.length>0&&h===""){m.push(g);continue}d+=(g.match(/\{/g)||[]).length,d-=(g.match(/\}/g)||[]).length;let W=T(h);if(b&&W&&W.kind!=="import"&&!h.startsWith("//")&&!h.startsWith("/*"))b=!1;if(b){if(m.length>0){if(W?.kind==="import"||!W)x.push(...m),m.length=0}x.push(g);continue}if(W&&d<=1){if(p)l.push(p);p={lines:m.length>0?[...m,g]:[g],kind:W.kind,name:W.name,isExport:W.isExport},m.length=0}else if(p)p.lines.push(g);else{if(h==="")continue;f.push(g)}}if(p)l.push(p);if(m.length>0)f.push(...m);l.sort((o,g)=>{if(u&&o.isExport!==g.isExport)return o.isExport?-1:1;let h=t.indexOf(o.kind),y=t.indexOf(g.kind),z=h>=0?h:t.length,I=y>=0?y:t.length;if(z!==I)return z-I;if(i)return o.name.localeCompare(g.name);return 0});let s=[...x],c=null;for(let o of l){if(c!==null&&o.kind!==c)s.push("");s.push(...o.lines),c=o.kind}if(f.length>0)s.push(""),s.push(...f);return s.join(`
16
- `)}function T(e){let n=e.startsWith("export "),t=n?e.slice(7):e;if(e.startsWith("import "))return{kind:"import",name:e.match(/from\s+['"]([^'"]+)['"]/)?.[1]||"",isExport:!1};if(t.startsWith("type ")||t.startsWith("declare type "))return{kind:"type",name:t.match(/type\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("interface ")||t.startsWith("declare interface "))return{kind:"interface",name:t.match(/interface\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("class ")||t.startsWith("abstract class ")||t.startsWith("declare class ")||t.startsWith("declare abstract class "))return{kind:"class",name:t.match(/class\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("enum ")||t.startsWith("const enum ")||t.startsWith("declare enum ")||t.startsWith("declare const enum "))return{kind:"enum",name:t.match(/enum\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("function ")||t.startsWith("async function ")||t.startsWith("declare function ")||t.startsWith("declare async function "))return{kind:"function",name:t.match(/function\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("const ")||t.startsWith("let ")||t.startsWith("var ")||t.startsWith("declare const ")||t.startsWith("declare let ")||t.startsWith("declare var "))return{kind:"variable",name:t.match(/(?:const|let|var)\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("namespace ")||t.startsWith("declare namespace "))return{kind:"namespace",name:t.match(/namespace\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("module ")||t.startsWith("declare module "))return{kind:"module",name:t.match(/module\s+['"]?(\w+)['"]?/)?.[1]||"",isExport:n};if(e.startsWith("export {")||e.startsWith("export *")||e.startsWith("export type {"))return{kind:"export",name:"",isExport:!0};return null}function to(e){let n=e.split(`
16
+ `)}function T(e){let n=e.startsWith("export "),t=n?e.slice(7):e;if(e.startsWith("import "))return{kind:"import",name:e.match(/from\s+['"]([^'"]+)['"]/)?.[1]||"",isExport:!1};if(t.startsWith("type ")||t.startsWith("declare type "))return{kind:"type",name:t.match(/type\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("interface ")||t.startsWith("declare interface "))return{kind:"interface",name:t.match(/interface\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("class ")||t.startsWith("abstract class ")||t.startsWith("declare class ")||t.startsWith("declare abstract class "))return{kind:"class",name:t.match(/class\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("enum ")||t.startsWith("const enum ")||t.startsWith("declare enum ")||t.startsWith("declare const enum "))return{kind:"enum",name:t.match(/enum\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("function ")||t.startsWith("async function ")||t.startsWith("declare function ")||t.startsWith("declare async function "))return{kind:"function",name:t.match(/function\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("const ")||t.startsWith("let ")||t.startsWith("var ")||t.startsWith("declare const ")||t.startsWith("declare let ")||t.startsWith("declare var "))return{kind:"variable",name:t.match(/(?:const|let|var)\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("namespace ")||t.startsWith("declare namespace "))return{kind:"namespace",name:t.match(/namespace\s+(\w+)/)?.[1]||"",isExport:n};if(t.startsWith("module ")||t.startsWith("declare module "))return{kind:"module",name:t.match(/module\s+['"]?(\w+)['"]?/)?.[1]||"",isExport:n};if(e.startsWith("export {")||e.startsWith("export *")||e.startsWith("export type {"))return{kind:"export",name:"",isExport:!0};return null}function co(e){let n=e.split(`
17
17
  `),t=[];for(let i=0;i<n.length;i++){let u=n[i],a=u.trim();if(a.startsWith("/**")||a.startsWith("*")||a.startsWith("*/")){t.push(u);continue}if(a.startsWith("//")){t.push(u);continue}if(a.startsWith("/*")||a.endsWith("*/")){t.push(u);continue}t.push(u)}return t.join(`
18
- `)}function no(e={}){return{normalize:(n)=>We(n,e),normalizeLineEndings:(n)=>sn(n,e.lineEnding||"lf"),removeTrailingWhitespace:on,normalizeBlankLines:(n)=>an(n,e.maxBlankLines||1),ensureTrailingNewline:cn,processImports:(n)=>ln(n,e.importGrouping||{}),orderDeclarations:(n)=>un(n,e.declarationOrder||{})}}var ro={default:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},minimal:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:2,trimTrailingWhitespace:!0,normalizeIndentation:!1,importGrouping:{enabled:!1}},strict:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0},declarationOrder:{kinds:rn,alphabetize:!0,groupExports:!0}},windows:{lineEnding:"crlf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},tabs:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"tabs",size:1},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}}};
19
- export{rn,zr,We,sn,eo,on,an,cn,Hr,ln,un,to,no,ro};
18
+ `)}function lo(e={}){return{normalize:(n)=>Ve(n,e),normalizeLineEndings:(n)=>fn(n,e.lineEnding||"lf"),removeTrailingWhitespace:dn,normalizeBlankLines:(n)=>pn(n,e.maxBlankLines||1),ensureTrailingNewline:mn,processImports:(n)=>gn(n,e.importGrouping||{}),orderDeclarations:(n)=>hn(n,e.declarationOrder||{})}}var uo={default:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},minimal:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:2,trimTrailingWhitespace:!0,normalizeIndentation:!1,importGrouping:{enabled:!1}},strict:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0},declarationOrder:{kinds:un,alphabetize:!0,groupExports:!0}},windows:{lineEnding:"crlf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},tabs:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"tabs",size:1},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}}};
19
+ export{un,Zr,Ve,fn,ao,dn,pn,mn,Qr,gn,hn,co,lo,uo};