sveld 0.38.9 → 0.38.10
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/browser.js +1 -1
- package/{chunk-xmk8z1r7.js → chunk-3aykpznf.js} +30 -30
- package/chunk-dmh6cpfa.js +1 -0
- package/chunk-q988tzf8.js +191 -0
- package/chunk-sjga1h52.js +5 -0
- package/cli-entry.js +3 -3
- package/index.d.ts +9 -4
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-1azsj0zd.js +0 -13
- package/chunk-hkvtnaw2.js +0 -189
- package/chunk-tm3wwspf.js +0 -5
- package/chunk-xzarv1ey.js +0 -1
package/browser.js
CHANGED
|
@@ -55,7 +55,7 @@ ${" ".repeat(r+2+op(s.slice(0,t)).length)}^`}).join(`
|
|
|
55
55
|
`).length===e.lines.length}function rr(e,t){if(t<=0)return e;return e.split(`
|
|
56
56
|
`).slice(0,-t).join(`
|
|
57
57
|
`).trimEnd()}var dE=new Set(["abstract","access","alias","alpha","arg","argument","async","augments","author","beta","borrows","const","constructs","copyright","defaultValue","description","emits","experimental","exports","external","fires","function","global","import","inner","instance","kind","lends","license","link","listens","member","name","override","package","private","prop","protected","public","readonly","remarks","requires","satisfies","sealed","static","summary","throws","todo","tutorial","typeParam","version","virtual","yields"]),fE=[...Zn,...Mr,"type","param","returns","typedef","property","callback","template","generics","slot","snippet","event","restProps","extends","extendProps","deprecated","ignore","internal","sveld-ignore","csspart","cssprop"],hE=/;$/;function mE(e){let t=e.trim().replace(hE,"").trimEnd();if(!t.startsWith("{")||!t.endsWith("}"))return!1;return We(t,0)===t.length-1}var yE=/[\w$]+/g,gE=new Set(["property","param","returns","return"]);function xE(e,t,n){let i=[e[t].type];for(let s=t+1;gE.has(e[s]?.tag);s++)i.push(e[s].type);let r=new Set(i.join(" ").match(yE));return n.some(({name:s})=>r.has(s))}function EE(e){let t=e.trim();return!t||t==="object"||t==="Object"}function uu(e,t){if(t.usedGenericsTag&&t.usedTemplateTag&&!t.warnedMixedGenericsTags){t.warnedMixedGenericsTags=!0;let n=e.componentFilePath?` in ${e.componentFilePath}`:"";console.warn(`Warning: Both @generics and @template tags are used to declare component generics${n}; their declarations are combined in the order encountered.`)}}function du(e,t,n,i){if(t.seenGenericNames.has(n))D(e,"generics-conflict",n,`Duplicate generic name "${n}".`,i);else t.seenGenericNames.add(n)}function fu(e,t,n){if(e.generics){let r=F(e.generics[0],",").map((s)=>s.trim()).indexOf(t.trim());if(r!==-1){let s=F(e.generics[1],",").map((a)=>a.trim());s[r]=n,e.generics=[e.generics[0],s.join(", ")];return}}fi(e,t,n)}function hu(e,{name:t,description:n,tags:i,internal:r,source:s},a,o){if(e.typedefs.has(t))D(e,"typedef-duplicate",t,`Duplicate typedef/callback name "${t}"; the later declaration overwrites the earlier one.`,s);e.typedefs.set(t,{type:a,name:t,description:n||void 0,ts:o,tags:i.length>0?i:void 0,...r?{internal:!0}:{},source:s})}function vE(e,t,n,i,r){let s=t.findIndex((a)=>a.name===n.name);if(s===-1)t.push(n);else{let a=i?` of "${i}"`:"";D(e,"property-duplicate",n.name,`Duplicate property "${n.name}"${a}; the later declaration overwrites the earlier one.`,r),t[s]=n}}class mu{tags;lines;commentDescription;commentDescriptionUsed=!1;isFirstTag=!0;event;typedef;callback;typeDeclaration;attachTrailingTag;pendingTags=[];pendingDeprecated;pendingInternal=!1;pendingTypeParameters=[];lineDescriptions=new Map;tagLineNumbers=new Set;consumedDescriptionLines=new Set;indentedContinuationLines=new Set;trimBodyAbove;trimThisBody;hasSlotOrSnippetTag;hasExtendsTag;ctx;generics;documentsFunction;constructor(e,t,n,i){this.ctx=e,this.generics=t,this.documentsFunction=i;let{tags:r,lines:s}=n;this.tags=r,this.lines=s,this.commentDescription=n.description,this.hasSlotOrSnippetTag=r.some((l)=>l.tag==="slot"||l.tag==="snippet"),this.hasExtendsTag=r.some((l)=>l.tag==="extends"||l.tag==="extendProps");for(let l of r)if(l.lines.length>0)this.tagLineNumbers.add(l.lines[0].number);for(let l of s)if(l.continuesType)this.tagLineNumbers.add(l.number);let a=!1,o=!1;for(let l of s){if(!l.tag&&!l.continuesType&&l.content&&(o||l.content.trim()!=="}"))this.lineDescriptions.set(l.number,l.content);if(l.tag!==void 0||l.continuesType)a=!0;else if(!l.content.trim());else if(a&&(l.indent||o))this.indentedContinuationLines.add(l.number);else a=!1;if(Qt(l.content))o=!o}}orCommentDescription(e){if(e||!this.isFirstTag||this.commentDescriptionUsed||!this.commentDescription)return e;return this.commentDescriptionUsed=!0,this.commentDescription}typeDeclarationName(e){if(this.pendingTypeParameters.length===0)return pE(e);let t=`${e}<${this.pendingTypeParameters.join(", ")}>`;return this.pendingTypeParameters.length=0,t}joinBlockLines(e,t){let n=t?t.text.split(`
|
|
58
|
-
`):[],i=t?.line;for(let r of e){if(i!==void 0&&r-i>1){let a=i+1;while(a<r&&cu(this.lines[a]))a++;if(a===r)for(let o=i+1;o<r;o++)n.push("")}let s=this.lines[r];n.push(s.indent+s.content),i=r}return Qn(n)}getPrecedingDescription(e){if(e.length===0)return;let t=e[0].number,n=[],i=!1;for(let r=t-1;r>=0;r--){if(this.tagLineNumbers.has(r)||this.indentedContinuationLines.has(r)||this.consumedDescriptionLines.has(r))break;if(this.lineDescriptions.has(r))n.unshift(r),i=!0;else if(i&&!cu(this.lines[r]))break}if(n.length===0)return;for(let r of n)this.consumedDescriptionLines.add(r);return this.trimBodyAbove?.(n[0]),this.joinBlockLines(n)}claimBodyLines(e,t){if(!uE(e)){for(let i=1;i<e.lines.length;i++)this.consumedDescriptionLines.add(e.lines[i].number);return}let n=e.lines[e.lines.length-1].number;this.trimThisBody=(i)=>t(n-i+1)}getTagDescription(e,t,n=!1){let i=ir(e),r=t!==void 0&&cE.has(t.tag)&&!ir(t.lines),s=n&&(t===void 0||!co.has(t.tag)),a=[];for(let o=1;o<e.length;o++){let l=e[o];if((r||s)&&!this.indentedContinuationLines.has(l.number))continue;if(!this.lineDescriptions.get(l.number)?.trim()||this.consumedDescriptionLines.has(l.number))continue;a.push(l.number),this.consumedDescriptionLines.add(l.number)}if(a.length===0)return i;return this.joinBlockLines(a,{text:i??"",line:e[Rr(e)].number})}flagDescriptionAfterEvent(e,t,n,i){let{event:r}=this;if(r===void 0||r.description)return;if(r.tagLine!==void 0&&this.indentedContinuationLines.has(r.tagLine+1))return;if(i?.tag!=="event"&&!co.has(i?.tag??""))return;if(ir(n))return;let s=t?`@${e} "${t}"`:`@${e}`;D(this.ctx,"event-description-ambiguous",r.name,`Text after @event "${r.name}" was used as the description of ${s}. Move it above the tag it describes, indent it as a continuation line, or give each event its own comment block.`,ke(this.ctx,n))}takePrecedingDescription(e){let{tag:t,name:n,lines:i}=this.tags[e],r=this.getPrecedingDescription(i);if(r)this.flagDescriptionAfterEvent(t,n,i,this.tags[e-1]);return r}finalizeEvent(){let{ctx:e,event:t}=this;if(t===void 0)return;this.event=void 0;let i=(t.type&&t.type!=="object"&&t.type!=="Object"?t.type:void 0)??(t.properties.length>0?mn(t.properties,!0):t.type||""),{tagLine:r}=t;if(r!==void 0){let p=this.tags.find((u)=>{let f=u.lines[0]?.number;return f!==void 0&&f>r&&!co.has(u.tag)})?.lines[0].number,c=Array.from(this.lineDescriptions.keys()).sort((u,f)=>u-f).filter((u)=>u>r&&(p===void 0||u<p)&&!this.consumedDescriptionLines.has(u)&&this.lineDescriptions.get(u)?.trim());for(let u of c)this.consumedDescriptionLines.add(u);if(c.length>0)t.description=this.joinBlockLines(c,t.description?{text:t.description,line:r}:void 0)}let{name:s,description:a,source:o}=t,l=i===""&&(!e.events.has(s)||e.untypedJsDocEventNames.has(s));if(Ke(e,{name:s,detail:i,has_argument:!1,description:a,deprecated:t.deprecated,tags:t.tags.length>0?t.tags:void 0,internal:t.internal||void 0,source:o}),l)e.untypedJsDocEventNames.add(s);e.eventDescriptions.set(s,a),e.jsDocEventNames.add(s),e.jsDocEventSources.set(s,o),ct(e,"event-no-source",s,t.ignores)}finalizeTypedef(){let{ctx:e,typedef:t}=this;if(t===void 0)return;this.typedef=void 0;let{properties:n}=t,i=n.length>0,r=i?mn(n,!0):t.type||"{}",s=!i&&t.type&&mE(r)?`interface ${t.name} ${r}`:`type ${t.name} = ${r};`,a=i?n.filter(({name:o})=>!o.includes(".")&&!o.startsWith("[")).map(({name:o,type:l,optional:p,description:c})=>({name:o,type:l,optional:p===!0,...c?{description:c}:{}})):Re(r,{skipIndexSignatures:!0});if(a)e.typedefMembersByName.set(t.name,a);hu(e,t,r,s)}finalizeCallback(){let{callback:e}=this;if(e===void 0)return;this.callback=void 0;let t=`(${we(e.params)}) => ${e.returnType||"void"}`;hu(this.ctx,e,t,`type ${e.name} = ${t};`)}openTypeDeclaration(e){let{name:t,lines:n}=this.tags[e],i={name:this.typeDeclarationName(t),source:ke(this.ctx,n),description:this.orCommentDescription(this.getTagDescription(n,this.tags[e+1])||this.takePrecedingDescription(e)),tags:this.pendingTags.splice(0),internal:this.pendingInternal},{tags:r}=i;if(this.pendingDeprecated!==void 0)r.push({name:"deprecated",body:this.pendingDeprecated===!0?"":this.pendingDeprecated}),this.pendingDeprecated=void 0;return this.pendingInternal=!1,this.attachTrailingTag=(s)=>r.push(s),this.isFirstTag=!1,i}readExtends(e,t){let{name:n,lines:i}=this.tags[e];if(this.ctx.extends!==void 0)D(this.ctx,"extend-props-duplicate",n,`A second @extends/@extendProps tag ("${n}") overwrote the first ("${this.ctx.extends.interface}"); only one is used.`,ke(this.ctx,i));this.ctx.extends={interface:n,import:lE.test(t)?JSON.stringify(t):t},this.isFirstTag=!1}readRestProps(e,t){let{name:n,description:i}=this.tags[e],r=n?i?`${n} ${i}`:n:i,s=Dt(r),a=this.orCommentDescription(s||this.takePrecedingDescription(e)),o={type:"Element",name:t,description:a||void 0};if(this.ctx.rest_props=o,s)this.claimBodyLines(this.tags[e],(l)=>{o.description=Dt(rr(r,l))||void 0});this.isFirstTag=!1}readSlot(e,t){let{tag:n,name:i,lines:r}=this.tags[e],s=i==="-"||n==="snippet"&&i==="children"?void 0:i,a=this.orCommentDescription(this.getTagDescription(r,this.tags[e+1]));if(!a&&this.pendingTags.length===0)a=this.takePrecedingDescription(e);this.isFirstTag=!1;let o=t||"Record<string, never>",l=ke(this.ctx,r);if(!t)D(this.ctx,"slot-missing-type",s||"default",`@${n}${s?` "${s}"`:""} is missing a required {Type} annotation; falling back to "${o}".`,l);let p=this.pendingTags.splice(0),c=Xe(s);this.ctx.jsDocSlots.set(c,{tag:n,source:l}),En(this.ctx,{slot_name:s,slot_props:o,slot_description:a||void 0,slot_deprecated:this.pendingDeprecated,slot_tags:p.length>0?p:void 0,slot_internal:this.pendingInternal||void 0,source:l}),this.pendingDeprecated=void 0,this.pendingInternal=!1,this.typeDeclaration=void 0,this.attachTrailingTag=(u)=>{let f=this.ctx.slots.get(c);if(f)f.tags=[...f.tags??[],u]}}readEvent(e,t){let{name:n,lines:i}=this.tags[e],r=ir(i)||this.takePrecedingDescription(e);this.finalizeEvent();let s=this.pendingTags.splice(0);this.event={name:n,type:t,tagLine:i.length>0?i[0].number:void 0,description:this.orCommentDescription(r),source:ke(this.ctx,i),tags:s,internal:this.pendingInternal,deprecated:this.pendingDeprecated,ignores:[],properties:[]},this.pendingInternal=!1,this.pendingDeprecated=void 0,this.typeDeclaration=void 0,this.attachTrailingTag=(a)=>s.push(a),this.isFirstTag=!1}readProperty(e,t){let{name:n,optional:i,default:r,lines:s}=this.tags[e],a=this.getTagDescription(s,this.tags[e+1],this.event!==void 0),o=this.event??(this.typedef&&EE(this.typedef.type)?this.typedef:void 0);if(o===void 0)return;vE(this.ctx,o.properties,{name:n,type:t,description:a,optional:i||!1,default:r},o.name,ke(this.ctx,s))}readTypedef(e,t){this.finalizeTypedef(),this.typedef={...this.openTypeDeclaration(e),type:t,properties:[]},this.typeDeclaration=this.typedef}readCallback(e){this.finalizeCallback(),this.callback={...this.openTypeDeclaration(e),params:[],returnType:void 0},this.typeDeclaration=this.callback}readGenerics(e,t){let{name:n,lines:i}=this.tags[e],r=ke(this.ctx,i);for(let s of F(n,","))du(this.ctx,this.generics,s.trim(),r);this.generics.usedGenericsTag=!0,uu(this.ctx,this.generics),fu(this.ctx,n,t||n),this.isFirstTag=!1}readTemplate(e,t){let{tags:n}=this,i=Br(n[e],t),r=e+1;while(n[r]?.tag==="template")r++;let s=n[r];if((s?.tag==="typedef"||s?.tag==="callback")&&!s.name.includes("<")&&xE(n,r,i)){this.pendingTypeParameters.push(...i.map(({constraint:o})=>o));return}if(this.hasSlotOrSnippetTag&&!this.hasExtendsTag){this.ctx.deferredSlotBlockGenerics.push(...i);return}if(this.documentsFunction)return;let a=ke(this.ctx,n[e].lines);for(let o of i)du(this.ctx,this.generics,o.name,a),fu(this.ctx,o.name,o.constraint);this.generics.usedTemplateTag=!0,uu(this.ctx,this.generics),this.isFirstTag=!1}readDeprecated(e){let{text:t}=this.tags[e],{event:n}=this;if(!n&&this.typeDeclaration){let r={name:"deprecated",body:t};this.typeDeclaration.tags.push(r),this.claimBodyLines(this.tags[e],(s)=>{r.body=rr(t,s)});return}if((n?n.deprecated:this.pendingDeprecated)!==void 0)return;let i=(r)=>{if(n)n.deprecated=r;else this.pendingDeprecated=r};i(ei(t)),this.claimBodyLines(this.tags[e],(r)=>{i(ei(rr(t,r)))})}readPassthrough(e){let{tag:t,text:n,lines:i}=this.tags[e],r={name:t,body:n};if(this.claimBodyLines(this.tags[e],(s)=>{r.body=rr(n,s)}),!Zn.has(t)&&!Mr.has(t)){let s=dE.has(t)?void 0:lu(t,fE,t.length<=4?1:2);D(this.ctx,"jsdoc-unknown-tag",t,s?`Unknown JSDoc tag "@${t}"; did you mean "@${s}"? Passed through unchanged.`:`Unknown JSDoc tag "@${t}"; passed through unchanged. If this is a typo, fix the tag name.`,ke(this.ctx,i))}if(this.attachTrailingTag)this.attachTrailingTag(r);else this.pendingTags.push(r)}read(){let{tags:e}=this;for(let i=0;i<e.length;i++){let{tag:r,type:s,name:a,optional:o}=e[i],l=Ce(s);switch(this.trimBodyAbove=this.trimThisBody,this.trimThisBody=void 0,r){case"extends":case"extendProps":this.readExtends(i,l);break;case"restProps":this.readRestProps(i,l);break;case"slot":case"snippet":this.readSlot(i,l);break;case"csspart":{let p=this.getTagDescription(e[i].lines,e[i+1]);this.ctx.cssParts.push({name:a,...p?{description:p}:{}});break}case"cssprop":case"cssproperty":{let p=this.getTagDescription(e[i].lines,e[i+1]),c=e[i].default;this.ctx.cssProperties.push({name:a,...l?{type:l}:{},...c===void 0?{}:{default:c},...p?{description:p}:{}});break}case"event":this.readEvent(i,l);break;case"type":if(this.event)this.event.type=l;break;case"param":this.callback?.params.push({name:a,type:l,optional:o||!1});break;case"returns":case"return":if(this.callback)this.callback.returnType=l;break;case"property":this.readProperty(i,l);break;case"typedef":this.readTypedef(i,l);break;case"callback":this.readCallback(i);break;case"generics":this.readGenerics(i,l);break;case"template":this.readTemplate(i,l);break;case"deprecated":this.readDeprecated(i);break;case"ignore":case"internal":if(this.event)this.event.internal=!0;else if(this.typeDeclaration)this.typeDeclaration.internal=!0;else this.pendingInternal=!0;break;case"sveld-ignore":this.event?.ignores.push(a);break;case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:this.readPassthrough(i);break}if(pu.has(r))this.finalizeEvent()}this.finalizeEvent(),this.finalizeTypedef(),this.finalizeCallback();let t=[...this.pendingTags,...this.pendingDeprecated===void 0?[]:[{name:"deprecated"}],...this.pendingInternal?[{name:"internal"}]:[]];if(t.length===0)return;if(!e.some((i)=>i.tag==="event"||pu.has(i.tag)))return;for(let i of t)D(this.ctx,"jsdoc-tag-dropped",i.name,`@${i.name} could not attach to a @slot/@snippet/@event/@typedef/@callback tag in the same comment block and was dropped.`)}}function yu(e,t=e.source){if(!t)return;let n={usedGenericsTag:!1,usedTemplateTag:!1,warnedMixedGenericsTags:!1,seenGenericNames:new Set},i=t.includes("@template")?ea(e):new Set;e.functionDocCommentStarts=i;let r=Zt(t);for(let s of r)e.jsDocBlocksByStart.set(s.start,s);for(let s of r)new mu(e,n,s,i.has(s.start)).read()}var xu=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]),bE=Array.from(xu);function gu(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function SE(e){if(e.includes("\\u"))return!0;for(let t of bE){let n=e.indexOf(t);while(n!==-1){if(!gu(e.charCodeAt(n-1))&&!gu(e.charCodeAt(n+t.length)))return!0;n=e.indexOf(t,n+1)}}return!1}function TE(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function CE(e){let t=new Set;switch(e.type){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":if(e.type!=="ArrowFunctionExpression"&&e.id)t.add(e.id.name);for(let n of e.params)Y(n,t);break;case"BlockStatement":sr(e.body,t);break;case"CatchClause":Y(e.param,t);break;case"EachBlock":if(Y(e.context,t),e.index)t.add(e.index);break;case"AwaitBlock":Y(e.value,t),Y(e.error,t);break}return t}function sr(e,t){for(let n of e??[])switch(n.type){case"ImportDeclaration":for(let i of n.specifiers)t.add(i.local.name);break;case"VariableDeclaration":for(let i of n.declarations)Y(i.id,t);break;case"FunctionDeclaration":case"ClassDeclaration":if(n.id?.name)t.add(n.id.name);break;case"ExportNamedDeclaration":if(n.declaration)sr([n.declaration],t);break}}function uo(e,t){if(!e)return!1;let n=[...t],i=!1;return z(e,{enter(r,s){if(oi(r.type))return ie;if(Mt(r))n.push(CE(r));if(r.type==="Identifier"&&xu.has(r.name)&&Sr(r,s)&&!TE(r.name,n))return i=!0,Ut},leave(r){if(Mt(r))n.pop()}}),i}function Eu(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";if(e.source!==void 0&&!SE(e.source))return"legacy";let n=new Set;sr(t.module?.content.body,n);let i=new Set;return sr(t.instance?.content.body,i),uo(t.module,[n])||uo(t.instance,[n,i])||uo(t.fragment,[n,i])?"runes":"legacy"}var kE=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function wE(e){if(e.type!=="TSAsExpression"&&e.type!=="TSTypeAssertion")return!1;let t="typeAnnotation"in e?e.typeAnnotation:void 0;return t?.type==="TSTypeReference"&&t.typeName.type==="Identifier"&&t.typeName.name==="const"}function or(e,t){if(!e)return;z(e,{enter(n){if(!kE.has(n.type)||!("expression"in n)||!n.expression)return;let{expression:i}=n;if(typeof i!=="object")return i;let r=t.typeAssertions.get(n);if(t.constAssertions.has(n)||r===void 0&&wE(n))t.constAssertions.add(i);else if(r!==void 0)t.typeAssertions.set(i,r);else if((n.type==="TSAsExpression"||n.type==="TSTypeAssertion")&&"typeAnnotation"in n)t.typeAssertions.set(i,n.typeAnnotation);return i}})}var AE=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;function PE(e){if(!e.includes("@ts-"))return e;let t=e.charCodeAt(0)===65279?1:0,{instance:n,module:i}=Bi(e),r=[n,i].flatMap((o)=>o?[o.content]:[]).sort((o,l)=>o.start-l.start),s="",a=0;for(let{start:o,end:l}of r)s+=e.slice(a,o+t),s+=e.slice(o+t,l+t).replace(AE,""),a=l+t;return s+e.slice(a)}function vu(e,t,n){e.componentFilePath=n;let i=PE(t);e.source=i;let r=au(i);if(il(e,r),e.parsed=r,e.scriptLanguage==="ts")or(r.module,e.typeCasts),or(r.instance,e.typeCasts),or(r.fragment,e.typeCasts);e.syntaxMode=Eu(e);let s=r.css,a=s?i.slice(0,s.start)+" ".repeat(s.end-s.start)+i.slice(s.end):i;Hr(e,r.module),Hr(e,r.instance),yu(e,a)}class fo{ctx=wr();cleanup(){this.ctx=wr()}parseSvelteComponent(e,t){let{component:n,pending:i}=this.parse(e,t);if(i)n[_e]={...n[_e]??{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[]},...i};return n}parse(e,t){this.cleanup();let n=this.ctx;vu(n,e,t.filePath),ou(n);let i=cl(n);return Qc(n,i)}}var _E=/\.$/,ho="resolving it needs file access (generateBundle or the CLI)";function DE(e,t={}){let n=e[_e];if(!n)return e;let{pendingCallDefaultCandidates:i,pendingConstDefaultCandidates:r,pendingContextKeyCandidates:s,pendingDispatchEscapeCandidates:a,deferredEventNoSourceDiagnostics:o,untypedJsDocEventNames:l,...p}=n,c=(i??[]).filter((b)=>b.importSource!==void 0);if(c.length===0&&!r&&!s&&!a&&!o)return e;let u=e.filePath,f=t.filePath??(typeof u==="string"?u:""),h=[],m=(b,X,he,Pe)=>{h.push(Xn({component:f,kind:"cross-file-unresolved",name:b,message:X,...he?{source:he}:{},...Pe?{ignored:Pe}:{}}))},E=(b,X)=>(b==="props"?e.props:e.moduleExports).find((he)=>he.name===X)?.source,y=(b)=>b==="props"?"Prop":"Module export";for(let b of s??[]){let X=rn(b);m(X,`setContext key \`${X}\` is imported from "${b.importSource}"; ${ho}, so the context is omitted.`,b.source)}for(let b of r??[])m(b.propName,`${y(b.location)} "${b.propName}" defaults to \`${rn(b)}\` imported from "${b.importSource}"; ${ho}, so the default shows the identifier and its type isn't read.`,E(b.location,b.propName));for(let b of c)m(b.propName,`${y(b.location)} "${b.propName}" defaults to \`${b.calleeName}()\` imported from "${b.importSource}"; ${ho}, so its return type isn't read and the prop falls back to "any".`,E(b.location,b.propName));for(let b of a??[])m(b.calleeText,`\`${b.dispatcherName}\` is passed to \`${b.calleeText}\`, imported from "${b.importSource}"; reading the events it dispatches needs file access (generateBundle or the CLI), so they're omitted.`,b.source,b.ignored);let _=Array.from(new Set((a??[]).map((b)=>`\`${b.calleeText}\``))).join(", "),A=(o??[]).map((b)=>_?{...b,message:`${b.message.replace(_E,"")} in this file; ${_} may dispatch it, but imported helpers aren't read without file access.`}:b),R={...e,diagnostics:[...e.diagnostics??[],...A,...h]};return R[_e]=p,R}var Su="sveld",Tu="0.38.9";var mo="5.57.2";var Cu=1;function tt(e){return e.some((t)=>t.internal)?e.filter((t)=>!t.internal):e}function $E(e){return{...e,props:tt(e.props),moduleExports:tt(e.moduleExports),slots:tt(e.slots),events:tt(e.events),typedefs:tt(e.typedefs),...e.contexts?{contexts:tt(e.contexts).map((t)=>({...t,properties:tt(t.properties)}))}:{}}}function yo(e,t={}){let n=Array.from(e.values(),(s)=>{let{diagnostics:a,...o}=s;return $E(o)}).sort((s,a)=>$e(s.moduleName,a.moduleName)),i={schemaVersion:Cu,generator:{name:Su,version:Tu,svelteVersion:mo},total:n.length,components:n},r=t.entryExports?tt(t.entryExports):void 0;if(r&&r.length>0)i.totalExports=r.length,i.exports=r;return i}var IE=" ",LE=120,RE=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,ME=200,Pu=/\s/,OE=/\s{2}|[^\S ]/,BE=/["'`{}/]/g,FE=/["'`{};/]/g,_u=9,go=10,jE=13,Bn=32,lr=34,qE=38,pr=39,VE=40,GE=41,ar=42,ku=46,Eo=47,Du=59,HE=62,WE=91,vo=92,zE=93,cr=96,bo=123,UE=124,So=125;function KE(e){return RE.test(XE(e,ME))}var wu=[""];function JE(e){let t=wu[e];if(t===void 0)t=IE.repeat(e),wu[e]=t;return t}function XE(e,t){let n="";for(let i=e.length-1;i>=0&&n.length<t;i--)n=e[i]+n;return n.length>t?n.slice(-t):n}function YE(e){if(e.length===0)return!1;let t=e[e.length-1];return t.charCodeAt(t.length-1)===go}function QE(e){while(e.length>0){let t=e[e.length-1],n=t.length;while(n>0){let i=t.charCodeAt(n-1);if(i!==Bn&&i!==_u)break;n--}if(n===t.length)return;if(n===0){e.pop();continue}e[e.length-1]=t.slice(0,n);return}}function ZE(e){while(e.length>0){let t=e[e.length-1];if(!Pu.test(t[t.length-1]))return;let n=t.trimEnd();if(n.length===t.length)return;if(n.length===0){e.pop();continue}e[e.length-1]=n;return}}function ev(e){if(e.includes("{"))return!1;let t=0,n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);if(t!==0){if(r===t&&e.charCodeAt(i-1)!==vo)t=0;continue}if(r===lr||r===pr||r===cr){t=r;continue}if(r===Du&&++n>=2)return!0}return!1}function tv(e){if(!OE.test(e))return e.trimEnd();let t="",n=null,i=!1;for(let r=0;r<e.length;r++){let s=e[r],a=e[r-1];if(n){if(t+=s,n==="double"&&s==='"'&&a!=="\\"||n==="single"&&s==="'"&&a!=="\\"||n==="template"&&s==="`"&&a!=="\\")n=null;i=!1;continue}if(s==='"'||s==="'"||s==="`"){n=s==='"'?"double":s==="'"?"single":"template",t+=s,i=!1;continue}if(Pu.test(s)){if(!i&&t.length>0)t+=" ",i=!0;continue}t+=s,i=!1}return t.trimEnd()}function Nu(e,t){let n=e[t],i=e.indexOf(n,t+1);while(i!==-1&&e.charCodeAt(i-1)===vo)i=e.indexOf(n,i+1);return i}function $u(e,t){let n=e.indexOf("*/",t+1);return n===-1?-1:n+1}function nv(e){let t=new Map,n=[],i=BE,r=0;while(r<e.length){if(i.lastIndex=r,!i.test(e))break;r=i.lastIndex-1;let s=e.charCodeAt(r);if(s===Eo){if(e.charCodeAt(r+1)===ar){let a=$u(e,r);if(a===-1)break;r=a}}else if(s===lr||s===pr||s===cr){let a=Nu(e,r);if(a===-1)break;r=a}else if(s===bo)n.push(r);else if(s===So&&n.length>0)t.set(n.pop(),r);r++}return t}function iv(e,t,n){for(let i=t;i<n;i++)if(!xo(e.charCodeAt(i)))return!1;return!0}function xo(e){if(e<=Bn)return e===Bn||e>=_u&&e<=jE;if(e<160)return!1;return e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function Iu(e,t,n,i){let r=[],s=FE,a=t,o=t;while(o<n){if(s.lastIndex=o,!s.test(e))break;if(o=s.lastIndex-1,o>=n)break;let l=e.charCodeAt(o);if(l===Eo){if(e.charCodeAt(o+1)===ar){let p=$u(e,o);if(p===-1)break;o=p}o++;continue}if(l===lr||l===pr||l===cr){let p=Nu(e,o);if(p===-1)break;o=p+1;continue}if(l===bo){let p=i.get(o);if(p===void 0||p>=n){o++;continue}if(a<o)r.push(e.slice(a,o));let c=o+1;if(iv(e,c,p)){r.push("{}"),o=p+1,a=o;continue}let u=e.slice(c,p),f=e.charCodeAt(c)===go;if(!f&&!u.includes("/*")&&!ev(u)&&!KE(r)){let h=Iu(e,c,p,i),m=h.trim();if(!m.includes(`
|
|
58
|
+
`):[],i=t?.line;for(let r of e){if(i!==void 0&&r-i>1){let a=i+1;while(a<r&&cu(this.lines[a]))a++;if(a===r)for(let o=i+1;o<r;o++)n.push("")}let s=this.lines[r];n.push(s.indent+s.content),i=r}return Qn(n)}getPrecedingDescription(e){if(e.length===0)return;let t=e[0].number,n=[],i=!1;for(let r=t-1;r>=0;r--){if(this.tagLineNumbers.has(r)||this.indentedContinuationLines.has(r)||this.consumedDescriptionLines.has(r))break;if(this.lineDescriptions.has(r))n.unshift(r),i=!0;else if(i&&!cu(this.lines[r]))break}if(n.length===0)return;for(let r of n)this.consumedDescriptionLines.add(r);return this.trimBodyAbove?.(n[0]),this.joinBlockLines(n)}claimBodyLines(e,t){if(!uE(e)){for(let i=1;i<e.lines.length;i++)this.consumedDescriptionLines.add(e.lines[i].number);return}let n=e.lines[e.lines.length-1].number;this.trimThisBody=(i)=>t(n-i+1)}getTagDescription(e,t,n=!1){let i=ir(e),r=t!==void 0&&cE.has(t.tag)&&!ir(t.lines),s=n&&(t===void 0||!co.has(t.tag)),a=[];for(let o=1;o<e.length;o++){let l=e[o];if((r||s)&&!this.indentedContinuationLines.has(l.number))continue;if(!this.lineDescriptions.get(l.number)?.trim()||this.consumedDescriptionLines.has(l.number))continue;a.push(l.number),this.consumedDescriptionLines.add(l.number)}if(a.length===0)return i;return this.joinBlockLines(a,{text:i??"",line:e[Rr(e)].number})}flagDescriptionAfterEvent(e,t,n,i){let{event:r}=this;if(r===void 0||r.description)return;if(r.tagLine!==void 0&&this.indentedContinuationLines.has(r.tagLine+1))return;if(i?.tag!=="event"&&!co.has(i?.tag??""))return;if(ir(n))return;let s=t?`@${e} "${t}"`:`@${e}`;D(this.ctx,"event-description-ambiguous",r.name,`Text after @event "${r.name}" was used as the description of ${s}. Move it above the tag it describes, indent it as a continuation line, or give each event its own comment block.`,ke(this.ctx,n))}takePrecedingDescription(e){let{tag:t,name:n,lines:i}=this.tags[e],r=this.getPrecedingDescription(i);if(r)this.flagDescriptionAfterEvent(t,n,i,this.tags[e-1]);return r}finalizeEvent(){let{ctx:e,event:t}=this;if(t===void 0)return;this.event=void 0;let i=(t.type&&t.type!=="object"&&t.type!=="Object"?t.type:void 0)??(t.properties.length>0?mn(t.properties,!0):t.type||""),{tagLine:r}=t;if(r!==void 0){let p=this.tags.find((u)=>{let f=u.lines[0]?.number;return f!==void 0&&f>r&&!co.has(u.tag)})?.lines[0].number,c=Array.from(this.lineDescriptions.keys()).sort((u,f)=>u-f).filter((u)=>u>r&&(p===void 0||u<p)&&!this.consumedDescriptionLines.has(u)&&this.lineDescriptions.get(u)?.trim());for(let u of c)this.consumedDescriptionLines.add(u);if(c.length>0)t.description=this.joinBlockLines(c,t.description?{text:t.description,line:r}:void 0)}let{name:s,description:a,source:o}=t,l=i===""&&(!e.events.has(s)||e.untypedJsDocEventNames.has(s));if(Ke(e,{name:s,detail:i,has_argument:!1,description:a,deprecated:t.deprecated,tags:t.tags.length>0?t.tags:void 0,internal:t.internal||void 0,source:o}),l)e.untypedJsDocEventNames.add(s);e.eventDescriptions.set(s,a),e.jsDocEventNames.add(s),e.jsDocEventSources.set(s,o),ct(e,"event-no-source",s,t.ignores)}finalizeTypedef(){let{ctx:e,typedef:t}=this;if(t===void 0)return;this.typedef=void 0;let{properties:n}=t,i=n.length>0,r=i?mn(n,!0):t.type||"{}",s=!i&&t.type&&mE(r)?`interface ${t.name} ${r}`:`type ${t.name} = ${r};`,a=i?n.filter(({name:o})=>!o.includes(".")&&!o.startsWith("[")).map(({name:o,type:l,optional:p,description:c})=>({name:o,type:l,optional:p===!0,...c?{description:c}:{}})):Re(r,{skipIndexSignatures:!0});if(a)e.typedefMembersByName.set(t.name,a);hu(e,t,r,s)}finalizeCallback(){let{callback:e}=this;if(e===void 0)return;this.callback=void 0;let t=`(${we(e.params)}) => ${e.returnType||"void"}`;hu(this.ctx,e,t,`type ${e.name} = ${t};`)}openTypeDeclaration(e){let{name:t,lines:n}=this.tags[e],i={name:this.typeDeclarationName(t),source:ke(this.ctx,n),description:this.orCommentDescription(this.getTagDescription(n,this.tags[e+1])||this.takePrecedingDescription(e)),tags:this.pendingTags.splice(0),internal:this.pendingInternal},{tags:r}=i;if(this.pendingDeprecated!==void 0)r.push({name:"deprecated",body:this.pendingDeprecated===!0?"":this.pendingDeprecated}),this.pendingDeprecated=void 0;return this.pendingInternal=!1,this.attachTrailingTag=(s)=>r.push(s),this.isFirstTag=!1,i}readExtends(e,t){let{name:n,lines:i}=this.tags[e];if(this.ctx.extends!==void 0)D(this.ctx,"extend-props-duplicate",n,`A second @extends/@extendProps tag ("${n}") overwrote the first ("${this.ctx.extends.interface}"); only one is used.`,ke(this.ctx,i));this.ctx.extends={interface:n,import:lE.test(t)?JSON.stringify(t):t},this.isFirstTag=!1}readRestProps(e,t){let{name:n,description:i}=this.tags[e],r=n?i?`${n} ${i}`:n:i,s=Dt(r),a=this.orCommentDescription(s||this.takePrecedingDescription(e)),o={type:"Element",name:t,description:a||void 0};if(this.ctx.rest_props=o,s)this.claimBodyLines(this.tags[e],(l)=>{o.description=Dt(rr(r,l))||void 0});this.isFirstTag=!1}readSlot(e,t){let{tag:n,name:i,lines:r}=this.tags[e],s=i==="-"||n==="snippet"&&i==="children"?void 0:i,a=this.orCommentDescription(this.getTagDescription(r,this.tags[e+1]));if(!a&&this.pendingTags.length===0)a=this.takePrecedingDescription(e);this.isFirstTag=!1;let o=t||"Record<string, never>",l=ke(this.ctx,r);if(!t)D(this.ctx,"slot-missing-type",s||"default",`@${n}${s?` "${s}"`:""} is missing a required {Type} annotation; falling back to "${o}".`,l);let p=this.pendingTags.splice(0),c=Xe(s);this.ctx.jsDocSlots.set(c,{tag:n,source:l}),En(this.ctx,{slot_name:s,slot_props:o,slot_description:a||void 0,slot_deprecated:this.pendingDeprecated,slot_tags:p.length>0?p:void 0,slot_internal:this.pendingInternal||void 0,source:l}),this.pendingDeprecated=void 0,this.pendingInternal=!1,this.typeDeclaration=void 0,this.attachTrailingTag=(u)=>{let f=this.ctx.slots.get(c);if(f)f.tags=[...f.tags??[],u]}}readEvent(e,t){let{name:n,lines:i}=this.tags[e],r=ir(i)||this.takePrecedingDescription(e);this.finalizeEvent();let s=this.pendingTags.splice(0);this.event={name:n,type:t,tagLine:i.length>0?i[0].number:void 0,description:this.orCommentDescription(r),source:ke(this.ctx,i),tags:s,internal:this.pendingInternal,deprecated:this.pendingDeprecated,ignores:[],properties:[]},this.pendingInternal=!1,this.pendingDeprecated=void 0,this.typeDeclaration=void 0,this.attachTrailingTag=(a)=>s.push(a),this.isFirstTag=!1}readProperty(e,t){let{name:n,optional:i,default:r,lines:s}=this.tags[e],a=this.getTagDescription(s,this.tags[e+1],this.event!==void 0),o=this.event??(this.typedef&&EE(this.typedef.type)?this.typedef:void 0);if(o===void 0)return;vE(this.ctx,o.properties,{name:n,type:t,description:a,optional:i||!1,default:r},o.name,ke(this.ctx,s))}readTypedef(e,t){this.finalizeTypedef(),this.typedef={...this.openTypeDeclaration(e),type:t,properties:[]},this.typeDeclaration=this.typedef}readCallback(e){this.finalizeCallback(),this.callback={...this.openTypeDeclaration(e),params:[],returnType:void 0},this.typeDeclaration=this.callback}readGenerics(e,t){let{name:n,lines:i}=this.tags[e],r=ke(this.ctx,i);for(let s of F(n,","))du(this.ctx,this.generics,s.trim(),r);this.generics.usedGenericsTag=!0,uu(this.ctx,this.generics),fu(this.ctx,n,t||n),this.isFirstTag=!1}readTemplate(e,t){let{tags:n}=this,i=Br(n[e],t),r=e+1;while(n[r]?.tag==="template")r++;let s=n[r];if((s?.tag==="typedef"||s?.tag==="callback")&&!s.name.includes("<")&&xE(n,r,i)){this.pendingTypeParameters.push(...i.map(({constraint:o})=>o));return}if(this.hasSlotOrSnippetTag&&!this.hasExtendsTag){this.ctx.deferredSlotBlockGenerics.push(...i);return}if(this.documentsFunction)return;let a=ke(this.ctx,n[e].lines);for(let o of i)du(this.ctx,this.generics,o.name,a),fu(this.ctx,o.name,o.constraint);this.generics.usedTemplateTag=!0,uu(this.ctx,this.generics),this.isFirstTag=!1}readDeprecated(e){let{text:t}=this.tags[e],{event:n}=this;if(!n&&this.typeDeclaration){let r={name:"deprecated",body:t};this.typeDeclaration.tags.push(r),this.claimBodyLines(this.tags[e],(s)=>{r.body=rr(t,s)});return}if((n?n.deprecated:this.pendingDeprecated)!==void 0)return;let i=(r)=>{if(n)n.deprecated=r;else this.pendingDeprecated=r};i(ei(t)),this.claimBodyLines(this.tags[e],(r)=>{i(ei(rr(t,r)))})}readPassthrough(e){let{tag:t,text:n,lines:i}=this.tags[e],r={name:t,body:n};if(this.claimBodyLines(this.tags[e],(s)=>{r.body=rr(n,s)}),!Zn.has(t)&&!Mr.has(t)){let s=dE.has(t)?void 0:lu(t,fE,t.length<=4?1:2);D(this.ctx,"jsdoc-unknown-tag",t,s?`Unknown JSDoc tag "@${t}"; did you mean "@${s}"? Passed through unchanged.`:`Unknown JSDoc tag "@${t}"; passed through unchanged. If this is a typo, fix the tag name.`,ke(this.ctx,i))}if(this.attachTrailingTag)this.attachTrailingTag(r);else this.pendingTags.push(r)}read(){let{tags:e}=this;for(let i=0;i<e.length;i++){let{tag:r,type:s,name:a,optional:o}=e[i],l=Ce(s);switch(this.trimBodyAbove=this.trimThisBody,this.trimThisBody=void 0,r){case"extends":case"extendProps":this.readExtends(i,l);break;case"restProps":this.readRestProps(i,l);break;case"slot":case"snippet":this.readSlot(i,l);break;case"csspart":{let p=this.getTagDescription(e[i].lines,e[i+1]);this.ctx.cssParts.push({name:a,...p?{description:p}:{}});break}case"cssprop":case"cssproperty":{let p=this.getTagDescription(e[i].lines,e[i+1]),c=e[i].default;this.ctx.cssProperties.push({name:a,...l?{type:l}:{},...c===void 0?{}:{default:c},...p?{description:p}:{}});break}case"event":this.readEvent(i,l);break;case"type":if(this.event)this.event.type=l;break;case"param":this.callback?.params.push({name:a,type:l,optional:o||!1});break;case"returns":case"return":if(this.callback)this.callback.returnType=l;break;case"property":this.readProperty(i,l);break;case"typedef":this.readTypedef(i,l);break;case"callback":this.readCallback(i);break;case"generics":this.readGenerics(i,l);break;case"template":this.readTemplate(i,l);break;case"deprecated":this.readDeprecated(i);break;case"ignore":case"internal":if(this.event)this.event.internal=!0;else if(this.typeDeclaration)this.typeDeclaration.internal=!0;else this.pendingInternal=!0;break;case"sveld-ignore":this.event?.ignores.push(a);break;case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:this.readPassthrough(i);break}if(pu.has(r))this.finalizeEvent()}this.finalizeEvent(),this.finalizeTypedef(),this.finalizeCallback();let t=[...this.pendingTags,...this.pendingDeprecated===void 0?[]:[{name:"deprecated"}],...this.pendingInternal?[{name:"internal"}]:[]];if(t.length===0)return;if(!e.some((i)=>i.tag==="event"||pu.has(i.tag)))return;for(let i of t)D(this.ctx,"jsdoc-tag-dropped",i.name,`@${i.name} could not attach to a @slot/@snippet/@event/@typedef/@callback tag in the same comment block and was dropped.`)}}function yu(e,t=e.source){if(!t)return;let n={usedGenericsTag:!1,usedTemplateTag:!1,warnedMixedGenericsTags:!1,seenGenericNames:new Set},i=t.includes("@template")?ea(e):new Set;e.functionDocCommentStarts=i;let r=Zt(t);for(let s of r)e.jsDocBlocksByStart.set(s.start,s);for(let s of r)new mu(e,n,s,i.has(s.start)).read()}var xu=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]),bE=Array.from(xu);function gu(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function SE(e){if(e.includes("\\u"))return!0;for(let t of bE){let n=e.indexOf(t);while(n!==-1){if(!gu(e.charCodeAt(n-1))&&!gu(e.charCodeAt(n+t.length)))return!0;n=e.indexOf(t,n+1)}}return!1}function TE(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function CE(e){let t=new Set;switch(e.type){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":if(e.type!=="ArrowFunctionExpression"&&e.id)t.add(e.id.name);for(let n of e.params)Y(n,t);break;case"BlockStatement":sr(e.body,t);break;case"CatchClause":Y(e.param,t);break;case"EachBlock":if(Y(e.context,t),e.index)t.add(e.index);break;case"AwaitBlock":Y(e.value,t),Y(e.error,t);break}return t}function sr(e,t){for(let n of e??[])switch(n.type){case"ImportDeclaration":for(let i of n.specifiers)t.add(i.local.name);break;case"VariableDeclaration":for(let i of n.declarations)Y(i.id,t);break;case"FunctionDeclaration":case"ClassDeclaration":if(n.id?.name)t.add(n.id.name);break;case"ExportNamedDeclaration":if(n.declaration)sr([n.declaration],t);break}}function uo(e,t){if(!e)return!1;let n=[...t],i=!1;return z(e,{enter(r,s){if(oi(r.type))return ie;if(Mt(r))n.push(CE(r));if(r.type==="Identifier"&&xu.has(r.name)&&Sr(r,s)&&!TE(r.name,n))return i=!0,Ut},leave(r){if(Mt(r))n.pop()}}),i}function Eu(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";if(e.source!==void 0&&!SE(e.source))return"legacy";let n=new Set;sr(t.module?.content.body,n);let i=new Set;return sr(t.instance?.content.body,i),uo(t.module,[n])||uo(t.instance,[n,i])||uo(t.fragment,[n,i])?"runes":"legacy"}var kE=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function wE(e){if(e.type!=="TSAsExpression"&&e.type!=="TSTypeAssertion")return!1;let t="typeAnnotation"in e?e.typeAnnotation:void 0;return t?.type==="TSTypeReference"&&t.typeName.type==="Identifier"&&t.typeName.name==="const"}function or(e,t){if(!e)return;z(e,{enter(n){if(!kE.has(n.type)||!("expression"in n)||!n.expression)return;let{expression:i}=n;if(typeof i!=="object")return i;let r=t.typeAssertions.get(n);if(t.constAssertions.has(n)||r===void 0&&wE(n))t.constAssertions.add(i);else if(r!==void 0)t.typeAssertions.set(i,r);else if((n.type==="TSAsExpression"||n.type==="TSTypeAssertion")&&"typeAnnotation"in n)t.typeAssertions.set(i,n.typeAnnotation);return i}})}var AE=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;function PE(e){if(!e.includes("@ts-"))return e;let t=e.charCodeAt(0)===65279?1:0,{instance:n,module:i}=Bi(e),r=[n,i].flatMap((o)=>o?[o.content]:[]).sort((o,l)=>o.start-l.start),s="",a=0;for(let{start:o,end:l}of r)s+=e.slice(a,o+t),s+=e.slice(o+t,l+t).replace(AE,""),a=l+t;return s+e.slice(a)}function vu(e,t,n){e.componentFilePath=n;let i=PE(t);e.source=i;let r=au(i);if(il(e,r),e.parsed=r,e.scriptLanguage==="ts")or(r.module,e.typeCasts),or(r.instance,e.typeCasts),or(r.fragment,e.typeCasts);e.syntaxMode=Eu(e);let s=r.css,a=s?i.slice(0,s.start)+" ".repeat(s.end-s.start)+i.slice(s.end):i;Hr(e,r.module),Hr(e,r.instance),yu(e,a)}class fo{ctx=wr();cleanup(){this.ctx=wr()}parseSvelteComponent(e,t){let{component:n,pending:i}=this.parse(e,t);if(i)n[_e]={...n[_e]??{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[]},...i};return n}parse(e,t){this.cleanup();let n=this.ctx;vu(n,e,t.filePath),ou(n);let i=cl(n);return Qc(n,i)}}var _E=/\.$/,ho="resolving it needs file access (generateBundle or the CLI)";function DE(e,t={}){let n=e[_e];if(!n)return e;let{pendingCallDefaultCandidates:i,pendingConstDefaultCandidates:r,pendingContextKeyCandidates:s,pendingDispatchEscapeCandidates:a,deferredEventNoSourceDiagnostics:o,untypedJsDocEventNames:l,...p}=n,c=(i??[]).filter((b)=>b.importSource!==void 0);if(c.length===0&&!r&&!s&&!a&&!o)return e;let u=e.filePath,f=t.filePath??(typeof u==="string"?u:""),h=[],m=(b,X,he,Pe)=>{h.push(Xn({component:f,kind:"cross-file-unresolved",name:b,message:X,...he?{source:he}:{},...Pe?{ignored:Pe}:{}}))},E=(b,X)=>(b==="props"?e.props:e.moduleExports).find((he)=>he.name===X)?.source,y=(b)=>b==="props"?"Prop":"Module export";for(let b of s??[]){let X=rn(b);m(X,`setContext key \`${X}\` is imported from "${b.importSource}"; ${ho}, so the context is omitted.`,b.source)}for(let b of r??[])m(b.propName,`${y(b.location)} "${b.propName}" defaults to \`${rn(b)}\` imported from "${b.importSource}"; ${ho}, so the default shows the identifier and its type isn't read.`,E(b.location,b.propName));for(let b of c)m(b.propName,`${y(b.location)} "${b.propName}" defaults to \`${b.calleeName}()\` imported from "${b.importSource}"; ${ho}, so its return type isn't read and the prop falls back to "any".`,E(b.location,b.propName));for(let b of a??[])m(b.calleeText,`\`${b.dispatcherName}\` is passed to \`${b.calleeText}\`, imported from "${b.importSource}"; reading the events it dispatches needs file access (generateBundle or the CLI), so they're omitted.`,b.source,b.ignored);let _=Array.from(new Set((a??[]).map((b)=>`\`${b.calleeText}\``))).join(", "),A=(o??[]).map((b)=>_?{...b,message:`${b.message.replace(_E,"")} in this file; ${_} may dispatch it, but imported helpers aren't read without file access.`}:b),R={...e,diagnostics:[...e.diagnostics??[],...A,...h]};return R[_e]=p,R}var Su="sveld",Tu="0.38.10";var mo="5.57.2";var Cu=1;function tt(e){return e.some((t)=>t.internal)?e.filter((t)=>!t.internal):e}function $E(e){return{...e,props:tt(e.props),moduleExports:tt(e.moduleExports),slots:tt(e.slots),events:tt(e.events),typedefs:tt(e.typedefs),...e.contexts?{contexts:tt(e.contexts).map((t)=>({...t,properties:tt(t.properties)}))}:{}}}function yo(e,t={}){let n=Array.from(e.values(),(s)=>{let{diagnostics:a,...o}=s;return $E(o)}).sort((s,a)=>$e(s.moduleName,a.moduleName)),i={schemaVersion:Cu,generator:{name:Su,version:Tu,svelteVersion:mo},total:n.length,components:n},r=t.entryExports?tt(t.entryExports):void 0;if(r&&r.length>0)i.totalExports=r.length,i.exports=r;return i}var IE=" ",LE=120,RE=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,ME=200,Pu=/\s/,OE=/\s{2}|[^\S ]/,BE=/["'`{}/]/g,FE=/["'`{};/]/g,_u=9,go=10,jE=13,Bn=32,lr=34,qE=38,pr=39,VE=40,GE=41,ar=42,ku=46,Eo=47,Du=59,HE=62,WE=91,vo=92,zE=93,cr=96,bo=123,UE=124,So=125;function KE(e){return RE.test(XE(e,ME))}var wu=[""];function JE(e){let t=wu[e];if(t===void 0)t=IE.repeat(e),wu[e]=t;return t}function XE(e,t){let n="";for(let i=e.length-1;i>=0&&n.length<t;i--)n=e[i]+n;return n.length>t?n.slice(-t):n}function YE(e){if(e.length===0)return!1;let t=e[e.length-1];return t.charCodeAt(t.length-1)===go}function QE(e){while(e.length>0){let t=e[e.length-1],n=t.length;while(n>0){let i=t.charCodeAt(n-1);if(i!==Bn&&i!==_u)break;n--}if(n===t.length)return;if(n===0){e.pop();continue}e[e.length-1]=t.slice(0,n);return}}function ZE(e){while(e.length>0){let t=e[e.length-1];if(!Pu.test(t[t.length-1]))return;let n=t.trimEnd();if(n.length===t.length)return;if(n.length===0){e.pop();continue}e[e.length-1]=n;return}}function ev(e){if(e.includes("{"))return!1;let t=0,n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);if(t!==0){if(r===t&&e.charCodeAt(i-1)!==vo)t=0;continue}if(r===lr||r===pr||r===cr){t=r;continue}if(r===Du&&++n>=2)return!0}return!1}function tv(e){if(!OE.test(e))return e.trimEnd();let t="",n=null,i=!1;for(let r=0;r<e.length;r++){let s=e[r],a=e[r-1];if(n){if(t+=s,n==="double"&&s==='"'&&a!=="\\"||n==="single"&&s==="'"&&a!=="\\"||n==="template"&&s==="`"&&a!=="\\")n=null;i=!1;continue}if(s==='"'||s==="'"||s==="`"){n=s==='"'?"double":s==="'"?"single":"template",t+=s,i=!1;continue}if(Pu.test(s)){if(!i&&t.length>0)t+=" ",i=!0;continue}t+=s,i=!1}return t.trimEnd()}function Nu(e,t){let n=e[t],i=e.indexOf(n,t+1);while(i!==-1&&e.charCodeAt(i-1)===vo)i=e.indexOf(n,i+1);return i}function $u(e,t){let n=e.indexOf("*/",t+1);return n===-1?-1:n+1}function nv(e){let t=new Map,n=[],i=BE,r=0;while(r<e.length){if(i.lastIndex=r,!i.test(e))break;r=i.lastIndex-1;let s=e.charCodeAt(r);if(s===Eo){if(e.charCodeAt(r+1)===ar){let a=$u(e,r);if(a===-1)break;r=a}}else if(s===lr||s===pr||s===cr){let a=Nu(e,r);if(a===-1)break;r=a}else if(s===bo)n.push(r);else if(s===So&&n.length>0)t.set(n.pop(),r);r++}return t}function iv(e,t,n){for(let i=t;i<n;i++)if(!xo(e.charCodeAt(i)))return!1;return!0}function xo(e){if(e<=Bn)return e===Bn||e>=_u&&e<=jE;if(e<160)return!1;return e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function Iu(e,t,n,i){let r=[],s=FE,a=t,o=t;while(o<n){if(s.lastIndex=o,!s.test(e))break;if(o=s.lastIndex-1,o>=n)break;let l=e.charCodeAt(o);if(l===Eo){if(e.charCodeAt(o+1)===ar){let p=$u(e,o);if(p===-1)break;o=p}o++;continue}if(l===lr||l===pr||l===cr){let p=Nu(e,o);if(p===-1)break;o=p+1;continue}if(l===bo){let p=i.get(o);if(p===void 0||p>=n){o++;continue}if(a<o)r.push(e.slice(a,o));let c=o+1;if(iv(e,c,p)){r.push("{}"),o=p+1,a=o;continue}let u=e.slice(c,p),f=e.charCodeAt(c)===go;if(!f&&!u.includes("/*")&&!ev(u)&&!KE(r)){let h=Iu(e,c,p,i),m=h.trim();if(!m.includes(`
|
|
59
59
|
`)){let E=m.endsWith(";")?m.slice(0,-1):m,y=`{ ${tv(E)} }`;if(y.length<=LE){r.push(y),o=p+1,a=o;continue}}if(r.push("{"),h.charCodeAt(0)!==Du)r.push(`
|
|
60
60
|
`);if(h.length>0)r.push(h);o=p,a=p;continue}if(r.push("{"),!f)r.push(`
|
|
61
61
|
`);o=c,a=c;continue}if(l===So){if(a<o)r.push(e.slice(a,o));if(QE(r),!YE(r))r.push(`
|