sveld 0.36.7 → 0.36.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser.js +72 -72
- package/lib/{chunk-hytk5gv8.js → chunk-27bcwe2d.js} +73 -73
- package/lib/{chunk-wn9w3zst.js → chunk-8xb689xy.js} +1 -1
- package/lib/{chunk-5x7ma2jx.js → chunk-fs34jqzg.js} +19 -19
- package/lib/{chunk-bjwm35xb.js → chunk-wd7r13a5.js} +1 -1
- package/lib/{chunk-c5sqd852.js → chunk-xzpr4ksw.js} +1 -1
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as gZ,A as y,B as p,C as UZ,D as bQ,G as hZ,H as uQ,I as DZ,J as h,K as A,L as zQ,M as LQ,N as kZ,O as _Z,P as SZ,Q as qZ,R as YZ,S as WZ,T as BQ,U as KZ,V as HZ,W as TZ,Y as bZ,Z as OZ,_ as BZ,aa as fZ,ba as TQ,ca as FZ,ea as CZ,fa as o,ga as zZ,ha as NZ,v as nQ,w as VQ,x as s,y as EZ,z as pQ}from"./chunk-4ndm4k55.js";import{ja as vZ}from"./chunk-5x7ma2jx.js";class OQ{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(Q)=>this.replacement=Q}}replace(Q,Z,$,G){if(Q&&Z)if($!=null)Q[Z][$]=G;else Q[Z]=G}remove(Q,Z,$){if(Q&&Z)if($!==null&&$!==void 0)Q[Z].splice($,1);else delete Q[Z]}}class AQ extends OQ{constructor(Q,Z){super();this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:($)=>this.replacement=$},this.enter=Q,this.leave=Z}visit(Q,Z,$,G){if(Q){if(this.enter){let q=this.should_skip,W=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let Y=this.should_skip,O=this.should_remove;if(this.should_skip=q,this.should_remove=W,this.replacement=K,Y)return Q;if(O)return null}let X;for(X in Q){let q=Q[X];if(q&&typeof q==="object"){if(Array.isArray(q)){let W=q;for(let K=0;K<W.length;K+=1){let Y=W[K];if(gQ(Y)){if(!this.visit(Y,Q,X,K))K--}}}else if(gQ(q))this.visit(q,Q,X,null)}}if(this.leave){let q=this.replacement,W=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let K=this.should_remove;if(this.replacement=q,this.should_remove=W,K)return null}}return Q}}function gQ(Q){return Q!==null&&typeof Q==="object"&&"type"in Q&&typeof Q.type==="string"}function v(Q,{enter:Z,leave:$}){return new AQ(Z,$).visit(Q,null)}var fQ={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 yZ(Q){return Q in fQ}function NQ(Q){if(yZ(Q))return fQ[Q];return"HTMLElement"}function PQ(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag: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:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,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}}function m(Q,Z,$,G,X){Q.diagnosticRecords.push({component:Q.componentFilePath,kind:Z,name:$,message:G,...X?{source:X}:{}})}function GQ(Q,Z,$,G){if(LQ($)===void 0)return;if(Q.trackPropLocalName($),Z.props.has($)){let X=Z.props.get($);Z.props.set($,{...X,...G})}else Z.props.set($,G)}function l(Q,Z,$,G=0){let X,q,W=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:X,type:q,isFunction:W};let K=yQ(Q,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)?.replace(uQ," ");if(q=X,W=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let O=$;if(O.left&&typeof O.left==="object"&&"type"in O.left&&O.left.type==="Literal"&&"value"in O.left&&typeof O.left.value==="string")q="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")q=sQ($),X=vQ(Z,$)}else if($.type==="UnaryExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.argument){if(typeof Y.argument==="object"&&"type"in Y.argument&&Y.argument.type==="UnaryExpression")q=l(Q,Z,Y.argument).type;else if(typeof Y.argument==="object"&&"value"in Y.argument)q=typeof Y.argument.value}}else if($.type==="NewExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.callee&&typeof Y.callee==="object"&&"type"in Y.callee&&Y.callee.type==="Identifier"){let O=Y.callee.name;if(O==="Date")q="Date";else if(O==="Map")q="Map<any, any>";else if(O==="Set")q="Set<any>";else if(O==="WeakMap")q="WeakMap<object, any>";else if(O==="WeakSet")q="WeakSet<object>";else if(O==="Array")q="any[]";else if(O==="RegExp"||O==="Regexp")q="RegExp";else if(O==="Error")q="Error";else q=O}}else if($.type==="CallExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);let O=Y.callee,L=O&&typeof O==="object"&&"type"in O&&O.type==="Identifier"?O.name:void 0;if((L==="$derived"||L==="$state")&&Y.arguments.length===1&&G<5)return{...l(Q,Z,Y.arguments[0],G+1),value:X,defaultValue:K};if(L){let J=xZ(Q,Z,L);if(J)return{value:X,type:void 0,isFunction:!1,defaultValue:K,resolvedType:J};if(Z.funcDecls.has(L)||mZ(Z,L))return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L}};let B=Z.valueImportBindingsByLocalName.get(L);if(B)return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L,importSource:B.source,importedName:B.importedName}}}return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L??uZ(Z,O)}}}else if($.type==="Identifier"){let Y=$;if(G<5){let O=xQ(Z,Y.name);if(O){let L=l(Q,Z,O,G+1),J=Q.resolveLocalVarJSDoc(Y.name);return{...L,resolvedType:J?.type??L.resolvedType,resolvedDescription:J?.description??L.resolvedDescription,resolvedParams:J?.params??L.resolvedParams,resolvedReturnType:J?.returnType??L.resolvedReturnType}}if(Z.funcDecls.has(Y.name)){let L=Q.resolveLocalVarJSDoc(Y.name),J=Z.funcDecls.get(Y.name);return{value:J?vQ(Z,J):void 0,type:void 0,isFunction:!0,defaultValue:J?yQ(Q,Z,J):void 0,resolvedType:L?.type??cZ(L,J),resolvedDescription:L?.description,resolvedParams:L?.params,resolvedReturnType:L?.returnType}}}if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)}else if($.type==="MemberExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Q.isNumericConstant($))q="number"}else if($.type==="TemplateLiteral"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);q="string"}else if("raw"in $&&typeof $.raw==="string"){if(X=$.raw,"value"in $)q=$.value==null?void 0:typeof $.value}return{value:X,type:q,isFunction:W,defaultValue:K}}function xQ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init;return}function mQ(Q,Z){for(let $ of Q.vars){if($.kind!=="const")continue;for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init}return}function uZ(Q,Z){if(Z&&typeof Z==="object"&&"start"in Z&&"end"in Z&&typeof Z.start==="number"&&typeof Z.end==="number")return A(Q,Z.start,Z.end)??"call";return"call"}function xZ(Q,Z,$){let G=Q.resolveLocalVarJSDoc($);if(G?.returnType)return G.returnType;let X=Z.funcDecls.get($)??lQ(Z,$);if(!X)return;let q=dZ(Z,X);if(q)return q;let W=lZ(Z,$);if(W)return W;let K=dQ(X);return K==="any"?void 0:K}function mZ(Q,Z){return lQ(Q,Z)!==void 0}function lQ(Q,Z){let $=xQ(Q,Z);if(!$||typeof $!=="object"||!("type"in $))return;if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")return $;return}function lZ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations){let X=G.id;if(!X||typeof X!=="object"||!("type"in X)||X.type!=="Identifier"||!("name"in X)||X.name!==Z)continue;let q=X.typeAnnotation;if(q?.type!=="TSTypeAnnotation")return;let W=q.typeAnnotation;if(!W||typeof W.start!=="number"||typeof W.end!=="number")return;return sZ(A(Q,W.start,W.end))}return}function sZ(Q){if(!Q)return;let Z=Q.lastIndexOf("=>");if(Z===-1)return;return Q.slice(Z+2).trim()||void 0}function dZ(Q,Z){let $=Z.returnType;if($?.type!=="TSTypeAnnotation")return;let G=$.typeAnnotation;if(!G||typeof G.start!=="number"||typeof G.end!=="number")return;return A(Q,G.start,G.end)}function cZ(Q,Z){let $=Q?.returnType??"any",G=Q?.params;if(G&&G.length>0)return`(${G.map((q)=>`${q.name}${q.optional?"?":""}: ${q.type}`).join(", ")}) => ${$}`;if(Q?.returnType)return`() => ${$}`;if(Z)return sQ(Z);return"(...args: any[]) => any"}function sQ(Q){return`(${iZ(Q)}) => ${dQ(Q)}`}function iZ(Q){let Z=Q.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let G of Z)if(G&&typeof G==="object"&&"type"in G&&G.type==="Identifier"&&"name"in G&&typeof G.name==="string")$.push(`${G.name}: any`);else return"...args: any[]";return $.join(", ")}function dQ(Q){if(Q.async||Q.generator)return"any";let Z=Q.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=pZ(Z),$.length===0)return"any"}else $=[Z];let G=null;for(let X of $){let q=oZ(X);if(!q)return"any";if(G===null)G=q;else if(G!==q)return"any"}return G??"any"}function pZ(Q){let Z=[];return v(Q,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function oZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return null;switch(Q.type){case"Literal":{let Z=Q.value;if(typeof Z==="string")return"string";if(typeof Z==="number")return"number";if(typeof Z==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let Z=Q.callee;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="Identifier"){let $=Z.name;if($==="String")return"string";if($==="Number")return"number";if($==="Boolean")return"boolean"}return null}default:return null}}function cQ(Q){if(y(Q,"$bindable"))return{init:Q.arguments[0],bindable:!0};return{init:Q,bindable:!1}}function rZ(Q,Z){let $=Z.params;if(!Array.isArray($)||$.length===0)return"";let G=$[0],X=$[$.length-1];if(typeof G.start!=="number"||typeof X.end!=="number")return"";return A(Q,G.start,X.end)??""}function vQ(Q,Z){if(Z.generator)return;let $=Z.body;if(!$||typeof $!=="object"||!("type"in $))return;let G=rZ(Q,Z),X=Z.async?"async ":"",q=(K,Y)=>K&&typeof K==="object"&&("type"in K)&&K.type==="ObjectExpression"?`(${Y})`:Y;if($.type!=="BlockStatement"){let K=zQ(Q,$);return K===void 0?void 0:`${X}(${G}) => ${q($,K)}`}let W=$.body;if(W.length===0)return`${X}(${G}) => {}`;if(W.length===1){let K=W[0];if(K&&typeof K==="object"&&"type"in K&&K.type==="ReturnStatement"){let Y=K.argument;if(Y){let O=zQ(Q,Y);if(O!==void 0)return`${X}(${G}) => ${q(Y,O)}`}}}return}function yQ(Q,Z,$){let G=zQ(Z,$);if(!G||!$||typeof $!=="object"||!("type"in $))return;let X="expression";if($.type==="Literal"||$.type==="UnaryExpression")X="literal";else if($.type==="TemplateLiteral")X=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")X="array";else if($.type==="ObjectExpression")X="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"||$.type==="FunctionDeclaration")X="function";let q={raw:G,kind:X};if(X==="literal"||X==="array"||X==="object"){let W=EQ(Q,$);if(W.ok)q.value=W.value}return q}function EQ(Q,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return{ok:!1};if(Z.type==="Literal"){let $=Z.value;return typeof $==="bigint"?{ok:!1}:{ok:!0,value:$}}if(Z.type==="UnaryExpression"){let $=Z,G=$.argument;if(!G||typeof G!=="object"||!("type"in G)||G.type!=="Literal")return{ok:!1};let X=G.value;if(typeof X==="number"){if($.operator==="-")return{ok:!0,value:-X};if($.operator==="+")return{ok:!0,value:X}}if(typeof X==="boolean"&&$.operator==="!")return{ok:!0,value:!X};return{ok:!1}}if(Z.type==="TemplateLiteral"){let $=Z;if($.expressions.length>0||$.quasis.length!==1)return{ok:!1};return{ok:!0,value:$.quasis[0].value.cooked??$.quasis[0].value.raw}}if(Z.type==="ArrayExpression"){let $=Z,G=[];for(let X of $.elements){if(!X)return{ok:!1};let q=EQ(Q,X);if(!q.ok)return{ok:!1};G.push(q.value)}return{ok:!0,value:G}}if(Z.type==="ObjectExpression"){let $=Z,G={};for(let X of $.properties){if(X.type!=="Property"||X.computed)return{ok:!1};let q=Q.getPropertyName(X.key);if(!q)return{ok:!1};let W=EQ(Q,X.value);if(!W.ok)return{ok:!1};G[q]=W.value}return{ok:!0,value:G}}return{ok:!1}}var aZ=/[-_.:/\s]+/;function hQ(Q){return`${Q.split(aZ).map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join("")}Context`}function nZ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let X=[];if(!pQ($))return null;let q=$;for(let W of q.properties){if(W.type!=="Property")continue;let K=Z.getPropertyName(W.key);if(!K)continue;let Y="any",O;if(s(W.value)){let L=W.value.name,J=Z.findVariableTypeAndDescription(L);if(J)Y=J.type,O=J.description;else m(Q,"context-any-type",K,`Context "${G}" property "${K}" has no type annotation; defaulted to "any".`,h(Q,W))}else if(W.value&&typeof W.value==="object"&&"type"in W.value&&(W.value.type==="ArrowFunctionExpression"||W.value.type==="FunctionExpression"))Y=`(${W.value.params?.map((B)=>{if(s(B))return`${B.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(VQ(W.value))Y=W.value.value==null?"null":typeof W.value.value;X.push({name:K,type:Y,description:O,optional:!1})}return{key:G,typeName:hQ(G),properties:X,description:void 0}}else if(s($)){let X=$.name,q=Z.findVariableTypeAndDescription(X);if(q)return{key:G,typeName:hQ(G),properties:[{name:X,type:q.type,description:q.description,optional:!1}]};return m(Q,"context-any-type",X,`Context "${G}" variable "${X}" has no type annotation; defaulted to "any".`,h(Q,$)),{key:G,typeName:hQ(G),properties:[{name:X,type:"any",description:void 0,optional:!1}]}}return null}function iQ(Q){let Z=Q.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",G=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!G)return null;let X=Q.arguments[0];if(!X||typeof X!=="object"||!("type"in X))return"";if(X.type==="Literal"&&typeof X.value==="string")return X.value;if(X.type==="TemplateLiteral"&&X.quasis?.length===1)return X.quasis[0].value.cooked??"";return""}function oQ(Q,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let G=Z;if(G.type==="Literal")return typeof G.value==="string"?G.value:G.value==null?null:String(G.value);if(G.type==="TemplateLiteral"){if(G.quasis?.length===1){let X=G.quasis[0].value.cooked;return X==null?null:X}return null}if(G.type==="CallExpression"||G.type==="NewExpression")return iQ(G);if(G.type==="Identifier"){if($>=5)return null;let X=mQ(Q,G.name);if(X&&typeof X==="object"&&"type"in X){let q=X;if((q.type==="CallExpression"||q.type==="NewExpression")&&iQ(q)==="")return G.name;return oQ(Q,q,$+1)}return null}return null}function rQ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let X=$,q=X.arguments[0];if(!q)return;let W=oQ(Q,q);if(!W){let O=Q.componentFilePath?` in ${Q.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${O}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=X.arguments[1];if(!K)return;let Y=nZ(Q,Z,K,W);if(Y&&!Q.contexts.has(W))Q.contexts.set(W,Y)}function tZ({hasTypeScriptType:Q,hasJSDocType:Z,inferredType:$,finalType:G}){if(Q)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(G!==void 0)return"inferred";return"unknown"}function XQ(Q){let Z=Q.explicitType??Q.jsdocType??Q.resolvedType??Q.typeSeed,$=Q.jsdocParams??Q.resolvedParams,G=Q.jsdocReturnType??Q.resolvedReturnType;if(Q.isFunctionDeclaration&&Z==="() => any"&&G)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${G}`:`() => ${G}`;let X=Q.jsdocDescription??Q.resolvedDescription;if(X===void 0&&Z!==void 0)X=Q.typedefs?.get(Z)?.description;let q=tZ({hasTypeScriptType:Q.explicitType!==void 0,hasJSDocType:Q.jsdocType!==void 0||Q.jsdocParams!==void 0||Q.jsdocReturnType!==void 0||Q.resolvedType!==void 0,inferredType:Q.inferredTypeForSource,finalType:Z}),W=Q.initializerIsFunction||Q.isFunctionDeclaration||Q.inferIsFunctionFromTypeSignature===!0&&(!!Q.jsdocParams?.length||Q.jsdocReturnType!==void 0||!!Q.jsdocType?.includes("=>")||!!Q.resolvedType?.includes("=>")||!!Q.explicitType?.includes("=>"));return{type:Z,typeSource:q,description:X,params:$,returnType:G,isFunction:W}}function eZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;let Z=String(Q.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in Q&&typeof Q.name==="string"?Q.name:void 0;if(!$)return;let G=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in Q&&typeof Q.tag==="string")G.thisValue=Q.tag;return G}function aQ(Q,Z){if(Q.rest_props!==void 0)return;let $=eZ(Z);if($)Q.rest_props=$}function k(Q,Z,$){if(!Z||Q.has(Z))return;Q.set(Z,$)}function JQ(Q,Z){for(let $=Q.activeScopes.length-1;$>=0;$-=1){let G=Q.activeScopes[$]?.get(Z);if(!G)continue;return G.kind==="prop"?G.publicPropName:void 0}return}function P(Q,Z=new Set){if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(Q.type){case"Identifier":Z.add(Q.name);break;case"AssignmentPattern":P(Q.left,Z);break;case"ArrayPattern":for(let $ of Q.elements)P($??void 0,Z);break;case"ObjectPattern":for(let $ of Q.properties)if($.type==="Property")P($.value,Z);else if($.type==="RestElement")P($.argument,Z);break;case"RestElement":P(Q.argument,Z);break}return Z}function kQ(Q,Z){let $=P(Z);if(!$)return;for(let G of $){let X=JQ(Q,G);if(X)Q.reactive_vars.add(X)}}function MQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;switch(String(Q.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function tQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;let Z=String(Q.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function Q0(Q,Z){let $=Q.scopeDeclarations.get(Z);if(!$)$=new Map,Q.scopeDeclarations.set(Z,$);return $}function Z0(Q,Z,$){let G=[];if($.id.type==="Identifier")return G.push({kind:"local",name:$.id.name}),G;if($.id.type!=="ObjectPattern")return G;for(let X of $.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")G.push({kind:"local",name:X.argument.name});continue}if(X.computed)continue;let q=Q.getPropertyName(X.key);if(!q)continue;let W;if(X.value.type==="Identifier")W=X.value.name;else if(X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier")W=X.value.left.name;if(!W)continue;G.push({kind:"prop",name:W,publicPropName:q})}return G}function DQ(Q,Z,$,G,X){if(!nQ(Z))return;let q=X?.allowRunesProps??!1,W=X?.forceProp??!1,K=Z;for(let Y of K.declarations){if(q&&y(p(Y.init),"$props")){for(let J of Z0(Q,K,Y))k(J.kind==="prop"?$:G,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let O=K.kind==="var"?G:$,L=W?"prop":"local";for(let J of P(Y.id))k(O,J,L==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function $0(Q,Z){if("id"in Q&&Q.id&&typeof Q.id==="object"&&"name"in Q.id&&typeof Q.id.name==="string")k(Z,Q.id.name,{kind:"local"});for(let $ of Q.params)for(let G of P($))k(Z,G,{kind:"local"})}function G0(Q,Z,$,G){if(!Array.isArray(Z))return;for(let X of Z){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"VariableDeclaration":DQ(Q,X,$,G);break;case"FunctionDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break}}}function X0(Q,Z,$){if(!$||typeof $!=="object")return;let G="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!G||!("body"in G)||!Array.isArray(G.body))return;for(let X of G.body){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"ImportDeclaration":for(let q of X.specifiers??[])if(q.local?.name)k(Z.componentScope,q.local.name,{kind:"local"});break;case"VariableDeclaration":DQ(Q,X,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!X.declaration||typeof X.declaration!=="object"||!("type"in X.declaration))break;if(X.declaration.type==="VariableDeclaration")DQ(Q,X.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(X.declaration.type==="FunctionDeclaration"&&X.declaration.id?.name)k(Z.componentScope,X.declaration.id.name,{kind:"prop",publicPropName:X.declaration.id.name});break}}}function eQ(Q,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,X0(Q,Z,Z.parsed?.instance)}function QZ(Q){return{varScopeStack:[Q.componentScope]}}function ZZ(Q,Z,$,G){if(!MQ(G))return;let X=Q0(Z,G),q=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(G.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":$0(G,X);break;case"BlockStatement":G0(Q,G.body,X,q);break;case"CatchClause":if("param"in G)for(let K of P(G.param))k(X,K,{kind:"local"});break;case"EachBlock":{let K=G;for(let Y of P(K.context))k(X,Y,{kind:"local"});if(typeof K.index==="string")k(X,K.index,{kind:"local"});else if(K.index&&"name"in K.index)k(X,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in G)for(let K of P(G.value))k(X,K,{kind:"local"});break;case"CatchBlock":if("error"in G)for(let K of P(G.error))k(X,K,{kind:"local"});break}if(tQ(G))$.varScopeStack.push(X)}function $Z(Q,Z){if(tQ(Z))Q.varScopeStack.pop()}var U0=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function q0(Q,Z){switch(Z?.type){case"MemberExpression":return Z.computed||Q===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return Q===Z.meta;case"PropertyDefinition":return Z.computed||Q===Z.value;case"Property":return Z.computed||Q===Z.value;case"ExportSpecifier":case"ImportSpecifier":return Q===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Y0(Q,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(Q))return!0;return!1}function W0(Q){let Z=new Set;if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=Q;if($.id?.name)Z.add($.id.name);for(let G of $.params??[])P(G,Z);break}case"BlockStatement":jQ(Q.body,Z);break;case"CatchClause":P(Q.param,Z);break;case"EachBlock":{let $=Q;if(P($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":P(Q.value,Z);break;case"CatchBlock":P(Q.error,Z);break}return Z}function jQ(Q,Z){if(!Array.isArray(Q))return;for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let G of $.specifiers??[])if(G.local?.name)Z.add(G.local.name);break;case"VariableDeclaration":for(let G of $.declarations??[])P(G.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let G=$.id?.name;if(G)Z.add(G);break}case"ExportNamedDeclaration":{let G=$.declaration;if(G&&typeof G==="object"&&"type"in G)jQ([G],Z);break}}}}function _Q(Q,Z){if(!Q||typeof Q!=="object")return!1;let $=[...Z],G=!1;return v(Q,{enter(X,q){if(G){this.skip();return}if(MQ(X))$.push(W0(X));if(q&&X.type==="Identifier"&&U0.has(X.name)&&!q.type.startsWith("TS")&&q0(X,q)&&!Y0(X.name,$))G=!0,this.skip()},leave(X){if(MQ(X))$.pop()}}),G}function GZ(Q){if(!Q||typeof Q!=="object")return;if("content"in Q){let Z=Q.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in Q&&Array.isArray(Q.body))return Q.body;return}function XZ(Q){if(Q.runesOptionOverride!==void 0)return Q.runesOptionOverride?"runes":"legacy";let Z=Q.parsed;if(!Z)return"legacy";let $=new Set;jQ(GZ(Z.module),$);let G=new Set;return jQ(GZ(Z.instance),G),_Q(Z.module,[$])||_Q(Z.instance,[$,G])||_Q(Z.html,[$,G])?"runes":"legacy"}var K0=/[A-Za-z_$][\w$]*/g;function H0(Q,Z,$){let G=new Map,X=Z.typeParameters?.params,q=$.typeArguments?.params;if(!X?.length||!q?.length)return G;for(let W=0;W<X.length;W++){let K=X[W]?.name,Y=q[W];if(!K||Y?.start===void 0||Y?.end===void 0)continue;let O=A(Q,Y.start,Y.end)?.trim();if(O)G.set(K,O)}return G}function O0(Q,Z){if(Z.size===0)return Q;return Q.replace(K0,($)=>Z.get($)??$)}function UQ(Q,Z,$,G,X=new Set){let q=new Map;if(!$?.type)return q;let W=(K)=>{for(let Y of K){if(Y?.type!=="TSPropertySignature"||Y.computed)continue;if(!Y.key)continue;let O=Q.getPropertyName(Y.key);if(!O)continue;let L=Y.typeAnnotation?.start,J=Y.typeAnnotation?.end;if(L===void 0||J===void 0)continue;let B=A(Z,L+1,J)?.trim();if(!B)continue;q.set(O,{type:B,optional:Y.optional===!0,source:h(Z,Y)})}};switch($.type){case"TSTypeLiteral":W($.members??[]);break;case"TSInterfaceDeclaration":W($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}case"TSTypeReference":{let K=WZ($.typeName);if(!K||X.has(K))break;let Y=G.get(K);if(!Y)break;X.add(K);let O=UQ(Q,Z,Y,G,X);X.delete(K);let L=H0(Z,Y,$);for(let[J,B]of O)q.set(J,L.size===0?B:{...B,type:O0(B.type,L)});break}case"TSIntersectionType":for(let K of $.types??[]){let Y=UQ(Q,Z,K,G,X);for(let[O,L]of Y)q.set(O,L)}break;case"TSParenthesizedType":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}}return q}function LZ(Q,Z,$){if(Z.runesPropsDeclarationMetadataByDeclaratorStart.clear(),Z.explicitPropTypesByName.clear(),Z.explicitVariableTypesByName.clear(),Z.typeImportBindingsByLocalName.clear(),Z.localTypeDeclarationsByName.clear(),Z.typedRunesPropsDeclarations.length=0,!Z.source)return;let G=$;Z.scriptLanguage=Q.resolveScriptLanguage(G),Z.customElementTag=G.options?.customElement?.tag,Z.runesOptionOverride=G.options?.runes,Z.scriptGenericsAttribute=Q.resolveScriptGenericsAttribute(G);let X=G.instance?.content?.body??[];for(let q of X){if(!q?.type)continue;if(q.type==="ImportDeclaration"&&q.source?.value)for(let W of q.specifiers??[]){let K=W.local?.name;if(!K)continue;if(!(q.importKind==="type"||W.importKind==="type"))continue;let O,L;if(W.type==="ImportSpecifier")O="named",L=W.imported?.type==="Identifier"?W.imported.name:typeof W.imported?.value==="string"?W.imported.value:void 0;else if(W.type==="ImportDefaultSpecifier")O="default";else if(W.type==="ImportNamespaceSpecifier")O="namespace";if(!O)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:L,localName:K,source:String(q.source.value),specifierType:O})}if((q.type==="TSInterfaceDeclaration"||q.type==="TSTypeAliasDeclaration")&&q.id?.name&&q.start!==void 0&&q.end!==void 0)Z.localTypeDeclarationsByName.set(q.id.name,{code:A(Z,q.start,q.end)?.trim()??"",node:q,start:q.start});if(q.type==="ExportNamedDeclaration"&&q.declaration?.type==="VariableDeclaration")for(let W of q.declaration.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(W.id.name,K)}else if(q.type==="VariableDeclaration")for(let W of q.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(W.id.name,K)}}for(let q of X){if(!q||typeof q!=="object"||!("declarations"in q))continue;for(let W of q.declarations??[]){if(!y(p(W.init),"$props"))continue;let K=W.id?.typeAnnotation?void 0:UZ(W.init),Y=W.id?.typeAnnotation?.typeAnnotation??K,O=W.id?.typeAnnotation?BQ(Z,W.id.typeAnnotation):KZ(Z,K),L=UQ(Q,Z,Y,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([T,f])=>[T,f.node]))),J=new Set,B=new Set;if(HZ(Z,Y,J,B),OZ(Z,J,B),W.start!==void 0){let T={canonicalType:O,props:L,referencedImportedTypes:J,referencedLocalTypes:B};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(W.start,T),O)Z.typedRunesPropsDeclarations.push(T)}}}}function VZ(Q,Z,$){for(let G of $.declarations){if(!y(p(G.init),"$props"))continue;if(G.id.type==="Identifier"){Z.wholePropsLocals.add(G.id.name),Z.restPropLocals.add(G.id.name);let W=qZ(Z,G.start);if(W)for(let[K,Y]of W.props)GQ(Q,Z,K,{name:K,kind:"let",type:Y.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!Y.optional,constant:!1,reactive:!1,source:Y.source});continue}if(G.id.type!=="ObjectPattern")continue;let X=o(Z,Q,$),q=G.id.properties.filter((W)=>{if(W.type!=="Property"||W.computed)return!1;if(!Q.getPropertyName(W.key))return!1;if(W.value.type==="Identifier")return!0;return W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier"}).length;for(let W of G.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Z.restPropLocals.add(W.argument.name);continue}let K=Q.getPropertyName(W.key);if(!K)continue;let Y,O;if(W.value.type==="Identifier")Y=W.value.name;else{let M=W.value;Y=M.left.name,O=M.right}if(!Y)continue;if(Q.trackPropLocalName(K,Y),K==="children")Z.snippetPropLocals.add(Y);let L=zZ(Z,Q,W)??(q===1?X:void 0),J=YZ(Z,G.start,K),{init:B,bindable:T}=cQ(O),f=B==null?{isFunction:!1}:l(Q,Z,B),{value:e,type:QQ,isFunction:qQ,defaultValue:RQ}=f,wQ=J?.type===void 0&&L?.type===void 0?f.resolvedType:void 0;if(f.pendingCallDefault)Z.pendingCallDefaultCandidates.push({propName:K,location:"props",...f.pendingCallDefault});let{type:IQ,typeSource:YQ,description:WQ,params:KQ,returnType:U,isFunction:H}=XQ({explicitType:J?.type,typeSeed:QQ,inferredTypeForSource:QQ,jsdocType:L?.type,jsdocDescription:L?.description,jsdocParams:L?.params,jsdocReturnType:L?.returnType,resolvedType:wQ,resolvedDescription:f.resolvedDescription,resolvedParams:f.resolvedParams,resolvedReturnType:f.resolvedReturnType,initializerIsFunction:qQ,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(T)Z.reactive_vars.add(K);GQ(Q,Z,K,{name:K,...Y===K?{}:{localName:Y},kind:"let",description:WQ,binding:L?.binding,deprecated:L?.deprecated,tags:L?.tags,...T?{bindable:!0}:{},type:IQ,typeSource:YQ,value:e,defaultValue:RQ,params:KQ,returnType:U,isFunction:H,isFunctionDeclaration:!1,isRequired:B==null&&J?.optional!==!0,constant:!1,reactive:T,source:h(Z,W)})}}}function JZ(Q,Z){if(Q.syntaxMode!=="runes")return;for(let[$,G]of Array.from(Q.events.entries())){if(G.type!=="dispatched")continue;if(Z.has($)||Q.forwardedEvents.has($))continue;let X=`on${$}`,q=Q.props.get(X);if(!q)continue;let W=q.type!==void 0||q.params!==void 0||q.returnType!==void 0,K=G.detail===void 0||G.detail==="undefined"||G.detail==="null"?"() => void":`(detail: ${G.detail}) => void`;Q.props.set(X,{...q,description:q.description??G.description,type:W?q.type:K,typeSource:W?q.typeSource:"inferred",isFunction:!0}),Q.events.delete($)}}var MZ=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function FQ(Q){if(!Q||typeof Q!=="object")return;v(Q,{enter(Z){if(!MZ.has(Z.type))return;let $=Z.expression;while($&&MZ.has($.type))$=$.expression;if($)this.replace($)}})}function CQ(Q,Z){let $=Z.source?.value;if(typeof $!=="string"||Z.importKind==="type")return;for(let G of Z.specifiers??[]){if(G.type!=="ImportSpecifier"||G.importKind==="type")continue;let X=G.local?.name;if(!X)continue;let q=G.imported?.name??(typeof G.imported?.value==="string"?G.imported.value:X);Q.valueImportBindingsByLocalName.set(X,{localName:X,importedName:q,source:$})}}function SQ(Q,Z){if(!Z)return;v(Z,{enter($){if($.type==="ImportDeclaration")CQ(Q,$);if($.type==="FunctionDeclaration"){let G=$;if(G.id?.name)Q.funcDecls.set(G.id.name,G)}}})}function RZ(Q,Z,$){let G=Z+1;while(G<Q.length){if(Q[G]==="\\"){G+=2;continue}if(Q[G]===$)return G+1;G++}return G}function wZ(Q,Z){let $=Z+1,G=0;while($<Q.length){let X=Q[$];if(X==="\\"){$+=2;continue}if(G===0){if(X==="`")return $+1;if(X==="$"&&Q[$+1]==="{"){G=1,$+=2;continue}$++;continue}if(X==="{")G++;else if(X==="}")G--;else if(X==='"'||X==="'"){$=RZ(Q,$,X);continue}else if(X==="`"){$=wZ(Q,$);continue}$++}return $}function z0(Q,Z){let $=[],G=Q.length,X=0;while(X<G){let q=Q[X];if(q==='"'||q==="'"){X=RZ(Q,X,q);continue}if(q==="`"){X=wZ(Q,X);continue}if(q==="/"&&Q[X+1]==="/"){let W=X+2;while(W<G&&Q[W]!==`
|
|
1
|
+
import{$ as gZ,A as y,B as p,C as UZ,D as bQ,G as hZ,H as uQ,I as DZ,J as h,K as A,L as zQ,M as LQ,N as kZ,O as _Z,P as SZ,Q as qZ,R as YZ,S as WZ,T as BQ,U as KZ,V as HZ,W as TZ,Y as bZ,Z as OZ,_ as BZ,aa as fZ,ba as TQ,ca as FZ,ea as CZ,fa as o,ga as zZ,ha as NZ,v as nQ,w as VQ,x as s,y as EZ,z as pQ}from"./chunk-4ndm4k55.js";import{ja as vZ}from"./chunk-fs34jqzg.js";class OQ{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(Q)=>this.replacement=Q}}replace(Q,Z,$,G){if(Q&&Z)if($!=null)Q[Z][$]=G;else Q[Z]=G}remove(Q,Z,$){if(Q&&Z)if($!==null&&$!==void 0)Q[Z].splice($,1);else delete Q[Z]}}class AQ extends OQ{constructor(Q,Z){super();this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:($)=>this.replacement=$},this.enter=Q,this.leave=Z}visit(Q,Z,$,G){if(Q){if(this.enter){let q=this.should_skip,W=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let Y=this.should_skip,O=this.should_remove;if(this.should_skip=q,this.should_remove=W,this.replacement=K,Y)return Q;if(O)return null}let X;for(X in Q){let q=Q[X];if(q&&typeof q==="object"){if(Array.isArray(q)){let W=q;for(let K=0;K<W.length;K+=1){let Y=W[K];if(gQ(Y)){if(!this.visit(Y,Q,X,K))K--}}}else if(gQ(q))this.visit(q,Q,X,null)}}if(this.leave){let q=this.replacement,W=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let K=this.should_remove;if(this.replacement=q,this.should_remove=W,K)return null}}return Q}}function gQ(Q){return Q!==null&&typeof Q==="object"&&"type"in Q&&typeof Q.type==="string"}function v(Q,{enter:Z,leave:$}){return new AQ(Z,$).visit(Q,null)}var fQ={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 yZ(Q){return Q in fQ}function NQ(Q){if(yZ(Q))return fQ[Q];return"HTMLElement"}function PQ(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag: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:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,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}}function m(Q,Z,$,G,X){Q.diagnosticRecords.push({component:Q.componentFilePath,kind:Z,name:$,message:G,...X?{source:X}:{}})}function GQ(Q,Z,$,G){if(LQ($)===void 0)return;if(Q.trackPropLocalName($),Z.props.has($)){let X=Z.props.get($);Z.props.set($,{...X,...G})}else Z.props.set($,G)}function l(Q,Z,$,G=0){let X,q,W=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:X,type:q,isFunction:W};let K=yQ(Q,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)?.replace(uQ," ");if(q=X,W=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let O=$;if(O.left&&typeof O.left==="object"&&"type"in O.left&&O.left.type==="Literal"&&"value"in O.left&&typeof O.left.value==="string")q="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")q=sQ($),X=vQ(Z,$)}else if($.type==="UnaryExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.argument){if(typeof Y.argument==="object"&&"type"in Y.argument&&Y.argument.type==="UnaryExpression")q=l(Q,Z,Y.argument).type;else if(typeof Y.argument==="object"&&"value"in Y.argument)q=typeof Y.argument.value}}else if($.type==="NewExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.callee&&typeof Y.callee==="object"&&"type"in Y.callee&&Y.callee.type==="Identifier"){let O=Y.callee.name;if(O==="Date")q="Date";else if(O==="Map")q="Map<any, any>";else if(O==="Set")q="Set<any>";else if(O==="WeakMap")q="WeakMap<object, any>";else if(O==="WeakSet")q="WeakSet<object>";else if(O==="Array")q="any[]";else if(O==="RegExp"||O==="Regexp")q="RegExp";else if(O==="Error")q="Error";else q=O}}else if($.type==="CallExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);let O=Y.callee,L=O&&typeof O==="object"&&"type"in O&&O.type==="Identifier"?O.name:void 0;if((L==="$derived"||L==="$state")&&Y.arguments.length===1&&G<5)return{...l(Q,Z,Y.arguments[0],G+1),value:X,defaultValue:K};if(L){let J=xZ(Q,Z,L);if(J)return{value:X,type:void 0,isFunction:!1,defaultValue:K,resolvedType:J};if(Z.funcDecls.has(L)||mZ(Z,L))return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L}};let B=Z.valueImportBindingsByLocalName.get(L);if(B)return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L,importSource:B.source,importedName:B.importedName}}}return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L??uZ(Z,O)}}}else if($.type==="Identifier"){let Y=$;if(G<5){let O=xQ(Z,Y.name);if(O){let L=l(Q,Z,O,G+1),J=Q.resolveLocalVarJSDoc(Y.name);return{...L,resolvedType:J?.type??L.resolvedType,resolvedDescription:J?.description??L.resolvedDescription,resolvedParams:J?.params??L.resolvedParams,resolvedReturnType:J?.returnType??L.resolvedReturnType}}if(Z.funcDecls.has(Y.name)){let L=Q.resolveLocalVarJSDoc(Y.name),J=Z.funcDecls.get(Y.name);return{value:J?vQ(Z,J):void 0,type:void 0,isFunction:!0,defaultValue:J?yQ(Q,Z,J):void 0,resolvedType:L?.type??cZ(L,J),resolvedDescription:L?.description,resolvedParams:L?.params,resolvedReturnType:L?.returnType}}}if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)}else if($.type==="MemberExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Q.isNumericConstant($))q="number"}else if($.type==="TemplateLiteral"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);q="string"}else if("raw"in $&&typeof $.raw==="string"){if(X=$.raw,"value"in $)q=$.value==null?void 0:typeof $.value}return{value:X,type:q,isFunction:W,defaultValue:K}}function xQ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init;return}function mQ(Q,Z){for(let $ of Q.vars){if($.kind!=="const")continue;for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init}return}function uZ(Q,Z){if(Z&&typeof Z==="object"&&"start"in Z&&"end"in Z&&typeof Z.start==="number"&&typeof Z.end==="number")return A(Q,Z.start,Z.end)??"call";return"call"}function xZ(Q,Z,$){let G=Q.resolveLocalVarJSDoc($);if(G?.returnType)return G.returnType;let X=Z.funcDecls.get($)??lQ(Z,$);if(!X)return;let q=dZ(Z,X);if(q)return q;let W=lZ(Z,$);if(W)return W;let K=dQ(X);return K==="any"?void 0:K}function mZ(Q,Z){return lQ(Q,Z)!==void 0}function lQ(Q,Z){let $=xQ(Q,Z);if(!$||typeof $!=="object"||!("type"in $))return;if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")return $;return}function lZ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations){let X=G.id;if(!X||typeof X!=="object"||!("type"in X)||X.type!=="Identifier"||!("name"in X)||X.name!==Z)continue;let q=X.typeAnnotation;if(q?.type!=="TSTypeAnnotation")return;let W=q.typeAnnotation;if(!W||typeof W.start!=="number"||typeof W.end!=="number")return;return sZ(A(Q,W.start,W.end))}return}function sZ(Q){if(!Q)return;let Z=Q.lastIndexOf("=>");if(Z===-1)return;return Q.slice(Z+2).trim()||void 0}function dZ(Q,Z){let $=Z.returnType;if($?.type!=="TSTypeAnnotation")return;let G=$.typeAnnotation;if(!G||typeof G.start!=="number"||typeof G.end!=="number")return;return A(Q,G.start,G.end)}function cZ(Q,Z){let $=Q?.returnType??"any",G=Q?.params;if(G&&G.length>0)return`(${G.map((q)=>`${q.name}${q.optional?"?":""}: ${q.type}`).join(", ")}) => ${$}`;if(Q?.returnType)return`() => ${$}`;if(Z)return sQ(Z);return"(...args: any[]) => any"}function sQ(Q){return`(${iZ(Q)}) => ${dQ(Q)}`}function iZ(Q){let Z=Q.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let G of Z)if(G&&typeof G==="object"&&"type"in G&&G.type==="Identifier"&&"name"in G&&typeof G.name==="string")$.push(`${G.name}: any`);else return"...args: any[]";return $.join(", ")}function dQ(Q){if(Q.async||Q.generator)return"any";let Z=Q.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=pZ(Z),$.length===0)return"any"}else $=[Z];let G=null;for(let X of $){let q=oZ(X);if(!q)return"any";if(G===null)G=q;else if(G!==q)return"any"}return G??"any"}function pZ(Q){let Z=[];return v(Q,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function oZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return null;switch(Q.type){case"Literal":{let Z=Q.value;if(typeof Z==="string")return"string";if(typeof Z==="number")return"number";if(typeof Z==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let Z=Q.callee;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="Identifier"){let $=Z.name;if($==="String")return"string";if($==="Number")return"number";if($==="Boolean")return"boolean"}return null}default:return null}}function cQ(Q){if(y(Q,"$bindable"))return{init:Q.arguments[0],bindable:!0};return{init:Q,bindable:!1}}function rZ(Q,Z){let $=Z.params;if(!Array.isArray($)||$.length===0)return"";let G=$[0],X=$[$.length-1];if(typeof G.start!=="number"||typeof X.end!=="number")return"";return A(Q,G.start,X.end)??""}function vQ(Q,Z){if(Z.generator)return;let $=Z.body;if(!$||typeof $!=="object"||!("type"in $))return;let G=rZ(Q,Z),X=Z.async?"async ":"",q=(K,Y)=>K&&typeof K==="object"&&("type"in K)&&K.type==="ObjectExpression"?`(${Y})`:Y;if($.type!=="BlockStatement"){let K=zQ(Q,$);return K===void 0?void 0:`${X}(${G}) => ${q($,K)}`}let W=$.body;if(W.length===0)return`${X}(${G}) => {}`;if(W.length===1){let K=W[0];if(K&&typeof K==="object"&&"type"in K&&K.type==="ReturnStatement"){let Y=K.argument;if(Y){let O=zQ(Q,Y);if(O!==void 0)return`${X}(${G}) => ${q(Y,O)}`}}}return}function yQ(Q,Z,$){let G=zQ(Z,$);if(!G||!$||typeof $!=="object"||!("type"in $))return;let X="expression";if($.type==="Literal"||$.type==="UnaryExpression")X="literal";else if($.type==="TemplateLiteral")X=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")X="array";else if($.type==="ObjectExpression")X="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"||$.type==="FunctionDeclaration")X="function";let q={raw:G,kind:X};if(X==="literal"||X==="array"||X==="object"){let W=EQ(Q,$);if(W.ok)q.value=W.value}return q}function EQ(Q,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return{ok:!1};if(Z.type==="Literal"){let $=Z.value;return typeof $==="bigint"?{ok:!1}:{ok:!0,value:$}}if(Z.type==="UnaryExpression"){let $=Z,G=$.argument;if(!G||typeof G!=="object"||!("type"in G)||G.type!=="Literal")return{ok:!1};let X=G.value;if(typeof X==="number"){if($.operator==="-")return{ok:!0,value:-X};if($.operator==="+")return{ok:!0,value:X}}if(typeof X==="boolean"&&$.operator==="!")return{ok:!0,value:!X};return{ok:!1}}if(Z.type==="TemplateLiteral"){let $=Z;if($.expressions.length>0||$.quasis.length!==1)return{ok:!1};return{ok:!0,value:$.quasis[0].value.cooked??$.quasis[0].value.raw}}if(Z.type==="ArrayExpression"){let $=Z,G=[];for(let X of $.elements){if(!X)return{ok:!1};let q=EQ(Q,X);if(!q.ok)return{ok:!1};G.push(q.value)}return{ok:!0,value:G}}if(Z.type==="ObjectExpression"){let $=Z,G={};for(let X of $.properties){if(X.type!=="Property"||X.computed)return{ok:!1};let q=Q.getPropertyName(X.key);if(!q)return{ok:!1};let W=EQ(Q,X.value);if(!W.ok)return{ok:!1};G[q]=W.value}return{ok:!0,value:G}}return{ok:!1}}var aZ=/[-_.:/\s]+/;function hQ(Q){return`${Q.split(aZ).map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join("")}Context`}function nZ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let X=[];if(!pQ($))return null;let q=$;for(let W of q.properties){if(W.type!=="Property")continue;let K=Z.getPropertyName(W.key);if(!K)continue;let Y="any",O;if(s(W.value)){let L=W.value.name,J=Z.findVariableTypeAndDescription(L);if(J)Y=J.type,O=J.description;else m(Q,"context-any-type",K,`Context "${G}" property "${K}" has no type annotation; defaulted to "any".`,h(Q,W))}else if(W.value&&typeof W.value==="object"&&"type"in W.value&&(W.value.type==="ArrowFunctionExpression"||W.value.type==="FunctionExpression"))Y=`(${W.value.params?.map((B)=>{if(s(B))return`${B.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(VQ(W.value))Y=W.value.value==null?"null":typeof W.value.value;X.push({name:K,type:Y,description:O,optional:!1})}return{key:G,typeName:hQ(G),properties:X,description:void 0}}else if(s($)){let X=$.name,q=Z.findVariableTypeAndDescription(X);if(q)return{key:G,typeName:hQ(G),properties:[{name:X,type:q.type,description:q.description,optional:!1}]};return m(Q,"context-any-type",X,`Context "${G}" variable "${X}" has no type annotation; defaulted to "any".`,h(Q,$)),{key:G,typeName:hQ(G),properties:[{name:X,type:"any",description:void 0,optional:!1}]}}return null}function iQ(Q){let Z=Q.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",G=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!G)return null;let X=Q.arguments[0];if(!X||typeof X!=="object"||!("type"in X))return"";if(X.type==="Literal"&&typeof X.value==="string")return X.value;if(X.type==="TemplateLiteral"&&X.quasis?.length===1)return X.quasis[0].value.cooked??"";return""}function oQ(Q,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let G=Z;if(G.type==="Literal")return typeof G.value==="string"?G.value:G.value==null?null:String(G.value);if(G.type==="TemplateLiteral"){if(G.quasis?.length===1){let X=G.quasis[0].value.cooked;return X==null?null:X}return null}if(G.type==="CallExpression"||G.type==="NewExpression")return iQ(G);if(G.type==="Identifier"){if($>=5)return null;let X=mQ(Q,G.name);if(X&&typeof X==="object"&&"type"in X){let q=X;if((q.type==="CallExpression"||q.type==="NewExpression")&&iQ(q)==="")return G.name;return oQ(Q,q,$+1)}return null}return null}function rQ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let X=$,q=X.arguments[0];if(!q)return;let W=oQ(Q,q);if(!W){let O=Q.componentFilePath?` in ${Q.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${O}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=X.arguments[1];if(!K)return;let Y=nZ(Q,Z,K,W);if(Y&&!Q.contexts.has(W))Q.contexts.set(W,Y)}function tZ({hasTypeScriptType:Q,hasJSDocType:Z,inferredType:$,finalType:G}){if(Q)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(G!==void 0)return"inferred";return"unknown"}function XQ(Q){let Z=Q.explicitType??Q.jsdocType??Q.resolvedType??Q.typeSeed,$=Q.jsdocParams??Q.resolvedParams,G=Q.jsdocReturnType??Q.resolvedReturnType;if(Q.isFunctionDeclaration&&Z==="() => any"&&G)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${G}`:`() => ${G}`;let X=Q.jsdocDescription??Q.resolvedDescription;if(X===void 0&&Z!==void 0)X=Q.typedefs?.get(Z)?.description;let q=tZ({hasTypeScriptType:Q.explicitType!==void 0,hasJSDocType:Q.jsdocType!==void 0||Q.jsdocParams!==void 0||Q.jsdocReturnType!==void 0||Q.resolvedType!==void 0,inferredType:Q.inferredTypeForSource,finalType:Z}),W=Q.initializerIsFunction||Q.isFunctionDeclaration||Q.inferIsFunctionFromTypeSignature===!0&&(!!Q.jsdocParams?.length||Q.jsdocReturnType!==void 0||!!Q.jsdocType?.includes("=>")||!!Q.resolvedType?.includes("=>")||!!Q.explicitType?.includes("=>"));return{type:Z,typeSource:q,description:X,params:$,returnType:G,isFunction:W}}function eZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;let Z=String(Q.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in Q&&typeof Q.name==="string"?Q.name:void 0;if(!$)return;let G=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in Q&&typeof Q.tag==="string")G.thisValue=Q.tag;return G}function aQ(Q,Z){if(Q.rest_props!==void 0)return;let $=eZ(Z);if($)Q.rest_props=$}function k(Q,Z,$){if(!Z||Q.has(Z))return;Q.set(Z,$)}function JQ(Q,Z){for(let $=Q.activeScopes.length-1;$>=0;$-=1){let G=Q.activeScopes[$]?.get(Z);if(!G)continue;return G.kind==="prop"?G.publicPropName:void 0}return}function P(Q,Z=new Set){if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(Q.type){case"Identifier":Z.add(Q.name);break;case"AssignmentPattern":P(Q.left,Z);break;case"ArrayPattern":for(let $ of Q.elements)P($??void 0,Z);break;case"ObjectPattern":for(let $ of Q.properties)if($.type==="Property")P($.value,Z);else if($.type==="RestElement")P($.argument,Z);break;case"RestElement":P(Q.argument,Z);break}return Z}function kQ(Q,Z){let $=P(Z);if(!$)return;for(let G of $){let X=JQ(Q,G);if(X)Q.reactive_vars.add(X)}}function MQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;switch(String(Q.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function tQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;let Z=String(Q.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function Q0(Q,Z){let $=Q.scopeDeclarations.get(Z);if(!$)$=new Map,Q.scopeDeclarations.set(Z,$);return $}function Z0(Q,Z,$){let G=[];if($.id.type==="Identifier")return G.push({kind:"local",name:$.id.name}),G;if($.id.type!=="ObjectPattern")return G;for(let X of $.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")G.push({kind:"local",name:X.argument.name});continue}if(X.computed)continue;let q=Q.getPropertyName(X.key);if(!q)continue;let W;if(X.value.type==="Identifier")W=X.value.name;else if(X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier")W=X.value.left.name;if(!W)continue;G.push({kind:"prop",name:W,publicPropName:q})}return G}function DQ(Q,Z,$,G,X){if(!nQ(Z))return;let q=X?.allowRunesProps??!1,W=X?.forceProp??!1,K=Z;for(let Y of K.declarations){if(q&&y(p(Y.init),"$props")){for(let J of Z0(Q,K,Y))k(J.kind==="prop"?$:G,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let O=K.kind==="var"?G:$,L=W?"prop":"local";for(let J of P(Y.id))k(O,J,L==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function $0(Q,Z){if("id"in Q&&Q.id&&typeof Q.id==="object"&&"name"in Q.id&&typeof Q.id.name==="string")k(Z,Q.id.name,{kind:"local"});for(let $ of Q.params)for(let G of P($))k(Z,G,{kind:"local"})}function G0(Q,Z,$,G){if(!Array.isArray(Z))return;for(let X of Z){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"VariableDeclaration":DQ(Q,X,$,G);break;case"FunctionDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break}}}function X0(Q,Z,$){if(!$||typeof $!=="object")return;let G="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!G||!("body"in G)||!Array.isArray(G.body))return;for(let X of G.body){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"ImportDeclaration":for(let q of X.specifiers??[])if(q.local?.name)k(Z.componentScope,q.local.name,{kind:"local"});break;case"VariableDeclaration":DQ(Q,X,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!X.declaration||typeof X.declaration!=="object"||!("type"in X.declaration))break;if(X.declaration.type==="VariableDeclaration")DQ(Q,X.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(X.declaration.type==="FunctionDeclaration"&&X.declaration.id?.name)k(Z.componentScope,X.declaration.id.name,{kind:"prop",publicPropName:X.declaration.id.name});break}}}function eQ(Q,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,X0(Q,Z,Z.parsed?.instance)}function QZ(Q){return{varScopeStack:[Q.componentScope]}}function ZZ(Q,Z,$,G){if(!MQ(G))return;let X=Q0(Z,G),q=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(G.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":$0(G,X);break;case"BlockStatement":G0(Q,G.body,X,q);break;case"CatchClause":if("param"in G)for(let K of P(G.param))k(X,K,{kind:"local"});break;case"EachBlock":{let K=G;for(let Y of P(K.context))k(X,Y,{kind:"local"});if(typeof K.index==="string")k(X,K.index,{kind:"local"});else if(K.index&&"name"in K.index)k(X,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in G)for(let K of P(G.value))k(X,K,{kind:"local"});break;case"CatchBlock":if("error"in G)for(let K of P(G.error))k(X,K,{kind:"local"});break}if(tQ(G))$.varScopeStack.push(X)}function $Z(Q,Z){if(tQ(Z))Q.varScopeStack.pop()}var U0=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function q0(Q,Z){switch(Z?.type){case"MemberExpression":return Z.computed||Q===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return Q===Z.meta;case"PropertyDefinition":return Z.computed||Q===Z.value;case"Property":return Z.computed||Q===Z.value;case"ExportSpecifier":case"ImportSpecifier":return Q===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Y0(Q,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(Q))return!0;return!1}function W0(Q){let Z=new Set;if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=Q;if($.id?.name)Z.add($.id.name);for(let G of $.params??[])P(G,Z);break}case"BlockStatement":jQ(Q.body,Z);break;case"CatchClause":P(Q.param,Z);break;case"EachBlock":{let $=Q;if(P($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":P(Q.value,Z);break;case"CatchBlock":P(Q.error,Z);break}return Z}function jQ(Q,Z){if(!Array.isArray(Q))return;for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let G of $.specifiers??[])if(G.local?.name)Z.add(G.local.name);break;case"VariableDeclaration":for(let G of $.declarations??[])P(G.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let G=$.id?.name;if(G)Z.add(G);break}case"ExportNamedDeclaration":{let G=$.declaration;if(G&&typeof G==="object"&&"type"in G)jQ([G],Z);break}}}}function _Q(Q,Z){if(!Q||typeof Q!=="object")return!1;let $=[...Z],G=!1;return v(Q,{enter(X,q){if(G){this.skip();return}if(MQ(X))$.push(W0(X));if(q&&X.type==="Identifier"&&U0.has(X.name)&&!q.type.startsWith("TS")&&q0(X,q)&&!Y0(X.name,$))G=!0,this.skip()},leave(X){if(MQ(X))$.pop()}}),G}function GZ(Q){if(!Q||typeof Q!=="object")return;if("content"in Q){let Z=Q.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in Q&&Array.isArray(Q.body))return Q.body;return}function XZ(Q){if(Q.runesOptionOverride!==void 0)return Q.runesOptionOverride?"runes":"legacy";let Z=Q.parsed;if(!Z)return"legacy";let $=new Set;jQ(GZ(Z.module),$);let G=new Set;return jQ(GZ(Z.instance),G),_Q(Z.module,[$])||_Q(Z.instance,[$,G])||_Q(Z.html,[$,G])?"runes":"legacy"}var K0=/[A-Za-z_$][\w$]*/g;function H0(Q,Z,$){let G=new Map,X=Z.typeParameters?.params,q=$.typeArguments?.params;if(!X?.length||!q?.length)return G;for(let W=0;W<X.length;W++){let K=X[W]?.name,Y=q[W];if(!K||Y?.start===void 0||Y?.end===void 0)continue;let O=A(Q,Y.start,Y.end)?.trim();if(O)G.set(K,O)}return G}function O0(Q,Z){if(Z.size===0)return Q;return Q.replace(K0,($)=>Z.get($)??$)}function UQ(Q,Z,$,G,X=new Set){let q=new Map;if(!$?.type)return q;let W=(K)=>{for(let Y of K){if(Y?.type!=="TSPropertySignature"||Y.computed)continue;if(!Y.key)continue;let O=Q.getPropertyName(Y.key);if(!O)continue;let L=Y.typeAnnotation?.start,J=Y.typeAnnotation?.end;if(L===void 0||J===void 0)continue;let B=A(Z,L+1,J)?.trim();if(!B)continue;q.set(O,{type:B,optional:Y.optional===!0,source:h(Z,Y)})}};switch($.type){case"TSTypeLiteral":W($.members??[]);break;case"TSInterfaceDeclaration":W($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}case"TSTypeReference":{let K=WZ($.typeName);if(!K||X.has(K))break;let Y=G.get(K);if(!Y)break;X.add(K);let O=UQ(Q,Z,Y,G,X);X.delete(K);let L=H0(Z,Y,$);for(let[J,B]of O)q.set(J,L.size===0?B:{...B,type:O0(B.type,L)});break}case"TSIntersectionType":for(let K of $.types??[]){let Y=UQ(Q,Z,K,G,X);for(let[O,L]of Y)q.set(O,L)}break;case"TSParenthesizedType":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}}return q}function LZ(Q,Z,$){if(Z.runesPropsDeclarationMetadataByDeclaratorStart.clear(),Z.explicitPropTypesByName.clear(),Z.explicitVariableTypesByName.clear(),Z.typeImportBindingsByLocalName.clear(),Z.localTypeDeclarationsByName.clear(),Z.typedRunesPropsDeclarations.length=0,!Z.source)return;let G=$;Z.scriptLanguage=Q.resolveScriptLanguage(G),Z.customElementTag=G.options?.customElement?.tag,Z.runesOptionOverride=G.options?.runes,Z.scriptGenericsAttribute=Q.resolveScriptGenericsAttribute(G);let X=G.instance?.content?.body??[];for(let q of X){if(!q?.type)continue;if(q.type==="ImportDeclaration"&&q.source?.value)for(let W of q.specifiers??[]){let K=W.local?.name;if(!K)continue;if(!(q.importKind==="type"||W.importKind==="type"))continue;let O,L;if(W.type==="ImportSpecifier")O="named",L=W.imported?.type==="Identifier"?W.imported.name:typeof W.imported?.value==="string"?W.imported.value:void 0;else if(W.type==="ImportDefaultSpecifier")O="default";else if(W.type==="ImportNamespaceSpecifier")O="namespace";if(!O)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:L,localName:K,source:String(q.source.value),specifierType:O})}if((q.type==="TSInterfaceDeclaration"||q.type==="TSTypeAliasDeclaration")&&q.id?.name&&q.start!==void 0&&q.end!==void 0)Z.localTypeDeclarationsByName.set(q.id.name,{code:A(Z,q.start,q.end)?.trim()??"",node:q,start:q.start});if(q.type==="ExportNamedDeclaration"&&q.declaration?.type==="VariableDeclaration")for(let W of q.declaration.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(W.id.name,K)}else if(q.type==="VariableDeclaration")for(let W of q.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(W.id.name,K)}}for(let q of X){if(!q||typeof q!=="object"||!("declarations"in q))continue;for(let W of q.declarations??[]){if(!y(p(W.init),"$props"))continue;let K=W.id?.typeAnnotation?void 0:UZ(W.init),Y=W.id?.typeAnnotation?.typeAnnotation??K,O=W.id?.typeAnnotation?BQ(Z,W.id.typeAnnotation):KZ(Z,K),L=UQ(Q,Z,Y,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([T,f])=>[T,f.node]))),J=new Set,B=new Set;if(HZ(Z,Y,J,B),OZ(Z,J,B),W.start!==void 0){let T={canonicalType:O,props:L,referencedImportedTypes:J,referencedLocalTypes:B};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(W.start,T),O)Z.typedRunesPropsDeclarations.push(T)}}}}function VZ(Q,Z,$){for(let G of $.declarations){if(!y(p(G.init),"$props"))continue;if(G.id.type==="Identifier"){Z.wholePropsLocals.add(G.id.name),Z.restPropLocals.add(G.id.name);let W=qZ(Z,G.start);if(W)for(let[K,Y]of W.props)GQ(Q,Z,K,{name:K,kind:"let",type:Y.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!Y.optional,constant:!1,reactive:!1,source:Y.source});continue}if(G.id.type!=="ObjectPattern")continue;let X=o(Z,Q,$),q=G.id.properties.filter((W)=>{if(W.type!=="Property"||W.computed)return!1;if(!Q.getPropertyName(W.key))return!1;if(W.value.type==="Identifier")return!0;return W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier"}).length;for(let W of G.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Z.restPropLocals.add(W.argument.name);continue}let K=Q.getPropertyName(W.key);if(!K)continue;let Y,O;if(W.value.type==="Identifier")Y=W.value.name;else{let M=W.value;Y=M.left.name,O=M.right}if(!Y)continue;if(Q.trackPropLocalName(K,Y),K==="children")Z.snippetPropLocals.add(Y);let L=zZ(Z,Q,W)??(q===1?X:void 0),J=YZ(Z,G.start,K),{init:B,bindable:T}=cQ(O),f=B==null?{isFunction:!1}:l(Q,Z,B),{value:e,type:QQ,isFunction:qQ,defaultValue:RQ}=f,wQ=J?.type===void 0&&L?.type===void 0?f.resolvedType:void 0;if(f.pendingCallDefault)Z.pendingCallDefaultCandidates.push({propName:K,location:"props",...f.pendingCallDefault});let{type:IQ,typeSource:YQ,description:WQ,params:KQ,returnType:U,isFunction:H}=XQ({explicitType:J?.type,typeSeed:QQ,inferredTypeForSource:QQ,jsdocType:L?.type,jsdocDescription:L?.description,jsdocParams:L?.params,jsdocReturnType:L?.returnType,resolvedType:wQ,resolvedDescription:f.resolvedDescription,resolvedParams:f.resolvedParams,resolvedReturnType:f.resolvedReturnType,initializerIsFunction:qQ,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(T)Z.reactive_vars.add(K);GQ(Q,Z,K,{name:K,...Y===K?{}:{localName:Y},kind:"let",description:WQ,binding:L?.binding,deprecated:L?.deprecated,tags:L?.tags,...T?{bindable:!0}:{},type:IQ,typeSource:YQ,value:e,defaultValue:RQ,params:KQ,returnType:U,isFunction:H,isFunctionDeclaration:!1,isRequired:B==null&&J?.optional!==!0,constant:!1,reactive:T,source:h(Z,W)})}}}function JZ(Q,Z){if(Q.syntaxMode!=="runes")return;for(let[$,G]of Array.from(Q.events.entries())){if(G.type!=="dispatched")continue;if(Z.has($)||Q.forwardedEvents.has($))continue;let X=`on${$}`,q=Q.props.get(X);if(!q)continue;let W=q.type!==void 0||q.params!==void 0||q.returnType!==void 0,K=G.detail===void 0||G.detail==="undefined"||G.detail==="null"?"() => void":`(detail: ${G.detail}) => void`;Q.props.set(X,{...q,description:q.description??G.description,type:W?q.type:K,typeSource:W?q.typeSource:"inferred",isFunction:!0}),Q.events.delete($)}}var MZ=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function FQ(Q){if(!Q||typeof Q!=="object")return;v(Q,{enter(Z){if(!MZ.has(Z.type))return;let $=Z.expression;while($&&MZ.has($.type))$=$.expression;if($)this.replace($)}})}function CQ(Q,Z){let $=Z.source?.value;if(typeof $!=="string"||Z.importKind==="type")return;for(let G of Z.specifiers??[]){if(G.type!=="ImportSpecifier"||G.importKind==="type")continue;let X=G.local?.name;if(!X)continue;let q=G.imported?.name??(typeof G.imported?.value==="string"?G.imported.value:X);Q.valueImportBindingsByLocalName.set(X,{localName:X,importedName:q,source:$})}}function SQ(Q,Z){if(!Z)return;v(Z,{enter($){if($.type==="ImportDeclaration")CQ(Q,$);if($.type==="FunctionDeclaration"){let G=$;if(G.id?.name)Q.funcDecls.set(G.id.name,G)}}})}function RZ(Q,Z,$){let G=Z+1;while(G<Q.length){if(Q[G]==="\\"){G+=2;continue}if(Q[G]===$)return G+1;G++}return G}function wZ(Q,Z){let $=Z+1,G=0;while($<Q.length){let X=Q[$];if(X==="\\"){$+=2;continue}if(G===0){if(X==="`")return $+1;if(X==="$"&&Q[$+1]==="{"){G=1,$+=2;continue}$++;continue}if(X==="{")G++;else if(X==="}")G--;else if(X==='"'||X==="'"){$=RZ(Q,$,X);continue}else if(X==="`"){$=wZ(Q,$);continue}$++}return $}function z0(Q,Z){let $=[],G=Q.length,X=0;while(X<G){let q=Q[X];if(q==='"'||q==="'"){X=RZ(Q,X,q);continue}if(q==="`"){X=wZ(Q,X);continue}if(q==="/"&&Q[X+1]==="/"){let W=X+2;while(W<G&&Q[W]!==`
|
|
2
2
|
`)W++;X=W;continue}if(q==="/"&&Q[X+1]==="*"){let W=X,K=X+2;while(K<G&&!(Q[K]==="*"&&Q[K+1]==="/"))K++;let Y=Math.min(K+2,G),O=Q.slice(W,Y);$.push({end:Y+Z,isJsDoc:O.startsWith("/**")&&O.length>4,text:O}),X=Y;continue}X++}return $}function jZ(Q,Z,$){if(!Q||typeof Q!=="object"||!("type"in Q))return;let G=Q;if(G.type==="FunctionDeclaration"){if(G.id?.type==="Identifier"&&G.id.name)$.push({name:G.id.name,start:Z});return}if(G.type==="VariableDeclaration"){for(let X of G.declarations??[])if(X?.id?.type==="Identifier"&&X.id.name)$.push({name:X.id.name,start:Z})}}function L0(Q){let Z=[];for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;let G=$;if(G.start===void 0)continue;if(G.type==="ExportNamedDeclaration"&&G.declaration)jZ(G.declaration,G.start,Z);else jZ(G,G.start,Z)}return Z}function V0(Q,Z,$){let G;for(let X of Q){if(X.end>Z)break;if(!X.isJsDoc)continue;if(!FZ.test($.slice(X.end,Z)))continue;G=X}return G}function IZ(Q,Z){let $=new Map;if(!Q.source)return $;let G=[Q.parsed?.module,Q.parsed?.instance],X=[],q=[];for(let W of G){let K=W?.content;if(!K?.body||K.start===void 0||K.end===void 0)continue;X.push(...z0(Q.source.slice(K.start,K.end),K.start)),q.push(...L0(K.body))}X.sort((W,K)=>W.end-K.end);for(let W of q){let K=V0(X,W.start,Q.source);if(!K)continue;let Y=BZ(K.text),{type:O,description:L}=CZ(Y);if(!O)continue;$.set(W.name,{type:Z.aliasType(O.type),description:L||O.description})}return $}function AZ(Q){if(Q==="var")return"let";if(Q==="using"||Q==="await using")return"const";return Q}var J0=null,PZ=/^@component/,M0=/\r/g,j0=/^\{\s*\}$/;class _{ctx=PQ();static mapToArray(Q){return Array.from(Q,([Z,$])=>$)}static getStaticAttributeValue(Q){if(!Array.isArray(Q.value))return;return Q.value.map((Z)=>Z.data??Z.raw??"").join("").trim()}resolveScriptLanguage(Q){let Z=[Q.instance,Q.module].filter((G)=>G!==void 0),$=!1;for(let G of Z){let X=G.attributes?.find((W)=>W.name==="lang");if(!X){$=!0;continue}if(_.getStaticAttributeValue(X)?.toLowerCase()==="ts")return"ts"}return $?"js":void 0}resolveScriptGenericsAttribute(Q){let Z=Q.instance?.attributes?.find((W)=>W.name==="generics");if(!Z)return;let $=h(this.ctx,Z),G=Q.instance?.attributes?.find((W)=>W.name==="lang");if((G?_.getStaticAttributeValue(G)?.toLowerCase():void 0)!=="ts"){m(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',$);return}let q=_.getStaticAttributeValue(Z);if(!q)return;return{value:q,source:$}}resolvePublicPropName(Q){return this.ctx.propLocalToPublicName.get(Q)??Q}trackPropLocalName(Q,Z=Q){this.ctx.propLocalToPublicName.set(Z,Q)}getPropByLocalOrPublic(Q){return this.ctx.props.get(this.resolvePublicPropName(Q))}getPropTypeByLocalOrPublic(Q){return this.getPropByLocalOrPublic(Q)?.type}getExplicitPropType(Q){return this.ctx.explicitPropTypesByName.get(Q)}getPropertyName(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;if(s(Q))return Q.name;if(VQ(Q))return Q.value==null?void 0:String(Q.value);return}isNumericConstant(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;if(Q.type!=="MemberExpression")return!1;let Z=Q,$=Z.object&&"name"in Z.object?Z.object.name:void 0,G=Z.property&&"name"in Z.property?Z.property.name:void 0;if(!$||!G)return!1;if($==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(G);if($==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(G);return!1}resolveLocalVarJSDoc(Q){for(let $ of this.ctx.vars)if($.declarations.some((X)=>X.id&&typeof X.id==="object"&&("type"in X.id)&&X.id.type==="Identifier"&&("name"in X.id)&&X.id.name===Q))return o(this.ctx,this,$);let Z=this.ctx.funcDecls.get(Q);if(Z)return o(this.ctx,this,Z);return}addModuleExport(Q,Z){if(LQ(Q)===void 0)return;if(this.ctx.moduleExports.has(Q)){let $=this.ctx.moduleExports.get(Q);this.ctx.moduleExports.set(Q,{...$,...Z})}else this.ctx.moduleExports.set(Q,Z)}aliasType(Q){if(Q==="*")return"any";return Q.trim()}findVariableTypeAndDescription(Q){let Z=this.getPropByLocalOrPublic(Q);if(Z?.type)return{type:Z.type,description:Z.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=IZ(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let $=this.ctx.variableInfoCache.get(Q),G=this.ctx.explicitVariableTypesByName.get(Q);if(G)return{type:G,description:$?.description};return $??null}accumulateGeneric(Q,Z){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${Q}`,`${this.ctx.generics[1]}, ${Z}`];else this.ctx.generics=[Q,Z]}cleanup(){this.ctx=PQ()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(Q){return _.SCRIPT_BLOCK_REGEX.lastIndex=0,Q.replace(_.SCRIPT_BLOCK_REGEX,(Z,$,G,X)=>{_.TS_DIRECTIVE_REGEX.lastIndex=0;let q=G.replace(_.TS_DIRECTIVE_REGEX,"");return $+q+X})}parseSvelteComponent(Q,Z){this.cleanup(),this.ctx.componentFilePath=Z.filePath;let $=_.stripTypeScriptDirectivesFromScripts(Q);this.ctx.source=$;let{modern:G,intoLegacy:X}=vZ($);if(LZ(this,this.ctx,G),this.ctx.parsed=X(),this.ctx.scriptLanguage==="ts")FQ(this.ctx.parsed.module),FQ(this.ctx.parsed.instance),FQ(this.ctx.parsed.html);this.ctx.syntaxMode=XZ(this.ctx);let q=this.ctx.parsed.css,W=q?.start!==void 0&&q?.end!==void 0?$.slice(0,q.start)+" ".repeat(q.end-q.start)+$.slice(q.end):$;NZ(this.ctx,this,W);let K={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};if(SQ(this.ctx,this.ctx.parsed?.module),SQ(this.ctx,this.ctx.parsed?.instance),this.ctx.parsed?.module)v(this.ctx.parsed?.module,{enter:(U)=>{if(U.type==="ImportDeclaration")CQ(this.ctx,U);if(U.type==="FunctionDeclaration"){let H=U;if(H.id?.name)this.ctx.funcDecls.set(H.id.name,H)}if(U.type==="VariableDeclaration")this.ctx.vars.add(U);if(U.type==="ExportNamedDeclaration"){if(U.declaration==null)return;if(!U.declaration||typeof U.declaration!=="object"||!("type"in U.declaration))return;let H,M,F=!1,z,V,C,w=!1,j,D,R;if(U.declaration.type==="FunctionDeclaration"){let N=U.declaration;if(!N.id?.name)return;H=N.id.name,M="function",z=void 0,V="() => any",w=!0,F=!0}else if(U.declaration.type==="VariableDeclaration"){let N=U.declaration,a=N.declarations[0];if(!a||typeof a!=="object"||!("id"in a))return;let{id:n,init:HQ}=a;if(!n||typeof n!=="object"||!("name"in n))return;let ZQ=n.name;H=ZQ,M=AZ(N.kind);let E=HQ==null?{isFunction:!1}:l(this,this.ctx,HQ);if({value:z,type:V,isFunction:w,defaultValue:j}=E,D=V,R=E,C=this.getExplicitPropType(ZQ),R.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:ZQ,location:"moduleExports",...R.pendingCallDefault})}else return;let S=o(this.ctx,this,U),{type:u,typeSource:d,description:I,params:b,returnType:g,isFunction:r}=XQ({explicitType:C,typeSeed:V,inferredTypeForSource:D,jsdocType:S?.type,jsdocDescription:S?.description,jsdocParams:S?.params,jsdocReturnType:S?.returnType,resolvedType:R?.resolvedType,resolvedDescription:R?.resolvedDescription,resolvedParams:R?.resolvedParams,resolvedReturnType:R?.resolvedReturnType,initializerIsFunction:w,isFunctionDeclaration:F,typedefs:this.ctx.typedefs});this.addModuleExport(H,{name:H,kind:M,description:I,deprecated:S?.deprecated,tags:S?.tags,type:u,typeSource:d,value:z,defaultValue:j,params:b,returnType:g,isFunction:r,isFunctionDeclaration:F,isRequired:!1,constant:M==="const",reactive:!1,source:h(this.ctx,U)})}}});let Y,O=new Set,L=new Set,J=[];eQ(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let B=QZ(this.ctx);if(v(K,{enter:(U,H,M)=>{ZZ(this,this.ctx,B,U);let F=this.ctx.scopeDeclarations.get(U);if(F)this.ctx.activeScopes.push(F);if(U.type==="AssignmentExpression")kQ(this.ctx,U.left);if(U.type==="UpdateExpression")kQ(this.ctx,U.argument);if(U.type==="CallExpression"){let z=U,V=z.callee&&typeof z.callee==="object"&&"name"in z.callee?z.callee.name:void 0;if(V==="createEventDispatcher"){if(H&&typeof H==="object"&&"id"in H&&H.id&&typeof H.id==="object"&&"name"in H.id)Y=H.id.name}if(V==="$host"){if(H&&typeof H==="object"&&"id"in H&&H.id&&typeof H.id==="object"&&"name"in H.id)O.add(H.id.name)}if(V==="setContext")rQ(this.ctx,this,U,H??void 0);if(V)J.push({name:V,arguments:z.arguments,source:h(this.ctx,z)});if(EZ(z.callee)&&s(z.callee.property)&&z.callee.property.name==="dispatchEvent"&&(y(z.callee.object,"$host")||s(z.callee.object)&&O.has(z.callee.object.name))){let C=SZ(this.ctx,z);if(C)L.add(C)}}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Spread"){let z=U;if(z.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(z.expression?.name??""))aQ(this.ctx,H)}if(U.type==="FunctionDeclaration"){let z=U;if(z.id?.name)this.ctx.funcDecls.set(z.id.name,z)}if(U.type==="ImportDeclaration")CQ(this.ctx,U);if(U.type==="VariableDeclaration"){if(this.ctx.vars.add(U),H&&typeof H==="object"&&"type"in H&&H.type==="Program"&&U.declarations.some((z)=>y(p(z.init),"$props")))VZ(this,this.ctx,U)}if(U.type==="ExportNamedDeclaration"){if(U.declaration==null&&U.specifiers.length===0)return;let z;if(U.declaration==null&&U.specifiers[0]?.type==="ExportSpecifier"){let E=U.specifiers[0],c=E.local&&typeof E.local==="object"&&"name"in E.local?E.local.name:void 0,i=E.exported&&typeof E.exported==="object"&&"name"in E.exported?E.exported.name:void 0;if(!c||!i)return;let t;for(let $Q of Array.from(this.ctx.vars))if($Q.declarations.some((x)=>x.id&&typeof x.id==="object"&&("type"in x.id)&&x.id.type==="Identifier"&&x.id.name===c)){t=$Q;break}U.declaration=t,z=i}if(U.declaration==null)return;if(!U.declaration||typeof U.declaration!=="object"||!("type"in U.declaration))return;let V,C=!1,w,j,D,R=!1,S=!1,u,d,I,b;if(U.declaration.type==="FunctionDeclaration"){let E=U.declaration;if(!E.id?.name)return;z??=E.id.name,u=E.id.name,V="function",w=void 0,j="() => any",R=!0,C=!0,S=!1}else if(U.declaration.type==="VariableDeclaration"){let E=U.declaration,c=E.declarations[0];if(!c||typeof c!=="object"||!("id"in c))return;let{id:i,init:t}=c;if(i&&typeof i==="object"&&"name"in i){let x=i.name;u=x,z??=x,D=this.getExplicitPropType(x)}else return;V=AZ(E.kind),S=V==="let"&&t==null;let $Q=t==null?{isFunction:!1}:l(this,this.ctx,t);if({value:w,type:j,isFunction:R,defaultValue:d}=$Q,I=j,b=$Q,b.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:z,location:"props",...b.pendingCallDefault})}else return;let g=o(this.ctx,this,U),{type:r,typeSource:N,description:a,params:n,returnType:HQ,isFunction:ZQ}=XQ({explicitType:D,typeSeed:j,inferredTypeForSource:I,jsdocType:g?.type,jsdocDescription:g?.description,jsdocParams:g?.params,jsdocReturnType:g?.returnType,resolvedType:b?.resolvedType,resolvedDescription:b?.resolvedDescription,resolvedParams:b?.resolvedParams,resolvedReturnType:b?.resolvedReturnType,initializerIsFunction:R,isFunctionDeclaration:C,typedefs:this.ctx.typedefs});GQ(this,this.ctx,z,{name:z,...u!==void 0&&u!==z?{localName:u}:{},kind:V,description:a,binding:g?.binding,deprecated:g?.deprecated,tags:g?.tags,type:r,typeSource:N,value:w,defaultValue:d,params:n,returnType:HQ,isFunction:ZQ,isFunctionDeclaration:C,isRequired:S,constant:V==="const",reactive:this.ctx.reactive_vars.has(z),source:h(this.ctx,U)})}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Comment"){let V=U?.data?.trim()??"";if(PZ.test(V))this.ctx.componentComment=V.replace(PZ,"").replace(M0,""),this.ctx.componentCommentSource=h(this.ctx,U)}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Slot"){let z=U,V=z.attributes?.find((j)=>j.name==="name")?.value?.[0]?.data,C=(z.attributes||[]).filter((j)=>j.name!=="name").reduce((j,D)=>{let R={value:void 0,replace:!1},S=D.value;if(S===void 0)return j;if(S[0]){let u=S[0],{type:d,expression:I,raw:b,start:g,end:r}=u;if(d==="Text"&&b!==void 0)R.value=JSON.stringify(b);else if(d==="AttributeShorthand"&&I&&typeof I==="object"&&"name"in I)R.value=I.name,R.replace=!0;if(I&&typeof I==="object"&&"type"in I){if(I.type==="Literal"&&"value"in I){let N=I.value;R.value=typeof N==="string"?JSON.stringify(N):String(N)}else if(I.type==="MemberExpression")R.value=hZ(this.ctx,this,I);else if(I.type!=="Identifier"){if(g!==void 0&&r!==void 0){if(I.type==="ObjectExpression"||I.type==="TemplateLiteral")R.value=A(this.ctx,g+1,r-1)}}}}if(D.name)j[D.name]=R;return j},{}),w=z.children?.map(({start:j,end:D})=>{if(j===void 0||D===void 0)return"";return A(this.ctx,j,D)??""}).join("").trim();TQ(this.ctx,{slot_name:V,slot_props:C,slot_fallback:w,source:h(this.ctx,U)})}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="RenderTag"){let z=U,V=fZ(this.ctx,z.expression);if(V){let C;if(V.arguments.length===0)C={};else if(V.arguments.length===1&&typeof V.arguments[0]==="object"&&V.arguments[0]&&"type"in V.arguments[0]&&V.arguments[0].type==="ObjectExpression")C=gZ(this.ctx,this,V.arguments[0]);else if(V.arguments.length===1)m(this.ctx,"syntax-skipped",V.publicName,`{@render ${V.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,h(this.ctx,U));let w=V.publicName==="children"?void 0:V.publicName,j=w===void 0?J0:w;if(C!==void 0)TQ(this.ctx,{slot_name:w,slot_props:C,source:h(this.ctx,U)});if(C!==void 0||this.ctx.slots.has(j))this.ctx.snippetPropLocals.add(V.trackingName)}}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="EventHandler"){let z=U;if(z.expression==null&&z.name){if(H!=null&&typeof H==="object"&&"name"in H){let V=typeof H.name==="string"?H.name:void 0,C="type"in H?String(H.type):void 0;if(V&&C){let w=C==="InlineComponent"?{type:"InlineComponent",name:V}:{type:"Element",name:V};this.ctx.forwardedEvents.set(z.name,w);let j=this.ctx.events.get(z.name),D=this.ctx.eventDescriptions.get(z.name),R=j?.deprecated;if(!j)this.ctx.events.set(z.name,{type:"forwarded",name:z.name,element:w,description:D,deprecated:R,source:h(this.ctx,U)});else if(j.type==="forwarded"&&D&&!j.description)this.ctx.events.set(z.name,{...j,description:D,deprecated:j.deprecated??R,source:j.source||h(this.ctx,U)})}}}}if(H&&typeof H==="object"&&"type"in H&&(String(H.type)==="Element"||String(H.type)==="InlineComponent")&&U&&typeof U==="object"&&"type"in U&&String(U.type)==="Binding"){let z=U;if(z.expression?.name){let V=JQ(this.ctx,z.expression.name);if(V)this.ctx.reactive_vars.add(V)}if(String(H.type)==="Element"&&z.name==="this"&&z.expression?.name&&"name"in H&&typeof H.name==="string"){let V=JQ(this.ctx,z.expression.name);if(!V)return;let C=H.name;if(this.ctx.bindings.has(V)){let w=this.ctx.bindings.get(V);if(w&&!w.elements.includes(C))this.ctx.bindings.set(V,{...w,elements:[...w.elements,C]})}else this.ctx.bindings.set(V,{elements:[C]})}}},leave:(U)=>{if(this.ctx.scopeDeclarations.has(U))this.ctx.activeScopes.pop();$Z(B,U)}}),Y!==void 0){for(let U of J)if(U.name===Y){let H=U.arguments[0],M=H&&typeof H==="object"&&"value"in H?H.value:void 0,F=U.arguments[1],z=F&&typeof F==="object"&&"value"in F?F.value:void 0;if(M!=null)_Z(this.ctx,{name:String(M),detail:z==null?"":kZ(z),has_argument:Boolean(F),source:U.source})}}let T=new Set(L);if(Y!==void 0){for(let U of J)if(U.name===Y){let H=U.arguments[0],M=H&&typeof H==="object"&&"value"in H?H.value:void 0;if(M!=null)T.add(String(M))}}this.ctx.forwardedEvents.forEach((U,H)=>{let M=this.ctx.events.get(H);if(M&&M.type==="dispatched"&&!T.has(H)){let F=this.ctx.eventDescriptions.get(H),z={type:"forwarded",name:H,element:U,description:F,deprecated:M.deprecated,tags:M.tags,source:M.source};if(M.detail!==void 0&&M.detail!=="undefined")z.detail=M.detail;this.ctx.events.set(H,z)}}),JZ(this.ctx,T);let f=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(U)=>this.resolvePublicPropName(U))):new Set,e=_.mapToArray(this.ctx.props).filter((U)=>!f.has(U.name)).map((U)=>{if(this.ctx.bindings.has(U.name)){let H=this.ctx.bindings.get(U.name)?.elements.sort().map((M)=>NQ(M)).join(" | ");return{...U,type:`null | ${H}`,typeSource:"inferred",reactive:U.reactive||this.ctx.reactive_vars.has(U.name)}}return{...U,reactive:U.reactive||this.ctx.reactive_vars.has(U.name)}});this.ctx.activeScopes.length=0;let QQ=_.mapToArray(this.ctx.slots).map((U)=>{if(!U.slot_props)return U;if(typeof U.slot_props==="string")return j0.test(U.slot_props)?{...U,slot_props:"Record<string, never>"}:U;let H=U.slot_props,M=[];for(let z of Object.keys(H)){if(H[z].replace&&H[z].value!==void 0)H[z].value=this.getPropTypeByLocalOrPublic(H[z].value);if(H[z].value===void 0)H[z].value="any";M.push(`${z}: ${H[z].value}`)}let F=M.length===0?"Record<string, never>":M.length===1?`{ ${M[0]} }`:`{
|
|
3
3
|
${M.join(`;
|
|
4
4
|
`)};
|