@dtsx/dtsx 0.11.54 → 0.11.55
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.
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-bys9tn88.js → chunk-0a1xppye.js} +1 -1
- package/dist/{chunk-x569v6av.js → chunk-20jq5v1p.js} +1 -1
- package/dist/{chunk-rc1zpm7f.js → chunk-2qbj76ap.js} +8 -8
- package/dist/{chunk-j4w3zxc1.js → chunk-38r6thfe.js} +1 -1
- package/dist/{chunk-aw6spwvp.js → chunk-4cr1q0yf.js} +2 -2
- package/dist/{chunk-0gy70m6b.js → chunk-555w3kcr.js} +1 -1
- package/dist/{chunk-wvdy228e.js → chunk-5bdwrsqt.js} +1 -1
- package/dist/{chunk-egmen4qn.js → chunk-5tn8854w.js} +12 -12
- package/dist/{chunk-d6cwtv8p.js → chunk-5yx2x4v4.js} +1 -1
- package/dist/{chunk-z6amkx8m.js → chunk-62428w6e.js} +1 -1
- package/dist/{chunk-365k5pgj.js → chunk-6j6dvj8a.js} +1 -1
- package/dist/{chunk-ywff3fq9.js → chunk-7rdazac9.js} +14 -14
- package/dist/{chunk-6sdswv08.js → chunk-81jrzxr6.js} +3 -3
- package/dist/{chunk-9gdtzkjv.js → chunk-9wwsqemm.js} +1 -1
- package/dist/{chunk-8apqea4x.js → chunk-b6994asf.js} +1 -1
- package/dist/{chunk-g3737b7k.js → chunk-bt2n0b75.js} +1 -1
- package/dist/{chunk-9xvmk7pg.js → chunk-c726s7aj.js} +1 -1
- package/dist/{chunk-geqq4mmz.js → chunk-cfjd81h8.js} +1 -1
- package/dist/{chunk-cdq514ff.js → chunk-daasy0pw.js} +2 -2
- package/dist/{chunk-zp7a7th9.js → chunk-djbck65n.js} +1 -1
- package/dist/{chunk-cp8xdvb6.js → chunk-ekf33t9z.js} +1 -1
- package/dist/{chunk-gdzqt46g.js → chunk-eskywkxz.js} +1 -1
- package/dist/{chunk-990m77vr.js → chunk-ewgs91y1.js} +1 -1
- package/dist/{chunk-rymbw083.js → chunk-f5jc2v3k.js} +1 -1
- package/dist/{chunk-h7nk8ywf.js → chunk-g25sbqbw.js} +1 -1
- package/dist/{chunk-6y728pph.js → chunk-h7ebvy8j.js} +1 -1
- package/dist/{chunk-193aw7d6.js → chunk-hj7gs32r.js} +1 -1
- package/dist/{chunk-na7saw10.js → chunk-kg0srf55.js} +1 -1
- package/dist/{chunk-srfpcjtn.js → chunk-mew3f4wh.js} +2 -2
- package/dist/{chunk-2q4d5dqw.js → chunk-njknd1pt.js} +1 -1
- package/dist/{chunk-r0mj8ky4.js → chunk-qhkxctek.js} +1 -1
- package/dist/{chunk-0xjw2vdt.js → chunk-qt9gjs57.js} +1 -1
- package/dist/{chunk-g743tp4d.js → chunk-r46rw8gr.js} +2 -2
- package/dist/{chunk-15qy51py.js → chunk-rzcnab8j.js} +1 -1
- package/dist/{chunk-pggbb1c0.js → chunk-sjbm1trn.js} +2 -2
- package/dist/{chunk-87mk4nnk.js → chunk-srm0ddsk.js} +9 -9
- package/dist/{chunk-j67chb8m.js → chunk-tw99ftp1.js} +1 -1
- package/dist/{chunk-3d49h0bx.js → chunk-vt5hr8vs.js} +1 -1
- package/dist/chunk-wq5r1ms9.js +38 -0
- package/dist/{chunk-1k5r7bpf.js → chunk-yxcyqezk.js} +1 -1
- package/dist/src/augmentation-graph.js +1 -1
- package/dist/src/bundle-linker.js +1 -1
- package/dist/src/bundler.js +1 -1
- package/dist/src/circular.js +1 -1
- package/dist/src/concurrency.js +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/declaration-project.js +1 -1
- package/dist/src/declaration-publication.js +1 -1
- package/dist/src/declaration-references.js +1 -1
- package/dist/src/docs.js +1 -1
- package/dist/src/extractor/extract.js +1 -1
- package/dist/src/extractor/scanner.js +1 -1
- package/dist/src/extractor.js +1 -1
- package/dist/src/function-properties.js +1 -1
- package/dist/src/generator.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/inferred-imports.js +1 -1
- package/dist/src/initializer-type-spans.js +1 -1
- package/dist/src/lsp.js +1 -1
- package/dist/src/native-checker.js +1 -1
- package/dist/src/native-extractor.js +1 -1
- package/dist/src/native-generation.js +1 -1
- package/dist/src/native-project.js +1 -1
- package/dist/src/optimizer.js +1 -1
- package/dist/src/parallel-processor.js +1 -1
- package/dist/src/parser.js +1 -1
- package/dist/src/plugins/bun.js +1 -1
- package/dist/src/plugins/esbuild.js +1 -1
- package/dist/src/plugins/index.js +1 -1
- package/dist/src/plugins/tsdown.js +1 -1
- package/dist/src/plugins/tsup.js +1 -1
- package/dist/src/plugins/vite.js +1 -1
- package/dist/src/plugins/webpack.js +1 -1
- package/dist/src/process-source.js +1 -1
- package/dist/src/processor/declarations.js +1 -1
- package/dist/src/processor/import-usage.js +1 -1
- package/dist/src/processor/index.js +1 -1
- package/dist/src/processor/type-inference.js +1 -1
- package/dist/src/processor.js +1 -1
- package/dist/src/return-type-scope.js +1 -1
- package/dist/src/security.js +1 -1
- package/dist/src/source-cache.js +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/value-inference.js +1 -1
- package/dist/src/worker-thread.js +1 -1
- package/dist/src/workspace.js +1 -1
- package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
- package/native/darwin-x64/libzig-dtsx.dylib +0 -0
- package/native/freebsd-x64/libzig-dtsx.so +0 -0
- package/native/linux-arm64/libzig-dtsx.so +0 -0
- package/native/linux-x64/libzig-dtsx.so +0 -0
- package/native/windows-x64/zig-dtsx.dll +0 -0
- package/package.json +1 -1
- package/dist/chunk-6j4wx5mf.js +0 -38
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u}from"./chunk-6b6rt0yh.js";import{b}from"./chunk-t5nmnzy6.js";import{C}from"./chunk-9mdgtq38.js";import{r}from"./chunk-
|
|
2
|
+
import{u}from"./chunk-6b6rt0yh.js";import{b}from"./chunk-t5nmnzy6.js";import{C}from"./chunk-9mdgtq38.js";import{r}from"./chunk-0a1xppye.js";import{Me}from"./chunk-bt2n0b75.js";function oa(c){if(!c.includes("declare")||!c.includes("module"))return[];return b(c).filter((d)=>d.category==="augmentation").map((d)=>d.specifier)}function A(c,d){let m=new Set([c]);for(let S of m)for(let p of d(S))m.add(p);return m}async function Re(c,d,m=!1,S){let p=new Map,v=new Map;for(let e of c){let g=S?.get(e)??await u(e);p.set(e,g);let s=oa(g);if(s.length)v.set(e,s)}let w=new Map;if(v.size===0)return w;let l=new Map,x=(e,g)=>{let s=d(e,g);if(s.resolved)return s.resolved;if(!s.isRelative&&!s.isAlias)return`external:${e}`;return};for(let[e,g]of p){let s=r(g,e,!1,m),a=Me(s),f={edges:[],declarations:new Set,augmentations:new Set},h=(n,i,t)=>{let o=x(n.specifier,e);if(!o)return;if(p.has(o))f.edges.push({specifier:n.specifier,target:o,import:i});if(t)f.declarations.add(o)};for(let n of s){if(n.kind!=="import")continue;let i=n.isSideEffect||C(n.text).some((t)=>a.usedItems.has(t));for(let t of b(n.text))h(t,!0,!!i)}for(let n of b(a.referenceText))h(n,!1,!0);for(let n of v.get(e)??[]){let i=x(n,e);if(i)f.augmentations.add(i),f.declarations.add(i)}l.set(e,f)}let y=!0;while(y){y=!1;for(let[e,g]of l){let s=A(e,(a)=>l.get(a)?.declarations??[]);for(let[a,f]of l){if(s.has(a)||!f.augmentations.size||![...f.augmentations].some((t)=>s.has(t)))continue;let h=[e],n=new Map,i=new Set([e]);for(let t of h){if(t===a)break;for(let o of l.get(t).edges){if(i.has(o.target))continue;i.add(o.target),n.set(o.target,{from:t,edge:o}),h.push(o.target)}}if(!n.has(a))continue;for(let t=a;t!==e;){let{from:o,edge:R}=n.get(t),I=l.get(o);if(R.import){let M=w.get(o);if(!M)M=new Set,w.set(o,M);M.add(R.specifier)}if(!I.declarations.has(t))I.declarations.add(t),y=!0;t=o}}}}return w}
|
|
3
3
|
export{oa,Re};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,m}from"./chunk-t5nmnzy6.js";import{Ge}from"./chunk-gwa4hmfa.js";function ft(l){let u=t(l);if(u.length!==1||u[0].kind!=="word")return;let f=l.slice(u[0].start,u[0].end);return["true","false","null","undefined","this","super"].includes(f)?void 0:f}function Vt(l){let u=t(l);if(u.length===0)return!0;let f=u[u.length-1],g=l.slice(f.start,f.end);if(f.kind==="word"&&
|
|
2
|
+
import{t,m}from"./chunk-t5nmnzy6.js";import{Ge}from"./chunk-gwa4hmfa.js";function ft(l){let u=t(l);if(u.length!==1||u[0].kind!=="word")return;let f=l.slice(u[0].start,u[0].end);return["true","false","null","undefined","this","super"].includes(f)?void 0:f}function Vt(l){let u=t(l);if(u.length===0)return!0;let f=u[u.length-1],g=l.slice(f.start,f.end);if(f.kind==="word"&&["is","extends","keyof","readonly"].includes(g))return!0;if(g==="|"||g==="&"||g==="?"||g===":")return!0;let o=u[u.length-2];return g===">"&&o!==void 0&&l.slice(o.start,o.end)==="="}function z(l){return C(l,m(l))}function tr(l){for(let u=1024;u<l.length;u*=8){let f=l.slice(0,u),g=I(f,t(f),u);if(g!==void 0)return g}return C(l,t(l))}function C(l,u){return I(l,u,1/0)??!1}function I(l,u,f){let g=0;for(let o=0;o<u.length;o++){let e=u[o];if(e.end>=f)return;if(e.kind==="punctuation"){let a=l.charCodeAt(e.start);if(a===123||a===40||a===91)g++;else if(a===125||a===41||a===93)g--;continue}if(g!==0||e.kind!=="word"||e.end-e.start!==6)continue;let b=l.slice(e.start,e.end);if(b==="export")return!0;if(b==="import"){let a=u[o+1];if(a===void 0?f!==1/0:a.end>=f)return;let w=a?l.slice(a.start,a.end):"";if(w!=="("&&w!==".")return!0}}return f===1/0?!1:void 0}function nr(l){if(l.isExported)return!1;if(["function","variable","interface","type","class","enum","namespace"].includes(l.kind))return!0;return l.kind==="module"&&(l.moduleForm==="namespace"||l.moduleForm==="identifier")}function rr(l,u,f){let g=l.text,o=t(g),e=(s)=>o[s]?g.slice(o[s].start,o[s].end):"",b=(s)=>o[s]?.kind==="word",a=new Map,w=new Map,y=[];for(let s=0;s<o.length;s++){let n=e(s);if(n==="("||n==="["||n==="{"||n==="<")y.push(s);else if(n===")"||n==="]"||n==="}"||n===">"&&e(s-1)!=="="){let i=y.at(-1);if(i!==void 0&&(e(i)==="("&&n===")"||e(i)==="["&&n==="]"||e(i)==="{"&&n==="}"||e(i)==="<"&&n===">")){if(y.pop(),a.set(i,s),e(i)==="<")w.set(s,i)}}}let O=(s)=>{let n=s;while(["readonly","public","private","protected","static","abstract","override","declare","accessor","get","set","async"].includes(e(n))&&(b(n+1)||o[n+1]?.kind==="quoted"||e(n+1)==="["||/^[0-9]/.test(e(n+1))))n++;if(e(n)==="(")return e((a.get(n)??o.length)+1)===":";if(e(n)==="<")return e((a.get(n)??o.length)+1)==="(";let i=n+1;if(e(n)==="[")i=(a.get(n)??o.length)+1;else if(g.charCodeAt(o[n]?.start??g.length)>=48&&g.charCodeAt(o[n]?.start??g.length)<=57)while(i<o.length&&o[i-1].end===o[i].start&&/^[\da-fxob_e.+-]+$/i.test(e(i)))i++;else if(!b(n)&&o[n]?.kind!=="quoted"&&o[n]?.kind!=="literal")return!1;if(e(i)==="?")i++;if(e(i)==="<")i=(a.get(i)??o.length)+1;return e(i)===":"||e(i)==="("},D=[],A=[];for(let s=0;s<o.length;s++){if(e(s)!=="(")continue;let n=a.get(s);if(n===void 0||!(e(n+1)===":"||e(n+1)==="="&&e(n+2)===">"))continue;let i=new Set,h=s+1;while(h<n){let p=h;while(p<n&&e(p)!==","){let x=a.get(p);if(x!==void 0)p=x+1;else p++}let r=h;while(r<p&&e(r)!==":"&&e(r)!=="="){let x=a.get(r);if(x!==void 0)r=x+1;else r++}let c=h;while([".","public","private","protected","readonly","override"].includes(e(c)))c++;if(e(c)==="{"||e(c)==="[")for(let x of Ge(g.slice(o[c].start,o[r-1].end)))i.add(x);else if(b(c))i.add(e(c));h=p+1}let d=n+(e(n+1)===":"?2:3);while(d<o.length){if(d>n+2&&g.slice(o[d-1].end,o[d].start).includes(`
|
|
3
3
|
`)&&!["|","&","?","extends","keyof","typeof","readonly","new","infer","is"].includes(e(d-1))&&O(d))break;if([";",",",")","]","}"].includes(e(d))||e(d)===">"&&e(d-1)!=="=")break;let p=a.get(d);if(p!==void 0)d=p+1;else d++}D.push({start:s,end:d,names:i});let k=w.get(s-1);if(f&&k!==void 0){let p=new Set,r=k+1;while(r<s-1){while(["const","in","out"].includes(e(r)))r++;if(b(r))p.add(e(r));while(r<s-1&&e(r)!==",")r=(a.get(r)??r)+1;r++}A.push({start:k,end:d,names:p})}}let v=f?new Set:void 0,S=(s)=>{if(!b(s))return;v?.add(o[s].start);let n=e(s);if(!D.some((i)=>s>=i.start&&s<i.end&&i.names.has(n)))u.add(n)},T=(s,n)=>{for(let i=s;i<n;i++){if(e(i)==="<"&&a.has(i)){i=a.get(i);continue}if(!b(i)||e(i-1)==="."||e(i+1)===":")continue;if(["true","false","null","undefined","new","this","super","as","satisfies","typeof","void","keyof"].includes(e(i)))continue;S(i)}};for(let s=0;s<o.length;s++){if(e(s)==="typeof")S(s+1);if(e(s)==="export"){let n=s+1;if(e(n)==="default"){if(!["function","class","abstract"].includes(e(n+1))){if(T(n+1,o.length),b(n+1)&&f?.candidates.has(e(n+1))&&(e(n+2)===";"||n+2===o.length))f.references.add(e(n+1))}continue}let i=e(n)==="type";if(i)n++;if(e(n)==="{"){let h=a.get(n);if(h===void 0||e(h+1)==="from")continue;for(let d=n+1;d<h;){let k=e(d)==="type"&&b(d+1)&&e(d+1)!=="as";if(k)d++;let p=f?.candidates.has(e(d));if(p)f.references.add(e(d));if(!p||!i&&!k)S(d);else v?.add(o[d].start);while(d<h&&e(d)!==",")d++;d++}}}if(e(s)==="["){let n=a.get(s);if(n!==void 0&&[":","?","("].includes(e(n+1))&&e(s+2)!==":"&&e(s+2)!=="in")T(s+1,n)}}if(l.kind==="class"){let s=-1;for(let n=0;n<o.length&&e(n)!=="{";n++)if(e(n)==="<"&&a.has(n))n=a.get(n);else if(e(n)==="extends"){s=n;break}if(s!==-1){let n=s+1;while(n<o.length&&e(n)!=="{"&&e(n)!=="implements"){let i=a.get(n);if(i!==void 0)n=i+1;else n++}T(s+1,n)}}if(f){let s=new Set,n=t(l.generics??""),i=0,h=!1;for(let r of n){let c=(l.generics??"").slice(r.start,r.end);if(["<","(","[","{"].includes(c)){if(i++,c==="<"&&i===1)h=!0}else if([">",")","]","}"].includes(c)&&!(c===">"&&(l.generics??"").slice(r.start-1,r.start)==="="))i--;else if(c===","&&i===1)h=!0;else if(h&&i===1&&r.kind==="word"&&!["const","in","out"].includes(c))s.add(c),h=!1}let d=A.flatMap((r)=>[...r.names].flatMap((c)=>[{index:r.start,name:c,delta:1},{index:r.end,name:c,delta:-1}])).sort((r,c)=>r.index-c.index),k=new Map,p=0;for(let r=0;r<o.length;r++){while(p<d.length&&d[p].index<=r){let M=d[p++];k.set(M.name,(k.get(M.name)??0)+M.delta)}if(!b(r)||v?.has(o[r].start)||!f.candidates.has(e(r))||s.has(e(r))||(k.get(e(r))??0)>0)continue;let c=e(r-1),x=e(r+1);if(c==="."||c==="as"&&l.kind==="export"||["const","let","var","function","class","interface","type","enum","namespace","module"].includes(c))continue;if(x===":"&&c!=="?"||x==="?"&&[":","("].includes(e(r+2))||x==="("||x==="<"&&e((a.get(r+1)??o.length)+1)==="(")continue;f.references.add(e(r))}}}
|
|
4
|
-
export{ft,Vt,
|
|
4
|
+
export{ft,Vt,z,tr,nr,rr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,m}from"./chunk-t5nmnzy6.js";import{n}from"./chunk-
|
|
2
|
+
import{t,m}from"./chunk-t5nmnzy6.js";import{n}from"./chunk-7rdazac9.js";function Hn(p,k,b,h){let r=new Map,i=new Map;for(let e of[...k,...b.values(),...[...h.values()].flat()])if(r.set(e.name,e),e.kind==="function"&&!i.has(e.name))i.set(e.name,e);for(let[e,o]of h)if(o.length)i.set(e,o[0]);if(!i.size)return;let u=new Set;for(let[e,o]of h)if(o.length>1)u.add(e);let a=new Map;for(let e of k)if(e.kind==="function"){let o=(a.get(e.name)??0)+1;if(a.set(e.name,o),o>1)u.add(e.name)}let s=m(p),d=(e)=>s[e]?p.slice(s[e].start,s[e].end):"",g=new Map,x=0;for(let e=0;e<s.length;e++){let o=s[e];if(o.kind==="punctuation"){let l=p.charCodeAt(o.start);if(l===40||l===91||l===123)x++;else if(l===41||l===93||l===125)x--;continue}if(x||s[e+2]?.kind!=="word"||d(e+1)!=="."||d(e+3)!=="=")continue;let c=d(e);if(!i.has(c))continue;let M=d(e+2),w=e+4,f=w,y=0;for(;f<s.length;f++){let l=d(f);if(!y&&l===";")break;if(!y&&f>w&&/[\r\n]/.test(p.slice(s[f-1].end,s[f].start))&&(["export","const","let","var","function","class"].includes(l)||i.has(l)&&d(f+1)==="."))break;if(["(","[","{"].includes(l))y++;else if([")","]","}"].includes(l))y--}if(f===w)continue;let D=R(p.slice(s[w].start,s[f-1].end),r,u),v=g.get(c);if(!v)g.set(c,v=new Map);let A=v.get(M);if(!A)v.set(M,A=[]);if(!A.includes(D))A.push(D);e=f-1}for(let[e,o]of g){let c=i.get(e),M=[...o].map(([f,y])=>` let ${f}: ${y.map((D)=>D.includes("=>")&&y.length>1?`(${D})`:D).join(" | ")};`).join(`
|
|
3
3
|
`),w=c.isExported&&!c.isDefault?"export ":"";if(c.isDefault)c.text=c.text.replace("export default function ","declare function ");if(c.text+=`
|
|
4
4
|
${w}declare namespace ${e} {
|
|
5
5
|
${M}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
2
|
+
import{r}from"./chunk-0a1xppye.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function bs(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
|
|
3
3
|
`);return{content:d,files:t,declarationCount:D,importCount:w,exportCount:S,size:Buffer.byteLength(d,"utf8"),warnings:[]}}function F(t){if(t.text){let n=t.text.trim();if(t.isExported&&!n.startsWith("export"))n=`export ${n}`;if(!n.endsWith(";")&&!n.endsWith("}"))n+=";";return n}let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${V(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${n.name}${n.typeAnnotation?`: ${n.typeAnnotation}`:""};`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)e.push(`implements ${t.implements.join(", ")}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${F(n)}`);e.push("}");break;case"enum":if(e.push("declare enum"),e.push(t.name),e.push("{"),t.members){let n=t.members.map((u)=>u.value!==void 0?`${u.name} = ${u.value}`:u.name);e.push(` ${n.join(`,
|
|
4
4
|
`)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function nn(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
|
|
5
5
|
`),m=[],d=0,i=!1;for(let o of b){let s=o.trim();if(!s&&!i)continue;if(s.startsWith("import ")){S++;let l=s.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(l){let[,h,W,q,H,A]=l;if(e.externals?.some((P)=>A.startsWith(P))){f.push(s);continue}if(A.startsWith("."))continue;if(!u.has(A))u.set(A,{source:A,specifiers:new Map,isTypeOnly:!!h,isSideEffect:!1});let E=u.get(A);if(W){let P=W.split(",").map((k)=>k.trim());for(let k of P){let[I,v]=k.split(/\s+as\s+/).map((M)=>M.trim()),R=I.startsWith("type "),O=R?I.replace("type ",""):I;E.specifiers.set(v||O,{name:O,alias:v!==O?v:void 0,isType:R})}}if(!h)E.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(s)){if(i=!0,m=[o],d=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d===0&&(s.endsWith(";")||!s.includes("{"))){let l=B(s);if(!D.has(l)||!e.mergeDuplicates){if(D.add(l),f.push(o),w++,s.startsWith("export"))C++}i=!1,m=[]}}else if(i){if(m.push(o),d+=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d<=0){let l=m.join(`
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w,le,Mt,u}from"./chunk-6b6rt0yh.js";import{
|
|
3
|
-
${tt()}`),p=j===-1?t:t.slice(0,j),y=Dt(p,o,C,f),b=`${d}.map`;return await g(b,JSON.stringify(y)),e.debug(` Generated source map: ${
|
|
4
|
-
${H}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${
|
|
5
|
-
...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)
|
|
6
|
-
`);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=Rn(i,S,
|
|
2
|
+
import{w,le,Mt,u}from"./chunk-6b6rt0yh.js";import{V}from"./chunk-mew3f4wh.js";import{L,N}from"./chunk-qbk49jz5.js";import{O,I}from"./chunk-fpa2ea8k.js";import{r}from"./chunk-0a1xppye.js";import{Re}from"./chunk-38r6thfe.js";import{e,M}from"./chunk-8vvryt8p.js";import{Oe,P,Bn,Z}from"./chunk-1t77gtcx.js";import{Rn}from"./chunk-srm0ddsk.js";import{et,kt}from"./chunk-h6ddkhyq.js";import{D}from"./chunk-2qbj76ap.js";import{De,oe,X,Pe}from"./chunk-yxcyqezk.js";import{tt,Y,re,Tt,At,Dt,Pt}from"./chunk-20jq5v1p.js";import{ne,$e}from"./chunk-hj7gs32r.js";import{Qe,Et}from"./chunk-tgaear7n.js";import{te}from"./chunk-spdw3tc0.js";import{Ln,rt}from"./chunk-cfjd81h8.js";import{q,Ee}from"./chunk-dak0dhnx.js";import{Xe}from"./chunk-msa98cgm.js";import{Ae}from"./chunk-7pw9ayve.js";import{l}from"./chunk-81jrzxr6.js";import{ie,Rt}from"./chunk-0d5nemtn.js";import{mkdir as ye}from"fs/promises";import{availableParallelism as Se}from"os";import{basename as fe,dirname as pe,relative as z,resolve as ee}from"path";var Q=new WeakMap,ce=new WeakMap;function se(d){let a=Q.get(d);if(!a)a=Oe(d),Q.set(d,a),a.catch(()=>Q.delete(d));return a}async function de(d,a,t,f,h,g=Y){let o=fe(d)||"output.d.ts",C=z(pe(d),a),T=`${o}.map`,j=t.lastIndexOf(`
|
|
3
|
+
${tt()}`),p=j===-1?t:t.slice(0,j),y=Dt(p,o,C,f),b=`${d}.map`;return await g(b,JSON.stringify(y)),e.debug(` Generated source map: ${z(h,b)}`),T}async function s(d){let a=Date.now(),t={...D,...d};if(t.logLevel)M(t.logLevel);else if(t.verbose)M("debug");let f=new Ae;if(t.plugins&&t.plugins.length>0){for(let n of t.plugins)f.register(n),e.debug(`Registered plugin: ${n.name}`);t=await f.runOnStart(t)}if(t.moduleSpecifierMode!==void 0&&t.moduleSpecifierMode!=="preserve"&&t.moduleSpecifierMode!=="node")throw Error("moduleSpecifierMode must be preserve or node");if(q(t.engine,"engine"),await ne(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await re(t);let h=t.typeMappings?ie(t.typeMappings):void 0,g=null,o={generationMode:t.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},C=0;e.debug("Starting DTS generation..."),e.debug(`Using ${o.generationMode} declaration generation path`),e.debug("Config:",t);let T=await De(t,()=>se(t)),j=T.entryFiles,p=[...T.files],{resolver:y,reachability:b}=T;if(ce.set(t,new Set(p)),t.incremental){let n=T.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let S of p){let F=await u(S);m.set(S,rt(F));for(let U of P(F,{includeImports:!0})){let R=y(U.specifier,S).resolved;if(R&&!R.split(/[/\\]/).includes("node_modules")&&!i.has(R))i.add(R),m.set(R,rt(await u(R)))}}let c=[...m].sort(([S],[F])=>S.localeCompare(F));n=JSON.stringify([n,c])}if(g=new et(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)g.clear()}else if(g.load()){let m=g.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)kt(t.cwd)}if(g&&!t.dryRun){let n=g.prune(new Set(p),t.cwd);if(n>0)e.debug(`Pruned ${n} deleted files from cache`)}if(e.debug(`Found ${p.length} TypeScript files`),t.progress&&p.length>0){let n=t.parallel?"parallel":"sequential";e.info(`Processing ${p.length} files (${n})...`)}let W=new Map,k=new Map,v=async(n,i,m="lf")=>{k.set(n,{content:i,lineEnding:m})},E=async(n,i)=>{let m;try{let c=X(n,t),S=async(x)=>{if(!t.diff)return;try{let B=await u(c),H=At(B,x,z(t.cwd,c));if(H)e.info(`
|
|
4
|
+
${H}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${z(t.cwd,c)}`)}},F=(x)=>{if(!t.validate)return 0;let B=Tt(x,c);if(B.isValid)return e.debug(`[validation] ${c} - OK`),0;e.warn(`[validation] ${z(t.cwd,c)} has ${B.errors.length} error(s):`);for(let H of B.errors){let ae=` Line ${H.line}:${H.column}`;if(H.code)ae+=` [${H.code}]`;if(ae+=` - ${H.message}`,e.warn(ae),H.suggestion)e.warn(` Suggestion: ${H.suggestion}`)}return B.errors.length},U=(x)=>{e.info(`[dry-run] Would generate: ${c}`),e.debug("--- Content preview ---"),e.debug(x.slice(0,500)+(x.length>500?`
|
|
5
|
+
...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)W.set(n,x);await S(x);let B=F(x);if(t.dryRun)U(x);else{if(t.declarationMap)m=i??await u(n),await de(c,n,x,m,t.cwd,v);await v(c,x,t.lineEnding)}return e.debug(`[cached] ${z(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:B}}}m=i??await u(n);let{content:R,declarationCount:he,importCount:we,exportCount:Ce}=await ge(n,m,t,f,h,T.augmentationImports.get(n));if(t.bundle)W.set(n,R);let A=R;if(t.prettier||t.indentStyle||t.indentSize){let x=await te(A,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);A=x.content;for(let B of x.warnings??[])e.warn(`[format] ${B}`)}if(t.declarationMap){let x=`${fe(c)||"output.d.ts"}.map`;A=Pt(A,x)}await S(A);let be=F(A);if(t.dryRun)U(A);else{if(t.declarationMap&&m)await de(c,n,A,m,t.cwd,v);if(await v(c,A,t.lineEnding),g&&m)g.update(n,m,A,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:he,importCount:we,exportCount:Ce,validationErrorCount:be}}catch(c){let S=Qe(c,n,m);if(t.plugins&&t.plugins.length>0)await f.runOnError(c instanceof Error?c:Error(String(c)),n,m||"");return{success:!1,file:n,declarationCount:0,importCount:0,exportCount:0,dtsError:S,validationErrorCount:0}}},G=t.parallel||t.parallel!==!1&&p.length>=10,J=V(t.concurrency,Se?.()??8),_=new Map;if(G&&p.length>1){let n=p.map(async(i)=>{try{let m=await u(i);return{file:i,source:m}}catch{return{file:i,source:null}}});for(let i of await Promise.all(n))if(i.source!==null)_.set(i.file,i.source)}let K=(n)=>{if(o.filesProcessed++,n.success){if(n.cached)C++;else o.filesGenerated++,o.declarationsFound+=n.declarationCount,o.importsProcessed+=n.importCount,o.exportsProcessed+=n.exportCount;if(t.validate){if(o.filesValidated++,n.validationErrorCount)o.validationErrors+=n.validationErrorCount}}else if(o.filesFailed++,n.dtsError){o.errors.push(n.dtsError);let i=Et(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(G)for(let n=0;n<p.length;n+=J){let i=p.slice(n,n+J),m=await Promise.all(i.map((c)=>E(c,_.get(c))));for(let c of m)K(c);if(t.progress){let c=Math.round(o.filesProcessed/p.length*100);e.info(`[${o.filesProcessed}/${p.length}] ${c}%`)}}else for(let n of p){let i=await E(n);if(K(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${z(t.cwd,n)} ${c}`)}}if(!t.bundle){let n=[];if(b)for(let i of b.unresolved)n.push({from:i.from,specifier:i.specifier,reason:"missing"});if(t.autoIncludeReExports===!1&&p.length>0){let i=new Set(p);for(let m of p){let c;try{c=await u(m)}catch{continue}for(let S of P(c)){let F=y(S.specifier,m);if(!F.isRelative)continue;if(!F.resolved)n.push({from:m,specifier:S.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(F.resolved)&&!i.has(F.resolved))n.push({from:m,specifier:S.specifier,reason:"not-emitted"})}}}if(n.length>0){let i=[];i.push(`Found ${n.length} re-export(s) pointing at siblings that won't be in the output:`);for(let c of n){let S=z(t.cwd,c.from);if(c.reason==="missing")i.push(` ${S} \u2192 '${c.specifier}' (path not found on disk)`);else i.push(` ${S} \u2192 '${c.specifier}' (resolved but not in entrypoints; set autoIncludeReExports: true or add to entrypoints)`)}let m=i.join(`
|
|
6
|
+
`);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=Rn(i,S,W,{cwd:t.cwd,keepComments:t.keepComments});for(let R of new Set(F.warnings))e.warn(`[bundle] ${R}`);let U=n?ee(t.cwd,t.outdir,t.bundleOutput):X(i,t);if(t.dryRun)e.info(`[dry-run] Would bundle ${F.files.length} files to: ${z(t.cwd,U)}`);else await v(U,F.content,t.lineEnding),e.debug(`Prepared ${F.files.length} bundled files for: ${z(t.cwd,U)}`);if(n)break}}catch(n){let i=n instanceof Error?n.message:String(n);throw e.error(`Bundle failed: ${i}`),n}if(!t.dryRun)await $e(t,k);if(g&&!t.dryRun)g.save(),e.debug("Saved build cache");if(o.durationMs=Date.now()-a,t.stats)if(t.outputFormat==="json")console.log(JSON.stringify(o,null,2));else{if(e.info(`
|
|
7
7
|
--- Generation Statistics ---`),e.info(`Files processed: ${o.filesProcessed}`),e.info(`Files generated: ${o.filesGenerated}`),C>0)e.info(`Files cached: ${C}`);if(o.filesFailed>0)e.info(`Files failed: ${o.filesFailed}`);if(e.info(`Declarations found: ${o.declarationsFound}`),e.info(`Imports processed: ${o.importsProcessed}`),e.info(`Exports processed: ${o.exportsProcessed}`),o.filesValidated>0){if(e.info(`Files validated: ${o.filesValidated}`),o.validationErrors>0)e.info(`Validation errors: ${o.validationErrors}`)}if(e.info(`Duration: ${o.durationMs}ms`),o.errors.length>0){e.info(`
|
|
8
8
|
Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.location.line}:${n.location.column}`;if(n.code)i+=` [${n.code}]`;if(i+=`: ${n.message}`,e.info(i),n.suggestion)e.info(` Suggestion: ${n.suggestion}`)}}e.info(`-----------------------------
|
|
9
|
-
`)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=Pe(a,t,f,ce.get(t));return Bn(d,(g)=>h(g).emittedSpecifier)}async function po(d,a){Q.delete(a),ce.delete(a);let t=await se(a),f=await Z([d],{includeImports:!0,resolveSpecifier:t}),h=await Re([...f.sources.keys()],t,a.isolatedDeclarations??!1,f.sources);return(await me(d,a,void 0,h.get(ee(d)))).content}async function me(d,a,t,f){let h=await u(d),g=a.typeMappings?ie(a.typeMappings):void 0;return ge(d,h,a,t,g,f)}async function ge(d,a,t,f,h,g){let o=a;if(f)o=await f.runOnBeforeFile(d,a);let C=new Map;if(!t.isolatedDeclarations){let v=await se(t);for(let E of P(o,{includeImports:!0})){let
|
|
9
|
+
`)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=Pe(a,t,f,ce.get(t));return Bn(d,(g)=>h(g).emittedSpecifier)}async function po(d,a){Q.delete(a),ce.delete(a);let t=await se(a),f=await Z([d],{includeImports:!0,resolveSpecifier:t}),h=await Re([...f.sources.keys()],t,a.isolatedDeclarations??!1,f.sources);return(await me(d,a,void 0,h.get(ee(d)))).content}async function me(d,a,t,f){let h=await u(d),g=a.typeMappings?ie(a.typeMappings):void 0;return ge(d,h,a,t,g,f)}async function ge(d,a,t,f,h,g){let o=a;if(f)o=await f.runOnBeforeFile(d,a);let C=new Map;if(!t.isolatedDeclarations){let v=await se(t);for(let E of P(o,{includeImports:!0})){let G=v(E.specifier,d).resolved;if(G&&!G.split(/[/\\]/).includes("node_modules"))C.set(E.specifier,await u(G))}}let T=f?.hasDeclarationHooks()?null:Me(o,d,t,C,g);if(T!==null)return ue(T,d,o,t,f,h,xe(T));let j=C.size?Ln(o,C):void 0,p=r(o,d,t.keepComments,t.isolatedDeclarations??!1,j);if(f)p=await f.runOnDeclarations(d,o,p);let y=0,b=0;for(let v=0;v<p.length;v++){let E=p[v];if(E.kind==="import")y++;if(E.kind==="export"||E.isExported)b++}let k=l(p,{filePath:d,sourceCode:o,declarations:p,augmentationImports:g},t.keepComments,t.importOrder);return ue(k,d,o,t,f,h,{declarationCount:p.length,importCount:y,exportCount:b})}function xe(d){let a=0,t=0,f=0;for(let h of d.split(`
|
|
10
10
|
`)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))f++}return{declarationCount:a,importCount:t,exportCount:f}}function Me(d,a,t,f,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=L(a)?N(d):O(a)?I(d):d;return Ee(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,engine:t.engine,sourceFile:a,inferenceSources:f,augmentationImports:h})}async function ue(d,a,t,f,h,g,o){let C=await ve(d,a,f);if(g)C=Rt(C,g,{filePath:a});if(f.normalizeOutput===!0||f.declarationOrder)C=Xe(C,{lineEnding:"lf",declarationOrder:f.declarationOrder,indent:{style:f.indentStyle??"spaces",size:f.indentSize??2}});if(h)C=await h.runOnAfterFile(a,t,C);return{content:C,...o}}async function mo(d){let a={...D,...d};if(a.logLevel)M(a.logLevel);let t=ee(a.cwd,a.root),f=150,h=5,g=1e4,o={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};e.info(`Watching for changes in ${t}...`),e.info(`Press Ctrl+C to stop
|
|
11
11
|
`);try{await s(a),e.info(`[watch] Initial generation complete
|
|
12
12
|
`)}catch(y){let b=y instanceof Error?y.message:String(y);e.error(`[watch] Initial generation failed: ${b}`),e.info(`[watch] Continuing to watch for changes...
|
|
13
|
-
`)}async function C(){if(o.isProcessing||o.pendingChanges.size===0)return;let y=Date.now();if(o.errorCount>=h){if(y-o.lastErrorTime<g){e.warn(`[watch] Too many errors, pausing for ${Math.ceil((g-(y-o.lastErrorTime))/1000)}s...`);return}o.errorCount=0}o.isProcessing=!0;let b=Array.from(o.pendingChanges);o.pendingChanges.clear();let
|
|
14
|
-
[${
|
|
15
|
-
[${
|
|
13
|
+
`)}async function C(){if(o.isProcessing||o.pendingChanges.size===0)return;let y=Date.now();if(o.errorCount>=h){if(y-o.lastErrorTime<g){e.warn(`[watch] Too many errors, pausing for ${Math.ceil((g-(y-o.lastErrorTime))/1000)}s...`);return}o.errorCount=0}o.isProcessing=!0;let b=Array.from(o.pendingChanges);o.pendingChanges.clear();let W=new Date().toLocaleTimeString();if(b.length===1)e.info(`
|
|
14
|
+
[${W}] File changed: ${b[0]}`);else e.info(`
|
|
15
|
+
[${W}] ${b.length} files changed`);let k=0,v=0;for(let E of b){let G=ee(t,E);try{let J=a.exclude||[];if(oe(G,J,t)){e.debug(` Skipping excluded file: ${E}`);continue}if(!await le(G).exists()){e.debug(` Skipping deleted file: ${E}`);continue}let K=X(G,a),{content:n}=await me(G,a);await ye(pe(K),{recursive:!0}),await Y(K,n,a.lineEnding),e.info(` \u2713 ${z(a.cwd,K)}`),k++}catch(J){v++,o.errorCount++,o.lastErrorTime=Date.now();let _=Qe(J,G);if(e.error(` \u2717 ${E}: ${_.message}`),_.suggestion)e.error(` Suggestion: ${_.suggestion}`)}}if(b.length>1)e.info(` Done: ${k} generated, ${v} failed`);if(v===0)o.errorCount=0;if(o.isProcessing=!1,o.pendingChanges.size>0)o.debounceTimer=setTimeout(C,f)}function T(y){if(o.pendingChanges.add(y),o.debounceTimer)clearTimeout(o.debounceTimer);o.debounceTimer=setTimeout(C,f)}let p=Mt([w?"bun":"node","-e",`
|
|
16
16
|
const fs = require('fs');
|
|
17
17
|
|
|
18
18
|
const rootPath = '${t}';
|
|
@@ -25,7 +25,7 @@ Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.lo
|
|
|
25
25
|
|
|
26
26
|
// Keep process alive
|
|
27
27
|
setInterval(() => {}, 1000);
|
|
28
|
-
`],{stdout:"pipe",stderr:"inherit"});if(w){let y=p.stdout.getReader(),b=new TextDecoder,
|
|
29
|
-
`);
|
|
30
|
-
`);b=
|
|
28
|
+
`],{stdout:"pipe",stderr:"inherit"});if(w){let y=p.stdout.getReader(),b=new TextDecoder,W="";while(!0){let{done:k,value:v}=await y.read();if(k)break;W+=b.decode(v,{stream:!0});let E=W.split(`
|
|
29
|
+
`);W=E.pop()||"";for(let G of E)if(G.startsWith("CHANGED:")){let J=G.slice(8);T(J)}}}else{let y=p.stdout,b="";y.on("data",(W)=>{b+=W.toString();let k=b.split(`
|
|
30
|
+
`);b=k.pop()||"";for(let v of k)if(v.startsWith("CHANGED:")){let E=v.slice(8);T(E)}}),await p.exited}}
|
|
31
31
|
export{s,po,mo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L,N}from"./chunk-qbk49jz5.js";import{O,I}from"./chunk-fpa2ea8k.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-
|
|
2
|
+
import{L,N}from"./chunk-qbk49jz5.js";import{O,I}from"./chunk-fpa2ea8k.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-wq5r1ms9.js";import{Le}from"./chunk-vt5hr8vs.js";import{J,Ee}from"./chunk-dak0dhnx.js";import{l}from"./chunk-81jrzxr6.js";function Ze(t,n,r,s,e,i){if(s.length!==1||s[0]!=="bun")return null;if(J(i)==="typescript")return null;let a=L(n??"")?N(t):O(n??"")?I(t):t;return Ee(a,{keepComments:r,isolatedDeclarations:e,engine:i,sourceFile:n})}var y=100,x=0,c=new Map;function $t(t,n,r=!0,s=["bun"],e=!1,i){let a=p(t),b=JSON.stringify([n,r,e,s,J(i)]),g=c.get(b);if(g&&g.contentHash===a)return g.lastAccess=++x,g.result;let h=Ze(t,n,r,s,e,i)??E(t,n,r,s,e);if(c.set(b,{result:h,contentHash:a,lastAccess:++x}),c.size>y){let S=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[o,f]of c)u.push([o,f.lastAccess]);u.sort((o,f)=>o[1]-f[1]);for(let o=0;o<S&&o<u.length;o++)c.delete(u[o][0])}return h}function ci(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!0)}function li(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!1)}function E(t,n,r,s,e){let i=Le(t,n,r,e);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}function ui(){c.clear()}function Ba(t,n,r=!0,s=["bun"],e=!1,i){return Ze(t,n,r,s,e,i)??kn(t,n,r,s,e)}function kn(t,n,r=!0,s=["bun"],e=!1){if(L(n??""))t=N(t);else if(O(n??""))t=I(t);let i=e?R(t,n,r):F(t,n,r);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}
|
|
3
3
|
export{Ze,$t,ci,li,ui,Ba,kn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
2
|
+
import{r}from"./chunk-0a1xppye.js";import{e}from"./chunk-8vvryt8p.js";import{existsSync as j,mkdirSync as S,readFileSync as E,writeFileSync as f}from"fs";import{basename as h,join as g}from"path";function cn(t){let n={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!t||t.length===0)return n;for(let s of t){let o=s.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
|
|
3
3
|
`).map((p)=>p.replace(/^\s*\*\s?/,"")).join(`
|
|
4
4
|
`).trim(),i=o.search(/@\w+/);if(i===-1){n.description=o;continue}else if(i>0)n.description=o.slice(0,i).trim(),o=o.slice(i);let a=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,c;while((c=a.exec(o))!==null){let[,p,u,d]=c,m=d.trim();switch(p){case"param":{let l=m.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(l)n.params.push({name:l[2],type:u,description:l[3].trim(),optional:!!l[1]});break}case"returns":case"return":n.returns={type:u,description:m};break;case"example":n.examples.push(m);break;case"deprecated":n.deprecated=m||"Deprecated";break;case"since":n.since=m;break;case"see":n.see.push(m);break;case"throws":case"throw":n.throws.push({type:u,description:m});break;case"category":n.category=m;break;default:if(!n.tags[p])n.tags[p]=[];n.tags[p].push(m)}}}return n}function w(t,n){let s=cn(t.leadingComments),o="";switch(t.kind){case"function":o=M(t);break;case"variable":o=C(t);break;case"interface":o=P(t);break;case"type":o=v(t);break;case"class":o=T(t);break;case"enum":o=F(t);break;default:o=t.text||t.name}let i={name:t.name,kind:t.kind,signature:o,jsdoc:s,isExported:t.isExported,isDefault:t.isDefault,sourceFile:n};if(t.members&&t.members.length>0)i.members=t.members.map((a)=>w(a,n));return i}function M(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("function"),n.push(t.name),t.generics)n.push(t.generics);if(t.parameters){let s=t.parameters.map((o)=>{let i="";if(o.rest)i+="...";if(i+=o.name,o.optional)i+="?";if(o.type)i+=`: ${o.type}`;return i}).join(", ");n.push(`(${s})`)}else n.push("()");if(t.returnType)n.push(`: ${t.returnType}`);return n.join(" ").replace(/\s+/g," ")}function C(t){let n=[];if(t.isExported)n.push("export");if(n.push("const"),n.push(t.name),t.typeAnnotation)n.push(`: ${t.typeAnnotation}`);return n.join(" ")}function P(t){let n=[];if(t.isExported)n.push("export");if(n.push("interface"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);return n.join(" ")}function v(t){let n=[];if(t.isExported)n.push("export");if(n.push("type"),n.push(t.name),t.generics)n.push(t.generics);if(n.push("="),t.typeAnnotation)n.push(t.typeAnnotation);return n.join(" ")}function T(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("class"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)n.push(`implements ${t.implements.join(", ")}`);return n.join(" ")}function F(t){let n=[];if(t.isExported)n.push("export");return n.push("enum"),n.push(t.name),n.join(" ")}async function ln(t,n={}){let s=[],o=new Map;for(let i of t){if(!j(i)){e.warn(`File not found: ${i}`);continue}let a=E(i,"utf-8"),c=r(a,i,!0);for(let p of c){if(p.kind==="import")continue;if(!n.includePrivate&&p.name.startsWith("_"))continue;if(!n.includeInternal&&p.leadingComments?.some((d)=>d.includes("@internal")))continue;let u=w(p,i);if(s.push(u),n.groupByCategory&&u.jsdoc.category){let d=u.jsdoc.category;if(!o.has(d))o.set(d,[]);o.get(d).push(u)}}}return{title:n.title||"API Documentation",description:n.description,entries:s,categories:o,generatedAt:new Date}}function Je(t,n={}){let s=[];if(s.push(`# ${t.title}`),s.push(""),t.description)s.push(t.description),s.push("");if(s.push(`> Generated on ${t.generatedAt.toISOString()}`),s.push(""),s.push("## Table of Contents"),s.push(""),n.groupByCategory&&t.categories.size>0)for(let o of t.categories.keys())s.push(`- [${o}](#${D(o)})`);else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0)s.push(`- [${b(i)}](#${D(b(i))})`)}if(s.push(""),n.groupByCategory&&t.categories.size>0)for(let[o,i]of t.categories){s.push(`## ${o}`),s.push("");for(let a of i)s.push(...k(a,n))}else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0){s.push(`## ${b(i)}`),s.push("");for(let c of a)s.push(...k(c,n))}}return s.join(`
|
|
5
5
|
`)}function k(t,n){let s=[];if(s.push(`### ${t.name}`),s.push(""),t.jsdoc.deprecated)s.push(`> **Deprecated:** ${t.jsdoc.deprecated}`),s.push("");if(s.push("```typescript"),s.push(t.signature),s.push("```"),s.push(""),t.jsdoc.description)s.push(t.jsdoc.description),s.push("");if(t.jsdoc.params.length>0){s.push("**Parameters:**"),s.push(""),s.push("| Name | Type | Description |"),s.push("|------|------|-------------|");for(let o of t.jsdoc.params){let i=o.optional?" (optional)":"",a=o.type||"any";s.push(`| \`${o.name}\`${i} | \`${a}\` | ${o.description} |`)}s.push("")}if(t.jsdoc.returns){s.push("**Returns:**"),s.push("");let o=t.jsdoc.returns.type?`\`${t.jsdoc.returns.type}\``:"";s.push(`${o} ${t.jsdoc.returns.description}`),s.push("")}if(t.jsdoc.throws.length>0){s.push("**Throws:**"),s.push("");for(let o of t.jsdoc.throws){let i=o.type?`\`${o.type}\``:"";s.push(`- ${i} ${o.description}`)}s.push("")}if(t.jsdoc.examples.length>0){s.push("**Examples:**"),s.push("");for(let o of t.jsdoc.examples)s.push("```typescript"),s.push(o),s.push("```"),s.push("")}if(t.jsdoc.see.length>0){s.push("**See also:**"),s.push("");for(let o of t.jsdoc.see)s.push(`- ${o}`);s.push("")}if(t.jsdoc.since)s.push(`*Since: ${t.jsdoc.since}*`),s.push("");if(n.includeSourceLinks&&t.sourceFile){let o=t.sourceFile;if(n.sourceBaseUrl)s.push(`[Source](${n.sourceBaseUrl}/${o})`);else s.push(`*Source: ${o}*`);s.push("")}if(t.members&&t.members.length>0){s.push("**Members:**"),s.push("");for(let o of t.members)if(s.push(`#### ${o.name}`),s.push(""),s.push("```typescript"),s.push(o.signature),s.push("```"),s.push(""),o.jsdoc.description)s.push(o.jsdoc.description),s.push("")}return s.push("---"),s.push(""),s}function un(t,n={}){let s=Je(t,n);return`<!DOCTYPE html>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{D}from"./chunk-
|
|
2
|
+
import{D}from"./chunk-2qbj76ap.js";import{re}from"./chunk-20jq5v1p.js";import{ne,$e}from"./chunk-hj7gs32r.js";import{Fn}from"./chunk-djbck65n.js";import{spawn as j}from"child_process";var N=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function x(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=j(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),b=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),E=(t,w)=>{if(v)return;if(v=!0,clearTimeout(b),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>E(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);E(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function zi(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!N.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...D,...f};if(await ne(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await re(n);let u=await Fn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await x(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await $e(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
|
|
3
3
|
export{zi};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h,g}from"./chunk-cgqg1br8.js";import{t}from"./chunk-t5nmnzy6.js";import{Ge}from"./chunk-gwa4hmfa.js";import{or,ar,cr}from"./chunk-hkcqbex1.js";import{y,ee,K}from"./chunk-vk5r6pgx.js";import{
|
|
3
|
-
`)||l.includes("\r"))return"string";return l}if(l.charCodeAt(0)===39||l.charCodeAt(0)===34){let d=Bt(l);if(d!==null){if(d==="string"||!c)return"string";return d}}if(y(l)){if(!c)return"number";return K(l)}if(l==="true"||l==="false"){if(!c)return"boolean";return l}if(l==="null")return"null";if(l==="undefined")return"undefined";if(l.startsWith("[")&&l.endsWith("]"))return Be(l,c,s+1,r);if(l.startsWith("{")&&l.endsWith("}"))return dt(l,c,s+1,r);if(l.startsWith("class ")||l.startsWith("class{"))return oe(l);if(l.startsWith("new "))return Kt(l);if(l.endsWith("as const")){let d=l.slice(0,-8).trim();if(d.startsWith("[")&&d.endsWith("]")){let x=d.slice(1,-1).trim();if(!x)return"readonly []";let T=Q(x),w=[];for(let A=0;A<T.length;A++){let p=T[A].trim();if(p.startsWith("...")){let m=p.slice(3).trim();if(Y(m))w.push(`...typeof ${m}`);else{let C=n(m,!0,!1,s+1,r);w.push(C.startsWith("readonly [")||C.endsWith("[]")?`...${C}`:"...unknown[]")}}else w.push(n(p,!0,!1,s+1,r))}return`readonly [${w.join(", ")}]`}return n(d,!0,i,s+1,r)}if(Z(l)!==-1||l.startsWith("function")||l.startsWith("async"))return pt(l,i,s,c);if(l.startsWith("`")&&l.endsWith("`"))return se(l,c);if(l.startsWith("Promise."))return Nt(l,c,s,r);if(l.startsWith("await "))return"unknown";if(l.startsWith("typeof ")&&nt(l.slice(7)))return"string";if(l.startsWith("void ")&&nt(l.slice(5)))return"undefined";if(l.startsWith("delete ")&&nt(l.slice(7)))return"boolean";if(ee(l)){if(c)return K(l);return"bigint"}if(l.startsWith("Symbol(")||l==="Symbol.for")return"symbol";let a=
|
|
2
|
+
import{h,g}from"./chunk-cgqg1br8.js";import{t}from"./chunk-t5nmnzy6.js";import{Ge}from"./chunk-gwa4hmfa.js";import{or,ar,cr}from"./chunk-hkcqbex1.js";import{y,ee,K}from"./chunk-vk5r6pgx.js";import{_}from"./chunk-daasy0pw.js";import{_e,we,je}from"./chunk-6r01zgys.js";import{be}from"./chunk-587w6ktw.js";var lt=20,ft=!1,D=null;function ht(e){return Ot(e).replace(/\n[ \t]*(?=\n)/g,"")}function Ot(e){if(e.indexOf("/*")===-1)return e.trim();let i=[],s=0,r=0,l=e.length;while(r<l)if(e.charCodeAt(r)===47&&r+1<l&&e.charCodeAt(r+1)===42){if(r>s)i.push(e.substring(s,r));r+=2;while(r<l-1){if(e.charCodeAt(r)===42&&e.charCodeAt(r+1)===47){r+=2;break}r++}s=r}else r++;if(s<l)i.push(e.substring(s));return i.join("").trim()}function zt(){ft=!0,D=null}function Ut(){ft=!1;let e=D;return D=null,e}function ut(e,c){let i=0,s=0;while((s=e.indexOf(c,s))!==-1)i++,s+=c.length;return i}function wt(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===36||e===95||e===46||e===58||e===45}function rt(e){let c=e.trim();if(c.length<3||c.charCodeAt(0)!==60)return!1;if(c.startsWith("<>"))return c.endsWith("</>");let i=c.charCodeAt(1);if(!(i>=65&&i<=90||i>=97&&i<=122||i===36||i===95))return!1;let r=2;while(r<c.length&&wt(c.charCodeAt(r)))r++;let l=c.slice(1,r),f=c.charCodeAt(r);if(f>32&&f!==62&&f!==47)return!1;if(c.endsWith("/>"))return!0;let u=c.lastIndexOf("</");if(u===-1)return!1;let a=u+2;while(a<c.length&&wt(c.charCodeAt(a)))a++;return c.slice(u+2,a)===l&&c.charCodeAt(a)===62&&a===c.length-1}function it(e){let c=e.length,i=!1;for(let f=1;f<c;f++)if(e.charCodeAt(f)<=32&&e.charCodeAt(f-1)<=32){i=!0;break}if(!i)for(let f=0;f<c;f++){let u=e.charCodeAt(f);if(u===10||u===13||u===9){i=!0;break}}if(!i)return e;let s=[],r=-1,l=!1;for(let f=0;f<c;f++)if(e.charCodeAt(f)<=32){if(!l){if(r>=0)s.push(e.substring(r,f));s.push(" "),l=!0,r=-1}}else{if(l||r<0)r=f;l=!1}if(r>=0)s.push(e.substring(r));return s.join("")}function n(e,c=!1,i=!1,s=0,r){if(!e||typeof e!=="string")return"unknown";if(s>=lt)return"unknown";let l=e.trim();if(rt(l))return"JSX.Element";let f=jt(l);if(f)return f;if(l.startsWith("BigInt("))return"bigint";if(l.startsWith("Symbol.for("))return"symbol";if(!(l.startsWith("[")&&l.endsWith("]")||l.startsWith("{")&&l.endsWith("}"))&&(l.includes(".raw`")||l.includes("String.raw`")))return"string";if(l.startsWith("`")&&l.endsWith("`")){if(!c||l.includes("${")||l.includes(`
|
|
3
|
+
`)||l.includes("\r"))return"string";return l}if(l.charCodeAt(0)===39||l.charCodeAt(0)===34){let d=Bt(l);if(d!==null){if(d==="string"||!c)return"string";return d}}if(y(l)){if(!c)return"number";return K(l)}if(l==="true"||l==="false"){if(!c)return"boolean";return l}if(l==="null")return"null";if(l==="undefined")return"undefined";if(l.startsWith("[")&&l.endsWith("]"))return Be(l,c,s+1,r);if(l.startsWith("{")&&l.endsWith("}"))return dt(l,c,s+1,r);if(l.startsWith("class ")||l.startsWith("class{"))return oe(l);if(l.startsWith("new "))return Kt(l);if(l.endsWith("as const")){let d=l.slice(0,-8).trim();if(d.startsWith("[")&&d.endsWith("]")){let x=d.slice(1,-1).trim();if(!x)return"readonly []";let T=Q(x),w=[];for(let A=0;A<T.length;A++){let p=T[A].trim();if(p.startsWith("...")){let m=p.slice(3).trim();if(Y(m))w.push(`...typeof ${m}`);else{let C=n(m,!0,!1,s+1,r);w.push(C.startsWith("readonly [")||C.endsWith("[]")?`...${C}`:"...unknown[]")}}else w.push(n(p,!0,!1,s+1,r))}return`readonly [${w.join(", ")}]`}return n(d,!0,i,s+1,r)}if(Z(l)!==-1||l.startsWith("function")||l.startsWith("async"))return pt(l,i,s,c);if(l.startsWith("`")&&l.endsWith("`"))return se(l,c);if(l.startsWith("Promise."))return Nt(l,c,s,r);if(l.startsWith("await "))return"unknown";if(l.startsWith("typeof ")&&nt(l.slice(7)))return"string";if(l.startsWith("void ")&&nt(l.slice(5)))return"undefined";if(l.startsWith("delete ")&&nt(l.slice(7)))return"boolean";if(ee(l)){if(c)return K(l);return"bigint"}if(l.startsWith("Symbol(")||l==="Symbol.for")return"symbol";let a=U(l);if(a!==null)return a;if(Pt(l))return"boolean";if(Gt(l))return"number";return"unknown"}function $t(e){let c=e.charCodeAt(0);if(c!==39&&c!==34)return!1;return J(e,0,c)===e.length}function Bt(e){if($t(e))return e;let c=Dt(e);if(c.length<2)return null;let i=!1,s=!0,r="";for(let l of c){let f=l.trim();if($t(f))i=!0,r+=Ft(f);else s=!1}if(s)return Vt(r);if(i)return"string";return null}function Dt(e){let c=[],i=0,s=0,r=0;while(r<e.length){let l=e.charCodeAt(r);if(l===39||l===34||l===96){r=J(e,r,l);continue}if(l===40||l===91||l===123)i++;else if(l===41||l===93||l===125)i--;else if(l===43&&i===0)c.push(e.slice(s,r)),s=r+1;r++}return c.push(e.slice(s)),c}function Ft(e){return e.slice(1,-1).replace(/\\(.)/g,(i,s)=>{if(s==="n")return`
|
|
4
4
|
`;if(s==="t")return"\t";if(s==="r")return"\r";if(s==="0")return"\x00";return s})}function Vt(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function Gt(e){if(e==="")return!1;let c=!1,i=!1;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);if(r>=48&&r<=57){c=!0;continue}if(r===43||r===45||r===42||r===47||r===37){i=!0;continue}if(r===60||r===62){let l=s+1;while(l<e.length&&e.charCodeAt(l)===r)l++;let f=l-s;if(f!==2&&!(r===62&&f===3))return!1;i=!0,s=l-1;continue}if(r===46||r===40||r===41||r<=32)continue;return!1}return c&&i}function Pt(e){let c=0,i;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);if(r===34||r===39||r===96){s=J(e,s,r)-1;continue}if(r===47){if(e[s+1]==="/"){let l=e.indexOf(`
|
|
5
|
-
`,s+2);s=l===-1?e.length:l;continue}if(e[s+1]==="*"){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1;continue}if(h(e,s)){s=g(e,s)-1;continue}}if(r===40||r===91||r===123){c++;continue}if(r===41||r===93||r===125){c--;continue}if(c!==0)continue;if(r===60){i??=
|
|
5
|
+
`,s+2);s=l===-1?e.length:l;continue}if(e[s+1]==="*"){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1;continue}if(h(e,s)){s=g(e,s)-1;continue}}if(r===40||r===91||r===123){c++;continue}if(r===41||r===93||r===125){c--;continue}if(c!==0)continue;if(r===60){i??=_(e);let l=i(s,0);if(l){s=l.end-1;continue}}if(e.startsWith("===",s)||e.startsWith("!==",s)||e.startsWith("==",s)||e.startsWith("!=",s)||e.startsWith(">=",s)||e.startsWith("<=",s))return!0;if((r===62||r===60)&&e.charCodeAt(s+1)===r){while(e.charCodeAt(s+1)===r)s++;continue}if((r===62||r===60)&&e.charCodeAt(s-1)!==61&&e.charCodeAt(s+1)!==61)return!0}return!1}function Ht(e,c=!1,i=0,s){return n(e,c,!0,i,s)}function B(e,c=!1,i="",s,r){let l=gt(i,s),f=[],u=!1,a=0;while(a<e.length){let x=e.charCodeAt(a);if(x===34||x===39||x===96){a=J(e,a,x);continue}if(x===47&&e.charCodeAt(a+1)===47){a+=2;while(a<e.length&&e.charCodeAt(a)!==10&&e.charCodeAt(a)!==13)a++;continue}if(x===47&&e.charCodeAt(a+1)===42){let w=e.indexOf("*/",a+2);a=w===-1?e.length:w+2;continue}if(e.startsWith("function",a)&&tt(e,a,8)||e.startsWith("class",a)&&tt(e,a,5)){let w=ie(e,a);if(w!==-1){a=ot(e,w);continue}}if(x===61&&e.charCodeAt(a+1)===62){let w=Mt(e,a+2);if(e.charCodeAt(w)===123){a=ot(e,w);continue}}if(e.startsWith("return",a)&&(a===0||!q(e.charCodeAt(a-1)))&&!q(e.charCodeAt(a+6))){a+=6;let w=!1;while(a<e.length&&e.charCodeAt(a)<=32){let k=e.charCodeAt(a);if(k===10||k===13)w=!0;a++}if(w||a>=e.length||e.charCodeAt(a)===59||e.charCodeAt(a)===125){u=!0;continue}let A=a,p=0,m=0,C=0;while(a<e.length){let k=e.charCodeAt(a);if(k===34||k===39||k===96){a=J(e,a,k);continue}if(k===47&&e.charCodeAt(a+1)===47){if(p===0&&m===0&&C===0)break;while(a<e.length&&e.charCodeAt(a)!==10&&e.charCodeAt(a)!==13)a++;continue}if(k===47&&e.charCodeAt(a+1)===42){let O=e.indexOf("*/",a+2);a=O===-1?e.length:O+2;continue}if(k===40)p++;else if(k===41)p--;else if(k===91)m++;else if(k===93)m--;else if(k===123)C++;else if(k===125){if(C===0&&p===0&&m===0)break;C--}else if(k===59&&p===0&&m===0&&C===0)break;else if((k===10||k===13)&&p===0&&m===0&&C===0){let O=a+1;while(O<e.length&&e.charCodeAt(O)<=32)O++;if(e.startsWith("return",O)&&!q(e.charCodeAt(O+6)))break}a++}let S=e.slice(A,a).trim(),b=ht(V(S,l,s,r,A));if(!f.includes(b))f.push(b);continue}a++}if(u&&!f.includes("undefined"))f.push("undefined");let d=f.includes("unknown")?"unknown":f.length===0?"void":Et(f);return c&&!d.startsWith("Promise<")?`Promise<${d}>`:d}function gt(e,c){let i=new Map,s=e.startsWith("(")&&e.endsWith(")")?e.slice(1,-1):e,r=t(s),l=0,f=0,u=[];for(let a of r){let d=s.slice(a.start,a.end);if(d===","&&f===0)u.push(s.slice(l,a.start)),l=a.end;if(["(","[","{","<"].includes(d))f++;else if([")","]","}"].includes(d)||d===">"&&s[a.start-1]!=="=")f--}u.push(s.slice(l));for(let a of u){let d=t(a),x=-1,T=-1,w=0;for(let C of d){let S=a.slice(C.start,C.end);if(w===0&&S===":"&&x===-1)x=C.start;if(w===0&&S==="="&&a[C.end]!==">"){T=C.start;break}if(["(","[","{","<"].includes(S))w++;else if([")","]","}"].includes(S)||S===">"&&a[C.start-1]!=="=")w--}let A=a.slice(0,x!==-1?x:T!==-1?T:void 0).trim().replace(/^\.\.\./,"").replace(/\?$/,""),p=x===-1&&T!==-1&&!a.trim().startsWith("...")?we(A,a.slice(T+1)):null;if(p){for(let C of p)i.set(C.alias,c?.(C.value)??n(C.value,!1));continue}if(!v(A)){if(A.startsWith("{")||A.startsWith("["))for(let C of Ge(A))i.set(C,"unknown");continue}let m=x!==-1?a.slice(x+1,T!==-1?T:void 0).trim():"";if(!m&&T!==-1){let C=a.slice(T+1).trim();m=c?.(C)??n(C,!1)}if(m){if(T===-1&&a.slice(0,x).trim().endsWith("?"))m=`(${m}) | undefined`;i.set(A,m)}else i.set(A,"unknown")}return i}var Wt={string:{at:"string | undefined",charAt:"string",charCodeAt:"number",codePointAt:"number | undefined",concat:"string",endsWith:"boolean",includes:"boolean",indexOf:"number",lastIndexOf:"number",localeCompare:"number",normalize:"string",padEnd:"string",padStart:"string",repeat:"string",replace:"string",replaceAll:"string",search:"number",slice:"string",split:"string[]",startsWith:"boolean",substring:"string",toLocaleLowerCase:"string",toLocaleUpperCase:"string",toLowerCase:"string",toString:"string",toUpperCase:"string",trim:"string",trimEnd:"string",trimStart:"string",valueOf:"string"},number:{toExponential:"string",toFixed:"string",toLocaleString:"string",toPrecision:"string",toString:"string",valueOf:"number"},bigint:{toLocaleString:"string",toString:"string",valueOf:"bigint"},boolean:{toString:"string",valueOf:"boolean"}};function $a(e,c){let i=Object.hasOwn(Wt,e)?Wt[e]:void 0;return i&&Object.hasOwn(i,c)?i[c]:void 0}function W(e){return e.includes(`
|
|
6
6
|
`)?e.replaceAll(`
|
|
7
7
|
`,`
|
|
8
|
-
`):e}function Jt(e,c){if(e=e.trim(),!e.startsWith("{")||!e.endsWith("}"))return;let i=e.slice(1,-1),s=t(i),r=0,l=0;for(let f=0;f<=s.length;f++){let u=s[f],a=u?i.slice(u.start,u.end):";";if(l===0&&(a===";"||a===",")){let d=i.slice(r,u?.start).trim(),x=d.indexOf(":");if(x!==-1&&d.slice(0,x).trim()===c)return d.slice(x+1).trim();r=u?.end??i.length}if(["(","[","{","<"].includes(a))l++;else if([")","]","}"].includes(a)||a===">"&&u&&i[u.start-1]!=="=")l--}return}function
|
|
9
|
-
`,s+2);s=l===-1?e.length:l;continue}if(e[s+1]==="*"){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1;continue}if(h(e,s)){s=g(e,s)-1;continue}}if(r==="<"&&c===0){i??=
|
|
10
|
-
`||r==="\r"){let l=e.slice(s).trimStart(),f=/[A-Za-z]+$/.exec(st(e.slice(0,s)))?.[0];if(s=e.length-l.length-1,f&&["new","void","typeof","delete","await","yield"].includes(f))continue;if(l&&l[0]!=="."&&l[0]!=="?"&&l[0]!=="("&&l[0]!=="[")return!1}}return!0}function re(e){if(e.startsWith("function")&&tt(e,0,8))return!0;let c=Z(e);if(c===-1)return!1;let i=e.slice(0,c).trim();if(i.startsWith("async")&&tt(i,0,5))i=i.slice(5).trim();if(i.startsWith("<")){let r=o(i,0,"<",">");if(r===-1)return!1;i=i.slice(r+1).trim()}if(i.startsWith("(")){let r=o(i,0,"(",")");if(r===-1)return!1;let l=i.slice(r+1).trim();if(l&&!l.startsWith(":"))return!1}let s=Ct(i);return at(s.params)||v(s.params)}function at(e){if(!e.startsWith("(")||!e.endsWith(")"))return!1;let c=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s===40)c++;else if(s===41&&--c===0)return i===e.length-1}return!1}function Rt(e){let c=0,i=-1;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);if(r===34||r===39||r===96){s=J(e,s,r)-1;continue}if(r===47&&(e.charCodeAt(s+1)===47||e.charCodeAt(s+1)===42)){if(e.charCodeAt(s+1)===47)while(s+1<e.length&&e.charCodeAt(s+1)!==10&&e.charCodeAt(s+1)!==13)s++;else{let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1}continue}if(r===40||r===91||r===123)c++;else if(r===41||r===93||r===125)c--;else if(r===63&&c===0&&e.charCodeAt(s+1)!==63)i=s;else if(r===58&&c===0&&i!==-1)return{whenTrue:st(e.slice(i+1,s)),whenFalse:st(e.slice(s+1))}}return null}function tt(e,c,i){return(c===0||!
|
|
11
|
-
`)||e.includes("\r"))return"string";return e}function Kt(e,c){let i=t(e),s=(a)=>i[a]?e.slice(i[a].start,i[a].end):"";if(s(0)!=="new"||i[1]?.kind!=="word"||["class","function","new","super"].includes(s(1)))return"unknown";let r=2,l=[s(1)];while(s(r)==="."&&i[r+1]?.kind==="word")l.push(s(r+1)),r+=2;let f=l.join(".");if(!c&&(f.charCodeAt(0)<65||f.charCodeAt(0)>90))return"unknown";let u="";if(s(r)==="<"){let a=i[r].start,d=
|
|
8
|
+
`):e}function Jt(e,c){if(e=e.trim(),!e.startsWith("{")||!e.endsWith("}"))return;let i=e.slice(1,-1),s=t(i),r=0,l=0;for(let f=0;f<=s.length;f++){let u=s[f],a=u?i.slice(u.start,u.end):";";if(l===0&&(a===";"||a===",")){let d=i.slice(r,u?.start).trim(),x=d.indexOf(":");if(x!==-1&&d.slice(0,x).trim()===c)return d.slice(x+1).trim();r=u?.end??i.length}if(["(","[","{","<"].includes(a))l++;else if([")","]","}"].includes(a)||a===">"&&u&&i[u.start-1]!=="=")l--}return}function V(e,c,i,s,r=0,l=0){if(l>=lt)return"unknown";let f=e.trim();while(at(f))f=f.slice(1,-1).trim();let u=i?.(f);if(u)return u;if(rt(f))return"JSX.Element";if(f.startsWith("await ")){let b=V(f.slice(6),c,i,s,r,l+1);return b.startsWith("Promise<")&&b.endsWith(">")?b.slice(8,-1):b}if(c.has(f))return c.get(f);let a=/^([\w$]+)\.([\w$]+(?:\.[\w$]+)*)$/.exec(f),d;if(a){let b=c.get(a[1]),k=b&&Jt(b,a[2]);if(k)return k;if(b)d=`typeof ${f}`}if(f.startsWith("!"))return"boolean";if(f.startsWith("fetch("))return"Promise<Response>";if(re(f))return n(f,!1);let x=Rt(f);if(x){let b=V(x.whenTrue,c,i,s,r,l+1),k=V(x.whenFalse,c,i,s,r,l+1);return b===k?b:Et([b,k])}for(let b of["??","||","&&"]){let k=It(f,b);if(k!==-1){let O=V(f.slice(0,k),c,i,s,r,l+1),P=V(f.slice(k+b.length),c,i,s,r,l+1);return vt(O,P,b)}}let T=Qt(f);if(T&&s)return s(T,r);let w=jt(f);if(w)return s?s(w,r):w;if(Pt(f))return"boolean";let A=0;for(let b=f.length-1;b>=0;b--){let k=f.charCodeAt(b);if(k===41||k===93||k===125)A++;else if(k===40||k===91||k===123)A--;else if(A===0&&(k===43||k===45||k===42||k===47||k===37)){let O=V(f.slice(0,b),c,i,s,r,l+1),P=V(f.slice(b+1),c,i,s,r,l+1);if(k===43&&(O==="string"||P==="string"))return"string";if(O==="number"&&P==="number")return"number";break}}if(f.startsWith("[")&&f.endsWith("]")){let b=Q(f.slice(1,-1));if(b.some((k)=>k.trim().startsWith("..."))){let k=b.map((O)=>{let P=O.trim();if(!P)return"undefined";let I=P.startsWith("..."),j=V(I?P.slice(3):P,c,i,s,r,l+1);return I?`(NonNullable<${j}> extends Iterable<infer Element> ? Element : never)`:j});return`(${[...new Set(k)].join(" | ")||"never"})[]`}}let p=d??(f.startsWith("{")&&f.endsWith("}")?dt(f,!1,l+1,void 0,(b)=>V(b,c,i,s,r,l+1)):n(f,!1));if(p==="unknown"&&v(f)&&s)return s(`typeof ${f}`,r);let m=t(p),C="",S=0;for(let b=0;b<m.length;b++){let k=m[b];if(k.kind!=="word"||p.slice(k.start,k.end)!=="typeof")continue;let O=m[b+1];if(!O||O.kind!=="word")continue;let P=c.get(p.slice(O.start,O.end)),I=P,j=!P,z=k.start,F=O.end,E=b,L=[];b++;while(m[b+1]&&p.slice(m[b+1].start,m[b+1].end)==="."&&m[b+2]?.kind==="word"){let N=m[b+2];if(L.push(p.slice(N.start,N.end)),!j)P=`(${P})["${p.slice(N.start,N.end)}"]`;F=N.end,b+=2}let X=m[b+1];if(X&&p.slice(X.start,X.end)==="<"){let N=o(p,X.start,"<",">");if(N!==-1){F=N+1;while(m[b+1]&&m[b+1].start<=N)b++;P=void 0,I=void 0,j=!0}}let et=E>=2&&p.slice(m[E-2].start,m[E-2].end)==="ReturnType"&&p.slice(m[E-1].start,m[E-1].end)==="<"&&m[b+1]&&p.slice(m[b+1].start,m[b+1].end)===">",M=I&&et&&L.length===1?$a(I.trim(),L[0]):void 0;if(M){z=m[E-2].start,F=m[++b].end;let N=z===0&&F===p.length;C+=p.slice(S,z)+(N||!M.includes("|")?M:`(${M})`),S=F;continue}if(j&&et)z=m[E-2].start,F=m[++b].end;C+=p.slice(S,z)+(P??"unknown"),S=F}return C+p.slice(S)}function Qt(e){let c=t(e),i=0,s=-1;for(let l=0;l<c.length;l++){let f=c[l],u=e.slice(f.start,f.end);if(f.kind!=="punctuation"&&f.kind!=="word")continue;if(["(","[","{"].includes(u))i++;else if([")","]","}"].includes(u))i--;else if(!i&&u==="as"&&l>0&&e.slice(c[l-1].start,c[l-1].end)!==".")s=l}if(s===-1||s+1===c.length)return;let r=e.slice(c[s].end).trim();if(r==="const")return;i=0;for(let l of c.slice(s+1)){if(l.kind!=="punctuation")continue;let f=e.slice(l.start,l.end);if(!i&&["??","||","&&"].some((u)=>e.startsWith(u,l.start)))return;if(["(","[","{","<"].includes(f))i++;else if([")","]","}",">"].includes(f))i--;else if(!i&&["+","-","*","/","%","=","!",";"].includes(f))return}return r}function It(e,c){let i=0;for(let s of t(e)){if(s.kind!=="punctuation")continue;let r=e.slice(s.start,s.end);if(["(","[","{"].includes(r))i++;else if([")","]","}"].includes(r))i--;if(!i&&e.startsWith(c,s.start))return s.start}return-1}function Xt(e){if(e.includes("=>"))return null;let c=[],i=0,s=0;for(let r=0;r<=e.length;r++){let l=r===e.length?"|":e[r];if(l==="'"||l==='"'||l==="`"){r++;while(r<e.length&&e[r]!==l)r+=e[r]==="\\"?2:1;if(r>=e.length)return null}else if(l==="("||l==="["||l==="{"||l==="<")i++;else if(l===")"||l==="]"||l==="}"||l===">")i--;else if(l==="|"&&i===0){let f=e.slice(s,r).trim();if(f)c.push(f);s=r+1}if(i<0)return null}return i===0?c:null}function Yt(e,c){let i=Xt(c);if(!i)return`${e} | ${c}`;let s=[];for(let d of[e,...i]){if(d==="unknown")return"unknown";if(!s.includes(d))s.push(d)}let r=s.includes("boolean")||s.includes("true")&&s.includes("false"),l=s.includes("string"),f=s.includes("number"),u=[],a=!1;for(let d of s)if(r&&(d==="true"||d==="false"||d==="boolean")){if(!a)u.push("boolean");a=!0}else if(l&&Zt(d))continue;else if(f&&/^-?\d+(?:\.\d+)?$/.test(d))continue;else u.push(d);return u.join(" | ")}function Zt(e){let c=e[0];return e.length>=2&&(c==="'"||c==='"')&&e.endsWith(c)&&!e.slice(1,-1).includes(c)}function vt(e,c,i){let s=Z(c)!==-1?`(${c.trim()})`:c;if(e.trim()==="unknown")return i==="&&"||s.trim()==="unknown"?"unknown":`{} | ${s}`;let r=e.trim();if(r==="boolean"||r==="string"||r==="number"){if(i==="??")return r;return Yt(i==="||"?r==="boolean"?"true":r:r==="boolean"?"false":r==="string"?"''":"0",s)}let l="false | 0 | 0n | '' | null | undefined";if(i==="??")return`([${e}] extends [NonNullable<${e}>] ? ${e} : NonNullable<${e}> | ${s})`;if(i==="||")return`([${e}] extends [object] ? ${e} : [Exclude<${e}, object> & (${l})] extends [never] ? ${e} : Exclude<NonNullable<${e}>, ${l}> | ${s})`;return`([${e}] extends [object] ? ${s} : [${e}] extends [${l}] ? ${e} : unknown extends (${e}) ? ${e} : (Exclude<${e}, object> & (${l})) | ${s})`}function te(e){let c=`(NonNullable<${e}> extends infer __dtsx_spread_value ? { -readonly [__dtsx_spread_key in keyof __dtsx_spread_value]: __dtsx_spread_value[__dtsx_spread_key] } : never)`,i=`(NonNullable<${e}> extends infer __dtsx_spread_value ? { -readonly [__dtsx_spread_key in keyof __dtsx_spread_value]?: __dtsx_spread_value[__dtsx_spread_key] } : never)`;return`([${e}] extends [null | undefined] ? {} : [${e}] extends [NonNullable<${e}>] ? ${c} : ${i})`}function ne(e,c){let i=e.trim();while(at(i))i=i.slice(1,-1).trim();let s=It(i,"??");if(s!==-1&&i.slice(s+2).trim()==="{}")return te(c(i.slice(0,s)));let r=Rt(i);if(r){if(r.whenFalse.trim()==="{}")return`Partial<${c(r.whenTrue)}>`;if(r.whenTrue.trim()==="{}")return`Partial<${c(r.whenFalse)}>`}return c(i)}function Et(e){return e.map((c)=>e.length>1&&Z(c)!==-1?`(${c})`:c).join(" | ")}function st(e){let c=0;while(c<e.length){let r=e.charCodeAt(c);if(r<=32)c++;else if(r===47&&e.charCodeAt(c+1)===47){c+=2;while(c<e.length&&e.charCodeAt(c)!==10&&e.charCodeAt(c)!==13)c++}else if(r===47&&e.charCodeAt(c+1)===42){let l=e.indexOf("*/",c+2);c=l===-1?e.length:l+2}else break}let i=c,s=c;while(s<e.length){let r=e.charCodeAt(s);if(r===34||r===39||r===96){s=J(e,s,r),i=s;continue}if(r===92){s=Math.min(s+2,e.length),i=s;continue}if(r===47&&e.charCodeAt(s+1)===47){while(s<e.length&&e.charCodeAt(s)!==10&&e.charCodeAt(s)!==13)s++;continue}if(r===47&&e.charCodeAt(s+1)===42){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+2;continue}if(s++,r>32)i=s}return e.slice(c,i)}function jt(e){if(!e.startsWith("<"))return;let c=_(e)(0,0);if(!c||c.parameters||c.completeOperand||!e.slice(c.end).trim()||!nt(e.slice(c.end).trim()))return;return e.slice(1,c.end-1).trim()}function nt(e){e=st(e);let c=0,i;for(let s=0;s<e.length;s++){let r=e[s];if(r==="'"||r==='"'||r==="`"){let l=s+1;while(l<e.length&&e[l]!==r){if(e[l]==="\\")l++;l++}s=l;continue}if(r==="/"){if(e[s+1]==="/"){let l=e.indexOf(`
|
|
9
|
+
`,s+2);s=l===-1?e.length:l;continue}if(e[s+1]==="*"){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1;continue}if(h(e,s)){s=g(e,s)-1;continue}}if(r==="<"&&c===0){i??=_(e);let l=i(s,0);if(l){s=l.end-1;continue}}if(r==="("||r==="["||r==="{")c++;else if(r===")"||r==="]"||r==="}")c--;else if(c!==0)continue;else if(r==="?"){if(e[s+1]!==".")return!1}else if("=!<>&|+-*/%,:".includes(r))return!1;else if(r===" "||r==="\t"||r===`
|
|
10
|
+
`||r==="\r"){let l=e.slice(s).trimStart(),f=/[A-Za-z]+$/.exec(st(e.slice(0,s)))?.[0];if(s=e.length-l.length-1,f&&["new","void","typeof","delete","await","yield"].includes(f))continue;if(l&&l[0]!=="."&&l[0]!=="?"&&l[0]!=="("&&l[0]!=="[")return!1}}return!0}function re(e){if(e.startsWith("function")&&tt(e,0,8))return!0;let c=Z(e);if(c===-1)return!1;let i=e.slice(0,c).trim();if(i.startsWith("async")&&tt(i,0,5))i=i.slice(5).trim();if(i.startsWith("<")){let r=o(i,0,"<",">");if(r===-1)return!1;i=i.slice(r+1).trim()}if(i.startsWith("(")){let r=o(i,0,"(",")");if(r===-1)return!1;let l=i.slice(r+1).trim();if(l&&!l.startsWith(":"))return!1}let s=Ct(i);return at(s.params)||v(s.params)}function at(e){if(!e.startsWith("(")||!e.endsWith(")"))return!1;let c=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s===40)c++;else if(s===41&&--c===0)return i===e.length-1}return!1}function Rt(e){let c=0,i=-1;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);if(r===34||r===39||r===96){s=J(e,s,r)-1;continue}if(r===47&&(e.charCodeAt(s+1)===47||e.charCodeAt(s+1)===42)){if(e.charCodeAt(s+1)===47)while(s+1<e.length&&e.charCodeAt(s+1)!==10&&e.charCodeAt(s+1)!==13)s++;else{let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+1}continue}if(r===40||r===91||r===123)c++;else if(r===41||r===93||r===125)c--;else if(r===63&&c===0&&e.charCodeAt(s+1)!==63)i=s;else if(r===58&&c===0&&i!==-1)return{whenTrue:st(e.slice(i+1,s)),whenFalse:st(e.slice(s+1))}}return null}function tt(e,c,i){return(c===0||!q(e.charCodeAt(c-1)))&&!q(e.charCodeAt(c+i))}function Mt(e,c){let i=c;while(i<e.length){if(e.charCodeAt(i)<=32){i++;continue}if(e.startsWith("//",i)){while(i<e.length&&e.charCodeAt(i)!==10&&e.charCodeAt(i)!==13)i++;continue}if(e.startsWith("/*",i)){let s=e.indexOf("*/",i+2);i=s<0?e.length:s+2;continue}break}return i}function ie(e,c){let i=0,s=0,r=0,l=!1,f=!1;for(let u=c;u<e.length;u++){if(u=Mt(e,u),u>=e.length)break;let a=e.charCodeAt(u);if(a===34||a===39||a===96){u=J(e,u,a)-1,f=!1;continue}if(q(a)||a>=128){let d=u;while(u+1<e.length&&(q(e.charCodeAt(u+1))||e.charCodeAt(u+1)>=128))u++;f=l&&["keyof","typeof","readonly","unique","new","abstract","infer","extends"].includes(e.slice(d,u+1));continue}if(a===61&&e.charCodeAt(u+1)===62){u++,f=l;continue}if(a===40)i++;else if(a===41)i--,f=!1;else if(a===91)s++;else if(a===93)s--,f=!1;else if(a===60&&i===0&&s===0)r++;else if(a===62&&r>0&&i===0&&s===0)r--,f=!1;else if(a===123)if(i||s||r||l&&f)u=ot(e,u)-1,f=!1;else return u;else if(i===0&&s===0&&r===0){if(a===58)l=!0,f=!0;else if(l&&[124,38,63].includes(a))f=!0;else if(a===59)return-1}}return-1}function ot(e,c){let i=1,s=c+1;while(s<e.length&&i>0){let r=e.charCodeAt(s);if(r===34||r===39||r===96){s=J(e,s,r);continue}if(r===47&&e.charCodeAt(s+1)===47){s+=2;while(s<e.length&&e.charCodeAt(s)!==10&&e.charCodeAt(s)!==13)s++;continue}if(r===47&&e.charCodeAt(s+1)===42){let l=e.indexOf("*/",s+2);s=l===-1?e.length:l+2;continue}if(r===123)i++;else if(r===125)i--;s++}return s}function J(e,c,i){let s=c+1;while(s<e.length){let r=e.charCodeAt(s);if(r===92){s+=2;continue}if(i===96&&r===36&&e.charCodeAt(s+1)===123){s=ot(e,s+1);continue}if(s++,r===i)break}return s}function se(e,c){if(e.includes(".raw`")||e.includes("String.raw`"))return"string";if(!c||e.includes("${")||e.includes(`
|
|
11
|
+
`)||e.includes("\r"))return"string";return e}function Kt(e,c){let i=t(e),s=(a)=>i[a]?e.slice(i[a].start,i[a].end):"";if(s(0)!=="new"||i[1]?.kind!=="word"||["class","function","new","super"].includes(s(1)))return"unknown";let r=2,l=[s(1)];while(s(r)==="."&&i[r+1]?.kind==="word")l.push(s(r+1)),r+=2;let f=l.join(".");if(!c&&(f.charCodeAt(0)<65||f.charCodeAt(0)>90))return"unknown";let u="";if(s(r)==="<"){let a=i[r].start,d=_(e)(a,0);if(!d||!d.completeOperand||d.parameters)return"unknown";u=e.slice(a,d.end);while(r<i.length&&i[r].start<d.end)r++}if(r<i.length){if(s(r)!=="(")return"unknown";let a=0,d=!1;for(;r<i.length;r++)if(s(r)==="(")a++;else if(s(r)===")"&&--a===0){d=r===i.length-1;break}if(!d)return"unknown"}if(c)return c(f)?f+u:`InstanceType<typeof ${f}${u}>`;if(u)return f+u;switch(f){case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"Array":return"any[]";case"Object":return"object";case"Promise":return"Promise<any>";default:return f}}function oe(e){return"{ new (...args: any[]): any }"}function Nt(e,c,i=0,s){if(e.startsWith("Promise.resolve(")){let l=e.indexOf(")",16);if(l!==-1){let f=e.slice(16,l).trim();if(f)return`Promise<${n(f,c,!1,i+1,s)}>`}return"Promise<unknown>"}if(e.startsWith("Promise.reject("))return"Promise<never>";if(e.startsWith("Promise.all(")){let r=e.indexOf("[",12),l=e.lastIndexOf("]");if(r!==-1&&l>r){let f=e.slice(r+1,l).trim(),u=Q(f),a=[];for(let d=0;d<u.length;d++){let x=u[d].trim();if(x.startsWith("Promise.resolve(")){let T=Nt(x,c,i+1,s),w=T.indexOf("<"),A=T.lastIndexOf(">");a.push(w!==-1&&A>w?T.slice(w+1,A):"unknown")}else a.push(n(x,c,!1,i+1,s))}return`Promise<[${a.join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function Be(e,c,i=0,s){let r=e.slice(1,-1).trim();if(!r)return"never[]";if(i>=lt)return"unknown[]";let l=Q(r),f=!1;for(let A=0;A<l.length;A++){let p=l[A],m=p.length;while(m>0&&p.charCodeAt(m-1)<=32)m--;if(m>=8&&p.slice(m-8,m)==="as const"){f=!0;break}}if(f){let A=[];for(let p=0;p<l.length;p++){let m=l[p].trim();if(m.endsWith("as const")){let C=m.slice(0,-8).trim();if(C.startsWith("[")&&C.endsWith("]")){let S=C.slice(1,-1).trim(),b=Q(S),k=[];for(let O=0;O<b.length;O++)k.push(n(b[O].trim(),!0,!1,i+1,s));A.push(`readonly [${k.join(", ")}]`)}else A.push(n(C,!0,!1,i+1,s))}else if(m.startsWith("[")&&m.endsWith("]"))A.push(Be(m,!0,i+1,s));else A.push(n(m,!0,!1,i+1,s))}return`readonly [
|
|
12
12
|
${A.join(` |
|
|
13
13
|
`)}
|
|
14
|
-
]`}let u=ft&&!c,a=[],d=[];for(let A of l){let p=A.trim(),m=
|
|
14
|
+
]`}let u=ft&&!c,a=[],d=[];for(let A of l){let p=A.trim(),m=D;if(D=null,p.startsWith("...")){let C=p.slice(3).trim(),S=n(C,!1,!1,i+1,s);if(S.endsWith("[]"))a.push(S.slice(0,-2));else if(S.startsWith("readonly [")&&S.endsWith("]"))a.push(S.slice(10,-1));else if(Y(C))a.push(`(typeof ${C})[number]`);else a.push("unknown")}else if(p.startsWith("[")&&p.endsWith("]"))a.push(Be(p,c,i+1,s));else a.push(Ht(p,c,i+1,s));if(u)d.push(D);D=m}if(u)if(mt(e))D=it(e);else{let A=[];for(let p=0;p<l.length;p++){let m=l[p].trim();if(m.endsWith("as const"))continue;if(ct(m)||m==="null"||m==="undefined")A.push(m);else if(m.startsWith("[")&&mt(m))A.push(it(m));else if(m.startsWith("{")){if(d[p])A.push(d[p])}else{let C=n(m,!1,!1,0,s);if(C!=="unknown")A.push(C)}}if(A.length>0)D=`[${A.join(", ")}]`}if(c)return`readonly [${a.join(", ")}]`;let x=new Set,T=[],w=!0;for(let A of a){if(!x.has(A))x.add(A),T.push(A);if(w){if(!(y(A)||A==="true"||A==="false"||A.charCodeAt(0)===34&&A.charCodeAt(A.length-1)===34||A.charCodeAt(0)===39&&A.charCodeAt(A.length-1)===39))w=!1}}if(w&&a.length<=10)return`readonly [${a.join(", ")}]`;if(T.length===1)return`${T[0]}[]`;return`(${T.join(" | ")})[]`}function Q(e){let c=[],i=0,s=!1,r=0,l=-1,f=0;for(let u=0;u<e.length;u++){let a=e.charCodeAt(u);if(s){if(a===92)u++;else if(a===r)s=!1;f=u+1;continue}if(a===47&&e.charCodeAt(u+1)===47){let d=e.indexOf(`
|
|
15
15
|
`,u+2);u=(d===-1?e.length:d)-1;continue}if(a===47&&e.charCodeAt(u+1)===42){let d=e.indexOf("*/",u+2);u=(d===-1?e.length:d+2)-1;continue}if(a===32||a===9||a===10||a===13)continue;if(a===44&&i===0){if(l!==-1)c.push(e.slice(l,f));l=-1;continue}if(a===34||a===39||a===96)s=!0,r=a;else if(a===91||a===123||a===40)i++;else if(a===93||a===125||a===41)i--;if(l===-1)l=u;f=u+1}if(l!==-1)c.push(e.slice(l,f));return c}function ct(e){if(y(e))return!0;if(e==="true"||e==="false")return!0;if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return!0;return!1}function Lt(e){return e==="number"||e==="string"||e==="boolean"}function ir(e){let c=[],i=0;while(i<e.length){while(i<e.length&&e.charCodeAt(i)<=32)i++;if(e.startsWith("/*",i)){let s=e.indexOf("*/",i+2);if(s===-1)break;c.push(e.slice(i,s+2)),i=s+2}else if(e.startsWith("//",i)){let s=i;while(s<e.length&&e.charCodeAt(s)!==10&&e.charCodeAt(s)!==13)s++;c.push(e.slice(i,s).trimEnd()),i=s}else break}return c}function qt(e,c,i){let s=c.trim();if(!Lt(i)||!ct(s))return"";let r=(e??[]).map((f)=>f.trim()).filter((f)=>f.startsWith("/**")||f.startsWith("//")).join(`
|
|
16
16
|
`),l;if(r.includes("@defaultValue"))l=r;else{let f=`@defaultValue ${be(s)}`;if(!r)l=`/** ${f} */`;else{let u=r.lastIndexOf("*/");if(u!==-1){let a=r.slice(0,u).trimEnd();if(a.startsWith("/** ")&&!a.includes(`
|
|
17
17
|
`))a=`/**
|
|
@@ -24,17 +24,17 @@ import{h,g}from"./chunk-cgqg1br8.js";import{t}from"./chunk-t5nmnzy6.js";import{G
|
|
|
24
24
|
`).map((f)=>{let u=f.trim();if(!u)return"";return u.startsWith("*")?` ${u}`:` ${u}`}).join(`
|
|
25
25
|
`)+`
|
|
26
26
|
`}function mt(e){let c=!1,i=0,s=e.length;for(let r=0;r<s;r++){let l=e.charCodeAt(r);if(c){if(l===92){r++;continue}if(l===i)c=!1;continue}if(l===34||l===39||l===96){c=!0,i=l;continue}if(l===61&&r+1<s&&e.charCodeAt(r+1)===62)return!1;if(l===47&&(e.charCodeAt(r+1)===47||e.charCodeAt(r+1)===42))return!1;if(l>=97&&l<=122){let f=r;while(r<s&&(e.charCodeAt(r)>=97&&e.charCodeAt(r)<=122||e.charCodeAt(r)>=65&&e.charCodeAt(r)<=90||e.charCodeAt(r)>=48&&e.charCodeAt(r)<=57||e.charCodeAt(r)===95||e.charCodeAt(r)===36))r++;let u=e.slice(f,r);if(u==="new"||u==="async"||u==="await"||u==="function"||u==="yield"||u==="console"||u==="process")return!1;let a=r;while(a<s&&e.charCodeAt(a)<=32)a++;if(a<s&&e.charCodeAt(a)===40)return!1;r--}}return!0}function dt(e,c,i=0,s,r){let l=e.slice(1,-1).trim();if(!l)return"{}";if(i>=lt)return"Record<string, unknown>";let f=ae(l),u=new Set(f.flatMap(([S])=>{let b=Tt(At(S).key);return b?.kind==="get"?[b.name]:[]})),a=[],d=[],x=[],T=!1,w=ft&&!c,A=[],p=0;for(let[S,b]of f){let{comments:k,key:O}=At(S),P=k?`${k}
|
|
27
|
-
`:"",I=Tt(O);if(I&&cr(I.name))continue;let j=O,
|
|
28
|
-
${j}: ${W(E)}`);else a.push(`${P}${c?"readonly ":""}${j}: ${W(E)}`)}if(w){let R=Ot(et);if(M.endsWith("as const"));else if(ct(M))A.push(`${R}: ${M}`);else if(M.startsWith("[")&&mt(M))A.push(`${R}: ${it(M)}`);else if(M.startsWith("{")){if(X)A.push(`${R}: ${X}`)}else if(
|
|
27
|
+
`:"",I=Tt(O);if(I&&cr(I.name))continue;let j=O,z=!1;if(O==="..."){let R=b.trim(),G=r?ne(R,r):Y(R)?`typeof ${R}`:n(R,c,!1,i+1,s);if(G!=="unknown")d.push(G);if(w&&(Y(R)||R.startsWith("{")))A.push(`...${it(R)}`);continue}let F=D;D=null;let E,L=b.trim();if(L===O&&v(L))E=r?.(b)??(c?void 0:s?.mutableBindingTypes?.get(L))??`typeof ${L}`;else if(he(L)){z=!0;let R=ge(O);if(R){j=R.name;let G="";if(L.startsWith("async "))G="async ";if(L.charCodeAt(G.length)===42)G+="*";E=St(R.name,G+R.typeParams+L.slice(G.length))}else E=St(O,L)}else{if(E=r?.(b)??n(b,c,!1,i+1,s),E==="unknown"&&Y(L))E=(c?void 0:s?.mutableBindingTypes?.get(L))??`typeof ${L}`;if(E.includes("=>")||E.includes("function")||E.includes("async"))E=xt(E)}let X=D;D=F;let et=j,M=b.trim(),N=or(j,s);if(!ar(I?.name??j,s)&&!(I?.kind==="set"&&u.has(I.name)))x.push(I?de(I.kind,E):E);if(N&&"index"in N)T=!0;else{if(N&&"name"in N)j=N.name;if(I){let R=ue(I.kind,I.name,E);if(R){a.push(`${P}${W(R)}`);continue}}if(!c&&Lt(E)&&ct(M))a.push(`${P}/** @defaultValue ${be(M)} */
|
|
28
|
+
${j}: ${W(E)}`);else a.push(`${P}${c?"readonly ":""}${j}: ${W(E)}`)}if(w){let R=Ot(et);if(M.endsWith("as const"));else if(ct(M))A.push(`${R}: ${M}`);else if(M.startsWith("[")&&mt(M))A.push(`${R}: ${it(M)}`);else if(M.startsWith("{")){if(X)A.push(`${R}: ${X}`)}else if(z)A.push(`${R}: ${ht(xt(E))}`),p++;else if(!M.startsWith("[")&&(M.includes("=>")||M.startsWith("function")||M.startsWith("async"))){let G=pt(M,!1,0,!0);A.push(`${R}: ${ht(G)}`),p++}}}if(w&&A.length>p){let S=i>0?(i-1)/2:0,b=`{ ${A.join(", ")} }`;if(b.length<=80)D=b;else{let k=" ".repeat((S+1)*2),O=" ".repeat(S*2);D=`{
|
|
29
29
|
${k}${A.join(`,
|
|
30
30
|
${k}`)}
|
|
31
31
|
${O}}`}}if(T&&d.length===0){let S=[...new Set(x)].map((b)=>b.includes("=>")||b.includes(" & ")?`(${b})`:b);a.unshift(`${c?"readonly ":""}[x: string]: ${W(S.join(" | "))}`)}let m=a.length>0?`{
|
|
32
32
|
${a.join(`;
|
|
33
33
|
`)}
|
|
34
|
-
}`:"{}";if(d.length===0)return m;let C=d[0];for(let S=1;S<d.length;S++)C=`Omit<${C}, keyof ${d[S]}> & ${d[S]}`;return a.length>0?`Omit<${C}, keyof ${m}> & ${m}`:C}function v(e){if(!e)return!1;let c=e.charCodeAt(0);if(!(c>=65&&c<=90||c>=97&&c<=122||c===95||c===36||c>127))return!1;for(let i=1;i<e.length;i++)if(!
|
|
34
|
+
}`:"{}";if(d.length===0)return m;let C=d[0];for(let S=1;S<d.length;S++)C=`Omit<${C}, keyof ${d[S]}> & ${d[S]}`;return a.length>0?`Omit<${C}, keyof ${m}> & ${m}`:C}function v(e){if(!e)return!1;let c=e.charCodeAt(0);if(!(c>=65&&c<=90||c>=97&&c<=122||c===95||c===36||c>127))return!1;for(let i=1;i<e.length;i++)if(!q(e.charCodeAt(i)))return!1;return!0}function Y(e){let c=e.split(".");return c.length>0&&c.every(v)}function ce(e){let c=!1,i="";for(let s=0;s<e.length;s++){let r=e[s];if(c){if(r==="\\")s++;else if(r===i)c=!1;continue}if(r==='"'||r==="'"||r==="`"){c=!0,i=r;continue}if(r==="(")return s;if(r==="<"){let l=o(e,s,"<",">");if(l!==-1)s=l}}return-1}function U(e){if(e.length<3||!e.endsWith(")"))return null;let c=ce(e);if(c===-1||o(e,c,"(",")")!==e.length-1)return null;let i=e.slice(0,c).trim(),s=!1;if(i.endsWith("?."))s=!0,i=i.slice(0,-2).trim();let r=i,l=!1,f=i.indexOf("<");if(f!==-1){if(o(i,f,"<",">")!==i.length-1)return null;r=i.slice(0,f).trim(),l=!0}if(r.endsWith("?.")){s=!0;let A=i.slice(r.length);r=r.slice(0,-2).trim(),i=r+A}if(!Y(r))return null;let u=e.slice(c+1,-1).trim(),a=Z(u)!==-1||u.startsWith("function")||u.startsWith("async function"),d=Y(u),x=!a&&u.endsWith(")")&&U(u)!==null,T=r.indexOf(".");if(T!==-1){if(r.indexOf(".",T+1)!==-1)return null}else if(!l&&!s&&!a&&!d&&!x)return null;let w=`ReturnType<typeof ${i}>`;return s?`ReturnType<NonNullable<typeof ${i}>> | (null extends typeof ${r} ? undefined : undefined extends typeof ${r} ? undefined : never)`:w}function xt(e){let i=e.split(`
|
|
35
35
|
`).map((x)=>_t(x)).join(`
|
|
36
|
-
`),s=i.indexOf("async");if(s!==-1){let x=s>0?i.charCodeAt(s-1):32,T=s+5<i.length?i.charCodeAt(s+5):32;if(!
|
|
36
|
+
`),s=i.indexOf("async");if(s!==-1){let x=s>0?i.charCodeAt(s-1):32,T=s+5<i.length?i.charCodeAt(s+5):32;if(!q(x)&&!q(T))i=(i.slice(0,s)+i.slice(s+5)).trim()}let r=i.indexOf("(");if(r!==-1){let x=o(i,r,"(",")");if(x!==-1){let T=i.slice(r,x+1),w=ye(T);i=i.slice(0,r)+w+i.slice(x+1)}}let l=i.length,f="",u=[],a=!1,d=!1;for(let x=0;x<l;x++){let T=i.charCodeAt(x);if(T===123||T===40)u.push(T);else if(T===125||T===41)u.pop();if(T<=32){if(a=!0,T===10||T===13)d=!0;continue}if(a&&f.length>0){let A=(u.length>0?u[u.length-1]:0)===123;if(d&&A){let p=f.charCodeAt(f.length-1),m=p===59||p===44||p===123||T===125,C=f.length>=2&&f.charCodeAt(f.length-1)===47&&f.charCodeAt(f.length-2)===42;if(!m&&!C)f+="; ";else f+=" "}else f+=" "}a=!1,d=!1,f+=i[x]}return f.trim()}function q(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36}function ye(e){let c=e.trim(),i,s=!1;if(c.startsWith("(")&&c.endsWith(")"))i=c.slice(1,-1),s=!0;else i=c;let r=i.trim();if(!r)return s?"()":"";let l=!1;{let p=0;for(let m=0;m<r.length;m++){let C=r.charCodeAt(m);if(C===40||C===60||C===91||C===123)p++;else if(C===41||C===93||C===125||C===62&&r.charCodeAt(m-1)!==61)p--;else if(p===0&&C===61){let S=m>0?r.charCodeAt(m-1):0,b=m+1<r.length?r.charCodeAt(m+1):0;if(S!==61&&S!==33&&S!==60&&S!==62&&b!==61&&b!==62){l=!0;break}}}}if(!l)return c;let f=[],u=[],a=0,d=0,x=!1,T=0;for(let p=0;p<=r.length;p++){if(p===r.length){f.push(r.slice(a));break}let m=r.charCodeAt(p);if(x){if(m===92){p++;continue}if(m===T)x=!1;continue}if(m===47&&p+1<r.length){let C=r.charCodeAt(p+1);if(C===42){p+=2;while(p+1<r.length&&!(r.charCodeAt(p)===42&&r.charCodeAt(p+1)===47))p++;p++;continue}if(C===47){while(p<r.length&&r.charCodeAt(p)!==10)p++;continue}}if(m===39||m===34||m===96){x=!0,T=m;continue}if(m===40||m===60||m===91||m===123)d++;else if(m===41||m===93||m===125||m===62&&r.charCodeAt(p-1)!==61)d--;else if(m===44&&d===0){f.push(r.slice(a,p));let C=",",S=p+1;while(S<r.length&&r.charCodeAt(S)<=32)C+=r[S],S++;u.push(C),a=S}}let w=[];for(let p of f){let m=p.trim();if(!m){w.push(p);continue}if(m.startsWith("//"))continue;let C=_t(m),S=p.slice(0,p.length-p.trimStart().length);w.push(S+le(C))}let A=w[0]||"";for(let p=1;p<w.length;p++)A+=(u[p-1]||", ")+w[p];return _e(s?`(${A})`:A)}function _t(e){let c=!1,i=0;for(let s=0;s<e.length-1;s++){let r=e.charCodeAt(s);if(c){if(r===92){s++;continue}if(r===i)c=!1;continue}if(r===39||r===34||r===96){c=!0,i=r;continue}if(r===47&&e.charCodeAt(s+1)===47)return e.slice(0,s).trimEnd()}return e}function le(e){if(e.startsWith("..."))return e;let c=-1,i=-1,s=0,r=!1,l=0;for(let u=0;u<e.length;u++){let a=e.charCodeAt(u);if(r){if(a===92){u++;continue}if(a===l)r=!1;continue}if(a===47&&u+1<e.length){let d=e.charCodeAt(u+1);if(d===42){u+=2;while(u+1<e.length&&!(e.charCodeAt(u)===42&&e.charCodeAt(u+1)===47))u++;u++;continue}if(d===47){while(u<e.length&&e.charCodeAt(u)!==10)u++;continue}}if(a===39||a===34||a===96){r=!0,l=a;continue}if(a===40||a===60||a===91||a===123)s++;else if(a===41||a===93||a===125||a===62&&e.charCodeAt(u-1)!==61)s--;else if(s===0){if(a===58&&c===-1)c=u;else if(a===61&&i===-1&&(u===0||e.charCodeAt(u-1)!==61)&&(u+1>=e.length||e.charCodeAt(u+1)!==61&&e.charCodeAt(u+1)!==62))i=u}}let f=i!==-1;if(c!==-1&&(i===-1||c<i)){let u=e.slice(0,c).trim(),a=i!==-1?e.slice(c+1,i).trim():e.slice(c+1).trim(),d=f&&!u.endsWith("?")?"?":"";return`${u}${d}: ${a}`}else if(i!==-1){let u=e.slice(0,i).trim(),a=we(u,e.slice(i+1));if(a)return je(a,bt);let d=!u.endsWith("?")?"?":"";return`${u}${d}: ${bt(e.slice(i+1))}`}return e}function bt(e){let c=e.trim();if(c==="true"||c==="false")return"boolean";if(y(c))return"number";if(c.startsWith("'")&&c.endsWith("'")||c.startsWith('"')&&c.endsWith('"'))return"string";if(c.startsWith("["))return"unknown[]";if(c.startsWith("{"))return"Record<string, unknown>";return"unknown"}function fe(e){let c=0,i=e.length;while(c<i){while(c<i&&(e.charCodeAt(c)===32||e.charCodeAt(c)===9||e.charCodeAt(c)===10||e.charCodeAt(c)===13))c++;if(c+1<i&&e.charCodeAt(c)===47&&e.charCodeAt(c+1)===42){c+=2;while(c+1<i&&!(e.charCodeAt(c)===42&&e.charCodeAt(c+1)===47))c++;c+=2;continue}break}return c}function At(e){let c=[],i=0,s=e.length;while(i<s){while(i<s&&e.charCodeAt(i)<=32)i++;if(i+1>=s||e.charCodeAt(i)!==47||e.charCodeAt(i+1)!==42)break;let r=i;i+=2;while(i+1<s&&!(e.charCodeAt(i)===42&&e.charCodeAt(i+1)===47))i++;i=Math.min(i+2,s),c.push(e.slice(r,i).trim())}return{comments:c.join(`
|
|
37
37
|
`),key:e.slice(i).trim()}}function ae(e){let c=[],i="",s="",r=0,l=!1,f="",u=!0,a=!1,d=0,x=!1,T=!1,w=0,A=!1,p=!1;for(let m=0;m<e.length;m++){let C=e.charCodeAt(m),S=m>0?e.charCodeAt(m-1):0,b=m<e.length-1?e.charCodeAt(m+1):0;if(!l&&!a&&C===47&&b===47){i=i.replace(/[ \t]+$/,""),m+=2;while(m<e.length&&e.charCodeAt(m)!==10)m++;m--;continue}if(!l&&!a&&C===47&&b===42){a=!0,d=1,i+="/*",m++;continue}else if(a&&C===42&&b===47){if(d--,i+="*/",m++,d===0)a=!1;continue}else if(a&&C===47&&b===42){d++,i+="/*",m++;continue}let k=e[m];if(!l&&!a&&(C===34||C===39||C===96))l=!0,f=k,i+=k;else if(l&&k===f&&S!==92)l=!1,i+=k;else if(!l&&!a)if(C===46&&b===46&&e.charCodeAt(m+2)===46&&r===0&&u)s=`${i.trim()}...`,i="",u=!1,A=!1,m+=2;else if(C===40&&r===0&&u&&w===0){s=i.trim();let O=fe(s),P=O>0?s.slice(0,O):"",I=s.slice(O),j="";if(I.startsWith("async ")||I.startsWith("async\t")||I.startsWith(`async
|
|
38
38
|
`))I=I.slice(6).trimStart(),j="async ";if(I.startsWith("*"))I=I.slice(1).trimStart(),j+="*";s=P+I,i=j+k,u=!1,A=!0,p=!1,r=1}else if(C===123||C===91||C===40){if(r++,i+=k,p&&C===123)p=!1}else if(C===125||C===93||C===41){if(r--,i+=k,C===41&&r===0&&!u&&!A)x=!0;if(A){if(C===41&&r===0&&!p)p=!0;else if(C===125&&r===0)A=!1,p=!1}}else if(C===58&&r===0&&u&&w===0)s=i.trim(),i="",u=!1;else if(C===58&&r===0&&x)T=!0,i+=k;else if(C===60&&T)w++,i+=k;else if(C===60&&u&&r===0)w++,i+=k;else if(C===62&&w>0&&S!==61)w--,i+=k;else if(C===61&&b===62&&T&&w===0)T=!1,x=!1,i+=k;else if(C===44&&r===0&&w===0&&!p){if(s&&i.trim()){let O=i.trim();c.push([s,O])}else if(u&&i.trim())kt(c,i.trim());i="",s="",u=!0,x=!1,T=!1,w=0}else i+=k;else i+=k}if(s&&i.trim()){let m=i.trim();c.push([s,m])}else if(u&&i.trim())kt(c,i.trim());return c}function kt(e,c){let{comments:i,key:s}=At(c);if(v(s))e.push([i?`${i}
|
|
39
|
-
${s}`:s,s]);else if(s.startsWith("...")&&s.length>3)e.push(["...",s.slice(3).trim()])}function Tt(e){let c=e.trim();if(c.startsWith("get ")&&c.length>4){let i=c.slice(4).trim();if(i)return{kind:"get",name:i}}if(c.startsWith("set ")&&c.length>4){let i=c.slice(4).trim();if(i)return{kind:"set",name:i}}return null}function ue(e,c,i){let s=i.trim();if(s.charCodeAt(0)!==40)return null;let r=o(s,0,"(",")");if(r===-1)return null;let l=s.slice(1,r).trim(),f=s.slice(r+1).trimStart();if(!f.startsWith("=>"))return null;let u=f.slice(2).trim();if(e==="get")return`get ${c}(): ${u||"unknown"}`;return`set ${c}(${l})`}function de(e,c){let i=c.trim(),s=o(i,0,"(",")");if(!i.startsWith("(")||s===-1)return"unknown";if(e==="get"){let u=i.slice(s+1).trim();return u.startsWith("=>")?u.slice(2).trim():"unknown"}let r=i.slice(1,s).trim(),l=r.startsWith("{")?o(r,0,"{","}"):r.startsWith("[")?o(r,0,"[","]"):0,f=r.indexOf(":",Math.max(0,l));return f===-1?"unknown":r.slice(f+1).trim()}function he(e){let c=e;if(c.startsWith("async ")||c.startsWith("async\t"))c=c.slice(5).trimStart();if(c.startsWith("*"))c=c.slice(1).trimStart();if(!c.startsWith("("))return!1;let i=0;for(let s=0;s<c.length;s++){let r=c.charCodeAt(s);if(r===40)i++;else if(r===41){if(i--,i===0){let l=c.slice(s+1).trimStart();if(l.startsWith("{"))return!0;if(l.startsWith(":")){let f=yt(l,1);if(f?.kind==="arrow")return!1;if(f?.kind==="body")return!0}return!1}}}return!1}function ge(e){let c=e.trimEnd();if(!c.endsWith(">"))return null;let i=0,s=-1;for(let l=c.length-1;l>=0;l--){let f=c.charCodeAt(l);if(f===62){if(l>0&&c.charCodeAt(l-1)===61)continue;i++}else if(f===60){if(i--,i===0){s=l;break}}}if(s===-1)return null;let r=c.slice(0,s).trimEnd();if(!r)return null;return{name:r,typeParams:c.slice(s)}}function St(e,c){let i=c.trimStart(),s=!1,r=!1;if(i.startsWith("async ")||i.startsWith("async\t"))s=!0,i=i.slice(5).trimStart();if(i.startsWith("*"))r=!0,i=i.slice(1).trimStart();let l="";if(i.charCodeAt(0)===60){let w=0,A=-1;for(let p=0;p<i.length;p++)if(i.charCodeAt(p)===60)w++;else if(i.charCodeAt(p)===62&&!(p>0&&i.charCodeAt(p-1)===61)){if(w--,w===0){A=p;break}}if(A!==-1)l=i.slice(0,A+1),i=i.slice(A+1).trimStart()}let f=i.indexOf("("),u=o(i,f,"(",")");if(f===-1||u===-1)return"() => unknown";let a=i.slice(f,u+1),d="unknown",x=i.slice(u+1).trimStart();if(x.charCodeAt(0)===58){let w=x.slice(1),A=yt(w,0);if(A)d=w.slice(0,A.index).trim();else d=w.trim()}if(d==="unknown"&&!r&&x.charCodeAt(0)===123){let w=o(x,0,"{","}");if(w!==-1){let A=B(x.slice(1,w),s,a);if(A!=="unknown"&&A!=="Promise<unknown>")d=s&&A.startsWith("Promise<")?A.slice(8,-1):A;else if(s)d="Promise<unknown>"}}if(d==="unknown"){if(s&&r)d="AsyncGenerator<unknown, void, unknown>";else if(r)d="Generator<unknown, void, unknown>";else if(s)d="Promise<void>"}else if(s&&!d.startsWith("Promise<")&&!d.startsWith("AsyncGenerator<"))d=`Promise<${d}>`;let T=ye(a);return`${l}${T} => ${d}`}function yt(e,c){let i=0,s=0,r=0,l=0,f=!1,u=0;for(let a=c;a<e.length;a++){let d=e.charCodeAt(a);if(f){if(d===92)a++;else if(d===u)f=!1;continue}if(d===34||d===39||d===96){f=!0,u=d;continue}if(d===40)i++;else if(d===41&&i>0)i--;else if(d===91)s++;else if(d===93&&s>0)s--;else if(d===60)r++;else if(d===62&&r>0&&e.charCodeAt(a-1)!==61)r--;else if(d===125&&l>0)l--;else if(d===123){let x=i>0||s>0||r>0||l>0,T=e.slice(c,a).trimEnd(),w=T.charCodeAt(T.length-1),A=T.length===0||w===38||w===124||w===40||w===44||w===58||w===61||w===91;if(x||A)l++;else return{index:a,kind:"body"}}else if(d===61&&a+1<e.length&&e.charCodeAt(a+1)===62&&i===0&&s===0&&r===0&&l===0)return{index:a,kind:"arrow"}}return null}function o(e,c,i,s){let r=0;for(let l=c;l<e.length;l++)if(e[l]===i)r++;else if(e[l]===s){if(s===">"&&l>0&&e[l-1]==="=")continue;if(r--,r===0)return l}return-1}function Z(e){let c=0,i=0,s=!1,r="";for(let l=0;l<e.length-1;l++){let f=e[l],u=e[l+1],a=l>0?e[l-1]:"";if(!s&&(f==='"'||f==="'"||f==="`"))s=!0,r=f;else if(s&&f===r&&a!=="\\")s=!1;if(!s){if(f==="<"){let d=o(e,l,"<",">");if(d!==-1){l=d;continue}}if(f==="(")c++;else if(f===")")c--;else if(f==="[")i++;else if(f==="]")i--;if(f==="="&&u===">"&&c===0&&i===0)return l}}return-1}function pt(e,c=!1,i=0,s=!0){let r=e.trim();if(r.length>200&&ut(r,"=>")>2&&ut(r,"<")>5&&!r.startsWith("function"))return c?"((...args: any[]) => any)":"(...args: any[]) => any";if(r.startsWith("async ")&&r.includes("=>")){let f=r.slice(5).trim(),u=Z(f);if(u===-1)return c?"(() => Promise<unknown>)":"() => Promise<unknown>";let a=f.substring(0,u).trim(),d=f.substring(u+2).trim(),x=Ct(a),{params:T,returnType:w}=x;if(T=ye(T),T==="()"||T==="")T="()";else if(!T.startsWith("("))T=`(${T})`;let A=w;if(A);else if(d.startsWith("{"))A=B(d.slice(1,d.endsWith("}")?-1:void 0),!0,x.params);else A=F(d,gt(x.params));let p=`${T} => ${w||A.startsWith("Promise<")?A:`Promise<${A}>`}`;return c?`(${p})`:p}if(r.includes("=>")){let f="",u=r;if(r.startsWith("<")){let C=o(r,0,"<",">");if(C!==-1)f=r.substring(0,C+1),u=r.substring(C+1).trim()}let a=Z(u);if(a===-1)return c?"(() => unknown)":"() => unknown";let d=u.substring(0,a).trim(),x=u.substring(a+2).trim(),T=Ct(d),{params:w,returnType:A}=T;if(w=ye(w),w==="()"||w==="")w="()";else if(!w.startsWith("("))w=`(${w})`;let p="unknown";if(A)p=A;else if(x.startsWith("{"))p=B(x.slice(1,x.endsWith("}")?-1:void 0),!1,T.params);else if(rt(x)||at(x)&&rt(x.slice(1,-1).trim()))p="JSX.Element";else if(x.includes("=>")){let C=x.trimStart(),S=C.indexOf("("),b=S!==-1?o(C,S,"(",")"):-1,k=b!==-1?C.indexOf("=>",b):-1;if(S===0&&b!==-1&&k!==-1){let O=C.substring(S+1,b).trim(),P=ye(O);if(f.includes("T")&&P.includes("T"))p=`(${P}) => T`;else p=`(${P}) => any`}else p="any"}else p=F(x,gt(T.params));let m=`${f}${w} => ${p}`;return c?`(${m})`:m}if(r.startsWith("function")){let f=8,u=r.length;while(f<u&&r.charCodeAt(f)<=32)f++;let a=!1;if(f<u&&r.charCodeAt(f)===42){a=!0,f++;while(f<u&&r.charCodeAt(f)<=32)f++}let d="";if(f<u&&r.charCodeAt(f)===60){let w=f,A=1;f++;while(f<u&&A>0){let p=r.charCodeAt(f);if(p===60)A++;else if(p===62&&r.charCodeAt(f-1)!==61)A--;f++}d=r.substring(w,f);while(f<u&&r.charCodeAt(f)<=32)f++}let x=r.indexOf("(",f);if(x!==-1){let w=1,A=x+1;while(A<u&&w>0){let k=r.charCodeAt(A);if(k===40)w++;else if(k===41)w--;A++}let p=r.substring(x+1,A-1).trim(),m=p?ye(`(${p})`):"()";if(a){let k=r.substring(A).trim(),O=k.indexOf("Generator<");if(O!==-1){let I=O+10,j=k.indexOf(">",I);if(j!==-1){let q=k.substring(I,j),D=`${d}${m} => Generator<${q}>`;return c?`(${D})`:D}}let P=`${d}${m} => Generator<any, any, any>`;return c?`(${P})`:P}let C="unknown",S=r.substring(A).trimStart();if(S.charCodeAt(0)===58){let k=S.slice(1),O=yt(k,0),P=(O?k.slice(0,O.index):k).trim();if(P)C=P}let b=`${d}${m} => ${C}`;return c?`(${b})`:b}let T="(...args: any[]) => unknown";return c?`(${T})`:T}if(r.includes("=>")&&r.includes("(")&&r.includes(")")){if(r.length>100||ut(r,"=>")>2){let f="";if(r.charCodeAt(0)===60){let T=o(r,0,"<",">");if(T!==-1)f=r.substring(0,T+1)}let u=r.indexOf("("),a=u!==-1?o(r,u,"(",")"):-1,d=u!==-1&&a!==-1?r.substring(u,a+1):"(...args: any[])";d=ye(d);let x=`${f}${d} => any`;return c?`(${x})`:x}return c?`(${r})`:r}let l="() => unknown";return c?`(${l})`:l}function Ct(e){let c=e.trim();if(!c.startsWith("("))return{params:c,returnType:""};let i=o(c,0,"(",")");if(i===-1)return{params:c,returnType:""};let s=c.slice(i+1).trim();return{params:c.slice(0,i+1),returnType:s.startsWith(":")?s.slice(1).trim():""}}function We(e){let c=e.trim();if(c==="any"||c==="object"||c==="unknown")return!0;if(c.startsWith("Record<")&&c.endsWith(">"))return!0;if(c.startsWith("Array<")&&c.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(c))return!0;return!1}function U(e){let c=-1,i=0;for(let r=0;r<e.length;r++){let l=e.charCodeAt(r);if(l===34||l===39||l===96){r=J(e,r,l)-1;continue}if(l===47&&e.charCodeAt(r+1)===47){while(r<e.length&&e.charCodeAt(r)!==10)r++;continue}if(l===47&&e.charCodeAt(r+1)===42){let f=e.indexOf("*/",r+2);r=f===-1?e.length:f+1;continue}if(l===47){let f=r-1;while(f>=0&&e.charCodeAt(f)<=32)f--;if(f<0||"([{:;,=!?&|+*-~>".includes(e[f])){let u=!1;for(r++;r<e.length;r++){let a=e.charCodeAt(r);if(a===92)r++;else if(a===91)u=!0;else if(a===93)u=!1;else if(a===47&&!u)break}continue}}if(l===40||l===91||l===123)i++;else if(l===41||l===93||l===125)i--;else if(i===0&&e.startsWith("satisfies",r)&&tt(e,r,9)&&e[r-1]!==".")c=r}if(c===-1)return null;let s=e.slice(c+9).trim();if(s.endsWith(";"))s=s.slice(0,-1).trim();return s||null}function za(e){let c=e.trim(),i=c.match(/^\{\s*\[(\w+)\s+in\s+(.+?)\](\?)?\s*:\s*(.+)\s*\}$/);if(i){let[,l,f,u,a]=i;return`{ [${l} in ${f}]${u?"?":""}: ${a} }`}let s=c.match(/^\{\s*readonly\s+\[(\w+)\s+in\s+(.+?)\](\?)?\s*:\s*(.+)\s*\}$/);if(s){let[,l,f,u,a]=s;return`{ readonly [${l} in ${f}]${u?"?":""}: ${a} }`}let r=c.match(/^\{\s*(-?readonly\s+)?\[(\w+)\s+in\s+(.+?)\](-?\?)?\s*:\s*(.+)\s*\}$/);if(r){let[,l,f,u,a,d]=r;return`{ ${l?`${l.trim()} `:""}[${f} in ${u}]${a||""}: ${d} }`}return null}function Ua(e){let c=e.trim(),i=c.indexOf(" extends ");if(i===-1)return null;let s=c.slice(i+9),r=me(s);if(r===-1)return null;let l=pe(s,r);if(l===-1)return null;let f=c.slice(0,i).trim(),u=s.slice(0,r).trim(),a=s.slice(r+1,l).trim(),d=s.slice(l+1).trim();return`${f} extends ${u} ? ${a} : ${d}`}function me(e){let c=0,i=!1,s="";for(let r=0;r<e.length;r++){let l=e[r],f=r>0?e[r-1]:"";if(!i&&(l==='"'||l==="'"||l==="`"))i=!0,s=l;else if(i&&l===s&&f!=="\\")i=!1;if(!i){if(l==="<"||l==="("||l==="["||l==="{")c++;if(l===">"||l===")"||l==="]"||l==="}")c--;if(l==="?"&&c===0)return r}}return-1}function pe(e,c){let i=0,s=!1,r="";for(let l=c+1;l<e.length;l++){let f=e[l],u=l>0?e[l-1]:"";if(!s&&(f==='"'||f==="'"||f==="`"))s=!0,r=f;else if(s&&f===r&&u!=="\\")s=!1;if(!s){if(f==="<"||f==="("||f==="["||f==="{")i++;if(f===">"||f===")"||f==="]"||f==="}")i--;if(f==="?"&&i===0)i++;if(f===":"&&i===0)return l;if(f===":"&&i>0)i--}}return-1}function Ha(e){let c=e.trim();if(!c.startsWith("`")||!c.endsWith("`"))return null;let i=c.slice(1,-1);if(!i.includes("${"))return c;let s=[],r="",l=0;while(l<i.length)if(i[l]==="$"&&i[l+1]==="{"){if(r)s.push(`"${r}"`),r="";let f=1,u="";l+=2;while(l<i.length&&f>0){if(i[l]==="{")f++;if(i[l]==="}")f--;if(f>0)u+=i[l];l++}s.push(u.trim())}else r+=i[l],l++;if(r)s.push(`"${r}"`);return c}function Ka(e){let c=[],i=/infer\s+(\w+)/g,s;while((s=i.exec(e))!==null)c.push(s[1]);return c}function qa(e){let i=e.trim(),s=i.indexOf("[");if(s!==-1){if(i.indexOf(" in ",s)!==-1)return!0}let r=i.indexOf(" extends ");if(r!==-1){let f=i.indexOf(" ? ",r);if(f!==-1&&i.indexOf(" : ",f)!==-1)return!0}if(i.charCodeAt(0)===96&&i.charCodeAt(i.length-1)===96){if(i.indexOf("${")!==-1)return!0}let l=i.indexOf("infer ");if(l!==-1){if(l===0||!V(i.charCodeAt(l-1)))return!0}return!1}function Ja(e,c=3){let i=e.trim(),s=0,r=0;for(let l of i){if(l==="<"||l==="("||l==="["||l==="{")s++,r=Math.max(r,s);if(l===">"||l===")"||l==="]"||l==="}")s--}if(r>c){let l=i.match(/^(\w+)</);if(l)return`${l[1]}<any>`;return"unknown"}return i}function Ya(e){let i=e.trim().match(/^(\w+)<(.+)>$/);if(!i)return null;let s=i[1],r=i[2],l=Ea(r);if(["Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisParameterType","OmitThisParameter","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer"].includes(s))return{name:s,params:l};return null}function Ea(e){let c=[],i="",s=0,r=!1,l="";for(let f=0;f<e.length;f++){let u=e[f],a=f>0?e[f-1]:"";if(!r&&(u==='"'||u==="'"||u==="`"))r=!0,l=u;else if(r&&u===l&&a!=="\\")r=!1;if(!r){if(u==="<"||u==="("||u==="["||u==="{")s++;if(u===">"||u===")"||u==="]"||u==="}")s--;if(u===","&&s===0){c.push(i.trim()),i="";continue}}i+=u}if(i.trim())c.push(i.trim());return c}function Xa(e){let c=e.trim();if(c.startsWith("keyof "))return c;return null}function Za(e){let c=e.trim();if(c.startsWith("typeof "))return c;return null}function Qa(e){let c=e.trim();if(c.length===0||c.charCodeAt(0)===91)return!1;if(c.charCodeAt(c.length-1)!==93)return!1;let i=c.indexOf("[");if(i<=0)return!1;for(let s=0;s<i;s++){let r=c.charCodeAt(s);if(!V(r)&&r!==46)return!1}return!0}
|
|
40
|
-
export{zt,Ut,n,Ht,B,$a,W,Kt,Be,Q,ir,qt,dt,
|
|
39
|
+
${s}`:s,s]);else if(s.startsWith("...")&&s.length>3)e.push(["...",s.slice(3).trim()])}function Tt(e){let c=e.trim();if(c.startsWith("get ")&&c.length>4){let i=c.slice(4).trim();if(i)return{kind:"get",name:i}}if(c.startsWith("set ")&&c.length>4){let i=c.slice(4).trim();if(i)return{kind:"set",name:i}}return null}function ue(e,c,i){let s=i.trim();if(s.charCodeAt(0)!==40)return null;let r=o(s,0,"(",")");if(r===-1)return null;let l=s.slice(1,r).trim(),f=s.slice(r+1).trimStart();if(!f.startsWith("=>"))return null;let u=f.slice(2).trim();if(e==="get")return`get ${c}(): ${u||"unknown"}`;return`set ${c}(${l})`}function de(e,c){let i=c.trim(),s=o(i,0,"(",")");if(!i.startsWith("(")||s===-1)return"unknown";if(e==="get"){let u=i.slice(s+1).trim();return u.startsWith("=>")?u.slice(2).trim():"unknown"}let r=i.slice(1,s).trim(),l=r.startsWith("{")?o(r,0,"{","}"):r.startsWith("[")?o(r,0,"[","]"):0,f=r.indexOf(":",Math.max(0,l));return f===-1?"unknown":r.slice(f+1).trim()}function he(e){let c=e;if(c.startsWith("async ")||c.startsWith("async\t"))c=c.slice(5).trimStart();if(c.startsWith("*"))c=c.slice(1).trimStart();if(!c.startsWith("("))return!1;let i=0;for(let s=0;s<c.length;s++){let r=c.charCodeAt(s);if(r===40)i++;else if(r===41){if(i--,i===0){let l=c.slice(s+1).trimStart();if(l.startsWith("{"))return!0;if(l.startsWith(":")){let f=yt(l,1);if(f?.kind==="arrow")return!1;if(f?.kind==="body")return!0}return!1}}}return!1}function ge(e){let c=e.trimEnd();if(!c.endsWith(">"))return null;let i=0,s=-1;for(let l=c.length-1;l>=0;l--){let f=c.charCodeAt(l);if(f===62){if(l>0&&c.charCodeAt(l-1)===61)continue;i++}else if(f===60){if(i--,i===0){s=l;break}}}if(s===-1)return null;let r=c.slice(0,s).trimEnd();if(!r)return null;return{name:r,typeParams:c.slice(s)}}function St(e,c){let i=c.trimStart(),s=!1,r=!1;if(i.startsWith("async ")||i.startsWith("async\t"))s=!0,i=i.slice(5).trimStart();if(i.startsWith("*"))r=!0,i=i.slice(1).trimStart();let l="";if(i.charCodeAt(0)===60){let w=0,A=-1;for(let p=0;p<i.length;p++)if(i.charCodeAt(p)===60)w++;else if(i.charCodeAt(p)===62&&!(p>0&&i.charCodeAt(p-1)===61)){if(w--,w===0){A=p;break}}if(A!==-1)l=i.slice(0,A+1),i=i.slice(A+1).trimStart()}let f=i.indexOf("("),u=o(i,f,"(",")");if(f===-1||u===-1)return"() => unknown";let a=i.slice(f,u+1),d="unknown",x=i.slice(u+1).trimStart();if(x.charCodeAt(0)===58){let w=x.slice(1),A=yt(w,0);if(A)d=w.slice(0,A.index).trim();else d=w.trim()}if(d==="unknown"&&!r&&x.charCodeAt(0)===123){let w=o(x,0,"{","}");if(w!==-1){let A=B(x.slice(1,w),s,a);if(A!=="unknown"&&A!=="Promise<unknown>")d=s&&A.startsWith("Promise<")?A.slice(8,-1):A;else if(s)d="Promise<unknown>"}}if(d==="unknown"){if(s&&r)d="AsyncGenerator<unknown, void, unknown>";else if(r)d="Generator<unknown, void, unknown>";else if(s)d="Promise<void>"}else if(s&&!d.startsWith("Promise<")&&!d.startsWith("AsyncGenerator<"))d=`Promise<${d}>`;let T=ye(a);return`${l}${T} => ${d}`}function yt(e,c){let i=0,s=0,r=0,l=0,f=!1,u=0;for(let a=c;a<e.length;a++){let d=e.charCodeAt(a);if(f){if(d===92)a++;else if(d===u)f=!1;continue}if(d===34||d===39||d===96){f=!0,u=d;continue}if(d===40)i++;else if(d===41&&i>0)i--;else if(d===91)s++;else if(d===93&&s>0)s--;else if(d===60)r++;else if(d===62&&r>0&&e.charCodeAt(a-1)!==61)r--;else if(d===125&&l>0)l--;else if(d===123){let x=i>0||s>0||r>0||l>0,T=e.slice(c,a).trimEnd(),w=T.charCodeAt(T.length-1),A=T.length===0||w===38||w===124||w===40||w===44||w===58||w===61||w===91;if(x||A)l++;else return{index:a,kind:"body"}}else if(d===61&&a+1<e.length&&e.charCodeAt(a+1)===62&&i===0&&s===0&&r===0&&l===0)return{index:a,kind:"arrow"}}return null}function o(e,c,i,s){let r=0;for(let l=c;l<e.length;l++)if(e[l]===i)r++;else if(e[l]===s){if(s===">"&&l>0&&e[l-1]==="=")continue;if(r--,r===0)return l}return-1}function Z(e){let c=0,i=0,s=!1,r="";for(let l=0;l<e.length-1;l++){let f=e[l],u=e[l+1],a=l>0?e[l-1]:"";if(!s&&(f==='"'||f==="'"||f==="`"))s=!0,r=f;else if(s&&f===r&&a!=="\\")s=!1;if(!s){if(f==="<"){let d=o(e,l,"<",">");if(d!==-1){l=d;continue}}if(f==="(")c++;else if(f===")")c--;else if(f==="[")i++;else if(f==="]")i--;if(f==="="&&u===">"&&c===0&&i===0)return l}}return-1}function pt(e,c=!1,i=0,s=!0){let r=e.trim();if(r.length>200&&ut(r,"=>")>2&&ut(r,"<")>5&&!r.startsWith("function"))return c?"((...args: any[]) => any)":"(...args: any[]) => any";if(r.startsWith("async ")&&r.includes("=>")){let f=r.slice(5).trim(),u=Z(f);if(u===-1)return c?"(() => Promise<unknown>)":"() => Promise<unknown>";let a=f.substring(0,u).trim(),d=f.substring(u+2).trim(),x=Ct(a),{params:T,returnType:w}=x;if(T=ye(T),T==="()"||T==="")T="()";else if(!T.startsWith("("))T=`(${T})`;let A=w;if(A);else if(d.startsWith("{"))A=B(d.slice(1,d.endsWith("}")?-1:void 0),!0,x.params);else A=V(d,gt(x.params));let p=`${T} => ${w||A.startsWith("Promise<")?A:`Promise<${A}>`}`;return c?`(${p})`:p}if(r.includes("=>")){let f="",u=r;if(r.startsWith("<")){let C=o(r,0,"<",">");if(C!==-1)f=r.substring(0,C+1),u=r.substring(C+1).trim()}let a=Z(u);if(a===-1)return c?"(() => unknown)":"() => unknown";let d=u.substring(0,a).trim(),x=u.substring(a+2).trim(),T=Ct(d),{params:w,returnType:A}=T;if(w=ye(w),w==="()"||w==="")w="()";else if(!w.startsWith("("))w=`(${w})`;let p="unknown";if(A)p=A;else if(x.startsWith("{"))p=B(x.slice(1,x.endsWith("}")?-1:void 0),!1,T.params);else if(rt(x)||at(x)&&rt(x.slice(1,-1).trim()))p="JSX.Element";else if(x.includes("=>")){let C=x.trimStart(),S=C.indexOf("("),b=S!==-1?o(C,S,"(",")"):-1,k=b!==-1?C.indexOf("=>",b):-1;if(S===0&&b!==-1&&k!==-1){let O=C.substring(S+1,b).trim(),P=ye(O);if(f.includes("T")&&P.includes("T"))p=`(${P}) => T`;else p=`(${P}) => any`}else p="any"}else p=V(x,gt(T.params));let m=`${f}${w} => ${p}`;return c?`(${m})`:m}if(r.startsWith("function")){let f=8,u=r.length;while(f<u&&r.charCodeAt(f)<=32)f++;let a=!1;if(f<u&&r.charCodeAt(f)===42){a=!0,f++;while(f<u&&r.charCodeAt(f)<=32)f++}let d="";if(f<u&&r.charCodeAt(f)===60){let w=f,A=1;f++;while(f<u&&A>0){let p=r.charCodeAt(f);if(p===60)A++;else if(p===62&&r.charCodeAt(f-1)!==61)A--;f++}d=r.substring(w,f);while(f<u&&r.charCodeAt(f)<=32)f++}let x=r.indexOf("(",f);if(x!==-1){let w=1,A=x+1;while(A<u&&w>0){let k=r.charCodeAt(A);if(k===40)w++;else if(k===41)w--;A++}let p=r.substring(x+1,A-1).trim(),m=p?ye(`(${p})`):"()";if(a){let k=r.substring(A).trim(),O=k.indexOf("Generator<");if(O!==-1){let I=O+10,j=k.indexOf(">",I);if(j!==-1){let z=k.substring(I,j),F=`${d}${m} => Generator<${z}>`;return c?`(${F})`:F}}let P=`${d}${m} => Generator<any, any, any>`;return c?`(${P})`:P}let C="unknown",S=r.substring(A).trimStart();if(S.charCodeAt(0)===58){let k=S.slice(1),O=yt(k,0),P=(O?k.slice(0,O.index):k).trim();if(P)C=P}let b=`${d}${m} => ${C}`;return c?`(${b})`:b}let T="(...args: any[]) => unknown";return c?`(${T})`:T}if(r.includes("=>")&&r.includes("(")&&r.includes(")")){if(r.length>100||ut(r,"=>")>2){let f="";if(r.charCodeAt(0)===60){let T=o(r,0,"<",">");if(T!==-1)f=r.substring(0,T+1)}let u=r.indexOf("("),a=u!==-1?o(r,u,"(",")"):-1,d=u!==-1&&a!==-1?r.substring(u,a+1):"(...args: any[])";d=ye(d);let x=`${f}${d} => any`;return c?`(${x})`:x}return c?`(${r})`:r}let l="() => unknown";return c?`(${l})`:l}function Ct(e){let c=e.trim();if(!c.startsWith("("))return{params:c,returnType:""};let i=o(c,0,"(",")");if(i===-1)return{params:c,returnType:""};let s=c.slice(i+1).trim();return{params:c.slice(0,i+1),returnType:s.startsWith(":")?s.slice(1).trim():""}}function We(e){let c=e.trim();if(c==="any"||c==="object"||c==="unknown")return!0;if(c.startsWith("Record<")&&c.endsWith(">"))return!0;if(c.startsWith("Array<")&&c.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(c))return!0;return!1}function H(e){let c=-1,i=0;for(let r=0;r<e.length;r++){let l=e.charCodeAt(r);if(l===34||l===39||l===96){r=J(e,r,l)-1;continue}if(l===47&&e.charCodeAt(r+1)===47){while(r<e.length&&e.charCodeAt(r)!==10)r++;continue}if(l===47&&e.charCodeAt(r+1)===42){let f=e.indexOf("*/",r+2);r=f===-1?e.length:f+1;continue}if(l===47){let f=r-1;while(f>=0&&e.charCodeAt(f)<=32)f--;if(f<0||"([{:;,=!?&|+*-~>".includes(e[f])){let u=!1;for(r++;r<e.length;r++){let a=e.charCodeAt(r);if(a===92)r++;else if(a===91)u=!0;else if(a===93)u=!1;else if(a===47&&!u)break}continue}}if(l===40||l===91||l===123)i++;else if(l===41||l===93||l===125)i--;else if(i===0&&e.startsWith("satisfies",r)&&tt(e,r,9)&&e[r-1]!==".")c=r}if(c===-1)return null;let s=e.slice(c+9).trim();if(s.endsWith(";"))s=s.slice(0,-1).trim();return s||null}function za(e){let c=e.trim(),i=c.match(/^\{\s*\[(\w+)\s+in\s+(.+?)\](\?)?\s*:\s*(.+)\s*\}$/);if(i){let[,l,f,u,a]=i;return`{ [${l} in ${f}]${u?"?":""}: ${a} }`}let s=c.match(/^\{\s*readonly\s+\[(\w+)\s+in\s+(.+?)\](\?)?\s*:\s*(.+)\s*\}$/);if(s){let[,l,f,u,a]=s;return`{ readonly [${l} in ${f}]${u?"?":""}: ${a} }`}let r=c.match(/^\{\s*(-?readonly\s+)?\[(\w+)\s+in\s+(.+?)\](-?\?)?\s*:\s*(.+)\s*\}$/);if(r){let[,l,f,u,a,d]=r;return`{ ${l?`${l.trim()} `:""}[${f} in ${u}]${a||""}: ${d} }`}return null}function Ua(e){let c=e.trim(),i=c.indexOf(" extends ");if(i===-1)return null;let s=c.slice(i+9),r=me(s);if(r===-1)return null;let l=pe(s,r);if(l===-1)return null;let f=c.slice(0,i).trim(),u=s.slice(0,r).trim(),a=s.slice(r+1,l).trim(),d=s.slice(l+1).trim();return`${f} extends ${u} ? ${a} : ${d}`}function me(e){let c=0,i=!1,s="";for(let r=0;r<e.length;r++){let l=e[r],f=r>0?e[r-1]:"";if(!i&&(l==='"'||l==="'"||l==="`"))i=!0,s=l;else if(i&&l===s&&f!=="\\")i=!1;if(!i){if(l==="<"||l==="("||l==="["||l==="{")c++;if(l===">"||l===")"||l==="]"||l==="}")c--;if(l==="?"&&c===0)return r}}return-1}function pe(e,c){let i=0,s=!1,r="";for(let l=c+1;l<e.length;l++){let f=e[l],u=l>0?e[l-1]:"";if(!s&&(f==='"'||f==="'"||f==="`"))s=!0,r=f;else if(s&&f===r&&u!=="\\")s=!1;if(!s){if(f==="<"||f==="("||f==="["||f==="{")i++;if(f===">"||f===")"||f==="]"||f==="}")i--;if(f==="?"&&i===0)i++;if(f===":"&&i===0)return l;if(f===":"&&i>0)i--}}return-1}function Ha(e){let c=e.trim();if(!c.startsWith("`")||!c.endsWith("`"))return null;let i=c.slice(1,-1);if(!i.includes("${"))return c;let s=[],r="",l=0;while(l<i.length)if(i[l]==="$"&&i[l+1]==="{"){if(r)s.push(`"${r}"`),r="";let f=1,u="";l+=2;while(l<i.length&&f>0){if(i[l]==="{")f++;if(i[l]==="}")f--;if(f>0)u+=i[l];l++}s.push(u.trim())}else r+=i[l],l++;if(r)s.push(`"${r}"`);return c}function Ka(e){let c=[],i=/infer\s+(\w+)/g,s;while((s=i.exec(e))!==null)c.push(s[1]);return c}function qa(e){let i=e.trim(),s=i.indexOf("[");if(s!==-1){if(i.indexOf(" in ",s)!==-1)return!0}let r=i.indexOf(" extends ");if(r!==-1){let f=i.indexOf(" ? ",r);if(f!==-1&&i.indexOf(" : ",f)!==-1)return!0}if(i.charCodeAt(0)===96&&i.charCodeAt(i.length-1)===96){if(i.indexOf("${")!==-1)return!0}let l=i.indexOf("infer ");if(l!==-1){if(l===0||!q(i.charCodeAt(l-1)))return!0}return!1}function Ja(e,c=3){let i=e.trim(),s=0,r=0;for(let l of i){if(l==="<"||l==="("||l==="["||l==="{")s++,r=Math.max(r,s);if(l===">"||l===")"||l==="]"||l==="}")s--}if(r>c){let l=i.match(/^(\w+)</);if(l)return`${l[1]}<any>`;return"unknown"}return i}function Ya(e){let i=e.trim().match(/^(\w+)<(.+)>$/);if(!i)return null;let s=i[1],r=i[2],l=Ea(r);if(["Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisParameterType","OmitThisParameter","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer"].includes(s))return{name:s,params:l};return null}function Ea(e){let c=[],i="",s=0,r=!1,l="";for(let f=0;f<e.length;f++){let u=e[f],a=f>0?e[f-1]:"";if(!r&&(u==='"'||u==="'"||u==="`"))r=!0,l=u;else if(r&&u===l&&a!=="\\")r=!1;if(!r){if(u==="<"||u==="("||u==="["||u==="{")s++;if(u===">"||u===")"||u==="]"||u==="}")s--;if(u===","&&s===0){c.push(i.trim()),i="";continue}}i+=u}if(i.trim())c.push(i.trim());return c}function Xa(e){let c=e.trim();if(c.startsWith("keyof "))return c;return null}function Za(e){let c=e.trim();if(c.startsWith("typeof "))return c;return null}function Qa(e){let c=e.trim();if(c.length===0||c.charCodeAt(0)===91)return!1;if(c.charCodeAt(c.length-1)!==93)return!1;let i=c.indexOf("[");if(i<=0)return!1;for(let s=0;s<i;s++){let r=c.charCodeAt(s);if(!q(r)&&r!==46)return!1}return!0}
|
|
40
|
+
export{zt,Ut,n,Ht,B,$a,W,Kt,Be,Q,ir,qt,dt,U,ye,o,pt,We,H,za,Ua,Ha,Ka,qa,Ja,Ya,Ea,Xa,Za,Qa};
|