sveld 0.37.4 → 0.37.6

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,6 @@
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};