sveld 0.37.6 → 0.37.7

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.
@@ -0,0 +1 @@
1
+ import{o}from"./chunk-aw6a570w.js";export{o as default};
@@ -0,0 +1,6 @@
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}`:`{
2
+ ${K.join(`;
3
+ `)};
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(`
5
+ `);for(let{name:A,constraint:_}of this.ctx.deferredSlotBlockGenerics){let ee=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${ee}\\b`).test(N))continue;this.accumulateGeneric(A,_)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)r(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=qe(this.ctx.scriptGenericsAttribute.value)}let ct=o.mapToArray(this.ctx.moduleExports),it=o.mapToArray(this.ctx.events).map((N)=>{switch(N.type){case"forwarded":return{...N,element:N.element.name};case"dispatched":return N;default:return N}}).sort(ie),yt=o.mapToArray(this.ctx.typedefs),St=o.mapToArray(this.ctx.contexts),gt={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((N)=>N.location==="props").map((N)=>[N.propName,N])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((N)=>N.location==="moduleExports").map((N)=>[N.propName,N]))};for(let N of rt)if(N.typeSource==="unknown"){let A=gt.props.get(N.name);if(A)N.type="any";let _=A?A.importSource?`Prop "${N.name}" default calls "${A.calleeName}()" imported from "${A.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${N.name}" default calls "${A.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${N.name}" type could not be inferred; falling back to "${N.type??"any"}".`;r(this.ctx,"prop-unknown-type",N.name,_,N.source)}for(let N of ct)if(N.typeSource==="unknown"&&gt.moduleExports.has(N.name))N.type="any";let dt=F,Dt=[];if(dt!==void 0){let N=[];for(let _ of ve){let ee=$e(_,dt);if(ee)N.push({call:_,...ee})}if(N.length>0)T(this.ctx,"dispatch-escapes",dt,this.resolveLocalVarJSDoc(dt)?.sveldIgnore);let A=ue(this.ctx,"dispatch-escapes",dt);for(let{call:_,argumentIndex:ee,property:K}of N){let I=Ze.has(_)?void 0:me(this.ctx,_.callee);if(!I){Dt.push(_);continue}let B=n(this.ctx,_);this.ctx.pendingDispatchEscapeCandidates.push({importSource:I.source,importedName:I.importedName,...I.members?{members:I.members}:{},calleeText:f(this.ctx,_.callee)??I.importedName,dispatcherName:dt,argumentIndex:ee,...K===void 0?{}:{property:K},...B?{source:B}:{},...A?{ignored:A}:{}})}}for(let N of this.ctx.jsDocEventNames){if(Qe.has(N))continue;if(this.ctx.forwardedEvents.has(N))continue;if(this.ctx.props.has(`on${N}`))continue;if(Dt.length>0)continue;let A=pe(this.ctx,"event-no-source",N,`@event "${N}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(N));if(this.ctx.pendingDispatchEscapeCandidates.length>0)this.ctx.deferredEventNoSourceDiagnostics.push(A);else this.ctx.diagnosticRecords.push(A)}for(let N of Dt){let A=f(this.ctx,N.callee)??"";r(this.ctx,"dispatch-escapes",dt??"",`\`${dt}\` is passed to \`${A}\`, which sveld can't follow: it only reads a function imported from another module, by name, as its default export, or through a namespace import. Document the events dispatched there with @event tags.`,n(this.ctx,N))}if(this.ctx.rest_props?.type==="InlineComponent")r(this.ctx,"rest-props-unresolved","$$restProps",`$$restProps is only spread onto component "${this.ctx.rest_props.name}"; sveld cannot infer its rest-prop type. Spread onto a plain element or add an @restProps tag.`);let It=yt.filter((N)=>N.internal).map((N)=>N.name.split("<")[0]);if(It.length>0){let N=It.map((_)=>({name:_,regex:new RegExp(`\\b${_}\\b`)})),A=(_,ee,K)=>{if(!ee)return;for(let{name:I,regex:B}of N){if(!B.test(ee))continue;r(this.ctx,"internal-typedef-referenced",_,`"${_}" references "${I}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,K)}};for(let _ of rt){if(_.internal)continue;A(_.name,_.type,_.source)}for(let _ of ct){if(_.internal)continue;A(_.name,_.type,_.source)}for(let _ of yt){if(_.internal)continue;A(_.name,_.ts)}for(let _ of it){if(_.internal||_.type!=="dispatched")continue;A(_.name,_.detail,_.source)}for(let _ of Xe){if(_.internal)continue;A(_.name??"default",_.slot_props,_.source)}for(let _ of St){if(_.internal)continue;if(_.type!==void 0)A(_.typeName,_.type,_.source);for(let ee of _.properties)A(ee.name,ee.type)}}let _t={source:ne(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:rt,moduleExports:ct,slots:Xe,events:it,typedefs:yt,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:St,customElementTag:this.ctx.customElementTag,customElement:this.ctx.customElement,...this.ctx.cssParts.length>0?{cssParts:this.ctx.cssParts.slice()}:{},...this.ctx.cssProperties.length>0?{cssProperties:this.ctx.cssProperties.slice()}:{},diagnostics:this.ctx.diagnosticRecords.slice()},Ht=Ne(this.ctx);if(Ht)_t[w]=Ht;return _t}}
6
+ export{o};
@@ -0,0 +1,6 @@
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(`
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
+ `)}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
+ ${e.code}
5
+ `}function Z(e,n){let s=e.pos??0,i=n.slice(0,s).split(`
6
+ `).length;return{line:Math.max(1,i-z+1),text:String(e.text??"").trim()}}function Q(e){let n=e.lastIndexOf("declare const");return e.indexOf(I,n)+2}function Y(e){let n=f.resolve(e);while(!0){let s=f.join(n,"tsconfig.json");if(O(s))return s;let i=f.dirname(n);if(i===n)return null;n=i}}export{C as TypeResolver};
package/lib/cli-entry.js CHANGED
@@ -1 +1 @@
1
- import{pe}from"./chunk-jsp9b7b6.js";export{pe as cli};
1
+ import{we}from"./chunk-8xbe5qy3.js";export{we as cli};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{q,V,U,W,me,H,o,Ne,Q,F,ce,Ie,ue,_,Oe,N,S,Y,I,R,k,w,C,Z,Me,Re,P,pe}from"./chunk-jsp9b7b6.js";import{i}from"./chunk-escdydzn.js";async function f(s){if(s&&"input"in s)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:m,...u}=s??{},a=await N(),n=_(m??a.entry);if(n===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let e=Y(S(a,u,{entry:n}));I(e),R(e.quiet===!0);let t=await w(n,e.glob===!0,k(e)),p;if(e.check)p=await F(t.components,Q(e),{entryExports:t.entryExports});if(await P(t,e,n),!e.dryRun)t.cache?.save();let c=e.reportDiagnostics||e.strict,r=V(t.diagnostics,c);if(c&&r.length>0)if(e.format==="json")process.stderr.write(H(r));else console.error(W(r));let l=0;if(p?.bump==="major")l=3;else if(U(r,e.strict).length>0)l=4;return{diagnostics:r,check:p,errors:t.errors,exitCode:l}}export{Ie as CHECK_REPORT_SCHEMA_VERSION,i as ComponentParser,me as DIAGNOSTICS_SCHEMA_VERSION,q as DIAGNOSTIC_CODES,o as buildComponentApiDocument,pe as cli,Re as default,Oe as defineConfig,Ne as diffApiDocuments,ce as formatCheckReport,ue as formatCheckReportJson,Z as getWriter,Me as listWriters,C as registerWriter,F 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-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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.37.6",
3
+ "version": "0.37.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions and component documentation for your Svelte components.",
6
6
  "type": "module",
@@ -202,8 +202,8 @@
202
202
  "name": { "type": "string" },
203
203
  "localName": { "type": "string" },
204
204
  "kind": {
205
- "enum": ["let", "const", "function", "re-export"],
206
- "description": "`re-export` is module-export only: `export { x } from \"...\"`, `export * from \"...\"`, or `export { x }` of an imported binding."
205
+ "enum": ["let", "const", "function", "re-export", "class"],
206
+ "description": "`re-export` is module-export only: `export { x } from \"...\"`, `export * from \"...\"`, or `export { x }` of an imported binding. `class` is module-export only too: a class the module script declares, with its public surface in `members`."
207
207
  },
