sveld 0.35.2 → 0.36.0
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/README.md +33 -6
- package/lib/browser.d.ts +660 -39
- package/lib/browser.js +172 -172
- package/lib/chunk-0fqdg2xa.js +20 -0
- package/lib/chunk-2vwf7nck.js +1 -0
- package/lib/chunk-8myyzjb1.js +4 -0
- package/lib/{chunk-v4q9vw0y.js → chunk-as5hgj7e.js} +57 -57
- package/lib/{chunk-zva3xjwa.js → chunk-denfbw92.js} +1 -1
- package/lib/chunk-h1r040pg.js +6 -0
- package/lib/chunk-m538qnhp.js +230 -0
- package/lib/chunk-r4rrncmd.js +1 -0
- package/lib/{chunk-1p4ka68s.js → chunk-t9d5k3p7.js} +1 -1
- package/lib/{chunk-8xw75w8t.js → chunk-tmj7vnjr.js} +2 -2
- package/lib/chunk-xryt7ad2.js +3 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.d.ts +767 -10
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/ComponentParser.d.ts +0 -560
- package/lib/ast-guards.d.ts +0 -16
- package/lib/brands.d.ts +0 -11
- package/lib/bundle.d.ts +0 -174
- package/lib/check.d.ts +0 -43
- package/lib/chunk-72hx9e9w.js +0 -20
- package/lib/chunk-7qz0hzgw.js +0 -217
- package/lib/chunk-cxrw7gzr.js +0 -2
- package/lib/chunk-jdnsv86e.js +0 -1
- package/lib/chunk-pmj8c3yv.js +0 -6
- package/lib/chunk-s9mzxa4y.js +0 -1
- package/lib/chunk-xkrgedm4.js +0 -4
- package/lib/cli-entry.d.ts +0 -12
- package/lib/cli.d.ts +0 -28
- package/lib/create-exports.d.ts +0 -32
- package/lib/dependency-graph.d.ts +0 -20
- package/lib/diagnostics.d.ts +0 -34
- package/lib/element-tag-map.d.ts +0 -146
- package/lib/example-check.d.ts +0 -24
- package/lib/get-svelte-entry.d.ts +0 -3
- package/lib/load-config.d.ts +0 -62
- package/lib/parse-cache.d.ts +0 -28
- package/lib/parse-entry-exports.d.ts +0 -30
- package/lib/parse-exports.d.ts +0 -25
- package/lib/parsed-component-metadata.d.ts +0 -13
- package/lib/parser/bindings.d.ts +0 -4
- package/lib/parser/context.d.ts +0 -72
- package/lib/parser/contexts.d.ts +0 -19
- package/lib/parser/diagnostics.d.ts +0 -8
- package/lib/parser/events.d.ts +0 -21
- package/lib/parser/generics.d.ts +0 -24
- package/lib/parser/jsdoc.d.ts +0 -55
- package/lib/parser/prop-shared.d.ts +0 -84
- package/lib/parser/props.d.ts +0 -71
- package/lib/parser/rest-props.d.ts +0 -4
- package/lib/parser/runes-detection.d.ts +0 -13
- package/lib/parser/runes-props.d.ts +0 -18
- package/lib/parser/scopes.d.ts +0 -56
- package/lib/parser/slots.d.ts +0 -24
- package/lib/parser/source-position.d.ts +0 -26
- package/lib/parser/type-resolution.d.ts +0 -17
- package/lib/parser/typescript-casts.d.ts +0 -1
- package/lib/parser/utils.d.ts +0 -1
- package/lib/parser/variable-jsdoc.d.ts +0 -12
- package/lib/parser-stack.d.ts +0 -20
- package/lib/path.d.ts +0 -2
- package/lib/plugin.d.ts +0 -85
- package/lib/resolve-alias.d.ts +0 -30
- package/lib/resolve-types.d.ts +0 -52
- package/lib/sveld.d.ts +0 -29
- package/lib/svelte-parse.d.ts +0 -4
- package/lib/svelte-version.d.ts +0 -1
- package/lib/validate.d.ts +0 -13
- package/lib/watch.d.ts +0 -34
- package/lib/writer/MarkdownWriterBase.d.ts +0 -26
- package/lib/writer/Writer.d.ts +0 -31
- package/lib/writer/WriterMarkdown.d.ts +0 -31
- package/lib/writer/built-in-writers.d.ts +0 -1
- package/lib/writer/document-model.d.ts +0 -34
- package/lib/writer/format-generated-ts.d.ts +0 -8
- package/lib/writer/markdown-format-utils.d.ts +0 -20
- package/lib/writer/markdown-render-utils.d.ts +0 -10
- package/lib/writer/registry.d.ts +0 -17
- package/lib/writer/writer-custom-elements-core.d.ts +0 -86
- package/lib/writer/writer-custom-elements.d.ts +0 -15
- package/lib/writer/writer-json.d.ts +0 -27
- package/lib/writer/writer-markdown-core.d.ts +0 -32
- package/lib/writer/writer-markdown.d.ts +0 -23
- package/lib/writer/writer-ts-definitions-core.d.ts +0 -30
- package/lib/writer/writer-ts-definitions.d.ts +0 -43
package/lib/bundle.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { asRelativeSourcePath, type NormalizedPath } from "./brands";
|
|
2
|
-
import type { ParsedComponent } from "./ComponentParser";
|
|
3
|
-
import { type SveldDiagnostic } from "./diagnostics";
|
|
4
|
-
import { ParseCache } from "./parse-cache";
|
|
5
|
-
import { type EntryExports } from "./parse-entry-exports";
|
|
6
|
-
import { type ParsedExports } from "./parse-exports";
|
|
7
|
-
export interface ComponentDocApi extends ParsedComponent {
|
|
8
|
-
filePath: NormalizedPath;
|
|
9
|
-
moduleName: string;
|
|
10
|
-
}
|
|
11
|
-
export type ComponentDocs = Map<string, ComponentDocApi>;
|
|
12
|
-
/**
|
|
13
|
-
* A parse failure for a single component, captured so the rest of the run
|
|
14
|
-
* can continue. Surfaced via {@link GenerateBundleResult.errors}.
|
|
15
|
-
*/
|
|
16
|
-
export interface ComponentParseError {
|
|
17
|
-
filePath: string;
|
|
18
|
-
moduleName: string;
|
|
19
|
-
message: string;
|
|
20
|
-
stack?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface GenerateBundleResult {
|
|
23
|
-
exports: ParsedExports;
|
|
24
|
-
/** Entry-barrel exports other than components. Empty when `documentExports` is off. */
|
|
25
|
-
entryExports: EntryExports;
|
|
26
|
-
components: ComponentDocs;
|
|
27
|
-
allComponentsForTypes: ComponentDocs;
|
|
28
|
-
/**
|
|
29
|
-
* Components that failed to parse. Empty unless `failFast` is disabled and
|
|
30
|
-
* one or more components threw during parsing.
|
|
31
|
-
*/
|
|
32
|
-
errors: ComponentParseError[];
|
|
33
|
-
/** Unknown props, `any` contexts, and orphan `@event` tags across the bundle. */
|
|
34
|
-
diagnostics: SveldDiagnostic[];
|
|
35
|
-
}
|
|
36
|
-
export interface GenerateBundleOptions {
|
|
37
|
-
/**
|
|
38
|
-
* Throw on the first component that fails to parse instead of collecting
|
|
39
|
-
* the failure and continuing with the remaining components.
|
|
40
|
-
*/
|
|
41
|
-
failFast?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Load the TypeScript program to expand opaque imported whole-object `$props()`
|
|
44
|
-
* types into JSON/Markdown props. Off by default; requires `typescript`.
|
|
45
|
-
*/
|
|
46
|
-
resolveTypes?: boolean;
|
|
47
|
-
/** Record consts, functions, and types from the entry barrel. Off by default. */
|
|
48
|
-
documentExports?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Cache parsed component output to disk. Unchanged files skip re-parsing on
|
|
51
|
-
* later runs. On by default, writing to
|
|
52
|
-
* `node_modules/.cache/sveld/parse-cache.json`; a string sets a custom path.
|
|
53
|
-
* Pass `false` to disable.
|
|
54
|
-
*/
|
|
55
|
-
cache?: boolean | string;
|
|
56
|
-
/**
|
|
57
|
-
* Run plain TS/JS `@example` blocks on props, module exports, slots, and
|
|
58
|
-
* events through the TypeScript program. Broken examples become
|
|
59
|
-
* `example-compile-error` diagnostics. Svelte/HTML markup is skipped.
|
|
60
|
-
* Off by default. Requires `typescript`.
|
|
61
|
-
*/
|
|
62
|
-
checkExamples?: boolean;
|
|
63
|
-
}
|
|
64
|
-
export declare function toGenerateBundleOptions(opts?: Pick<GenerateBundleOptions, "failFast" | "resolveTypes" | "documentExports" | "cache" | "checkExamples">): GenerateBundleOptions;
|
|
65
|
-
/** A function that resolves a (possibly relative) component path to an absolute path. */
|
|
66
|
-
export type ResolveComponentFilePath = (filePath: string) => string;
|
|
67
|
-
/** Options controlling how a single component parse failure is handled. */
|
|
68
|
-
export interface ProcessComponentOptions {
|
|
69
|
-
/** Rethrow on parse failure instead of reporting it via `onParseError`. */
|
|
70
|
-
failFast?: boolean;
|
|
71
|
-
/** Invoked with a diagnostic when a component fails to parse (and `failFast` is off). */
|
|
72
|
-
onParseError?: (error: ComponentParseError) => void;
|
|
73
|
-
/** When set, reuse a component's previous parse if its content hash is unchanged. */
|
|
74
|
-
cache?: ParseCache;
|
|
75
|
-
/** Resolved file path -> sha256, computed once up front so it isn't re-hashed per pass. */
|
|
76
|
-
hashes?: Map<string, string>;
|
|
77
|
-
/**
|
|
78
|
-
* In-run memo of freshly parsed components, keyed by resolved file path and
|
|
79
|
-
* shared across the exported and all-components passes so a component that
|
|
80
|
-
* appears in both is only parsed once. Only fresh parses are stored here
|
|
81
|
-
* (never disk-cache hits), and an entry is cleared wherever the disk cache
|
|
82
|
-
* is invalidated so the `@extends` dependency-invalidation flow still forces
|
|
83
|
-
* a re-parse.
|
|
84
|
-
*/
|
|
85
|
-
memo?: Map<string, ParsedComponent>;
|
|
86
|
-
}
|
|
87
|
-
export declare function stripTopLevelStyleBlock(source: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* Discovered component sources for an entry point, before parsing.
|
|
90
|
-
*
|
|
91
|
-
* `exports` holds explicitly exported components (used for JSON/Markdown);
|
|
92
|
-
* `allComponents` additionally includes glob-discovered components (used for
|
|
93
|
-
* `.d.ts` generation). `resolveComponentFilePath` maps a component `source`
|
|
94
|
-
* to its absolute path on disk.
|
|
95
|
-
*/
|
|
96
|
-
export interface CollectedComponents {
|
|
97
|
-
exports: ParsedExports;
|
|
98
|
-
allComponents: ParsedExports;
|
|
99
|
-
rootDir: string;
|
|
100
|
-
resolveComponentFilePath: ResolveComponentFilePath;
|
|
101
|
-
}
|
|
102
|
-
/** A `.svelte` file discovered on disk, before it's merged into `exports`/`allComponents`. */
|
|
103
|
-
export interface GlobbedComponentSource {
|
|
104
|
-
moduleName: string;
|
|
105
|
-
source: ReturnType<typeof asRelativeSourcePath>;
|
|
106
|
-
}
|
|
107
|
-
/** Globs every `.svelte` file under `rootDir`, resolving each to its module name and source path. */
|
|
108
|
-
export declare function globComponentSources(rootDir: string): GlobbedComponentSource[];
|
|
109
|
-
/**
|
|
110
|
-
* Discovers component sources for an entry point without parsing them.
|
|
111
|
-
*
|
|
112
|
-
* Parses the entry's exports (when `input` is a file) and, when `glob` is set,
|
|
113
|
-
* augments the set with every `.svelte` file under the entry directory.
|
|
114
|
-
*
|
|
115
|
-
* @param documentExports - When `true`, log and continue if the entry file fails
|
|
116
|
-
* the acorn component-export parse (TypeScript-only syntax is common).
|
|
117
|
-
*/
|
|
118
|
-
export declare function collectComponents(input: string, glob: boolean, documentExports?: boolean): CollectedComponents;
|
|
119
|
-
/**
|
|
120
|
-
* Reads the given component file paths into a map of path -> contents.
|
|
121
|
-
*
|
|
122
|
-
* Failed reads are recorded as `null` (and logged) so callers can skip them
|
|
123
|
-
* gracefully rather than aborting the whole bundle.
|
|
124
|
-
*/
|
|
125
|
-
export declare function readFileMap(filePaths: Iterable<string>): Promise<Map<string, string | null>>;
|
|
126
|
-
/**
|
|
127
|
-
* Parses a single component entry into its documentation API.
|
|
128
|
-
*
|
|
129
|
-
* Reads the component contents from `fileMap`, removes top-level styles for
|
|
130
|
-
* metadata parsing, and parses it to extract component metadata. Returns `null`
|
|
131
|
-
* for non-Svelte entries or files that could not be read.
|
|
132
|
-
*
|
|
133
|
-
* A component that throws while parsing is captured via `options.onParseError`
|
|
134
|
-
* (and `null` is returned) so callers can continue with the rest, unless
|
|
135
|
-
* `options.failFast` is set, in which case the error is rethrown.
|
|
136
|
-
*
|
|
137
|
-
* @param entry - Export entry tuple `[exportName, exportInfo]`
|
|
138
|
-
* @param entries - All sibling entries, used to resolve the module name
|
|
139
|
-
* @param fileMap - Map of resolved file paths to their contents
|
|
140
|
-
* @param resolveComponentFilePath - Resolves a component `source` to its absolute path
|
|
141
|
-
* @param options - Parse-failure handling (`failFast` / `onParseError`)
|
|
142
|
-
*/
|
|
143
|
-
export declare function processComponent([exportName, entry]: [string, ParsedExports[string]], entries: Array<[string, ParsedExports[string]]>, fileMap: Map<string, string | null>, resolveComponentFilePath: ResolveComponentFilePath, options?: ProcessComponentOptions): ComponentDocApi | null;
|
|
144
|
-
export declare function collectSvelteFilePaths(entriesList: Array<Array<[string, ParsedExports[string]]>>, resolveComponentFilePath: ResolveComponentFilePath): Set<string>;
|
|
145
|
-
export declare function reportParseErrors(errors: ComponentParseError[]): void;
|
|
146
|
-
/**
|
|
147
|
-
* Generates component documentation bundle from Svelte source files.
|
|
148
|
-
*
|
|
149
|
-
* Parses exports, discovers components (optionally via glob), and processes
|
|
150
|
-
* all Svelte files to extract component metadata. Returns both exported
|
|
151
|
-
* components (for JSON/Markdown) and all components (for TypeScript definitions).
|
|
152
|
-
*
|
|
153
|
-
* A single component that fails to parse is captured as a diagnostic (see
|
|
154
|
-
* {@link GenerateBundleResult.errors}) so the remaining components still emit
|
|
155
|
-
* output. Pass `{ failFast: true }` to restore abort-on-first-error behavior.
|
|
156
|
-
*
|
|
157
|
-
* @param input - Entry point file or directory containing Svelte components
|
|
158
|
-
* @param glob - Whether to glob for all .svelte files in the directory
|
|
159
|
-
* @param options - Bundle options (e.g. `failFast`, `resolveTypes`, `documentExports`)
|
|
160
|
-
* @returns Bundle result containing exports, entryExports, components, allComponentsForTypes, and errors
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```ts
|
|
164
|
-
* // Generate from single file:
|
|
165
|
-
* const result = await generateBundle("./src/App.svelte", false);
|
|
166
|
-
*
|
|
167
|
-
* // Generate from directory with glob:
|
|
168
|
-
* const result = await generateBundle("./src", true);
|
|
169
|
-
*
|
|
170
|
-
* // Abort on the first parse failure:
|
|
171
|
-
* const result = await generateBundle("./src", true, { failFast: true });
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
export declare function generateBundle(input: string, glob: boolean, options?: GenerateBundleOptions): Promise<GenerateBundleResult>;
|
package/lib/check.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ComponentDocs } from "./bundle";
|
|
2
|
-
import type { SveldRuntimeOptions } from "./load-config";
|
|
3
|
-
import type { EntryExports } from "./parse-entry-exports";
|
|
4
|
-
import { type ComponentApiDocument } from "./writer/document-model";
|
|
5
|
-
export type SemverBump = "major" | "minor" | "patch" | "none";
|
|
6
|
-
/** One API diff between the committed snapshot and the current parse. */
|
|
7
|
-
export interface ApiChange {
|
|
8
|
-
/** Component `moduleName` this change belongs to, or `"*"` for document-wide notices. */
|
|
9
|
-
component: string;
|
|
10
|
-
kind: "component" | "prop" | "moduleExport" | "event" | "slot" | "shape";
|
|
11
|
-
/** Prop, event, slot, or shape-field name, when applicable. */
|
|
12
|
-
name?: string;
|
|
13
|
-
bump: SemverBump;
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
export interface CheckResult {
|
|
17
|
-
/** `false` when there was nothing on disk to diff against (e.g. first run). */
|
|
18
|
-
snapshotExists: boolean;
|
|
19
|
-
snapshotFile: string;
|
|
20
|
-
changes: ApiChange[];
|
|
21
|
-
/** Highest bump across all changes. */
|
|
22
|
-
bump: SemverBump;
|
|
23
|
-
}
|
|
24
|
-
/** Diffs two `COMPONENT_API.json` documents and assigns a semver bump to each change. */
|
|
25
|
-
export declare function diffApiDocuments(previous: ComponentApiDocument, next: ComponentApiDocument): ApiChange[];
|
|
26
|
-
export interface RunCheckOptions {
|
|
27
|
-
/** Entry-barrel exports when `documentExports` is on. */
|
|
28
|
-
entryExports?: EntryExports;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolves the snapshot path for `check`: an explicit string wins, otherwise
|
|
32
|
-
* it falls back to the `json` writer's `outFile`, or `COMPONENT_API.json`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveCheckSnapshotFile(options: Pick<SveldRuntimeOptions, "check" | "jsonOptions">): string;
|
|
35
|
-
/**
|
|
36
|
-
* Diffs the current component set against a committed `COMPONENT_API.json`
|
|
37
|
-
* snapshot and assigns a semver bump to each change. Returns
|
|
38
|
-
* `snapshotExists: false` when no snapshot file exists yet, so the first
|
|
39
|
-
* run does not fail CI.
|
|
40
|
-
*/
|
|
41
|
-
export declare function runCheck(components: ComponentDocs, snapshotFile: string, options?: RunCheckOptions): Promise<CheckResult>;
|
|
42
|
-
/** Groups changes by component for CLI output. */
|
|
43
|
-
export declare function formatCheckReport(result: CheckResult): string;
|
package/lib/chunk-72hx9e9w.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{A as m,B as KO,C as vO,D as gO,E as yO,F as S0,G as xO,H as uO,I as eO,J as IO,K as O1,L as mO,u as ZO,x as tO,y as v,z as r0}from"./chunk-xkrgedm4.js";import{M as b0}from"./chunk-v4q9vw0y.js";class R0{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(O)=>this.replacement=O}}replace(O,Z,$,Q){if(O&&Z)if($!=null)O[Z][$]=Q;else O[Z]=Q}remove(O,Z,$){if(O&&Z)if($!==null&&$!==void 0)O[Z].splice($,1);else delete O[Z]}}class T0 extends R0{constructor(O,Z){super();this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:($)=>this.replacement=$},this.enter=O,this.leave=Z}visit(O,Z,$,Q){if(O){if(this.enter){let Y=this.should_skip,X=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let q=this.should_skip,z=this.should_remove;if(this.should_skip=Y,this.should_remove=X,this.replacement=K,q)return O;if(z)return null}let W;for(W in O){let Y=O[W];if(Y&&typeof Y==="object"){if(Array.isArray(Y)){let X=Y;for(let K=0;K<X.length;K+=1){let q=X[K];if($O(q)){if(!this.visit(q,O,W,K))K--}}}else if($O(Y))this.visit(Y,O,W,null)}}if(this.leave){let Y=this.replacement,X=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let K=this.should_remove;if(this.replacement=Y,this.should_remove=X,K)return null}}return O}}function $O(O){return O!==null&&typeof O==="object"&&"type"in O&&typeof O.type==="string"}function Q0(O,{enter:Z,leave:$}){return new T0(Z,$).visit(O,null)}function e(O){return typeof O==="object"&&O!==null}function QO(O){return e(O)&&O.type==="VariableDeclaration"&&Array.isArray(O.declarations)}function G0(O){return e(O)&&O.type==="Literal"}function O0(O){return e(O)&&O.type==="Identifier"&&typeof O.name==="string"}function WO(O){return e(O)&&O.type==="MemberExpression"}function A0(O){return e(O)&&O.type==="ObjectExpression"&&Array.isArray(O.properties)}function Z1(O){return e(O)&&O.type==="CallExpression"}function Z0(O,Z){if(!Z1(O))return!1;return!!O.callee&&e(O.callee)&&O.callee.type==="Identifier"&&O.callee.name===Z}function X0(O){if(e(O)&&(O.type==="TSAsExpression"||O.type==="TSSatisfiesExpression")&&"expression"in O)return X0(O.expression);return O}function YO(O){if(e(O)&&(O.type==="TSAsExpression"||O.type==="TSSatisfiesExpression")&&"typeAnnotation"in O)return O.typeAnnotation;return}function $1(O){return e(O)&&O.type==="NewExpression"}function N0(O,Z){if(!$1(O))return!1;return!!O.callee&&e(O.callee)&&O.callee.type==="Identifier"&&O.callee.name===Z}var qO={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function Q1(O){return O in qO}function XO(O){if(Q1(O))return qO[O];return"HTMLElement"}var W1=/\w/;function Y1(O,Z){let $=O.trim();if(!$.startsWith("{")||!$.endsWith("}"))return;let Q=$.slice(1,-1),W=[],Y=0,X="";for(let K of Q)if(K==="{"||K==="<"||K==="("||K==="[")Y++,X+=K;else if(K==="}"||K===">"||K===")"||K==="]")Y--,X+=K;else if((K===";"||K===",")&&Y===0)W.push(X.trim()),X="";else X+=K;if(X.trim())W.push(X.trim());for(let K of W){if(!K.startsWith(Z))continue;let q=K.slice(Z.length);if(q.length>0&&W1.test(q[0]))continue;let z=q.trimStart();if(z.startsWith("?"))z=z.slice(1).trimStart();if(z.startsWith(":"))return z.slice(1).trim()}return}function I0(O,Z,$){let Q=$;if(Q.computed||Q.object?.type!=="Identifier"||Q.property?.type!=="Identifier")return;let W=Q.object.name,Y=Q.property.name;if(!W||!Y)return;if(O.wholePropsLocals.has(W))return Z.getPropTypeByLocalOrPublic(Y);let X=Z.getPropTypeByLocalOrPublic(W)??Z.findVariableTypeAndDescription(W)?.type;if(!X)return;return Y1(X,Y)}function v0(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1}}function W0(O,Z,$,Q,W){O.diagnosticRecords.push({component:O.componentFilePath,kind:Z,name:$,message:Q,...W?{source:W}:{}})}function a(O){return O===void 0||O===""?void 0:O}var q1=/[\r\n]+/g;function j0(O,Z,$,Q){if(a($)===void 0)return;if(O.trackPropLocalName($),Z.props.has($)){let W=Z.props.get($);Z.props.set($,{...W,...Q})}else Z.props.set($,Q)}function z0(O,Z,$,Q=0){let W,Y,X=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:W,type:Y,isFunction:X};let K=j1(O,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end)?.replace(q1," ");if(Y=W,X=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let z=$;if(z.left&&typeof z.left==="object"&&"type"in z.left&&z.left.type==="Literal"&&"value"in z.left&&typeof z.left.value==="string")Y="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")Y=zO($),W=void 0}else if($.type==="UnaryExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end);if(q.argument){if(typeof q.argument==="object"&&"type"in q.argument&&q.argument.type==="UnaryExpression")Y=z0(O,Z,q.argument).type;else if(typeof q.argument==="object"&&"value"in q.argument)Y=typeof q.argument.value}}else if($.type==="NewExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end);if(q.callee&&typeof q.callee==="object"&&"type"in q.callee&&q.callee.type==="Identifier"){let z=q.callee.name;if(z==="Date")Y="Date";else if(z==="Map")Y="Map<any, any>";else if(z==="Set")Y="Set<any>";else if(z==="WeakMap")Y="WeakMap<object, any>";else if(z==="WeakSet")Y="WeakSet<object>";else if(z==="Array")Y="any[]";else if(z==="RegExp"||z==="Regexp")Y="RegExp";else if(z==="Error")Y="Error";else Y=z}}else if($.type==="CallExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end)}else if($.type==="Identifier"){let q=$;if(Q<5){let z=X1(Z,q.name);if(z){let H=z0(O,Z,z,Q+1),w=O.resolveLocalVarJSDoc(q.name);return{...H,resolvedType:w?.type??H.resolvedType,resolvedDescription:w?.description??H.resolvedDescription,resolvedParams:w?.params??H.resolvedParams,resolvedReturnType:w?.returnType??H.resolvedReturnType}}if(Z.funcDecls.has(q.name)){let H=O.resolveLocalVarJSDoc(q.name),w=Z.funcDecls.get(q.name);return{value:void 0,type:void 0,isFunction:!0,resolvedType:H?.type??K1(H,w),resolvedDescription:H?.description,resolvedParams:H?.params,resolvedReturnType:H?.returnType}}}if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end)}else if($.type==="MemberExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end);if(O.isNumericConstant($))Y="number"}else if($.type==="TemplateLiteral"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=m(Z,q.start,q.end);Y="string"}else if("raw"in $&&typeof $.raw==="string"){if(W=$.raw,"value"in $)Y=$.value==null?void 0:typeof $.value}return{value:W,type:Y,isFunction:X,defaultValue:K}}function X1(O,Z){for(let $ of O.vars)for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init;return}function GO(O,Z){for(let $ of O.vars){if($.kind!=="const")continue;for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init}return}function K1(O,Z){let $=O?.returnType??"any",Q=O?.params;if(Q&&Q.length>0)return`(${Q.map((Y)=>`${Y.name}${Y.optional?"?":""}: ${Y.type}`).join(", ")}) => ${$}`;if(O?.returnType)return`() => ${$}`;if(Z)return zO(Z);return"(...args: any[]) => any"}function zO(O){return`(${G1(O)}) => ${z1(O)}`}function G1(O){let Z=O.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let Q of Z)if(Q&&typeof Q==="object"&&"type"in Q&&Q.type==="Identifier"&&"name"in Q&&typeof Q.name==="string")$.push(`${Q.name}: any`);else return"...args: any[]";return $.join(", ")}function z1(O){if(O.async||O.generator)return"any";let Z=O.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=H1(Z),$.length===0)return"any"}else $=[Z];let Q=null;for(let W of $){let Y=U1(W);if(!Y)return"any";if(Q===null)Q=Y;else if(Q!==Y)return"any"}return Q??"any"}function H1(O){let Z=[];return Q0(O,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function U1(O){if(!O||typeof O!=="object"||!("type"in O))return null;switch(O.type){case"Literal":{let Z=O.value;if(typeof Z==="string")return"string";if(typeof Z==="number")return"number";if(typeof Z==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let Z=O.callee;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="Identifier"){let $=Z.name;if($==="String")return"string";if($==="Number")return"number";if($==="Boolean")return"boolean"}return null}default:return null}}function HO(O){if(Z0(O,"$bindable"))return{init:O.arguments[0],bindable:!0};return{init:O,bindable:!1}}function j1(O,Z,$){let Q=KO(Z,$);if(!Q||!$||typeof $!=="object"||!("type"in $))return;let W="expression";if($.type==="Literal"||$.type==="UnaryExpression")W="literal";else if($.type==="TemplateLiteral")W=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")W="array";else if($.type==="ObjectExpression")W="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")W="function";let Y={raw:Q,kind:W};if(W==="literal"||W==="array"||W==="object"){let X=g0(O,$);if(X.ok)Y.value=X.value}return Y}function g0(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return{ok:!1};if(Z.type==="Literal"){let $=Z.value;return typeof $==="bigint"?{ok:!1}:{ok:!0,value:$}}if(Z.type==="UnaryExpression"){let $=Z,Q=$.argument;if(!Q||typeof Q!=="object"||!("type"in Q)||Q.type!=="Literal")return{ok:!1};let W=Q.value;if(typeof W==="number"){if($.operator==="-")return{ok:!0,value:-W};if($.operator==="+")return{ok:!0,value:W}}if(typeof W==="boolean"&&$.operator==="!")return{ok:!0,value:!W};return{ok:!1}}if(Z.type==="TemplateLiteral"){let $=Z;if($.expressions.length>0||$.quasis.length!==1)return{ok:!1};return{ok:!0,value:$.quasis[0].value.cooked??$.quasis[0].value.raw}}if(Z.type==="ArrayExpression"){let $=Z,Q=[];for(let W of $.elements){if(!W)return{ok:!1};let Y=g0(O,W);if(!Y.ok)return{ok:!1};Q.push(Y.value)}return{ok:!0,value:Q}}if(Z.type==="ObjectExpression"){let $=Z,Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)return{ok:!1};let Y=O.getPropertyName(W.key);if(!Y)return{ok:!1};let X=g0(O,W.value);if(!X.ok)return{ok:!1};Q[Y]=X.value}return{ok:!0,value:Q}}return{ok:!1}}var w1=/[-_.:/\s]+/;function y0(O){return`${O.split(w1).map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join("")}Context`}function M1(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let W=[];if(!A0($))return null;let Y=$;for(let X of Y.properties){if(X.type!=="Property")continue;let K=Z.getPropertyName(X.key);if(!K)continue;let q="any",z;if(O0(X.value)){let H=X.value.name,w=Z.findVariableTypeAndDescription(H);if(w)q=w.type,z=w.description;else W0(O,"context-any-type",K,`Context "${Q}" property "${K}" has no type annotation; defaulted to "any".`,v(O,X))}else if(X.value&&typeof X.value==="object"&&"type"in X.value&&(X.value.type==="ArrowFunctionExpression"||X.value.type==="FunctionExpression"))q=`(${X.value.params?.map((A)=>{if(O0(A))return`${A.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(G0(X.value))q=X.value.value==null?"null":typeof X.value.value;W.push({name:K,type:q,description:z,optional:!1})}return{key:Q,typeName:y0(Q),properties:W,description:void 0}}else if(O0($)){let W=$.name,Y=Z.findVariableTypeAndDescription(W);if(Y)return{key:Q,typeName:y0(Q),properties:[{name:W,type:Y.type,description:Y.description,optional:!1}]};return W0(O,"context-any-type",W,`Context "${Q}" variable "${W}" has no type annotation; defaulted to "any".`,v(O,$)),{key:Q,typeName:y0(Q),properties:[{name:W,type:"any",description:void 0,optional:!1}]}}return null}function UO(O){let Z=O.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",Q=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!Q)return null;let W=O.arguments[0];if(!W||typeof W!=="object"||!("type"in W))return"";if(W.type==="Literal"&&typeof W.value==="string")return W.value;if(W.type==="TemplateLiteral"&&W.quasis?.length===1)return W.quasis[0].value.cooked??"";return""}function jO(O,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let Q=Z;if(Q.type==="Literal")return typeof Q.value==="string"?Q.value:Q.value==null?null:String(Q.value);if(Q.type==="TemplateLiteral"){if(Q.quasis?.length===1){let W=Q.quasis[0].value.cooked;return W==null?null:W}return null}if(Q.type==="CallExpression"||Q.type==="NewExpression")return UO(Q);if(Q.type==="Identifier"){if($>=5)return null;let W=GO(O,Q.name);if(W&&typeof W==="object"&&"type"in W){let Y=W;if((Y.type==="CallExpression"||Y.type==="NewExpression")&&UO(Y)==="")return Q.name;return jO(O,Y,$+1)}return null}return null}function wO(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let W=$,Y=W.arguments[0];if(!Y)return;let X=jO(O,Y);if(!X){let z=O.componentFilePath?` in ${O.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${z}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=W.arguments[1];if(!K)return;let q=M1(O,Z,K,X);if(q&&!O.contexts.has(X))O.contexts.set(X,q)}function x0(O){return typeof O==="string"?JSON.stringify(O):String(O)}function w0(O,{name:Z,detail:$,has_argument:Q,description:W,deprecated:Y,tags:X,source:K}){if(Z===void 0)return;let q=!Q&&!$?"null":a($),z=W,H=O.events.get(Z);if(H?.type==="forwarded")O.events.set(Z,{type:"dispatched",name:Z,detail:q,description:z||H.description,deprecated:Y??H.deprecated,tags:X??H.tags,source:K||H.source});else if(H){let w=H.tags??X;O.events.set(Z,{...H,detail:H.detail===void 0?q:H.detail,description:H.description||z,deprecated:H.deprecated??Y,tags:w,source:K||H.source})}else O.events.set(Z,{type:"dispatched",name:Z,detail:q,description:z,deprecated:Y,tags:X,source:K})}function MO(O,Z){let $=Z.arguments[0],Q=N0($,"CustomEvent");if(!Q&&!N0($,"Event"))return;let W=$.arguments[0],Y=G0(W)?W.value:void 0;if(Y==null)return;let X=Q?$.arguments[1]:void 0,K=!1,q;if(A0(X)){let z=X.properties.find((H)=>H.type==="Property"&&O0(H.key)&&H.key.name==="detail");if(z?.type==="Property")K=!0,q=G0(z.value)?z.value.value:void 0}return w0(O,{name:String(Y),detail:q==null?"":x0(q),has_argument:K,source:v(O,Z)}),String(Y)}function u0(O,Z,$=!1){if(O.length===0)return"null";let Q=O.map(({name:W,type:Y,description:X,optional:K,default:q})=>{let z=K?"?":"",H=X||"";if(q&&H)H=`${H} @default ${q}`;else if(q)H=`@default ${q}`;if(H){if($)return`/** ${H} */
|
|
2
|
-
${W}${z}: ${Y};`;return`/** ${H} */ ${W}${z}: ${Y};`}return`${W}${z}: ${Y};`}).join($?`
|
|
3
|
-
`:" ");return $?`{
|
|
4
|
-
${Q}
|
|
5
|
-
}`:`{ ${Q} }`}var t;(function(O){O.start="/**",O.nostart="/***",O.delim="*",O.end="*/"})(t=t||(t={}));function m0(O){return/^\s+$/.test(O)}function JO(O){let Z=O.match(/\r+$/);return Z==null?["",O]:[O.slice(-Z[0].length),O.slice(0,-Z[0].length)]}function Y0(O){let Z=O.match(/^\s+/);return Z==null?["",O]:[O.slice(0,Z[0].length),O.slice(Z[0].length)]}function BO(O){return O.split(/\n/)}function VO(O={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},O)}function l0(O={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},O)}var J1=/^@\S+/;function d0({fence:O="```"}={}){let Z=B1(O),$=(Q,W)=>Z(Q)?!W:W;return function(W){let Y=[[]],X=!1;for(let K of W){if(J1.test(K.tokens.description)&&!X)Y.push([K]);else Y[Y.length-1].push(K);X=$(K.tokens.description,X)}return Y}}function B1(O){if(typeof O==="string")return(Z)=>Z.split(O).length%2===0;return O}function i0({startLine:O=0,markers:Z=t}={}){let $=null,Q=O;return function(Y){let X=Y,K=l0();if([K.lineEnd,X]=JO(X),[K.start,X]=Y0(X),$===null&&X.startsWith(Z.start)&&!X.startsWith(Z.nostart))$=[],K.delimiter=X.slice(0,Z.start.length),X=X.slice(Z.start.length),[K.postDelimiter,X]=Y0(X);if($===null)return Q++,null;let q=X.trimRight().endsWith(Z.end);if(K.delimiter===""&&X.startsWith(Z.delim)&&!X.startsWith(Z.end))K.delimiter=Z.delim,X=X.slice(Z.delim.length),[K.postDelimiter,X]=Y0(X);if(q){let z=X.trimRight();K.end=X.slice(z.length-Z.end.length),X=z.slice(0,-Z.end.length)}if(K.description=X,$.push({number:Q,source:Y,tokens:K}),Q++,q){let z=$.slice();return $=null,z}return null}}function c0({tokenizers:O}){return function($){var Q;let W=VO({source:$});for(let Y of O)if(W=Y(W),(Q=W.problems[W.problems.length-1])===null||Q===void 0?void 0:Q.critical)break;return W}}function F0(){return(O)=>{let{tokens:Z}=O.source[0],$=Z.description.match(/\s*(@(\S+))(\s*)/);if($===null)return O.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:O.source[0].number,critical:!0}),O;return Z.tag=$[1],Z.postTag=$[3],Z.description=Z.description.slice($[0].length),O.tag=$[2],O}}function C0(O="compact"){let Z=L1(O);return($)=>{let Q=0,W=[];for(let[K,{tokens:q}]of $.source.entries()){let z="";if(K===0&&q.description[0]!=="{")return $;for(let H of q.description){if(H==="{")Q++;if(H==="}")Q--;if(z+=H,Q===0)break}if(W.push([q,z]),Q===0)break}if(Q!==0)return $.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:$.source[0].number,critical:!0}),$;let Y=[],X=W[0][0].postDelimiter.length;for(let[K,[q,z]]of W.entries()){if(q.type=z,K>0)q.type=q.postDelimiter.slice(X)+z,q.postDelimiter=q.postDelimiter.slice(0,X);[q.postType,q.description]=Y0(q.description.slice(z.length)),Y.push(q.type)}return Y[0]=Y[0].slice(1),Y[Y.length-1]=Y[Y.length-1].slice(0,-1),$.type=Z(Y),$}}var V1=(O)=>O.trim();function L1(O){if(O==="compact")return(Z)=>Z.map(V1).join("");else if(O==="preserve")return(Z)=>Z.join(`
|
|
6
|
-
`);else return O}var R1=(O)=>O&&O.startsWith('"')&&O.endsWith('"');function P0(){let O=(Z,{tokens:$},Q)=>$.type===""?Z:Q;return(Z)=>{let{tokens:$}=Z.source[Z.source.reduce(O,0)],Q=$.description.trimLeft(),W=Q.split('"');if(W.length>1&&W[0]===""&&W.length%2===1)return Z.name=W[1],$.name=`"${W[1]}"`,[$.postName,$.description]=Y0(Q.slice($.name.length)),Z;let Y=0,X="",K=!1,q;for(let H of Q){if(Y===0&&m0(H))break;if(H==="[")Y++;if(H==="]")Y--;X+=H}if(Y!==0)return Z.problems.push({code:"spec:name:unpaired-brackets",message:"unpaired brackets",line:Z.source[0].number,critical:!0}),Z;let z=X;if(X[0]==="["&&X[X.length-1]==="]"){K=!0,X=X.slice(1,-1);let H=X.split("=");if(X=H[0].trim(),H[1]!==void 0)q=H.slice(1).join("=").trim();if(X==="")return Z.problems.push({code:"spec:name:empty-name",message:"empty name",line:Z.source[0].number,critical:!0}),Z;if(q==="")return Z.problems.push({code:"spec:name:empty-default",message:"empty default value",line:Z.source[0].number,critical:!0}),Z;if(!R1(q)&&/=(?!>)/.test(q))return Z.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:Z.source[0].number,critical:!0}),Z}if(Z.optional=K,Z.name=X,$.name=z,q!==void 0)Z.default=q;return[$.postName,$.description]=Y0(Q.slice($.name.length)),Z}}function h0(O="compact",Z=t){let $=s0(O);return(Q)=>{return Q.description=$(Q.source,Z),Q}}function s0(O){if(O==="compact")return A1;if(O==="preserve")return C1;return O}function A1(O,Z=t){return O.map(({tokens:{description:$}})=>$.trim()).filter(($)=>$!=="").join(" ")}var I1=(O,{tokens:Z},$)=>Z.type===""?O:$,F1=({tokens:O})=>(O.delimiter===""?O.start:O.postDelimiter.slice(1))+O.description;function C1(O,Z=t){if(O.length===0)return"";if(O[0].tokens.description===""&&O[0].tokens.delimiter===Z.start)O=O.slice(1);let $=O[O.length-1];if($!==void 0&&$.tokens.description===""&&$.tokens.end.endsWith(Z.end))O=O.slice(0,-1);return O=O.slice(O.reduce(I1,0)),O.map(F1).join(`
|
|
7
|
-
`)}function p0({startLine:O=0,fence:Z="```",spacing:$="compact",markers:Q=t,tokenizers:W=[F0(),C0($),P0(),h0($)]}={}){if(O<0||O%1>0)throw Error("Invalid startLine");let Y=i0({startLine:O,markers:Q}),X=d0({fence:Z}),K=c0({tokenizers:W}),q=s0($);return function(z){let H=[];for(let w of BO(z)){let A=Y(w);if(A===null)continue;let f=X(A),N=f.slice(1).map(K);H.push({description:q(f[0],Q),tags:N,source:A,problems:N.reduce((s,i)=>s.concat(i.problems),[])})}return H}}function P1(O){return O.start+O.delimiter+O.postDelimiter+O.tag+O.postTag+O.type+O.postType+O.name+O.postName+O.description+O.end+O.lineEnd}function o0(){return(O)=>O.source.map(({tokens:Z})=>P1(Z)).join(`
|
|
8
|
-
`)}var h1={line:0,start:0,delimiter:0,postDelimiter:0,tag:0,postTag:0,name:0,postName:0,type:0,postType:0,description:0,end:0,lineEnd:0};var V3=Object.keys(h1);function M0(O,Z={}){return p0(Z)(O)}var y3=o0();var f1=null;function D1(O,Z,$){let Q={value:void 0,replace:!1};if(!$||typeof $!=="object"||!("type"in $))return Q;if($.type==="Identifier")Q.value=$.name,Q.replace=!0;else if($.type==="Literal")Q.value=String($.value);else if($.type==="MemberExpression")Q.value=I0(O,Z,$);else if(($.type==="ObjectExpression"||$.type==="TemplateLiteral")&&"start"in $&&"end"in $&&typeof $.start==="number"&&typeof $.end==="number")Q.value=m(O,$.start,$.end);return Q}function LO(O,Z,$){let Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)continue;let Y=Z.getPropertyName(W.key);if(!Y)continue;Q[Y]=D1(O,Z,W.value)}return Q}function E1(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return null;if(Z.type==="Identifier"){let Y=Z,X=O.propLocalToPublicName.get(Y.name);if(!X)return null;return{publicName:X,trackingName:Y.name}}if(Z.type!=="MemberExpression")return null;let $=Z,Q=$.object&&typeof $.object==="object"&&"type"in $.object&&$.object.type==="Identifier"?$.object.name:void 0;if(!Q||!O.wholePropsLocals.has(Q))return null;let W;if(!$.computed&&$.property&&typeof $.property==="object"&&"type"in $.property){if($.property.type==="Identifier")W=$.property.name;else if($.property.type==="Literal"&&$.property.value!=null)W=String($.property.value)}else if($.computed&&$.property&&typeof $.property==="object"&&"type"in $.property&&$.property.type==="Literal"&&"value"in $.property&&$.property.value!=null)W=String($.property.value);if(!W)return null;return{publicName:W,trackingName:W}}function RO(O,Z){let $=Z;if($&&typeof $==="object"&&"type"in $&&$.type==="ChainExpression")$=$.expression;if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return null;let Q=$;if(!Q.callee||typeof Q.callee!=="object"||!("type"in Q.callee))return null;let W=E1(O,Q.callee);if(!W)return null;return{...W,arguments:Q.arguments}}function S1(O){return O===void 0||O===""?void 0:O}function J0(O,{slot_name:Z,slot_props:$,slot_fallback:Q,slot_description:W,slot_deprecated:Y,slot_tags:X,source:K}){let q=Z===void 0||Z==="",z=q?f1:Z??"",H=a(Q),w=S1($),A=W?.trim()||void 0;if(O.slots.has(z)){let f=O.slots.get(z);if(f)O.slots.set(z,{...f,default:f.default??q,fallback:H,slot_props:f.slot_props===void 0?w:f.slot_props,description:f.description||A,deprecated:f.deprecated??Y,tags:f.tags||X,source:K||f.source})}else O.slots.set(z,{name:z,default:q,fallback:H,slot_props:$,description:A,deprecated:Y,tags:X,source:K})}var b1=/\s*=\s*/;function AO(O){let Z=O.indexOf("<");if(Z===-1||!O.endsWith(">"))return O;let $=O.slice(0,Z),Q=O.slice(Z+1,-1),W=IO(Q).map((Y)=>Y.trim().replace(b1," = ")).join(", ");return`${$}<${W}>`}var _1=/^\s*$/,k1=/;$/,T1=/^-\s*/;function H0(O){if(O===void 0)return;let Z=O.replace(T1,"").trim();return Z===""?"":Z}function B0(O){if(!O||O.length===0)return;return O[0].tokens.description}var FO=new Set(["since","example"]);function CO(O){if(!O||O.length===0)return"";let Z=[];for(let $ of O){let Q=$.tokens;if((Q.end??"").trim()==="*/")break;if(Q.tag){let W=`${Q.name??""}${Q.postName??""}${Q.description??""}`.trimEnd();if(W)Z.push(W)}else Z.push(`${Q.postDelimiter??""}${Q.description??""}`)}return Z.join(`
|
|
9
|
-
`)}function N1(O){let Z=O.trim();return Z===""?!0:Z}function PO(O,Z){return N1(`${O??""}${Z?` ${Z}`:""}`)}function v1(O){let Z=O.trim().replace(k1,"").trimEnd();if(!Z.startsWith("{")||!Z.endsWith("}"))return!1;let $=0,Q=null;for(let W=0;W<Z.length;W++){let Y=Z[W];if(Q!==null){if(Y==="\\"){W++;continue}if(Y===Q)Q=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Q=Y;continue}if(Y==="{"||Y==="["||Y==="(")$++;else if(Y==="}"||Y==="]"||Y===")"){if($--,$===0&&W<Z.length-1)return!1}}return $===0}function g1(O){let Z=O;if(!Z.startsWith("/*"))Z=`/*${Z}`;if(!Z.endsWith("*/"))Z+="*/";return Z}function a0(O){let Z=O[0]?.tags??[],$=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Q,W=[],Y,X,K,q=[],z=[];for(let H of Z)if(H.tag==="type")Q=H;else if(H.tag==="param")W.push(H);else if(H.tag==="returns"||H.tag==="return")Y=H;else if(H.tag==="deprecated")K??=PO(H.name,H.description);else if(FO.has(H.tag))z.push(H);else if(H.tag==="bindable"){if(H.type)continue;let w=`${H.name}${H.description?` ${H.description}`:""}`.trim();if(w==="readonly"||w==="writable")X??=w}else if(!$.has(H.tag))q.push(H);return{type:Q,param:W,returns:Y,binding:X,deprecated:K,additional:q,passthrough:z,description:O[0]?.description}}function y1(O){if(!O||O.length===0)return;let Z=O[O.length-1];return Z&&typeof Z==="object"&&"value"in Z?Z:void 0}function x1(O,Z,$){if(!Z||Z.length===0||$===void 0||!O.source)return;for(let Q=Z.length-1;Q>=0;Q--){let W=Z[Q];if(!W||typeof W!=="object"||!("value"in W)||!("end"in W))continue;if(typeof W.end!=="number")continue;let Y=O.source.slice(W.end,$);if(_1.test(Y))return W}return}function K0(O,Z,$){if(!$?.leadingComments)return;let Q=x1(O,$.leadingComments,$.start);if(!Q)return;return u1(Z,[Q])}function hO(O,Z,$){if(!$?.leadingComments)return;return K0(O,Z,$)}function u1(O,Z){if(!Z)return;let $=y1(Z);if(!$)return;let Q=M0(g1($.value),{spacing:"preserve"}),{type:W,param:Y,returns:X,binding:K,deprecated:q,additional:z,passthrough:H,description:w}=a0(Q),A,f,N,s;if(W)A=O.aliasType(W.type);if(Y.length>0)f=Y.filter((b)=>!b.name.includes(".")).map((b)=>({name:b.name,type:O.aliasType(b.type),description:H0(b.description),optional:b.optional||!1}));if(X)N=O.aliasType(X.type);let i=a(w?.trim());if(i||z.length>0){let b=[];if(i)b.push(i);for(let G of z){let U=`@${G.tag}${G.name?` ${G.name}`:""}${G.description?` ${G.description}`:""}`;b.push(U)}s=b.join(`
|
|
10
|
-
`)}let x=H.length>0?H.map((b)=>({name:b.tag,body:CO(b.source)})):void 0;return{type:A,params:f,returnType:N,description:s,binding:K,deprecated:q,tags:x}}function fO(O,Z){if(!O.source)return;let $=0;for(let{tags:Q,description:W,source:Y}of M0(O.source,{spacing:"preserve"})){let X=Y.map((V)=>V.source).join(`
|
|
11
|
-
`),K=O.source.indexOf(X,$),q=K===-1?void 0:K;if(K!==-1)$=K+X.length;let z,H,w,A,f,N,s=[],i=[],x,b,G,U=[],J,F,j=[],M,L=!1,B=!0,I=[],T,S=new Map,u=new Set,p=new Set;for(let V of Q)if(V.source&&V.source.length>0)u.add(V.source[0].number);for(let V of Y)if(!V.tokens.tag&&V.tokens.description&&V.tokens.description.trim()!=="}")S.set(V.number,V.tokens.description);let $0=(V)=>{if(!V||V.length===0)return;let k=V[0].number,C=[],y=[],D=!1;for(let R=k-1;R>=1;R--){if(u.has(R))break;let P=S.get(R);if(P)C.unshift(P),y.unshift(R),D=!0;else if(D){let E=Y.find((h)=>h.number===R);if(!(!E||!E.tokens.tag&&(!E.tokens.description||E.tokens.description.trim()==="")))break}}if(C.length===0)return;for(let R of y)p.add(R);return C.join(`
|
|
12
|
-
`).trim()},_=()=>{if(z!==void 0){let V=H&&H!=="object"&&H!=="Object"?H:void 0,k;if(V)k=V;else if(i.length>0)k=u0(i,z,!0);else k=H||"";if(N!==void 0){let C;for(let R of Q){let P=R.source?.[0]?.number;if(typeof P!=="number")continue;if(P<=N)continue;if(R.tag==="property"||R.tag==="type")continue;C=P;break}let y=[],D=Array.from(S.keys()).sort((R,P)=>R-P);for(let R of D){if(R<=N)continue;if(C!==void 0&&R>=C)continue;if(p.has(R))continue;let E=S.get(R)?.trim();if(E)y.push(E),p.add(R)}if(y.length>0){let R=y.join(`
|
|
13
|
-
`);w=w?`${w}
|
|
14
|
-
${R}`:R}}w0(O,{name:z,detail:k,has_argument:!1,description:w,deprecated:A,tags:s.length>0?s:void 0,source:f}),O.eventDescriptions.set(z,w),O.jsDocEventNames.add(z),O.jsDocEventSources.set(z,f),i.length=0,z=void 0,H=void 0,w=void 0,A=void 0,f=void 0,N=void 0,s=[]}},o=()=>{if(x!==void 0){let V,k;if(U.length>0)V=u0(U,void 0,!0),k=`type ${x} = ${V};`;else if(b)V=b,k=v1(V)?`interface ${x} ${V}`:`type ${x} = ${V};`;else V="{}",k=`type ${x} = ${V};`;O.typedefs.set(x,{type:V,name:x,description:a(G),ts:k}),U.length=0,x=void 0,b=void 0,G=void 0}},c=()=>{if(J!==void 0){let C=`(${j.map(({name:D,type:R,optional:P})=>{return`${D}${P?"?":""}: ${R}`}).join(", ")}) => ${M||"void"}`,y=`type ${J} = ${C};`;O.typedefs.set(J,{type:C,name:J,description:a(F),ts:y}),j.length=0,M=void 0,J=void 0,F=void 0}},q0=Q.some((V)=>V.tag==="slot"||V.tag==="snippet"),n=Q.some((V)=>V.tag==="extends"||V.tag==="extendProps");for(let{tag:V,type:k,name:C,description:y,optional:D,default:R,source:P}of Q){let E=Z.aliasType(k),r=$0(P);switch(V){case"extends":case"extendProps":if(O.extends={interface:C,import:E},B)B=!1;break;case"restProps":{let h=C?y?`${C} ${y}`:C:y,k0=H0(h)||r;if(!k0&&B&&!L&&W)k0=W,L=!0;if(O.rest_props={type:"Element",name:E,description:k0||void 0},B)B=!1;break}case"slot":case"snippet":{let U0=H0(B0(P));if(!U0&&B&&!L&&W)U0=W,L=!0;if(!U0&&I.length===0)U0=r;if(B)B=!1;J0(O,{slot_name:C,slot_props:E,slot_description:U0||void 0,slot_deprecated:T,slot_tags:I.length>0?[...I]:void 0,source:r0(O,Y,P,q)}),I.length=0,T=void 0;break}case"event":{if(_(),z=C,H=E,N=P&&P.length>0?P[0].number:void 0,w=H0(B0(P))||r,!w&&B&&!L&&W)w=W,L=!0;if(f=r0(O,Y,P,q),B)B=!1;break}case"type":if(z!==void 0)H=E;break;case"param":if(J!==void 0)j.push({name:C,type:E,optional:D||!1});break;case"returns":case"return":if(J!==void 0)M=E;break;case"property":{let h={name:C,type:E,description:H0(B0(P)),optional:D||!1,default:R};if(z!==void 0)i.push(h);else if(x!==void 0)U.push(h);break}case"typedef":{if(o(),x=AO(C),b=E,G=H0(B0(P))||r,!G&&B&&!L&&W)G=W,L=!0;if(B)B=!1;break}case"callback":{if(c(),J=AO(C),F=H0(B0(P))||r,!F&&B&&!L&&W)F=W,L=!0;if(B)B=!1;break}case"generics":if(O.generics=[C,E],B)B=!1;break;case"template":{let h=C;if(E)h=`${C} extends ${E}`;if(R)h+=` = ${R}`;if(q0&&!n){O.deferredSlotBlockGenerics.push({name:C,constraint:h});break}if(Z.accumulateGeneric(C,h),B)B=!1;break}case"deprecated":{let h=PO(C,y);if(z===void 0)T??=h;else A??=h;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let h={name:V,body:CO(P)};if(z!==void 0&&FO.has(V))s.push(h);else I.push(h)}break}}_(),o(),c()}}function m1({hasTypeScriptType:O,hasJSDocType:Z,inferredType:$,finalType:Q}){if(O)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(Q!==void 0)return"inferred";return"unknown"}function V0(O){let Z=O.explicitType??O.jsdocType??O.resolvedType??O.typeSeed,$=O.jsdocParams??O.resolvedParams,Q=O.jsdocReturnType??O.resolvedReturnType;if(O.isFunctionDeclaration&&Z==="() => any"&&Q)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${Q}`:`() => ${Q}`;let W=O.jsdocDescription??O.resolvedDescription;if(W===void 0&&Z!==void 0)W=O.typedefs?.get(Z)?.description;let Y=m1({hasTypeScriptType:O.explicitType!==void 0,hasJSDocType:O.jsdocType!==void 0||O.jsdocParams!==void 0||O.jsdocReturnType!==void 0||O.resolvedType!==void 0,inferredType:O.inferredTypeForSource,finalType:Z}),X=O.initializerIsFunction||O.isFunctionDeclaration||O.inferIsFunctionFromTypeSignature===!0&&(!!O.jsdocParams?.length||O.jsdocReturnType!==void 0||!!O.jsdocType?.includes("=>")||!!O.resolvedType?.includes("=>")||!!O.explicitType?.includes("=>"));return{type:Z,typeSource:Y,description:W,params:$,returnType:Q,isFunction:X}}function l1(O){if(!O||typeof O!=="object"||!("type"in O))return;let Z=String(O.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in O&&typeof O.name==="string"?O.name:void 0;if(!$)return;let Q=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in O&&typeof O.tag==="string")Q.thisValue=O.tag;return Q}function DO(O,Z){if(O.rest_props!==void 0)return;let $=l1(Z);if($)O.rest_props=$}function d(O,Z,$){if(!Z||O.has(Z))return;O.set(Z,$)}function f0(O,Z){for(let $=O.activeScopes.length-1;$>=0;$-=1){let Q=O.activeScopes[$]?.get(Z);if(!Q)continue;return Q.kind==="prop"?Q.publicPropName:void 0}return}function g(O,Z=new Set){if(!O||typeof O!=="object"||!("type"in O))return Z;switch(O.type){case"Identifier":Z.add(O.name);break;case"AssignmentPattern":g(O.left,Z);break;case"ArrayPattern":for(let $ of O.elements)g($??void 0,Z);break;case"ObjectPattern":for(let $ of O.properties)if($.type==="Property")g($.value,Z);else if($.type==="RestElement")g($.argument,Z);break;case"RestElement":g(O.argument,Z);break}return Z}function e0(O,Z){let $=g(Z);if(!$)return;for(let Q of $){let W=f0(O,Q);if(W)O.reactive_vars.add(W)}}function D0(O){if(!O||typeof O!=="object"||!("type"in O))return!1;switch(String(O.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function EO(O){if(!O||typeof O!=="object"||!("type"in O))return!1;let Z=String(O.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function d1(O,Z){let $=O.scopeDeclarations.get(Z);if(!$)$=new Map,O.scopeDeclarations.set(Z,$);return $}function i1(O,Z,$){let Q=[];if($.id.type==="Identifier")return Q.push({kind:"local",name:$.id.name}),Q;if($.id.type!=="ObjectPattern")return Q;for(let W of $.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Q.push({kind:"local",name:W.argument.name});continue}if(W.computed)continue;let Y=O.getPropertyName(W.key);if(!Y)continue;let X;if(W.value.type==="Identifier")X=W.value.name;else if(W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier")X=W.value.left.name;if(!X)continue;Q.push({kind:"prop",name:X,publicPropName:Y})}return Q}function t0(O,Z,$,Q,W){if(!QO(Z))return;let Y=W?.allowRunesProps??!1,X=W?.forceProp??!1,K=Z;for(let q of K.declarations){if(Y&&Z0(X0(q.init),"$props")){for(let w of i1(O,K,q))d(w.kind==="prop"?$:Q,w.name,w.kind==="prop"?{kind:"prop",publicPropName:w.publicPropName}:{kind:"local"});continue}let z=K.kind==="var"?Q:$,H=X?"prop":"local";for(let w of g(q.id))d(z,w,H==="prop"?{kind:"prop",publicPropName:w}:{kind:"local"})}}function c1(O,Z){if("id"in O&&O.id&&typeof O.id==="object"&&"name"in O.id&&typeof O.id.name==="string")d(Z,O.id.name,{kind:"local"});for(let $ of O.params)for(let Q of g($))d(Z,Q,{kind:"local"})}function s1(O,Z,$,Q){if(!Array.isArray(Z))return;for(let W of Z){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"VariableDeclaration":t0(O,W,$,Q);break;case"FunctionDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break}}}function p1(O,Z,$){if(!$||typeof $!=="object")return;let Q="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!Q||!("body"in Q)||!Array.isArray(Q.body))return;for(let W of Q.body){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"ImportDeclaration":for(let Y of W.specifiers??[])if(Y.local?.name)d(Z.componentScope,Y.local.name,{kind:"local"});break;case"VariableDeclaration":t0(O,W,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!W.declaration||typeof W.declaration!=="object"||!("type"in W.declaration))break;if(W.declaration.type==="VariableDeclaration")t0(O,W.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(W.declaration.type==="FunctionDeclaration"&&W.declaration.id?.name)d(Z.componentScope,W.declaration.id.name,{kind:"prop",publicPropName:W.declaration.id.name});break}}}function SO(O,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,p1(O,Z,Z.parsed?.instance)}function bO(O){return{varScopeStack:[O.componentScope]}}function _O(O,Z,$,Q){if(!D0(Q))return;let W=d1(Z,Q),Y=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":c1(Q,W);break;case"BlockStatement":s1(O,Q.body,W,Y);break;case"CatchClause":if("param"in Q)for(let K of g(Q.param))d(W,K,{kind:"local"});break;case"EachBlock":{let K=Q;for(let q of g(K.context))d(W,q,{kind:"local"});if(typeof K.index==="string")d(W,K.index,{kind:"local"});else if(K.index&&"name"in K.index)d(W,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in Q)for(let K of g(Q.value))d(W,K,{kind:"local"});break;case"CatchBlock":if("error"in Q)for(let K of g(Q.error))d(W,K,{kind:"local"});break}if(EO(Q))$.varScopeStack.push(W)}function kO(O,Z){if(EO(Z))O.varScopeStack.pop()}var o1=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function n1(O,Z){switch(Z?.type){case"MemberExpression":return Z.computed||O===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return O===Z.meta;case"PropertyDefinition":return Z.computed||O===Z.value;case"Property":return Z.computed||O===Z.value;case"ExportSpecifier":case"ImportSpecifier":return O===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function r1(O,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(O))return!0;return!1}function a1(O){let Z=new Set;if(!O||typeof O!=="object"||!("type"in O))return Z;switch(String(O.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=O;if($.id?.name)Z.add($.id.name);for(let Q of $.params??[])g(Q,Z);break}case"BlockStatement":E0(O.body,Z);break;case"CatchClause":g(O.param,Z);break;case"EachBlock":{let $=O;if(g($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":g(O.value,Z);break;case"CatchBlock":g(O.error,Z);break}return Z}function E0(O,Z){if(!Array.isArray(O))return;for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let Q of $.specifiers??[])if(Q.local?.name)Z.add(Q.local.name);break;case"VariableDeclaration":for(let Q of $.declarations??[])g(Q.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let Q=$.id?.name;if(Q)Z.add(Q);break}case"ExportNamedDeclaration":{let Q=$.declaration;if(Q&&typeof Q==="object"&&"type"in Q)E0([Q],Z);break}}}}function OO(O,Z){if(!O||typeof O!=="object")return!1;let $=[...Z],Q=!1;return Q0(O,{enter(W,Y){if(Q){this.skip();return}if(D0(W))$.push(a1(W));if(Y&&W.type==="Identifier"&&o1.has(W.name)&&!Y.type.startsWith("TS")&&n1(W,Y)&&!r1(W.name,$))Q=!0,this.skip()},leave(W){if(D0(W))$.pop()}}),Q}function TO(O){if(!O||typeof O!=="object")return;if("content"in O){let Z=O.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in O&&Array.isArray(O.body))return O.body;return}function NO(O){if(O.runesOptionOverride!==void 0)return O.runesOptionOverride?"runes":"legacy";let Z=O.parsed;if(!Z)return"legacy";let $=new Set;E0(TO(Z.module),$);let Q=new Set;return E0(TO(Z.instance),Q),OO(Z.module,[$])||OO(Z.instance,[$,Q])||OO(Z.html,[$,Q])?"runes":"legacy"}var t1=/[A-Za-z_$][\w$]*/g;function e1(O,Z,$){let Q=new Map,W=Z.typeParameters?.params,Y=$.typeArguments?.params;if(!W?.length||!Y?.length)return Q;for(let X=0;X<W.length;X++){let K=W[X]?.name,q=Y[X];if(!K||q?.start===void 0||q?.end===void 0)continue;let z=m(O,q.start,q.end)?.trim();if(z)Q.set(K,z)}return Q}function O2(O,Z){if(Z.size===0)return O;return O.replace(t1,($)=>Z.get($)??$)}function L0(O,Z,$,Q,W=new Set){let Y=new Map;if(!$?.type)return Y;let X=(K)=>{for(let q of K){if(q?.type!=="TSPropertySignature"||q.computed)continue;if(!q.key)continue;let z=O.getPropertyName(q.key);if(!z)continue;let H=q.typeAnnotation?.start,w=q.typeAnnotation?.end;if(H===void 0||w===void 0)continue;let A=m(Z,H+1,w)?.trim();if(!A)continue;Y.set(z,{type:A,optional:q.optional===!0,source:v(Z,q)})}};switch($.type){case"TSTypeLiteral":X($.members??[]);break;case"TSInterfaceDeclaration":X($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=L0(O,Z,$.typeAnnotation,Q,W);for(let[q,z]of K)Y.set(q,z);break}case"TSTypeReference":{let K=yO($.typeName);if(!K||W.has(K))break;let q=Q.get(K);if(!q)break;W.add(K);let z=L0(O,Z,q,Q,W);W.delete(K);let H=e1(Z,q,$);for(let[w,A]of z)Y.set(w,H.size===0?A:{...A,type:O2(A.type,H)});break}case"TSIntersectionType":for(let K of $.types??[]){let q=L0(O,Z,K,Q,W);for(let[z,H]of q)Y.set(z,H)}break;case"TSParenthesizedType":{let K=L0(O,Z,$.typeAnnotation,Q,W);for(let[q,z]of K)Y.set(q,z);break}}return Y}function lO(O,Z){if(Z.runesPropsDeclarationMetadataByDeclaratorStart.clear(),Z.explicitPropTypesByName.clear(),Z.explicitVariableTypesByName.clear(),Z.typeImportBindingsByLocalName.clear(),Z.localTypeDeclarationsByName.clear(),Z.typedRunesPropsDeclarations.length=0,!Z.source)return;let $=b0(Z.source,{modern:!0});Z.scriptLanguage=O.resolveScriptLanguage($),Z.customElementTag=$.options?.customElement?.tag,Z.runesOptionOverride=$.options?.runes,Z.scriptGenericsAttribute=O.resolveScriptGenericsAttribute($);let Q=$.instance?.content?.body??[];for(let W of Q){if(!W?.type)continue;if(W.type==="ImportDeclaration"&&W.source?.value)for(let Y of W.specifiers??[]){let X=Y.local?.name;if(!X)continue;if(!(W.importKind==="type"||Y.importKind==="type"))continue;let q,z;if(Y.type==="ImportSpecifier")q="named",z=Y.imported?.type==="Identifier"?Y.imported.name:typeof Y.imported?.value==="string"?Y.imported.value:void 0;else if(Y.type==="ImportDefaultSpecifier")q="default";else if(Y.type==="ImportNamespaceSpecifier")q="namespace";if(!q)continue;Z.typeImportBindingsByLocalName.set(X,{importedName:z,localName:X,source:String(W.source.value),specifierType:q})}if((W.type==="TSInterfaceDeclaration"||W.type==="TSTypeAliasDeclaration")&&W.id?.name&&W.start!==void 0&&W.end!==void 0)Z.localTypeDeclarationsByName.set(W.id.name,{code:m(Z,W.start,W.end)?.trim()??"",node:W,start:W.start});if(W.type==="ExportNamedDeclaration"&&W.declaration?.type==="VariableDeclaration")for(let Y of W.declaration.declarations??[]){if(Y.id?.type!=="Identifier"||!Y.id.name)continue;let X=S0(Z,Y.id.typeAnnotation);if(X)Z.explicitPropTypesByName.set(Y.id.name,X)}else if(W.type==="VariableDeclaration")for(let Y of W.declarations??[]){if(Y.id?.type!=="Identifier"||!Y.id.name)continue;let X=S0(Z,Y.id.typeAnnotation);if(X)Z.explicitVariableTypesByName.set(Y.id.name,X)}}for(let W of Q){if(!W||typeof W!=="object"||!("declarations"in W))continue;for(let Y of W.declarations??[]){if(!Z0(X0(Y.init),"$props"))continue;let X=Y.id?.typeAnnotation?void 0:YO(Y.init),K=Y.id?.typeAnnotation?.typeAnnotation??X,q=Y.id?.typeAnnotation?S0(Z,Y.id.typeAnnotation):xO(Z,X),z=L0(O,Z,K,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([A,f])=>[A,f.node]))),H=new Set,w=new Set;if(uO(Z,K,H,w),mO(Z,H,w),Y.start!==void 0){let A={canonicalType:q,props:z,referencedImportedTypes:H,referencedLocalTypes:w};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(Y.start,A),q)Z.typedRunesPropsDeclarations.push(A)}}}}function dO(O,Z,$){for(let Q of $.declarations){if(!Z0(X0(Q.init),"$props"))continue;if(Q.id.type==="Identifier"){Z.wholePropsLocals.add(Q.id.name),Z.restPropLocals.add(Q.id.name);let X=vO(Z,Q.start);if(X)for(let[K,q]of X.props)j0(O,Z,K,{name:K,kind:"let",type:q.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!q.optional,constant:!1,reactive:!1,source:q.source});continue}if(Q.id.type!=="ObjectPattern")continue;let W=K0(Z,O,$),Y=Q.id.properties.filter((X)=>{if(X.type!=="Property"||X.computed)return!1;if(!O.getPropertyName(X.key))return!1;if(X.value.type==="Identifier")return!0;return X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier"}).length;for(let X of Q.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")Z.restPropLocals.add(X.argument.name);continue}let K=O.getPropertyName(X.key);if(!K)continue;let q,z;if(X.value.type==="Identifier")q=X.value.name;else{let B=X.value;q=B.left.name,z=B.right}if(!q)continue;if(O.trackPropLocalName(K,q),K==="children")Z.snippetPropLocals.add(q);let H=hO(Z,O,X)??(Y===1?W:void 0),w=gO(Z,Q.start,K),{init:A,bindable:f}=HO(z),N=A==null?{isFunction:!1}:z0(O,Z,A),{value:s,type:i,isFunction:x,defaultValue:b}=N,G=w?.type===void 0&&H?.type===void 0?N.resolvedType:void 0,{type:U,typeSource:J,description:F,params:j,returnType:M,isFunction:L}=V0({explicitType:w?.type,typeSeed:i,inferredTypeForSource:i,jsdocType:H?.type,jsdocDescription:H?.description,jsdocParams:H?.params,jsdocReturnType:H?.returnType,resolvedType:G,resolvedDescription:N.resolvedDescription,resolvedParams:N.resolvedParams,resolvedReturnType:N.resolvedReturnType,initializerIsFunction:x,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(f)Z.reactive_vars.add(K);j0(O,Z,K,{name:K,...q===K?{}:{localName:q},kind:"let",description:F,binding:H?.binding,deprecated:H?.deprecated,tags:H?.tags,...f?{bindable:!0}:{},type:U,typeSource:J,value:s,defaultValue:b,params:j,returnType:M,isFunction:L,isFunctionDeclaration:!1,isRequired:A==null&&w?.optional!==!0,constant:!1,reactive:f,source:v(Z,X)})}}}function iO(O,Z){if(O.syntaxMode!=="runes")return;for(let[$,Q]of Array.from(O.events.entries())){if(Q.type!=="dispatched")continue;if(Z.has($)||O.forwardedEvents.has($))continue;let W=`on${$}`,Y=O.props.get(W);if(!Y)continue;let X=Y.type!==void 0||Y.params!==void 0||Y.returnType!==void 0,K=Q.detail===void 0||Q.detail==="undefined"||Q.detail==="null"?"() => void":`(detail: ${Q.detail}) => void`;O.props.set(W,{...Y,description:Y.description??Q.description,type:X?Y.type:K,typeSource:X?Y.typeSource:"inferred",isFunction:!0}),O.events.delete($)}}var cO=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function _0(O){if(!O||typeof O!=="object")return;Q0(O,{enter(Z){if(!cO.has(Z.type))return;let $=Z.expression;while($&&cO.has($.type))$=$.expression;if($)this.replace($)}})}var Z2=/^\s*$/;function pO(O,Z,$){let Q=Z+1;while(Q<O.length){if(O[Q]==="\\"){Q+=2;continue}if(O[Q]===$)return Q+1;Q++}return Q}function oO(O,Z){let $=Z+1,Q=0;while($<O.length){let W=O[$];if(W==="\\"){$+=2;continue}if(Q===0){if(W==="`")return $+1;if(W==="$"&&O[$+1]==="{"){Q=1,$+=2;continue}$++;continue}if(W==="{")Q++;else if(W==="}")Q--;else if(W==='"'||W==="'"){$=pO(O,$,W);continue}else if(W==="`"){$=oO(O,$);continue}$++}return $}function $2(O,Z){let $=[],Q=O.length,W=0;while(W<Q){let Y=O[W];if(Y==='"'||Y==="'"){W=pO(O,W,Y);continue}if(Y==="`"){W=oO(O,W);continue}if(Y==="/"&&O[W+1]==="/"){let X=W+2;while(X<Q&&O[X]!==`
|
|
15
|
-
`)X++;W=X;continue}if(Y==="/"&&O[W+1]==="*"){let X=W,K=W+2;while(K<Q&&!(O[K]==="*"&&O[K+1]==="/"))K++;let q=Math.min(K+2,Q),z=O.slice(X,q);$.push({end:q+Z,isJsDoc:z.startsWith("/**")&&z.length>4,text:z}),W=q;continue}W++}return $}function sO(O,Z,$){if(!O||typeof O!=="object"||!("type"in O))return;let Q=O;if(Q.type==="FunctionDeclaration"){if(Q.id?.type==="Identifier"&&Q.id.name)$.push({name:Q.id.name,start:Z});return}if(Q.type==="VariableDeclaration"){for(let W of Q.declarations??[])if(W?.id?.type==="Identifier"&&W.id.name)$.push({name:W.id.name,start:Z})}}function Q2(O){let Z=[];for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;let Q=$;if(Q.start===void 0)continue;if(Q.type==="ExportNamedDeclaration"&&Q.declaration)sO(Q.declaration,Q.start,Z);else sO(Q,Q.start,Z)}return Z}function W2(O,Z,$){let Q;for(let W of O){if(W.end>Z)break;if(!W.isJsDoc)continue;if(!Z2.test($.slice(W.end,Z)))continue;Q=W}return Q}function nO(O,Z){let $=new Map;if(!O.source)return $;let Q=[O.parsed?.module,O.parsed?.instance],W=[],Y=[];for(let X of Q){let K=X?.content;if(!K?.body||K.start===void 0||K.end===void 0)continue;W.push(...$2(O.source.slice(K.start,K.end),K.start)),Y.push(...Q2(K.body))}W.sort((X,K)=>X.end-K.end);for(let X of Y){let K=W2(W,X.start,O.source);if(!K)continue;let q=M0(K.text,{spacing:"preserve"}),{type:z,description:H}=a0(q);if(!z)continue;$.set(X.name,{type:Z.aliasType(z.type),description:H||z.description})}return $}function rO(O){if(O==="var")return"let";if(O==="using"||O==="await using")return"const";return O}var Y2=null,aO=/^@component/,q2=/\r/g,X2=/^\{\s*\}$/;class l{ctx=v0();static mapToArray(O){return Array.from(O,([Z,$])=>$)}static getStaticAttributeValue(O){if(!Array.isArray(O.value))return;return O.value.map((Z)=>Z.data??Z.raw??"").join("").trim()}resolveScriptLanguage(O){let Z=[O.instance,O.module].filter((Q)=>Q!==void 0),$=!1;for(let Q of Z){let W=Q.attributes?.find((X)=>X.name==="lang");if(!W){$=!0;continue}if(l.getStaticAttributeValue(W)?.toLowerCase()==="ts")return"ts"}return $?"js":void 0}resolveScriptGenericsAttribute(O){let Z=O.instance?.attributes?.find((X)=>X.name==="generics");if(!Z)return;let $=v(this.ctx,Z),Q=O.instance?.attributes?.find((X)=>X.name==="lang");if((Q?l.getStaticAttributeValue(Q)?.toLowerCase():void 0)!=="ts"){W0(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',$);return}let Y=l.getStaticAttributeValue(Z);if(!Y)return;return{value:Y,source:$}}static assignValue(O){return a(O)}resolvePublicPropName(O){return this.ctx.propLocalToPublicName.get(O)??O}trackPropLocalName(O,Z=O){this.ctx.propLocalToPublicName.set(Z,O)}getPropByLocalOrPublic(O){return this.ctx.props.get(this.resolvePublicPropName(O))}getPropTypeByLocalOrPublic(O){return this.getPropByLocalOrPublic(O)?.type}getExplicitPropType(O){return this.ctx.explicitPropTypesByName.get(O)}getPropertyName(O){if(!O||typeof O!=="object"||!("type"in O))return;if(O0(O))return O.name;if(G0(O))return O.value==null?void 0:String(O.value);return}isNumericConstant(O){if(!O||typeof O!=="object"||!("type"in O))return!1;if(O.type!=="MemberExpression")return!1;let Z=O,$=Z.object&&"name"in Z.object?Z.object.name:void 0,Q=Z.property&&"name"in Z.property?Z.property.name:void 0;if(!$||!Q)return!1;if($==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(Q);if($==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(Q);return!1}resolveLocalVarJSDoc(O){for(let $ of this.ctx.vars)if($.declarations.some((W)=>W.id&&typeof W.id==="object"&&("type"in W.id)&&W.id.type==="Identifier"&&("name"in W.id)&&W.id.name===O))return K0(this.ctx,this,$);let Z=this.ctx.funcDecls.get(O);if(Z)return K0(this.ctx,this,Z);return}addModuleExport(O,Z){if(l.assignValue(O)===void 0)return;if(this.ctx.moduleExports.has(O)){let $=this.ctx.moduleExports.get(O);this.ctx.moduleExports.set(O,{...$,...Z})}else this.ctx.moduleExports.set(O,Z)}aliasType(O){if(O==="*")return"any";return O.trim()}findVariableTypeAndDescription(O){let Z=this.getPropByLocalOrPublic(O);if(Z?.type)return{type:Z.type,description:Z.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=nO(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let $=this.ctx.variableInfoCache.get(O),Q=this.ctx.explicitVariableTypesByName.get(O);if(Q)return{type:Q,description:$?.description};return $??null}accumulateGeneric(O,Z){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${O}`,`${this.ctx.generics[1]}, ${Z}`];else this.ctx.generics=[O,Z]}cleanup(){this.ctx=v0()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(O){return l.SCRIPT_BLOCK_REGEX.lastIndex=0,O.replace(l.SCRIPT_BLOCK_REGEX,(Z,$,Q,W)=>{l.TS_DIRECTIVE_REGEX.lastIndex=0;let Y=Q.replace(l.TS_DIRECTIVE_REGEX,"");return $+Y+W})}parseSvelteComponent(O,Z){this.cleanup(),this.ctx.componentFilePath=Z.filePath;let $=l.stripTypeScriptDirectivesFromScripts(O);if(this.ctx.source=$,lO(this,this.ctx),this.ctx.parsed=b0($,{modern:!1}),this.ctx.scriptLanguage==="ts")_0(this.ctx.parsed.module),_0(this.ctx.parsed.instance),_0(this.ctx.parsed.html);if(this.ctx.syntaxMode=NO(this.ctx),fO(this.ctx,this),this.ctx.parsed?.module)Q0(this.ctx.parsed?.module,{enter:(G)=>{if(G.type==="ExportNamedDeclaration"){if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let U,J,F=!1,j,M,L,B=!1,I,T,S;if(G.declaration.type==="FunctionDeclaration"){let n=G.declaration;if(!n.id?.name)return;U=n.id.name,J="function",j=void 0,M="() => any",B=!0,F=!0}else if(G.declaration.type==="VariableDeclaration"){let n=G.declaration,V=n.declarations[0];if(!V||typeof V!=="object"||!("id"in V))return;let{id:k,init:C}=V;if(!k||typeof k!=="object"||!("name"in k))return;let y=k.name;U=y,J=rO(n.kind);let D=C==null?{isFunction:!1}:z0(this,this.ctx,C);({value:j,type:M,isFunction:B,defaultValue:I}=D),T=M,S=D,L=this.getExplicitPropType(y)}else return;let u=K0(this.ctx,this,G),{type:p,typeSource:$0,description:_,params:o,returnType:c,isFunction:q0}=V0({explicitType:L,typeSeed:M,inferredTypeForSource:T,jsdocType:u?.type,jsdocDescription:u?.description,jsdocParams:u?.params,jsdocReturnType:u?.returnType,resolvedType:S?.resolvedType,resolvedDescription:S?.resolvedDescription,resolvedParams:S?.resolvedParams,resolvedReturnType:S?.resolvedReturnType,initializerIsFunction:B,isFunctionDeclaration:F,typedefs:this.ctx.typedefs});this.addModuleExport(U,{name:U,kind:J,description:_,deprecated:u?.deprecated,tags:u?.tags,type:p,typeSource:$0,value:j,defaultValue:I,params:o,returnType:c,isFunction:q0,isFunctionDeclaration:F,isRequired:!1,constant:J==="const",reactive:!1,source:v(this.ctx,G)})}}});let Q,W=new Set,Y=new Set,X=[],K={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};SO(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let q=bO(this.ctx);if(Q0(K,{enter:(G,U,J)=>{_O(this,this.ctx,q,G);let F=this.ctx.scopeDeclarations.get(G);if(F)this.ctx.activeScopes.push(F);if(G.type==="AssignmentExpression")e0(this.ctx,G.left);if(G.type==="UpdateExpression")e0(this.ctx,G.argument);if(G.type==="CallExpression"){let j=G,M=j.callee&&typeof j.callee==="object"&&"name"in j.callee?j.callee.name:void 0;if(M==="createEventDispatcher"){if(U&&typeof U==="object"&&"id"in U&&U.id&&typeof U.id==="object"&&"name"in U.id)Q=U.id.name}if(M==="$host"){if(U&&typeof U==="object"&&"id"in U&&U.id&&typeof U.id==="object"&&"name"in U.id)W.add(U.id.name)}if(M==="setContext")wO(this.ctx,this,G,U??void 0);if(M)X.push({name:M,arguments:j.arguments,source:v(this.ctx,j)});if(WO(j.callee)&&O0(j.callee.property)&&j.callee.property.name==="dispatchEvent"&&(Z0(j.callee.object,"$host")||O0(j.callee.object)&&W.has(j.callee.object.name))){let L=MO(this.ctx,j);if(L)Y.add(L)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Spread"){let j=G;if(j.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(j.expression?.name??""))DO(this.ctx,U)}if(G.type==="FunctionDeclaration"){let j=G;if(j.id?.name)this.ctx.funcDecls.set(j.id.name,j)}if(G.type==="VariableDeclaration"){if(this.ctx.vars.add(G),U&&typeof U==="object"&&"type"in U&&U.type==="Program"&&G.declarations.some((j)=>Z0(X0(j.init),"$props")))dO(this,this.ctx,G)}if(G.type==="ExportNamedDeclaration"){if(G.declaration==null&&G.specifiers.length===0)return;let j;if(G.declaration==null&&G.specifiers[0]?.type==="ExportSpecifier"){let D=G.specifiers[0],R=D.local&&typeof D.local==="object"&&"name"in D.local?D.local.name:void 0,P=D.exported&&typeof D.exported==="object"&&"name"in D.exported?D.exported.name:void 0;if(!R||!P)return;let E;for(let r of Array.from(this.ctx.vars))if(r.declarations.some((h)=>h.id&&typeof h.id==="object"&&("type"in h.id)&&h.id.type==="Identifier"&&h.id.name===R)){E=r;break}G.declaration=E,j=P}if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let M,L=!1,B,I,T,S=!1,u=!1,p,$0,_,o;if(G.declaration.type==="FunctionDeclaration"){let D=G.declaration;if(!D.id?.name)return;j??=D.id.name,p=D.id.name,M="function",B=void 0,I="() => any",S=!0,L=!0,u=!1}else if(G.declaration.type==="VariableDeclaration"){let D=G.declaration,R=D.declarations[0];if(!R||typeof R!=="object"||!("id"in R))return;let{id:P,init:E}=R;if(P&&typeof P==="object"&&"name"in P){let h=P.name;p=h,j??=h,T=this.getExplicitPropType(h)}else return;M=rO(D.kind),u=M==="let"&&E==null;let r=E==null?{isFunction:!1}:z0(this,this.ctx,E);({value:B,type:I,isFunction:S,defaultValue:$0}=r),_=I,o=r}else return;let c=K0(this.ctx,this,G),{type:q0,typeSource:n,description:V,params:k,returnType:C,isFunction:y}=V0({explicitType:T,typeSeed:I,inferredTypeForSource:_,jsdocType:c?.type,jsdocDescription:c?.description,jsdocParams:c?.params,jsdocReturnType:c?.returnType,resolvedType:o?.resolvedType,resolvedDescription:o?.resolvedDescription,resolvedParams:o?.resolvedParams,resolvedReturnType:o?.resolvedReturnType,initializerIsFunction:S,isFunctionDeclaration:L,typedefs:this.ctx.typedefs});j0(this,this.ctx,j,{name:j,...p!==void 0&&p!==j?{localName:p}:{},kind:M,description:V,binding:c?.binding,deprecated:c?.deprecated,tags:c?.tags,type:q0,typeSource:n,value:B,defaultValue:$0,params:k,returnType:C,isFunction:y,isFunctionDeclaration:L,isRequired:u,constant:M==="const",reactive:this.ctx.reactive_vars.has(j),source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Comment"){let M=G?.data?.trim()??"";if(aO.test(M))this.ctx.componentComment=M.replace(aO,"").replace(q2,""),this.ctx.componentCommentSource=v(this.ctx,G)}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Slot"){let j=G,M=j.attributes?.find((I)=>I.name==="name")?.value?.[0]?.data,L=(j.attributes||[]).filter((I)=>I.name!=="name").reduce((I,T)=>{let S={value:void 0,replace:!1},u=T.value;if(u===void 0)return I;if(u[0]){let p=u[0],{type:$0,expression:_,raw:o,start:c,end:q0}=p;if($0==="Text"&&o!==void 0)S.value=JSON.stringify(o);else if($0==="AttributeShorthand"&&_&&typeof _==="object"&&"name"in _)S.value=_.name,S.replace=!0;if(_&&typeof _==="object"&&"type"in _){if(_.type==="Literal"&&"value"in _){let n=_.value;S.value=typeof n==="string"?JSON.stringify(n):String(n)}else if(_.type==="MemberExpression")S.value=I0(this.ctx,this,_);else if(_.type!=="Identifier"){if(c!==void 0&&q0!==void 0){if(_.type==="ObjectExpression"||_.type==="TemplateLiteral")S.value=m(this.ctx,c+1,q0-1)}}}}if(T.name)I[T.name]=S;return I},{}),B=j.children?.map(({start:I,end:T})=>{if(I===void 0||T===void 0)return"";return m(this.ctx,I,T)??""}).join("").trim();J0(this.ctx,{slot_name:M,slot_props:L,slot_fallback:B,source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="RenderTag"){let j=G,M=RO(this.ctx,j.expression);if(M){let L;if(M.arguments.length===0)L={};else if(M.arguments.length===1&&typeof M.arguments[0]==="object"&&M.arguments[0]&&"type"in M.arguments[0]&&M.arguments[0].type==="ObjectExpression")L=LO(this.ctx,this,M.arguments[0]);else if(M.arguments.length===1)W0(this.ctx,"syntax-skipped",M.publicName,`{@render ${M.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,v(this.ctx,G));let B=M.publicName==="children"?void 0:M.publicName,I=B===void 0?Y2:B;if(L!==void 0)J0(this.ctx,{slot_name:B,slot_props:L,source:v(this.ctx,G)});if(L!==void 0||this.ctx.slots.has(I))this.ctx.snippetPropLocals.add(M.trackingName)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="EventHandler"){let j=G;if(j.expression==null&&j.name){if(U!=null&&typeof U==="object"&&"name"in U){let M=typeof U.name==="string"?U.name:void 0,L="type"in U?String(U.type):void 0;if(M&&L){let B=L==="InlineComponent"?{type:"InlineComponent",name:M}:{type:"Element",name:M};this.ctx.forwardedEvents.set(j.name,B);let I=this.ctx.events.get(j.name),T=this.ctx.eventDescriptions.get(j.name),S=I?.deprecated;if(!I)this.ctx.events.set(j.name,{type:"forwarded",name:j.name,element:B,description:T,deprecated:S,source:v(this.ctx,G)});else if(I.type==="forwarded"&&T&&!I.description)this.ctx.events.set(j.name,{...I,description:T,deprecated:I.deprecated??S,source:I.source||v(this.ctx,G)})}}}}if(U&&typeof U==="object"&&"type"in U&&(String(U.type)==="Element"||String(U.type)==="InlineComponent")&&G&&typeof G==="object"&&"type"in G&&String(G.type)==="Binding"){let j=G;if(j.expression?.name){let M=f0(this.ctx,j.expression.name);if(M)this.ctx.reactive_vars.add(M)}if(String(U.type)==="Element"&&j.name==="this"&&j.expression?.name&&"name"in U&&typeof U.name==="string"){let M=f0(this.ctx,j.expression.name);if(!M)return;let L=U.name;if(this.ctx.bindings.has(M)){let B=this.ctx.bindings.get(M);if(B&&!B.elements.includes(L))this.ctx.bindings.set(M,{...B,elements:[...B.elements,L]})}else this.ctx.bindings.set(M,{elements:[L]})}}},leave:(G)=>{if(this.ctx.scopeDeclarations.has(G))this.ctx.activeScopes.pop();kO(q,G)}}),Q!==void 0){for(let G of X)if(G.name===Q){let U=G.arguments[0],J=U&&typeof U==="object"&&"value"in U?U.value:void 0,F=G.arguments[1],j=F&&typeof F==="object"&&"value"in F?F.value:void 0;if(J!=null)w0(this.ctx,{name:String(J),detail:j==null?"":x0(j),has_argument:Boolean(F),source:G.source})}}let z=new Set(Y);if(Q!==void 0){for(let G of X)if(G.name===Q){let U=G.arguments[0],J=U&&typeof U==="object"&&"value"in U?U.value:void 0;if(J!=null)z.add(String(J))}}this.ctx.forwardedEvents.forEach((G,U)=>{let J=this.ctx.events.get(U);if(J&&J.type==="dispatched"&&!z.has(U)){let F=this.ctx.eventDescriptions.get(U),j={type:"forwarded",name:U,element:G,description:F,deprecated:J.deprecated,tags:J.tags,source:J.source};if(J.detail!==void 0&&J.detail!=="undefined")j.detail=J.detail;this.ctx.events.set(U,j)}}),iO(this.ctx,z);let H=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(G)=>this.resolvePublicPropName(G))):new Set,w=l.mapToArray(this.ctx.props).filter((G)=>!H.has(G.name)).map((G)=>{if(this.ctx.bindings.has(G.name)){let U=this.ctx.bindings.get(G.name)?.elements.sort().map((J)=>XO(J)).join(" | ");return{...G,type:`null | ${U}`,typeSource:"inferred",reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}}return{...G,reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}});this.ctx.activeScopes.length=0;let A=l.mapToArray(this.ctx.slots).map((G)=>{if(!G.slot_props)return G;if(typeof G.slot_props==="string")return X2.test(G.slot_props)?{...G,slot_props:"Record<string, never>"}:G;let U=G.slot_props,J=[];for(let j of Object.keys(U)){if(U[j].replace&&U[j].value!==void 0)U[j].value=this.getPropTypeByLocalOrPublic(U[j].value);if(U[j].value===void 0)U[j].value="any";J.push(`${j}: ${U[j].value}`)}let F=J.length===0?"Record<string, never>":J.length===1?`{ ${J[0]} }`:`{
|
|
16
|
-
${J.join(`;
|
|
17
|
-
`)};
|
|
18
|
-
}`;return{...G,slot_props:F}}).sort((G,U)=>{let J=G.name??"",F=U.name??"";if(J<F)return-1;if(J>F)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let G=[...w.map((U)=>U.type??""),...A.map((U)=>U.slot_props??"")].join(`
|
|
19
|
-
`);for(let{name:U,constraint:J}of this.ctx.deferredSlotBlockGenerics){let F=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${F}\\b`).test(G))continue;this.accumulateGeneric(U,J)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)W0(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=O1(this.ctx.scriptGenericsAttribute.value)}let f=l.mapToArray(this.ctx.moduleExports),N=l.mapToArray(this.ctx.events).map((G)=>{switch(G.type){case"forwarded":return{...G,element:G.element.name};case"dispatched":return G;default:return G}}).sort((G,U)=>{let J=G.name.localeCompare(U.name);if(J!==0)return J;let F=G.type.localeCompare(U.type);if(F!==0)return F;if(G.type==="forwarded"&&U.type==="forwarded"){let j=G.element.localeCompare(U.element);if(j!==0)return j}return(G.detail??"").localeCompare(U.detail??"")}),s=l.mapToArray(this.ctx.typedefs),i=l.mapToArray(this.ctx.contexts);for(let G of w)if(G.typeSource==="unknown")W0(this.ctx,"prop-unknown-type",G.name,`Prop "${G.name}" type could not be inferred; falling back to "${G.type??"any"}".`,G.source);for(let G of this.ctx.jsDocEventNames){if(z.has(G))continue;if(this.ctx.forwardedEvents.has(G))continue;if(this.ctx.props.has(`on${G}`))continue;W0(this.ctx,"event-no-source",G,`@event "${G}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(G))}let x={source:tO(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:w,moduleExports:f,slots:A,events:N,typedefs:s,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:i,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},b=eO(this.ctx);if(b)x[ZO]=b;return x}}
|
|
20
|
-
export{a as s,l as t};
|