sveld 0.40.1 → 0.40.2
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-qb2pq69t.js → chunk-6hzm92zg.js} +1 -1
- package/chunk-a6579404.js +40 -0
- package/chunk-atg0fsa6.js +191 -0
- package/chunk-tz95vn4s.js +1 -0
- package/cli-entry.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-9fj46p2x.js +0 -40
- package/chunk-y7x842z1.js +0 -1
- package/chunk-ypb35mtk.js +0 -191
package/browser.js
CHANGED
|
@@ -55,7 +55,7 @@ ${" ".repeat(r+2+pp(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 bE=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"]),vE=[...ei,...Mr,"type","param","returns","typedef","property","callback","template","generics","slot","snippet","event","restProps","extends","extendProps","deprecated","ignore","internal","sveld-ignore","csspart","cssprop"],SE=/;$/;function TE(e){let t=e.trim().replace(SE,"").trimEnd();if(!t.startsWith("{")||!t.endsWith("}"))return!1;return We(t,0)===t.length-1}var CE=/[\w$]+/g,kE=new Set(["property","param","returns","return"]);function wE(e,t,n){let i=[e[t].type];for(let s=t+1;kE.has(e[s]?.tag);s++)i.push(e[s].type);let r=new Set(i.join(" ").match(CE));return n.some(({name:s})=>r.has(s))}function AE(e){let t=e.trim();return!t||t==="object"||t==="Object"}function mu(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 yu(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 gu(e,t,n){if(e.generics){let r=B(e.generics[0],",").map((s)=>s.trim()).indexOf(t.trim());if(r!==-1){let s=B(e.generics[1],",").map((l)=>l.trim());s[r]=n,e.generics=[e.generics[0],s.join(", ")];return}}fi(e,t,n)}function xu(e,{name:t,description:n,tags:i,internal:r,source:s},l,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:l,name:t,description:n||void 0,ts:o,tags:i.length>0?i:void 0,...r?{internal:!0}:{},source:s})}function PE(e,t,n,i,r){let s=t.findIndex((l)=>l.name===n.name);if(s===-1)t.push(n);else{let l=i?` of "${i}"`:"";D(e,"property-duplicate",n.name,`Duplicate property "${n.name}"${l}; the later declaration overwrites the earlier one.`,r),t[s]=n}}class Eu{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((a)=>a.tag==="slot"||a.tag==="snippet"),this.hasExtendsTag=r.some((a)=>a.tag==="extends"||a.tag==="extendProps");for(let a of r)if(a.lines.length>0)this.tagLineNumbers.add(a.lines[0].number);for(let a of s)if(a.continuesType)this.tagLineNumbers.add(a.number);let l=!1,o=!1;for(let a of s){if(!a.tag&&!a.continuesType&&a.content&&(o||a.content.trim()!=="}"))this.lineDescriptions.set(a.number,a.content);if(a.tag!==void 0||a.continuesType)l=!0;else if(!a.content.trim());else if(l&&(a.indent||o))this.indentedContinuationLines.add(a.number);else l=!1;if(Qt(a.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 gE(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 l=i+1;while(l<r&&hu(this.lines[l]))l++;if(l===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 Zn(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&&!hu(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(!EE(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&&xE.has(t.tag)&&!ir(t.lines),s=n&&(t===void 0||!fo.has(t.tag)),l=[];for(let o=1;o<e.length;o++){let a=e[o];if((r||s)&&!this.indentedContinuationLines.has(a.number))continue;if(!this.lineDescriptions.get(a.number)?.trim()||this.consumedDescriptionLines.has(a.number))continue;l.push(a.number),this.consumedDescriptionLines.add(a.number)}if(l.length===0)return i;return this.joinBlockLines(l,{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"&&!fo.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.`,Ae(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?yn(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&&!fo.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:l,source:o}=t,a=i===""&&(!e.events.has(s)||e.untypedJsDocEventNames.has(s));if(Je(e,{name:s,detail:i,has_argument:!1,description:l,deprecated:t.deprecated,tags:t.tags.length>0?t.tags:void 0,internal:t.internal||void 0,source:o}),a)e.untypedJsDocEventNames.add(s);e.eventDescriptions.set(s,l),e.jsDocEventNames.add(s),e.jsDocEventSources.set(s,o),ze(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?yn(n,!0):t.type||"{}",s=!i&&t.type&&TE(r)?`interface ${t.name} ${r}`:`type ${t.name} = ${r};`,l=i?n.filter(({name:o})=>!o.includes(".")&&!o.startsWith("[")).map(({name:o,type:a,optional:p,description:c})=>({name:o,type:a,optional:p===!0,...c?{description:c}:{}})):Re(r,{skipIndexSignatures:!0});if(l)e.typedefMembersByName.set(t.name,l);xu(e,t,r,s)}finalizeCallback(){let{callback:e}=this;if(e===void 0)return;this.callback=void 0;let t=`(${ye(e.params)}) => ${e.returnType||"void"}`;xu(this.ctx,e,t,`type ${e.name} = ${t};`)}openTypeDeclaration(e){let{name:t,lines:n}=this.tags[e],i={name:this.typeDeclarationName(t),source:Ae(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.`,Ae(this.ctx,i));this.ctx.extends={interface:n,import:yE.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),l=this.orCommentDescription(s||this.takePrecedingDescription(e)),o={type:"Element",name:t,description:l||void 0};if(this.ctx.rest_props=o,s)this.claimBodyLines(this.tags[e],(a)=>{o.description=Dt(rr(r,a))||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,l=this.orCommentDescription(this.getTagDescription(r,this.tags[e+1]));if(!l&&this.pendingTags.length===0)l=this.takePrecedingDescription(e);this.isFirstTag=!1;let o=t||"Record<string, never>",a=Ae(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}".`,a);let p=this.pendingTags.splice(0),c=Ye(s);this.ctx.jsDocSlots.set(c,{tag:n,source:a}),bn(this.ctx,{slot_name:s,slot_props:o,slot_description:l||void 0,slot_deprecated:this.pendingDeprecated,slot_tags:p.length>0?p:void 0,slot_internal:this.pendingInternal||void 0,source:a}),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:Ae(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=(l)=>s.push(l),this.isFirstTag=!1}readProperty(e,t){let{name:n,optional:i,default:r,lines:s}=this.tags[e],l=this.getTagDescription(s,this.tags[e+1],this.event!==void 0),o=this.event??(this.typedef&&AE(this.typedef.type)?this.typedef:void 0);if(o===void 0)return;PE(this.ctx,o.properties,{name:n,type:t,description:l,optional:i||!1,default:r},o.name,Ae(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=Ae(this.ctx,i);for(let s of B(n,","))yu(this.ctx,this.generics,s.trim(),r);this.generics.usedGenericsTag=!0,mu(this.ctx,this.generics),gu(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("<")&&wE(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 l=Ae(this.ctx,n[e].lines);for(let o of i)yu(this.ctx,this.generics,o.name,l),gu(this.ctx,o.name,o.constraint);this.generics.usedTemplateTag=!0,mu(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(ti(t)),this.claimBodyLines(this.tags[e],(r)=>{i(ti(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)}),!ei.has(t)&&!Mr.has(t)){let s=bE.has(t)?void 0:du(t,vE,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.`,Ae(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:l,optional:o}=e[i],a=we(s);switch(this.trimBodyAbove=this.trimThisBody,this.trimThisBody=void 0,r){case"extends":case"extendProps":this.readExtends(i,a);break;case"restProps":this.readRestProps(i,a);break;case"slot":case"snippet":this.readSlot(i,a);break;case"csspart":{let p=this.getTagDescription(e[i].lines,e[i+1]);this.ctx.cssParts.push({name:l,...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:l,...a?{type:a}:{},...c===void 0?{}:{default:c},...p?{description:p}:{}});break}case"event":this.readEvent(i,a);break;case"type":if(this.event)this.event.type=a;break;case"param":this.callback?.params.push({name:l,type:a,optional:o||!1});break;case"returns":case"return":if(this.callback)this.callback.returnType=a;break;case"property":this.readProperty(i,a);break;case"typedef":this.readTypedef(i,a);break;case"callback":this.readCallback(i);break;case"generics":this.readGenerics(i,a);break;case"template":this.readTemplate(i,a);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(l);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(fu.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"||fu.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 bu(e,t=e.source){if(!t)return;let n={usedGenericsTag:!1,usedTemplateTag:!1,warnedMixedGenericsTags:!1,seenGenericNames:new Set},i=t.includes("@template")?na(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 Eu(e,n,s,i.has(s.start)).read()}var Su=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]),_E=Array.from(Su);function vu(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function DE(e){if(e.includes("\\u"))return!0;for(let t of _E){let n=e.indexOf(t);while(n!==-1){if(!vu(e.charCodeAt(n-1))&&!vu(e.charCodeAt(n+t.length)))return!0;n=e.indexOf(t,n+1)}}return!1}function NE(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function $E(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 ho(e,t){if(!e)return!1;let n=[...t],i=!1;return z(e,{enter(r,s){if(ai(r.type))return ie;if(Mt(r))n.push($E(r));if(r.type==="Identifier"&&Su.has(r.name)&&Sr(r,s)&&!NE(r.name,n))return i=!0,Ut},leave(r){if(Mt(r))n.pop()}}),i}function Tu(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";if(e.source!==void 0&&!DE(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),ho(t.module,[n])||ho(t.instance,[n,i])||ho(t.fragment,[n,i])?"runes":"legacy"}var IE=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function LE(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(!IE.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&&LE(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 RE=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;function ME(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,a)=>o.start-a.start),s="",l=0;for(let{start:o,end:a}of r)s+=e.slice(l,o+t),s+=e.slice(o+t,a+t).replace(RE,""),l=a+t;return s+e.slice(l)}function Cu(e,t,n){e.componentFilePath=n;let i=ME(t);e.source=i;let r=uu(i);if(ol(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=Tu(e);let s=r.css,l=s?i.slice(0,s.start)+" ".repeat(s.end-s.start)+i.slice(s.end):i;Wr(e,r.module),Wr(e,r.instance),bu(e,l)}class mo{ctx=wr();cleanup(){this.ctx=wr()}parseSvelteComponent(e,t){let{component:n,pending:i}=this.parse(e,t);if(i)n[De]={...n[De]??{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[]},...i};return n}parse(e,t){this.cleanup();let n=this.ctx;Cu(n,e,t.filePath),cu(n);let i=fl(n);return nu(n,i)}}var OE=/\.$/,yo="resolving it needs file access (generateBundle or the CLI)";function BE(e,t={}){let n=e[De];if(!n)return e;let{pendingCallDefaultCandidates:i,pendingConstDefaultCandidates:r,pendingContextKeyCandidates:s,pendingDispatchEscapeCandidates:l,deferredEventNoSourceDiagnostics:o,untypedJsDocEventNames:a,...p}=n,c=(i??[]).filter((v)=>v.importSource!==void 0);if(c.length===0&&!r&&!s&&!l&&!o)return e;let u=e.filePath,f=t.filePath??(typeof u==="string"?u:""),h=[],m=(v,X,he,_e)=>{h.push(Yn({component:f,kind:"cross-file-unresolved",name:v,message:X,...he?{source:he}:{},..._e?{ignored:_e}:{}}))},x=(v,X)=>(v==="props"?e.props:e.moduleExports).find((he)=>he.name===X)?.source,y=(v)=>v==="props"?"Prop":"Module export";for(let v of s??[]){let X=rn(v);m(X,`setContext key \`${X}\` is imported from "${v.importSource}"; ${yo}, so the context is omitted.`,v.source)}for(let v of r??[])m(v.propName,`${y(v.location)} "${v.propName}" defaults to \`${rn(v)}\` imported from "${v.importSource}"; ${yo}, so the default shows the identifier and its type isn't read.`,x(v.location,v.propName));for(let v of c)m(v.propName,`${y(v.location)} "${v.propName}" defaults to \`${v.calleeName}()\` imported from "${v.importSource}"; ${yo}, so its return type isn't read and the prop falls back to "any".`,x(v.location,v.propName));for(let v of l??[])m(v.calleeText,`\`${v.dispatcherName}\` is passed to \`${v.calleeText}\`, imported from "${v.importSource}"; reading the events it dispatches needs file access (generateBundle or the CLI), so they're omitted.`,v.source,v.ignored);let _=Array.from(new Set((l??[]).map((v)=>`\`${v.calleeText}\``))).join(", "),A=(o??[]).map((v)=>_?{...v,message:`${v.message.replace(OE,"")} in this file; ${_} may dispatch it, but imported helpers aren't read without file access.`}:v),R={...e,diagnostics:[...e.diagnostics??[],...A,...h]};return R[De]=p,R}var wu="sveld",Au="0.40.1";var go="5.57.2";var Pu=1;function nt(e){return e.some((t)=>t.internal)?e.filter((t)=>!t.internal):e}function jE(e){return{...e,props:nt(e.props),moduleExports:nt(e.moduleExports),slots:nt(e.slots),events:nt(e.events),typedefs:nt(e.typedefs),...e.contexts?{contexts:nt(e.contexts).map((t)=>({...t,properties:nt(t.properties)}))}:{}}}function xo(e,t={}){let n=Array.from(e.values(),(s)=>{let{diagnostics:l,...o}=s;return jE(o)}).sort((s,l)=>Ie(s.moduleName,l.moduleName)),i={schemaVersion:Pu,generator:{name:wu,version:Au,svelteVersion:go},total:n.length,components:n},r=t.entryExports?nt(t.entryExports):void 0;if(r&&r.length>0)i.totalExports=r.length,i.exports=r;return i}var qE=" ",VE=120,GE=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,HE=200,$u=/\s/,WE=/\s{2}|[^\S ]/,zE=/["'`{}/]/g,UE=/["'`{};/]/g,Iu=9,Eo=10,KE=13,Fn=32,lr=34,JE=38,pr=39,XE=40,YE=41,ar=42,_u=46,vo=47,Lu=59,QE=62,ZE=91,So=92,eb=93,cr=96,To=123,tb=124,Co=125;function nb(e){return GE.test(rb(e,HE))}var Du=[""];function ib(e){let t=Du[e];if(t===void 0)t=qE.repeat(e),Du[e]=t;return t}function rb(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 sb(e){if(e.length===0)return!1;let t=e[e.length-1];return t.charCodeAt(t.length-1)===Eo}function ob(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!==Fn&&i!==Iu)break;n--}if(n===t.length)return;if(n===0){e.pop();continue}e[e.length-1]=t.slice(0,n);return}}function ab(e){while(e.length>0){let t=e[e.length-1];if(!$u.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 lb(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)!==So)t=0;continue}if(r===lr||r===pr||r===cr){t=r;continue}if(r===Lu&&++n>=2)return!0}return!1}function pb(e){if(!WE.test(e))return e.trimEnd();let t="",n=null,i=!1;for(let r=0;r<e.length;r++){let s=e[r],l=e[r-1];if(n){if(t+=s,n==="double"&&s==='"'&&l!=="\\"||n==="single"&&s==="'"&&l!=="\\"||n==="template"&&s==="`"&&l!=="\\")n=null;i=!1;continue}if(s==='"'||s==="'"||s==="`"){n=s==='"'?"double":s==="'"?"single":"template",t+=s,i=!1;continue}if($u.test(s)){if(!i&&t.length>0)t+=" ",i=!0;continue}t+=s,i=!1}return t.trimEnd()}function Ru(e,t){let n=e[t],i=e.indexOf(n,t+1);while(i!==-1&&e.charCodeAt(i-1)===So)i=e.indexOf(n,i+1);return i}function Mu(e,t){let n=e.indexOf("*/",t+1);return n===-1?-1:n+1}function cb(e){let t=new Map,n=[],i=zE,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===vo){if(e.charCodeAt(r+1)===ar){let l=Mu(e,r);if(l===-1)break;r=l}}else if(s===lr||s===pr||s===cr){let l=Ru(e,r);if(l===-1)break;r=l}else if(s===To)n.push(r);else if(s===Co&&n.length>0)t.set(n.pop(),r);r++}return t}function ub(e,t,n){for(let i=t;i<n;i++)if(!bo(e.charCodeAt(i)))return!1;return!0}function bo(e){if(e<=Fn)return e===Fn||e>=Iu&&e<=KE;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 Ou(e,t,n,i){let r=[],s=UE,l=t,o=t;while(o<n){if(s.lastIndex=o,!s.test(e))break;if(o=s.lastIndex-1,o>=n)break;let a=e.charCodeAt(o);if(a===vo){if(e.charCodeAt(o+1)===ar){let p=Mu(e,o);if(p===-1)break;o=p}o++;continue}if(a===lr||a===pr||a===cr){let p=Ru(e,o);if(p===-1)break;o=p+1;continue}if(a===To){let p=i.get(o);if(p===void 0||p>=n){o++;continue}if(l<o)r.push(e.slice(l,o));let c=o+1;if(ub(e,c,p)){r.push("{}"),o=p+1,l=o;continue}let u=e.slice(c,p),f=e.charCodeAt(c)===Eo;if(!f&&!u.includes("/*")&&!lb(u)&&!nb(r)){let h=Ou(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 l=i+1;while(l<r&&hu(this.lines[l]))l++;if(l===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 Zn(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&&!hu(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(!EE(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&&xE.has(t.tag)&&!ir(t.lines),s=n&&(t===void 0||!fo.has(t.tag)),l=[];for(let o=1;o<e.length;o++){let a=e[o];if((r||s)&&!this.indentedContinuationLines.has(a.number))continue;if(!this.lineDescriptions.get(a.number)?.trim()||this.consumedDescriptionLines.has(a.number))continue;l.push(a.number),this.consumedDescriptionLines.add(a.number)}if(l.length===0)return i;return this.joinBlockLines(l,{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"&&!fo.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.`,Ae(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?yn(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&&!fo.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:l,source:o}=t,a=i===""&&(!e.events.has(s)||e.untypedJsDocEventNames.has(s));if(Je(e,{name:s,detail:i,has_argument:!1,description:l,deprecated:t.deprecated,tags:t.tags.length>0?t.tags:void 0,internal:t.internal||void 0,source:o}),a)e.untypedJsDocEventNames.add(s);e.eventDescriptions.set(s,l),e.jsDocEventNames.add(s),e.jsDocEventSources.set(s,o),ze(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?yn(n,!0):t.type||"{}",s=!i&&t.type&&TE(r)?`interface ${t.name} ${r}`:`type ${t.name} = ${r};`,l=i?n.filter(({name:o})=>!o.includes(".")&&!o.startsWith("[")).map(({name:o,type:a,optional:p,description:c})=>({name:o,type:a,optional:p===!0,...c?{description:c}:{}})):Re(r,{skipIndexSignatures:!0});if(l)e.typedefMembersByName.set(t.name,l);xu(e,t,r,s)}finalizeCallback(){let{callback:e}=this;if(e===void 0)return;this.callback=void 0;let t=`(${ye(e.params)}) => ${e.returnType||"void"}`;xu(this.ctx,e,t,`type ${e.name} = ${t};`)}openTypeDeclaration(e){let{name:t,lines:n}=this.tags[e],i={name:this.typeDeclarationName(t),source:Ae(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.`,Ae(this.ctx,i));this.ctx.extends={interface:n,import:yE.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),l=this.orCommentDescription(s||this.takePrecedingDescription(e)),o={type:"Element",name:t,description:l||void 0};if(this.ctx.rest_props=o,s)this.claimBodyLines(this.tags[e],(a)=>{o.description=Dt(rr(r,a))||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,l=this.orCommentDescription(this.getTagDescription(r,this.tags[e+1]));if(!l&&this.pendingTags.length===0)l=this.takePrecedingDescription(e);this.isFirstTag=!1;let o=t||"Record<string, never>",a=Ae(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}".`,a);let p=this.pendingTags.splice(0),c=Ye(s);this.ctx.jsDocSlots.set(c,{tag:n,source:a}),bn(this.ctx,{slot_name:s,slot_props:o,slot_description:l||void 0,slot_deprecated:this.pendingDeprecated,slot_tags:p.length>0?p:void 0,slot_internal:this.pendingInternal||void 0,source:a}),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:Ae(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=(l)=>s.push(l),this.isFirstTag=!1}readProperty(e,t){let{name:n,optional:i,default:r,lines:s}=this.tags[e],l=this.getTagDescription(s,this.tags[e+1],this.event!==void 0),o=this.event??(this.typedef&&AE(this.typedef.type)?this.typedef:void 0);if(o===void 0)return;PE(this.ctx,o.properties,{name:n,type:t,description:l,optional:i||!1,default:r},o.name,Ae(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=Ae(this.ctx,i);for(let s of B(n,","))yu(this.ctx,this.generics,s.trim(),r);this.generics.usedGenericsTag=!0,mu(this.ctx,this.generics),gu(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("<")&&wE(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 l=Ae(this.ctx,n[e].lines);for(let o of i)yu(this.ctx,this.generics,o.name,l),gu(this.ctx,o.name,o.constraint);this.generics.usedTemplateTag=!0,mu(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(ti(t)),this.claimBodyLines(this.tags[e],(r)=>{i(ti(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)}),!ei.has(t)&&!Mr.has(t)){let s=bE.has(t)?void 0:du(t,vE,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.`,Ae(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:l,optional:o}=e[i],a=we(s);switch(this.trimBodyAbove=this.trimThisBody,this.trimThisBody=void 0,r){case"extends":case"extendProps":this.readExtends(i,a);break;case"restProps":this.readRestProps(i,a);break;case"slot":case"snippet":this.readSlot(i,a);break;case"csspart":{let p=this.getTagDescription(e[i].lines,e[i+1]);this.ctx.cssParts.push({name:l,...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:l,...a?{type:a}:{},...c===void 0?{}:{default:c},...p?{description:p}:{}});break}case"event":this.readEvent(i,a);break;case"type":if(this.event)this.event.type=a;break;case"param":this.callback?.params.push({name:l,type:a,optional:o||!1});break;case"returns":case"return":if(this.callback)this.callback.returnType=a;break;case"property":this.readProperty(i,a);break;case"typedef":this.readTypedef(i,a);break;case"callback":this.readCallback(i);break;case"generics":this.readGenerics(i,a);break;case"template":this.readTemplate(i,a);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(l);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(fu.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"||fu.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 bu(e,t=e.source){if(!t)return;let n={usedGenericsTag:!1,usedTemplateTag:!1,warnedMixedGenericsTags:!1,seenGenericNames:new Set},i=t.includes("@template")?na(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 Eu(e,n,s,i.has(s.start)).read()}var Su=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]),_E=Array.from(Su);function vu(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function DE(e){if(e.includes("\\u"))return!0;for(let t of _E){let n=e.indexOf(t);while(n!==-1){if(!vu(e.charCodeAt(n-1))&&!vu(e.charCodeAt(n+t.length)))return!0;n=e.indexOf(t,n+1)}}return!1}function NE(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function $E(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 ho(e,t){if(!e)return!1;let n=[...t],i=!1;return z(e,{enter(r,s){if(ai(r.type))return ie;if(Mt(r))n.push($E(r));if(r.type==="Identifier"&&Su.has(r.name)&&Sr(r,s)&&!NE(r.name,n))return i=!0,Ut},leave(r){if(Mt(r))n.pop()}}),i}function Tu(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";if(e.source!==void 0&&!DE(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),ho(t.module,[n])||ho(t.instance,[n,i])||ho(t.fragment,[n,i])?"runes":"legacy"}var IE=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function LE(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(!IE.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&&LE(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 RE=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;function ME(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,a)=>o.start-a.start),s="",l=0;for(let{start:o,end:a}of r)s+=e.slice(l,o+t),s+=e.slice(o+t,a+t).replace(RE,""),l=a+t;return s+e.slice(l)}function Cu(e,t,n){e.componentFilePath=n;let i=ME(t);e.source=i;let r=uu(i);if(ol(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=Tu(e);let s=r.css,l=s?i.slice(0,s.start)+" ".repeat(s.end-s.start)+i.slice(s.end):i;Wr(e,r.module),Wr(e,r.instance),bu(e,l)}class mo{ctx=wr();cleanup(){this.ctx=wr()}parseSvelteComponent(e,t){let{component:n,pending:i}=this.parse(e,t);if(i)n[De]={...n[De]??{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[]},...i};return n}parse(e,t){this.cleanup();let n=this.ctx;Cu(n,e,t.filePath),cu(n);let i=fl(n);return nu(n,i)}}var OE=/\.$/,yo="resolving it needs file access (generateBundle or the CLI)";function BE(e,t={}){let n=e[De];if(!n)return e;let{pendingCallDefaultCandidates:i,pendingConstDefaultCandidates:r,pendingContextKeyCandidates:s,pendingDispatchEscapeCandidates:l,deferredEventNoSourceDiagnostics:o,untypedJsDocEventNames:a,...p}=n,c=(i??[]).filter((v)=>v.importSource!==void 0);if(c.length===0&&!r&&!s&&!l&&!o)return e;let u=e.filePath,f=t.filePath??(typeof u==="string"?u:""),h=[],m=(v,X,he,_e)=>{h.push(Yn({component:f,kind:"cross-file-unresolved",name:v,message:X,...he?{source:he}:{},..._e?{ignored:_e}:{}}))},x=(v,X)=>(v==="props"?e.props:e.moduleExports).find((he)=>he.name===X)?.source,y=(v)=>v==="props"?"Prop":"Module export";for(let v of s??[]){let X=rn(v);m(X,`setContext key \`${X}\` is imported from "${v.importSource}"; ${yo}, so the context is omitted.`,v.source)}for(let v of r??[])m(v.propName,`${y(v.location)} "${v.propName}" defaults to \`${rn(v)}\` imported from "${v.importSource}"; ${yo}, so the default shows the identifier and its type isn't read.`,x(v.location,v.propName));for(let v of c)m(v.propName,`${y(v.location)} "${v.propName}" defaults to \`${v.calleeName}()\` imported from "${v.importSource}"; ${yo}, so its return type isn't read and the prop falls back to "any".`,x(v.location,v.propName));for(let v of l??[])m(v.calleeText,`\`${v.dispatcherName}\` is passed to \`${v.calleeText}\`, imported from "${v.importSource}"; reading the events it dispatches needs file access (generateBundle or the CLI), so they're omitted.`,v.source,v.ignored);let _=Array.from(new Set((l??[]).map((v)=>`\`${v.calleeText}\``))).join(", "),A=(o??[]).map((v)=>_?{...v,message:`${v.message.replace(OE,"")} in this file; ${_} may dispatch it, but imported helpers aren't read without file access.`}:v),R={...e,diagnostics:[...e.diagnostics??[],...A,...h]};return R[De]=p,R}var wu="sveld",Au="0.40.2";var go="5.57.2";var Pu=1;function nt(e){return e.some((t)=>t.internal)?e.filter((t)=>!t.internal):e}function jE(e){return{...e,props:nt(e.props),moduleExports:nt(e.moduleExports),slots:nt(e.slots),events:nt(e.events),typedefs:nt(e.typedefs),...e.contexts?{contexts:nt(e.contexts).map((t)=>({...t,properties:nt(t.properties)}))}:{}}}function xo(e,t={}){let n=Array.from(e.values(),(s)=>{let{diagnostics:l,...o}=s;return jE(o)}).sort((s,l)=>Ie(s.moduleName,l.moduleName)),i={schemaVersion:Pu,generator:{name:wu,version:Au,svelteVersion:go},total:n.length,components:n},r=t.entryExports?nt(t.entryExports):void 0;if(r&&r.length>0)i.totalExports=r.length,i.exports=r;return i}var qE=" ",VE=120,GE=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,HE=200,$u=/\s/,WE=/\s{2}|[^\S ]/,zE=/["'`{}/]/g,UE=/["'`{};/]/g,Iu=9,Eo=10,KE=13,Fn=32,lr=34,JE=38,pr=39,XE=40,YE=41,ar=42,_u=46,vo=47,Lu=59,QE=62,ZE=91,So=92,eb=93,cr=96,To=123,tb=124,Co=125;function nb(e){return GE.test(rb(e,HE))}var Du=[""];function ib(e){let t=Du[e];if(t===void 0)t=qE.repeat(e),Du[e]=t;return t}function rb(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 sb(e){if(e.length===0)return!1;let t=e[e.length-1];return t.charCodeAt(t.length-1)===Eo}function ob(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!==Fn&&i!==Iu)break;n--}if(n===t.length)return;if(n===0){e.pop();continue}e[e.length-1]=t.slice(0,n);return}}function ab(e){while(e.length>0){let t=e[e.length-1];if(!$u.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 lb(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)!==So)t=0;continue}if(r===lr||r===pr||r===cr){t=r;continue}if(r===Lu&&++n>=2)return!0}return!1}function pb(e){if(!WE.test(e))return e.trimEnd();let t="",n=null,i=!1;for(let r=0;r<e.length;r++){let s=e[r],l=e[r-1];if(n){if(t+=s,n==="double"&&s==='"'&&l!=="\\"||n==="single"&&s==="'"&&l!=="\\"||n==="template"&&s==="`"&&l!=="\\")n=null;i=!1;continue}if(s==='"'||s==="'"||s==="`"){n=s==='"'?"double":s==="'"?"single":"template",t+=s,i=!1;continue}if($u.test(s)){if(!i&&t.length>0)t+=" ",i=!0;continue}t+=s,i=!1}return t.trimEnd()}function Ru(e,t){let n=e[t],i=e.indexOf(n,t+1);while(i!==-1&&e.charCodeAt(i-1)===So)i=e.indexOf(n,i+1);return i}function Mu(e,t){let n=e.indexOf("*/",t+1);return n===-1?-1:n+1}function cb(e){let t=new Map,n=[],i=zE,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===vo){if(e.charCodeAt(r+1)===ar){let l=Mu(e,r);if(l===-1)break;r=l}}else if(s===lr||s===pr||s===cr){let l=Ru(e,r);if(l===-1)break;r=l}else if(s===To)n.push(r);else if(s===Co&&n.length>0)t.set(n.pop(),r);r++}return t}function ub(e,t,n){for(let i=t;i<n;i++)if(!bo(e.charCodeAt(i)))return!1;return!0}function bo(e){if(e<=Fn)return e===Fn||e>=Iu&&e<=KE;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 Ou(e,t,n,i){let r=[],s=UE,l=t,o=t;while(o<n){if(s.lastIndex=o,!s.test(e))break;if(o=s.lastIndex-1,o>=n)break;let a=e.charCodeAt(o);if(a===vo){if(e.charCodeAt(o+1)===ar){let p=Mu(e,o);if(p===-1)break;o=p}o++;continue}if(a===lr||a===pr||a===cr){let p=Ru(e,o);if(p===-1)break;o=p+1;continue}if(a===To){let p=i.get(o);if(p===void 0||p>=n){o++;continue}if(l<o)r.push(e.slice(l,o));let c=o+1;if(ub(e,c,p)){r.push("{}"),o=p+1,l=o;continue}let u=e.slice(c,p),f=e.charCodeAt(c)===Eo;if(!f&&!u.includes("/*")&&!lb(u)&&!nb(r)){let h=Ou(e,c,p,i),m=h.trim();if(!m.includes(`
|
|
59
59
|
`)){let x=m.endsWith(";")?m.slice(0,-1):m,y=`{ ${pb(x)} }`;if(y.length<=VE){r.push(y),o=p+1,l=o;continue}}if(r.push("{"),h.charCodeAt(0)!==Lu)r.push(`
|
|
60
60
|
`);if(h.length>0)r.push(h);o=p,l=p;continue}if(r.push("{"),!f)r.push(`
|
|
61
61
|
`);o=c,l=c;continue}if(a===Co){if(l<o)r.push(e.slice(l,o));if(ob(r),!sb(r))r.push(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n,
|
|
1
|
+
import{n,q}from"./chunk-atg0fsa6.js";import{readdirSync as P,readFileSync as T,statSync as _}from"node:fs";import{createRequire as x}from"node:module";import c from"node:path";var k=/[^A-Za-z0-9_-]/g,R=/[^A-Za-z0-9_$]/g,I=/^[0-9]/,C=2,g=7,f=`TypeScript ${g} or later, which provides \`typescript/async\` (\`typescript/unstable/async\` in 7.0)`,w=["typescript/async","typescript/unstable/async"];function A(e){if(!e)return!1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=g}async function b(e){let t;try{let i=x(c.join(e,"package.json")).resolve("typescript/package.json");t=JSON.parse(T(i,"utf8")).version}catch{return{installed:!1}}if(!A(t))return{installed:!0,version:t};for(let s of w)try{let i=await import(s);return{installed:!0,version:t,module:i}}catch{}return{installed:!0,version:t}}class d{api=null;usesFileSystemLayer=!1;tsconfigPath;overlay=new Map;constructor(e){this.tsconfigPath=e}static async create(e=process.cwd(),{importTs:t=b}={}){let s=await t(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${f}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${f}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=q(e,["tsconfig.json"]);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let r=new d(i);return r.usesFileSystemLayer=typeof s.module.API.prototype?.createSnapshot==="function",r.api=r.usesFileSystemLayer?new s.module.API({cwd:e}):new s.module.API({cwd:e,fs:r.createFileSystem()}),{ok:!0,resolver:r}}async checkExamples(e){let t=new Map,s=[];for(let r of e)for(let a of r.sources){let o=this.exampleFileName(r.filePath,r.moduleName,a.id);this.overlay.set(o,N(a)),s.push({filePath:r.filePath,source:a,file:o})}if(s.length===0)return t;let i=this.usesFileSystemLayer?await this.api.createSnapshot({openProjects:[this.tsconfigPath],fileSystem:{kind:"layer",files:Object.fromEntries(this.overlay)}}):await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((r)=>r.file)}});try{let r=await i.getDefaultProjectForFile(s[0].file);if(!r)return t;await Promise.all(s.map(async({filePath:a,source:o,file:p})=>{let[y,h]=await Promise.all([r.program.getSyntacticDiagnostics(p),r.program.getSemanticDiagnostics(p)]),u=[...y,...h];if(u.length===0)return;let S=this.overlay.get(p)??"",E=u.map((l)=>j(l,S)).sort((l,v)=>l.line-v.line).map((l)=>`Line ${l.line}: ${l.text}`).join(`
|
|
2
2
|
`),m=t.get(a)??[];m.push({id:o.id,name:o.name,message:E}),t.set(a,m)}))}finally{await i.dispose?.()}return t}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(e)=>this.overlay.get(n(e)),fileExists:(e)=>this.overlay.has(n(e))?!0:void 0,getAccessibleEntries:(e)=>{let t=n(e),s=Array.from(this.overlay.keys()).filter((a)=>n(c.dirname(a))===t);if(s.length===0)return;let i=[],r=[];try{for(let a of P(e)){let o=c.join(e,a);try{(_(o).isDirectory()?r:i).push(a)}catch{}}}catch{}for(let a of s){let o=c.basename(a);if(!i.includes(o))i.push(o)}return{files:i,directories:r}}}}exampleFileName(e,t,s){let i=c.dirname(c.resolve(e)),r=s.replace(k,"_");return n(c.join(i,`__sveld_example_${t}_${r}.ts`))}}function F(e){let t=e.replace(R,"_");if(t===""||I.test(t))return`_${t}`;return t}function N(e){return`const ${F(e.name)} = null as unknown as (${e.type});
|
|
3
3
|
${e.code}
|
|
4
4
|
`}function j(e,t){let s=e.pos??0,i=t.slice(0,s).split(`
|