sveld 0.36.4 → 0.36.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.
- package/lib/browser.js +189 -195
- package/lib/chunk-44fwt51g.js +225 -0
- package/lib/{chunk-mab8x3d6.js → chunk-5x7ma2jx.js} +48 -48
- package/lib/chunk-c5sqd852.js +1 -0
- package/lib/chunk-ck4qbyqp.js +16 -0
- package/lib/{chunk-jehp1k7m.js → chunk-k880gdpw.js} +1 -1
- package/lib/{chunk-6magvxxe.js → chunk-t6s3aa0t.js} +5 -5
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/chunk-4ggahk6z.js +0 -17
- package/lib/chunk-86gqt5ax.js +0 -230
- package/lib/chunk-9ep3ybg5.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ia as a,ja as b}from"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-0q7qnmx3.js";export{b as parseModern,a as parse};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function b(w){return typeof w==="object"&&w!==null}function Bq(w){return b(w)&&w.type==="VariableDeclaration"&&Array.isArray(w.declarations)}function a(w){return b(w)&&w.type==="Literal"}function $w(w){return b(w)&&w.type==="Identifier"&&typeof w.name==="string"}function Mq(w){return b(w)&&w.type==="MemberExpression"}function Jw(w){return b(w)&&w.type==="ObjectExpression"&&Array.isArray(w.properties)}function Rw(w){return b(w)&&w.type==="CallExpression"}function Uq(w,q){if(!Rw(w))return!1;return!!w.callee&&b(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===q}function Cw(w){if(b(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"expression"in w)return Cw(w.expression);return w}function Oq(w){if(b(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"typeAnnotation"in w)return w.typeAnnotation;return}function Sw(w){return b(w)&&w.type==="NewExpression"}function r(w,q){if(!Sw(w))return!1;return!!w.callee&&b(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===q}var Iw=Symbol("sveld.parsedComponentTypeScriptMetadata");function Vq(w){return w[Iw]}function kq(w,q){if(q.length===0)return;let K=new Set(w.props.map((Z)=>Z.name));for(let Z of q){if(K.has(Z.name))continue;K.add(Z.name),w.props.push({name:Z.name,kind:"let",constant:!1,type:Z.type,typeSource:"typescript",...Z.description?{description:Z.description}:{},isFunction:Z.type.includes("=>"),isFunctionDeclaration:!1,isRequired:Z.isRequired,reactive:!1})}}var bw=/\w/;function hw(w,q){let K=w.trim();if(!K.startsWith("{")||!K.endsWith("}"))return;let Z=K.slice(1,-1),Q=[],$=0,J="";for(let z of Z)if(z==="{"||z==="<"||z==="("||z==="[")$++,J+=z;else if(z==="}"||z===">"||z===")"||z==="]")$--,J+=z;else if((z===";"||z===",")&&$===0)Q.push(J.trim()),J="";else J+=z;if(J.trim())Q.push(J.trim());for(let z of Q){if(!z.startsWith(q))continue;let H=z.slice(q.length);if(H.length>0&&bw.test(H[0]))continue;let j=H.trimStart();if(j.startsWith("?"))j=j.slice(1).trimStart();if(j.startsWith(":"))return j.slice(1).trim()}return}function Yw(w,q,K){let Z=K;if(Z.computed||Z.object?.type!=="Identifier"||Z.property?.type!=="Identifier")return;let Q=Z.object.name,$=Z.property.name;if(!Q||!$)return;if(w.wholePropsLocals.has(Q))return q.getPropTypeByLocalOrPublic($);let J=q.getPropTypeByLocalOrPublic(Q)??q.findVariableTypeAndDescription(Q)?.type;if(!J)return;return hw(J,$)}var Dw=/[\r\n]+/g;function _w(w){if(w.sourceLineStartOffsetsCache)return w.sourceLineStartOffsetsCache;let q=[0];if(w.source){let K=w.source.indexOf(`
|
|
2
|
+
`);while(K!==-1)q.push(K+1),K=w.source.indexOf(`
|
|
3
|
+
`,K+1)}return w.sourceLineStartOffsetsCache=q,q}function zw(w,q){if(!w.source||q<0||q>w.source.length)return;let K=_w(w),Z=0,Q=K.length-1;while(Z<=Q){let $=Math.floor((Z+Q)/2),J=K[$],z=K[$+1]??Number.POSITIVE_INFINITY;if(q<J)Q=$-1;else if(q>=z)Z=$+1;else return{line:$+1,column:q-J}}return}function Hw(w,q,K){if(q===void 0||K===void 0||K<q)return;let Z=zw(w,q),Q=zw(w,K);if(!Z||!Q)return;return{start:Z,end:Q}}function jw(w,q){if(!q||typeof q!=="object")return;let K="start"in q&&typeof q.start==="number"?q.start:void 0,Z="end"in q&&typeof q.end==="number"?q.end:void 0;return Hw(w,K,Z)}function n(w,q){if(!q||q.length===0)return;let K=[...q];while(K.length>1){let H=K[K.length-1];if(H.tag!==void 0||!H.raw.trim().endsWith("*/"))break;K.pop()}let Z=K[0],Q=Z.raw.indexOf(`@${Z.tag??""}`),$=Z.start+Math.max(Q,0),J=K[K.length-1],z=J.start+J.raw.length;return Hw(w,$,z)}function x(w,q,K){return w.source?.slice(q,K)}function Fq(w,q){if(!q||typeof q!=="object")return;let K="start"in q&&typeof q.start==="number"?q.start:void 0,Z="end"in q&&typeof q.end==="number"?q.end:void 0;if(K===void 0||Z===void 0)return;return x(w,K,Z)?.replace(Dw," ")}function v(w){return w===void 0||w===""?void 0:w}function Lw(w){return typeof w==="string"?JSON.stringify(w):String(w)}function t(w,{name:q,detail:K,has_argument:Z,description:Q,deprecated:$,tags:J,source:z}){if(q===void 0)return;let H=!Z&&!K?"null":v(K),j=Q,Y=w.events.get(q);if(Y?.type==="forwarded")w.events.set(q,{type:"dispatched",name:q,detail:H,description:j||Y.description,deprecated:$??Y.deprecated,tags:J??Y.tags,source:z||Y.source});else if(Y){let U=Y.tags??J;w.events.set(q,{...Y,detail:Y.detail===void 0?H:Y.detail,description:Y.description||j,deprecated:Y.deprecated??$,tags:U,source:z||Y.source})}else w.events.set(q,{type:"dispatched",name:q,detail:H,description:j,deprecated:$,tags:J,source:z})}function bq(w,q){let K=q.arguments[0],Z=r(K,"CustomEvent");if(!Z&&!r(K,"Event"))return;let Q=K.arguments[0],$=a(Q)?Q.value:void 0;if($==null)return;let J=Z?K.arguments[1]:void 0,z=!1,H;if(Jw(J)){let j=J.properties.find((Y)=>Y.type==="Property"&&$w(Y.key)&&Y.key.name==="detail");if(j?.type==="Property")z=!0,H=a(j.value)?j.value.value:void 0}return t(w,{name:String($),detail:H==null?"":Lw(H),has_argument:z,source:jw(w,q)}),String($)}function e(w,q,K=!1){if(w.length===0)return"null";let Z=w.map(({name:Q,type:$,description:J,optional:z,default:H})=>{let j=z?"?":"",Y=J||"";if(H&&Y)Y=`${Y} @default ${H}`;else if(H)Y=`@default ${H}`;if(Y){if(K)return`/** ${Y} */
|
|
4
|
+
${Q}${j}: ${$};`;return`/** ${Y} */ ${Q}${j}: ${$};`}return`${Q}${j}: ${$};`}).join(K?`
|
|
5
|
+
`:" ");return K?`{
|
|
6
|
+
${Z}
|
|
7
|
+
}`:`{ ${Z} }`}var vw=/[A-Za-z_$][\w$]*/g;function Ew(w,q){if(!q)return!1;let K=new Set(q[0].split(",").map((Z)=>Z.trim()));for(let[Z]of w.matchAll(vw))if(K.has(Z))return!0;return!1}function fw(w,q){if(q===void 0)return;return w.runesPropsDeclarationMetadataByDeclaratorStart.get(q)}function _q(w,q,K){return fw(w,q)?.props.get(K)}function Lq(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"right"in w&&w.right&&typeof w.right==="object"&&"name"in w.right&&typeof w.right.name==="string")return w.right.name;return}function Ww(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"left"in w&&w.left&&typeof w.left==="object")return Ww(w.left);return}function vq(w,q){let K=q?.start,Z=q?.end;if(K===void 0||Z===void 0)return;return x(w,K+1,Z)?.trim()}function Eq(w,q){let K=q?.start,Z=q?.end;if(K===void 0||Z===void 0)return;return x(w,K,Z)?.trim()}function D(w,q,K,Z,Q=new Set){if(!q?.type)return;switch(q.type){case"TSInterfaceDeclaration":D(w,{type:"TSTypeLiteral",members:q.body?.body},K,Z,Q);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":D(w,q.typeAnnotation,K,Z,Q);return;case"TSIntersectionType":case"TSUnionType":for(let $ of q.types??[])D(w,$,K,Z,Q);return;case"TSTypeLiteral":for(let $ of q.members??[]){if($?.type!=="TSPropertySignature")continue;D(w,$.typeAnnotation?.typeAnnotation,K,Z,Q)}return;case"TSTypeReference":{let $=Ww(q.typeName);if($){if(w.typeImportBindingsByLocalName.has($))K.add($);let J=w.localTypeDeclarationsByName.get($);if(J&&!Q.has($))Z.add($),Q.add($),D(w,J.node,K,Z,Q),Q.delete($)}if("typeParameters"in q&&q.typeParameters&&typeof q.typeParameters==="object"){let J=q.typeParameters;for(let z of J.params??[])D(w,z,K,Z,Q)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let $ of Object.values(q)){if(!$||typeof $!=="object")continue;if(Array.isArray($)){for(let J of $){if(!J||typeof J!=="object"||!("type"in J))continue;D(w,J,K,Z,Q)}continue}if("type"in $)D(w,$,K,Z,Q)}}function Nw(w,q){let K=new Map;for(let Z of Array.from(q).sort()){let Q=w.typeImportBindingsByLocalName.get(Z);if(!Q)continue;let $=K.get(Q.source)??{default:[],named:[],namespace:[]};if(Q.specifierType==="default")$.default.push(Q.localName);else if(Q.specifierType==="namespace")$.namespace.push(Q.localName);else $.named.push({imported:Q.importedName,local:Q.localName});K.set(Q.source,$)}return Array.from(K.entries()).sort(([Z],[Q])=>Z.localeCompare(Q)).map(([Z,Q])=>{if(Q.namespace.length>0)return Q.namespace.map((H)=>`import type * as ${H} from "${Z}";`).join(`
|
|
8
|
+
`);let $=Q.named.map(({imported:H,local:j})=>{if(!H||H===j)return j;return`${H} as ${j}`}),J=Q.default[0],z=$.length>0?`{ ${$.join(", ")} }`:"";if(J&&z)return`import type ${J}, ${z} from "${Z}";`;if(J)return`import type ${J} from "${Z}";`;return`import type ${z} from "${Z}";`})}function fq(w){let q=w.pendingCallDefaultCandidates.length>0?w.pendingCallDefaultCandidates.slice():void 0;if(w.typedRunesPropsDeclarations.length!==1)return q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:q}:void 0;let[K]=w.typedRunesPropsDeclarations;if(!K.canonicalType)return q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:q}:void 0;let Z=Array.from(K.referencedLocalTypes).map((Q)=>w.localTypeDeclarationsByName.get(Q)).filter((Q)=>Q!==void 0).sort((Q,$)=>Q.start-$.start).map((Q)=>Q.code);return{canonicalPropsType:K.canonicalType,canonicalPropNames:Array.from(K.props.keys()).sort(),localTypeDeclarations:Z,typeImportStatements:Nw(w,K.referencedImportedTypes),referencesComponentGenerics:Ew(K.canonicalType,w.generics),...q?{pendingCallDefaultCandidates:q}:{}}}var Tw=/^[A-Za-z_$][\w$]*/,xw=/[A-Za-z_$][\w$]*/g,Bw=/^(?:const|in|out)\s+/;function ww(w){let q=[],K=0,Z=0;for(let Q=0;Q<w.length;Q++){let $=w[Q];if($==="<"||$==="("||$==="["||$==="{")K++;else if($===">"||$===")"||$==="]"||$==="}")K=Math.max(K-1,0);else if($===","&&K===0)q.push(w.slice(Z,Q)),Z=Q+1}return q.push(w.slice(Z)),q}function xq(w){let q=ww(w).map((Z)=>Z.trim()).filter((Z)=>Z.length>0);if(q.length===0)return null;return[q.map((Z)=>{let Q=Z;while(Bw.test(Q))Q=Q.replace(Bw,"");return Q.match(Tw)?.[0]??Z}).join(", "),q.join(", ")]}function yq(w,q,K){let Z=w.scriptGenericsAttribute?.value;if(!Z)return;for(let[Q]of Z.matchAll(xw)){if(w.typeImportBindingsByLocalName.has(Q))q.add(Q);if(K.has(Q))continue;let $=w.localTypeDeclarationsByName.get(Q);if(!$)continue;K.add(Q),D(w,$.node,q,K)}}var yw=null;function uw(w,q,K){let Z={value:void 0,replace:!1};if(!K||typeof K!=="object"||!("type"in K))return Z;if(K.type==="Identifier")Z.value=K.name,Z.replace=!0;else if(K.type==="Literal")Z.value=String(K.value);else if(K.type==="MemberExpression")Z.value=Yw(w,q,K);else if((K.type==="ObjectExpression"||K.type==="TemplateLiteral")&&"start"in K&&"end"in K&&typeof K.start==="number"&&typeof K.end==="number")Z.value=x(w,K.start,K.end);return Z}function dq(w,q,K){let Z={};for(let Q of K.properties){if(Q.type!=="Property"||Q.computed)continue;let $=q.getPropertyName(Q.key);if(!$)continue;Z[$]=uw(w,q,Q.value)}return Z}function gw(w,q){if(!q||typeof q!=="object"||!("type"in q))return null;if(q.type==="Identifier"){let $=q,J=w.propLocalToPublicName.get($.name);if(!J)return null;return{publicName:J,trackingName:$.name}}if(q.type!=="MemberExpression")return null;let K=q,Z=K.object&&typeof K.object==="object"&&"type"in K.object&&K.object.type==="Identifier"?K.object.name:void 0;if(!Z||!w.wholePropsLocals.has(Z))return null;let Q;if(!K.computed&&K.property&&typeof K.property==="object"&&"type"in K.property){if(K.property.type==="Identifier")Q=K.property.name;else if(K.property.type==="Literal"&&K.property.value!=null)Q=String(K.property.value)}else if(K.computed&&K.property&&typeof K.property==="object"&&"type"in K.property&&K.property.type==="Literal"&&"value"in K.property&&K.property.value!=null)Q=String(K.property.value);if(!Q)return null;return{publicName:Q,trackingName:Q}}function pq(w,q){let K=q;if(K&&typeof K==="object"&&"type"in K&&K.type==="ChainExpression")K=K.expression;if(!K||typeof K!=="object"||!("type"in K)||K.type!=="CallExpression")return null;let Z=K;if(!Z.callee||typeof Z.callee!=="object"||!("type"in Z.callee))return null;let Q=gw(w,Z.callee);if(!Q)return null;return{...Q,arguments:Z.arguments}}function Mw(w,{slot_name:q,slot_props:K,slot_fallback:Z,slot_description:Q,slot_deprecated:$,slot_tags:J,source:z}){let H=q===void 0||q==="",j=H?yw:q??"",Y=v(Z),U=K===void 0||K===""?void 0:K,S=Q?.trim()||void 0;if(w.slots.has(j)){let V=w.slots.get(j);if(V)w.slots.set(j,{...V,default:V.default??H,fallback:Y,slot_props:V.slot_props===void 0?U:V.slot_props,description:V.description||S,deprecated:V.deprecated??$,tags:V.tags||J,source:z||V.source})}else w.slots.set(j,{name:j,default:H,fallback:Y,slot_props:K,description:S,deprecated:$,tags:J,source:z})}var lw=/\n/,mw=/\r$/,y=/^\s+/,dw=/\s/,pw=/^@[^\s/]+(?=\s|$)/,cw=/^@(\S+)\s*/;function iw(w){let q=[],K=0;for(let Z of w.split(lw))q.push({text:Z.replace(mw,""),start:K}),K+=Z.length+1;return q}function ow(w,q){let K=w.replace(y,""),Z=!1;if(q)K=K.slice(3),Z=!0;else if(K.startsWith("*")&&!K.startsWith("*/"))K=K.slice(1),Z=!0;let Q=K.match(y)?.[0]??"";K=K.slice(Q.length);let $=K.trimEnd(),J=$.endsWith("*/")?$.slice(0,-2):K;return{indent:Z?Q.slice(1):Q,separator:Q,content:J}}function sw(w){let q=[],K=iw(w),Z=null,Q=0;for(let $ of K){if(Z===null){let j=$.text.replace(y,"");if(!j.startsWith("/**")||j.startsWith("/***"))continue;Z=[],Q=$.start+($.text.length-j.length)}let{indent:J,separator:z,content:H}=ow($.text,Z.length===0);if(Z.push({raw:$.text,start:$.start,number:Z.length,indent:J,separator:z,content:H}),$.text.trimEnd().endsWith("*/"))q.push({start:Q,lines:Z}),Z=null}return q}function aw(w){let q=w;if(q.length>0&&q[0].content==="")q=q.slice(1);if(q.length>0&&q[q.length-1].content==="")q=q.slice(0,-1);return q}function rw(w){let q=[[]],K=!1;for(let Z of w){if(pw.test(Z.content)&&!K)q.push([Z]);else q[q.length-1].push(Z);if(Z.content.split("```").length%2===0)K=!K}return q}function Uw(w){return w.map((q)=>q.indent+q.content).join(`
|
|
9
|
+
`)}function nw(w,q){let K=q;while(K<w.length-1&&w[K].content.trim()==="")K++;if(w[K].content[0]!=="{")return null;let Z=0,Q=[],$=K;for(;$<w.length;$++){let H=w[$].content,j=0;for(let Y of H){if(Y==="{")Z++;else if(Y==="}")Z--;if(j++,Z===0)break}if(Q.push(j),Z===0)break}if(Z!==0)return null;let J=$;return{type:Q.map((H,j)=>{let Y=K+j,U=w[Y].content.slice(0,H);return w[Y].content=w[Y].content.slice(H).replace(y,""),j===0?U:w[Y].indent+U}).join(`
|
|
10
|
+
`).slice(1,-1),endIndex:J}}function tw(w){let q=w.content.match(y)?.[0]??"",K=w.content.slice(q.length),Z=0,Q=0;for(let j of K){if(Z===0&&dw.test(j))break;if(j==="[")Z++;if(j==="]")Z--;Q++}let $=Z===0?K.slice(0,Q):"";if(!$)return null;let J=$,z=!1,H;if($.startsWith("[")&&$.endsWith("]")){z=!0;let Y=$.slice(1,-1).split("=");if(J=Y[0].trim(),Y.length>1)H=Y.slice(1).join("=").trim();if(!J)return null}return w.content=K.slice(Q).replace(y,""),{name:J,optional:z,default:H}}function ew(w){let q=w[0],K=q.content.match(cw),Z=K?K[1]:"",Q=K?q.content.slice(K[0].length):q.content,$=Q.trimEnd(),J=w.slice(1).map((V)=>V.separator+V.content),z=($?[$,...J]:J).join(`
|
|
11
|
+
`);q.content=Q,q.tag=Z;let H=nw(w,0),j=H?.type??"",Y=0;if(H){Y=H.endIndex;while(Y<w.length-1&&w[Y].content.trim()==="")Y++}let U=tw(w[Y]),S=Uw(w.slice(H?H.endIndex:0));return{tag:Z,name:U?.name??"",type:j,optional:U?.optional??!1,default:U?.default,description:S,raw:z,lines:w}}function wq(w,q){let K=aw(w);K.forEach(($,J)=>{$.number=J});let Z=rw(K),Q=Z.slice(1).map(ew);return{description:Uw(Z[0]),tags:Q,start:q,lines:K}}function p(w){return sw(w).map(({start:q,lines:K})=>wq(K,q))}var qq=/\s*=\s*/;function Ow(w){let q=w.indexOf("<");if(q===-1||!w.endsWith(">"))return w;let K=w.slice(0,q),Z=w.slice(q+1,-1),Q=ww(Z).map(($)=>$.trim().replace(qq," = ")).join(", ");return`${K}<${Q}>`}var Kq=/^\s*$/,Zq=/;$/,Qq=/^-\s*/;function f(w){if(w===void 0)return;let q=w.replace(Qq,"").trim();return q===""?"":q}function m(w){if(!w||w.length===0)return;return w[0].content}var Xw=new Set(["since","example"]);function $q(w){let q=w.trim();return q===""?!0:q}function Vw(w,q){return $q(`${w??""}${q?` ${q}`:""}`)}function Jq(w){let q=w.trim().replace(Zq,"").trimEnd();if(!q.startsWith("{")||!q.endsWith("}"))return!1;let K=0,Z=null;for(let Q=0;Q<q.length;Q++){let $=q[Q];if(Z!==null){if($==="\\"){Q++;continue}if($===Z)Z=null;continue}if($==='"'||$==="'"||$==="`"){Z=$;continue}if($==="{"||$==="["||$==="(")K++;else if($==="}"||$==="]"||$===")"){if(K--,K===0&&Q<q.length-1)return!1}}return K===0}function kw(w){let q=w;if(!q.startsWith("/*"))q=`/*${q}`;if(!q.endsWith("*/"))q+="*/";return q}function Yq(w){if(w==="*")return"any";return w.trim()}function eq(w){let q=p(kw(w)),{returns:K}=Aw(q);return K?Yq(K.type):void 0}function Aw(w){let q=w[0]?.tags??[],K=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Z,Q=[],$,J,z,H=[],j=[];for(let Y of q)if(Y.tag==="type")Z=Y;else if(Y.tag==="param")Q.push(Y);else if(Y.tag==="returns"||Y.tag==="return")$=Y;else if(Y.tag==="deprecated")z??=Vw(Y.name,Y.description);else if(Xw.has(Y.tag))j.push(Y);else if(Y.tag==="bindable"){if(Y.type)continue;let U=`${Y.name}${Y.description?` ${Y.description}`:""}`.trim();if(U==="readonly"||U==="writable")J??=U}else if(!K.has(Y.tag))H.push(Y);return{type:Z,param:Q,returns:$,binding:J,deprecated:z,additional:H,passthrough:j,description:w[0]?.description}}function zq(w){if(!w||w.length===0)return;let q=w[w.length-1];return q&&typeof q==="object"&&"value"in q?q:void 0}function Hq(w,q,K){if(!q||q.length===0||K===void 0||!w.source)return;for(let Z=q.length-1;Z>=0;Z--){let Q=q[Z];if(!Q||typeof Q!=="object"||!("value"in Q)||!("end"in Q))continue;if(typeof Q.end!=="number")continue;let $=w.source.slice(Q.end,K);if(Kq.test($))return Q}return}function jq(w,q,K){if(!K?.leadingComments)return;let Z=Hq(w,K.leadingComments,K.start);if(!Z)return;return Wq(q,[Z])}function wK(w,q,K){if(!K?.leadingComments)return;return jq(w,q,K)}function Wq(w,q){if(!q)return;let K=zq(q);if(!K)return;let Z=p(kw(K.value)),{type:Q,param:$,returns:J,binding:z,deprecated:H,additional:j,passthrough:Y,description:U}=Aw(Z),S,V,F,E;if(Q)S=w.aliasType(Q.type);if($.length>0)V=$.filter((O)=>!O.name.includes(".")).map((O)=>({name:O.name,type:w.aliasType(O.type),description:f(O.description),optional:O.optional||!1}));if(J)F=w.aliasType(J.type);let _=v(U?.trim());if(_||j.length>0){let O=[];if(_)O.push(_);for(let I of j){let u=`@${I.tag}${I.name?` ${I.name}`:""}${I.description?` ${I.description}`:""}`;O.push(u)}E=O.join(`
|
|
12
|
+
`)}let N=Y.length>0?Y.map((O)=>({name:O.tag,body:O.raw})):void 0;return{type:S,params:V,returnType:F,description:E,binding:z,deprecated:H,tags:N}}function qK(w,q,K=w.source){if(!K)return;for(let{tags:Z,description:Q,lines:$}of p(K)){let J,z,H,j,Y,U,S=[],V=[],F,E,_,N=[],O,I,u=[],c,h=!1,X=!0,g=[],i,d=new Map,qw=new Set,o=new Set;for(let W of Z)if(W.lines.length>0)qw.add(W.lines[0].number);for(let W of $)if(!W.tag&&W.content&&W.content.trim()!=="}")d.set(W.number,W.content);let Gw=(W)=>{if(!W||W.length===0)return;let G=W[0].number,M=[],P=[],L=!1;for(let B=G-1;B>=0;B--){if(qw.has(B))break;let R=d.get(B);if(R)M.unshift(R),P.unshift(B),L=!0;else if(L){let k=$[B];if(!(!k||!k.tag&&(!k.content||k.content.trim()==="")))break}}if(M.length===0)return;for(let B of P)o.add(B);return M.join(`
|
|
13
|
+
`).trim()},Kw=()=>{if(J!==void 0){let W=z&&z!=="object"&&z!=="Object"?z:void 0,G;if(W)G=W;else if(V.length>0)G=e(V,J,!0);else G=z||"";if(U!==void 0){let M;for(let B of Z){let R=B.lines[0]?.number;if(typeof R!=="number")continue;if(R<=U)continue;if(B.tag==="property"||B.tag==="type")continue;M=R;break}let P=[],L=Array.from(d.keys()).sort((B,R)=>B-R);for(let B of L){if(B<=U)continue;if(M!==void 0&&B>=M)continue;if(o.has(B))continue;let k=d.get(B)?.trim();if(k)P.push(k),o.add(B)}if(P.length>0){let B=P.join(`
|
|
14
|
+
`);H=H?`${H}
|
|
15
|
+
${B}`:B}}t(w,{name:J,detail:G,has_argument:!1,description:H,deprecated:j,tags:S.length>0?S:void 0,source:Y}),w.eventDescriptions.set(J,H),w.jsDocEventNames.add(J),w.jsDocEventSources.set(J,Y),V.length=0,J=void 0,z=void 0,H=void 0,j=void 0,Y=void 0,U=void 0,S=[]}},Zw=()=>{if(F!==void 0){let W,G;if(N.length>0)W=e(N,void 0,!0),G=`type ${F} = ${W};`;else if(E)W=E,G=Jq(W)?`interface ${F} ${W}`:`type ${F} = ${W};`;else W="{}",G=`type ${F} = ${W};`;w.typedefs.set(F,{type:W,name:F,description:v(_),ts:G}),N.length=0,F=void 0,E=void 0,_=void 0}},Qw=()=>{if(O!==void 0){let M=`(${u.map(({name:L,type:B,optional:R})=>{return`${L}${R?"?":""}: ${B}`}).join(", ")}) => ${c||"void"}`,P=`type ${O} = ${M};`;w.typedefs.set(O,{type:M,name:O,description:v(I),ts:P}),u.length=0,c=void 0,O=void 0,I=void 0}},Fw=Z.some((W)=>W.tag==="slot"||W.tag==="snippet"),Pw=Z.some((W)=>W.tag==="extends"||W.tag==="extendProps");for(let{tag:W,type:G,name:M,description:P,optional:L,default:B,raw:R,lines:k}of Z){let C=q.aliasType(G),l=Gw(k);switch(W){case"extends":case"extendProps":if(w.extends={interface:M,import:C},X)X=!1;break;case"restProps":{let A=M?P?`${M} ${P}`:M:P,s=f(A)||l;if(!s&&X&&!h&&Q)s=Q,h=!0;if(w.rest_props={type:"Element",name:C,description:s||void 0},X)X=!1;break}case"slot":case"snippet":{let T=f(m(k));if(!T&&X&&!h&&Q)T=Q,h=!0;if(!T&&g.length===0)T=l;if(X)X=!1;Mw(w,{slot_name:M,slot_props:C,slot_description:T||void 0,slot_deprecated:i,slot_tags:g.length>0?[...g]:void 0,source:n(w,k)}),g.length=0,i=void 0;break}case"event":{if(Kw(),J=M,z=C,U=k.length>0?k[0].number:void 0,H=f(m(k))||l,!H&&X&&!h&&Q)H=Q,h=!0;if(Y=n(w,k),X)X=!1;break}case"type":if(J!==void 0)z=C;break;case"param":if(O!==void 0)u.push({name:M,type:C,optional:L||!1});break;case"returns":case"return":if(O!==void 0)c=C;break;case"property":{let A={name:M,type:C,description:f(m(k)),optional:L||!1,default:B};if(J!==void 0)V.push(A);else if(F!==void 0)N.push(A);break}case"typedef":{if(Zw(),F=Ow(M),E=C,_=f(m(k))||l,!_&&X&&!h&&Q)_=Q,h=!0;if(X)X=!1;break}case"callback":{if(Qw(),O=Ow(M),I=f(m(k))||l,!I&&X&&!h&&Q)I=Q,h=!0;if(X)X=!1;break}case"generics":if(w.generics=[M,C],X)X=!1;break;case"template":{let A=M;if(C)A=`${M} extends ${C}`;if(B)A+=` = ${B}`;if(Fw&&!Pw){w.deferredSlotBlockGenerics.push({name:M,constraint:A});break}if(q.accumulateGeneric(M,A),X)X=!1;break}case"deprecated":{let A=Vw(M,P);if(J===void 0)i??=A;else j??=A;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let A={name:W,body:R};if(J!==void 0&&Xw.has(W))S.push(A);else g.push(A)}break}}Kw(),Zw(),Qw()}}
|
|
16
|
+
export{b as u,Bq as v,a as w,$w as x,Mq as y,Jw as z,Uq as A,Cw as B,Oq as C,Iw as D,Vq as E,kq as F,Yw as G,Dw as H,Hw as I,jw as J,x as K,Fq as L,v as M,Lw as N,t as O,bq as P,fw as Q,_q as R,Lq as S,vq as T,Eq as U,D as V,fq as W,ww as X,xq as Y,yq as Z,p as _,dq as $,pq as aa,Mw as ba,Kq as ca,eq as da,Aw as ea,jq as fa,wK as ga,qK as ha};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as d}from"./chunk-
|
|
1
|
+
import{t as d}from"./chunk-t6s3aa0t.js";import{D as a,E as b,F as c}from"./chunk-ck4qbyqp.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-0q7qnmx3.js";export{b as getParsedComponentTypeScriptMetadata,d as default,c as applyResolvedProps,a as PARSED_COMPONENT_TYPE_SCRIPT_METADATA};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{$ as bZ,A as v,B as p,C as XZ,D as TQ,G as EZ,H as yQ,I as hZ,J as h,K as A,L as zQ,M as LQ,N as DZ,O as kZ,P as _Z,Q as UZ,R as qZ,S as YZ,T as jQ,U as WZ,V as KZ,W as SZ,Y as TZ,Z as HZ,_ as MZ,aa as gZ,ba as SQ,ca as jZ,ea as FZ,fa as o,ga as OZ,ha as fZ,v as aQ,w as VQ,x as s,y as PZ,z as iQ}from"./chunk-4ggahk6z.js";import{ja as NZ}from"./chunk-mab8x3d6.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 IQ 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(bQ(Y)){if(!this.visit(Y,Q,X,K))K--}}}else if(bQ(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 bQ(Q){return Q!==null&&typeof Q==="object"&&"type"in Q&&typeof Q.type==="string"}function x(Q,{enter:Z,leave:$}){return new IQ(Z,$).visit(Q,null)}var gQ={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 vZ(Q){return Q in gQ}function fQ(Q){if(vZ(Q))return gQ[Q];return"HTMLElement"}function AQ(){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=vQ(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(yQ," ");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=lQ($),X=NQ(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=uZ(Q,Z,L);if(J)return{value:X,type:void 0,isFunction:!1,defaultValue:K,resolvedType:J};if(Z.funcDecls.has(L)||xZ(Z,L))return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L}};let j=Z.valueImportBindingsByLocalName.get(L);if(j)return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L,importSource:j.source,importedName:j.importedName}}}return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L??yZ(Z,O)}}}else if($.type==="Identifier"){let Y=$;if(G<5){let O=uQ(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?NQ(Z,J):void 0,type:void 0,isFunction:!0,defaultValue:J?vQ(Q,Z,J):void 0,resolvedType:L?.type??dZ(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 uQ(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 xQ(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 yZ(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 uZ(Q,Z,$){let G=Q.resolveLocalVarJSDoc($);if(G?.returnType)return G.returnType;let X=Z.funcDecls.get($)??mQ(Z,$);if(!X)return;let q=sZ(Z,X);if(q)return q;let W=mZ(Z,$);if(W)return W;let K=sQ(X);return K==="any"?void 0:K}function xZ(Q,Z){return mQ(Q,Z)!==void 0}function mQ(Q,Z){let $=uQ(Q,Z);if(!$||typeof $!=="object"||!("type"in $))return;if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")return $;return}function mZ(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 lZ(A(Q,W.start,W.end))}return}function lZ(Q){if(!Q)return;let Z=Q.lastIndexOf("=>");if(Z===-1)return;return Q.slice(Z+2).trim()||void 0}function sZ(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 dZ(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 lQ(Z);return"(...args: any[]) => any"}function lQ(Q){return`(${cZ(Q)}) => ${sQ(Q)}`}function cZ(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 sQ(Q){if(Q.async||Q.generator)return"any";let Z=Q.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=iZ(Z),$.length===0)return"any"}else $=[Z];let G=null;for(let X of $){let q=pZ(X);if(!q)return"any";if(G===null)G=q;else if(G!==q)return"any"}return G??"any"}function iZ(Q){let Z=[];return x(Q,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function pZ(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 dQ(Q){if(v(Q,"$bindable"))return{init:Q.arguments[0],bindable:!0};return{init:Q,bindable:!1}}function oZ(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 NQ(Q,Z){if(Z.generator)return;let $=Z.body;if(!$||typeof $!=="object"||!("type"in $))return;let G=oZ(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 vQ(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=PQ(Q,$);if(W.ok)q.value=W.value}return q}function PQ(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=PQ(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=PQ(Q,X.value);if(!W.ok)return{ok:!1};G[q]=W.value}return{ok:!0,value:G}}return{ok:!1}}var rZ=/[-_.:/\s]+/;function EQ(Q){return`${Q.split(rZ).map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join("")}Context`}function aZ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let X=[];if(!iQ($))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((j)=>{if(s(j))return`${j.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:EQ(G),properties:X,description:void 0}}else if(s($)){let X=$.name,q=Z.findVariableTypeAndDescription(X);if(q)return{key:G,typeName:EQ(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:EQ(G),properties:[{name:X,type:"any",description:void 0,optional:!1}]}}return null}function cQ(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 pQ(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 cQ(G);if(G.type==="Identifier"){if($>=5)return null;let X=xQ(Q,G.name);if(X&&typeof X==="object"&&"type"in X){let q=X;if((q.type==="CallExpression"||q.type==="NewExpression")&&cQ(q)==="")return G.name;return pQ(Q,q,$+1)}return null}return null}function oQ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let X=$,q=X.arguments[0];if(!q)return;let W=pQ(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=aZ(Q,Z,K,W);if(Y&&!Q.contexts.has(W))Q.contexts.set(W,Y)}function nZ({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=nZ({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 tZ(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 rQ(Q,Z){if(Q.rest_props!==void 0)return;let $=tZ(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 DQ(Q,Z){let $=P(Z);if(!$)return;for(let G of $){let X=JQ(Q,G);if(X)Q.reactive_vars.add(X)}}function BQ(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 nQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;let Z=String(Q.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function eZ(Q,Z){let $=Q.scopeDeclarations.get(Z);if(!$)$=new Map,Q.scopeDeclarations.set(Z,$);return $}function Q0(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 hQ(Q,Z,$,G,X){if(!aQ(Z))return;let q=X?.allowRunesProps??!1,W=X?.forceProp??!1,K=Z;for(let Y of K.declarations){if(q&&v(p(Y.init),"$props")){for(let J of Q0(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 Z0(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 $0(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":hQ(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 G0(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":hQ(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")hQ(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 tQ(Q,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,G0(Q,Z,Z.parsed?.instance)}function eQ(Q){return{varScopeStack:[Q.componentScope]}}function QZ(Q,Z,$,G){if(!BQ(G))return;let X=eZ(Z,G),q=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(G.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Z0(G,X);break;case"BlockStatement":$0(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(nQ(G))$.varScopeStack.push(X)}function ZZ(Q,Z){if(nQ(Z))Q.varScopeStack.pop()}var X0=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function U0(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 q0(Q,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(Q))return!0;return!1}function Y0(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":MQ(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 MQ(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)MQ([G],Z);break}}}}function kQ(Q,Z){if(!Q||typeof Q!=="object")return!1;let $=[...Z],G=!1;return x(Q,{enter(X,q){if(G){this.skip();return}if(BQ(X))$.push(Y0(X));if(q&&X.type==="Identifier"&&X0.has(X.name)&&!q.type.startsWith("TS")&&U0(X,q)&&!q0(X.name,$))G=!0,this.skip()},leave(X){if(BQ(X))$.pop()}}),G}function $Z(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 GZ(Q){if(Q.runesOptionOverride!==void 0)return Q.runesOptionOverride?"runes":"legacy";let Z=Q.parsed;if(!Z)return"legacy";let $=new Set;MQ($Z(Z.module),$);let G=new Set;return MQ($Z(Z.instance),G),kQ(Z.module,[$])||kQ(Z.instance,[$,G])||kQ(Z.html,[$,G])?"runes":"legacy"}var W0=/[A-Za-z_$][\w$]*/g;function K0(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 H0(Q,Z){if(Z.size===0)return Q;return Q.replace(W0,($)=>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 j=A(Z,L+1,J)?.trim();if(!j)continue;q.set(O,{type:j,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=YZ($.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=K0(Z,Y,$);for(let[J,j]of O)q.set(J,L.size===0?j:{...j,type:H0(j.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 zZ(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=jQ(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=jQ(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(!v(p(W.init),"$props"))continue;let K=W.id?.typeAnnotation?void 0:XZ(W.init),Y=W.id?.typeAnnotation?.typeAnnotation??K,O=W.id?.typeAnnotation?jQ(Z,W.id.typeAnnotation):WZ(Z,K),L=UQ(Q,Z,Y,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([T,f])=>[T,f.node]))),J=new Set,j=new Set;if(KZ(Z,Y,J,j),HZ(Z,J,j),W.start!==void 0){let T={canonicalType:O,props:L,referencedImportedTypes:J,referencedLocalTypes:j};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(W.start,T),O)Z.typedRunesPropsDeclarations.push(T)}}}}function LZ(Q,Z,$){for(let G of $.declarations){if(!v(p(G.init),"$props"))continue;if(G.id.type==="Identifier"){Z.wholePropsLocals.add(G.id.name),Z.restPropLocals.add(G.id.name);let W=UZ(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 B=W.value;Y=B.left.name,O=B.right}if(!Y)continue;if(Q.trackPropLocalName(K,Y),K==="children")Z.snippetPropLocals.add(Y);let L=OZ(Z,Q,W)??(q===1?X:void 0),J=qZ(Z,G.start,K),{init:j,bindable:T}=dQ(O),f=j==null?{isFunction:!1}:l(Q,Z,j),{value:e,type:QQ,isFunction:qQ,defaultValue:CQ}=f,RQ=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:wQ,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:RQ,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:wQ,typeSource:YQ,value:e,defaultValue:CQ,params:KQ,returnType:U,isFunction:H,isFunctionDeclaration:!1,isRequired:j==null&&J?.optional!==!0,constant:!1,reactive:T,source:h(Z,W)})}}}function VZ(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 JZ=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function FQ(Q){if(!Q||typeof Q!=="object")return;x(Q,{enter(Z){if(!JZ.has(Z.type))return;let $=Z.expression;while($&&JZ.has($.type))$=$.expression;if($)this.replace($)}})}function _Q(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 CZ(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 RZ(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==="'"){$=CZ(Q,$,X);continue}else if(X==="`"){$=RZ(Q,$);continue}$++}return $}function O0(Q,Z){let $=[],G=Q.length,X=0;while(X<G){let q=Q[X];if(q==='"'||q==="'"){X=CZ(Q,X,q);continue}if(q==="`"){X=RZ(Q,X);continue}if(q==="/"&&Q[X+1]==="/"){let W=X+2;while(W<G&&Q[W]!==`
|
|
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 BZ(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 z0(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)BZ(G.declaration,G.start,Z);else BZ(G,G.start,Z)}return Z}function L0(Q,Z,$){let G;for(let X of Q){if(X.end>Z)break;if(!X.isJsDoc)continue;if(!jZ.test($.slice(X.end,Z)))continue;G=X}return G}function wZ(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(...O0(Q.source.slice(K.start,K.end),K.start)),q.push(...z0(K.body))}X.sort((W,K)=>W.end-K.end);for(let W of q){let K=L0(X,W.start,Q.source);if(!K)continue;let Y=MZ(K.text,{spacing:"preserve"}),{type:O,description:L}=FZ(Y);if(!O)continue;$.set(W.name,{type:Z.aliasType(O.type),description:L||O.description})}return $}function IZ(Q){if(Q==="var")return"let";if(Q==="using"||Q==="await using")return"const";return Q}var V0=null,AZ=/^@component/,J0=/\r/g,B0=/^\{\s*\}$/;class _{ctx=AQ();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=wZ(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=AQ()}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,legacy:X}=NZ($);if(zZ(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=GZ(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):$;if(fZ(this.ctx,this,W),this.ctx.parsed?.module)x(this.ctx.parsed?.module,{enter:(U)=>{if(U.type==="ImportDeclaration")_Q(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,B,F=!1,z,V,C,w=!1,M,D,R;if(U.declaration.type==="FunctionDeclaration"){let N=U.declaration;if(!N.id?.name)return;H=N.id.name,B="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,B=IZ(N.kind);let E=HQ==null?{isFunction:!1}:l(this,this.ctx,HQ);if({value:z,type:V,isFunction:w,defaultValue:M}=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:y,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:B,description:I,deprecated:S?.deprecated,tags:S?.tags,type:y,typeSource:d,value:z,defaultValue:M,params:b,returnType:g,isFunction:r,isFunctionDeclaration:F,isRequired:!1,constant:B==="const",reactive:!1,source:h(this.ctx,U)})}}});let K,Y=new Set,O=new Set,L=[],J={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};tQ(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let j=eQ(this.ctx);if(x(J,{enter:(U,H,B)=>{QZ(this,this.ctx,j,U);let F=this.ctx.scopeDeclarations.get(U);if(F)this.ctx.activeScopes.push(F);if(U.type==="AssignmentExpression")DQ(this.ctx,U.left);if(U.type==="UpdateExpression")DQ(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)K=H.id.name}if(V==="$host"){if(H&&typeof H==="object"&&"id"in H&&H.id&&typeof H.id==="object"&&"name"in H.id)Y.add(H.id.name)}if(V==="setContext")oQ(this.ctx,this,U,H??void 0);if(V)L.push({name:V,arguments:z.arguments,source:h(this.ctx,z)});if(PZ(z.callee)&&s(z.callee.property)&&z.callee.property.name==="dispatchEvent"&&(v(z.callee.object,"$host")||s(z.callee.object)&&Y.has(z.callee.object.name))){let C=_Z(this.ctx,z);if(C)O.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??""))rQ(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")_Q(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)=>v(p(z.init),"$props")))LZ(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((u)=>u.id&&typeof u.id==="object"&&("type"in u.id)&&u.id.type==="Identifier"&&u.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,M,D,R=!1,S=!1,y,d,I,b;if(U.declaration.type==="FunctionDeclaration"){let E=U.declaration;if(!E.id?.name)return;z??=E.id.name,y=E.id.name,V="function",w=void 0,M="() => 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 u=i.name;y=u,z??=u,D=this.getExplicitPropType(u)}else return;V=IZ(E.kind),S=V==="let"&&t==null;let $Q=t==null?{isFunction:!1}:l(this,this.ctx,t);if({value:w,type:M,isFunction:R,defaultValue:d}=$Q,I=M,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:M,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,...y!==void 0&&y!==z?{localName:y}:{},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(AZ.test(V))this.ctx.componentComment=V.replace(AZ,"").replace(J0,""),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((M)=>M.name==="name")?.value?.[0]?.data,C=(z.attributes||[]).filter((M)=>M.name!=="name").reduce((M,D)=>{let R={value:void 0,replace:!1},S=D.value;if(S===void 0)return M;if(S[0]){let y=S[0],{type:d,expression:I,raw:b,start:g,end:r}=y;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=EZ(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)M[D.name]=R;return M},{}),w=z.children?.map(({start:M,end:D})=>{if(M===void 0||D===void 0)return"";return A(this.ctx,M,D)??""}).join("").trim();SQ(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=gZ(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=bZ(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,M=w===void 0?V0:w;if(C!==void 0)SQ(this.ctx,{slot_name:w,slot_props:C,source:h(this.ctx,U)});if(C!==void 0||this.ctx.slots.has(M))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 M=this.ctx.events.get(z.name),D=this.ctx.eventDescriptions.get(z.name),R=M?.deprecated;if(!M)this.ctx.events.set(z.name,{type:"forwarded",name:z.name,element:w,description:D,deprecated:R,source:h(this.ctx,U)});else if(M.type==="forwarded"&&D&&!M.description)this.ctx.events.set(z.name,{...M,description:D,deprecated:M.deprecated??R,source:M.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();ZZ(j,U)}}),K!==void 0){for(let U of L)if(U.name===K){let H=U.arguments[0],B=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(B!=null)kZ(this.ctx,{name:String(B),detail:z==null?"":DZ(z),has_argument:Boolean(F),source:U.source})}}let T=new Set(O);if(K!==void 0){for(let U of L)if(U.name===K){let H=U.arguments[0],B=H&&typeof H==="object"&&"value"in H?H.value:void 0;if(B!=null)T.add(String(B))}}this.ctx.forwardedEvents.forEach((U,H)=>{let B=this.ctx.events.get(H);if(B&&B.type==="dispatched"&&!T.has(H)){let F=this.ctx.eventDescriptions.get(H),z={type:"forwarded",name:H,element:U,description:F,deprecated:B.deprecated,tags:B.tags,source:B.source};if(B.detail!==void 0&&B.detail!=="undefined")z.detail=B.detail;this.ctx.events.set(H,z)}}),VZ(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((B)=>fQ(B)).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 B0.test(U.slot_props)?{...U,slot_props:"Record<string, never>"}:U;let H=U.slot_props,B=[];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";B.push(`${z}: ${H[z].value}`)}let F=B.length===0?"Record<string, never>":B.length===1?`{ ${B[0]} }`:`{
|
|
3
|
-
${
|
|
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-ck4qbyqp.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]!==`
|
|
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
|
+
${M.join(`;
|
|
4
4
|
`)};
|
|
5
|
-
}`;return{...U,slot_props:F}}).sort((U,H)=>{let
|
|
6
|
-
`);for(let{name:H,constraint:
|
|
5
|
+
}`;return{...U,slot_props:F}}).sort((U,H)=>{let M=U.name??"",F=H.name??"";if(M<F)return-1;if(M>F)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let U=[...e.map((H)=>H.type??""),...QQ.map((H)=>H.slot_props??"")].join(`
|
|
6
|
+
`);for(let{name:H,constraint:M}of this.ctx.deferredSlotBlockGenerics){let F=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${F}\\b`).test(U))continue;this.accumulateGeneric(H,M)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)m(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=bZ(this.ctx.scriptGenericsAttribute.value)}let qQ=_.mapToArray(this.ctx.moduleExports),RQ=_.mapToArray(this.ctx.events).map((U)=>{switch(U.type){case"forwarded":return{...U,element:U.element.name};case"dispatched":return U;default:return U}}).sort((U,H)=>{let M=U.name.localeCompare(H.name);if(M!==0)return M;let F=U.type.localeCompare(H.type);if(F!==0)return F;if(U.type==="forwarded"&&H.type==="forwarded"){let z=U.element.localeCompare(H.element);if(z!==0)return z}return(U.detail??"").localeCompare(H.detail??"")}),wQ=_.mapToArray(this.ctx.typedefs),IQ=_.mapToArray(this.ctx.contexts),YQ={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((U)=>U.location==="props").map((U)=>[U.propName,U])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((U)=>U.location==="moduleExports").map((U)=>[U.propName,U]))};for(let U of e)if(U.typeSource==="unknown"){let H=YQ.props.get(U.name);if(H)U.type="any";let M=H?H.importSource?`Prop "${U.name}" default calls "${H.calleeName}()" imported from "${H.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${U.name}" default calls "${H.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${U.name}" type could not be inferred; falling back to "${U.type??"any"}".`;m(this.ctx,"prop-unknown-type",U.name,M,U.source)}for(let U of qQ)if(U.typeSource==="unknown"&&YQ.moduleExports.has(U.name))U.type="any";for(let U of this.ctx.jsDocEventNames){if(T.has(U))continue;if(this.ctx.forwardedEvents.has(U))continue;if(this.ctx.props.has(`on${U}`))continue;m(this.ctx,"event-no-source",U,`@event "${U}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(U))}let WQ={source:DZ(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:e,moduleExports:qQ,slots:QQ,events:RQ,typedefs:wQ,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:IQ,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},KQ=TZ(this.ctx);if(KQ)WQ[bQ]=KQ;return WQ}}
|
|
7
7
|
export{_ as t};
|
package/lib/cli-entry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./chunk-
|
|
1
|
+
import{s as e}from"./chunk-44fwt51g.js";import"./chunk-ck4qbyqp.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";export{e as cli};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K,b as j,c as C,d as x,e as k,f as q,g as A,h as D,i as H,j as W,k as v,l as S,m as J,n as I,o as L,p as M,q as N,r as P,s as Q}from"./chunk-
|
|
1
|
+
import{a as K,b as j,c as C,d as x,e as k,f as q,g as A,h as D,i as H,j as W,k as v,l as S,m as J,n as I,o as L,p as M,q as N,r as P,s as Q}from"./chunk-44fwt51g.js";import{t as E}from"./chunk-t6s3aa0t.js";import"./chunk-ck4qbyqp.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";async function z(t){if(t&&"input"in t)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:R,...b}=t??{},m=await W(),f=D(R??m.entry);if(f===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let o=v(m,b,{entry:f}),p=await J(f,o.glob===!0,S(o)),y;if(o.check)y=await x(p.components,C(o),{entryExports:p.entryExports});if(await P(p,o,f),!o.dryRun)p.cache?.save();let{diagnostics:r}=p;if((o.reportDiagnostics||o.strict)&&r.length>0)console.error(A(r));if(o.strict&&r.length>0)process.exitCode=1;return{diagnostics:r,check:y}}export{z as sveld,x as runCheck,I as registerWriter,M as listWriters,L as getWriter,q as formatCheckReportJson,k as formatCheckReport,j as diffApiDocuments,H as defineConfig,N as default,Q as cli,K as buildComponentApiDocument,E as ComponentParser};
|
package/package.json
CHANGED
package/lib/chunk-4ggahk6z.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function C(w){return typeof w==="object"&&w!==null}function Sw(w){return C(w)&&w.type==="VariableDeclaration"&&Array.isArray(w.declarations)}function W0(w){return C(w)&&w.type==="Literal"}function h0(w){return C(w)&&w.type==="Identifier"&&typeof w.name==="string"}function fw(w){return C(w)&&w.type==="MemberExpression"}function F0(w){return C(w)&&w.type==="ObjectExpression"&&Array.isArray(w.properties)}function i0(w){return C(w)&&w.type==="CallExpression"}function Dw(w,O){if(!i0(w))return!1;return!!w.callee&&C(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===O}function p0(w){if(C(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"expression"in w)return p0(w.expression);return w}function Ew(w){if(C(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"typeAnnotation"in w)return w.typeAnnotation;return}function o0(w){return C(w)&&w.type==="NewExpression"}function K0(w,O){if(!o0(w))return!1;return!!w.callee&&C(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===O}var n0=Symbol("sveld.parsedComponentTypeScriptMetadata");function vw(w){return w[n0]}function Nw(w,O){if(O.length===0)return;let j=new Set(w.props.map((W)=>W.name));for(let W of O){if(j.has(W.name))continue;j.add(W.name),w.props.push({name:W.name,kind:"let",constant:!1,type:W.type,typeSource:"typescript",...W.description?{description:W.description}:{},isFunction:W.type.includes("=>"),isFunctionDeclaration:!1,isRequired:W.isRequired,reactive:!1})}}var r0=/\w/;function c0(w,O){let j=w.trim();if(!j.startsWith("{")||!j.endsWith("}"))return;let W=j.slice(1,-1),K=[],Z=0,$="";for(let Q of W)if(Q==="{"||Q==="<"||Q==="("||Q==="[")Z++,$+=Q;else if(Q==="}"||Q===">"||Q===")"||Q==="]")Z--,$+=Q;else if((Q===";"||Q===",")&&Z===0)K.push($.trim()),$="";else $+=Q;if($.trim())K.push($.trim());for(let Q of K){if(!Q.startsWith(O))continue;let J=Q.slice(O.length);if(J.length>0&&r0.test(J[0]))continue;let M=J.trimStart();if(M.startsWith("?"))M=M.slice(1).trimStart();if(M.startsWith(":"))return M.slice(1).trim()}return}function C0(w,O,j){let W=j;if(W.computed||W.object?.type!=="Identifier"||W.property?.type!=="Identifier")return;let K=W.object.name,Z=W.property.name;if(!K||!Z)return;if(w.wholePropsLocals.has(K))return O.getPropTypeByLocalOrPublic(Z);let $=O.getPropTypeByLocalOrPublic(K)??O.findVariableTypeAndDescription(K)?.type;if(!$)return;return c0($,Z)}var s0=/[\r\n]+/g;function a0(w){if(w.sourceLineStartOffsetsCache)return w.sourceLineStartOffsetsCache;let O=[0];if(w.source){for(let j=0;j<w.source.length;j++)if(w.source[j]===`
|
|
2
|
-
`)O.push(j+1)}return w.sourceLineStartOffsetsCache=O,O}function I0(w,O){if(!w.source||O<0||O>w.source.length)return;let j=a0(w),W=0,K=j.length-1;while(W<=K){let Z=Math.floor((W+K)/2),$=j[Z],Q=j[Z+1]??Number.POSITIVE_INFINITY;if(O<$)K=Z-1;else if(O>=Q)W=Z+1;else return{line:Z+1,column:O-$}}return}function b0(w,O,j){if(O===void 0||j===void 0||j<O)return;let W=I0(w,O),K=I0(w,j);if(!W||!K)return;return{start:W,end:K}}function L0(w,O){if(!O||typeof O!=="object")return;let j="start"in O&&typeof O.start==="number"?O.start:void 0,W="end"in O&&typeof O.end==="number"?O.end:void 0;return b0(w,j,W)}function Z0(w,O,j,W){if(!j||j.length===0||W===void 0)return;let K=[...j];while(K.length>1){let X=K[K.length-1];if(X.tokens.tag||!X.source.trim().endsWith("*/"))break;K.pop()}let Z=W;for(let X=0;X<K[0].number-1;X++)Z+=O[X]?.source.length??0,Z+=1;let $=K[0],Q=$.source.indexOf($.tokens.tag??""),J=Z+Math.max(Q,0),M=W,Y=K[K.length-1],z=Y.number;for(let X=0;X<z-1;X++)M+=O[X]?.source.length??0,M+=1;return M+=Y.source.length,b0(w,J,M)}function l(w,O,j){return w.source?.slice(O,j)}function yw(w,O){if(!O||typeof O!=="object")return;let j="start"in O&&typeof O.start==="number"?O.start:void 0,W="end"in O&&typeof O.end==="number"?O.end:void 0;if(j===void 0||W===void 0)return;return l(w,j,W)?.replace(s0," ")}function N(w){return w===void 0||w===""?void 0:w}function t0(w){return typeof w==="string"?JSON.stringify(w):String(w)}function $0(w,{name:O,detail:j,has_argument:W,description:K,deprecated:Z,tags:$,source:Q}){if(O===void 0)return;let J=!W&&!j?"null":N(j),M=K,Y=w.events.get(O);if(Y?.type==="forwarded")w.events.set(O,{type:"dispatched",name:O,detail:J,description:M||Y.description,deprecated:Z??Y.deprecated,tags:$??Y.tags,source:Q||Y.source});else if(Y){let z=Y.tags??$;w.events.set(O,{...Y,detail:Y.detail===void 0?J:Y.detail,description:Y.description||M,deprecated:Y.deprecated??Z,tags:z,source:Q||Y.source})}else w.events.set(O,{type:"dispatched",name:O,detail:J,description:M,deprecated:Z,tags:$,source:Q})}function iw(w,O){let j=O.arguments[0],W=K0(j,"CustomEvent");if(!W&&!K0(j,"Event"))return;let K=j.arguments[0],Z=W0(K)?K.value:void 0;if(Z==null)return;let $=W?j.arguments[1]:void 0,Q=!1,J;if(F0($)){let M=$.properties.find((Y)=>Y.type==="Property"&&h0(Y.key)&&Y.key.name==="detail");if(M?.type==="Property")Q=!0,J=W0(M.value)?M.value.value:void 0}return $0(w,{name:String(Z),detail:J==null?"":t0(J),has_argument:Q,source:L0(w,O)}),String(Z)}function Q0(w,O,j=!1){if(w.length===0)return"null";let W=w.map(({name:K,type:Z,description:$,optional:Q,default:J})=>{let M=Q?"?":"",Y=$||"";if(J&&Y)Y=`${Y} @default ${J}`;else if(J)Y=`@default ${J}`;if(Y){if(j)return`/** ${Y} */
|
|
3
|
-
${K}${M}: ${Z};`;return`/** ${Y} */ ${K}${M}: ${Z};`}return`${K}${M}: ${Z};`}).join(j?`
|
|
4
|
-
`:" ");return j?`{
|
|
5
|
-
${W}
|
|
6
|
-
}`:`{ ${W} }`}var e0=/[A-Za-z_$][\w$]*/g;function ww(w,O){if(!O)return!1;let j=new Set(O[0].split(",").map((W)=>W.trim()));for(let[W]of w.matchAll(e0))if(j.has(W))return!0;return!1}function Ow(w,O){if(O===void 0)return;return w.runesPropsDeclarationMetadataByDeclaratorStart.get(O)}function nw(w,O,j){return Ow(w,O)?.props.get(j)}function rw(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"right"in w&&w.right&&typeof w.right==="object"&&"name"in w.right&&typeof w.right.name==="string")return w.right.name;return}function _0(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"left"in w&&w.left&&typeof w.left==="object")return _0(w.left);return}function cw(w,O){let j=O?.start,W=O?.end;if(j===void 0||W===void 0)return;return l(w,j+1,W)?.trim()}function sw(w,O){let j=O?.start,W=O?.end;if(j===void 0||W===void 0)return;return l(w,j,W)?.trim()}function D(w,O,j,W,K=new Set){if(!O?.type)return;switch(O.type){case"TSInterfaceDeclaration":D(w,{type:"TSTypeLiteral",members:O.body?.body},j,W,K);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":D(w,O.typeAnnotation,j,W,K);return;case"TSIntersectionType":case"TSUnionType":for(let Z of O.types??[])D(w,Z,j,W,K);return;case"TSTypeLiteral":for(let Z of O.members??[]){if(Z?.type!=="TSPropertySignature")continue;D(w,Z.typeAnnotation?.typeAnnotation,j,W,K)}return;case"TSTypeReference":{let Z=_0(O.typeName);if(Z){if(w.typeImportBindingsByLocalName.has(Z))j.add(Z);let $=w.localTypeDeclarationsByName.get(Z);if($&&!K.has(Z))W.add(Z),K.add(Z),D(w,$.node,j,W,K),K.delete(Z)}if("typeParameters"in O&&O.typeParameters&&typeof O.typeParameters==="object"){let $=O.typeParameters;for(let Q of $.params??[])D(w,Q,j,W,K)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let Z of Object.values(O)){if(!Z||typeof Z!=="object")continue;if(Array.isArray(Z)){for(let $ of Z){if(!$||typeof $!=="object"||!("type"in $))continue;D(w,$,j,W,K)}continue}if("type"in Z)D(w,Z,j,W,K)}}function jw(w,O){let j=new Map;for(let W of Array.from(O).sort()){let K=w.typeImportBindingsByLocalName.get(W);if(!K)continue;let Z=j.get(K.source)??{default:[],named:[],namespace:[]};if(K.specifierType==="default")Z.default.push(K.localName);else if(K.specifierType==="namespace")Z.namespace.push(K.localName);else Z.named.push({imported:K.importedName,local:K.localName});j.set(K.source,Z)}return Array.from(j.entries()).sort(([W],[K])=>W.localeCompare(K)).map(([W,K])=>{if(K.namespace.length>0)return K.namespace.map((J)=>`import type * as ${J} from "${W}";`).join(`
|
|
7
|
-
`);let Z=K.named.map(({imported:J,local:M})=>{if(!J||J===M)return M;return`${J} as ${M}`}),$=K.default[0],Q=Z.length>0?`{ ${Z.join(", ")} }`:"";if($&&Q)return`import type ${$}, ${Q} from "${W}";`;if($)return`import type ${$} from "${W}";`;return`import type ${Q} from "${W}";`})}function aw(w){let O=w.pendingCallDefaultCandidates.length>0?w.pendingCallDefaultCandidates.slice():void 0;if(w.typedRunesPropsDeclarations.length!==1)return O?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:O}:void 0;let[j]=w.typedRunesPropsDeclarations;if(!j.canonicalType)return O?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:O}:void 0;let W=Array.from(j.referencedLocalTypes).map((K)=>w.localTypeDeclarationsByName.get(K)).filter((K)=>K!==void 0).sort((K,Z)=>K.start-Z.start).map((K)=>K.code);return{canonicalPropsType:j.canonicalType,canonicalPropNames:Array.from(j.props.keys()).sort(),localTypeDeclarations:W,typeImportStatements:jw(w,j.referencedImportedTypes),referencesComponentGenerics:ww(j.canonicalType,w.generics),...O?{pendingCallDefaultCandidates:O}:{}}}var Ww=/^[A-Za-z_$][\w$]*/,Kw=/[A-Za-z_$][\w$]*/g,S0=/^(?:const|in|out)\s+/;function Y0(w){let O=[],j=0,W=0;for(let K=0;K<w.length;K++){let Z=w[K];if(Z==="<"||Z==="("||Z==="["||Z==="{")j++;else if(Z===">"||Z===")"||Z==="]"||Z==="}")j=Math.max(j-1,0);else if(Z===","&&j===0)O.push(w.slice(W,K)),W=K+1}return O.push(w.slice(W)),O}function wO(w){let O=Y0(w).map((W)=>W.trim()).filter((W)=>W.length>0);if(O.length===0)return null;return[O.map((W)=>{let K=W;while(S0.test(K))K=K.replace(S0,"");return K.match(Ww)?.[0]??W}).join(", "),O.join(", ")]}function OO(w,O,j){let W=w.scriptGenericsAttribute?.value;if(!W)return;for(let[K]of W.matchAll(Kw)){if(w.typeImportBindingsByLocalName.has(K))O.add(K);if(j.has(K))continue;let Z=w.localTypeDeclarationsByName.get(K);if(!Z)continue;j.add(K),D(w,Z.node,O,j)}}var Zw=null;function $w(w,O,j){let W={value:void 0,replace:!1};if(!j||typeof j!=="object"||!("type"in j))return W;if(j.type==="Identifier")W.value=j.name,W.replace=!0;else if(j.type==="Literal")W.value=String(j.value);else if(j.type==="MemberExpression")W.value=C0(w,O,j);else if((j.type==="ObjectExpression"||j.type==="TemplateLiteral")&&"start"in j&&"end"in j&&typeof j.start==="number"&&typeof j.end==="number")W.value=l(w,j.start,j.end);return W}function $O(w,O,j){let W={};for(let K of j.properties){if(K.type!=="Property"||K.computed)continue;let Z=O.getPropertyName(K.key);if(!Z)continue;W[Z]=$w(w,O,K.value)}return W}function Qw(w,O){if(!O||typeof O!=="object"||!("type"in O))return null;if(O.type==="Identifier"){let Z=O,$=w.propLocalToPublicName.get(Z.name);if(!$)return null;return{publicName:$,trackingName:Z.name}}if(O.type!=="MemberExpression")return null;let j=O,W=j.object&&typeof j.object==="object"&&"type"in j.object&&j.object.type==="Identifier"?j.object.name:void 0;if(!W||!w.wholePropsLocals.has(W))return null;let K;if(!j.computed&&j.property&&typeof j.property==="object"&&"type"in j.property){if(j.property.type==="Identifier")K=j.property.name;else if(j.property.type==="Literal"&&j.property.value!=null)K=String(j.property.value)}else if(j.computed&&j.property&&typeof j.property==="object"&&"type"in j.property&&j.property.type==="Literal"&&"value"in j.property&&j.property.value!=null)K=String(j.property.value);if(!K)return null;return{publicName:K,trackingName:K}}function QO(w,O){let j=O;if(j&&typeof j==="object"&&"type"in j&&j.type==="ChainExpression")j=j.expression;if(!j||typeof j!=="object"||!("type"in j)||j.type!=="CallExpression")return null;let W=j;if(!W.callee||typeof W.callee!=="object"||!("type"in W.callee))return null;let K=Qw(w,W.callee);if(!K)return null;return{...K,arguments:W.arguments}}function f0(w,{slot_name:O,slot_props:j,slot_fallback:W,slot_description:K,slot_deprecated:Z,slot_tags:$,source:Q}){let J=O===void 0||O==="",M=J?Zw:O??"",Y=N(W),z=j===void 0||j===""?void 0:j,X=K?.trim()||void 0;if(w.slots.has(M)){let B=w.slots.get(M);if(B)w.slots.set(M,{...B,default:B.default??J,fallback:Y,slot_props:B.slot_props===void 0?z:B.slot_props,description:B.description||X,deprecated:B.deprecated??Z,tags:B.tags||$,source:Q||B.source})}else w.slots.set(M,{name:M,default:J,fallback:Y,slot_props:j,description:X,deprecated:Z,tags:$,source:Q})}var I;(function(w){w.start="/**",w.nostart="/***",w.delim="*",w.end="*/"})(I||(I={}));function M0(w){return/^\s+$/.test(w)}function D0(w){let O=w.match(/\r+$/);return O==null?["",w]:[w.slice(-O[0].length),w.slice(0,-O[0].length)]}function k(w){let O=w.match(/^\s+/);return O==null?["",w]:[w.slice(0,O[0].length),w.slice(O[0].length)]}function E0(w){return w.split(/\n/)}function k0(w={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},w)}function J0(w={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},w)}var Yw=/^@[^\s/]+(?=\s|$)/;function z0({fence:w="```"}={}){let O=Mw(w),j=(W,K)=>O(W)?!K:K;return function(K){let Z=[[]],$=!1;for(let Q of K){if(Yw.test(Q.tokens.description)&&!$)Z.push([Q]);else Z[Z.length-1].push(Q);$=j(Q.tokens.description,$)}return Z}}function Mw(w){if(typeof w==="string")return(O)=>O.split(w).length%2===0;return w}function H0({startLine:w=0,markers:O=I}={}){let j=null,W=w;return function(Z){let $=Z,Q=J0();if([Q.lineEnd,$]=D0($),[Q.start,$]=k($),j===null&&$.startsWith(O.start)&&!$.startsWith(O.nostart))j=[],Q.delimiter=$.slice(0,O.start.length),$=$.slice(O.start.length),[Q.postDelimiter,$]=k($);if(j===null)return W++,null;let J=$.trimRight().endsWith(O.end);if(Q.delimiter===""&&$.startsWith(O.delim)&&!$.startsWith(O.end))Q.delimiter=O.delim,$=$.slice(O.delim.length),[Q.postDelimiter,$]=k($);if(J){let M=$.trimRight();Q.end=$.slice(M.length-O.end.length),$=M.slice(0,-O.end.length)}if(Q.description=$,j.push({number:W,source:Z,tokens:Q}),W++,J){let M=j.slice();return j=null,M}return null}}function X0({tokenizers:w}){return function(j){var W;let K=k0({source:j});for(let Z of w)if(K=Z(K),(W=K.problems[K.problems.length-1])===null||W===void 0?void 0:W.critical)break;return K}}function n(){return(w)=>{let{tokens:O}=w.source[0],j=O.description.match(/\s*(@(\S+))(\s*)/);if(j===null)return w.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:w.source[0].number,critical:!0}),w;if(j[1].includes("/"))return w;return O.tag=j[1],O.postTag=j[3],O.description=O.description.slice(j[0].length),w.tag=j[2],w}}function r(w="compact"){let O=zw(w);return(j)=>{let W=0,K=[],Z=!1,$=!0;for(let{tokens:M}of j.source.values()){let Y="";if(!Z&&M.description.trim())Z=!0;else if(!Z)continue;if($&&M.description[0]!=="{")return j;$=!1;for(let z of M.description){if(z==="{")W++;if(z==="}")W--;if(Y+=z,W===0)break}if(K.push([M,Y]),W===0)break}if(!Z)return j;if(W!==0)return j.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:j.source[0].number,critical:!0}),j;let Q=[],J=K[0][0].postDelimiter.length;for(let[M,[Y,z]]of K.entries()){if(Y.type=z,M>0)Y.type=Y.postDelimiter.slice(J)+z,Y.postDelimiter=Y.postDelimiter.slice(0,J);[Y.postType,Y.description]=k(Y.description.slice(z.length)),Q.push(Y.type)}return Q[0]=Q[0].slice(1),Q[Q.length-1]=Q[Q.length-1].slice(0,-1),j.type=O(Q),j}}var Jw=(w)=>w.trim();function zw(w){if(w==="compact")return(O)=>O.map(Jw).join("");else if(w==="preserve")return(O)=>O.join(`
|
|
8
|
-
`);else return w}var v0=(w)=>w&&w.startsWith('"')&&w.endsWith('"');function c(){let w=(O,{tokens:j},W)=>j.type===""?O:W;return(O)=>{let j=O.source.reduce(w,0),W;if(O.type)do{if({tokens:W}=O.source[j],W.description.trim())break;j++}while(O.source[j]);else({tokens:W}=O.source[j]);let K=W.description.trimStart(),Z=K.split('"');if(Z.length>1&&Z[0]===""&&Z.length%2===1)return O.name=Z[1],W.name=`"${Z[1]}"`,[W.postName,W.description]=k(K.slice(W.name.length)),O;let $=0,Q="",J=!1,M;for(let z of K){if($===0&&M0(z))break;if(z==="[")$++;if(z==="]")$--;Q+=z}if($!==0)return O.problems.push({code:"spec:name:unpaired-brackets",message:"unpaired brackets",line:O.source[0].number,critical:!0}),O;let Y=Q;if(Q[0]==="["&&Q[Q.length-1]==="]"){J=!0,Q=Q.slice(1,-1);let z=Q.split("=");if(Q=z[0].trim(),z[1]!==void 0)M=z.slice(1).join("=").trim();if(Q==="")return O.problems.push({code:"spec:name:empty-name",message:"empty name",line:O.source[0].number,critical:!0}),O;if(M==="")return O.problems.push({code:"spec:name:empty-default",message:"empty default value",line:O.source[0].number,critical:!0}),O;if(!v0(M)&&/=(?!>)/.test(M))return O.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:O.source[0].number,critical:!0}),O}if(!J){let z=Q.search(/=(?!>)/);if(z!==-1){let X=Q.slice(0,z).trim(),B=Q.slice(z+1).trim();if(X==="")return O.problems.push({code:"spec:name:empty-name",message:"empty name",line:O.source[0].number,critical:!0}),O;if(B==="")return O.problems.push({code:"spec:name:empty-default",message:"empty default value",line:O.source[0].number,critical:!0}),O;if(/^[\p{ID_Start}$_\.][\p{ID_Continue}$_\u200c\u200d\.]*=/u.test(Q)){if(!v0(B)&&/=(?!>)/.test(B))return O.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:O.source[0].number,critical:!0}),O;Q=X,M=B}}}if(O.optional=J,O.name=Q,W.name=Y,M!==void 0)O.default=M;return[W.postName,W.description]=k(K.slice(W.name.length)),O}}function s(w="compact",O=I){let j=q0(w);return(W)=>{return W.description=j(W.source,O),W}}function q0(w){if(w==="compact")return Hw;if(w==="preserve")return Uw;return w}function Hw(w,O=I){return w.map(({tokens:{description:j}})=>j.trim()).filter((j)=>j!=="").join(" ")}var Xw=(w,{tokens:O},j)=>O.type===""?w:j,qw=({tokens:w})=>(w.delimiter===""?w.start:w.postDelimiter.slice(1))+w.description;function Uw(w,O=I){if(w.length===0)return"";if(w[0].tokens.description===""&&w[0].tokens.delimiter===O.start)w=w.slice(1);let j=w[w.length-1];if(j!==void 0&&j.tokens.description===""&&j.tokens.end.endsWith(O.end))w=w.slice(0,-1);return w=w.slice(w.reduce(Xw,0)),w.map(qw).join(`
|
|
9
|
-
`)}function U0({startLine:w=0,fence:O="```",spacing:j="compact",markers:W=I,tokenizers:K=[n(),r(j),c(),s(j)]}={}){if(w<0||w%1>0)throw Error("Invalid startLine");let Z=H0({startLine:w,markers:W}),$=z0({fence:O}),Q=X0({tokenizers:K}),J=q0(j);return function(M){let Y=[];for(let z of E0(M)){let X=Z(z);if(X===null)continue;let B=$(X),b=B.slice(1).map(Q);Y.push({description:J(B[0],W),tags:b,source:X,problems:b.reduce((L,_)=>L.concat(_.problems),[])})}return Y}}function Bw(w){return w.start+w.delimiter+w.postDelimiter+w.tag+w.postTag+w.type+w.postType+w.name+w.postName+w.description+w.end+w.lineEnd}function B0(){return(w)=>w.source.map(({tokens:O})=>Bw(O)).join(`
|
|
10
|
-
`)}var Gw={line:0,start:0,delimiter:0,postDelimiter:0,tag:0,postTag:0,name:0,postName:0,type:0,postType:0,description:0,end:0,lineEnd:0};var iO=Object.keys(Gw);function a(w,O={}){return U0(O)(w)}var Jj=B0();var Vw=/\s*=\s*/;function N0(w){let O=w.indexOf("<");if(O===-1||!w.endsWith(">"))return w;let j=w.slice(0,O),W=w.slice(O+1,-1),K=Y0(W).map((Z)=>Z.trim().replace(Vw," = ")).join(", ");return`${j}<${K}>`}var Aw=/^\s*$/,Rw=/;$/,Pw=/^-\s*/;function T(w){if(w===void 0)return;let O=w.replace(Pw,"").trim();return O===""?"":O}function i(w){if(!w||w.length===0)return;return w[0].tokens.description}var x0=new Set(["since","example"]);function T0(w){if(!w||w.length===0)return"";let O=[];for(let j of w){let W=j.tokens;if((W.end??"").trim()==="*/")break;if(W.tag){let K=`${W.name??""}${W.postName??""}${W.description??""}`.trimEnd();if(K)O.push(K)}else O.push(`${W.postDelimiter??""}${W.description??""}`)}return O.join(`
|
|
11
|
-
`)}function hw(w){let O=w.trim();return O===""?!0:O}function y0(w,O){return hw(`${w??""}${O?` ${O}`:""}`)}function Fw(w){let O=w.trim().replace(Rw,"").trimEnd();if(!O.startsWith("{")||!O.endsWith("}"))return!1;let j=0,W=null;for(let K=0;K<O.length;K++){let Z=O[K];if(W!==null){if(Z==="\\"){K++;continue}if(Z===W)W=null;continue}if(Z==='"'||Z==="'"||Z==="`"){W=Z;continue}if(Z==="{"||Z==="["||Z==="(")j++;else if(Z==="}"||Z==="]"||Z===")"){if(j--,j===0&&K<O.length-1)return!1}}return j===0}function u0(w){let O=w;if(!O.startsWith("/*"))O=`/*${O}`;if(!O.endsWith("*/"))O+="*/";return O}function Cw(w){if(w==="*")return"any";return w.trim()}function Rj(w){let O=a(u0(w),{spacing:"preserve"}),{returns:j}=g0(O);return j?Cw(j.type):void 0}function g0(w){let O=w[0]?.tags??[],j=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),W,K=[],Z,$,Q,J=[],M=[];for(let Y of O)if(Y.tag==="type")W=Y;else if(Y.tag==="param")K.push(Y);else if(Y.tag==="returns"||Y.tag==="return")Z=Y;else if(Y.tag==="deprecated")Q??=y0(Y.name,Y.description);else if(x0.has(Y.tag))M.push(Y);else if(Y.tag==="bindable"){if(Y.type)continue;let z=`${Y.name}${Y.description?` ${Y.description}`:""}`.trim();if(z==="readonly"||z==="writable")$??=z}else if(!j.has(Y.tag))J.push(Y);return{type:W,param:K,returns:Z,binding:$,deprecated:Q,additional:J,passthrough:M,description:w[0]?.description}}function Iw(w){if(!w||w.length===0)return;let O=w[w.length-1];return O&&typeof O==="object"&&"value"in O?O:void 0}function bw(w,O,j){if(!O||O.length===0||j===void 0||!w.source)return;for(let W=O.length-1;W>=0;W--){let K=O[W];if(!K||typeof K!=="object"||!("value"in K)||!("end"in K))continue;if(typeof K.end!=="number")continue;let Z=w.source.slice(K.end,j);if(Aw.test(Z))return K}return}function Lw(w,O,j){if(!j?.leadingComments)return;let W=bw(w,j.leadingComments,j.start);if(!W)return;return _w(O,[W])}function Pj(w,O,j){if(!j?.leadingComments)return;return Lw(w,O,j)}function _w(w,O){if(!O)return;let j=Iw(O);if(!j)return;let W=a(u0(j.value),{spacing:"preserve"}),{type:K,param:Z,returns:$,binding:Q,deprecated:J,additional:M,passthrough:Y,description:z}=g0(W),X,B,b,L;if(K)X=w.aliasType(K.type);if(Z.length>0)B=Z.filter((G)=>!G.name.includes(".")).map((G)=>({name:G.name,type:w.aliasType(G.type),description:T(G.description),optional:G.optional||!1}));if($)b=w.aliasType($.type);let _=N(z?.trim());if(_||M.length>0){let G=[];if(_)G.push(_);for(let S of M){let x=`@${S.tag}${S.name?` ${S.name}`:""}${S.description?` ${S.description}`:""}`;G.push(x)}L=G.join(`
|
|
12
|
-
`)}let y=Y.length>0?Y.map((G)=>({name:G.tag,body:T0(G.source)})):void 0;return{type:X,params:B,returnType:b,description:L,binding:Q,deprecated:J,tags:y}}function hj(w,O,j=w.source){if(!j)return;let W=0;for(let{tags:K,description:Z,source:$}of a(j,{spacing:"preserve"})){let Q=$.map((H)=>H.source).join(`
|
|
13
|
-
`),J=j.indexOf(Q,W),M=J===-1?void 0:J;if(J!==-1)W=J+Q.length;let Y,z,X,B,b,L,_=[],y=[],G,S,x,p=[],v,d,t=[],e,f=!1,A=!0,m=[],w0,o=new Map,V0=new Set,O0=new Set;for(let H of K)if(H.source&&H.source.length>0)V0.add(H.source[0].number);for(let H of $)if(!H.tokens.tag&&H.tokens.description&&H.tokens.description.trim()!=="}")o.set(H.number,H.tokens.description);let l0=(H)=>{if(!H||H.length===0)return;let h=H[0].number,U=[],F=[],E=!1;for(let q=h-1;q>=1;q--){if(V0.has(q))break;let V=o.get(q);if(V)U.unshift(V),F.unshift(q),E=!0;else if(E){let R=$.find((P)=>P.number===q);if(!(!R||!R.tokens.tag&&(!R.tokens.description||R.tokens.description.trim()==="")))break}}if(U.length===0)return;for(let q of F)O0.add(q);return U.join(`
|
|
14
|
-
`).trim()},A0=()=>{if(Y!==void 0){let H=z&&z!=="object"&&z!=="Object"?z:void 0,h;if(H)h=H;else if(y.length>0)h=Q0(y,Y,!0);else h=z||"";if(L!==void 0){let U;for(let q of K){let V=q.source?.[0]?.number;if(typeof V!=="number")continue;if(V<=L)continue;if(q.tag==="property"||q.tag==="type")continue;U=V;break}let F=[],E=Array.from(o.keys()).sort((q,V)=>q-V);for(let q of E){if(q<=L)continue;if(U!==void 0&&q>=U)continue;if(O0.has(q))continue;let R=o.get(q)?.trim();if(R)F.push(R),O0.add(q)}if(F.length>0){let q=F.join(`
|
|
15
|
-
`);X=X?`${X}
|
|
16
|
-
${q}`:q}}$0(w,{name:Y,detail:h,has_argument:!1,description:X,deprecated:B,tags:_.length>0?_:void 0,source:b}),w.eventDescriptions.set(Y,X),w.jsDocEventNames.add(Y),w.jsDocEventSources.set(Y,b),y.length=0,Y=void 0,z=void 0,X=void 0,B=void 0,b=void 0,L=void 0,_=[]}},R0=()=>{if(G!==void 0){let H,h;if(p.length>0)H=Q0(p,void 0,!0),h=`type ${G} = ${H};`;else if(S)H=S,h=Fw(H)?`interface ${G} ${H}`:`type ${G} = ${H};`;else H="{}",h=`type ${G} = ${H};`;w.typedefs.set(G,{type:H,name:G,description:N(x),ts:h}),p.length=0,G=void 0,S=void 0,x=void 0}},P0=()=>{if(v!==void 0){let U=`(${t.map(({name:E,type:q,optional:V})=>{return`${E}${V?"?":""}: ${q}`}).join(", ")}) => ${e||"void"}`,F=`type ${v} = ${U};`;w.typedefs.set(v,{type:U,name:v,description:N(d),ts:F}),t.length=0,e=void 0,v=void 0,d=void 0}},d0=K.some((H)=>H.tag==="slot"||H.tag==="snippet"),m0=K.some((H)=>H.tag==="extends"||H.tag==="extendProps");for(let{tag:H,type:h,name:U,description:F,optional:E,default:q,source:V}of K){let R=O.aliasType(h),u=l0(V);switch(H){case"extends":case"extendProps":if(w.extends={interface:U,import:R},A)A=!1;break;case"restProps":{let P=U?F?`${U} ${F}`:U:F,j0=T(P)||u;if(!j0&&A&&!f&&Z)j0=Z,f=!0;if(w.rest_props={type:"Element",name:R,description:j0||void 0},A)A=!1;break}case"slot":case"snippet":{let g=T(i(V));if(!g&&A&&!f&&Z)g=Z,f=!0;if(!g&&m.length===0)g=u;if(A)A=!1;f0(w,{slot_name:U,slot_props:R,slot_description:g||void 0,slot_deprecated:w0,slot_tags:m.length>0?[...m]:void 0,source:Z0(w,$,V,M)}),m.length=0,w0=void 0;break}case"event":{if(A0(),Y=U,z=R,L=V&&V.length>0?V[0].number:void 0,X=T(i(V))||u,!X&&A&&!f&&Z)X=Z,f=!0;if(b=Z0(w,$,V,M),A)A=!1;break}case"type":if(Y!==void 0)z=R;break;case"param":if(v!==void 0)t.push({name:U,type:R,optional:E||!1});break;case"returns":case"return":if(v!==void 0)e=R;break;case"property":{let P={name:U,type:R,description:T(i(V)),optional:E||!1,default:q};if(Y!==void 0)y.push(P);else if(G!==void 0)p.push(P);break}case"typedef":{if(R0(),G=N0(U),S=R,x=T(i(V))||u,!x&&A&&!f&&Z)x=Z,f=!0;if(A)A=!1;break}case"callback":{if(P0(),v=N0(U),d=T(i(V))||u,!d&&A&&!f&&Z)d=Z,f=!0;if(A)A=!1;break}case"generics":if(w.generics=[U,R],A)A=!1;break;case"template":{let P=U;if(R)P=`${U} extends ${R}`;if(q)P+=` = ${q}`;if(d0&&!m0){w.deferredSlotBlockGenerics.push({name:U,constraint:P});break}if(O.accumulateGeneric(U,P),A)A=!1;break}case"deprecated":{let P=y0(U,F);if(Y===void 0)w0??=P;else B??=P;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let P={name:H,body:T0(V)};if(Y!==void 0&&x0.has(H))_.push(P);else m.push(P)}break}}A0(),R0(),P0()}}
|
|
17
|
-
export{C as u,Sw as v,W0 as w,h0 as x,fw as y,F0 as z,Dw as A,p0 as B,Ew as C,n0 as D,vw as E,Nw as F,C0 as G,s0 as H,b0 as I,L0 as J,l as K,yw as L,N as M,t0 as N,$0 as O,iw as P,Ow as Q,nw as R,rw as S,cw as T,sw as U,D as V,aw as W,Y0 as X,wO as Y,OO as Z,a as _,$O as $,QO as aa,f0 as ba,Aw as ca,Rj as da,g0 as ea,Lw as fa,Pj as ga,hj as ha};
|