208
208
  "constant": { "type": "boolean" },
209
209
  "type": { "type": "string" },
@@ -220,7 +220,25 @@
220
220
  "returnType": { "type": "string" },
221
221
  "typeParameters": {
222
222
  "type": "string",
223
- "description": "A function's own type parameter list from its `@template` tags, without angle brackets."
223
+ "description": "A function's own type parameter list from its `@template` tags, or a class's type parameters, without angle brackets."
224
+ },
225
+ "members": {
226
+ "type": "array",
227
+ "description": "Set when `kind` is `class`: its public constructor, methods, and properties, in source order.",
228
+ "items": { "$ref": "#/$defs/classMember" }
229
+ },
230
+ "extends": {
231
+ "type": "string",
232
+ "description": "Set when `kind` is `class` and it extends an imported or exported class: the clause's source text, e.g. `Base<T>`."
233
+ },
234
+ "implements": {
235
+ "type": "array",
236
+ "description": "Set when `kind` is `class` and it implements interfaces: each clause's source text.",
237
+ "items": { "type": "string" }
238
+ },
239
+ "abstract": {
240
+ "const": true,
241
+ "description": "Set when `kind` is `class` and the class is abstract."
224
242
  },
225
243
  "isFunction": { "type": "boolean" },
226
244
  "isFunctionDeclaration": { "type": "boolean" },
@@ -242,6 +260,40 @@
242
260
  "source": { "$ref": "#/$defs/sourceRange" }
243
261
  }
244
262
  },
