sveld 0.37.7 → 0.37.8

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.
@@ -1,4 +1,4 @@
1
- import{u,t}from"./chunk-8xbe5qy3.js";import{existsSync as O,readdirSync as D,readFileSync as j,statSync as M}from"node:fs";import{createRequire as L}from"node:module";import f from"node:path";var I="__sveld_resolved_props__",E="__SveldResolvedProps__",G=/ \| undefined$/,U=/[^A-Za-z0-9_-]/g,B=/[^A-Za-z0-9_$]/g,q=/^[0-9]/,z=2,A=7,F=`TypeScript ${A} or later, which provides \`typescript/unstable/async\``;function X(e){if(!e)return!1;let n=Number.parseInt(e,10);return Number.isFinite(n)&&n>=A}async function V(e){let n;try{let i=L(f.join(e,"package.json")).resolve("typescript/package.json");n=JSON.parse(j(i,"utf8")).version}catch{return{installed:!1}}if(!X(n))return{installed:!0,version:n};try{let s=await import("./chunk-0r8vwqdc.js");return{installed:!0,version:n,module:s}}catch{return{installed:!0,version:n}}}class C{api;symbolFlags;typeFlags;tsconfigPath;cwd;overlay=new Map;pendingOverlayDeletions=new Set;constructor(e,n,s,i,o){this.api=e,this.symbolFlags=n,this.typeFlags=s,this.tsconfigPath=i,this.cwd=o}static async create(e=process.cwd(),{importTs:n=V}={}){let s=await n(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${F}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${F}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=Y(e);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let o=s.module,r=new C(null,o.SymbolFlags,o.TypeFlags,i,e),a=new o.API({cwd:e,fs:r.createFileSystem()});return r.api=a,{ok:!0,resolver:r}}async expandAll(e){let n=new Map;if(e.length===0)return n;let s=new Map;for(let o of e){if(!o.metadata.canonicalPropsType)continue;if(o.metadata.referencesComponentGenerics)continue;let r=this.virtualFileName(o.filePath,o.moduleName);this.overlay.set(r,W(o.metadata)),s.set(r,o)}if(s.size===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(s.keys())}});try{let[o]=s.keys(),r=await i.getDefaultProjectForFile(o);if(!r)return n;let a=r.checker,h=await Promise.all(Array.from(s,async([c,d])=>{let p=this.overlay.get(c);if(!p)return null;let m=Q(p),l=await a.getTypeAtPosition(c,m);if(!l)return null;let g=new Map,_=await a.getPropertiesOfType(l);for(let T of _){if(!T.name||T.name.startsWith("__"))continue;g.set(T.name,{name:T.name,symbols:[T],forceOptional:!1})}if((l.flags&this.typeFlags.Union)!==0){let T=await l.getTypes(),N=await Promise.all(T.map((w)=>a.getPropertiesOfType(w)));for(let w of N)for(let P of w){if(!P.name||P.name.startsWith("__")||g.has(P.name))continue;let k=g.get(P.name);if(k)k.symbols.push(P);else g.set(P.name,{name:P.name,symbols:[P],forceOptional:!0})}}return{filePath:d.filePath,groups:Array.from(g.values())}})),y=[],S=[];h.forEach((c,d)=>{if(!c)return;c.groups.forEach((p,m)=>{for(let l of p.symbols)y.push(l),S.push({fileIndex:d,groupIndex:m})})});let x=y.length>0?await a.getTypeOfSymbol(y):[],b=await Promise.all(x.map((c)=>c?a.typeToString(c):Promise.resolve("any"))),v=new Map;y.forEach((c,d)=>{let{fileIndex:p,groupIndex:m}=S[d],l=(c.flags&this.symbolFlags.Optional)!==0,g=b[d];if(l)g=g.replace(G,"");let _=v.get(p)??new Map,R=_.get(m)??[];R.push(g),_.set(m,R),v.set(p,_)}),h.forEach((c,d)=>{if(!c)return;let p=v.get(d),m=c.groups.map((l,g)=>{let _=p?.get(g)??[],R=!(l.forceOptional||l.symbols.some((T)=>(T.flags&this.symbolFlags.Optional)!==0));return{name:l.name,type:Array.from(new Set(_)).join(" | "),isRequired:R}});m.sort((l,g)=>u(l.name,g.name)),n.set(c.filePath,m)})}finally{await i.dispose?.()}return n}async checkExamples(e){let n=new Map;if(e.length===0)return n;let s=[];for(let o of e)for(let r of o.sources){let a=this.exampleFileName(o.filePath,o.moduleName,r.id);this.overlay.set(a,J(r)),s.push({filePath:o.filePath,source:r,file:a})}if(s.length===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((o)=>o.file)}});try{let[o]=s,r=await i.getDefaultProjectForFile(o.file);if(!r)return n;await Promise.all(s.map(async({filePath:a,source:h,file:y})=>{let[S,x]=await Promise.all([r.program.getSyntacticDiagnostics(y),r.program.getSemanticDiagnostics(y)]),b=[...S,...x];if(b.length===0)return;let v=this.overlay.get(y)??"",c=b.map((p)=>Z(p,v)).sort((p,m)=>p.line-m.line).map((p)=>`Line ${p.line}: ${p.text}`).join(`
1
+ import{u,t}from"./chunk-2vte7cyp.js";import{existsSync as O,readdirSync as D,readFileSync as j,statSync as M}from"node:fs";import{createRequire as L}from"node:module";import f from"node:path";var I="__sveld_resolved_props__",E="__SveldResolvedProps__",G=/ \| undefined$/,U=/[^A-Za-z0-9_-]/g,B=/[^A-Za-z0-9_$]/g,q=/^[0-9]/,z=2,A=7,F=`TypeScript ${A} or later, which provides \`typescript/unstable/async\``;function X(e){if(!e)return!1;let n=Number.parseInt(e,10);return Number.isFinite(n)&&n>=A}async function V(e){let n;try{let i=L(f.join(e,"package.json")).resolve("typescript/package.json");n=JSON.parse(j(i,"utf8")).version}catch{return{installed:!1}}if(!X(n))return{installed:!0,version:n};try{let s=await import("./chunk-0s0w60zm.js");return{installed:!0,version:n,module:s}}catch{return{installed:!0,version:n}}}class C{api;symbolFlags;typeFlags;tsconfigPath;cwd;overlay=new Map;pendingOverlayDeletions=new Set;constructor(e,n,s,i,o){this.api=e,this.symbolFlags=n,this.typeFlags=s,this.tsconfigPath=i,this.cwd=o}static async create(e=process.cwd(),{importTs:n=V}={}){let s=await n(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${F}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${F}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=Y(e);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let o=s.module,r=new C(null,o.SymbolFlags,o.TypeFlags,i,e),a=new o.API({cwd:e,fs:r.createFileSystem()});return r.api=a,{ok:!0,resolver:r}}async expandAll(e){let n=new Map;if(e.length===0)return n;let s=new Map;for(let o of e){if(!o.metadata.canonicalPropsType)continue;if(o.metadata.referencesComponentGenerics)continue;let r=this.virtualFileName(o.filePath,o.moduleName);this.overlay.set(r,W(o.metadata)),s.set(r,o)}if(s.size===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(s.keys())}});try{let[o]=s.keys(),r=await i.getDefaultProjectForFile(o);if(!r)return n;let a=r.checker,h=await Promise.all(Array.from(s,async([c,d])=>{let p=this.overlay.get(c);if(!p)return null;let m=Q(p),l=await a.getTypeAtPosition(c,m);if(!l)return null;let g=new Map,_=await a.getPropertiesOfType(l);for(let T of _){if(!T.name||T.name.startsWith("__"))continue;g.set(T.name,{name:T.name,symbols:[T],forceOptional:!1})}if((l.flags&this.typeFlags.Union)!==0){let T=await l.getTypes(),N=await Promise.all(T.map((w)=>a.getPropertiesOfType(w)));for(let w of N)for(let P of w){if(!P.name||P.name.startsWith("__")||g.has(P.name))continue;let k=g.get(P.name);if(k)k.symbols.push(P);else g.set(P.name,{name:P.name,symbols:[P],forceOptional:!0})}}return{filePath:d.filePath,groups:Array.from(g.values())}})),y=[],S=[];h.forEach((c,d)=>{if(!c)return;c.groups.forEach((p,m)=>{for(let l of p.symbols)y.push(l),S.push({fileIndex:d,groupIndex:m})})});let x=y.length>0?await a.getTypeOfSymbol(y):[],b=await Promise.all(x.map((c)=>c?a.typeToString(c):Promise.resolve("any"))),v=new Map;y.forEach((c,d)=>{let{fileIndex:p,groupIndex:m}=S[d],l=(c.flags&this.symbolFlags.Optional)!==0,g=b[d];if(l)g=g.replace(G,"");let _=v.get(p)??new Map,R=_.get(m)??[];R.push(g),_.set(m,R),v.set(p,_)}),h.forEach((c,d)=>{if(!c)return;let p=v.get(d),m=c.groups.map((l,g)=>{let _=p?.get(g)??[],R=!(l.forceOptional||l.symbols.some((T)=>(T.flags&this.symbolFlags.Optional)!==0));return{name:l.name,type:Array.from(new Set(_)).join(" | "),isRequired:R}});m.sort((l,g)=>u(l.name,g.name)),n.set(c.filePath,m)})}finally{await i.dispose?.()}return n}async checkExamples(e){let n=new Map;if(e.length===0)return n;let s=[];for(let o of e)for(let r of o.sources){let a=this.exampleFileName(o.filePath,o.moduleName,r.id);this.overlay.set(a,J(r)),s.push({filePath:o.filePath,source:r,file:a})}if(s.length===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((o)=>o.file)}});try{let[o]=s,r=await i.getDefaultProjectForFile(o.file);if(!r)return n;await Promise.all(s.map(async({filePath:a,source:h,file:y})=>{let[S,x]=await Promise.all([r.program.getSyntacticDiagnostics(y),r.program.getSemanticDiagnostics(y)]),b=[...S,...x];if(b.length===0)return;let v=this.overlay.get(y)??"",c=b.map((p)=>Z(p,v)).sort((p,m)=>p.line-m.line).map((p)=>`Line ${p.line}: ${p.text}`).join(`
2
2
  `),d=n.get(a)??[];d.push({id:h.id,name:h.name,message:c}),n.set(a,d)}))}finally{await i.dispose?.()}return n}forgetOverlayFiles(e){for(let n of e)if(this.overlay.delete(n))this.pendingOverlayDeletions.add(n)}async openBareTypeSession(e){for(let[r,a]of e)this.overlay.set(r,a);let n=Array.from(this.pendingOverlayDeletions).filter((r)=>!e.has(r));this.pendingOverlayDeletions.clear();let s=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(e.keys()),deleted:n}}),i=`${t(f.join(this.cwd,"node_modules"))}/`;return{resolveAt:async(r,a)=>{let h=await s.getDefaultProjectForFile(r);if(!h)return{kind:"unresolved"};let y=h.checker,S=await y.getSymbolAtPosition(r,a);if(!S)return{kind:"unresolved"};let x=await y.getAliasedSymbol(S);if(await y.isUnknownSymbol(x))return{kind:"unresolved"};let b=x.declarations??[];if(b.length===0)return{kind:"unresolved"};let v=await Promise.all(b.map((l)=>l.resolve())),c=v.findIndex((l)=>l&&t(l.getSourceFile().fileName).startsWith(i)),d=c===-1?v.findIndex((l)=>l!==void 0):c,p=d===-1?void 0:v[d];if(!p)return{kind:"unresolved"};let m=p.getSourceFile();if(await h.program.isSourceFileDefaultLibrary(m))return{kind:"default-lib"};return{kind:"resolved",filePath:m.fileName,declaredName:x.name}},dispose:()=>s.dispose?.()??Promise.resolve()}}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(e)=>this.overlay.get(t(e)),fileExists:(e)=>this.overlay.has(t(e))?!0:void 0,getAccessibleEntries:(e)=>{let n=t(e),s=Array.from(this.overlay.keys()).filter((r)=>t(f.dirname(r))===n);if(s.length===0)return;let i=[],o=[];try{for(let r of D(e)){let a=f.join(e,r);try{(M(a).isDirectory()?o:i).push(r)}catch{}}}catch{}for(let r of s){let a=f.basename(r);if(!i.includes(a))i.push(a)}return{files:i,directories:o}}}}virtualFileName(e,n){let s=f.dirname(f.resolve(e));return t(f.join(s,`__sveld_resolved_${n}.ts`))}exampleFileName(e,n,s){let i=f.dirname(f.resolve(e)),o=s.replace(U,"_");return t(f.join(i,`__sveld_example_${n}_${o}.ts`))}}function W(e){return[...e.typeImportStatements,...e.localTypeDeclarations,`type ${E} = ${e.canonicalPropsType};`,`declare const ${I}: ${E};`].join(`
3
3
  `)}function H(e){let n=e.replace(B,"_");if(n===""||q.test(n))return`_${n}`;return n}function J(e){return`const ${H(e.name)} = null as unknown as (${e.type});
4
4
  ${e.code}
@@ -0,0 +1 @@
1
+ import{o}from"./chunk-sg7vsn8d.js";export{o as default};
@@ -1,4 +1,4 @@
1
- import{h,e,O,y,g,Pe,w,Q,r,pe,T,ue,ne,n,s,f,b,m,le,Ae,De,E,P,l,a,_e,fe,de,Ne,re,me,S,Ie,he,q,V,x,Re,U,se,i,ye,W,Le,Oe,Me,Be,je,ge,H,xe,$e,ie,G,k,Fe,Je,qe,Ve,Te,Ue,z,Ee,We,be,v,d,He,Ge,Se,C,M}from"./chunk-8xbe5qy3.js";var Bt={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function pn(t){return t in Bt}function Ft(t){if(pn(t))return Bt[t];return"HTMLElement"}var ln=new Set(["MethodDefinition","PropertyDefinition","AccessorProperty"]);function dn(t){if(t.computed||!t.key)return;if(t.key.type==="Identifier")return t.key.name;if(t.key.type==="Literal"&&(typeof t.key.value==="string"||typeof t.key.value==="number"))return String(t.key.value);return}function jt(t){return t==="private"||t==="protected"}function mt(t){return{...t?.description?{description:t.description}:{},...t?.deprecated===void 0?{}:{deprecated:t.deprecated},...t?.tags?{tags:t.tags}:{}}}function Ot(t){return t?.slice(1,-1).trim()||void 0}function vt(t,c,u){let p=fe(t,c),D=new Map((u?.params??[]).map((R)=>[R.name,R])),L=p.params.map(({name:R,type:J,optional:X,rest:ae})=>{let Y=D.get(R);return{name:ae?`...${R}`:R,type:J??Y?.type??(ae?"any[]":"any"),...Y?.description?{description:Y.description}:{},...!ae&&(X||Y?.optional)?{optional:!0}:{}}}),j=p.returnType??u?.returnType??(c.async?"Promise<any>":void 0),F=Ot(p.typeParameters)??u?.typeParameters;return{...L.length>0?{params:L}:{},...j?{returnType:j}:{},...F?{typeParameters:F}:{}}}function $t(t,c,u){let p=[],D=new Map,L=new Set,j=new Set,F,R=-1;for(let ae of u.body?.body??[]){let Y=ae;if(!ln.has(Y.type)||jt(Y.accessibility))continue;let ze=dn(Y);if(ze===void 0)continue;let ve=d(t,c,Y);if(ve?.internal)continue;let Ze=`${Y.static?"static ":""}${ze}`,Ye={...Y.static?{static:!0}:{},...Y.optional?{optional:!0}:{},...Y.abstract?{abstract:!0}:{}};if(Y.type!=="MethodDefinition"){if(a(t,Y.typeAnnotation?.typeAnnotation),!Y.static)j.add(ze);p.push({kind:"property",name:ze,type:E(t,Y.typeAnnotation)??ve?.type??"any",...Ye,...Y.readonly?{readonly:!0}:{},...mt(ve)});continue}let pt=Y.value,Qe=Y.typeParameters?{...pt,typeParameters:Y.typeParameters}:pt;if(Y.kind==="constructor"){let lt=vt(t,Qe,ve);p.push({kind:"constructor",name:"constructor",params:lt.params,...mt(ve)}),R=p.length,F=Qe.body?.body,(Qe.params??[]).forEach((Xe,ct)=>{if(Xe.type!=="TSParameterProperty"||jt(Xe.accessibility))return;let it=lt.params?.[ct];if(!it)return;j.add(it.name),p.push({kind:"property",name:it.name,type:it.type,...Xe.readonly?{readonly:!0}:{},...it.description?{description:it.description}:{}})});continue}if(Y.kind==="get"||Y.kind==="set"){let lt=vt(t,Qe,ve),rt=Y.kind==="get"?lt.returnType??ve?.type:lt.params?.[0]?.type??ve?.type,Xe=D.get(Ze);if(Xe){if(Y.kind==="set")Xe.readonly=void 0;if(rt&&rt!=="any"&&(Xe.type==="any"||Y.kind==="get"))Xe.type=rt;if(!Xe.description&&!Xe.deprecated)Object.assign(Xe,mt(ve));continue}let ct={kind:"property",name:ze,type:rt??"any",...Ye,...Y.kind==="get"?{readonly:!0}:{},...mt(ve)};D.set(Ze,ct),p.push(ct);continue}if(Qe.type==="TSDeclareMethod"&&!Y.abstract)L.add(Ze);else if(Qe.type!=="TSDeclareMethod"&&L.has(Ze))continue;p.push({kind:"method",name:ze,...Ye,...vt(t,Qe,ve),...mt(ve)})}if(t.scriptLanguage!=="ts"&&F)p.splice(R,0,...mn(t,c,F,j));for(let ae of u.typeParameters?.params??[])a(t,ae.constraint),a(t,ae.default);let J=Ot(P(t,u.typeParameters)),X=un(t,u);return{members:p,...J?{typeParameters:J}:{},...X}}function un(t,c){let u={},p=c.superClass;if(p){if(u.extends=P(t,{start:p.start,end:c.superTypeParameters?.end??p.end}),p.type==="Identifier")Vt(t,p,c.superTypeParameters)}let D=(c.implements??[]).map((L)=>(Vt(t,L.expression,L.typeParameters),P(t,L))).filter((L)=>Boolean(L));if(D.length>0)u.implements=D;return u}function Vt(t,c,u){a(t,{type:"TSTypeReference",typeName:c,...u?{typeParameters:u}:{}})}function mn(t,c,u,p){let D=[];for(let L of u){let j=L.type==="ExpressionStatement"?L.expression:void 0;if(j?.type!=="AssignmentExpression"||j.operator!=="=")continue;let F=j.left;if(F?.type!=="MemberExpression"||F.computed||F.object?.type!=="ThisExpression")continue;let R=F.property?.type==="Identifier"?F.property.name:void 0;if(!R||p.has(R))continue;p.add(R);let J=d(t,c,L);if(J?.internal)continue;D.push({kind:"property",name:R,type:J?.type??"any",...mt(J)})}return D}function Mt(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,sourceLineHint:void 0,parsedJsDocByText:new Map,jsDocBlocksByStart:new Map,functionDocCommentStarts:new Set,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingConstDefaultCandidates:[],pendingContextKeyCandidates:[],pendingDispatchEscapeCandidates:[],deferredEventNoSourceDiagnostics:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,explicitVariableTypeNodesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,untypedJsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}var fn=new Set(["Component","SvelteComponent","SvelteSelf"]),yn=new Set(["RegularElement","SvelteElement"]);function Tt(t){return fn.has(t)}function bt(t){return yn.has(t)}function gn({hasTypeScriptType:t,hasJSDocType:c,inferredType:u,finalType:p}){if(t)return"typescript";if(c)return"jsdoc";if(u!==void 0)return"default";if(p!==void 0)return"inferred";return"unknown"}function Et(t){let c=t.explicitType??t.jsdocType??t.resolvedType??t.typeSeed,u=t.jsdocParams??t.resolvedParams,p=t.jsdocReturnType??t.resolvedReturnType;if((t.isFunctionDeclaration?c==="() => any":t.initializerIsFunction&&c===t.typeSeed)&&p){let J=t.jsdocTypeParameters?`<${t.jsdocTypeParameters}>`:"";c=u&&u.length>0?`${J}(${b(u)}) => ${p}`:`${J}() => ${p}`}let L=t.jsdocDescription??t.resolvedDescription;if(L===void 0&&c!==void 0)L=t.typedefs?.get(c)?.description;let j=gn({hasTypeScriptType:t.explicitType!==void 0,hasJSDocType:t.jsdocType!==void 0||t.jsdocParams!==void 0||t.jsdocReturnType!==void 0||t.resolvedType!==void 0,inferredType:t.inferredTypeForSource,finalType:c}),F=t.initializerIsFunction||t.isFunctionDeclaration||t.inferIsFunctionFromTypeSignature===!0&&(!!t.jsdocParams?.length||t.jsdocReturnType!==void 0||!!t.jsdocType?.includes("=>")||!!t.resolvedType?.includes("=>")||!!t.explicitType?.includes("=>")),R=F?t.jsdocTypeParameters:void 0;return{type:c,typeSource:j,description:L,params:u,returnType:p,isFunction:F,typeParameters:R}}function hn(t){if(!t||typeof t!=="object"||!("type"in t))return;let c=String(t.type),u=Tt(c);if(!u&&!bt(c))return;let p="name"in t&&typeof t.name==="string"?t.name:void 0;if(!p)return;let D=u?{type:"InlineComponent",name:p}:{type:"Element",name:p};if(p==="svelte:element"&&"tag"in t&&t.tag&&typeof t.tag==="object"){let L=t.tag;if(L.type==="Literal"&&typeof L.value==="string")D.thisValue=L.value}return D}function Jt(t,c){let u=hn(c);if(!u)return;if(t.rest_props===void 0){t.rest_props=u;return}if(t.rest_props.type==="InlineComponent"&&u.type==="Element")t.rest_props=u}var Kt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function xn(t,c){switch(c?.type){case"MemberExpression":return c.computed||t===c.object;case"MethodDefinition":return!!c.computed;case"MetaProperty":return t===c.meta;case"PropertyDefinition":return c.computed||t===c.value;case"Property":return c.computed||t===c.value;case"ExportSpecifier":case"ImportSpecifier":return t===c.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}var Tn=Array.from(Kt);function Gt(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95||t===36}function bn(t){if(t.includes("\\u"))return!0;for(let c of Tn){let u=t.indexOf(c);while(u!==-1){if(!Gt(t.charCodeAt(u-1))&&!Gt(t.charCodeAt(u+c.length)))return!0;u=t.indexOf(c,u+1)}}return!1}function En(t,c){for(let u=c.length-1;u>=0;u-=1)if(c[u]?.has(t))return!0;return!1}function Sn(t){let c=new Set;if(!t||typeof t!=="object"||!("type"in t))return c;switch(String(t.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let u=t;if(u.id?.name)c.add(u.id.name);for(let p of u.params??[])i(p,c);break}case"BlockStatement":Pt(t.body,c);break;case"CatchClause":i(t.param,c);break;case"EachBlock":{let u=t;if(i(u.context,c),typeof u.index==="string")c.add(u.index);else if(u.index?.name)c.add(u.index.name);break}case"AwaitBlock":{let u=t;i(u.value,c),i(u.error,c);break}}return c}function Pt(t,c){if(!Array.isArray(t))return;for(let u of t){if(!u||typeof u!=="object"||!("type"in u))continue;switch(String(u.type)){case"ImportDeclaration":for(let p of u.specifiers??[])if(p.local?.name)c.add(p.local.name);break;case"VariableDeclaration":for(let p of u.declarations??[])i(p.id,c);break;case"FunctionDeclaration":case"ClassDeclaration":{let p=u.id?.name;if(p)c.add(p);break}case"ExportNamedDeclaration":{let p=u.declaration;if(p&&typeof p==="object"&&"type"in p)Pt([p],c);break}}}}function Nt(t,c){if(!t||typeof t!=="object")return!1;return Lt(t,void 0,[...c])}function Lt(t,c,u){if(Se(t.type))return!1;let p=W(t);if(p)u.push(Sn(t));let D=!1;if(c&&t.type==="Identifier"&&t.name!==void 0&&Kt.has(t.name)&&!c.type.startsWith("TS")&&xn(t,c)&&!En(t.name,u))D=!0;else for(let L in t){if(L==="leadingComments")continue;let j=t[L];if(!j||typeof j!=="object")continue;if(Array.isArray(j)){for(let F=0;F<j.length;F++){let R=j[F];if(R&&typeof R==="object"&&typeof R.type==="string"){if(Lt(R,t,u)){D=!0;break}}}if(D)break}else if(typeof j.type==="string"){if(Lt(j,t,u)){D=!0;break}}}if(p)u.pop();return D}function zt(t){if(!t||typeof t!=="object")return;if("content"in t){let c=t.content,u=c&&typeof c==="object"&&"body"in c?c.body:void 0;if(Array.isArray(u))return u}if("body"in t&&Array.isArray(t.body))return t.body;return}function Ut(t){if(t.runesOptionOverride!==void 0)return t.runesOptionOverride?"runes":"legacy";let c=t.parsed;if(!c)return"legacy";if(t.source!==void 0&&!bn(t.source))return"legacy";let u=new Set;Pt(zt(c.module),u);let p=new Set;return Pt(zt(c.instance),p),Nt(c.module,[u])||Nt(c.instance,[u,p])||Nt(c.fragment,[u,p])?"runes":"legacy"}var Pn=/[A-Za-z_$][\w$]*/g;function Cn(t,c,u){let p=new Map,D=c.typeParameters?.params,L=u.typeArguments?.params;if(!D?.length||!L?.length)return p;for(let j=0;j<D.length;j++){let F=D[j]?.name,R=L[j];if(!F||R?.start===void 0||R?.end===void 0)continue;let J=s(t,R.start,R.end)?.trim();if(J)p.set(F,J)}return p}function Dn(t,c){if(c.size===0)return t;return t.replace(Pn,(u)=>c.get(u)??u)}function ft(t,c,u,p,D=new Set){let L=new Map;if(!u?.type)return L;let j=(F)=>{for(let R of F){if(R?.type!=="TSPropertySignature"||R.computed)continue;if(!R.key)continue;let J=t.getPropertyName(R.key);if(!J)continue;let X=R.typeAnnotation?.start,ae=R.typeAnnotation?.end;if(X===void 0||ae===void 0)continue;let Y=s(c,X+1,ae)?.trim();if(!Y)continue;a(c,R.typeAnnotation?.typeAnnotation),L.set(J,{type:Y,optional:R.optional===!0,source:n(c,R)})}};switch(u.type){case"TSTypeLiteral":j(u.members??[]);break;case"TSInterfaceDeclaration":j(u.body?.body??[]);break;case"TSTypeAliasDeclaration":{let F=ft(t,c,u.typeAnnotation,p,D);for(let[R,J]of F)L.set(R,J);break}case"TSTypeReference":{let F=De(u.typeName);if(!F||D.has(F))break;let R=p.get(F);if(!R)break;D.add(F);let J=ft(t,c,R,p,D);D.delete(F);let X=Cn(c,R,u);for(let[ae,Y]of J)L.set(ae,X.size===0?Y:{...Y,type:Dn(Y.type,X)});break}case"TSIntersectionType":for(let F of u.types??[]){let R=ft(t,c,F,p,D);for(let[J,X]of R)L.set(J,X)}break;case"TSParenthesizedType":{let F=ft(t,c,u.typeAnnotation,p,D);for(let[R,J]of F)L.set(R,J);break}}return L}function vn(t){let c={};for(let[u,p]of Object.entries(t))c[u]={...p.attribute===void 0?{}:{attribute:p.attribute},...p.reflect===void 0?{}:{reflect:p.reflect},...p.type===void 0?{}:{type:p.type}};return c}function kt(t,c,u){if(c.type==="ImportDeclaration"&&c.source?.value)for(let D of c.specifiers??[]){let L=D.local?.name;if(!L)continue;if(!(c.importKind==="type"||D.importKind==="type"))continue;let F,R;if(D.type==="ImportSpecifier")F="named",R=D.imported?.type==="Identifier"?D.imported.name:typeof D.imported?.value==="string"?D.imported.value:void 0;else if(D.type==="ImportDefaultSpecifier")F="default";else if(D.type==="ImportNamespaceSpecifier")F="namespace";if(!F)continue;t.typeImportBindingsByLocalName.set(L,{importedName:R,localName:L,source:String(c.source.value),specifierType:F})}let p=c.type==="TSEnumDeclaration";if((p||c.type==="TSInterfaceDeclaration"||c.type==="TSTypeAliasDeclaration")&&c.id?.name&&c.start!==void 0&&c.end!==void 0){let D=p?_e(t,c):s(t,c.start,c.end)?.trim();t.localTypeDeclarationsByName.set(c.id.name,{code:D??"",node:c,start:c.start,...u?{exported:u}:{}})}}function qt(t,c,u){if(c.runesPropsDeclarationMetadataByDeclaratorStart.clear(),c.explicitPropTypesByName.clear(),c.explicitVariableTypesByName.clear(),c.explicitVariableTypeNodesByName.clear(),c.typeImportBindingsByLocalName.clear(),c.localTypeDeclarationsByName.clear(),c.additionalTypeDependencyNodes.length=0,c.typedRunesPropsDeclarations.length=0,!c.source)return;let p=u;c.scriptLanguage=t.resolveScriptLanguage(p);let D=p.options?.customElement;c.customElementTag=D?.tag,c.customElement=D?{...D.tag===void 0?{}:{tag:D.tag},...D.shadow==="open"||D.shadow==="none"?{shadow:D.shadow}:{},...D.props?{props:vn(D.props)}:{},...D.extend===void 0?{}:{extend:!0}}:void 0,c.runesOptionOverride=p.options?.runes,c.scriptGenericsAttribute=t.resolveScriptGenericsAttribute(p);let L=p.module?.content?.body??[],j=new Set;for(let R of L){if(!R?.type)continue;if(R.type==="ExportNamedDeclaration"&&R.declaration)kt(c,R.declaration,!0);else if(R.type==="ExportNamedDeclaration"&&!R.source)for(let J of R.specifiers??[]){let X=J.local?.name;if(X&&X===J.exported?.name)j.add(X)}else kt(c,R,!1)}for(let R of j){let J=c.localTypeDeclarationsByName.get(R);if(J)J.exported=!0}let F=p.instance?.content?.body??[];for(let R of F){if(!R?.type)continue;if(kt(c,R,!1),R.type==="ExportNamedDeclaration"&&R.declaration?.type==="VariableDeclaration")for(let J of R.declaration.declarations??[]){if(J.id?.type!=="Identifier"||!J.id.name)continue;let X=E(c,J.id.typeAnnotation);if(X)c.explicitPropTypesByName.set(J.id.name,X),a(c,J.id.typeAnnotation?.typeAnnotation)}else if(R.type==="VariableDeclaration")for(let J of R.declarations??[]){if(J.id?.type!=="Identifier"||!J.id.name)continue;let X=E(c,J.id.typeAnnotation);if(X){c.explicitVariableTypesByName.set(J.id.name,X);let ae=J.id.typeAnnotation?.typeAnnotation;if(ae)c.explicitVariableTypeNodesByName.set(J.id.name,ae)}}}for(let R of F){if(!R||typeof R!=="object"||!("declarations"in R))continue;for(let J of R.declarations??[]){if(!y(g(J.init),"$props"))continue;let X=J.id?.typeAnnotation?void 0:Pe(J.init),ae=J.id?.typeAnnotation?.typeAnnotation??X,Y=J.id?.typeAnnotation?E(c,J.id.typeAnnotation):P(c,X),ze=ft(t,c,ae,new Map(Array.from(c.localTypeDeclarationsByName.entries(),([Ye,pt])=>[Ye,pt.node]))),ve=new Set,Ze=new Set;if(l(c,ae,ve,Ze),Ve(c,ve,Ze),J.start!==void 0){let Ye={canonicalType:Y,props:ze,referencedImportedTypes:ve,referencedLocalTypes:Ze};if(c.runesPropsDeclarationMetadataByDeclaratorStart.set(J.start,Ye),Y)c.typedRunesPropsDeclarations.push(Ye)}}}}function Wt(t,c,u){for(let p of u.declarations){if(!y(g(p.init),"$props"))continue;if(p.id.type==="Identifier"){c.wholePropsLocals.add(p.id.name),c.restPropLocals.add(p.id.name);let j=le(c,p.start);if(j)for(let[F,R]of j.props)q(t,c,F,{name:F,kind:"let",type:R.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!R.optional,constant:!1,reactive:!1,source:R.source});continue}if(p.id.type!=="ObjectPattern")continue;let D=d(c,t,u),L=p.id.properties.filter((j)=>{if(j.type!=="Property"||j.computed)return!1;if(!t.getPropertyName(j.key))return!1;if(j.value.type==="Identifier")return!0;return j.value.type==="AssignmentPattern"&&j.value.left.type==="Identifier"}).length;for(let j of p.id.properties){if(j.type==="RestElement"){if(j.argument.type==="Identifier")c.restPropLocals.add(j.argument.name);continue}let F=t.getPropertyName(j.key);if(!F)continue;let R,J;if(j.value.type==="Identifier")R=j.value.name;else{let gt=j.value;R=gt.left.name,J=gt.right}if(!R)continue;if(t.trackPropLocalName(F,R),F==="children")c.snippetPropLocals.add(R);let X=He(c,t,j)??(L===1?D:void 0),ae=Ae(c,p.start,F),{init:Y,bindable:ze}=Re(J),ve=Y==null?{isFunction:!1}:x(t,c,Y),{value:Ze,type:Ye,isFunction:pt,defaultValue:Qe}=ve,lt=ae?.type===void 0&&X?.type===void 0?ve.resolvedType:void 0;V(c,ve,F,"props");let{type:rt,typeSource:Xe,description:ct,params:it,returnType:yt,isFunction:St}=Et({explicitType:ae?.type,typeSeed:Ye,inferredTypeForSource:Ye,jsdocType:X?.type,jsdocDescription:X?.description,jsdocParams:X?.params,jsdocReturnType:X?.returnType,resolvedType:lt,resolvedDescription:ve.resolvedDescription,resolvedParams:ve.resolvedParams,resolvedReturnType:ve.resolvedReturnType,initializerIsFunction:pt,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(ze)c.reactive_vars.add(F);T(c,"prop-unknown-type",F,X?.sveldIgnore),q(t,c,F,{name:F,...R===F?{}:{localName:R},kind:"let",description:ct,binding:X?.binding,deprecated:X?.deprecated,tags:X?.tags,...X?.internal?{internal:!0}:{},...ze?{bindable:!0}:{},type:rt,typeSource:Xe,value:Ze,defaultValue:Qe,params:it,returnType:yt,isFunction:St,isFunctionDeclaration:!1,isRequired:!ze&&Y==null&&ae?.optional!==!0,constant:!1,reactive:ze,source:n(c,j)})}}}function Mn(t){let u=t.indexOf("EventDispatcher");if(u===-1)return;let p=u+15;while(t[p]===" ")p++;if(t[p]!=="<")return;let D=0,L=p;for(;p<t.length;p++)if(t[p]==="<")D++;else if(t[p]===">"){if(D--,D===0)return t.slice(L+1,p)}return}function Xt(t,c){let u=t[c];for(let p=c+1;p<t.length;p++)if(t[p]==="\\")p++;else if(t[p]===u)return p;return t.length}function Nn(t){let c=[],u=0,p=0;for(let D=0;D<t.length;D++){let L=t[D];if(L==='"'||L==="'")D=Xt(t,D);else if(L==="{"||L==="("||L==="["||L==="<")u++;else if(L==="}"||L===")"||L==="]"||L===">")u=Math.max(u-1,0);else if(u===0&&(L===";"||L===","))c.push(t.slice(p,D)),p=D+1}return c.push(t.slice(p)),c.map((D)=>D.trim()).filter((D)=>D.length>0)}var Ln=/^["']|["']$/g,kn=/\?$/,Rn=/^\{/,wn=/\}$/;function An(t){let c=0;for(let u=0;u<t.length;u++){let p=t[u];if(p==='"'||p==="'")u=Xt(t,u);else if(p==="{"||p==="("||p==="["||p==="<")c++;else if(p==="}"||p===")"||p==="]"||p===">")c=Math.max(c-1,0);else if(c===0&&p===":"){let D=t.slice(0,u).trim().replace(kn,"").replace(Ln,""),L=t.slice(u+1).trim();if(!D||!L)return;return{name:D,type:L}}}return}function Yt(t,c,u,p,D){if(u){let R=new Map(Array.from(c.localTypeDeclarationsByName.entries(),([X,ae])=>[X,ae.node])),J=ft(t,c,u,R);for(let[X,ae]of J)k(c,{name:X,detail:ae.type,has_argument:!0,source:ae.source});return}let L=t.resolveLocalVarJSDoc(p)?.type,j=L?Mn(L):void 0;if(!j)return;let F=j.trim().replace(Rn,"").replace(wn,"");for(let R of Nn(F)){let J=An(R);if(!J)continue;k(c,{name:J.name,detail:J.type,has_argument:!0,source:D})}}function Qt(t,c){if(t.syntaxMode!=="runes")return;for(let[u,p]of Array.from(t.events.entries())){if(p.type!=="dispatched")continue;if(c.has(u)||t.forwardedEvents.has(u))continue;let D=`on${u}`,L=t.props.get(D);if(!L)continue;let j=L.type!==void 0||L.params!==void 0||L.returnType!==void 0,F=p.detail===void 0||p.detail==="undefined"||p.detail==="null"?"() => void":`(detail: ${p.detail}) => void`;t.props.set(D,{...L,description:L.description??p.description,type:j?L.type:F,typeSource:j?L.typeSource:"inferred",isFunction:!0}),t.events.delete(u)}}var Zt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function Rt(t){return t!==null&&typeof t==="object"&&typeof t.type==="string"}function en(t){if(!Zt.has(t.type))return t;let c=t.expression;while(c&&Zt.has(c.type))c=c.expression;return c??t}function Ct(t){if(!Rt(t))return;wt(t)}function wt(t){for(let c in t){if(c==="leadingComments")continue;let u=t[c];if(!u||typeof u!=="object")continue;if(Array.isArray(u))for(let p=0;p<u.length;p++){let D=u[p];if(!Rt(D))continue;let L=en(D);if(L!==D)u[p]=L;wt(L)}else if(Rt(u)){let p=en(u);if(p!==u)t[c]=p;wt(p)}}}function In(t,c,u,p,D){for(let L of t){if(L.type!=="Block"||L.start<u||L.end>p)continue;D.push({start:L.start,end:L.end,isJsDoc:L.end-L.start>4&&c.startsWith("/**",L.start)})}}function tn(t,c,u){if(!t||typeof t!=="object"||!("type"in t))return;let p=t;if(p.type==="FunctionDeclaration"){if(p.id?.type==="Identifier"&&p.id.name)u.push({name:p.id.name,start:c});return}if(p.type==="VariableDeclaration"){for(let D of p.declarations??[])if(D?.id?.type==="Identifier"&&D.id.name)u.push({name:D.id.name,start:c})}}function _n(t){let c=[];for(let u of t){if(!u||typeof u!=="object"||!("type"in u))continue;let p=u;if(p.start===void 0)continue;if(p.type==="ExportNamedDeclaration"&&p.declaration)tn(p.declaration,p.start,c);else tn(p,p.start,c)}return c}function Hn(t,c,u){let p=0,D=t.length;while(p<D){let L=p+D>>>1;if(t[L].end<=c)p=L+1;else D=L}for(let L=p-1;L>=0;L--){let j=t[L];if(!j.isJsDoc)continue;return Ee(u,j.end,c)?j:void 0}return}function nn(t,c){let u=new Map;if(!t.source)return u;let p=[t.parsed?.module,t.parsed?.instance],D=[],L=[],j=t.parsed?.comments??[];for(let F of p){let R=F?.content;if(!R?.body||R.start===void 0||R.end===void 0)continue;In(j,t.source,R.start,R.end,D),L.push(..._n(R.body))}D.sort((F,R)=>F.end-R.end);for(let F of L){let R=Hn(D,F.start,t.source);if(!R)continue;let J=be(t,t.source.slice(R.start,R.end)),{type:X,description:ae,ignore:Y,internal:ze}=v(J);if(Y.length>0)T(t,"context-any-type",F.name,Y);if(!X&&!ae&&!ze)continue;u.set(F.name,{type:X?c.aliasType(X.type):void 0,description:ae||X&&We(X),internal:ze||void 0})}return u}function At(t){if(t?.type==="Identifier")return t.name;return typeof t?.value==="string"?t.value:void 0}function rn(t,c){for(let u of(t&&S(t))??[]){let p=u,D=p.type==="ExportNamedDeclaration"&&p.declaration?p.declaration:p;if(D.type==="VariableDeclaration"){let L=D.declarations.find((j)=>j.id.type==="Identifier"?j.id.name===c:i(j.id).has(c));if(L)return{declaration:D,declarator:L,statement:p}}else if((D.type==="FunctionDeclaration"||D.type==="ClassDeclaration")&&D.id?.name===c)return{declaration:D,statement:p}}return}function Bn(t,c){for(let u of(t&&S(t))??[]){let p=u;if(p.type!=="LabeledStatement"||p.label.name!=="$")continue;if(p.body.type!=="ExpressionStatement")continue;let D=p.body.expression;if(D.type!=="AssignmentExpression"||D.operator!=="=")continue;if(!i(D.left).has(c))continue;let L={type:"VariableDeclarator",id:D.left,init:D.right};return{declaration:{type:"VariableDeclaration",kind:"let",declarations:[L]},declarator:L,statement:p}}return}function on(t){if(t==="var")return"let";if(t==="using"||t==="await using")return"const";return t}var Fn=null,sn=/^@component/,jn=/^[A-Za-z_$][\w$]*(?=\s*(?:<|$))/,Vn=/\r/g,On=/^\{\s*\}$/,$n=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class o{ctx=Mt();static mapToArray(t){return Array.from(t,([c,u])=>u)}static getStaticAttributeValue(t){if(!Array.isArray(t.value))return;return t.value.map((c)=>c.data??c.raw??"").join("").trim()}resolveScriptLanguage(t){let c=[t.instance,t.module].filter((p)=>p!==void 0),u=!1;for(let p of c){let D=p.attributes?.find((j)=>j.name==="lang");if(!D){u=!0;continue}if(o.getStaticAttributeValue(D)?.toLowerCase()==="ts")return"ts"}return u?"js":void 0}resolveScriptGenericsAttribute(t){let c=t.instance?.attributes?.find((j)=>j.name==="generics");if(!c)return;let u=n(this.ctx,c),p=t.instance?.attributes?.find((j)=>j.name==="lang");if((p?o.getStaticAttributeValue(p)?.toLowerCase():void 0)!=="ts"){r(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',u);return}let L=o.getStaticAttributeValue(c);if(!L)return;return{value:L,source:u}}resolvePublicPropName(t){return this.ctx.propLocalToPublicName.get(t)??t}trackPropLocalName(t,c=t){this.ctx.propLocalToPublicName.set(c,t)}getPropByLocalOrPublic(t){return this.ctx.props.get(this.resolvePublicPropName(t))}getPropTypeByLocalOrPublic(t){return this.getPropByLocalOrPublic(t)?.type}getExplicitPropType(t){return this.ctx.explicitPropTypesByName.get(t)}getPropertyName(t){if(!t||typeof t!=="object"||!("type"in t))return;if(e(t))return t.name;if(h(t))return t.value==null?void 0:String(t.value);return}isNumericConstant(t){if(!t||typeof t!=="object"||!("type"in t))return!1;if(t.type!=="MemberExpression")return!1;let c=t,u=c.object&&"name"in c.object?c.object.name:void 0,p=c.property&&"name"in c.property?c.property.name:void 0;if(!u||!p)return!1;if(u==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(p);if(u==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(p);return!1}resolveLocalVarJSDoc(t){for(let u of this.ctx.vars)if(u.declarations.some((D)=>D.id&&typeof D.id==="object"&&("type"in D.id)&&D.id.type==="Identifier"&&("name"in D.id)&&D.id.name===t))return d(this.ctx,this,u);let c=this.ctx.funcDecls.get(t);if(c)return d(this.ctx,this,c);return}addModuleExport(t,c){if(m(t)===void 0)return;if(this.ctx.moduleExports.has(t)){let u=this.ctx.moduleExports.get(t);this.ctx.moduleExports.set(t,{...u,...c})}else this.ctx.moduleExports.set(t,c)}resolveExportSpecifier(t,c,u,p){let D=At(c.local),L=At(c.exported);if(!D||!L)return;if(t.source!=null)return{localName:D,exportedName:L};let j=rn(u,D);if(!j&&p==="instance"){let F=this.ctx.parsed?.module;j=rn(F,D)??Bn(u,D)}return{localName:D,exportedName:L,...j}}recordUnresolvedExportSpecifier(t,c,u){let p=t.source?.value,D=typeof p==="string"?`it re-exports from "${p}"`:this.ctx.valueImportBindingsByLocalName.has(c)?"it re-exports an imported binding":"no matching local declaration was found";r(this.ctx,"export-unresolved",u,`export "${u}" was skipped because ${D}; sveld only resolves exports of a local declaration.`,n(this.ctx,t))}exportJSDoc(t,c){if(!c)return d(this.ctx,this,t);let u=t.specifiers.length===1?d(this.ctx,this,t):void 0,p=d(this.ctx,this,c.statement);if(!u||!p)return u??p;let D=Object.fromEntries(Object.entries(u).filter(([,L])=>L!==void 0));return{...p,...D,internal:u.internal||p.internal}}recordClassExport(t,c){r(this.ctx,"export-unresolved",c,`export "${c}" was skipped because a class can't be a prop; export it from the module script instead.`,n(this.ctx,t))}dropUndeclaredClassBases(){let t=Array.from(this.ctx.moduleExports.values()).filter((u)=>u.kind==="class"),c=new Set(t.map((u)=>u.localName??u.name));for(let u of t){if(!u.extends)continue;let p=jn.exec(u.extends)?.[0];if(p&&(c.has(p)||this.ctx.valueImportBindingsByLocalName.has(p)||this.ctx.typeImportBindingsByLocalName.has(p)))continue;r(this.ctx,"export-unresolved",u.name,`class "${u.name}" extends \`${u.extends}\`, which isn't imported or an exported class, so the .d.ts declares it without \`extends\` and its inherited members are missing. Export the base class from the module script.`,u.source),u.extends=void 0}}addModuleClassExport(t,c,u){let p=c.id?.name;if(!p)return;let D=u?.exportedName??p,L=this.exportJSDoc(t,u),{members:j,typeParameters:F,extends:R,implements:J}=$t(this.ctx,this,c),X=F??L?.typeParameters;this.addModuleExport(D,{name:D,...p===D?{}:{localName:p},kind:"class",description:L?.description,deprecated:L?.deprecated,tags:L?.tags,...L?.internal?{internal:!0}:{},type:`typeof ${p}`,...X?{typeParameters:X}:{},members:j,...c.abstract?{abstract:!0}:{},...R?{extends:R}:{},...J?{implements:J}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,source:n(this.ctx,t)})}aliasType(t){if(t==="*")return"any";return t.trim()}findVariableTypeAndDescription(t){let c=this.getPropByLocalOrPublic(t);if(c?.type)return{type:c.type,description:c.description,internal:c.internal};let u=this.variableJsDocEntry(t),p=this.ctx.explicitVariableTypesByName.get(t);if(p)return{type:p,description:u?.description,internal:u?.internal};if(!u?.type)return null;return{type:u.type,description:u.description,internal:u.internal}}findVariableJsDoc(t){let c=this.variableJsDocEntry(t);return{...c?.description?{description:c.description}:{},...c?.internal?{internal:!0}:{}}}variableJsDocEntry(t){if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=nn(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;return this.ctx.variableInfoCache.get(t)}accumulateGeneric(t,c){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${t}`,`${this.ctx.generics[1]}, ${c}`];else this.ctx.generics=[t,c]}cleanup(){this.ctx=Mt()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;static stripTypeScriptDirectivesFromScripts(t){if(!t.includes("@ts-"))return t;return o.SCRIPT_BLOCK_REGEX.lastIndex=0,t.replace(o.SCRIPT_BLOCK_REGEX,(c,u,p,D)=>{o.TS_DIRECTIVE_REGEX.lastIndex=0;let L=p.replace(o.TS_DIRECTIVE_REGEX,"");return u+L+D})}parseSvelteComponent(t,c){this.cleanup(),this.ctx.componentFilePath=c.filePath;let u=o.stripTypeScriptDirectivesFromScripts(t);this.ctx.source=u;let p=M(u);if(qt(this,this.ctx,p),this.ctx.parsed=p,this.ctx.scriptLanguage==="ts")Ct(this.ctx.parsed.module),Ct(this.ctx.parsed.instance),Ct(this.ctx.parsed.fragment);this.ctx.syntaxMode=Ut(this.ctx);let D=this.ctx.parsed.css,L=D?.start!==void 0&&D?.end!==void 0?u.slice(0,D.start)+" ".repeat(D.end-D.start)+u.slice(D.end):u;he(this.ctx,this.ctx.parsed?.module),he(this.ctx,this.ctx.parsed?.instance),Ge(this.ctx,this,L);let j={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module){let N=Ie(this.ctx.parsed.module),A=(K,I,B)=>{let Z=d(this.ctx,this,K);this.addModuleExport(I==="*"?`* from ${B.from}`:I,{name:I,kind:"re-export",description:Z?.description,deprecated:Z?.deprecated,tags:Z?.tags,...Z?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:B,source:n(this.ctx,K)})},_=(K)=>{r(this.ctx,"module-export-conflict","default",`export "default" was skipped because it collides with the component's own default export.`,n(this.ctx,K))},ee=(K,I,B)=>{let Z=[];if(I.type==="FunctionDeclaration"){let oe=I;if(!oe.id?.name)return;let ce=this.ctx.scriptLanguage==="ts"?de(this.ctx,oe):void 0;Z.push({prop_name:B?.exportedName??oe.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:ce?.hasAnnotations?void 0:"() => any",explicitType:ce?.hasAnnotations?ce.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(I.type==="VariableDeclaration"){let oe=I,ce=on(oe.kind),ke=B?.declarator?[B.declarator]:oe.declarations;for(let we of ke){if(!we||typeof we!=="object"||!("id"in we))continue;let{id:Ke,init:et}=we;if(!Ke||typeof Ke!=="object")continue;if(Ke.type!=="Identifier"){for(let ut of i(Ke)){if(B&&B.localName!==ut)continue;Z.push({prop_name:B?.exportedName??ut,kind:ce,isFunctionDeclaration:!1,value:void 0,typeSeed:void 0,explicitType:void 0,initializerIsFunction:!1,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}continue}let st=Ke.name,Ce=B?.exportedName??st,ot=et==null?{isFunction:!1}:x(this,this.ctx,et),{value:tt,type:at,isFunction:nt,defaultValue:ht}=ot,xt=ot;V(this.ctx,ot,Ce,"moduleExports"),Z.push({prop_name:Ce,kind:ce,isFunctionDeclaration:!1,value:tt,typeSeed:at,explicitType:this.getExplicitPropType(st),initializerIsFunction:nt,defaultValue:ht,inferredTypeForSource:at,resolvedJSDoc:xt})}if(Z.length===0)return}else{if(I.type==="ClassDeclaration")this.addModuleClassExport(K,I,B);return}let te=this.exportJSDoc(K,B);for(let{prop_name:oe,kind:ce,isFunctionDeclaration:ke,value:we,typeSeed:Ke,explicitType:et,initializerIsFunction:st,defaultValue:Ce,inferredTypeForSource:ot,resolvedJSDoc:tt}of Z){let{type:at,typeSource:nt,description:ht,params:xt,returnType:ut,isFunction:an,typeParameters:cn}=Et({explicitType:et,typeSeed:Ke,inferredTypeForSource:ot,jsdocType:te?.type,jsdocDescription:te?.description,jsdocParams:te?.params,jsdocReturnType:te?.returnType,jsdocTypeParameters:te?.typeParameters,resolvedType:tt?.resolvedType,resolvedDescription:tt?.resolvedDescription,resolvedParams:tt?.resolvedParams,resolvedReturnType:tt?.resolvedReturnType,initializerIsFunction:st,isFunctionDeclaration:ke,typedefs:this.ctx.typedefs});this.addModuleExport(oe,{name:oe,kind:ce,description:ht,deprecated:te?.deprecated,tags:te?.tags,...te?.internal?{internal:!0}:{},type:at,typeSource:nt,value:we,defaultValue:Ce,params:xt,returnType:ut,typeParameters:cn,isFunction:an,isFunctionDeclaration:ke,isRequired:!1,constant:ce==="const",reactive:!1,source:n(this.ctx,K)})}};C(this.ctx.parsed?.module,(K,I)=>{if(K.type==="ImportDeclaration")re(this.ctx,K);if(K.type==="FunctionDeclaration"){let B=K;if(B.id?.name)this.ctx.funcDecls.set(B.id.name,B)}if(K.type==="VariableDeclaration")this.ctx.vars.add(K);if(K.type==="ExportNamedDeclaration"){if(K.declaration!=null){ee(K,K.declaration);return}let B=K.source?.value;for(let Z of K.specifiers){let te=this.resolveExportSpecifier(K,Z,I,"module");if(!te)continue;if(te.exportedName==="default"){_(K);continue}let oe=typeof B==="string"?{from:B,imported:te.localName}:N.get(te.localName);if(te.declaration)ee(K,te.declaration,te);else if(oe)A(K,te.exportedName,oe);else if(!this.ctx.localTypeDeclarationsByName.get(te.localName)?.exported)this.recordUnresolvedExportSpecifier(K,te.localName,te.exportedName)}}if(K.type==="ExportAllDeclaration"&&typeof K.source.value==="string"){let B=(K.exported&&At(K.exported))??"*";if(B==="default"){_(K);return}A(K,B,{from:K.source.value,imported:"*"})}}),this.dropUndeclaredClassBases()}let F,R,J,X=new Set,ae=new Set,Y=[],ze=[],ve=[],Ze=new Set;Le(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Ye=Oe(this.ctx),pt=(N,A,_)=>{let ee=[];if(A.type==="FunctionDeclaration"){let I=A;if(!I.id?.name)return;let B=_?.exportedName??I.id.name,Z=this.ctx.scriptLanguage==="ts"?de(this.ctx,I):void 0;ee.push({prop_name:B,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:Z?.hasAnnotations?void 0:"() => any",explicitType:Z?.hasAnnotations?Z.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:I.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(A.type==="VariableDeclaration"){let I=A,B=on(I.kind),Z=_?.declarator?[_.declarator]:I.declarations;for(let te of Z){if(!te||typeof te!=="object"||!("id"in te))continue;let{id:oe,init:ce}=te;if(!oe||typeof oe!=="object")continue;if(oe.type!=="Identifier"){for(let nt of i(oe)){if(_&&_.localName!==nt)continue;ee.push({prop_name:_?.exportedName??nt,kind:B,isFunctionDeclaration:!1,value:void 0,typeSeed:void 0,explicitType:void 0,initializerIsFunction:!1,isRequired:!1,localName:nt,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}continue}let ke=oe.name,we=_?.exportedName??ke,Ke=B==="let"&&ce==null,et=ce==null?{isFunction:!1}:x(this,this.ctx,ce),{value:st,type:Ce,isFunction:ot,defaultValue:tt}=et,at=et;V(this.ctx,et,we,"props"),ee.push({prop_name:we,kind:B,isFunctionDeclaration:!1,value:st,typeSeed:Ce,explicitType:this.getExplicitPropType(ke),initializerIsFunction:ot,isRequired:Ke,localName:ke,defaultValue:tt,inferredTypeForSource:Ce,resolvedJSDoc:at})}if(ee.length===0)return}else{if(A.type==="ClassDeclaration"&&A.id)this.recordClassExport(N,_?.exportedName??A.id.name);return}let K=this.exportJSDoc(N,_);for(let{prop_name:I,kind:B,isFunctionDeclaration:Z,value:te,typeSeed:oe,explicitType:ce,initializerIsFunction:ke,isRequired:we,localName:Ke,defaultValue:et,inferredTypeForSource:st,resolvedJSDoc:Ce}of ee){let{type:ot,typeSource:tt,description:at,params:nt,returnType:ht,isFunction:xt,typeParameters:ut}=Et({explicitType:ce,typeSeed:oe,inferredTypeForSource:st,jsdocType:K?.type,jsdocDescription:K?.description,jsdocParams:K?.params,jsdocReturnType:K?.returnType,jsdocTypeParameters:K?.typeParameters,resolvedType:Ce?.resolvedType,resolvedDescription:Ce?.resolvedDescription,resolvedParams:Ce?.resolvedParams,resolvedReturnType:Ce?.resolvedReturnType,initializerIsFunction:ke,isFunctionDeclaration:Z,typedefs:this.ctx.typedefs});T(this.ctx,"prop-unknown-type",I,K?.sveldIgnore),q(this,this.ctx,I,{name:I,...Ke!==void 0&&Ke!==I?{localName:Ke}:{},kind:B,description:at,binding:K?.binding,deprecated:K?.deprecated,tags:K?.tags,...K?.internal?{internal:!0}:{},type:ot,typeSource:tt,value:te,defaultValue:et,params:nt,returnType:ht,typeParameters:ut,isFunction:xt,isFunctionDeclaration:Z,isRequired:we,constant:B==="const",reactive:this.ctx.reactive_vars.has(I),source:n(this.ctx,N)})}};C(j,(N,A,_)=>{let ee=Me(this,this.ctx,Ye,N);if(ee)this.ctx.activeScopes.push(ee);let K=N.type;if(!$n.has(K))return;if(N.type==="AssignmentExpression")ye(this.ctx,N.left);if(N.type==="UpdateExpression")ye(this.ctx,N.argument);if(N.type==="CallExpression"){let I=N,B=I.callee&&typeof I.callee==="object"&&"name"in I.callee?I.callee.name:void 0;if(B==="createEventDispatcher"){if(A&&typeof A==="object"&&"id"in A&&A.id&&typeof A.id==="object"&&"name"in A.id)F=A.id.name,R=A;J=I.typeArguments?.params?.[0]}if(B==="$host"){if(A&&typeof A==="object"&&"id"in A&&A.id&&typeof A.id==="object"&&"name"in A.id)X.add(A.id.name)}if(B==="setContext")je(this.ctx,this,N,A??void 0);if(I.arguments.length>0){if(ve.push(I),se(this.ctx,I.callee))Ze.add(I)}if(B)ze.push({name:B,arguments:I.arguments,node:I,nestedBoundDetailNames:H(this.ctx,I.arguments[1])});if(O(I.callee)&&e(I.callee.property)&&I.callee.property.name==="dispatchEvent"&&(y(I.callee.object,"$host")||e(I.callee.object)&&X.has(I.callee.object.name))){let Z=Fe(this.ctx,I);if(Z)ae.add(Z.name),Y.push(Z)}}if(K==="SpreadAttribute"){let I=N;if(I.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(I.expression?.name??""))Jt(this.ctx,A)}if(N.type==="FunctionDeclaration"){let I=N;if(I.id?.name)this.ctx.funcDecls.set(I.id.name,I)}if(N.type==="ImportDeclaration")re(this.ctx,N);if(N.type==="VariableDeclaration"){if(this.ctx.vars.add(N),A&&typeof A==="object"&&"type"in A&&A.type==="Program"&&N.declarations.some((I)=>y(g(I.init),"$props")))Wt(this,this.ctx,N)}if(N.type==="ExportNamedDeclaration"){if(N.declaration!=null){pt(N,N.declaration);return}for(let I of N.specifiers){let B=this.resolveExportSpecifier(N,I,A,"instance");if(!B)continue;if(B.declaration)pt(N,B.declaration,B);else this.recordUnresolvedExportSpecifier(N,B.localName,B.exportedName)}}if(K==="Comment"){let B=N?.data?.trim()??"";if(sn.test(B))this.ctx.componentComment=B.replace(sn,"").replace(Vn,""),this.ctx.componentCommentSource=n(this.ctx,N)}if(K==="SlotElement"){let I=N,B=I.attributes?.find((ce)=>ce.name==="name")?.value,Z=(Array.isArray(B)?B[0]:void 0)?.data,te=(I.attributes||[]).filter((ce)=>ce.name!=="name").reduce((ce,ke)=>{let we={value:void 0,replace:!1},Ke=ke.value;if(Ke===void 0||Ke===!0)return ce;let et=Array.isArray(Ke)?Ke[0]:Ke;if(et){let{type:st,expression:Ce,raw:ot,start:tt,end:at}=et;if(st==="Text"&&ot!==void 0)we.value=JSON.stringify(ot);else if(!Array.isArray(Ke)&&st==="ExpressionTag"&&Ce&&typeof Ce==="object"&&"type"in Ce&&Ce.type==="Identifier"&&"name"in Ce&&Ce.name===ke.name)we.value=Ce.name,we.replace=!0;if(Ce&&typeof Ce==="object"&&"type"in Ce){if(Ce.type==="Literal"&&"value"in Ce){let nt=Ce.value;we.value=typeof nt==="string"?JSON.stringify(nt):String(nt)}else if(Ce.type==="MemberExpression")we.value=Q(this.ctx,this,Ce);else if(Ce.type!=="Identifier"){if(tt!==void 0&&at!==void 0){if(Ce.type==="ObjectExpression"||Ce.type==="TemplateLiteral")we.value=s(this.ctx,tt+1,at-1)}}}}if(ke.name)ce[ke.name]=we;return ce},{}),oe=I.fragment?.nodes?.map(({start:ce,end:ke})=>{if(ce===void 0||ke===void 0)return"";return s(this.ctx,ce,ke)??""}).join("").trim();z(this.ctx,{slot_name:Z,slot_props:te,slot_fallback:oe,source:n(this.ctx,N)})}if(K==="RenderTag"){let I=N,B=Ue(this.ctx,I.expression);if(B){let Z,te=!1;if(B.arguments.length===0)Z={};else if(B.arguments.length===1&&typeof B.arguments[0]==="object"&&B.arguments[0]&&"type"in B.arguments[0]&&B.arguments[0].type==="ObjectExpression"){let ke=Te(this.ctx,this,B.arguments[0]);Z=ke.slot_props,te=ke.hasUnresolvedSpread}else if(B.arguments.length===1)r(this.ctx,"syntax-skipped",B.publicName,`{@render ${B.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,n(this.ctx,N));let oe=B.publicName==="children"?void 0:B.publicName,ce=oe===void 0?Fn:oe;if(Z!==void 0)z(this.ctx,{slot_name:oe,slot_props:Z,slot_props_unresolved_spread:te||void 0,source:n(this.ctx,N)});if(Z!==void 0||this.ctx.slots.has(ce))this.ctx.snippetPropLocals.add(B.trackingName)}}if(K==="OnDirective"){let I=N;if(I.expression==null&&I.name){if(A!=null&&typeof A==="object"&&"name"in A){let B=typeof A.name==="string"?A.name:void 0,Z="type"in A?String(A.type):void 0;if(B&&Z){let te=Tt(Z)?{type:"InlineComponent",name:B}:{type:"Element",name:B};this.ctx.forwardedEvents.set(I.name,te);let oe=this.ctx.events.get(I.name),ce=this.ctx.eventDescriptions.get(I.name),ke=oe?.deprecated,we=oe?.internal;if(!oe)this.ctx.events.set(I.name,{type:"forwarded",name:I.name,element:te,description:ce,deprecated:ke,...we?{internal:!0}:{},source:n(this.ctx,N)});else if(oe.type==="forwarded"&&ce&&!oe.description)this.ctx.events.set(I.name,{...oe,description:ce,deprecated:oe.deprecated??ke,...oe.internal||we?{internal:!0}:{},source:oe.source||n(this.ctx,N)})}}}}if(K==="BindDirective"&&A&&typeof A==="object"&&"type"in A&&(bt(String(A.type))||Tt(String(A.type)))){let I=N;if(I.expression?.name){let B=U(this.ctx,I.expression.name);if(B)this.ctx.reactive_vars.add(B)}if(bt(String(A.type))&&I.name==="this"&&I.expression?.name&&"name"in A&&typeof A.name==="string"){let B=U(this.ctx,I.expression.name);if(!B)return;let Z=A.name;if(this.ctx.bindings.has(B)){let te=this.ctx.bindings.get(B);if(te&&!te.elements.includes(Z))this.ctx.bindings.set(B,{...te,elements:[...te.elements,Z]})}else this.ctx.bindings.set(B,{elements:[Z]})}}},(N)=>{if(W(N))this.ctx.activeScopes.pop(),Be(Ye,N)},{skipTypeOnlySubtrees:!0});for(let N of Y)Je(this,this.ctx,N);if(F!==void 0){Yt(this,this.ctx,J,F,n(this.ctx,R));for(let N of ze)if(N.name===F){let A=N.arguments[0],_=A&&typeof A==="object"&&"value"in A?A.value:void 0,ee=N.arguments[1],K=xe(ge(this,this.ctx,N.nestedBoundDetailNames),ee),I=K===void 0&&ee&&typeof ee==="object"&&"value"in ee?ee.value:void 0,B=I===null&&ee.raw==="null";if(_!=null)k(this.ctx,{name:String(_),detail:K??(B?"null":I==null?"":G(I)),has_argument:Boolean(ee),source:n(this.ctx,N.node)})}}let Qe=new Set(ae);if(F!==void 0){for(let N of ze)if(N.name===F){let A=N.arguments[0],_=A&&typeof A==="object"&&"value"in A?A.value:void 0;if(_!=null)Qe.add(String(_))}}this.ctx.forwardedEvents.forEach((N,A)=>{let _=this.ctx.events.get(A);if(_&&_.type==="dispatched"&&!Qe.has(A)){let ee=this.ctx.eventDescriptions.get(A),K={type:"forwarded",name:A,element:N,description:ee,deprecated:_.deprecated,tags:_.tags,source:_.source};if(_.internal)K.internal=!0;if(_.detail!==void 0&&_.detail!=="undefined")K.detail=_.detail;this.ctx.events.set(A,K)}}),Qt(this.ctx,Qe);let lt=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(N)=>this.resolvePublicPropName(N))):new Set,rt=o.mapToArray(this.ctx.props).filter((N)=>!lt.has(N.name)).map((N)=>{if(this.ctx.bindings.has(N.name)){let A=this.ctx.bindings.get(N.name)?.elements.sort().map((_)=>Ft(_)).join(" | ");return{...N,type:`null | ${A}`,typeSource:"inferred",reactive:N.reactive||this.ctx.reactive_vars.has(N.name)}}return{...N,reactive:N.reactive||this.ctx.reactive_vars.has(N.name)}});this.ctx.activeScopes.length=0;let Xe=o.mapToArray(this.ctx.slots).map((N)=>{let{slot_props_unresolved_spread:A,..._}=N;if(!N.slot_props)return _;if(typeof N.slot_props==="string")return On.test(N.slot_props)?{..._,slot_props:"Record<string, never>"}:_;let ee=N.slot_props,K=[];for(let Z of Object.keys(ee)){if(ee[Z].replace&&ee[Z].value!==void 0)ee[Z].value=this.getPropTypeByLocalOrPublic(ee[Z].value);if(ee[Z].value===void 0)ee[Z].value="any";K.push(`${Z}: ${ee[Z].value}`)}let I=A?" & Record<string, any>":"",B=K.length===0?A?"Record<string, any>":"Record<string, never>":K.length===1?`{ ${K[0]} }${I}`:`{
1
+ import{h,e,O,y,g,Pe,w,Q,r,pe,T,ue,ne,n,s,f,b,m,le,Ae,De,E,P,l,a,_e,fe,de,Ne,re,me,S,Ie,he,q,V,x,Re,U,se,i,ye,W,Le,Oe,Me,Be,je,ge,H,xe,$e,ie,G,k,Fe,Je,qe,Ve,Te,Ue,z,Ee,We,be,v,d,He,Ge,Se,C,M}from"./chunk-2vte7cyp.js";var Bt={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function pn(t){return t in Bt}function Ft(t){if(pn(t))return Bt[t];return"HTMLElement"}var ln=new Set(["MethodDefinition","PropertyDefinition","AccessorProperty"]);function dn(t){if(t.computed||!t.key)return;if(t.key.type==="Identifier")return t.key.name;if(t.key.type==="Literal"&&(typeof t.key.value==="string"||typeof t.key.value==="number"))return String(t.key.value);return}function jt(t){return t==="private"||t==="protected"}function mt(t){return{...t?.description?{description:t.description}:{},...t?.deprecated===void 0?{}:{deprecated:t.deprecated},...t?.tags?{tags:t.tags}:{}}}function Ot(t){return t?.slice(1,-1).trim()||void 0}function vt(t,c,u){let p=fe(t,c),D=new Map((u?.params??[]).map((R)=>[R.name,R])),L=p.params.map(({name:R,type:J,optional:X,rest:ae})=>{let Y=D.get(R);return{name:ae?`...${R}`:R,type:J??Y?.type??(ae?"any[]":"any"),...Y?.description?{description:Y.description}:{},...!ae&&(X||Y?.optional)?{optional:!0}:{}}}),j=p.returnType??u?.returnType??(c.async?"Promise<any>":void 0),F=Ot(p.typeParameters)??u?.typeParameters;return{...L.length>0?{params:L}:{},...j?{returnType:j}:{},...F?{typeParameters:F}:{}}}function $t(t,c,u){let p=[],D=new Map,L=new Set,j=new Set,F,R=-1;for(let ae of u.body?.body??[]){let Y=ae;if(!ln.has(Y.type)||jt(Y.accessibility))continue;let ze=dn(Y);if(ze===void 0)continue;let ve=d(t,c,Y);if(ve?.internal)continue;let Ze=`${Y.static?"static ":""}${ze}`,Ye={...Y.static?{static:!0}:{},...Y.optional?{optional:!0}:{},...Y.abstract?{abstract:!0}:{}};if(Y.type!=="MethodDefinition"){if(a(t,Y.typeAnnotation?.typeAnnotation),!Y.static)j.add(ze);p.push({kind:"property",name:ze,type:E(t,Y.typeAnnotation)??ve?.type??"any",...Ye,...Y.readonly?{readonly:!0}:{},...mt(ve)});continue}let pt=Y.value,Qe=Y.typeParameters?{...pt,typeParameters:Y.typeParameters}:pt;if(Y.kind==="constructor"){let lt=vt(t,Qe,ve);p.push({kind:"constructor",name:"constructor",params:lt.params,...mt(ve)}),R=p.length,F=Qe.body?.body,(Qe.params??[]).forEach((Xe,ct)=>{if(Xe.type!=="TSParameterProperty"||jt(Xe.accessibility))return;let it=lt.params?.[ct];if(!it)return;j.add(it.name),p.push({kind:"property",name:it.name,type:it.type,...Xe.readonly?{readonly:!0}:{},...it.description?{description:it.description}:{}})});continue}if(Y.kind==="get"||Y.kind==="set"){let lt=vt(t,Qe,ve),rt=Y.kind==="get"?lt.returnType??ve?.type:lt.params?.[0]?.type??ve?.type,Xe=D.get(Ze);if(Xe){if(Y.kind==="set")Xe.readonly=void 0;if(rt&&rt!=="any"&&(Xe.type==="any"||Y.kind==="get"))Xe.type=rt;if(!Xe.description&&!Xe.deprecated)Object.assign(Xe,mt(ve));continue}let ct={kind:"property",name:ze,type:rt??"any",...Ye,...Y.kind==="get"?{readonly:!0}:{},...mt(ve)};D.set(Ze,ct),p.push(ct);continue}if(Qe.type==="TSDeclareMethod"&&!Y.abstract)L.add(Ze);else if(Qe.type!=="TSDeclareMethod"&&L.has(Ze))continue;p.push({kind:"method",name:ze,...Ye,...vt(t,Qe,ve),...mt(ve)})}if(t.scriptLanguage!=="ts"&&F)p.splice(R,0,...mn(t,c,F,j));for(let ae of u.typeParameters?.params??[])a(t,ae.constraint),a(t,ae.default);let J=Ot(P(t,u.typeParameters)),X=un(t,u);return{members:p,...J?{typeParameters:J}:{},...X}}function un(t,c){let u={},p=c.superClass;if(p){if(u.extends=P(t,{start:p.start,end:c.superTypeParameters?.end??p.end}),p.type==="Identifier")Vt(t,p,c.superTypeParameters)}let D=(c.implements??[]).map((L)=>(Vt(t,L.expression,L.typeParameters),P(t,L))).filter((L)=>Boolean(L));if(D.length>0)u.implements=D;return u}function Vt(t,c,u){a(t,{type:"TSTypeReference",typeName:c,...u?{typeParameters:u}:{}})}function mn(t,c,u,p){let D=[];for(let L of u){let j=L.type==="ExpressionStatement"?L.expression:void 0;if(j?.type!=="AssignmentExpression"||j.operator!=="=")continue;let F=j.left;if(F?.type!=="MemberExpression"||F.computed||F.object?.type!=="ThisExpression")continue;let R=F.property?.type==="Identifier"?F.property.name:void 0;if(!R||p.has(R))continue;p.add(R);let J=d(t,c,L);if(J?.internal)continue;D.push({kind:"property",name:R,type:J?.type??"any",...mt(J)})}return D}function Mt(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,sourceLineHint:void 0,parsedJsDocByText:new Map,jsDocBlocksByStart:new Map,functionDocCommentStarts:new Set,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingConstDefaultCandidates:[],pendingContextKeyCandidates:[],pendingDispatchEscapeCandidates:[],deferredEventNoSourceDiagnostics:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,explicitVariableTypeNodesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,untypedJsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}var fn=new Set(["Component","SvelteComponent","SvelteSelf"]),yn=new Set(["RegularElement","SvelteElement"]);function Tt(t){return fn.has(t)}function bt(t){return yn.has(t)}function gn({hasTypeScriptType:t,hasJSDocType:c,inferredType:u,finalType:p}){if(t)return"typescript";if(c)return"jsdoc";if(u!==void 0)return"default";if(p!==void 0)return"inferred";return"unknown"}function Et(t){let c=t.explicitType??t.jsdocType??t.resolvedType??t.typeSeed,u=t.jsdocParams??t.resolvedParams,p=t.jsdocReturnType??t.resolvedReturnType;if((t.isFunctionDeclaration?c==="() => any":t.initializerIsFunction&&c===t.typeSeed)&&p){let J=t.jsdocTypeParameters?`<${t.jsdocTypeParameters}>`:"";c=u&&u.length>0?`${J}(${b(u)}) => ${p}`:`${J}() => ${p}`}let L=t.jsdocDescription??t.resolvedDescription;if(L===void 0&&c!==void 0)L=t.typedefs?.get(c)?.description;let j=gn({hasTypeScriptType:t.explicitType!==void 0,hasJSDocType:t.jsdocType!==void 0||t.jsdocParams!==void 0||t.jsdocReturnType!==void 0||t.resolvedType!==void 0,inferredType:t.inferredTypeForSource,finalType:c}),F=t.initializerIsFunction||t.isFunctionDeclaration||t.inferIsFunctionFromTypeSignature===!0&&(!!t.jsdocParams?.length||t.jsdocReturnType!==void 0||!!t.jsdocType?.includes("=>")||!!t.resolvedType?.includes("=>")||!!t.explicitType?.includes("=>")),R=F?t.jsdocTypeParameters:void 0;return{type:c,typeSource:j,description:L,params:u,returnType:p,isFunction:F,typeParameters:R}}function hn(t){if(!t||typeof t!=="object"||!("type"in t))return;let c=String(t.type),u=Tt(c);if(!u&&!bt(c))return;let p="name"in t&&typeof t.name==="string"?t.name:void 0;if(!p)return;let D=u?{type:"InlineComponent",name:p}:{type:"Element",name:p};if(p==="svelte:element"&&"tag"in t&&t.tag&&typeof t.tag==="object"){let L=t.tag;if(L.type==="Literal"&&typeof L.value==="string")D.thisValue=L.value}return D}function Jt(t,c){let u=hn(c);if(!u)return;if(t.rest_props===void 0){t.rest_props=u;return}if(t.rest_props.type==="InlineComponent"&&u.type==="Element")t.rest_props=u}var Kt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function xn(t,c){switch(c?.type){case"MemberExpression":return c.computed||t===c.object;case"MethodDefinition":return!!c.computed;case"MetaProperty":return t===c.meta;case"PropertyDefinition":return c.computed||t===c.value;case"Property":return c.computed||t===c.value;case"ExportSpecifier":case"ImportSpecifier":return t===c.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}var Tn=Array.from(Kt);function Gt(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95||t===36}function bn(t){if(t.includes("\\u"))return!0;for(let c of Tn){let u=t.indexOf(c);while(u!==-1){if(!Gt(t.charCodeAt(u-1))&&!Gt(t.charCodeAt(u+c.length)))return!0;u=t.indexOf(c,u+1)}}return!1}function En(t,c){for(let u=c.length-1;u>=0;u-=1)if(c[u]?.has(t))return!0;return!1}function Sn(t){let c=new Set;if(!t||typeof t!=="object"||!("type"in t))return c;switch(String(t.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let u=t;if(u.id?.name)c.add(u.id.name);for(let p of u.params??[])i(p,c);break}case"BlockStatement":Pt(t.body,c);break;case"CatchClause":i(t.param,c);break;case"EachBlock":{let u=t;if(i(u.context,c),typeof u.index==="string")c.add(u.index);else if(u.index?.name)c.add(u.index.name);break}case"AwaitBlock":{let u=t;i(u.value,c),i(u.error,c);break}}return c}function Pt(t,c){if(!Array.isArray(t))return;for(let u of t){if(!u||typeof u!=="object"||!("type"in u))continue;switch(String(u.type)){case"ImportDeclaration":for(let p of u.specifiers??[])if(p.local?.name)c.add(p.local.name);break;case"VariableDeclaration":for(let p of u.declarations??[])i(p.id,c);break;case"FunctionDeclaration":case"ClassDeclaration":{let p=u.id?.name;if(p)c.add(p);break}case"ExportNamedDeclaration":{let p=u.declaration;if(p&&typeof p==="object"&&"type"in p)Pt([p],c);break}}}}function Nt(t,c){if(!t||typeof t!=="object")return!1;return Lt(t,void 0,[...c])}function Lt(t,c,u){if(Se(t.type))return!1;let p=W(t);if(p)u.push(Sn(t));let D=!1;if(c&&t.type==="Identifier"&&t.name!==void 0&&Kt.has(t.name)&&!c.type.startsWith("TS")&&xn(t,c)&&!En(t.name,u))D=!0;else for(let L in t){if(L==="leadingComments")continue;let j=t[L];if(!j||typeof j!=="object")continue;if(Array.isArray(j)){for(let F=0;F<j.length;F++){let R=j[F];if(R&&typeof R==="object"&&typeof R.type==="string"){if(Lt(R,t,u)){D=!0;break}}}if(D)break}else if(typeof j.type==="string"){if(Lt(j,t,u)){D=!0;break}}}if(p)u.pop();return D}function zt(t){if(!t||typeof t!=="object")return;if("content"in t){let c=t.content,u=c&&typeof c==="object"&&"body"in c?c.body:void 0;if(Array.isArray(u))return u}if("body"in t&&Array.isArray(t.body))return t.body;return}function Ut(t){if(t.runesOptionOverride!==void 0)return t.runesOptionOverride?"runes":"legacy";let c=t.parsed;if(!c)return"legacy";if(t.source!==void 0&&!bn(t.source))return"legacy";let u=new Set;Pt(zt(c.module),u);let p=new Set;return Pt(zt(c.instance),p),Nt(c.module,[u])||Nt(c.instance,[u,p])||Nt(c.fragment,[u,p])?"runes":"legacy"}var Pn=/[A-Za-z_$][\w$]*/g;function Cn(t,c,u){let p=new Map,D=c.typeParameters?.params,L=u.typeArguments?.params;if(!D?.length||!L?.length)return p;for(let j=0;j<D.length;j++){let F=D[j]?.name,R=L[j];if(!F||R?.start===void 0||R?.end===void 0)continue;let J=s(t,R.start,R.end)?.trim();if(J)p.set(F,J)}return p}function Dn(t,c){if(c.size===0)return t;return t.replace(Pn,(u)=>c.get(u)??u)}function ft(t,c,u,p,D=new Set){let L=new Map;if(!u?.type)return L;let j=(F)=>{for(let R of F){if(R?.type!=="TSPropertySignature"||R.computed)continue;if(!R.key)continue;let J=t.getPropertyName(R.key);if(!J)continue;let X=R.typeAnnotation?.start,ae=R.typeAnnotation?.end;if(X===void 0||ae===void 0)continue;let Y=s(c,X+1,ae)?.trim();if(!Y)continue;a(c,R.typeAnnotation?.typeAnnotation),L.set(J,{type:Y,optional:R.optional===!0,source:n(c,R)})}};switch(u.type){case"TSTypeLiteral":j(u.members??[]);break;case"TSInterfaceDeclaration":j(u.body?.body??[]);break;case"TSTypeAliasDeclaration":{let F=ft(t,c,u.typeAnnotation,p,D);for(let[R,J]of F)L.set(R,J);break}case"TSTypeReference":{let F=De(u.typeName);if(!F||D.has(F))break;let R=p.get(F);if(!R)break;D.add(F);let J=ft(t,c,R,p,D);D.delete(F);let X=Cn(c,R,u);for(let[ae,Y]of J)L.set(ae,X.size===0?Y:{...Y,type:Dn(Y.type,X)});break}case"TSIntersectionType":for(let F of u.types??[]){let R=ft(t,c,F,p,D);for(let[J,X]of R)L.set(J,X)}break;case"TSParenthesizedType":{let F=ft(t,c,u.typeAnnotation,p,D);for(let[R,J]of F)L.set(R,J);break}}return L}function vn(t){let c={};for(let[u,p]of Object.entries(t))c[u]={...p.attribute===void 0?{}:{attribute:p.attribute},...p.reflect===void 0?{}:{reflect:p.reflect},...p.type===void 0?{}:{type:p.type}};return c}function kt(t,c,u){if(c.type==="ImportDeclaration"&&c.source?.value)for(let D of c.specifiers??[]){let L=D.local?.name;if(!L)continue;if(!(c.importKind==="type"||D.importKind==="type"))continue;let F,R;if(D.type==="ImportSpecifier")F="named",R=D.imported?.type==="Identifier"?D.imported.name:typeof D.imported?.value==="string"?D.imported.value:void 0;else if(D.type==="ImportDefaultSpecifier")F="default";else if(D.type==="ImportNamespaceSpecifier")F="namespace";if(!F)continue;t.typeImportBindingsByLocalName.set(L,{importedName:R,localName:L,source:String(c.source.value),specifierType:F})}let p=c.type==="TSEnumDeclaration";if((p||c.type==="TSInterfaceDeclaration"||c.type==="TSTypeAliasDeclaration")&&c.id?.name&&c.start!==void 0&&c.end!==void 0){let D=p?_e(t,c):s(t,c.start,c.end)?.trim();t.localTypeDeclarationsByName.set(c.id.name,{code:D??"",node:c,start:c.start,...u?{exported:u}:{}})}}function qt(t,c,u){if(c.runesPropsDeclarationMetadataByDeclaratorStart.clear(),c.explicitPropTypesByName.clear(),c.explicitVariableTypesByName.clear(),c.explicitVariableTypeNodesByName.clear(),c.typeImportBindingsByLocalName.clear(),c.localTypeDeclarationsByName.clear(),c.additionalTypeDependencyNodes.length=0,c.typedRunesPropsDeclarations.length=0,!c.source)return;let p=u;c.scriptLanguage=t.resolveScriptLanguage(p);let D=p.options?.customElement;c.customElementTag=D?.tag,c.customElement=D?{...D.tag===void 0?{}:{tag:D.tag},...D.shadow==="open"||D.shadow==="none"?{shadow:D.shadow}:{},...D.props?{props:vn(D.props)}:{},...D.extend===void 0?{}:{extend:!0}}:void 0,c.runesOptionOverride=p.options?.runes,c.scriptGenericsAttribute=t.resolveScriptGenericsAttribute(p);let L=p.module?.content?.body??[],j=new Set;for(let R of L){if(!R?.type)continue;if(R.type==="ExportNamedDeclaration"&&R.declaration)kt(c,R.declaration,!0);else if(R.type==="ExportNamedDeclaration"&&!R.source)for(let J of R.specifiers??[]){let X=J.local?.name;if(X&&X===J.exported?.name)j.add(X)}else kt(c,R,!1)}for(let R of j){let J=c.localTypeDeclarationsByName.get(R);if(J)J.exported=!0}let F=p.instance?.content?.body??[];for(let R of F){if(!R?.type)continue;if(kt(c,R,!1),R.type==="ExportNamedDeclaration"&&R.declaration?.type==="VariableDeclaration")for(let J of R.declaration.declarations??[]){if(J.id?.type!=="Identifier"||!J.id.name)continue;let X=E(c,J.id.typeAnnotation);if(X)c.explicitPropTypesByName.set(J.id.name,X),a(c,J.id.typeAnnotation?.typeAnnotation)}else if(R.type==="VariableDeclaration")for(let J of R.declarations??[]){if(J.id?.type!=="Identifier"||!J.id.name)continue;let X=E(c,J.id.typeAnnotation);if(X){c.explicitVariableTypesByName.set(J.id.name,X);let ae=J.id.typeAnnotation?.typeAnnotation;if(ae)c.explicitVariableTypeNodesByName.set(J.id.name,ae)}}}for(let R of F){if(!R||typeof R!=="object"||!("declarations"in R))continue;for(let J of R.declarations??[]){if(!y(g(J.init),"$props"))continue;let X=J.id?.typeAnnotation?void 0:Pe(J.init),ae=J.id?.typeAnnotation?.typeAnnotation??X,Y=J.id?.typeAnnotation?E(c,J.id.typeAnnotation):P(c,X),ze=ft(t,c,ae,new Map(Array.from(c.localTypeDeclarationsByName.entries(),([Ye,pt])=>[Ye,pt.node]))),ve=new Set,Ze=new Set;if(l(c,ae,ve,Ze),Ve(c,ve,Ze),J.start!==void 0){let Ye={canonicalType:Y,props:ze,referencedImportedTypes:ve,referencedLocalTypes:Ze};if(c.runesPropsDeclarationMetadataByDeclaratorStart.set(J.start,Ye),Y)c.typedRunesPropsDeclarations.push(Ye)}}}}function Wt(t,c,u){for(let p of u.declarations){if(!y(g(p.init),"$props"))continue;if(p.id.type==="Identifier"){c.wholePropsLocals.add(p.id.name),c.restPropLocals.add(p.id.name);let j=le(c,p.start);if(j)for(let[F,R]of j.props)q(t,c,F,{name:F,kind:"let",type:R.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!R.optional,constant:!1,reactive:!1,source:R.source});continue}if(p.id.type!=="ObjectPattern")continue;let D=d(c,t,u),L=p.id.properties.filter((j)=>{if(j.type!=="Property"||j.computed)return!1;if(!t.getPropertyName(j.key))return!1;if(j.value.type==="Identifier")return!0;return j.value.type==="AssignmentPattern"&&j.value.left.type==="Identifier"}).length;for(let j of p.id.properties){if(j.type==="RestElement"){if(j.argument.type==="Identifier")c.restPropLocals.add(j.argument.name);continue}let F=t.getPropertyName(j.key);if(!F)continue;let R,J;if(j.value.type==="Identifier")R=j.value.name;else{let gt=j.value;R=gt.left.name,J=gt.right}if(!R)continue;if(t.trackPropLocalName(F,R),F==="children")c.snippetPropLocals.add(R);let X=He(c,t,j)??(L===1?D:void 0),ae=Ae(c,p.start,F),{init:Y,bindable:ze}=Re(J),ve=Y==null?{isFunction:!1}:x(t,c,Y),{value:Ze,type:Ye,isFunction:pt,defaultValue:Qe}=ve,lt=ae?.type===void 0&&X?.type===void 0?ve.resolvedType:void 0;V(c,ve,F,"props");let{type:rt,typeSource:Xe,description:ct,params:it,returnType:yt,isFunction:St}=Et({explicitType:ae?.type,typeSeed:Ye,inferredTypeForSource:Ye,jsdocType:X?.type,jsdocDescription:X?.description,jsdocParams:X?.params,jsdocReturnType:X?.returnType,resolvedType:lt,resolvedDescription:ve.resolvedDescription,resolvedParams:ve.resolvedParams,resolvedReturnType:ve.resolvedReturnType,initializerIsFunction:pt,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(ze)c.reactive_vars.add(F);T(c,"prop-unknown-type",F,X?.sveldIgnore),q(t,c,F,{name:F,...R===F?{}:{localName:R},kind:"let",description:ct,binding:X?.binding,deprecated:X?.deprecated,tags:X?.tags,...X?.internal?{internal:!0}:{},...ze?{bindable:!0}:{},type:rt,typeSource:Xe,value:Ze,defaultValue:Qe,params:it,returnType:yt,isFunction:St,isFunctionDeclaration:!1,isRequired:!ze&&Y==null&&ae?.optional!==!0,constant:!1,reactive:ze,source:n(c,j)})}}}function Mn(t){let u=t.indexOf("EventDispatcher");if(u===-1)return;let p=u+15;while(t[p]===" ")p++;if(t[p]!=="<")return;let D=0,L=p;for(;p<t.length;p++)if(t[p]==="<")D++;else if(t[p]===">"){if(D--,D===0)return t.slice(L+1,p)}return}function Xt(t,c){let u=t[c];for(let p=c+1;p<t.length;p++)if(t[p]==="\\")p++;else if(t[p]===u)return p;return t.length}function Nn(t){let c=[],u=0,p=0;for(let D=0;D<t.length;D++){let L=t[D];if(L==='"'||L==="'")D=Xt(t,D);else if(L==="{"||L==="("||L==="["||L==="<")u++;else if(L==="}"||L===")"||L==="]"||L===">")u=Math.max(u-1,0);else if(u===0&&(L===";"||L===","))c.push(t.slice(p,D)),p=D+1}return c.push(t.slice(p)),c.map((D)=>D.trim()).filter((D)=>D.length>0)}var Ln=/^["']|["']$/g,kn=/\?$/,Rn=/^\{/,wn=/\}$/;function An(t){let c=0;for(let u=0;u<t.length;u++){let p=t[u];if(p==='"'||p==="'")u=Xt(t,u);else if(p==="{"||p==="("||p==="["||p==="<")c++;else if(p==="}"||p===")"||p==="]"||p===">")c=Math.max(c-1,0);else if(c===0&&p===":"){let D=t.slice(0,u).trim().replace(kn,"").replace(Ln,""),L=t.slice(u+1).trim();if(!D||!L)return;return{name:D,type:L}}}return}function Yt(t,c,u,p,D){if(u){let R=new Map(Array.from(c.localTypeDeclarationsByName.entries(),([X,ae])=>[X,ae.node])),J=ft(t,c,u,R);for(let[X,ae]of J)k(c,{name:X,detail:ae.type,has_argument:!0,source:ae.source});return}let L=t.resolveLocalVarJSDoc(p)?.type,j=L?Mn(L):void 0;if(!j)return;let F=j.trim().replace(Rn,"").replace(wn,"");for(let R of Nn(F)){let J=An(R);if(!J)continue;k(c,{name:J.name,detail:J.type,has_argument:!0,source:D})}}function Qt(t,c){if(t.syntaxMode!=="runes")return;for(let[u,p]of Array.from(t.events.entries())){if(p.type!=="dispatched")continue;if(c.has(u)||t.forwardedEvents.has(u))continue;let D=`on${u}`,L=t.props.get(D);if(!L)continue;let j=L.type!==void 0||L.params!==void 0||L.returnType!==void 0,F=p.detail===void 0||p.detail==="undefined"||p.detail==="null"?"() => void":`(detail: ${p.detail}) => void`;t.props.set(D,{...L,description:L.description??p.description,type:j?L.type:F,typeSource:j?L.typeSource:"inferred",isFunction:!0}),t.events.delete(u)}}var Zt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function Rt(t){return t!==null&&typeof t==="object"&&typeof t.type==="string"}function en(t){if(!Zt.has(t.type))return t;let c=t.expression;while(c&&Zt.has(c.type))c=c.expression;return c??t}function Ct(t){if(!Rt(t))return;wt(t)}function wt(t){for(let c in t){if(c==="leadingComments")continue;let u=t[c];if(!u||typeof u!=="object")continue;if(Array.isArray(u))for(let p=0;p<u.length;p++){let D=u[p];if(!Rt(D))continue;let L=en(D);if(L!==D)u[p]=L;wt(L)}else if(Rt(u)){let p=en(u);if(p!==u)t[c]=p;wt(p)}}}function In(t,c,u,p,D){for(let L of t){if(L.type!=="Block"||L.start<u||L.end>p)continue;D.push({start:L.start,end:L.end,isJsDoc:L.end-L.start>4&&c.startsWith("/**",L.start)})}}function tn(t,c,u){if(!t||typeof t!=="object"||!("type"in t))return;let p=t;if(p.type==="FunctionDeclaration"){if(p.id?.type==="Identifier"&&p.id.name)u.push({name:p.id.name,start:c});return}if(p.type==="VariableDeclaration"){for(let D of p.declarations??[])if(D?.id?.type==="Identifier"&&D.id.name)u.push({name:D.id.name,start:c})}}function _n(t){let c=[];for(let u of t){if(!u||typeof u!=="object"||!("type"in u))continue;let p=u;if(p.start===void 0)continue;if(p.type==="ExportNamedDeclaration"&&p.declaration)tn(p.declaration,p.start,c);else tn(p,p.start,c)}return c}function Hn(t,c,u){let p=0,D=t.length;while(p<D){let L=p+D>>>1;if(t[L].end<=c)p=L+1;else D=L}for(let L=p-1;L>=0;L--){let j=t[L];if(!j.isJsDoc)continue;return Ee(u,j.end,c)?j:void 0}return}function nn(t,c){let u=new Map;if(!t.source)return u;let p=[t.parsed?.module,t.parsed?.instance],D=[],L=[],j=t.parsed?.comments??[];for(let F of p){let R=F?.content;if(!R?.body||R.start===void 0||R.end===void 0)continue;In(j,t.source,R.start,R.end,D),L.push(..._n(R.body))}D.sort((F,R)=>F.end-R.end);for(let F of L){let R=Hn(D,F.start,t.source);if(!R)continue;let J=be(t,t.source.slice(R.start,R.end)),{type:X,description:ae,ignore:Y,internal:ze}=v(J);if(Y.length>0)T(t,"context-any-type",F.name,Y);if(!X&&!ae&&!ze)continue;u.set(F.name,{type:X?c.aliasType(X.type):void 0,description:ae||X&&We(X),internal:ze||void 0})}return u}function At(t){if(t?.type==="Identifier")return t.name;return typeof t?.value==="string"?t.value:void 0}function rn(t,c){for(let u of(t&&S(t))??[]){let p=u,D=p.type==="ExportNamedDeclaration"&&p.declaration?p.declaration:p;if(D.type==="VariableDeclaration"){let L=D.declarations.find((j)=>j.id.type==="Identifier"?j.id.name===c:i(j.id).has(c));if(L)return{declaration:D,declarator:L,statement:p}}else if((D.type==="FunctionDeclaration"||D.type==="ClassDeclaration")&&D.id?.name===c)return{declaration:D,statement:p}}return}function Bn(t,c){for(let u of(t&&S(t))??[]){let p=u;if(p.type!=="LabeledStatement"||p.label.name!=="$")continue;if(p.body.type!=="ExpressionStatement")continue;let D=p.body.expression;if(D.type!=="AssignmentExpression"||D.operator!=="=")continue;if(!i(D.left).has(c))continue;let L={type:"VariableDeclarator",id:D.left,init:D.right};return{declaration:{type:"VariableDeclaration",kind:"let",declarations:[L]},declarator:L,statement:p}}return}function on(t){if(t==="var")return"let";if(t==="using"||t==="await using")return"const";return t}var Fn=null,sn=/^@component/,jn=/^[A-Za-z_$][\w$]*(?=\s*(?:<|$))/,Vn=/\r/g,On=/^\{\s*\}$/,$n=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class o{ctx=Mt();static mapToArray(t){return Array.from(t,([c,u])=>u)}static getStaticAttributeValue(t){if(!Array.isArray(t.value))return;return t.value.map((c)=>c.data??c.raw??"").join("").trim()}resolveScriptLanguage(t){let c=[t.instance,t.module].filter((p)=>p!==void 0),u=!1;for(let p of c){let D=p.attributes?.find((j)=>j.name==="lang");if(!D){u=!0;continue}if(o.getStaticAttributeValue(D)?.toLowerCase()==="ts")return"ts"}return u?"js":void 0}resolveScriptGenericsAttribute(t){let c=t.instance?.attributes?.find((j)=>j.name==="generics");if(!c)return;let u=n(this.ctx,c),p=t.instance?.attributes?.find((j)=>j.name==="lang");if((p?o.getStaticAttributeValue(p)?.toLowerCase():void 0)!=="ts"){r(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',u);return}let L=o.getStaticAttributeValue(c);if(!L)return;return{value:L,source:u}}resolvePublicPropName(t){return this.ctx.propLocalToPublicName.get(t)??t}trackPropLocalName(t,c=t){this.ctx.propLocalToPublicName.set(c,t)}getPropByLocalOrPublic(t){return this.ctx.props.get(this.resolvePublicPropName(t))}getPropTypeByLocalOrPublic(t){return this.getPropByLocalOrPublic(t)?.type}getExplicitPropType(t){return this.ctx.explicitPropTypesByName.get(t)}getPropertyName(t){if(!t||typeof t!=="object"||!("type"in t))return;if(e(t))return t.name;if(h(t))return t.value==null?void 0:String(t.value);return}isNumericConstant(t){if(!t||typeof t!=="object"||!("type"in t))return!1;if(t.type!=="MemberExpression")return!1;let c=t,u=c.object&&"name"in c.object?c.object.name:void 0,p=c.property&&"name"in c.property?c.property.name:void 0;if(!u||!p)return!1;if(u==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(p);if(u==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(p);return!1}resolveLocalVarJSDoc(t){for(let u of this.ctx.vars)if(u.declarations.some((D)=>D.id&&typeof D.id==="object"&&("type"in D.id)&&D.id.type==="Identifier"&&("name"in D.id)&&D.id.name===t))return d(this.ctx,this,u);let c=this.ctx.funcDecls.get(t);if(c)return d(this.ctx,this,c);return}addModuleExport(t,c){if(m(t)===void 0)return;if(this.ctx.moduleExports.has(t)){let u=this.ctx.moduleExports.get(t);this.ctx.moduleExports.set(t,{...u,...c})}else this.ctx.moduleExports.set(t,c)}resolveExportSpecifier(t,c,u,p){let D=At(c.local),L=At(c.exported);if(!D||!L)return;if(t.source!=null)return{localName:D,exportedName:L};let j=rn(u,D);if(!j&&p==="instance"){let F=this.ctx.parsed?.module;j=rn(F,D)??Bn(u,D)}return{localName:D,exportedName:L,...j}}recordUnresolvedExportSpecifier(t,c,u){let p=t.source?.value,D=typeof p==="string"?`it re-exports from "${p}"`:this.ctx.valueImportBindingsByLocalName.has(c)?"it re-exports an imported binding":"no matching local declaration was found";r(this.ctx,"export-unresolved",u,`export "${u}" was skipped because ${D}; sveld only resolves exports of a local declaration.`,n(this.ctx,t))}exportJSDoc(t,c){if(!c)return d(this.ctx,this,t);let u=t.specifiers.length===1?d(this.ctx,this,t):void 0,p=d(this.ctx,this,c.statement);if(!u||!p)return u??p;let D=Object.fromEntries(Object.entries(u).filter(([,L])=>L!==void 0));return{...p,...D,internal:u.internal||p.internal}}recordClassExport(t,c){r(this.ctx,"export-unresolved",c,`export "${c}" was skipped because a class can't be a prop; export it from the module script instead.`,n(this.ctx,t))}dropUndeclaredClassBases(){let t=Array.from(this.ctx.moduleExports.values()).filter((u)=>u.kind==="class"),c=new Set(t.map((u)=>u.localName??u.name));for(let u of t){if(!u.extends)continue;let p=jn.exec(u.extends)?.[0];if(p&&(c.has(p)||this.ctx.valueImportBindingsByLocalName.has(p)||this.ctx.typeImportBindingsByLocalName.has(p)))continue;r(this.ctx,"export-unresolved",u.name,`class "${u.name}" extends \`${u.extends}\`, which isn't imported or an exported class, so the .d.ts declares it without \`extends\` and its inherited members are missing. Export the base class from the module script.`,u.source),u.extends=void 0}}addModuleClassExport(t,c,u){let p=c.id?.name;if(!p)return;let D=u?.exportedName??p,L=this.exportJSDoc(t,u),{members:j,typeParameters:F,extends:R,implements:J}=$t(this.ctx,this,c),X=F??L?.typeParameters;this.addModuleExport(D,{name:D,...p===D?{}:{localName:p},kind:"class",description:L?.description,deprecated:L?.deprecated,tags:L?.tags,...L?.internal?{internal:!0}:{},type:`typeof ${p}`,...X?{typeParameters:X}:{},members:j,...c.abstract?{abstract:!0}:{},...R?{extends:R}:{},...J?{implements:J}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,source:n(this.ctx,t)})}aliasType(t){if(t==="*")return"any";return t.trim()}findVariableTypeAndDescription(t){let c=this.getPropByLocalOrPublic(t);if(c?.type)return{type:c.type,description:c.description,internal:c.internal};let u=this.variableJsDocEntry(t),p=this.ctx.explicitVariableTypesByName.get(t);if(p)return{type:p,description:u?.description,internal:u?.internal};if(!u?.type)return null;return{type:u.type,description:u.description,internal:u.internal}}findVariableJsDoc(t){let c=this.variableJsDocEntry(t);return{...c?.description?{description:c.description}:{},...c?.internal?{internal:!0}:{}}}variableJsDocEntry(t){if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=nn(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;return this.ctx.variableInfoCache.get(t)}accumulateGeneric(t,c){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${t}`,`${this.ctx.generics[1]}, ${c}`];else this.ctx.generics=[t,c]}cleanup(){this.ctx=Mt()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;static stripTypeScriptDirectivesFromScripts(t){if(!t.includes("@ts-"))return t;return o.SCRIPT_BLOCK_REGEX.lastIndex=0,t.replace(o.SCRIPT_BLOCK_REGEX,(c,u,p,D)=>{o.TS_DIRECTIVE_REGEX.lastIndex=0;let L=p.replace(o.TS_DIRECTIVE_REGEX,"");return u+L+D})}parseSvelteComponent(t,c){this.cleanup(),this.ctx.componentFilePath=c.filePath;let u=o.stripTypeScriptDirectivesFromScripts(t);this.ctx.source=u;let p=M(u);if(qt(this,this.ctx,p),this.ctx.parsed=p,this.ctx.scriptLanguage==="ts")Ct(this.ctx.parsed.module),Ct(this.ctx.parsed.instance),Ct(this.ctx.parsed.fragment);this.ctx.syntaxMode=Ut(this.ctx);let D=this.ctx.parsed.css,L=D?.start!==void 0&&D?.end!==void 0?u.slice(0,D.start)+" ".repeat(D.end-D.start)+u.slice(D.end):u;he(this.ctx,this.ctx.parsed?.module),he(this.ctx,this.ctx.parsed?.instance),Ge(this.ctx,this,L);let j={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module){let N=Ie(this.ctx.parsed.module),A=(K,I,B)=>{let Z=d(this.ctx,this,K);this.addModuleExport(I==="*"?`* from ${B.from}`:I,{name:I,kind:"re-export",description:Z?.description,deprecated:Z?.deprecated,tags:Z?.tags,...Z?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:B,source:n(this.ctx,K)})},_=(K)=>{r(this.ctx,"module-export-conflict","default",`export "default" was skipped because it collides with the component's own default export.`,n(this.ctx,K))},ee=(K,I,B)=>{let Z=[];if(I.type==="FunctionDeclaration"){let oe=I;if(!oe.id?.name)return;let ce=this.ctx.scriptLanguage==="ts"?de(this.ctx,oe):void 0;Z.push({prop_name:B?.exportedName??oe.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:ce?.hasAnnotations?void 0:"() => any",explicitType:ce?.hasAnnotations?ce.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(I.type==="VariableDeclaration"){let oe=I,ce=on(oe.kind),ke=B?.declarator?[B.declarator]:oe.declarations;for(let we of ke){if(!we||typeof we!=="object"||!("id"in we))continue;let{id:Ke,init:et}=we;if(!Ke||typeof Ke!=="object")continue;if(Ke.type!=="Identifier"){for(let ut of i(Ke)){if(B&&B.localName!==ut)continue;Z.push({prop_name:B?.exportedName??ut,kind:ce,isFunctionDeclaration:!1,value:void 0,typeSeed:void 0,explicitType:void 0,initializerIsFunction:!1,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}continue}let st=Ke.name,Ce=B?.exportedName??st,ot=et==null?{isFunction:!1}:x(this,this.ctx,et),{value:tt,type:at,isFunction:nt,defaultValue:ht}=ot,xt=ot;V(this.ctx,ot,Ce,"moduleExports"),Z.push({prop_name:Ce,kind:ce,isFunctionDeclaration:!1,value:tt,typeSeed:at,explicitType:this.getExplicitPropType(st),initializerIsFunction:nt,defaultValue:ht,inferredTypeForSource:at,resolvedJSDoc:xt})}if(Z.length===0)return}else{if(I.type==="ClassDeclaration")this.addModuleClassExport(K,I,B);return}let te=this.exportJSDoc(K,B);for(let{prop_name:oe,kind:ce,isFunctionDeclaration:ke,value:we,typeSeed:Ke,explicitType:et,initializerIsFunction:st,defaultValue:Ce,inferredTypeForSource:ot,resolvedJSDoc:tt}of Z){let{type:at,typeSource:nt,description:ht,params:xt,returnType:ut,isFunction:an,typeParameters:cn}=Et({explicitType:et,typeSeed:Ke,inferredTypeForSource:ot,jsdocType:te?.type,jsdocDescription:te?.description,jsdocParams:te?.params,jsdocReturnType:te?.returnType,jsdocTypeParameters:te?.typeParameters,resolvedType:tt?.resolvedType,resolvedDescription:tt?.resolvedDescription,resolvedParams:tt?.resolvedParams,resolvedReturnType:tt?.resolvedReturnType,initializerIsFunction:st,isFunctionDeclaration:ke,typedefs:this.ctx.typedefs});this.addModuleExport(oe,{name:oe,kind:ce,description:ht,deprecated:te?.deprecated,tags:te?.tags,...te?.internal?{internal:!0}:{},type:at,typeSource:nt,value:we,defaultValue:Ce,params:xt,returnType:ut,typeParameters:cn,isFunction:an,isFunctionDeclaration:ke,isRequired:!1,constant:ce==="const",reactive:!1,source:n(this.ctx,K)})}};C(this.ctx.parsed?.module,(K,I)=>{if(K.type==="ImportDeclaration")re(this.ctx,K);if(K.type==="FunctionDeclaration"){let B=K;if(B.id?.name)this.ctx.funcDecls.set(B.id.name,B)}if(K.type==="VariableDeclaration")this.ctx.vars.add(K);if(K.type==="ExportNamedDeclaration"){if(K.declaration!=null){ee(K,K.declaration);return}let B=K.source?.value;for(let Z of K.specifiers){let te=this.resolveExportSpecifier(K,Z,I,"module");if(!te)continue;if(te.exportedName==="default"){_(K);continue}let oe=typeof B==="string"?{from:B,imported:te.localName}:N.get(te.localName);if(te.declaration)ee(K,te.declaration,te);else if(oe)A(K,te.exportedName,oe);else if(!this.ctx.localTypeDeclarationsByName.get(te.localName)?.exported)this.recordUnresolvedExportSpecifier(K,te.localName,te.exportedName)}}if(K.type==="ExportAllDeclaration"&&typeof K.source.value==="string"){let B=(K.exported&&At(K.exported))??"*";if(B==="default"){_(K);return}A(K,B,{from:K.source.value,imported:"*"})}}),this.dropUndeclaredClassBases()}let F,R,J,X=new Set,ae=new Set,Y=[],ze=[],ve=[],Ze=new Set;Le(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Ye=Oe(this.ctx),pt=(N,A,_)=>{let ee=[];if(A.type==="FunctionDeclaration"){let I=A;if(!I.id?.name)return;let B=_?.exportedName??I.id.name,Z=this.ctx.scriptLanguage==="ts"?de(this.ctx,I):void 0;ee.push({prop_name:B,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:Z?.hasAnnotations?void 0:"() => any",explicitType:Z?.hasAnnotations?Z.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:I.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(A.type==="VariableDeclaration"){let I=A,B=on(I.kind),Z=_?.declarator?[_.declarator]:I.declarations;for(let te of Z){if(!te||typeof te!=="object"||!("id"in te))continue;let{id:oe,init:ce}=te;if(!oe||typeof oe!=="object")continue;if(oe.type!=="Identifier"){for(let nt of i(oe)){if(_&&_.localName!==nt)continue;ee.push({prop_name:_?.exportedName??nt,kind:B,isFunctionDeclaration:!1,value:void 0,typeSeed:void 0,explicitType:void 0,initializerIsFunction:!1,isRequired:!1,localName:nt,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}continue}let ke=oe.name,we=_?.exportedName??ke,Ke=B==="let"&&ce==null,et=ce==null?{isFunction:!1}:x(this,this.ctx,ce),{value:st,type:Ce,isFunction:ot,defaultValue:tt}=et,at=et;V(this.ctx,et,we,"props"),ee.push({prop_name:we,kind:B,isFunctionDeclaration:!1,value:st,typeSeed:Ce,explicitType:this.getExplicitPropType(ke),initializerIsFunction:ot,isRequired:Ke,localName:ke,defaultValue:tt,inferredTypeForSource:Ce,resolvedJSDoc:at})}if(ee.length===0)return}else{if(A.type==="ClassDeclaration"&&A.id)this.recordClassExport(N,_?.exportedName??A.id.name);return}let K=this.exportJSDoc(N,_);for(let{prop_name:I,kind:B,isFunctionDeclaration:Z,value:te,typeSeed:oe,explicitType:ce,initializerIsFunction:ke,isRequired:we,localName:Ke,defaultValue:et,inferredTypeForSource:st,resolvedJSDoc:Ce}of ee){let{type:ot,typeSource:tt,description:at,params:nt,returnType:ht,isFunction:xt,typeParameters:ut}=Et({explicitType:ce,typeSeed:oe,inferredTypeForSource:st,jsdocType:K?.type,jsdocDescription:K?.description,jsdocParams:K?.params,jsdocReturnType:K?.returnType,jsdocTypeParameters:K?.typeParameters,resolvedType:Ce?.resolvedType,resolvedDescription:Ce?.resolvedDescription,resolvedParams:Ce?.resolvedParams,resolvedReturnType:Ce?.resolvedReturnType,initializerIsFunction:ke,isFunctionDeclaration:Z,typedefs:this.ctx.typedefs});T(this.ctx,"prop-unknown-type",I,K?.sveldIgnore),q(this,this.ctx,I,{name:I,...Ke!==void 0&&Ke!==I?{localName:Ke}:{},kind:B,description:at,binding:K?.binding,deprecated:K?.deprecated,tags:K?.tags,...K?.internal?{internal:!0}:{},type:ot,typeSource:tt,value:te,defaultValue:et,params:nt,returnType:ht,typeParameters:ut,isFunction:xt,isFunctionDeclaration:Z,isRequired:we,constant:B==="const",reactive:this.ctx.reactive_vars.has(I),source:n(this.ctx,N)})}};C(j,(N,A,_)=>{let ee=Me(this,this.ctx,Ye,N);if(ee)this.ctx.activeScopes.push(ee);let K=N.type;if(!$n.has(K))return;if(N.type==="AssignmentExpression")ye(this.ctx,N.left);if(N.type==="UpdateExpression")ye(this.ctx,N.argument);if(N.type==="CallExpression"){let I=N,B=I.callee&&typeof I.callee==="object"&&"name"in I.callee?I.callee.name:void 0;if(B==="createEventDispatcher"){if(A&&typeof A==="object"&&"id"in A&&A.id&&typeof A.id==="object"&&"name"in A.id)F=A.id.name,R=A;J=I.typeArguments?.params?.[0]}if(B==="$host"){if(A&&typeof A==="object"&&"id"in A&&A.id&&typeof A.id==="object"&&"name"in A.id)X.add(A.id.name)}if(B==="setContext")je(this.ctx,this,N,A??void 0);if(I.arguments.length>0){if(ve.push(I),se(this.ctx,I.callee))Ze.add(I)}if(B)ze.push({name:B,arguments:I.arguments,node:I,nestedBoundDetailNames:H(this.ctx,I.arguments[1])});if(O(I.callee)&&e(I.callee.property)&&I.callee.property.name==="dispatchEvent"&&(y(I.callee.object,"$host")||e(I.callee.object)&&X.has(I.callee.object.name))){let Z=Fe(this.ctx,I);if(Z)ae.add(Z.name),Y.push(Z)}}if(K==="SpreadAttribute"){let I=N;if(I.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(I.expression?.name??""))Jt(this.ctx,A)}if(N.type==="FunctionDeclaration"){let I=N;if(I.id?.name)this.ctx.funcDecls.set(I.id.name,I)}if(N.type==="ImportDeclaration")re(this.ctx,N);if(N.type==="VariableDeclaration"){if(this.ctx.vars.add(N),A&&typeof A==="object"&&"type"in A&&A.type==="Program"&&N.declarations.some((I)=>y(g(I.init),"$props")))Wt(this,this.ctx,N)}if(N.type==="ExportNamedDeclaration"){if(N.declaration!=null){pt(N,N.declaration);return}for(let I of N.specifiers){let B=this.resolveExportSpecifier(N,I,A,"instance");if(!B)continue;if(B.declaration)pt(N,B.declaration,B);else this.recordUnresolvedExportSpecifier(N,B.localName,B.exportedName)}}if(K==="Comment"){let B=N?.data?.trim()??"";if(sn.test(B))this.ctx.componentComment=B.replace(sn,"").replace(Vn,""),this.ctx.componentCommentSource=n(this.ctx,N)}if(K==="SlotElement"){let I=N,B=I.attributes?.find((ce)=>ce.name==="name")?.value,Z=(Array.isArray(B)?B[0]:void 0)?.data,te=(I.attributes||[]).filter((ce)=>ce.name!=="name").reduce((ce,ke)=>{let we={value:void 0,replace:!1},Ke=ke.value;if(Ke===void 0||Ke===!0)return ce;let et=Array.isArray(Ke)?Ke[0]:Ke;if(et){let{type:st,expression:Ce,raw:ot,start:tt,end:at}=et;if(st==="Text"&&ot!==void 0)we.value=JSON.stringify(ot);else if(!Array.isArray(Ke)&&st==="ExpressionTag"&&Ce&&typeof Ce==="object"&&"type"in Ce&&Ce.type==="Identifier"&&"name"in Ce&&Ce.name===ke.name)we.value=Ce.name,we.replace=!0;if(Ce&&typeof Ce==="object"&&"type"in Ce){if(Ce.type==="Literal"&&"value"in Ce){let nt=Ce.value;we.value=typeof nt==="string"?JSON.stringify(nt):String(nt)}else if(Ce.type==="MemberExpression")we.value=Q(this.ctx,this,Ce);else if(Ce.type!=="Identifier"){if(tt!==void 0&&at!==void 0){if(Ce.type==="ObjectExpression"||Ce.type==="TemplateLiteral")we.value=s(this.ctx,tt+1,at-1)}}}}if(ke.name)ce[ke.name]=we;return ce},{}),oe=I.fragment?.nodes?.map(({start:ce,end:ke})=>{if(ce===void 0||ke===void 0)return"";return s(this.ctx,ce,ke)??""}).join("").trim();z(this.ctx,{slot_name:Z,slot_props:te,slot_fallback:oe,source:n(this.ctx,N)})}if(K==="RenderTag"){let I=N,B=Ue(this.ctx,I.expression);if(B){let Z,te=!1;if(B.arguments.length===0)Z={};else if(B.arguments.length===1&&typeof B.arguments[0]==="object"&&B.arguments[0]&&"type"in B.arguments[0]&&B.arguments[0].type==="ObjectExpression"){let ke=Te(this.ctx,this,B.arguments[0]);Z=ke.slot_props,te=ke.hasUnresolvedSpread}else if(B.arguments.length===1)r(this.ctx,"syntax-skipped",B.publicName,`{@render ${B.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,n(this.ctx,N));let oe=B.publicName==="children"?void 0:B.publicName,ce=oe===void 0?Fn:oe;if(Z!==void 0)z(this.ctx,{slot_name:oe,slot_props:Z,slot_props_unresolved_spread:te||void 0,source:n(this.ctx,N)});if(Z!==void 0||this.ctx.slots.has(ce))this.ctx.snippetPropLocals.add(B.trackingName)}}if(K==="OnDirective"){let I=N;if(I.expression==null&&I.name){if(A!=null&&typeof A==="object"&&"name"in A){let B=typeof A.name==="string"?A.name:void 0,Z="type"in A?String(A.type):void 0;if(B&&Z){let te=Tt(Z)?{type:"InlineComponent",name:B}:{type:"Element",name:B};this.ctx.forwardedEvents.set(I.name,te);let oe=this.ctx.events.get(I.name),ce=this.ctx.eventDescriptions.get(I.name),ke=oe?.deprecated,we=oe?.internal;if(!oe)this.ctx.events.set(I.name,{type:"forwarded",name:I.name,element:te,description:ce,deprecated:ke,...we?{internal:!0}:{},source:n(this.ctx,N)});else if(oe.type==="forwarded"&&ce&&!oe.description)this.ctx.events.set(I.name,{...oe,description:ce,deprecated:oe.deprecated??ke,...oe.internal||we?{internal:!0}:{},source:oe.source||n(this.ctx,N)})}}}}if(K==="BindDirective"&&A&&typeof A==="object"&&"type"in A&&(bt(String(A.type))||Tt(String(A.type)))){let I=N;if(I.expression?.name){let B=U(this.ctx,I.expression.name);if(B)this.ctx.reactive_vars.add(B)}if(bt(String(A.type))&&I.name==="this"&&I.expression?.name&&"name"in A&&typeof A.name==="string"){let B=U(this.ctx,I.expression.name);if(!B)return;let Z=A.name;if(this.ctx.bindings.has(B)){let te=this.ctx.bindings.get(B);if(te&&!te.elements.includes(Z))this.ctx.bindings.set(B,{...te,elements:[...te.elements,Z]})}else this.ctx.bindings.set(B,{elements:[Z]})}}},(N)=>{if(W(N))this.ctx.activeScopes.pop(),Be(Ye,N)},{skipTypeOnlySubtrees:!0});for(let N of Y)Je(this,this.ctx,N);if(F!==void 0){Yt(this,this.ctx,J,F,n(this.ctx,R));for(let N of ze)if(N.name===F){let A=N.arguments[0],_=A&&typeof A==="object"&&"value"in A?A.value:void 0,ee=N.arguments[1],K=xe(ge(this,this.ctx,N.nestedBoundDetailNames),ee),I=K===void 0&&ee&&typeof ee==="object"&&"value"in ee?ee.value:void 0,B=I===null&&ee.raw==="null";if(_!=null)k(this.ctx,{name:String(_),detail:K??(B?"null":I==null?"":G(I)),has_argument:Boolean(ee),source:n(this.ctx,N.node)})}}let Qe=new Set(ae);if(F!==void 0){for(let N of ze)if(N.name===F){let A=N.arguments[0],_=A&&typeof A==="object"&&"value"in A?A.value:void 0;if(_!=null)Qe.add(String(_))}}this.ctx.forwardedEvents.forEach((N,A)=>{let _=this.ctx.events.get(A);if(_&&_.type==="dispatched"&&!Qe.has(A)){let ee=this.ctx.eventDescriptions.get(A),K={type:"forwarded",name:A,element:N,description:ee,deprecated:_.deprecated,tags:_.tags,source:_.source};if(_.internal)K.internal=!0;if(_.detail!==void 0&&_.detail!=="undefined")K.detail=_.detail;this.ctx.events.set(A,K)}}),Qt(this.ctx,Qe);let lt=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(N)=>this.resolvePublicPropName(N))):new Set,rt=o.mapToArray(this.ctx.props).filter((N)=>!lt.has(N.name)).map((N)=>{if(this.ctx.bindings.has(N.name)){let A=this.ctx.bindings.get(N.name)?.elements.sort().map((_)=>Ft(_)).join(" | ");return{...N,type:`null | ${A}`,typeSource:"inferred",reactive:N.reactive||this.ctx.reactive_vars.has(N.name)}}return{...N,reactive:N.reactive||this.ctx.reactive_vars.has(N.name)}});this.ctx.activeScopes.length=0;let Xe=o.mapToArray(this.ctx.slots).map((N)=>{let{slot_props_unresolved_spread:A,..._}=N;if(!N.slot_props)return _;if(typeof N.slot_props==="string")return On.test(N.slot_props)?{..._,slot_props:"Record<string, never>"}:_;let ee=N.slot_props,K=[];for(let Z of Object.keys(ee)){if(ee[Z].replace&&ee[Z].value!==void 0)ee[Z].value=this.getPropTypeByLocalOrPublic(ee[Z].value);if(ee[Z].value===void 0)ee[Z].value="any";K.push(`${Z}: ${ee[Z].value}`)}let I=A?" & Record<string, any>":"",B=K.length===0?A?"Record<string, any>":"Record<string, never>":K.length===1?`{ ${K[0]} }${I}`:`{
2
2
  ${K.join(`;
3
3
  `)};
4
4
  }${I}`;return{..._,slot_props:B}}).sort((N,A)=>{let _=N.name??"",ee=A.name??"";if(_<ee)return-1;if(_>ee)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let N=[...rt.map((A)=>A.type??""),...Xe.map((A)=>A.slot_props??"")].join(`
package/lib/cli-entry.js CHANGED
@@ -1 +1 @@
1
- import{we}from"./chunk-8xbe5qy3.js";export{we as cli};
1
+ import{we}from"./chunk-2vte7cyp.js";export{we as cli};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{Y,Z,K,ee,ve,te,c,ze,oe,X,ke,Xe,Ce,B,Ze,j,D,ae,F,J,_,N,I,ce,Ke,Qe,R,we}from"./chunk-8xbe5qy3.js";import{o}from"./chunk-aw6a570w.js";async function f(n){if(n&&"input"in n)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:m,...u}=n??{},l=await j(),i=B(m??l.entry);if(i===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let e=ae(D(l,u,{entry:i}));F(e),J(e.quiet===!0);let t=await N(i,e.glob===!0,_(e)),s;if(e.check)s=await X(t.components,oe(e),{entryExports:t.entryExports});if(await R(t,e,i),!e.dryRun)t.cache?.save();let a=e.reportDiagnostics||e.strict,r=Z(t.diagnostics,a);if(a&&r.length>0)if(e.format==="json")process.stderr.write(te(r));else console.error(ee(r));let p=0;if(s?.bump==="major")p=3;else if(K(r,e.strict).length>0)p=4;return{diagnostics:r,check:s,errors:t.errors,exitCode:p}}export{Xe as CHECK_REPORT_SCHEMA_VERSION,o as ComponentParser,ve as DIAGNOSTICS_SCHEMA_VERSION,Y as DIAGNOSTIC_CODES,c as buildComponentApiDocument,we as cli,Qe as default,Ze as defineConfig,ze as diffApiDocuments,ke as formatCheckReport,Ce as formatCheckReportJson,ce as getWriter,Ke as listWriters,I as registerWriter,X as runCheck,f as sveld};
1
+ import{Y,Z,K,ee,ve,te,c,ze,oe,X,ke,Xe,Ce,B,Ze,j,D,ae,F,J,_,N,I,ce,Ke,Qe,R,we}from"./chunk-2vte7cyp.js";import{o}from"./chunk-sg7vsn8d.js";async function f(n){if(n&&"input"in n)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:m,...u}=n??{},l=await j(),i=B(m??l.entry);if(i===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let e=ae(D(l,u,{entry:i}));F(e),J(e.quiet===!0);let t=await N(i,e.glob===!0,_(e)),s;if(e.check)s=await X(t.components,oe(e),{entryExports:t.entryExports});if(await R(t,e,i),!e.dryRun)t.cache?.save();let a=e.reportDiagnostics||e.strict,r=Z(t.diagnostics,a);if(a&&r.length>0)if(e.format==="json")process.stderr.write(te(r));else console.error(ee(r));let p=0;if(s?.bump==="major")p=3;else if(K(r,e.strict).length>0)p=4;return{diagnostics:r,check:s,errors:t.errors,exitCode:p}}export{Xe as CHECK_REPORT_SCHEMA_VERSION,o as ComponentParser,ve as DIAGNOSTICS_SCHEMA_VERSION,Y as DIAGNOSTIC_CODES,c as buildComponentApiDocument,we as cli,Qe as default,Ze as defineConfig,ze as diffApiDocuments,ke as formatCheckReport,Ce as formatCheckReportJson,ce as getWriter,Ke as listWriters,I as registerWriter,X as runCheck,f as sveld};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.37.7",
3
+ "version": "0.37.8",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions and component documentation for your Svelte components.",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{A,M}from"./chunk-8xbe5qy3.js";export{A as TemplateParseNotImplementedError,M as parse};
@@ -1 +0,0 @@
1
- import{o}from"./chunk-aw6a570w.js";export{o as default};