263
+ "classMember": {
264
+ "type": "object",
265
+ "required": ["kind", "name"],
266
+ "additionalProperties": false,
267
+ "description": "A public member of a `kind: \"class\"` module export. Private, protected, and `@internal` members are left out.",
268
+ "properties": {
269
+ "kind": {
270
+ "enum": ["constructor", "method", "property"],
271
+ "description": "`property` covers fields, constructor parameter properties, and getter/setter pairs."
272
+ },
273
+ "name": { "type": "string" },
274
+ "type": { "type": "string", "description": "A property's type." },
275
+ "params": {
276
+ "type": "array",
277
+ "description": "A method or constructor's parameters. A rest parameter's name starts with `...`.",
278
+ "items": { "$ref": "#/$defs/propParam" }
279
+ },
280
+ "returnType": { "type": "string" },
281
+ "typeParameters": {
282
+ "type": "string",
283
+ "description": "A method's own type parameter list, without angle brackets."
284
+ },
285
+ "static": { "const": true },
286
+ "readonly": { "const": true, "description": "A readonly field, or a getter with no setter." },
287
+ "optional": { "const": true },
288
+ "abstract": { "const": true },
289
+ "description": { "type": "string" },
290
+ "deprecated": { "$ref": "#/$defs/deprecated" },
291
+ "tags": {
292
+ "type": "array",
293
+ "items": { "$ref": "#/$defs/jsdocTag" }
294
+ }
295
+ }
296
+ },
245
297
  "reExport": {
246
298
  "type": "object",
247
299
  "required": ["from", "imported"],
@@ -370,6 +422,10 @@
370
422
  "properties": {
371
423
  "key": { "type": "string" },
372
424
  "typeName": { "type": "string" },
425
+ "type": {
426
+ "type": "string",
427
+ "description": "The context's whole type, when the setContext value is a variable whose type isn't an object type literal (e.g. ModalAPI, or any when untyped). properties is empty then."
428
+ },
373
429
  "description": { "type": "string" },
374
430
  "properties": {
375
431
  "type": "array",
@@ -1 +0,0 @@
1
- import{b,D}from"./chunk-jsp9b7b6.js";export{b as TemplateParseNotImplementedError,D as parse};
@@ -1,6 +0,0 @@
1
- import{le,m,r,fe,p,h,de,T,J,n,K,l,ee,G,t,s,f,u,L,O,g,he,ge,ye,xe,z,M,y,Te,te,Ee,be,E,Se,c,A,ke,re,we,Ce,Pe,ne,ve,B,X,Ae,se,ie,oe,j,d,De,_e,ae,x,D}from"./chunk-jsp9b7b6.js";var St={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 zt(e){return e in St}function Pt(e){if(zt(e))return St[e];return"HTMLElement"}function dt(){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,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,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}var Kt=new Set(["Component","SvelteComponent","SvelteSelf"]),Wt=new Set(["RegularElement","SvelteElement"]);function Qe(e){return Kt.has(e)}function Ze(e){return Wt.has(e)}function Ut({hasTypeScriptType:e,hasJSDocType:o,inferredType:a,finalType:b}){if(e)return"typescript";if(o)return"jsdoc";if(a!==void 0)return"default";if(b!==void 0)return"inferred";return"unknown"}function et(e){let o=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,a=e.jsdocParams??e.resolvedParams,b=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&o==="() => any"&&b){let w=e.jsdocTypeParameters?`<${e.jsdocTypeParameters}>`:"";o=a&&a.length>0?`${w}(${a.map((U)=>`${U.name}${U.optional?"?":""}: ${U.type}`).join(", ")}) => ${b}`:`${w}() => ${b}`}let S=e.jsdocDescription??e.resolvedDescription;if(S===void 0&&o!==void 0)S=e.typedefs?.get(o)?.description;let k=Ut({hasTypeScriptType:e.explicitType!==void 0,hasJSDocType:e.jsdocType!==void 0||e.jsdocParams!==void 0||e.jsdocReturnType!==void 0||e.resolvedType!==void 0,inferredType:e.inferredTypeForSource,finalType:o}),v=e.initializerIsFunction||e.isFunctionDeclaration||e.inferIsFunctionFromTypeSignature===!0&&(!!e.jsdocParams?.length||e.jsdocReturnType!==void 0||!!e.jsdocType?.includes("=>")||!!e.resolvedType?.includes("=>")||!!e.explicitType?.includes("=>")),C=v?e.jsdocTypeParameters:void 0;return{type:o,typeSource:k,description:S,params:a,returnType:b,isFunction:v,typeParameters:C}}function Xt(e){if(!e||typeof e!=="object"||!("type"in e))return;let o=String(e.type),a=Qe(o);if(!a&&!Ze(o))return;let b="name"in e&&typeof e.name==="string"?e.name:void 0;if(!b)return;let S=a?{type:"InlineComponent",name:b}:{type:"Element",name:b};if(b==="svelte:element"&&"tag"in e&&e.tag&&typeof e.tag==="object"){let k=e.tag;if(k.type==="Literal"&&typeof k.value==="string")S.thisValue=k.value}return S}function vt(e,o){let a=Xt(o);if(!a)return;if(e.rest_props===void 0){e.rest_props=a;return}if(e.rest_props.type==="InlineComponent"&&a.type==="Element")e.rest_props=a}function Le(e,o,a){if(!o||e.has(o))return;e.set(o,a)}function tt(e,o){for(let a=e.activeScopes.length-1;a>=0;a-=1){let b=e.activeScopes[a]?.get(o);if(!b)continue;return b.kind==="prop"?b.publicPropName:void 0}return}function Me(e,o=new Set){if(!e||typeof e!=="object"||!("type"in e))return o;switch(e.type){case"Identifier":o.add(e.name);break;case"AssignmentPattern":Me(e.left,o);break;case"ArrayPattern":for(let a of e.elements)Me(a??void 0,o);break;case"ObjectPattern":for(let a of e.properties)if(a.type==="Property")Me(a.value,o);else if(a.type==="RestElement")Me(a.argument,o);break;case"RestElement":Me(e.argument,o);break}return o}function mt(e,o){if(!o||typeof o!=="object"||!("type"in o))return;if(o.type==="Identifier"){let b=tt(e,o.name);if(b)e.reactive_vars.add(b);return}let a=Me(o);for(let b of a){let S=tt(e,b);if(S)e.reactive_vars.add(S)}}function nt(e){if(!e||typeof e!=="object"||!("type"in e))return!1;switch(String(e.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"AwaitBlock":return!0;default:return!1}}function Dt(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let o=String(e.type);return o==="FunctionDeclaration"||o==="FunctionExpression"||o==="ArrowFunctionExpression"}function qt(e,o){let a=e.scopeDeclarations.get(o);if(!a)a=new Map,e.scopeDeclarations.set(o,a);return a}function Yt(e,o,a){let b=[];if(a.id.type==="Identifier")return b.push({kind:"local",name:a.id.name}),b;if(a.id.type!=="ObjectPattern")return b;for(let S of a.id.properties){if(S.type==="RestElement"){if(S.argument.type==="Identifier")b.push({kind:"local",name:S.argument.name});continue}if(S.computed)continue;let k=e.getPropertyName(S.key);if(!k)continue;let v;if(S.value.type==="Identifier")v=S.value.name;else if(S.value.type==="AssignmentPattern"&&S.value.left.type==="Identifier")v=S.value.left.name;if(!v)continue;b.push({kind:"prop",name:v,publicPropName:k})}return b}function ut(e,o,a,b,S){if(!le(o))return;let k=S?.allowRunesProps??!1,v=S?.forceProp??!1,C=o;for(let w of C.declarations){if(k&&p(h(w.init),"$props")){for(let Y of Yt(e,C,w))Le(Y.kind==="prop"?a:b,Y.name,Y.kind==="prop"?{kind:"prop",publicPropName:Y.publicPropName}:{kind:"local"});continue}let U=C.kind==="var"?b:a,W=v?"prop":"local";for(let Y of Me(w.id))Le(U,Y,W==="prop"?{kind:"prop",publicPropName:Y}:{kind:"local"})}}function Qt(e,o){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")Le(o,e.id.name,{kind:"local"});for(let a of e.params)for(let b of Me(a))Le(o,b,{kind:"local"})}function Zt(e,o,a,b){if(!Array.isArray(o))return;for(let S of o){if(!S||typeof S!=="object"||!("type"in S))continue;switch(S.type){case"VariableDeclaration":ut(e,S,a,b);break;case"FunctionDeclaration":if(S.id?.name)Le(a,S.id.name,{kind:"local"});break;case"ClassDeclaration":if(S.id?.name)Le(a,S.id.name,{kind:"local"});break}}}function en(e,o,a){if(!a||typeof a!=="object")return;let b="content"in a&&a.content&&typeof a.content==="object"&&"body"in a.content&&Array.isArray(a.content.body)?a.content:("body"in a)&&Array.isArray(a.body)?a:void 0;if(!b||!("body"in b)||!Array.isArray(b.body))return;for(let S of b.body){if(!S||typeof S!=="object"||!("type"in S))continue;switch(S.type){case"ImportDeclaration":for(let k of S.specifiers??[])if(k.local?.name)Le(o.componentScope,k.local.name,{kind:"local"});break;case"VariableDeclaration":ut(e,S,o.componentScope,o.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(S.id?.name)Le(o.componentScope,S.id.name,{kind:"local"});break;case"ClassDeclaration":if(S.id?.name)Le(o.componentScope,S.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!S.declaration||typeof S.declaration!=="object"||!("type"in S.declaration))break;if(S.declaration.type==="VariableDeclaration")ut(e,S.declaration,o.componentScope,o.componentScope,{forceProp:!0});else if(S.declaration.type==="FunctionDeclaration"&&S.declaration.id?.name)Le(o.componentScope,S.declaration.id.name,{kind:"prop",publicPropName:S.declaration.id.name});break}}}function Ct(e,o){o.componentScope.clear(),o.scopeDeclarations=new Map,o.activeScopes.length=0,en(e,o,o.parsed?.instance)}function Mt(e){return{varScopeStack:[e.componentScope]}}function Nt(e,o,a,b){if(!nt(b))return;let S=qt(o,b),k=a.varScopeStack[a.varScopeStack.length-1]??o.componentScope;switch(String(b.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Qt(b,S);break;case"BlockStatement":Zt(e,b.body,S,k);break;case"CatchClause":if("param"in b)for(let C of Me(b.param))Le(S,C,{kind:"local"});break;case"EachBlock":{let C=b;for(let w of Me(C.context))Le(S,w,{kind:"local"});if(typeof C.index==="string")Le(S,C.index,{kind:"local"});else if(C.index&&"name"in C.index)Le(S,C.index.name,{kind:"local"});break}case"AwaitBlock":{let C=b;for(let w of Me(C.value))Le(S,w,{kind:"local"});for(let w of Me(C.error))Le(S,w,{kind:"local"});break}}if(Dt(b))a.varScopeStack.push(S);return S}function kt(e,o){if(Dt(o))e.varScopeStack.pop()}var Rt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function tn(e,o){switch(o?.type){case"MemberExpression":return o.computed||e===o.object;case"MethodDefinition":return!!o.computed;case"MetaProperty":return e===o.meta;case"PropertyDefinition":return o.computed||e===o.value;case"Property":return o.computed||e===o.value;case"ExportSpecifier":case"ImportSpecifier":return e===o.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}var nn=Array.from(Rt);function Lt(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function rn(e){if(e.includes("\\u"))return!0;for(let o of nn){let a=e.indexOf(o);while(a!==-1){if(!Lt(e.charCodeAt(a-1))&&!Lt(e.charCodeAt(a+o.length)))return!0;a=e.indexOf(o,a+1)}}return!1}function on(e,o){for(let a=o.length-1;a>=0;a-=1)if(o[a]?.has(e))return!0;return!1}function an(e){let o=new Set;if(!e||typeof e!=="object"||!("type"in e))return o;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let a=e;if(a.id?.name)o.add(a.id.name);for(let b of a.params??[])Me(b,o);break}case"BlockStatement":at(e.body,o);break;case"CatchClause":Me(e.param,o);break;case"EachBlock":{let a=e;if(Me(a.context,o),typeof a.index==="string")o.add(a.index);else if(a.index?.name)o.add(a.index.name);break}case"AwaitBlock":{let a=e;Me(a.value,o),Me(a.error,o);break}}return o}function at(e,o){if(!Array.isArray(e))return;for(let a of e){if(!a||typeof a!=="object"||!("type"in a))continue;switch(String(a.type)){case"ImportDeclaration":for(let b of a.specifiers??[])if(b.local?.name)o.add(b.local.name);break;case"VariableDeclaration":for(let b of a.declarations??[])Me(b.id,o);break;case"FunctionDeclaration":case"ClassDeclaration":{let b=a.id?.name;if(b)o.add(b);break}case"ExportNamedDeclaration":{let b=a.declaration;if(b&&typeof b==="object"&&"type"in b)at([b],o);break}}}}function ft(e,o){if(!e||typeof e!=="object")return!1;return yt(e,void 0,[...o])}function yt(e,o,a){if(ae(e.type))return!1;let b=nt(e);if(b)a.push(an(e));let S=!1;if(o&&e.type==="Identifier"&&e.name!==void 0&&Rt.has(e.name)&&!o.type.startsWith("TS")&&tn(e,o)&&!on(e.name,a))S=!0;else for(let k in e){if(k==="leadingComments")continue;let v=e[k];if(!v||typeof v!=="object")continue;if(Array.isArray(v)){for(let C=0;C<v.length;C++){let w=v[C];if(w&&typeof w==="object"&&typeof w.type==="string"){if(yt(w,e,a)){S=!0;break}}}if(S)break}else if(typeof v.type==="string"){if(yt(v,e,a)){S=!0;break}}}if(b)a.pop();return S}function wt(e){if(!e||typeof e!=="object")return;if("content"in e){let o=e.content,a=o&&typeof o==="object"&&"body"in o?o.body:void 0;if(Array.isArray(a))return a}if("body"in e&&Array.isArray(e.body))return e.body;return}function At(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let o=e.parsed;if(!o)return"legacy";if(e.source!==void 0&&!rn(e.source))return"legacy";let a=new Set;at(wt(o.module),a);let b=new Set;return at(wt(o.instance),b),ft(o.module,[a])||ft(o.instance,[a,b])||ft(o.fragment,[a,b])?"runes":"legacy"}var sn=/[A-Za-z_$][\w$]*/g;function cn(e,o,a){let b=new Map,S=o.typeParameters?.params,k=a.typeArguments?.params;if(!S?.length||!k?.length)return b;for(let v=0;v<S.length;v++){let C=S[v]?.name,w=k[v];if(!C||w?.start===void 0||w?.end===void 0)continue;let U=s(e,w.start,w.end)?.trim();if(U)b.set(C,U)}return b}function pn(e,o){if(o.size===0)return e;return e.replace(sn,(a)=>o.get(a)??a)}function We(e,o,a,b,S=new Set){let k=new Map;if(!a?.type)return k;let v=(C)=>{for(let w of C){if(w?.type!=="TSPropertySignature"||w.computed)continue;if(!w.key)continue;let U=e.getPropertyName(w.key);if(!U)continue;let W=w.typeAnnotation?.start,Y=w.typeAnnotation?.end;if(W===void 0||Y===void 0)continue;let me=s(o,W+1,Y)?.trim();if(!me)continue;A(o,w.typeAnnotation?.typeAnnotation),k.set(U,{type:me,optional:w.optional===!0,source:t(o,w)})}};switch(a.type){case"TSTypeLiteral":v(a.members??[]);break;case"TSInterfaceDeclaration":v(a.body?.body??[]);break;case"TSTypeAliasDeclaration":{let C=We(e,o,a.typeAnnotation,b,S);for(let[w,U]of C)k.set(w,U);break}case"TSTypeReference":{let C=be(a.typeName);if(!C||S.has(C))break;let w=b.get(C);if(!w)break;S.add(C);let U=We(e,o,w,b,S);S.delete(C);let W=cn(o,w,a);for(let[Y,me]of U)k.set(Y,W.size===0?me:{...me,type:pn(me.type,W)});break}case"TSIntersectionType":for(let C of a.types??[]){let w=We(e,o,C,b,S);for(let[U,W]of w)k.set(U,W)}break;case"TSParenthesizedType":{let C=We(e,o,a.typeAnnotation,b,S);for(let[w,U]of C)k.set(w,U);break}}return k}function ln(e){let o={};for(let[a,b]of Object.entries(e))o[a]={...b.attribute===void 0?{}:{attribute:b.attribute},...b.reflect===void 0?{}:{reflect:b.reflect},...b.type===void 0?{}:{type:b.type}};return o}function It(e,o,a){if(o.runesPropsDeclarationMetadataByDeclaratorStart.clear(),o.explicitPropTypesByName.clear(),o.explicitVariableTypesByName.clear(),o.typeImportBindingsByLocalName.clear(),o.localTypeDeclarationsByName.clear(),o.additionalTypeDependencyNodes.length=0,o.typedRunesPropsDeclarations.length=0,!o.source)return;let b=a;o.scriptLanguage=e.resolveScriptLanguage(b);let S=b.options?.customElement;o.customElementTag=S?.tag,o.customElement=S?{...S.tag===void 0?{}:{tag:S.tag},...S.shadow==="open"||S.shadow==="none"?{shadow:S.shadow}:{},...S.props?{props:ln(S.props)}:{},...S.extend===void 0?{}:{extend:!0}}:void 0,o.runesOptionOverride=b.options?.runes,o.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(b);let k=b.instance?.content?.body??[];for(let v of k){if(!v?.type)continue;if(v.type==="ImportDeclaration"&&v.source?.value)for(let C of v.specifiers??[]){let w=C.local?.name;if(!w)continue;if(!(v.importKind==="type"||C.importKind==="type"))continue;let W,Y;if(C.type==="ImportSpecifier")W="named",Y=C.imported?.type==="Identifier"?C.imported.name:typeof C.imported?.value==="string"?C.imported.value:void 0;else if(C.type==="ImportDefaultSpecifier")W="default";else if(C.type==="ImportNamespaceSpecifier")W="namespace";if(!W)continue;o.typeImportBindingsByLocalName.set(w,{importedName:Y,localName:w,source:String(v.source.value),specifierType:W})}if((v.type==="TSInterfaceDeclaration"||v.type==="TSTypeAliasDeclaration")&&v.id?.name&&v.start!==void 0&&v.end!==void 0)o.localTypeDeclarationsByName.set(v.id.name,{code:s(o,v.start,v.end)?.trim()??"",node:v,start:v.start});if(v.type==="TSEnumDeclaration"&&v.id?.name&&v.start!==void 0&&v.end!==void 0)o.localTypeDeclarationsByName.set(v.id.name,{code:ke(o,v)??"",node:v,start:v.start});if(v.type==="ExportNamedDeclaration"&&v.declaration?.type==="VariableDeclaration")for(let C of v.declaration.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let w=E(o,C.id.typeAnnotation);if(w)o.explicitPropTypesByName.set(C.id.name,w),A(o,C.id.typeAnnotation?.typeAnnotation)}else if(v.type==="VariableDeclaration")for(let C of v.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let w=E(o,C.id.typeAnnotation);if(w)o.explicitVariableTypesByName.set(C.id.name,w)}}for(let v of k){if(!v||typeof v!=="object"||!("declarations"in v))continue;for(let C of v.declarations??[]){if(!p(h(C.init),"$props"))continue;let w=C.id?.typeAnnotation?void 0:de(C.init),U=C.id?.typeAnnotation?.typeAnnotation??w,W=C.id?.typeAnnotation?E(o,C.id.typeAnnotation):Se(o,w),Y=We(e,o,U,new Map(Array.from(o.localTypeDeclarationsByName.entries(),([Re,Je])=>[Re,Je.node]))),me=new Set,Fe=new Set;if(c(o,U,me,Fe),Pe(o,me,Fe),C.start!==void 0){let Re={canonicalType:W,props:Y,referencedImportedTypes:me,referencedLocalTypes:Fe};if(o.runesPropsDeclarationMetadataByDeclaratorStart.set(C.start,Re),W)o.typedRunesPropsDeclarations.push(Re)}}}}function _t(e,o,a){for(let b of a.declarations){if(!p(h(b.init),"$props"))continue;if(b.id.type==="Identifier"){o.wholePropsLocals.add(b.id.name),o.restPropLocals.add(b.id.name);let v=te(o,b.start);if(v)for(let[C,w]of v.props)L(e,o,C,{name:C,kind:"let",type:w.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!w.optional,constant:!1,reactive:!1,source:w.source});continue}if(b.id.type!=="ObjectPattern")continue;let S=d(o,e,a),k=b.id.properties.filter((v)=>{if(v.type!=="Property"||v.computed)return!1;if(!e.getPropertyName(v.key))return!1;if(v.value.type==="Identifier")return!0;return v.value.type==="AssignmentPattern"&&v.value.left.type==="Identifier"}).length;for(let v of b.id.properties){if(v.type==="RestElement"){if(v.argument.type==="Identifier")o.restPropLocals.add(v.argument.name);continue}let C=e.getPropertyName(v.key);if(!C)continue;let w,U;if(v.value.type==="Identifier")w=v.value.name;else{let Ke=v.value;w=Ke.left.name,U=Ke.right}if(!w)continue;if(e.trackPropLocalName(C,w),C==="children")o.snippetPropLocals.add(w);let W=De(o,e,v)??(k===1?S:void 0),Y=Ee(o,b.start,C),{init:me,bindable:Fe}=he(U),Re=me==null?{isFunction:!1}:g(e,o,me),{value:Je,type:Ge,isFunction:ct,defaultValue:ze}=Re,Ue=Y?.type===void 0&&W?.type===void 0?Re.resolvedType:void 0;O(o,Re,C,"props");let{type:Xe,typeSource:rt,description:qe,params:ot,returnType:it,isFunction:Be}=et({explicitType:Y?.type,typeSeed:Ge,inferredTypeForSource:Ge,jsdocType:W?.type,jsdocDescription:W?.description,jsdocParams:W?.params,jsdocReturnType:W?.returnType,resolvedType:Ue,resolvedDescription:Re.resolvedDescription,resolvedParams:Re.resolvedParams,resolvedReturnType:Re.resolvedReturnType,initializerIsFunction:ct,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(Fe)o.reactive_vars.add(C);l(o,"prop-unknown-type",C,W?.sveldIgnore),L(e,o,C,{name:C,...w===C?{}:{localName:w},kind:"let",description:qe,binding:W?.binding,deprecated:W?.deprecated,tags:W?.tags,...W?.internal?{internal:!0}:{},...Fe?{bindable:!0}:{},type:Xe,typeSource:rt,value:Je,defaultValue:ze,params:ot,returnType:it,isFunction:Be,isFunctionDeclaration:!1,isRequired:!Fe&&me==null&&Y?.optional!==!0,constant:!1,reactive:Fe,source:t(o,v)})}}}function dn(e){let a=e.indexOf("EventDispatcher");if(a===-1)return;let b=a+15;while(e[b]===" ")b++;if(e[b]!=="<")return;let S=0,k=b;for(;b<e.length;b++)if(e[b]==="<")S++;else if(e[b]===">"){if(S--,S===0)return e.slice(k+1,b)}return}function un(e){let o=[],a=0,b=0;for(let S=0;S<e.length;S++){let k=e[S];if(k==="{"||k==="("||k==="["||k==="<")a++;else if(k==="}"||k===")"||k==="]"||k===">")a=Math.max(a-1,0);else if(a===0&&(k===";"||k===","))o.push(e.slice(b,S)),b=S+1}return o.push(e.slice(b)),o.map((S)=>S.trim()).filter((S)=>S.length>0)}var mn=/^["']|["']$/g,fn=/\?$/,yn=/^\{/,gn=/\}$/;function xn(e){let o=0;for(let a=0;a<e.length;a++){let b=e[a];if(b==="{"||b==="("||b==="["||b==="<")o++;else if(b==="}"||b===")"||b==="]"||b===">")o=Math.max(o-1,0);else if(o===0&&b===":"){let S=e.slice(0,a).trim().replace(fn,"").replace(mn,""),k=e.slice(a+1).trim();if(!S||!k)return;return{name:S,type:k}}}return}function Ft(e,o,a,b,S){if(a){let w=new Map(Array.from(o.localTypeDeclarationsByName.entries(),([W,Y])=>[W,Y.node])),U=We(e,o,a,w);for(let[W,Y]of U)y(o,{name:W,detail:Y.type,has_argument:!0,source:Y.source});return}let k=e.resolveLocalVarJSDoc(b)?.type,v=k?dn(k):void 0;if(!v)return;let C=v.trim().replace(yn,"").replace(gn,"");for(let w of un(C)){let U=xn(w);if(!U)continue;y(o,{name:U.name,detail:U.type,has_argument:!0,source:S})}}function Ht(e,o){if(e.syntaxMode!=="runes")return;for(let[a,b]of Array.from(e.events.entries())){if(b.type!=="dispatched")continue;if(o.has(a)||e.forwardedEvents.has(a))continue;let S=`on${a}`,k=e.props.get(S);if(!k)continue;let v=k.type!==void 0||k.params!==void 0||k.returnType!==void 0,C=b.detail===void 0||b.detail==="undefined"||b.detail==="null"?"() => void":`(detail: ${b.detail}) => void`;e.props.set(S,{...k,description:k.description??b.description,type:v?k.type:C,typeSource:v?k.typeSource:"inferred",isFunction:!0}),e.events.delete(a)}}var jt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function gt(e){return e!==null&&typeof e==="object"&&typeof e.type==="string"}function Bt(e){if(!jt.has(e.type))return e;let o=e.expression;while(o&&jt.has(o.type))o=o.expression;return o??e}function st(e){if(!gt(e))return;xt(e)}function xt(e){for(let o in e){if(o==="leadingComments")continue;let a=e[o];if(!a||typeof a!=="object")continue;if(Array.isArray(a))for(let b=0;b<a.length;b++){let S=a[b];if(!gt(S))continue;let k=Bt(S);if(k!==S)a[b]=k;xt(k)}else if(gt(a)){let b=Bt(a);if(b!==a)e[o]=b;xt(b)}}}function bn(e,o,a,b,S){for(let k of e){if(k.type!=="Block"||k.start<a||k.end>b)continue;let v=o.slice(k.start,k.end);S.push({end:k.end,isJsDoc:v.startsWith("/**")&&v.length>4,text:v})}}function Vt(e,o,a){if(!e||typeof e!=="object"||!("type"in e))return;let b=e;if(b.type==="FunctionDeclaration"){if(b.id?.type==="Identifier"&&b.id.name)a.push({name:b.id.name,start:o});return}if(b.type==="VariableDeclaration"){for(let S of b.declarations??[])if(S?.id?.type==="Identifier"&&S.id.name)a.push({name:S.id.name,start:o})}}function Tn(e){let o=[];for(let a of e){if(!a||typeof a!=="object"||!("type"in a))continue;let b=a;if(b.start===void 0)continue;if(b.type==="ExportNamedDeclaration"&&b.declaration)Vt(b.declaration,b.start,o);else Vt(b,b.start,o)}return o}function hn(e,o,a){let b;for(let S of e){if(S.end>o)break;if(!S.isJsDoc)continue;if(!ie.test(a.slice(S.end,o)))continue;b=S}return b}function Ot(e,o){let a=new Map;if(!e.source)return a;let b=[e.parsed?.module,e.parsed?.instance],S=[],k=[],v=e.parsed?.comments??[];for(let C of b){let w=C?.content;if(!w?.body||w.start===void 0||w.end===void 0)continue;bn(v,e.source,w.start,w.end,S),k.push(...Tn(w.body))}S.sort((C,w)=>C.end-w.end);for(let C of k){let w=hn(S,C.start,e.source);if(!w)continue;let U=oe(e,w.text),{type:W,description:Y,ignore:me,internal:Fe}=j(U);if(me.length>0)l(e,"context-any-type",C.name,me);if(!W)continue;a.set(C.name,{type:o.aliasType(W.type),description:Y||W.description,internal:Fe||void 0})}return a}function bt(e){if(e?.type==="Identifier")return e.name;return typeof e?.value==="string"?e.value:void 0}function $t(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var En=null,Gt=/^@component/,Sn=/\r/g,Pn=/^\{\s*\}$/,vn=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class i{ctx=dt();static mapToArray(e){return Array.from(e,([o,a])=>a)}static getStaticAttributeValue(e){if(!Array.isArray(e.value))return;return e.value.map((o)=>o.data??o.raw??"").join("").trim()}resolveScriptLanguage(e){let o=[e.instance,e.module].filter((b)=>b!==void 0),a=!1;for(let b of o){let S=b.attributes?.find((v)=>v.name==="lang");if(!S){a=!0;continue}if(i.getStaticAttributeValue(S)?.toLowerCase()==="ts")return"ts"}return a?"js":void 0}resolveScriptGenericsAttribute(e){let o=e.instance?.attributes?.find((v)=>v.name==="generics");if(!o)return;let a=t(this.ctx,o),b=e.instance?.attributes?.find((v)=>v.name==="lang");if((b?i.getStaticAttributeValue(b)?.toLowerCase():void 0)!=="ts"){n(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',a);return}let k=i.getStaticAttributeValue(o);if(!k)return;return{value:k,source:a}}resolvePublicPropName(e){return this.ctx.propLocalToPublicName.get(e)??e}trackPropLocalName(e,o=e){this.ctx.propLocalToPublicName.set(o,e)}getPropByLocalOrPublic(e){return this.ctx.props.get(this.resolvePublicPropName(e))}getPropTypeByLocalOrPublic(e){return this.getPropByLocalOrPublic(e)?.type}getExplicitPropType(e){return this.ctx.explicitPropTypesByName.get(e)}getPropertyName(e){if(!e||typeof e!=="object"||!("type"in e))return;if(r(e))return e.name;if(m(e))return e.value==null?void 0:String(e.value);return}isNumericConstant(e){if(!e||typeof e!=="object"||!("type"in e))return!1;if(e.type!=="MemberExpression")return!1;let o=e,a=o.object&&"name"in o.object?o.object.name:void 0,b=o.property&&"name"in o.property?o.property.name:void 0;if(!a||!b)return!1;if(a==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(b);if(a==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(b);return!1}resolveLocalVarJSDoc(e){for(let a of this.ctx.vars)if(a.declarations.some((S)=>S.id&&typeof S.id==="object"&&("type"in S.id)&&S.id.type==="Identifier"&&("name"in S.id)&&S.id.name===e))return d(this.ctx,this,a);let o=this.ctx.funcDecls.get(e);if(o)return d(this.ctx,this,o);return}addModuleExport(e,o){if(u(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let a=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...a,...o})}else this.ctx.moduleExports.set(e,o)}resolveExportSpecifier(e,o){let a=bt(o.local),b=bt(o.exported);if(!a||!b)return;if(e.source!=null)return{localName:a,exportedName:b};for(let S of this.ctx.vars){let k=S.declarations.find((v)=>v.id.type==="Identifier"&&v.id.name===a);if(k)return{localName:a,exportedName:b,declaration:S,declarator:k}}return{localName:a,exportedName:b}}recordUnresolvedExportSpecifier(e,o,a){let b=e.source?.value,S=typeof b==="string"?`it re-exports from "${b}"`:this.ctx.valueImportBindingsByLocalName.has(o)?"it re-exports an imported binding":"no matching local declaration was found";n(this.ctx,"export-unresolved",a,`export "${a}" was skipped because ${S}; sveld only resolves exports of a local declaration.`,t(this.ctx,e))}aliasType(e){if(e==="*")return"any";return e.trim()}findVariableTypeAndDescription(e){let o=this.getPropByLocalOrPublic(e);if(o?.type)return{type:o.type,description:o.description,internal:o.internal};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=Ot(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let a=this.ctx.variableInfoCache.get(e),b=this.ctx.explicitVariableTypesByName.get(e);if(b)return{type:b,description:a?.description,internal:a?.internal};return a??null}accumulateGeneric(e,o){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${e}`,`${this.ctx.generics[1]}, ${o}`];else this.ctx.generics=[e,o]}cleanup(){this.ctx=dt()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(e){if(!e.includes("@ts-"))return e;return i.SCRIPT_BLOCK_REGEX.lastIndex=0,e.replace(i.SCRIPT_BLOCK_REGEX,(o,a,b,S)=>{i.TS_DIRECTIVE_REGEX.lastIndex=0;let k=b.replace(i.TS_DIRECTIVE_REGEX,"");return a+k+S})}parseSvelteComponent(e,o){this.cleanup(),this.ctx.componentFilePath=o.filePath;let a=i.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=a;let b=D(a);if(It(this,this.ctx,b),this.ctx.parsed=b,this.ctx.scriptLanguage==="ts")st(this.ctx.parsed.module),st(this.ctx.parsed.instance),st(this.ctx.parsed.fragment);this.ctx.syntaxMode=At(this.ctx);let S=this.ctx.parsed.css,k=S?.start!==void 0&&S?.end!==void 0?a.slice(0,S.start)+" ".repeat(S.end-S.start)+a.slice(S.end):a;se(this.ctx,this.ctx.parsed?.module),se(this.ctx,this.ctx.parsed?.instance),_e(this.ctx,this,k);let v={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module){let P=Ae(this.ctx.parsed.module),N=(F,H,R)=>{let I=d(this.ctx,this,F);this.addModuleExport(H==="*"?`* from ${R.from}`:H,{name:H,kind:"re-export",description:I?.description,deprecated:I?.deprecated,tags:I?.tags,...I?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:R,source:t(this.ctx,F)})},_=(F,H,R)=>{let I=[];if(H.type==="FunctionDeclaration"){let Z=H;if(!Z.id?.name)return;let Q=this.ctx.scriptLanguage==="ts"?re(this.ctx,Z):void 0;I.push({prop_name:Z.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:Q?.hasAnnotations?void 0:"() => any",explicitType:Q?.hasAnnotations?Q.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(H.type==="VariableDeclaration"){let Z=H,Q=$t(Z.kind),ce=R?.declarator?[R.declarator]:Z.declarations;for(let pe of ce){if(!pe||typeof pe!=="object"||!("id"in pe))continue;let{id:ue,init:Ne}=pe;if(!ue||typeof ue!=="object"||!("name"in ue))continue;let Ie=ue.name,Ve=R?.exportedName??Ie,q=Ne==null?{isFunction:!1}:g(this,this.ctx,Ne),{value:He,type:je,isFunction:Oe,defaultValue:$e}=q,Ye=q;O(this.ctx,q,Ie,"moduleExports"),I.push({prop_name:Ve,kind:Q,isFunctionDeclaration:!1,value:He,typeSeed:je,explicitType:this.getExplicitPropType(Ie),initializerIsFunction:Oe,defaultValue:$e,inferredTypeForSource:je,resolvedJSDoc:Ye})}if(I.length===0)return}else return;let V=d(this.ctx,this,F);for(let{prop_name:Z,kind:Q,isFunctionDeclaration:ce,value:pe,typeSeed:ue,explicitType:Ne,initializerIsFunction:Ie,defaultValue:Ve,inferredTypeForSource:q,resolvedJSDoc:He}of I){let{type:je,typeSource:Oe,description:$e,params:Ye,returnType:pt,isFunction:lt,typeParameters:Jt}=et({explicitType:Ne,typeSeed:ue,inferredTypeForSource:q,jsdocType:V?.type,jsdocDescription:V?.description,jsdocParams:V?.params,jsdocReturnType:V?.returnType,jsdocTypeParameters:V?.typeParameters,resolvedType:He?.resolvedType,resolvedDescription:He?.resolvedDescription,resolvedParams:He?.resolvedParams,resolvedReturnType:He?.resolvedReturnType,initializerIsFunction:Ie,isFunctionDeclaration:ce,typedefs:this.ctx.typedefs});this.addModuleExport(Z,{name:Z,kind:Q,description:$e,deprecated:V?.deprecated,tags:V?.tags,...V?.internal?{internal:!0}:{},type:je,typeSource:Oe,value:pe,defaultValue:Ve,params:Ye,returnType:pt,typeParameters:Jt,isFunction:lt,isFunctionDeclaration:ce,isRequired:!1,constant:Q==="const",reactive:!1,source:t(this.ctx,F)})}};x(this.ctx.parsed?.module,(F)=>{if(F.type==="ImportDeclaration")X(this.ctx,F);if(F.type==="FunctionDeclaration"){let H=F;if(H.id?.name)this.ctx.funcDecls.set(H.id.name,H)}if(F.type==="VariableDeclaration")this.ctx.vars.add(F);if(F.type==="ExportNamedDeclaration"){if(F.declaration!=null){_(F,F.declaration);return}let H=F.source?.value;for(let R of F.specifiers){let I=this.resolveExportSpecifier(F,R);if(!I)continue;if(I.exportedName==="default"){n(this.ctx,"module-export-conflict",I.exportedName,`export "default" was skipped because it collides with the component's own default export.`,t(this.ctx,F));continue}let V=typeof H==="string"?{from:H,imported:I.localName}:P.get(I.localName);if(I.declaration)_(F,I.declaration,I);else if(V)N(F,I.exportedName,V);else this.recordUnresolvedExportSpecifier(F,I.localName,I.exportedName)}}if(F.type==="ExportAllDeclaration"&&typeof F.source.value==="string"){let H=(F.exported&&bt(F.exported))??"*";N(F,H,{from:F.source.value,imported:"*"})}})}let C,w,U,W=new Set,Y=new Set,me=[],Fe=[];Ct(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Re=Mt(this.ctx),Je=(P,N,_)=>{let F=[];if(N.type==="FunctionDeclaration"){let R=N;if(!R.id?.name)return;let I=R.id.name,V=this.ctx.scriptLanguage==="ts"?re(this.ctx,R):void 0;F.push({prop_name:I,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:V?.hasAnnotations?void 0:"() => any",explicitType:V?.hasAnnotations?V.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:R.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(N.type==="VariableDeclaration"){let R=N,I=$t(R.kind),V=_?.declarator?[_.declarator]:R.declarations;for(let Z of V){if(!Z||typeof Z!=="object"||!("id"in Z))continue;let{id:Q,init:ce}=Z;if(!Q||typeof Q!=="object"||!("name"in Q))continue;let pe=Q.name,ue=_?.exportedName??pe,Ne=I==="let"&&ce==null,Ie=ce==null?{isFunction:!1}:g(this,this.ctx,ce),{value:Ve,type:q,isFunction:He,defaultValue:je}=Ie,Oe=Ie;O(this.ctx,Ie,ue,"props"),F.push({prop_name:ue,kind:I,isFunctionDeclaration:!1,value:Ve,typeSeed:q,explicitType:this.getExplicitPropType(pe),initializerIsFunction:He,isRequired:Ne,localName:pe,defaultValue:je,inferredTypeForSource:q,resolvedJSDoc:Oe})}if(F.length===0)return}else return;let H=d(this.ctx,this,P);for(let{prop_name:R,kind:I,isFunctionDeclaration:V,value:Z,typeSeed:Q,explicitType:ce,initializerIsFunction:pe,isRequired:ue,localName:Ne,defaultValue:Ie,inferredTypeForSource:Ve,resolvedJSDoc:q}of F){let{type:He,typeSource:je,description:Oe,params:$e,returnType:Ye,isFunction:pt,typeParameters:lt}=et({explicitType:ce,typeSeed:Q,inferredTypeForSource:Ve,jsdocType:H?.type,jsdocDescription:H?.description,jsdocParams:H?.params,jsdocReturnType:H?.returnType,jsdocTypeParameters:H?.typeParameters,resolvedType:q?.resolvedType,resolvedDescription:q?.resolvedDescription,resolvedParams:q?.resolvedParams,resolvedReturnType:q?.resolvedReturnType,initializerIsFunction:pe,isFunctionDeclaration:V,typedefs:this.ctx.typedefs});l(this.ctx,"prop-unknown-type",R,H?.sveldIgnore),L(this,this.ctx,R,{name:R,...Ne!==void 0&&Ne!==R?{localName:Ne}:{},kind:I,description:Oe,binding:H?.binding,deprecated:H?.deprecated,tags:H?.tags,...H?.internal?{internal:!0}:{},type:He,typeSource:je,value:Z,defaultValue:Ie,params:$e,returnType:Ye,typeParameters:lt,isFunction:pt,isFunctionDeclaration:V,isRequired:ue,constant:I==="const",reactive:this.ctx.reactive_vars.has(R),source:t(this.ctx,P)})}};if(x(v,(P,N,_)=>{let F=Nt(this,this.ctx,Re,P);if(F)this.ctx.activeScopes.push(F);let H=P.type;if(!vn.has(H))return;if(P.type==="AssignmentExpression")mt(this.ctx,P.left);if(P.type==="UpdateExpression")mt(this.ctx,P.argument);if(P.type==="CallExpression"){let R=P,I=R.callee&&typeof R.callee==="object"&&"name"in R.callee?R.callee.name:void 0;if(I==="createEventDispatcher"){if(N&&typeof N==="object"&&"id"in N&&N.id&&typeof N.id==="object"&&"name"in N.id)C=N.id.name,w=N;U=R.typeArguments?.params?.[0]}if(I==="$host"){if(N&&typeof N==="object"&&"id"in N&&N.id&&typeof N.id==="object"&&"name"in N.id)W.add(N.id.name)}if(I==="setContext")ge(this.ctx,this,P,N??void 0);if(R.arguments.length>0)Fe.push(R);if(I)me.push({name:I,arguments:R.arguments,node:R});if(fe(R.callee)&&r(R.callee.property)&&R.callee.property.name==="dispatchEvent"&&(p(R.callee.object,"$host")||r(R.callee.object)&&W.has(R.callee.object.name))){let V=Te(this.ctx,R);if(V)Y.add(V)}}if(H==="SpreadAttribute"){let R=P;if(R.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(R.expression?.name??""))vt(this.ctx,N)}if(P.type==="FunctionDeclaration"){let R=P;if(R.id?.name)this.ctx.funcDecls.set(R.id.name,R)}if(P.type==="ImportDeclaration")X(this.ctx,P);if(P.type==="VariableDeclaration"){if(this.ctx.vars.add(P),N&&typeof N==="object"&&"type"in N&&N.type==="Program"&&P.declarations.some((R)=>p(h(R.init),"$props")))_t(this,this.ctx,P)}if(P.type==="ExportNamedDeclaration"){if(P.declaration!=null){Je(P,P.declaration);return}for(let R of P.specifiers){let I=this.resolveExportSpecifier(P,R);if(!I)continue;if(I.declaration)Je(P,I.declaration,I);else this.recordUnresolvedExportSpecifier(P,I.localName,I.exportedName)}}if(H==="Comment"){let I=P?.data?.trim()??"";if(Gt.test(I))this.ctx.componentComment=I.replace(Gt,"").replace(Sn,""),this.ctx.componentCommentSource=t(this.ctx,P)}if(H==="SlotElement"){let R=P,I=R.attributes?.find((ce)=>ce.name==="name")?.value,V=(Array.isArray(I)?I[0]:void 0)?.data,Z=(R.attributes||[]).filter((ce)=>ce.name!=="name").reduce((ce,pe)=>{let ue={value:void 0,replace:!1},Ne=pe.value;if(Ne===void 0||Ne===!0)return ce;let Ie=Array.isArray(Ne)?Ne[0]:Ne;if(Ie){let{type:Ve,expression:q,raw:He,start:je,end:Oe}=Ie;if(Ve==="Text"&&He!==void 0)ue.value=JSON.stringify(He);else if(!Array.isArray(Ne)&&Ve==="ExpressionTag"&&q&&typeof q==="object"&&"type"in q&&q.type==="Identifier"&&"name"in q&&q.name===pe.name)ue.value=q.name,ue.replace=!0;if(q&&typeof q==="object"&&"type"in q){if(q.type==="Literal"&&"value"in q){let $e=q.value;ue.value=typeof $e==="string"?JSON.stringify($e):String($e)}else if(q.type==="MemberExpression")ue.value=J(this.ctx,this,q);else if(q.type!=="Identifier"){if(je!==void 0&&Oe!==void 0){if(q.type==="ObjectExpression"||q.type==="TemplateLiteral")ue.value=s(this.ctx,je+1,Oe-1)}}}}if(pe.name)ce[pe.name]=ue;return ce},{}),Q=R.fragment?.nodes?.map(({start:ce,end:pe})=>{if(ce===void 0||pe===void 0)return"";return s(this.ctx,ce,pe)??""}).join("").trim();B(this.ctx,{slot_name:V,slot_props:Z,slot_fallback:Q,source:t(this.ctx,P)})}if(H==="RenderTag"){let R=P,I=ve(this.ctx,R.expression);if(I){let V,Z=!1;if(I.arguments.length===0)V={};else if(I.arguments.length===1&&typeof I.arguments[0]==="object"&&I.arguments[0]&&"type"in I.arguments[0]&&I.arguments[0].type==="ObjectExpression"){let pe=ne(this.ctx,this,I.arguments[0]);V=pe.slot_props,Z=pe.hasUnresolvedSpread}else if(I.arguments.length===1)n(this.ctx,"syntax-skipped",I.publicName,`{@render ${I.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,t(this.ctx,P));let Q=I.publicName==="children"?void 0:I.publicName,ce=Q===void 0?En:Q;if(V!==void 0)B(this.ctx,{slot_name:Q,slot_props:V,slot_props_unresolved_spread:Z||void 0,source:t(this.ctx,P)});if(V!==void 0||this.ctx.slots.has(ce))this.ctx.snippetPropLocals.add(I.trackingName)}}if(H==="OnDirective"){let R=P;if(R.expression==null&&R.name){if(N!=null&&typeof N==="object"&&"name"in N){let I=typeof N.name==="string"?N.name:void 0,V="type"in N?String(N.type):void 0;if(I&&V){let Z=Qe(V)?{type:"InlineComponent",name:I}:{type:"Element",name:I};this.ctx.forwardedEvents.set(R.name,Z);let Q=this.ctx.events.get(R.name),ce=this.ctx.eventDescriptions.get(R.name),pe=Q?.deprecated,ue=Q?.internal;if(!Q)this.ctx.events.set(R.name,{type:"forwarded",name:R.name,element:Z,description:ce,deprecated:pe,...ue?{internal:!0}:{},source:t(this.ctx,P)});else if(Q.type==="forwarded"&&ce&&!Q.description)this.ctx.events.set(R.name,{...Q,description:ce,deprecated:Q.deprecated??pe,...Q.internal||ue?{internal:!0}:{},source:Q.source||t(this.ctx,P)})}}}}if(H==="BindDirective"&&N&&typeof N==="object"&&"type"in N&&(Ze(String(N.type))||Qe(String(N.type)))){let R=P;if(R.expression?.name){let I=tt(this.ctx,R.expression.name);if(I)this.ctx.reactive_vars.add(I)}if(Ze(String(N.type))&&R.name==="this"&&R.expression?.name&&"name"in N&&typeof N.name==="string"){let I=tt(this.ctx,R.expression.name);if(!I)return;let V=N.name;if(this.ctx.bindings.has(I)){let Z=this.ctx.bindings.get(I);if(Z&&!Z.elements.includes(V))this.ctx.bindings.set(I,{...Z,elements:[...Z.elements,V]})}else this.ctx.bindings.set(I,{elements:[V]})}}},(P)=>{if(nt(P))this.ctx.activeScopes.pop(),kt(Re,P)},{skipTypeOnlySubtrees:!0}),C!==void 0){Ft(this,this.ctx,U,C,t(this.ctx,w));for(let P of me)if(P.name===C){let N=P.arguments[0],_=N&&typeof N==="object"&&"value"in N?N.value:void 0,F=P.arguments[1],H=ye(this,F),R=H===void 0&&F&&typeof F==="object"&&"value"in F?F.value:void 0;if(_!=null)y(this.ctx,{name:String(_),detail:H??(R==null?"":M(R)),has_argument:Boolean(F),source:t(this.ctx,P.node)})}}let Ge=new Set(Y);if(C!==void 0){for(let P of me)if(P.name===C){let N=P.arguments[0],_=N&&typeof N==="object"&&"value"in N?N.value:void 0;if(_!=null)Ge.add(String(_))}}this.ctx.forwardedEvents.forEach((P,N)=>{let _=this.ctx.events.get(N);if(_&&_.type==="dispatched"&&!Ge.has(N)){let F=this.ctx.eventDescriptions.get(N),H={type:"forwarded",name:N,element:P,description:F,deprecated:_.deprecated,tags:_.tags,source:_.source};if(_.internal)H.internal=!0;if(_.detail!==void 0&&_.detail!=="undefined")H.detail=_.detail;this.ctx.events.set(N,H)}}),Ht(this.ctx,Ge);let ct=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(P)=>this.resolvePublicPropName(P))):new Set,ze=i.mapToArray(this.ctx.props).filter((P)=>!ct.has(P.name)).map((P)=>{if(this.ctx.bindings.has(P.name)){let N=this.ctx.bindings.get(P.name)?.elements.sort().map((_)=>Pt(_)).join(" | ");return{...P,type:`null | ${N}`,typeSource:"inferred",reactive:P.reactive||this.ctx.reactive_vars.has(P.name)}}return{...P,reactive:P.reactive||this.ctx.reactive_vars.has(P.name)}});this.ctx.activeScopes.length=0;let Ue=i.mapToArray(this.ctx.slots).map((P)=>{let{slot_props_unresolved_spread:N,..._}=P;if(!P.slot_props)return _;if(typeof P.slot_props==="string")return Pn.test(P.slot_props)?{..._,slot_props:"Record<string, never>"}:_;let F=P.slot_props,H=[];for(let V of Object.keys(F)){if(F[V].replace&&F[V].value!==void 0)F[V].value=this.getPropTypeByLocalOrPublic(F[V].value);if(F[V].value===void 0)F[V].value="any";H.push(`${V}: ${F[V].value}`)}let R=N?" & Record<string, any>":"",I=H.length===0?N?"Record<string, any>":"Record<string, never>":H.length===1?`{ ${H[0]} }${R}`:`{
2
- ${H.join(`;
3
- `)};
4
- }${R}`;return{..._,slot_props:I}}).sort((P,N)=>{let _=P.name??"",F=N.name??"";if(_<F)return-1;if(_>F)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let P=[...ze.map((N)=>N.type??""),...Ue.map((N)=>N.slot_props??"")].join(`
5
- `);for(let{name:N,constraint:_}of this.ctx.deferredSlotBlockGenerics){let F=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${F}\\b`).test(P))continue;this.accumulateGeneric(N,_)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)n(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=Ce(this.ctx.scriptGenericsAttribute.value)}let Xe=i.mapToArray(this.ctx.moduleExports),rt=i.mapToArray(this.ctx.events).map((P)=>{switch(P.type){case"forwarded":return{...P,element:P.element.name};case"dispatched":return P;default:return P}}).sort(z),qe=i.mapToArray(this.ctx.typedefs),ot=i.mapToArray(this.ctx.contexts),it={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((P)=>P.location==="props").map((P)=>[P.propName,P])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((P)=>P.location==="moduleExports").map((P)=>[P.propName,P]))};for(let P of ze)if(P.typeSource==="unknown"){let N=it.props.get(P.name);if(N)P.type="any";let _=N?N.importSource?`Prop "${P.name}" default calls "${N.calleeName}()" imported from "${N.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${P.name}" default calls "${N.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${P.name}" type could not be inferred; falling back to "${P.type??"any"}".`;n(this.ctx,"prop-unknown-type",P.name,_,P.source)}for(let P of Xe)if(P.typeSource==="unknown"&&it.moduleExports.has(P.name))P.type="any";let Be=C,Ke=[];if(Be!==void 0){let P=[];for(let _ of Fe){let F=xe(_,Be);if(F)P.push({call:_,...F})}if(P.length>0)l(this.ctx,"dispatch-escapes",Be,this.resolveLocalVarJSDoc(Be)?.sveldIgnore);let N=ee(this.ctx,"dispatch-escapes",Be);for(let{call:_,argumentIndex:F,property:H}of P){let R=r(_.callee)?this.ctx.valueImportBindingsByLocalName.get(_.callee.name):void 0;if(!R){Ke.push(_);continue}let I=t(this.ctx,_);this.ctx.pendingDispatchEscapeCandidates.push({importSource:R.source,importedName:R.importedName,calleeText:f(this.ctx,_.callee)??R.importedName,dispatcherName:Be,argumentIndex:F,...H===void 0?{}:{property:H},...I?{source:I}:{},...N?{ignored:N}:{}})}}for(let P of this.ctx.jsDocEventNames){if(Ge.has(P))continue;if(this.ctx.forwardedEvents.has(P))continue;if(this.ctx.props.has(`on${P}`))continue;if(Ke.length>0)continue;let N=K(this.ctx,"event-no-source",P,`@event "${P}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(P));if(this.ctx.pendingDispatchEscapeCandidates.length>0)this.ctx.deferredEventNoSourceDiagnostics.push(N);else this.ctx.diagnosticRecords.push(N)}for(let P of Ke){let N=f(this.ctx,P.callee)??"";n(this.ctx,"dispatch-escapes",Be??"",`\`${Be}\` is passed to \`${N}\`, which sveld can only follow when it's an imported function. Document the events dispatched there with @event tags.`,t(this.ctx,P))}if(this.ctx.rest_props?.type==="InlineComponent")n(this.ctx,"rest-props-unresolved","$$restProps",`$$restProps is only spread onto component "${this.ctx.rest_props.name}"; sveld cannot infer its rest-prop type. Spread onto a plain element or add an @restProps tag.`);let Tt=qe.filter((P)=>P.internal).map((P)=>P.name.split("<")[0]);if(Tt.length>0){let P=Tt.map((_)=>({name:_,regex:new RegExp(`\\b${_}\\b`)})),N=(_,F,H)=>{if(!F)return;for(let{name:R,regex:I}of P){if(!I.test(F))continue;n(this.ctx,"internal-typedef-referenced",_,`"${_}" references "${R}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,H)}};for(let _ of ze){if(_.internal)continue;N(_.name,_.type,_.source)}for(let _ of Xe){if(_.internal)continue;N(_.name,_.type,_.source)}for(let _ of qe){if(_.internal)continue;N(_.name,_.ts)}for(let _ of rt){if(_.internal||_.type!=="dispatched")continue;N(_.name,_.detail,_.source)}for(let _ of Ue){if(_.internal)continue;N(_.name??"default",_.slot_props,_.source)}for(let _ of ot){if(_.internal)continue;for(let F of _.properties)N(F.name,F.type)}}let ht={source:G(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:ze,moduleExports:Xe,slots:Ue,events:rt,typedefs:qe,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:ot,customElementTag:this.ctx.customElementTag,customElement:this.ctx.customElement,...this.ctx.cssParts.length>0?{cssParts:this.ctx.cssParts.slice()}:{},...this.ctx.cssProperties.length>0?{cssProperties:this.ctx.cssProperties.slice()}:{},diagnostics:this.ctx.diagnosticRecords.slice()},Et=we(this.ctx);if(Et)ht[T]=Et;return ht}}
6
- export{i};