svelte-effect-runtime 3.4.7 → 3.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dist/chunks/{client-CsVu54pU.js → client-D_DE2cFa.js} +11 -42
- package/.dist/chunks/{client-CsVu54pU.js.map → client-D_DE2cFa.js.map} +1 -1
- package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-BdvO4AAS.js} +2 -2
- package/.dist/chunks/{dispatcher-pHH4JcFR.js.map → dispatcher-BdvO4AAS.js.map} +1 -1
- package/.dist/chunks/{dispatcher-LtvFKYUp.js → dispatcher-NpL5xhWF.js} +3 -3
- package/.dist/chunks/{dispatcher-LtvFKYUp.js.map → dispatcher-NpL5xhWF.js.map} +1 -1
- package/.dist/chunks/{errors-Dcf0MVbq.js → errors-Bl3NVEez.js} +21 -3
- package/.dist/chunks/{errors-Dcf0MVbq.js.map → errors-Bl3NVEez.js.map} +1 -1
- package/.dist/chunks/live-DEmS7qpO.js +103 -0
- package/.dist/chunks/live-DEmS7qpO.js.map +1 -0
- package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-BNNW2GDT.js} +3 -3
- package/.dist/chunks/{runtime-ekkMQ-wL.js.map → runtime-BNNW2GDT.js.map} +1 -1
- package/.dist/chunks/{transform-CEK6Ccll.js → transform-C2fCVPL_.js} +172 -105
- package/.dist/chunks/transform-C2fCVPL_.js.map +1 -0
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +15 -0
- package/.dist/generators.d.ts +3 -1
- package/.dist/internal/generators.js +20 -3
- package/.dist/internal/generators.js.map +1 -0
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/live.d.ts +100 -0
- package/.dist/markup/promise.js +1 -1
- package/.dist/markup/run.js +1 -1
- package/.dist/markup/transform/constants.d.ts +1 -0
- package/.dist/markup/transform/types.d.ts +1 -0
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.js +1 -1
- package/.dist/mod.d.ts +5 -2
- package/.dist/mod.js +4 -3
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/client/query.d.ts +6 -16
- package/.dist/remote/client/types.d.ts +2 -11
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.js +1 -1
- package/.dist/runtime/transform.js +57 -26
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/imports.d.ts +2 -0
- package/.dist/script-transform/types.d.ts +8 -0
- package/.dist/server/effects.d.ts +7 -7
- package/.dist/server/index.d.ts +3 -1
- package/.dist/server/types.d.ts +25 -50
- package/.dist/server/wrappers.d.ts +2 -2
- package/.dist/server.d.ts +2 -2
- package/.dist/server.js +40 -65
- package/.dist/server.js.map +1 -1
- package/.dist/yieldable.d.ts +41 -0
- package/package.json +1 -1
- package/.dist/chunks/transform-CEK6Ccll.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-CEK6Ccll.js","names":["create_source_map","is_yield_star_expression","create_source_map"],"sources":["../../../modules/svelte-effect-runtime/src/script-transform/imports.ts","../../../modules/svelte-effect-runtime/src/markup/transform/constants.ts","../../../modules/svelte-effect-runtime/src/markup/transform/apply.ts","../../../modules/svelte-effect-runtime/src/markup/transform/effect-bindings.ts","../../../modules/svelte-effect-runtime/src/markup/transform/classify.ts","../../../modules/svelte-effect-runtime/src/markup/transform/expressions.ts","../../../modules/svelte-effect-runtime/src/markup/transform/effect-callbacks.ts","../../../modules/svelte-effect-runtime/src/markup/transform/emit.ts","../../../modules/svelte-effect-runtime/src/script-transform/source.ts","../../../modules/svelte-effect-runtime/src/script-transform/runes.ts","../../../modules/svelte-effect-runtime/src/script-transform/ast.ts","../../../modules/svelte-effect-runtime/src/markup/transform/scan.ts","../../../modules/svelte-effect-runtime/src/markup/transform/index.ts"],"sourcesContent":["import type { RuntimeImportBindings } from \"./types.ts\";\n\nimport ts from \"typescript\";\n\ninterface RuntimeImportOptions {\n\tneeds_dispatcher?: boolean;\n\tneeds_effect?: boolean;\n\tneeds_untrack?: boolean;\n}\n\n/**\n * Builds the import statements injected by the script transform.\n *\n * @since 2.0.0\n * @param has_effect_import - Whether the user already imports `Effect`.\n * @param has_dispatcher_import - Whether the user already imports\n * `get_dispatcher`.\n * @param has_untrack_import - Whether the user already imports `untrack`.\n * @param bindings - Local names reserved for generated runtime helpers.\n * @param options - Runtime helper imports required by this transformed script.\n * @returns Newline-separated import statements to inject.\n */\nexport function make_imports(\n\thas_effect_import: boolean,\n\thas_dispatcher_import: boolean,\n\thas_untrack_import: boolean,\n\tbindings: RuntimeImportBindings = {\n\t\tcancel: \"__SER___cancel\",\n\t\tdispatcher: \"get_dispatcher\",\n\t\tdispatcher_value: \"__SER___dispatcher\",\n\t\teffect: \"Effect\",\n\t\tprogram: \"__SER___program\",\n\t\tuntrack: \"untrack\",\n\t},\n\toptions: RuntimeImportOptions = {},\n): string {\n\tconst needs_dispatcher = options.needs_dispatcher ?? true;\n\tconst needs_effect = options.needs_effect ?? true;\n\tconst needs_untrack = options.needs_untrack ?? true;\n\n\tconst dispatcher_import =\n\t\tbindings.dispatcher === \"get_dispatcher\"\n\t\t\t? `import { get_dispatcher } from \"svelte-effect-runtime/internal/generators\";`\n\t\t\t: `import { get_dispatcher as ${bindings.dispatcher} } from \"svelte-effect-runtime/internal/generators\";`;\n\n\tconst untrack_import =\n\t\tbindings.untrack === \"untrack\"\n\t\t\t? `import { untrack } from \"svelte\";`\n\t\t\t: `import { untrack as ${bindings.untrack} } from \"svelte\";`;\n\n\tconst effect_import = has_effect_import\n\t\t? false\n\t\t: bindings.effect === \"Effect\"\n\t\t\t? `import { Effect } from \"effect\";`\n\t\t\t: `import { Effect as ${bindings.effect} } from \"effect\";`;\n\n\treturn [\n\t\tneeds_dispatcher && !has_dispatcher_import && dispatcher_import,\n\t\tneeds_untrack && !has_untrack_import && untrack_import,\n\t\tneeds_effect && effect_import,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Checks whether a source file imports a local binding from a module.\n *\n * @since 2.0.0\n * @param source_file - Parsed TypeScript source file to inspect.\n * @param module_name - Module specifier to match.\n * @param local_name - Local binding name to look for.\n * @returns Whether that binding is already locally available.\n */\nexport function has_local_import_binding(\n\tsource_file: ts.SourceFile,\n\tmodule_name: string,\n\tlocal_name: string,\n): boolean {\n\treturn source_file.statements.some((stmt) => {\n\t\tif (\n\t\t\t!ts.isImportDeclaration(stmt) ||\n\t\t\t!ts.isStringLiteral(stmt.moduleSpecifier) ||\n\t\t\tstmt.moduleSpecifier.text !== module_name\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst clause = stmt.importClause;\n\n\t\tif (!clause || clause.isTypeOnly) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (clause.name?.text === local_name) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst named_bindings = clause.namedBindings;\n\n\t\tif (!named_bindings) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (ts.isNamespaceImport(named_bindings)) {\n\t\t\treturn named_bindings.name.text === local_name;\n\t\t}\n\n\t\treturn named_bindings.elements.some(\n\t\t\t(element) => !element.isTypeOnly && element.name.text === local_name,\n\t\t);\n\t});\n}\n\n/**\n * Checks whether a source file already has any top-level binding with a local\n * name.\n *\n * @since 2.4.2\n * @param source_file - Parsed TypeScript source file to inspect.\n * @param local_name - Local binding name to look for.\n * @returns Whether that local name is already declared in the file.\n */\nexport function has_top_level_binding(source_file: ts.SourceFile, local_name: string): boolean {\n\treturn collect_top_level_binding_names(source_file).includes(local_name);\n}\n\n/**\n * Collects every local binding declared at module top level.\n *\n * @since 2.4.2\n * @param source_file - Parsed TypeScript source file to inspect.\n * @returns Top-level names declared by imports, declarations, and variables.\n */\nexport function collect_top_level_binding_names(source_file: ts.SourceFile): string[] {\n\treturn source_file.statements.flatMap(collect_statement_binding_names);\n}\n\nfunction collect_statement_binding_names(stmt: ts.Statement): string[] {\n\tif (ts.isImportDeclaration(stmt)) {\n\t\treturn collect_import_binding_names(stmt);\n\t}\n\n\tif (ts.isVariableStatement(stmt)) {\n\t\treturn stmt.declarationList.declarations.flatMap((decl) =>\n\t\t\tcollect_binding_name_text(decl.name),\n\t\t);\n\t}\n\n\tif (\n\t\tts.isFunctionDeclaration(stmt) ||\n\t\tts.isClassDeclaration(stmt) ||\n\t\tts.isInterfaceDeclaration(stmt) ||\n\t\tts.isTypeAliasDeclaration(stmt) ||\n\t\tts.isEnumDeclaration(stmt) ||\n\t\tts.isModuleDeclaration(stmt)\n\t) {\n\t\treturn stmt.name ? [stmt.name.text] : [];\n\t}\n\n\treturn [];\n}\n\nfunction collect_import_binding_names(stmt: ts.ImportDeclaration): string[] {\n\tconst clause = stmt.importClause;\n\n\tif (!clause) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\tclause.name?.text,\n\t\tclause.namedBindings && ts.isNamespaceImport(clause.namedBindings)\n\t\t\t? clause.namedBindings.name.text\n\t\t\t: undefined,\n\t\tclause.namedBindings && ts.isNamedImports(clause.namedBindings)\n\t\t\t? clause.namedBindings.elements.map((element) => element.name.text)\n\t\t\t: undefined,\n\t]\n\t\t.flat()\n\t\t.filter((name): name is string => name !== undefined);\n}\n\nfunction collect_binding_name_text(name: ts.BindingName): string[] {\n\tif (ts.isIdentifier(name)) {\n\t\treturn [name.text];\n\t}\n\n\treturn name.elements.flatMap((element) => {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn collect_binding_name_text(element.name);\n\t});\n}\n","export const HELPERS = {\n\tcodes: \"Code\",\n\tdispatcher: \"Dispatcher\",\n} as const;\n","import type MagicString from \"magic-string\";\n\nimport { collect_top_level_binding_names } from \"$/script-transform/imports.ts\";\nimport { HELPERS } from \"./constants.ts\";\nimport type {\n\tHelperDeclaration,\n\tInsertion,\n\tMarkupHelperBindings,\n\tMarkupRelocation,\n\tPendingRelocation,\n\tReplacement,\n} from \"./types.ts\";\nimport ts from \"typescript\";\n\nexport function create_source_map(magic: MagicString, filename: string): Record<string, unknown> {\n\tconst map = magic.generateMap({\n\t\thires: true,\n\t\tincludeContent: true,\n\t\tsource: filename,\n\t});\n\n\treturn map as unknown as Record<string, unknown>;\n}\n\nexport function blank_script_blocks(content: string): string {\n\treturn content.replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script\\s*>/gi, (match) => {\n\t\tconst lines = match.split(\"\\n\");\n\t\treturn lines.map((l) => \" \".repeat(l.length)).join(\"\\n\");\n\t});\n}\n\nexport function inject_helpers(\n\tmagic: MagicString,\n\tcontent: string,\n\thelpers: HelperDeclaration[] = [],\n\tbindings: MarkupHelperBindings = HELPERS,\n): Insertion | undefined {\n\tconst import_helpers = unique_import_helpers(helpers);\n\tconst local_helpers = helpers.filter((helper) => !is_import_helper(helper));\n\n\tconst helper_segments: Array<{\n\t\ttext: string;\n\t\trelocation?: PendingRelocation;\n\t}> = [\n\t\tmake_import_helper(content, make_dispatcher_import(bindings)),\n\t\t...import_helpers,\n\t\t...local_helpers,\n\t]\n\t\t.filter((helper): helper is string | HelperDeclaration => helper !== undefined)\n\t\t.map((helper) => (typeof helper === \"string\" ? { text: helper } : helper));\n\n\tif (helper_segments.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst helper_block = helper_segments.map((segment) => segment.text).join(\"\\n\");\n\n\tconst script_tag = find_instance_script_tag(content);\n\n\tif (script_tag) {\n\t\tconst text = `\\n${helper_block}\\n`;\n\n\t\tmagic.appendLeft(script_tag.end, text);\n\n\t\treturn {\n\t\t\tstart: script_tag.end,\n\t\t\ttext,\n\t\t\trelocations: make_insertion_relocations(helper_segments, \"\\n\"),\n\t\t};\n\t} else {\n\t\tconst text = `<script>\\n${helper_block}\\n</script>\\n\\n`;\n\n\t\tmagic.prepend(text);\n\n\t\treturn {\n\t\t\tstart: 0,\n\t\t\ttext,\n\t\t\trelocations: make_insertion_relocations(helper_segments, \"<script>\\n\"),\n\t\t};\n\t}\n}\n\nexport function make_markup_helper_bindings(content: string): {\n\tbindings: MarkupHelperBindings;\n\tname_allocator: { reserve(name: string): string };\n} {\n\tconst script_tag = find_instance_script_tag(content);\n\tconst binding_names = script_tag\n\t\t? collect_script_binding_names(content.slice(script_tag.start, script_tag.end))\n\t\t: [];\n\tconst name_allocator = make_name_allocator(binding_names);\n\n\treturn {\n\t\tbindings: {\n\t\t\tcodes: name_allocator.reserve(HELPERS.codes),\n\t\t\tdispatcher: name_allocator.reserve(HELPERS.dispatcher),\n\t\t},\n\t\tname_allocator,\n\t};\n}\n\nexport function create_relocations(\n\treplacements: Replacement[],\n\thelper_insertion: Insertion | undefined,\n): MarkupRelocation[] {\n\tconst edits = [\n\t\thelper_insertion && {\n\t\t\tstart: helper_insertion.start,\n\t\t\tremovedLength: 0,\n\t\t\tinsertedLength: helper_insertion.text.length,\n\t\t},\n\t\t...replacements.map((replacement) => ({\n\t\t\tstart: replacement.start,\n\t\t\tremovedLength: replacement.end - replacement.start,\n\t\t\tinsertedLength: replacement.text.length,\n\t\t})),\n\t].filter(Boolean) as Array<{\n\t\tstart: number;\n\t\tremovedLength: number;\n\t\tinsertedLength: number;\n\t}>;\n\n\tconst replacement_relocations = replacements.flatMap((replacement) => {\n\t\tif (!replacement.relocation) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst delta_before = edits\n\t\t\t.filter((edit) => edit.start < replacement.start)\n\t\t\t.reduce((total, edit) => total + edit.insertedLength - edit.removedLength, 0);\n\t\tconst generated_start = replacement.start + delta_before;\n\n\t\treturn [\n\t\t\t{\n\t\t\t\toriginalStart: replacement.relocation.originalStart,\n\t\t\t\toriginalEnd: replacement.relocation.originalEnd,\n\t\t\t\tgeneratedStart:\n\t\t\t\t\tgenerated_start + replacement.relocation.generatedStartInReplacement,\n\t\t\t\tgeneratedEnd: generated_start + replacement.relocation.generatedEndInReplacement,\n\t\t\t},\n\t\t];\n\t});\n\n\tconst helper_relocations =\n\t\thelper_insertion?.relocations?.map((relocation) => ({\n\t\t\toriginalStart: relocation.originalStart,\n\t\t\toriginalEnd: relocation.originalEnd,\n\t\t\tgeneratedStart: helper_insertion.start + relocation.generatedStartInReplacement,\n\t\t\tgeneratedEnd: helper_insertion.start + relocation.generatedEndInReplacement,\n\t\t})) ?? [];\n\n\treturn [...replacement_relocations, ...helper_relocations];\n}\n\nfunction make_import_helper(content: string, import_text: string): string | undefined {\n\tif (content.includes(import_text)) {\n\t\treturn undefined;\n\t}\n\n\treturn import_text;\n}\n\nfunction make_dispatcher_import(bindings: MarkupHelperBindings): string {\n\tconst dispatcher = make_import_specifier(HELPERS.dispatcher, bindings.dispatcher);\n\tconst codes = make_import_specifier(HELPERS.codes, bindings.codes);\n\n\treturn `import { ${dispatcher}, ${codes} } from \"svelte-effect-runtime/internal/generators\";`;\n}\n\nfunction make_import_specifier(imported_name: string, local_name: string): string {\n\tif (imported_name === local_name) {\n\t\treturn imported_name;\n\t}\n\n\treturn `${imported_name} as ${local_name}`;\n}\n\nfunction make_insertion_relocations(\n\tsegments: Array<{\n\t\ttext: string;\n\t\trelocation?: PendingRelocation;\n\t}>,\n\tprefix: string,\n): PendingRelocation[] {\n\tconst relocations: PendingRelocation[] = [];\n\tlet offset = prefix.length;\n\n\tfor (const segment of segments) {\n\t\tif (segment.relocation) {\n\t\t\trelocations.push({\n\t\t\t\toriginalStart: segment.relocation.originalStart,\n\t\t\t\toriginalEnd: segment.relocation.originalEnd,\n\t\t\t\tgeneratedStartInReplacement:\n\t\t\t\t\toffset + segment.relocation.generatedStartInReplacement,\n\t\t\t\tgeneratedEndInReplacement: offset + segment.relocation.generatedEndInReplacement,\n\t\t\t});\n\t\t}\n\n\t\toffset += segment.text.length + 1;\n\t}\n\n\treturn relocations;\n}\n\nfunction find_instance_script_tag(content: string): { start: number; end: number } | undefined {\n\tconst pattern = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n\tfor (const match of content.matchAll(pattern)) {\n\t\tif (match.index === undefined) continue;\n\n\t\tconst attrs = match[1] ?? \"\";\n\t\tif (/\\bcontext\\s*=\\s*[\"']module[\"']/.test(attrs) || /\\bmodule\\b/.test(attrs)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst open_end = match[0].indexOf(\">\") + 1;\n\t\treturn {\n\t\t\tstart: match.index + open_end,\n\t\t\tend: match.index + match[0].length - \"</script>\".length,\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nfunction unique_import_helpers(helpers: HelperDeclaration[]): HelperDeclaration[] {\n\tconst seen = new Set<string>();\n\n\treturn helpers.filter((helper) => {\n\t\tif (!is_import_helper(helper)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (seen.has(helper.text)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(helper.text);\n\n\t\treturn true;\n\t});\n}\n\nfunction is_import_helper(helper: HelperDeclaration): boolean {\n\treturn helper.text.trimStart().startsWith(\"import \");\n}\n\nfunction collect_script_binding_names(script_content: string): string[] {\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-script.ts\",\n\t\tscript_content,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\n\treturn collect_top_level_binding_names(source_file);\n}\n\nfunction make_name_allocator(initial_names: readonly string[]): {\n\treserve(name: string): string;\n} {\n\tconst used_names = new Set(initial_names);\n\n\treturn {\n\t\treserve(name: string): string {\n\t\t\tlet candidate = name;\n\t\t\tlet suffix = 1;\n\n\t\t\twhile (used_names.has(candidate)) {\n\t\t\t\tcandidate = `${name}_${suffix}`;\n\t\t\t\tsuffix += 1;\n\t\t\t}\n\n\t\t\tused_names.add(candidate);\n\n\t\t\treturn candidate;\n\t\t},\n\t};\n}\n","import type { HelperDeclaration } from \"./types.ts\";\n\nimport ts from \"typescript\";\n\nconst EFFECT_PACKAGE_MODULE = \"effect\";\nconst EFFECT_DIRECT_MODULE = \"effect/Effect\";\nconst GENERATED_EFFECT_NAME = \"__SER___Effect\";\n\n/**\n * Describes local bindings that resolve to Effect APIs in markup expressions.\n *\n * @example\n * ```ts\n * const context = collect_effect_callback_bindings(source);\n * context.effect_object_names.has(\"E\");\n * ```\n *\n * @since 2.4.0\n */\nexport interface EffectCallbackRewriteContext {\n\t/** Local names imported as the Effect object, such as `Effect` or `E`. */\n\teffect_object_names: ReadonlySet<string>;\n\t/** Namespace names imported from `effect/Effect`, such as `E.flatMap`. */\n\teffect_module_names: ReadonlySet<string>;\n\t/** Package namespace names imported from `effect`, such as `Fx.Effect`. */\n\teffect_package_names: ReadonlySet<string>;\n\t/** Direct `effect/Effect` imports mapped from local name to exported name. */\n\tdirect_members: ReadonlyMap<string, string>;\n\t/** Expression used for generated `gen`, `sync`, and upgraded direct calls. */\n\twrapper_expression: string;\n\t/** Import inserted when generated code needs a fresh Effect binding. */\n\twrapper_import: HelperDeclaration | undefined;\n}\n\ninterface EffectBindingState {\n\teffect_object_names: string[];\n\teffect_module_names: string[];\n\teffect_package_names: string[];\n\tdirect_members: Map<string, string>;\n\tlocal_names: Set<string>;\n\timplicit_effect_import: boolean;\n}\n\n/**\n * Collects Effect import bindings that markup callback rewriting can trust.\n *\n * @example\n * ```ts\n * const bindings = collect_effect_callback_bindings(\n * `<script>import { Effect as E } from \"effect\";</script>`,\n * );\n * ```\n *\n * @since 2.4.0\n * @param content - Full Svelte component source before markup lowering.\n * @returns Binding metadata used to identify Effect callback combinators.\n */\nexport function collect_effect_callback_bindings(content: string): EffectCallbackRewriteContext {\n\tconst state = make_effect_binding_state();\n\tconst scripts = collect_script_blocks(content);\n\n\tfor (const script of scripts) {\n\t\tconst source_file = ts.createSourceFile(\n\t\t\t\"component-script.ts\",\n\t\t\tscript,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\n\t\tcollect_source_file_bindings(source_file, state);\n\t}\n\n\tensure_implicit_effect_binding(state);\n\n\tconst wrapper = choose_effect_wrapper(state);\n\n\treturn {\n\t\teffect_object_names: new Set(state.effect_object_names),\n\t\teffect_module_names: new Set(state.effect_module_names),\n\t\teffect_package_names: new Set(state.effect_package_names),\n\t\tdirect_members: new Map(state.direct_members),\n\t\twrapper_expression: wrapper.expression,\n\t\twrapper_import: wrapper.import_text ? { text: wrapper.import_text } : undefined,\n\t};\n}\n\nfunction make_effect_binding_state(): EffectBindingState {\n\treturn {\n\t\teffect_object_names: [],\n\t\teffect_module_names: [],\n\t\teffect_package_names: [],\n\t\tdirect_members: new Map(),\n\t\tlocal_names: new Set(),\n\t\timplicit_effect_import: false,\n\t};\n}\n\nfunction collect_script_blocks(content: string): string[] {\n\tconst pattern = /<script\\b[^>]*>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n\treturn [...content.matchAll(pattern)].map((match) => match[1] ?? \"\");\n}\n\nfunction collect_source_file_bindings(source_file: ts.SourceFile, state: EffectBindingState): void {\n\tfor (const statement of source_file.statements) {\n\t\tcollect_statement_binding(statement, state);\n\t}\n}\n\nfunction collect_statement_binding(statement: ts.Statement, state: EffectBindingState): void {\n\tif (ts.isImportDeclaration(statement)) {\n\t\tcollect_import_binding(statement, state);\n\t\treturn;\n\t}\n\n\tif (ts.isImportEqualsDeclaration(statement)) {\n\t\tstate.local_names.add(statement.name.text);\n\t\treturn;\n\t}\n\n\tif (ts.isVariableStatement(statement)) {\n\t\tfor (const declaration of statement.declarationList.declarations) {\n\t\t\tcollect_binding_name(declaration.name, state.local_names);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (\n\t\tts.isFunctionDeclaration(statement) ||\n\t\tts.isClassDeclaration(statement) ||\n\t\tts.isInterfaceDeclaration(statement) ||\n\t\tts.isTypeAliasDeclaration(statement) ||\n\t\tts.isEnumDeclaration(statement) ||\n\t\tts.isModuleDeclaration(statement)\n\t) {\n\t\tif (statement.name) {\n\t\t\tstate.local_names.add(statement.name.text);\n\t\t}\n\t}\n}\n\nfunction collect_import_binding(statement: ts.ImportDeclaration, state: EffectBindingState): void {\n\tif (!ts.isStringLiteral(statement.moduleSpecifier)) {\n\t\treturn;\n\t}\n\n\tconst module_name = statement.moduleSpecifier.text;\n\tconst clause = statement.importClause;\n\n\tif (!clause) {\n\t\treturn;\n\t}\n\n\tif (clause.name) {\n\t\tstate.local_names.add(clause.name.text);\n\t}\n\n\tconst named_bindings = clause.namedBindings;\n\n\tif (!named_bindings) {\n\t\treturn;\n\t}\n\n\tif (ts.isNamespaceImport(named_bindings)) {\n\t\tcollect_namespace_import_binding(module_name, named_bindings.name.text, state);\n\t\treturn;\n\t}\n\n\tfor (const element of named_bindings.elements) {\n\t\tcollect_named_import_binding(module_name, element, state);\n\t}\n}\n\nfunction collect_namespace_import_binding(\n\tmodule_name: string,\n\tlocal_name: string,\n\tstate: EffectBindingState,\n): void {\n\tstate.local_names.add(local_name);\n\n\tif (module_name === EFFECT_DIRECT_MODULE) {\n\t\tadd_ordered_name(state.effect_module_names, local_name);\n\t\treturn;\n\t}\n\n\tif (module_name === EFFECT_PACKAGE_MODULE) {\n\t\tadd_ordered_name(state.effect_package_names, local_name);\n\t}\n}\n\nfunction collect_named_import_binding(\n\tmodule_name: string,\n\telement: ts.ImportSpecifier,\n\tstate: EffectBindingState,\n): void {\n\tconst imported_name = element.propertyName?.text ?? element.name.text;\n\tconst local_name = element.name.text;\n\n\tstate.local_names.add(local_name);\n\n\tif (module_name === EFFECT_PACKAGE_MODULE && imported_name === \"Effect\") {\n\t\tadd_ordered_name(state.effect_object_names, local_name);\n\t\treturn;\n\t}\n\n\tif (module_name === EFFECT_DIRECT_MODULE) {\n\t\tstate.direct_members.set(local_name, imported_name);\n\t}\n}\n\nfunction collect_binding_name(name: ts.BindingName, local_names: Set<string>): void {\n\tif (ts.isIdentifier(name)) {\n\t\tlocal_names.add(name.text);\n\t\treturn;\n\t}\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcollect_binding_name(element.name, local_names);\n\t}\n}\n\nfunction ensure_implicit_effect_binding(state: EffectBindingState): void {\n\tif (has_effect_binding(state) || state.local_names.has(\"Effect\")) {\n\t\treturn;\n\t}\n\n\tadd_ordered_name(state.effect_object_names, \"Effect\");\n\tstate.implicit_effect_import = true;\n}\n\nfunction has_effect_binding(state: EffectBindingState): boolean {\n\treturn (\n\t\tstate.effect_object_names.length > 0 ||\n\t\tstate.effect_module_names.length > 0 ||\n\t\tstate.effect_package_names.length > 0 ||\n\t\tstate.direct_members.size > 0\n\t);\n}\n\nfunction choose_effect_wrapper(state: EffectBindingState): {\n\texpression: string;\n\timport_text?: string;\n} {\n\tconst effect_object = state.effect_object_names[0];\n\n\tif (effect_object) {\n\t\treturn {\n\t\t\texpression: effect_object,\n\t\t\timport_text: state.implicit_effect_import\n\t\t\t\t? `import { Effect } from \"effect\";`\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\n\tconst effect_module = state.effect_module_names[0];\n\n\tif (effect_module) {\n\t\treturn { expression: effect_module };\n\t}\n\n\tconst effect_package = state.effect_package_names[0];\n\n\tif (effect_package) {\n\t\treturn { expression: `${effect_package}.Effect` };\n\t}\n\n\tconst generated_name = make_generated_effect_name(state.local_names);\n\n\treturn {\n\t\texpression: generated_name,\n\t\timport_text: `import { Effect as ${generated_name} } from \"effect\";`,\n\t};\n}\n\nfunction make_generated_effect_name(local_names: ReadonlySet<string>): string {\n\tif (!local_names.has(GENERATED_EFFECT_NAME)) {\n\t\treturn GENERATED_EFFECT_NAME;\n\t}\n\n\tlet index = 1;\n\n\twhile (local_names.has(`${GENERATED_EFFECT_NAME}_${index}`)) {\n\t\tindex += 1;\n\t}\n\n\treturn `${GENERATED_EFFECT_NAME}_${index}`;\n}\n\nfunction add_ordered_name(names: string[], name: string): void {\n\tif (names.includes(name)) {\n\t\treturn;\n\t}\n\n\tnames.push(name);\n}\n","import type { AST } from \"svelte/compiler\";\n\nimport type { MarkupCandidate, TagKind } from \"./types.ts\";\n\n/**\n * Matches sanitized placeholders back to their Svelte AST context.\n *\n * @since 2.0.0\n * @param ast - Parsed Svelte AST for the sanitized component markup.\n * @param candidates - Placeholder candidates produced by the scanner.\n * @returns Candidates paired with the markup context that determines how they\n * should be emitted.\n */\nexport function classify_candidates(\n\tast: AST.Root,\n\tcandidates: MarkupCandidate[],\n): Array<{ candidate: MarkupCandidate; kind: TagKind }> {\n\tconst by_placeholder = new Map(\n\t\tcandidates.map((candidate) => [candidate.placeholder, candidate]),\n\t);\n\n\tconst classified: Array<{ candidate: MarkupCandidate; kind: TagKind }> = [];\n\tconst matched = new Set<string>();\n\n\twalk_ast(ast.fragment, by_placeholder, matched, classified);\n\n\treturn classified;\n}\n\nfunction walk_ast(\n\tfragment: AST.Fragment,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const node of fragment.nodes) {\n\t\tvisit_ast_node(node, candidates, matched, classified);\n\t}\n}\n\nfunction visit_ast_node(\n\tnode: AST.Fragment[\"nodes\"][number],\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tswitch (node.type) {\n\t\tcase \"ExpressionTag\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"IfBlock\":\n\t\t\tclassify_expression(node.test, \"plain\", candidates, matched, classified);\n\t\t\twalk_ast(node.consequent, candidates, matched, classified);\n\t\t\tif (node.alternate) {\n\t\t\t\twalk_ast(node.alternate, candidates, matched, classified);\n\t\t\t}\n\t\t\treturn;\n\n\t\tcase \"EachBlock\":\n\t\t\tclassify_expression(node.expression, \"each\", candidates, matched, classified);\n\t\t\twalk_ast(node.body, candidates, matched, classified);\n\t\t\tif (node.fallback) {\n\t\t\t\twalk_ast(node.fallback, candidates, matched, classified);\n\t\t\t}\n\t\t\treturn;\n\n\t\tcase \"AwaitBlock\":\n\t\t\tclassify_expression(node.expression, \"await\", candidates, matched, classified);\n\t\t\tif (node.pending) {\n\t\t\t\twalk_ast(node.pending, candidates, matched, classified);\n\t\t\t}\n\t\t\tif (node.then) walk_ast(node.then, candidates, matched, classified);\n\t\t\tif (node.catch) walk_ast(node.catch, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"RenderTag\":\n\t\t\tclassify_expression(node.expression, \"render\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"HtmlTag\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"DebugTag\":\n\t\t\tclassify_debug_tag(node, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"ConstTag\":\n\t\tcase \"DeclarationTag\":\n\t\t\tclassify_declaration_tag(node, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"KeyBlock\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\twalk_ast(node.fragment, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"RegularElement\":\n\t\tcase \"Component\":\n\t\tcase \"TitleElement\":\n\t\tcase \"SlotElement\":\n\t\tcase \"SvelteBody\":\n\t\tcase \"SvelteBoundary\":\n\t\tcase \"SvelteComponent\":\n\t\tcase \"SvelteDocument\":\n\t\tcase \"SvelteElement\":\n\t\tcase \"SvelteFragment\":\n\t\tcase \"SvelteHead\":\n\t\tcase \"SvelteSelf\":\n\t\tcase \"SvelteWindow\":\n\t\t\tvisit_element_attributes(node, candidates, matched, classified);\n\t\t\twalk_ast(node.fragment, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tdefault:\n\t\t\treturn;\n\t}\n}\n\nfunction classify_debug_tag(\n\t_node: Extract<AST.Fragment[\"nodes\"][number], { type: \"DebugTag\" }>,\n\t_candidates: Map<string, MarkupCandidate>,\n\t_matched: Set<string>,\n\t_classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\treturn;\n}\n\nfunction classify_declaration_tag(\n\tnode: Extract<AST.Fragment[\"nodes\"][number], { type: \"ConstTag\" | \"DeclarationTag\" }>,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const decl of node.declaration.declarations) {\n\t\tclassify_expression(decl as ExpressionLike, \"plain\", candidates, matched, classified);\n\t}\n}\n\ninterface ElementLikeNode {\n\tattributes: Array<{\n\t\ttype: string;\n\t\tname?: string;\n\t\tvalue?: unknown;\n\t\texpression?: unknown;\n\t}>;\n\tfragment: AST.Fragment;\n}\n\nfunction visit_element_attributes(\n\tnode: ElementLikeNode,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const attr of node.attributes) {\n\t\tif (attr.type === \"Attribute\" && attr.name && is_event_attribute_name(attr.name)) {\n\t\t\tvisit_attribute_value(\n\t\t\t\tattr.value as true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>,\n\t\t\t\t\"event\",\n\t\t\t\tcandidates,\n\t\t\t\tmatched,\n\t\t\t\tclassified,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (attr.type === \"OnDirective\" && attr.expression) {\n\t\t\tclassify_expression(\n\t\t\t\tattr.expression as ExpressionLike,\n\t\t\t\t\"event\",\n\t\t\t\tcandidates,\n\t\t\t\tmatched,\n\t\t\t\tclassified,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t}\n}\n\nfunction is_event_attribute_name(name: string): boolean {\n\treturn name.startsWith(\"on:\") || /^on[a-z]/.test(name);\n}\n\nfunction visit_attribute_value(\n\tvalue: true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>,\n\tkind: TagKind,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tif (value === true) {\n\t\treturn;\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tfor (const part of value) {\n\t\t\tif (part.type === \"ExpressionTag\") {\n\t\t\t\tclassify_expression(part.expression, kind, candidates, matched, classified);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tclassify_expression(value.expression, kind, candidates, matched, classified);\n}\n\ntype ExpressionLike = {\n\ttype: string;\n\tname?: string;\n\tcallee?: { type: string; name?: string };\n};\n\nfunction classify_expression(\n\texpression: ExpressionLike | null | undefined,\n\tkind: TagKind,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tif (!expression) {\n\t\treturn;\n\t}\n\n\tconst found_candidates = find_candidates(expression, candidates);\n\n\tfor (const candidate of found_candidates) {\n\t\tif (matched.has(candidate.placeholder)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tmatched.add(candidate.placeholder);\n\t\tclassified.push({\n\t\t\tcandidate,\n\t\t\tkind: resolve_candidate_kind(candidate, kind),\n\t\t});\n\t}\n}\n\nfunction resolve_candidate_kind(candidate: MarkupCandidate, context_kind: TagKind): TagKind {\n\tif (candidate.key === \"render_argument\") {\n\t\treturn \"render_argument\";\n\t}\n\n\treturn context_kind;\n}\n\nfunction find_candidates(\n\texpression: ExpressionLike,\n\tcandidates: Map<string, MarkupCandidate>,\n): MarkupCandidate[] {\n\tconst found: MarkupCandidate[] = [];\n\tconst seen_nodes = new Set<unknown>();\n\tconst seen_placeholders = new Set<string>();\n\n\tvisit_expression_value(expression, candidates, seen_nodes, seen_placeholders, found);\n\n\treturn found;\n}\n\nfunction visit_expression_value(\n\tvalue: unknown,\n\tcandidates: Map<string, MarkupCandidate>,\n\tseen_nodes: Set<unknown>,\n\tseen_placeholders: Set<string>,\n\tfound: MarkupCandidate[],\n): void {\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tvisit_expression_value(item, candidates, seen_nodes, seen_placeholders, found);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (!is_record(value) || seen_nodes.has(value)) {\n\t\treturn;\n\t}\n\n\tseen_nodes.add(value);\n\n\tif (value.type === \"Identifier\" && typeof value.name === \"string\") {\n\t\tconst candidate = candidates.get(value.name);\n\n\t\tif (candidate && !seen_placeholders.has(candidate.placeholder)) {\n\t\t\tseen_placeholders.add(candidate.placeholder);\n\t\t\tfound.push(candidate);\n\t\t}\n\t}\n\n\tfor (const child of Object.values(value)) {\n\t\tvisit_expression_value(child, candidates, seen_nodes, seen_placeholders, found);\n\t}\n}\n\nfunction is_record(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n","import ts from \"typescript\";\n\n/**\n * Strips an event handler arrow function down to its executable body.\n *\n * @since 2.0.0\n * @param expr - Event handler expression text from the original markup.\n * @returns Handler parameters, body text, and body offsets inside `expr`.\n */\nexport function strip_arrow_function(expr: string): {\n\tparams: string;\n\tbody: string;\n\tbody_start: number;\n\tbody_end: number;\n} {\n\tconst arrow_idx = expr.indexOf(\"=>\");\n\n\tif (arrow_idx === -1) {\n\t\treturn { params: \"()\", body: expr, body_start: 0, body_end: expr.length };\n\t}\n\n\tconst params = expr.slice(0, arrow_idx).trim();\n\tconst raw_body = expr.slice(arrow_idx + 2);\n\tconst leading_ws = raw_body.length - raw_body.trimStart().length;\n\tlet body_start = arrow_idx + 2 + leading_ws;\n\tlet body_end = expr.length - (raw_body.length - raw_body.trimEnd().length);\n\tlet body = expr.slice(body_start, body_end);\n\n\tif (body.startsWith(\"{\") && body.endsWith(\"}\")) {\n\t\tbody_start += 1;\n\t\tbody_end -= 1;\n\t\tbody = body.slice(1, -1);\n\t}\n\n\tconst body_leading_ws = body.length - body.trimStart().length;\n\tconst body_trailing_ws = body.length - body.trimEnd().length;\n\n\tbody_start += body_leading_ws;\n\tbody_end -= body_trailing_ws;\n\tbody = body.trim();\n\n\tif (body.endsWith(\";\")) {\n\t\tbody = body.slice(0, -1);\n\t\tbody_end -= 1;\n\t}\n\n\treturn { params, body, body_start, body_end };\n}\n\n/**\n * Returns whether an expression is a callback function.\n *\n * @since 2.0.0\n * @param expr - Expression text from a markup attribute or expression tag.\n * @returns Whether the expression parses as an arrow or function expression.\n */\nexport function is_callback_function_expression(expr: string): boolean {\n\tconst wrapped = `const __SER___callback = ${expr};`;\n\tconst sf = ts.createSourceFile(\n\t\t\"callback.ts\",\n\t\twrapped,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = sf.statements[0];\n\n\tif (!ts.isVariableStatement(stmt)) {\n\t\treturn false;\n\t}\n\n\tconst initializer = stmt.declarationList.declarations[0]?.initializer;\n\n\treturn (\n\t\tinitializer !== undefined &&\n\t\t(ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer))\n\t);\n}\n\n/**\n * Classifies `yield*` placement inside an event handler body.\n *\n * @example\n * ```ts\n * analyze_event_body_yield_star(\"yield* save()\");\n * ```\n *\n * @since 2.0.0\n * @param body - Event handler body text after the outer arrow has been\n * stripped.\n * @returns Whether the body has top-level yield* expressions and whether any\n * yield* appears inside a nested non-generator callback.\n */\nexport function analyze_event_body_yield_star(body: string): {\n\thas_top_level_yield_star: boolean;\n\thas_nested_invalid_yield_star: boolean;\n} {\n\tconst wrapped = `function* __SER___event() { ${body}; }`;\n\tconst sf = ts.createSourceFile(\n\t\t\"event.ts\",\n\t\twrapped,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = sf.statements[0];\n\n\tif (!ts.isFunctionDeclaration(stmt) || !stmt.body) {\n\t\treturn {\n\t\t\thas_top_level_yield_star: false,\n\t\t\thas_nested_invalid_yield_star: /\\byield\\s*\\*/.test(body),\n\t\t};\n\t}\n\n\tconst result = {\n\t\thas_top_level_yield_star: false,\n\t\thas_nested_invalid_yield_star: false,\n\t};\n\n\tvisit_event_body(stmt.body, \"top_level\", result);\n\n\treturn result;\n}\n\n/**\n * Collects free identifiers that must be captured as reactive dependencies.\n *\n * @since 2.0.0\n * @param expr_text - Markup expression text to inspect.\n * @returns Identifier names referenced by the expression.\n */\nexport function collect_free_identifiers(expr_text: string): string[] {\n\tconst wrapped = `function* __SER___w() { return (${expr_text}); }`;\n\tlet sf: ts.SourceFile;\n\n\ttry {\n\t\tsf = ts.createSourceFile(\n\t\t\t\"expr.ts\",\n\t\t\twrapped,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\t} catch {\n\t\treturn [];\n\t}\n\n\tconst fn = sf.statements[0];\n\n\tif (!ts.isFunctionDeclaration(fn) || !fn.body) {\n\t\treturn [];\n\t}\n\n\tconst ids: string[] = [];\n\tconst locals = new Set<string>();\n\tconst seen = new Set<string>();\n\n\tvisit_ids(fn.body, locals, seen, ids);\n\n\treturn ids;\n}\n\nfunction visit_ids(node: ts.Node, locals: Set<string>, seen: Set<string>, ids: string[]): void {\n\tif (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isFunctionDeclaration(node)\n\t) {\n\t\tconst scoped = new Set(locals);\n\n\t\tif (ts.isFunctionDeclaration(node) && node.name) {\n\t\t\tscoped.add(node.name.text);\n\t\t}\n\n\t\tfor (const parameter of node.parameters) {\n\t\t\tadd_binding_names(parameter.name, scoped);\n\t\t}\n\n\t\tif (node.body) {\n\t\t\tvisit_ids(node.body, scoped, seen, ids);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (ts.isVariableDeclaration(node)) {\n\t\tif (node.initializer) {\n\t\t\tvisit_ids(node.initializer, locals, seen, ids);\n\t\t}\n\n\t\tadd_binding_names(node.name, locals);\n\n\t\treturn;\n\t}\n\n\tif (ts.isTypeReferenceNode(node)) {\n\t\treturn;\n\t}\n\n\tif (ts.isIdentifier(node)) {\n\t\tif (\n\t\t\tnode.text === \"yield\" ||\n\t\t\tnode.text === \"undefined\" ||\n\t\t\tnode.text === \"null\" ||\n\t\t\tnode.text === \"true\" ||\n\t\t\tnode.text === \"false\" ||\n\t\t\tnode.text === \"this\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_property_access_name(node)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!locals.has(node.text) && !seen.has(node.text)) {\n\t\t\tseen.add(node.text);\n\t\t\tids.push(node.text);\n\t\t}\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => visit_ids(child, locals, seen, ids));\n}\n\nfunction add_binding_names(name: ts.BindingName, locals: Set<string>): void {\n\tif (ts.isIdentifier(name)) {\n\t\tlocals.add(name.text);\n\t\treturn;\n\t}\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tadd_binding_names(element.name, locals);\n\t}\n}\n\ntype EventYieldContext = \"top_level\" | \"nested_generator\" | \"nested_invalid\";\n\ninterface EventYieldAnalysis {\n\thas_top_level_yield_star: boolean;\n\thas_nested_invalid_yield_star: boolean;\n}\n\nfunction visit_event_body(\n\tnode: ts.Node,\n\tcontext: EventYieldContext,\n\tresult: EventYieldAnalysis,\n): void {\n\tif (is_yield_star_expression(node)) {\n\t\tif (context === \"top_level\") {\n\t\t\tresult.has_top_level_yield_star = true;\n\t\t} else if (context === \"nested_invalid\") {\n\t\t\tresult.has_nested_invalid_yield_star = true;\n\t\t}\n\n\t\tnode.forEachChild((child) => visit_event_body(child, context, result));\n\t\treturn;\n\t}\n\n\tif (is_nested_function_boundary(node)) {\n\t\tconst next_context = is_generator_function_boundary(node)\n\t\t\t? \"nested_generator\"\n\t\t\t: \"nested_invalid\";\n\n\t\tnode.forEachChild((child) => visit_event_body(child, next_context, result));\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => visit_event_body(child, context, result));\n}\n\nfunction is_nested_function_boundary(node: ts.Node): boolean {\n\treturn (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isFunctionDeclaration(node) ||\n\t\tts.isMethodDeclaration(node) ||\n\t\tts.isGetAccessorDeclaration(node) ||\n\t\tts.isSetAccessorDeclaration(node)\n\t);\n}\n\nfunction is_generator_function_boundary(node: ts.Node): boolean {\n\treturn (\n\t\t(ts.isFunctionExpression(node) ||\n\t\t\tts.isFunctionDeclaration(node) ||\n\t\t\tts.isMethodDeclaration(node)) &&\n\t\tnode.asteriskToken !== undefined\n\t);\n}\n\nfunction is_yield_star_expression(node: ts.Node): boolean {\n\tif (ts.isYieldExpression(node)) {\n\t\treturn node.asteriskToken !== undefined;\n\t}\n\n\treturn (\n\t\tts.isBinaryExpression(node) &&\n\t\tnode.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n\t\tts.isIdentifier(node.left) &&\n\t\tnode.left.text === \"yield\"\n\t);\n}\n\nfunction is_property_access_name(node: ts.Identifier): boolean {\n\tconst parent = node.parent;\n\n\treturn (\n\t\t(ts.isPropertyAccessExpression(parent) && parent.name === node) ||\n\t\t(ts.isPropertyAssignment(parent) && parent.name === node) ||\n\t\t(ts.isBindingElement(parent) && parent.propertyName === node) ||\n\t\tts.isImportSpecifier(parent) ||\n\t\tts.isExportSpecifier(parent)\n\t);\n}\n","import { contains_top_level_yield_star } from \"$/detect.ts\";\nimport type { EffectCallbackRewriteContext } from \"./effect-bindings.ts\";\nimport type { HelperDeclaration } from \"./types.ts\";\n\nimport MagicString from \"magic-string\";\nimport ts from \"typescript\";\n\nconst match_effect_members = new Map([\n\t[\"match\", \"matchEffect\"],\n\t[\"matchCause\", \"matchCauseEffect\"],\n]);\n\nconst effectful_callback_members = new Set([\n\t\"andThen\",\n\t\"catchAll\",\n\t\"catchAllCause\",\n\t\"catchCause\",\n\t\"catchTag\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"tap\",\n\t\"tapError\",\n\t\"tapErrorCause\",\n]);\n\nconst effectful_handler_members = new Set([\"matchCauseEffect\", \"matchEffect\", \"tapBoth\"]);\n\nconst effectful_handler_property_names = new Set([\"onFailure\", \"onSuccess\"]);\n\ninterface RewriteContext {\n\tsource_file: ts.SourceFile;\n\tsource_text: string;\n\tmagic: MagicString;\n\toffset: number;\n\tbindings: EffectCallbackRewriteContext;\n\tchanged: boolean;\n\tuses_wrapper: boolean;\n}\n\ninterface EffectMember {\n\tname: string;\n\tname_start: number;\n\tname_end: number;\n\tdirect: boolean;\n}\n\ntype EffectWrapperMember = \"gen\" | \"sync\";\n\n/**\n * Rewrites effectful callback shorthand inside event handler expressions.\n *\n * @example\n * ```ts\n * normalize_effect_callback_yields(\n * `yield* action.pipe(Effect.flatMap((value) => yield* next(value)))`,\n * collect_effect_callback_bindings(source),\n * );\n * ```\n *\n * @since 2.0.0\n * @param expr_text - Markup expression text before it is wrapped in the\n * generated Effect runner.\n * @param bindings - Local Effect import bindings collected from the Svelte\n * component's script blocks.\n * @returns The expression with nested Effect callback `yield*` shorthand\n * lowered into explicit Effect callbacks, plus any import needed by generated\n * wrapper calls.\n */\nexport function normalize_effect_callback_yields(\n\texpr_text: string,\n\tbindings: EffectCallbackRewriteContext,\n): { expr_text: string; helpers: HelperDeclaration[] } {\n\tconst prefix = \"const __SER___expression = \";\n\tconst source_text = `${prefix}${expr_text};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"event-expression.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst statement = source_file.statements[0];\n\tconst magic = new MagicString(expr_text);\n\tconst context: RewriteContext = {\n\t\tsource_file,\n\t\tsource_text,\n\t\tmagic,\n\t\toffset: prefix.length,\n\t\tbindings,\n\t\tchanged: false,\n\t\tuses_wrapper: false,\n\t};\n\n\tif (!ts.isVariableStatement(statement)) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tconst expression = statement.declarationList.declarations[0]?.initializer;\n\n\tif (!expression) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tvisit_expression(expression, context);\n\n\tif (!context.changed) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tconst helpers =\n\t\tcontext.uses_wrapper && bindings.wrapper_import ? [bindings.wrapper_import] : [];\n\n\treturn {\n\t\texpr_text: magic.toString(),\n\t\thelpers,\n\t};\n}\n\nfunction visit_expression(node: ts.Node, context: RewriteContext): void {\n\tif (is_non_generator_callback_with_top_level_yield(node)) {\n\t\treturn;\n\t}\n\n\tif (ts.isCallExpression(node)) {\n\t\trewrite_match_call(node, context);\n\t\trewrite_effectful_handler_call(node, context);\n\t\trewrite_effectful_callback_arguments(node, context);\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tvisit_expression(child, context);\n\t});\n}\n\nfunction rewrite_match_call(call: ts.CallExpression, context: RewriteContext): void {\n\tconst member = get_effect_member(call.expression, context);\n\tconst upgraded_name = member && match_effect_members.get(member.name);\n\tconst options = get_last_object_argument(call);\n\n\tif (!member || !upgraded_name || !options) {\n\t\treturn;\n\t}\n\n\tconst handlers = get_handler_properties(options);\n\tconst should_upgrade = handlers.some(\n\t\t(handler) =>\n\t\t\thandler.callback && is_non_generator_callback_with_top_level_yield(handler.callback),\n\t);\n\n\tif (!should_upgrade) {\n\t\treturn;\n\t}\n\n\trewrite_effect_member_name(member, upgraded_name, context);\n\tcontext.changed = true;\n\n\tfor (const handler of handlers) {\n\t\tif (!handler.callback) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (is_non_generator_callback_with_top_level_yield(handler.callback)) {\n\t\t\trewrite_callback_to_effect_gen(handler.callback, context);\n\t\t} else {\n\t\t\trewrite_callback_to_effect_sync(handler.callback, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_effectful_handler_call(call: ts.CallExpression, context: RewriteContext): void {\n\tconst member = get_effect_member(call.expression, context);\n\tconst options = get_last_object_argument(call);\n\n\tif (!member || !effectful_handler_members.has(member.name) || !options) {\n\t\treturn;\n\t}\n\n\tfor (const handler of get_handler_properties(options)) {\n\t\tif (handler.callback && is_non_generator_callback_with_top_level_yield(handler.callback)) {\n\t\t\trewrite_callback_to_effect_gen(handler.callback, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_effectful_callback_arguments(\n\tcall: ts.CallExpression,\n\tcontext: RewriteContext,\n): void {\n\tconst member = get_effect_member(call.expression, context);\n\n\tif (!member || !effectful_callback_members.has(member.name)) {\n\t\treturn;\n\t}\n\n\tfor (const argument of call.arguments) {\n\t\tif (\n\t\t\tis_callback_expression(argument) &&\n\t\t\tis_non_generator_callback_with_top_level_yield(argument)\n\t\t) {\n\t\t\trewrite_callback_to_effect_gen(argument, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_callback_to_effect_gen(\n\tcallback: ts.ArrowFunction | ts.FunctionExpression,\n\tcontext: RewriteContext,\n): void {\n\tif (is_async_function(callback)) {\n\t\treturn;\n\t}\n\n\tif (ts.isArrowFunction(callback)) {\n\t\trewrite_arrow_callback(callback, \"gen\", context);\n\t\treturn;\n\t}\n\n\trewrite_function_body(callback, \"gen\", context);\n}\n\nfunction rewrite_callback_to_effect_sync(\n\tcallback: ts.ArrowFunction | ts.FunctionExpression,\n\tcontext: RewriteContext,\n): void {\n\tif (is_async_function(callback)) {\n\t\treturn;\n\t}\n\n\tif (ts.isArrowFunction(callback)) {\n\t\trewrite_arrow_callback(callback, \"sync\", context);\n\t\treturn;\n\t}\n\n\trewrite_function_body(callback, \"sync\", context);\n}\n\nfunction rewrite_arrow_callback(\n\tcallback: ts.ArrowFunction,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): void {\n\tconst start = to_expr_pos(callback.getStart(context.source_file), context);\n\tconst end = to_expr_pos(callback.end, context);\n\tconst params_text = context.source_text\n\t\t.slice(\n\t\t\tcallback.getStart(context.source_file),\n\t\t\tcallback.equalsGreaterThanToken.getStart(context.source_file),\n\t\t)\n\t\t.trim();\n\tconst body_text = get_body_text(callback.body, context);\n\tconst rewritten_body = make_effect_body(callback.body, body_text, wrapper, context);\n\tconst replacement = `${params_text} => ${rewritten_body}`;\n\n\tcontext.magic.overwrite(start, end, replacement);\n\tcontext.changed = true;\n}\n\nfunction rewrite_function_body(\n\tcallback: ts.FunctionExpression,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): void {\n\tconst body_start = to_expr_pos(callback.body.getStart(context.source_file), context);\n\tconst body_end = to_expr_pos(callback.body.end, context);\n\tconst body_text = get_body_text(callback.body, context);\n\tconst rewritten_body = make_effect_body(callback.body, body_text, wrapper, context);\n\n\tcontext.magic.overwrite(body_start, body_end, `{ return ${rewritten_body}; }`);\n\tcontext.changed = true;\n}\n\nfunction make_effect_body(\n\tbody: ts.ConciseBody,\n\tbody_text: string,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): string {\n\tconst wrapper_access = make_effect_access(wrapper, context);\n\n\tif (wrapper === \"gen\") {\n\t\tif (ts.isBlock(body)) {\n\t\t\treturn `${wrapper_access}(function* () ${body_text})`;\n\t\t}\n\n\t\treturn `${wrapper_access}(function* () { return (${body_text}); })`;\n\t}\n\n\tif (ts.isBlock(body)) {\n\t\treturn `${wrapper_access}(() => ${body_text})`;\n\t}\n\n\treturn `${wrapper_access}(() => (${body_text}))`;\n}\n\nfunction get_body_text(body: ts.ConciseBody, context: RewriteContext): string {\n\treturn context.source_text.slice(body.getStart(context.source_file), body.end).trim();\n}\n\nfunction get_handler_properties(object_literal: ts.ObjectLiteralExpression): Array<{\n\tcallback: ts.ArrowFunction | ts.FunctionExpression | undefined;\n}> {\n\treturn object_literal.properties.flatMap((property) => {\n\t\tif (!ts.isPropertyAssignment(property)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst name = get_property_name(property.name);\n\n\t\tif (!name || !effectful_handler_property_names.has(name)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst callback = is_callback_expression(property.initializer)\n\t\t\t? property.initializer\n\t\t\t: undefined;\n\n\t\treturn [{ callback }];\n\t});\n}\n\nfunction get_last_object_argument(call: ts.CallExpression): ts.ObjectLiteralExpression | undefined {\n\tconst last_argument = call.arguments[call.arguments.length - 1];\n\n\tif (!last_argument || !ts.isObjectLiteralExpression(last_argument)) {\n\t\treturn undefined;\n\t}\n\n\treturn last_argument;\n}\n\nfunction get_effect_member(\n\texpression: ts.Expression,\n\tcontext: RewriteContext,\n): EffectMember | undefined {\n\tif (ts.isIdentifier(expression)) {\n\t\tconst direct_member = context.bindings.direct_members.get(expression.text);\n\n\t\tif (!direct_member) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tname: direct_member,\n\t\t\tname_start: to_expr_pos(expression.getStart(context.source_file), context),\n\t\t\tname_end: to_expr_pos(expression.end, context),\n\t\t\tdirect: true,\n\t\t};\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn undefined;\n\t}\n\n\tif (!is_effect_namespace_expression(expression.expression, context)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tname: expression.name.text,\n\t\tname_start: to_expr_pos(expression.name.getStart(context.source_file), context),\n\t\tname_end: to_expr_pos(expression.name.end, context),\n\t\tdirect: false,\n\t};\n}\n\nfunction rewrite_effect_member_name(\n\tmember: EffectMember,\n\tupgraded_name: string,\n\tcontext: RewriteContext,\n): void {\n\tif (member.direct) {\n\t\tcontext.magic.overwrite(\n\t\t\tmember.name_start,\n\t\t\tmember.name_end,\n\t\t\tmake_effect_access(upgraded_name, context),\n\t\t);\n\n\t\treturn;\n\t}\n\n\tcontext.magic.overwrite(member.name_start, member.name_end, upgraded_name);\n}\n\nfunction make_effect_access(member_name: string, context: RewriteContext): string {\n\tcontext.uses_wrapper = true;\n\n\treturn `${context.bindings.wrapper_expression}.${member_name}`;\n}\n\nfunction is_effect_namespace_expression(\n\texpression: ts.Expression,\n\tcontext: RewriteContext,\n): boolean {\n\tif (ts.isIdentifier(expression)) {\n\t\treturn (\n\t\t\tcontext.bindings.effect_object_names.has(expression.text) ||\n\t\t\tcontext.bindings.effect_module_names.has(expression.text)\n\t\t);\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn false;\n\t}\n\n\tif (expression.name.text !== \"Effect\") {\n\t\treturn false;\n\t}\n\n\tif (!ts.isIdentifier(expression.expression)) {\n\t\treturn false;\n\t}\n\n\treturn context.bindings.effect_package_names.has(expression.expression.text);\n}\n\nfunction get_property_name(name: ts.PropertyName): string | undefined {\n\tif (ts.isIdentifier(name) || ts.isStringLiteral(name)) {\n\t\treturn name.text;\n\t}\n\n\treturn undefined;\n}\n\nfunction is_callback_expression(node: ts.Node): node is ts.ArrowFunction | ts.FunctionExpression {\n\treturn ts.isArrowFunction(node) || ts.isFunctionExpression(node);\n}\n\nfunction is_non_generator_callback_with_top_level_yield(\n\tnode: ts.Node,\n): node is ts.ArrowFunction | ts.FunctionExpression {\n\tif (!is_callback_expression(node)) {\n\t\treturn false;\n\t}\n\n\tif (ts.isFunctionExpression(node) && node.asteriskToken) {\n\t\treturn false;\n\t}\n\n\treturn contains_top_level_yield_star(node.body);\n}\n\nfunction is_async_function(node: ts.ArrowFunction | ts.FunctionExpression): boolean {\n\treturn (\n\t\tnode.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword) ?? false\n\t);\n}\n\nfunction to_expr_pos(pos: number, context: RewriteContext): number {\n\treturn pos - context.offset;\n}\n","import { AsyncEffectInEventCallbackError, YieldStarInEventCallbackError } from \"$/errors.ts\";\nimport type { EffectCallbackRewriteContext } from \"./effect-bindings.ts\";\nimport {\n\tanalyze_event_body_yield_star,\n\tcollect_free_identifiers,\n\tis_callback_function_expression,\n} from \"./expressions.ts\";\nimport { normalize_effect_callback_yields } from \"./effect-callbacks.ts\";\nimport type {\n\tHelperDeclaration,\n\tMarkupCandidate,\n\tMarkupHelperBindings,\n\tMarkupNameAllocator,\n\tMarkupTransformTarget,\n\tPendingRelocation,\n\tReplacement,\n\tTagKind,\n} from \"./types.ts\";\n\n/**\n * Emits source edits for classified markup Effect expressions.\n *\n * @since 2.0.0\n * @param classified - Candidates paired with their Svelte markup context.\n * @param effect_context - Effect import bindings available to markup\n * expression rewrites.\n * @returns Replacements ready to apply to the original component source.\n */\nexport function emit_replacements(\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n\teffect_context: EffectCallbackRewriteContext,\n\thelper_bindings: MarkupHelperBindings,\n\tname_allocator: MarkupNameAllocator,\n\ttarget: MarkupTransformTarget,\n): Replacement[] {\n\treturn classified.map(({ candidate, kind }) =>\n\t\temit_replacement(candidate, kind, effect_context, helper_bindings, name_allocator, target),\n\t);\n}\n\nfunction emit_replacement(\n\tcandidate: MarkupCandidate,\n\tkind: TagKind,\n\teffect_context: EffectCallbackRewriteContext,\n\thelper_bindings: MarkupHelperBindings,\n\tname_allocator: MarkupNameAllocator,\n\ttarget: MarkupTransformTarget,\n): Replacement {\n\tconst normalized = normalize_effect_callback_yields(candidate.expr_text, effect_context);\n\tconst normalized_candidate = {\n\t\t...candidate,\n\t\texpr_text: normalized.expr_text,\n\t};\n\tconst id = make_cache_id(candidate);\n\tconst id_text = JSON.stringify(id);\n\tconst helper_name = make_helper_name(candidate, name_allocator);\n\tconst is_server_target = target === \"server\";\n\n\tlet replacement_text: string;\n\tlet helpers: HelperDeclaration[];\n\tlet relocation: PendingRelocation | undefined;\n\n\tif (kind === \"await\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_promise_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\t\"undefined\",\n\t\t\t`{ ssr: \"pending\" }`,\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"render\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_render_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\tcandidate,\n\t\t\thelper_bindings,\n\t\t\tis_server_target,\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"render_argument\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"undefined\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"each\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"[]\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"event\") {\n\t\tconst event = make_event_handler(normalized_candidate, helper_bindings);\n\n\t\treplacement_text = event.text;\n\t\thelpers = normalized.helpers;\n\t\trelocation = make_relocation(candidate, replacement_text, {\n\t\t\toriginalStart: 0,\n\t\t\toriginalEnd: candidate.expr_text.length,\n\t\t\tgeneratedText: event.expr_text,\n\t\t});\n\t} else {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"undefined\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t}\n\n\treturn {\n\t\tstart: candidate.start,\n\t\tend: candidate.end,\n\t\ttext: replacement_text,\n\t\thelpers,\n\t\trelocation,\n\t};\n}\n\nfunction make_event_handler(\n\tcandidate: MarkupCandidate,\n\thelper_bindings: MarkupHelperBindings,\n): { text: string; expr_text: string } {\n\tconst expr_text = candidate.expr_text;\n\n\tif (is_callback_function_expression(expr_text)) {\n\t\tthrow new YieldStarInEventCallbackError(candidate.filename, expr_text);\n\t}\n\n\tconst analysis = analyze_event_body_yield_star(expr_text);\n\n\tif (analysis.has_nested_invalid_yield_star) {\n\t\tthrow new AsyncEffectInEventCallbackError(candidate.filename, expr_text);\n\t}\n\n\treturn {\n\t\texpr_text,\n\t\ttext: `(event) => { ${helper_bindings.dispatcher}.emit({ type: ${helper_bindings.codes}.Markup.Run, fn: function* () { ${expr_text}; } }); }`,\n\t};\n}\n\nfunction emit_promise_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\thelper_bindings: MarkupHelperBindings,\n\tssr_fallback?: string,\n\toptions?: string,\n): string {\n\tconst properties = [\n\t\t`type: ${helper_bindings.codes}.Markup.Promise`,\n\t\t`id: ${id_text}`,\n\t\t`deps: ${effect.deps_text}`,\n\t\t`fn: () => ${effect.call}`,\n\t\tssr_fallback !== undefined && `ssr_fallback: ${ssr_fallback}`,\n\t\toptions !== undefined && `options: ${options}`,\n\t].filter((property): property is string => property !== false);\n\n\treturn `${helper_bindings.dispatcher}.emit({ ${properties.join(\", \")} })`;\n}\n\nfunction emit_render_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\tcandidate: MarkupCandidate,\n\thelper_bindings: MarkupHelperBindings,\n\tis_server_target: boolean,\n): string {\n\tconst expression = emit_promise_expression(\n\t\tid_text,\n\t\teffect,\n\t\thelper_bindings,\n\t\tserver_fallback(is_server_target, `() => undefined`),\n\t);\n\n\tif (/^\\s*yield\\s*\\*/.test(candidate.expr_text)) {\n\t\treturn `(await ${expression})()`;\n\t}\n\n\treturn `await ${expression}`;\n}\n\nfunction emit_await_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\thelper_bindings: MarkupHelperBindings,\n\tssr_fallback?: string,\n): string {\n\treturn `await ${emit_promise_expression(id_text, effect, helper_bindings, ssr_fallback)}`;\n}\n\nfunction server_fallback(is_server_target: boolean, fallback: string): string | undefined {\n\treturn is_server_target ? fallback : undefined;\n}\n\ninterface EffectHelper {\n\thelper: HelperDeclaration;\n\tcall: string;\n\tdeps_text: string;\n}\n\nfunction make_effect_helper(candidate: MarkupCandidate, helper_name: string): EffectHelper {\n\tconst deps = collect_free_identifiers(candidate.expr_text);\n\tconst args_text = deps.join(\", \");\n\tconst deps_text = deps.length === 0 ? \"[]\" : `[${args_text}]`;\n\tconst call = `${helper_name}()`;\n\tconst text = `function* ${helper_name}() { return (${candidate.expr_text}); }`;\n\tconst generated_start = text.indexOf(candidate.expr_text);\n\n\treturn {\n\t\tcall,\n\t\tdeps_text,\n\t\thelper: {\n\t\t\ttext,\n\t\t\trelocation: {\n\t\t\t\toriginalStart: candidate.start,\n\t\t\t\toriginalEnd: candidate.end,\n\t\t\t\tgeneratedStartInReplacement: generated_start,\n\t\t\t\tgeneratedEndInReplacement: generated_start + candidate.expr_text.length,\n\t\t\t},\n\t\t},\n\t};\n}\n\nfunction make_cache_id(candidate: MarkupCandidate): string {\n\tconst normalized_filename = candidate.filename.replace(/[?#].*$/, \"\");\n\n\treturn `${normalized_filename}:${candidate.start}:${candidate.end}`;\n}\n\nfunction make_helper_name(candidate: MarkupCandidate, name_allocator: MarkupNameAllocator): string {\n\treturn name_allocator.reserve(`__SER___markup_effect_${candidate.start}_${candidate.end}`);\n}\n\nfunction make_relocation(\n\tcandidate: MarkupCandidate,\n\treplacement_text: string,\n\tinner: {\n\t\toriginalStart: number;\n\t\toriginalEnd: number;\n\t\tgeneratedText: string;\n\t},\n): PendingRelocation | undefined {\n\tconst generated_start = replacement_text.indexOf(inner.generatedText);\n\n\tif (generated_start === -1) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\toriginalStart: candidate.start + inner.originalStart,\n\t\toriginalEnd: candidate.start + inner.originalEnd,\n\t\tgeneratedStartInReplacement: generated_start,\n\t\tgeneratedEndInReplacement: generated_start + inner.generatedText.length,\n\t};\n}\n","import type MagicString from \"magic-string\";\nimport type ts from \"typescript\";\n\n/**\n * Creates a source map from transformed script back to the original block.\n *\n * @since 2.0.0\n * @param magic - MagicString instance holding the transformed source.\n * @param filename - Source filename used for the source map entry.\n * @returns A plain source map object.\n */\nexport function create_source_map(magic: MagicString, filename: string): Record<string, unknown> {\n\tconst map = magic.generateMap({\n\t\thires: true,\n\t\tincludeContent: true,\n\t\tsource: filename,\n\t});\n\n\treturn map as unknown as Record<string, unknown>;\n}\n\n/**\n * Slices a substring matching a node's full source range.\n *\n * @since 2.0.0\n * @param content - Original source text.\n * @param node - AST node whose full range should be extracted.\n * @returns Source text including leading trivia.\n */\nexport function slice(content: string, node: ts.Node): string {\n\treturn content.slice(node.getFullStart(), node.end);\n}\n\n/**\n * Slices a substring matching a node's source range without leading trivia.\n *\n * @since 2.0.0\n * @param content - Original source text.\n * @param node - AST node whose non-trivia range should be extracted.\n * @returns Source text excluding leading trivia.\n */\nexport function slice_start(content: string, node: ts.Node): string {\n\treturn content.slice(node.getStart(), node.end);\n}\n","import { contains_top_level_yield_star } from \"$/detect.ts\";\nimport { AsyncEffectInSyncRuneError } from \"$/errors.ts\";\nimport { slice } from \"./source.ts\";\n\nimport ts from \"typescript\";\n\nconst ASYNC_EXPRESSION_RUNES = new Set([\n\t\"$derived\",\n\t\"$state\",\n\t\"$state.raw\",\n\t\"$state.snapshot\",\n\t\"$bindable\",\n]);\n\nconst CALLBACK_RUNES = new Set([\"$derived.by\", \"$effect\", \"$effect.pre\", \"$effect.root\"]);\n\n/**\n * Validates that `yield*` only appears in rune positions the script-effect\n * transform can lower without changing the rune's normal Svelte contract.\n *\n * @since 2.0.0\n * @param node - AST node to scan.\n * @param content - Original script source used for diagnostics.\n * @param filename - Source filename used for diagnostics.\n * @returns Nothing.\n */\nexport function validate_rune_yield_usage(node: ts.Node, content: string, filename: string): void {\n\tvisit_rune_yield_usage(node, content, filename);\n}\n\nfunction visit_rune_yield_usage(node: ts.Node, content: string, filename: string): void {\n\tif (ts.isCallExpression(node)) {\n\t\tvalidate_call_expression(node, content, filename);\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tvisit_rune_yield_usage(child, content, filename);\n\t});\n}\n\nfunction validate_call_expression(\n\tcall: ts.CallExpression,\n\tcontent: string,\n\tfilename: string,\n): void {\n\tconst rune_name = get_rune_name(call.expression);\n\n\tif (!rune_name) {\n\t\treturn;\n\t}\n\n\tif (!ASYNC_EXPRESSION_RUNES.has(rune_name) && contains_top_level_yield_star(call)) {\n\t\tthrow new AsyncEffectInSyncRuneError(rune_name, slice(content, call), filename);\n\t}\n\n\tif (!CALLBACK_RUNES.has(rune_name)) {\n\t\treturn;\n\t}\n\n\tconst callback = call.arguments[0];\n\n\tif (!callback || !callback_has_top_level_yield_star(callback)) {\n\t\treturn;\n\t}\n\n\tthrow new AsyncEffectInSyncRuneError(rune_name, slice(content, call), filename);\n}\n\nfunction callback_has_top_level_yield_star(node: ts.Expression): boolean {\n\tif ((ts.isArrowFunction(node) || ts.isFunctionExpression(node)) && node.body !== undefined) {\n\t\treturn contains_top_level_yield_star(node.body);\n\t}\n\n\treturn contains_top_level_yield_star(node);\n}\n\nfunction get_rune_name(expr: ts.Expression): string | undefined {\n\tif (ts.isIdentifier(expr) && is_rune_root(expr.text)) {\n\t\treturn expr.text;\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expr)) {\n\t\treturn undefined;\n\t}\n\n\tconst root_name = get_rune_name(expr.expression);\n\n\tif (!root_name) {\n\t\treturn undefined;\n\t}\n\n\treturn `${root_name}.${expr.name.text}`;\n}\n\nfunction is_rune_root(name: string): boolean {\n\treturn (\n\t\tname === \"$bindable\" ||\n\t\tname === \"$derived\" ||\n\t\tname === \"$effect\" ||\n\t\tname === \"$host\" ||\n\t\tname === \"$inspect\" ||\n\t\tname === \"$props\" ||\n\t\tname === \"$state\"\n\t);\n}\n","import ts from \"typescript\";\n\n/**\n * Checks whether a node is a `yield*` binary expression.\n *\n * @since 2.0.0\n * @param node - TypeScript AST node to check.\n * @returns Whether the node represents `yield * operand`.\n */\nexport function is_yield_star_expression(node: ts.Node): boolean {\n\treturn (\n\t\tts.isBinaryExpression(node) &&\n\t\tnode.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n\t\tts.isIdentifier(node.left) &&\n\t\tnode.left.text === \"yield\"\n\t);\n}\n\n/**\n * Checks whether a node owns its own yield semantics.\n *\n * @since 2.0.0\n * @param node - TypeScript AST node to check.\n * @returns Whether traversal should stop at this function boundary.\n */\nexport function is_function_boundary_node(node: ts.Node): boolean {\n\treturn (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionDeclaration(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isMethodDeclaration(node) ||\n\t\tts.isGetAccessorDeclaration(node) ||\n\t\tts.isSetAccessorDeclaration(node)\n\t);\n}\n\n/**\n * Returns `true` if the node tree contains a top-level `await`.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @returns Whether a top-level await expression was found.\n */\nexport function contains_top_level_await(node: ts.Node): boolean {\n\tif (ts.isAwaitExpression(node)) {\n\t\treturn true;\n\t}\n\n\treturn node\n\t\t.getChildren()\n\t\t.some((child) => !is_function_boundary_node(child) && contains_top_level_await(child));\n}\n\n/**\n * Collects top-level `yield*` nodes under an expression.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @param on_found - Callback invoked for each matching yield node.\n * @returns Nothing.\n */\nexport function collect_yield_star_nodes(node: ts.Node, on_found: (node: ts.Node) => void): void {\n\tif (is_function_boundary_node(node)) {\n\t\treturn;\n\t}\n\n\tif (is_yield_star_expression(node)) {\n\t\ton_found(node);\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tcollect_yield_star_nodes(child, on_found);\n\t});\n}\n\n/**\n * Finds the first top-level `yield*` expression below a node.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @param on_found - Callback invoked with the first matching node.\n * @returns Nothing.\n */\nexport function find_yield_star_node(node: ts.Node, on_found: (node: ts.Node) => void): void {\n\tif (is_function_boundary_node(node)) {\n\t\treturn;\n\t}\n\n\tif (is_yield_star_expression(node)) {\n\t\ton_found(node);\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tfind_yield_star_node(child, on_found);\n\t});\n}\n\n/**\n * Extracts identifier names from a TypeScript binding name.\n *\n * @since 2.0.0\n * @param name - Binding name node to flatten.\n * @returns Identifier names from identifiers and destructuring patterns.\n */\nexport function extract_binding_names(name: ts.BindingName): string[] {\n\tif (ts.isIdentifier(name)) {\n\t\treturn [name.text];\n\t}\n\n\tconst result: string[] = [];\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(...extract_binding_names(element.name));\n\t}\n\n\treturn result;\n}\n","import { validate_rune_yield_usage } from \"$/script-transform/runes.ts\";\nimport { collect_yield_star_nodes } from \"$/script-transform/ast.ts\";\nimport { contains_top_level_yield_star } from \"$/detect.ts\";\nimport { analyze_event_body_yield_star, strip_arrow_function } from \"./expressions.ts\";\nimport { HELPERS } from \"./constants.ts\";\nimport type { MarkupCandidate, TagKind } from \"./types.ts\";\n\nimport MagicString from \"magic-string\";\n\nimport ts from \"typescript\";\n\ninterface SanitizeResult {\n\tcode: string;\n\tcandidates: MarkupCandidate[];\n}\n\ninterface DeclarationYieldExpression {\n\tstart: number;\n\tend: number;\n\texpr_text: string;\n}\n\ninterface SourceRange {\n\tstart: number;\n\tend: number;\n}\n\n/**\n * Replaces markup `yield*` expressions with placeholders before Svelte parses\n * the component.\n *\n * @example\n * ```ts\n * const sanitized = sanitize_markup(\n * `<p>{yield* loadLabel()}</p>`,\n * \"Label.svelte\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param content - Raw Svelte component source to scan for effectful markup\n * expressions.\n * @param filename - Source filename used when validation errors need to point\n * back to the component being transformed.\n * @returns Sanitized source plus placeholder candidates that should be lowered\n * after Svelte classifies their markup positions.\n */\nexport function sanitize_markup(content: string, filename: string): SanitizeResult {\n\tconst candidates: MarkupCandidate[] = [];\n\tconst excluded_ranges = collect_excluded_ranges(content);\n\tconst magic = new MagicString(content);\n\tlet helper_index = 0;\n\tlet cursor = 0;\n\n\twhile (cursor < content.length) {\n\t\tconst open = content.indexOf(\"{\", cursor);\n\t\tif (open === -1) break;\n\n\t\t/** Skip braces inside <script> and <style> blocks. */\n\t\tconst excluded_range = find_excluded_range(excluded_ranges, open);\n\n\t\tif (excluded_range) {\n\t\t\tcursor = excluded_range.end;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** Find the matching closing brace. */\n\t\tconst close = find_closing_brace(content, open + 1);\n\t\tif (close === -1) {\n\t\t\tcursor = open + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst inner = content.slice(open + 1, close);\n\n\t\tconst trimmed = inner.trimStart();\n\t\tconst leading_ws = inner.length - trimmed.length;\n\n\t\tconst tag_info = get_tag_info(trimmed);\n\n\t\tconst declaration_yields = collect_declaration_yield_expressions(\n\t\t\tcontent,\n\t\t\topen,\n\t\t\tleading_ws,\n\t\t\ttrimmed,\n\t\t\tfilename,\n\t\t);\n\n\t\tif (declaration_yields.length > 0) {\n\t\t\tfor (const declaration_yield of declaration_yields) {\n\t\t\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\t\t\thelper_index += 1;\n\n\t\t\t\tcandidates.push({\n\t\t\t\t\tplaceholder,\n\t\t\t\t\tstart: declaration_yield.start,\n\t\t\t\t\tend: declaration_yield.end,\n\t\t\t\t\texpr_text: declaration_yield.expr_text,\n\t\t\t\t\tfilename,\n\t\t\t\t\tkey: \"plain\",\n\t\t\t\t});\n\n\t\t\t\tmagic.overwrite(declaration_yield.start, declaration_yield.end, placeholder);\n\t\t\t}\n\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet expr_body = trimmed.slice(tag_info.prefix_length);\n\n\t\t/** For @const, only use the RHS after `=` as the expression body. */\n\t\tconst equal_idx =\n\t\t\ttag_info.kind === \"plain\" && trimmed.startsWith(\"@const \")\n\t\t\t\t? expr_body.indexOf(\"=\")\n\t\t\t\t: -1;\n\n\t\t/** Check if this is a callback handler containing yield*. */\n\t\tconst is_event_callback = is_event_callback_expression(inner);\n\n\t\t/** Determine if this brace contains yield* that needs lowering. */\n\t\tconst event_yield = is_event_callback ? analyze_event_yield(inner) : undefined;\n\t\tconst has_yield =\n\t\t\tevent_yield?.has_top_level_yield_star ?? contains_yield_star_in_text(expr_body);\n\n\t\tif (!has_yield) {\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** The expression starts after the tag prefix. For @const, after the `=`. */\n\t\tlet extra_prefix = 0;\n\n\t\tif (equal_idx !== -1) {\n\t\t\tconst after_eq_raw = expr_body.slice(equal_idx + 1);\n\t\t\texpr_body = after_eq_raw.trimStart();\n\t\t\textra_prefix = equal_idx + 1 + (after_eq_raw.length - expr_body.length);\n\t\t}\n\n\t\tconst expr_start = open + 1 + leading_ws + tag_info.prefix_length + extra_prefix;\n\n\t\t/** For each/await, the expression ends before ` as ` or ` then `/` catch `. */\n\t\tlet expr_end = close;\n\n\t\tconst key = tag_info.kind;\n\n\t\tif (key === \"each\") {\n\t\t\tconst as_idx = expr_body.lastIndexOf(\" as \");\n\t\t\tif (as_idx !== -1) expr_end = expr_start + as_idx;\n\t\t}\n\n\t\tif (key === \"await\") {\n\t\t\tconst then_idx = expr_body.indexOf(\" then \");\n\t\t\tconst catch_idx = expr_body.indexOf(\" catch \");\n\t\t\tconst boundary = Math.min(\n\t\t\t\tthen_idx === -1 ? Infinity : then_idx,\n\t\t\t\tcatch_idx === -1 ? Infinity : catch_idx,\n\t\t\t);\n\t\t\tif (boundary !== Infinity) expr_end = expr_start + boundary;\n\t\t}\n\n\t\tconst expr_text = content.slice(expr_start, expr_end).trim();\n\n\t\tif (expr_text.length === 0) {\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tvalidate_expression_yield_usage(expr_text, filename);\n\n\t\tif (key === \"render\" && !/^\\s*yield\\s*\\*/.test(expr_text)) {\n\t\t\tconst render_arg_yields = collect_expression_yield_expressions(\n\t\t\t\tcontent,\n\t\t\t\texpr_start,\n\t\t\t\texpr_text,\n\t\t\t\tfilename,\n\t\t\t);\n\n\t\t\tif (render_arg_yields.length > 0) {\n\t\t\t\tfor (const render_arg_yield of render_arg_yields) {\n\t\t\t\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\t\t\t\thelper_index += 1;\n\n\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\tstart: render_arg_yield.start,\n\t\t\t\t\t\tend: render_arg_yield.end,\n\t\t\t\t\t\texpr_text: render_arg_yield.expr_text,\n\t\t\t\t\t\tfilename,\n\t\t\t\t\t\tkey: \"render_argument\",\n\t\t\t\t\t});\n\n\t\t\t\t\tmagic.overwrite(render_arg_yield.start, render_arg_yield.end, placeholder);\n\t\t\t\t}\n\n\t\t\t\tcursor = close + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t/** Create a placeholder and replace the expression (preserving tag prefixes). */\n\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\thelper_index += 1;\n\n\t\tcandidates.push({\n\t\t\tplaceholder,\n\t\t\tstart: expr_start,\n\t\t\tend: expr_end,\n\t\t\texpr_text,\n\t\t\tfilename,\n\t\t\tkey,\n\t\t});\n\n\t\tmagic.overwrite(expr_start, expr_end, key === \"render\" ? `${placeholder}()` : placeholder);\n\n\t\tcursor = close + 1;\n\t}\n\n\treturn { code: magic.toString(), candidates };\n}\n\nfunction collect_expression_yield_expressions(\n\tcontent: string,\n\texpr_start: number,\n\texpr_text: string,\n\tfilename: string,\n): DeclarationYieldExpression[] {\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-expression.ts\",\n\t\t`const __SER___expr = ${expr_text};`,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt || !ts.isVariableStatement(stmt)) {\n\t\treturn [];\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_file.text, filename);\n\n\tconst initializer = stmt.declarationList.declarations[0]?.initializer;\n\n\tif (!initializer || !contains_top_level_yield_star(initializer)) {\n\t\treturn [];\n\t}\n\n\tconst prefix_length = source_file.text.indexOf(expr_text);\n\tconst expressions: DeclarationYieldExpression[] = [];\n\n\tcollect_yield_star_nodes(initializer, (yield_node) => {\n\t\tconst start = expr_start + yield_node.getStart(source_file) - prefix_length;\n\t\tconst end = expr_start + yield_node.end - prefix_length;\n\t\tconst yielded_text = content.slice(start, end).trim();\n\n\t\texpressions.push({\n\t\t\tstart,\n\t\t\tend,\n\t\t\texpr_text: yielded_text,\n\t\t});\n\t});\n\n\treturn expressions;\n}\n\nfunction collect_excluded_ranges(content: string): SourceRange[] {\n\tconst ranges = [\n\t\t...collect_tag_ranges(content, \"script\"),\n\t\t...collect_tag_ranges(content, \"style\"),\n\t\t...collect_html_comment_ranges(content),\n\t];\n\n\tranges.sort((a, b) => a.start - b.start);\n\n\treturn merge_ranges(ranges);\n}\n\nfunction collect_tag_ranges(content: string, tag: string): SourceRange[] {\n\tconst pattern = new RegExp(`<${tag}\\\\b[^>]*>([\\\\s\\\\S]*?)<\\\\/${tag}\\\\s*>`, \"gi\");\n\n\treturn [...content.matchAll(pattern)].flatMap((match) => {\n\t\tif (match.index === undefined) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tstart: match.index,\n\t\t\t\tend: match.index + match[0].length,\n\t\t\t},\n\t\t];\n\t});\n}\n\nfunction collect_html_comment_ranges(content: string): SourceRange[] {\n\tconst ranges: SourceRange[] = [];\n\tlet cursor = 0;\n\n\twhile (cursor < content.length) {\n\t\tconst start = content.indexOf(\"<!--\", cursor);\n\n\t\tif (start === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst close = content.indexOf(\"-->\", start + \"<!--\".length);\n\t\tconst end = close === -1 ? content.length : close + \"-->\".length;\n\n\t\tranges.push({ start, end });\n\n\t\tcursor = end;\n\t}\n\n\treturn ranges;\n}\n\nfunction merge_ranges(ranges: SourceRange[]): SourceRange[] {\n\tconst merged: SourceRange[] = [];\n\n\tfor (const range of ranges) {\n\t\tconst previous = merged.at(-1);\n\n\t\tif (!previous || range.start > previous.end) {\n\t\t\tmerged.push({ ...range });\n\t\t\tcontinue;\n\t\t}\n\n\t\tprevious.end = Math.max(previous.end, range.end);\n\t}\n\n\treturn merged;\n}\n\nfunction find_excluded_range(ranges: SourceRange[], pos: number): SourceRange | undefined {\n\tlet low = 0;\n\tlet high = ranges.length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = Math.floor((low + high) / 2);\n\t\tconst range = ranges[mid];\n\n\t\tif (pos <= range.start) {\n\t\t\thigh = mid - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (pos >= range.end) {\n\t\t\tlow = mid + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn range;\n\t}\n\n\treturn undefined;\n}\n\n/** Brace matching helpers for extracting complete markup expressions. */\n\nfunction find_closing_brace(content: string, start: number): number {\n\tlet depth = 0;\n\n\tfor (let i = start; i < content.length; i += 1) {\n\t\tconst ch = content[i];\n\n\t\tif (ch === \"{\" && content[i - 1] !== \"$\") {\n\t\t\tdepth += 1;\n\t\t} else if (ch === \"}\") {\n\t\t\tif (depth === 0) return i;\n\t\t\tdepth -= 1;\n\t\t} else if (ch === \"'\" || ch === '\"' || ch === \"`\") {\n\t\t\ti = skip_string(content, i, ch);\n\t\t\tif (i === -1) return -1;\n\t\t} else if (ch === \"/\" && content[i + 1] === \"/\") {\n\t\t\ti = skip_line_comment(content, i);\n\t\t} else if (ch === \"/\" && content[i + 1] === \"*\") {\n\t\t\ti = skip_block_comment(content, i);\n\t\t\tif (i === -1) return -1;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction skip_string(content: string, start: number, quote: string): number {\n\tfor (let i = start + 1; i < content.length; i += 1) {\n\t\tif (content[i] === \"\\\\\") {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (content[i] === quote) return i;\n\t}\n\treturn -1;\n}\n\nfunction skip_line_comment(content: string, start: number): number {\n\tfor (let i = start + 2; i < content.length; i += 1) {\n\t\tif (content[i] === \"\\n\") return i;\n\t}\n\treturn content.length;\n}\n\nfunction skip_block_comment(content: string, start: number): number {\n\tfor (let i = start + 2; i < content.length; i += 1) {\n\t\tif (content[i] === \"*\" && content[i + 1] === \"/\") return i + 1;\n\t}\n\treturn -1;\n}\n\ninterface TagInfo {\n\tkind: TagKind;\n\tprefix_length: number;\n}\n\nfunction get_tag_info(trimmed: string): TagInfo {\n\tif (trimmed.startsWith(\"#each \")) {\n\t\treturn { kind: \"each\", prefix_length: \"#each \".length };\n\t}\n\tif (trimmed.startsWith(\"#await \")) {\n\t\treturn { kind: \"await\", prefix_length: \"#await \".length };\n\t}\n\tif (trimmed.startsWith(\"@render \")) {\n\t\treturn { kind: \"render\", prefix_length: \"@render \".length };\n\t}\n\n\t/** Strip prefix-only tags — the expression starts after the tag keyword. */\n\tif (trimmed.startsWith(\"#if \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"#if \".length };\n\t}\n\tif (trimmed.startsWith(\":else if \")) {\n\t\treturn { kind: \"plain\", prefix_length: \":else if \".length };\n\t}\n\tif (trimmed.startsWith(\"#key \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"#key \".length };\n\t}\n\tif (trimmed.startsWith(\"@const \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@const \".length };\n\t}\n\tif (trimmed.startsWith(\"@html \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@html \".length };\n\t}\n\tif (trimmed.startsWith(\"@debug \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@debug \".length };\n\t}\n\n\treturn { kind: \"plain\", prefix_length: 0 };\n}\n\nfunction collect_declaration_yield_expressions(\n\tcontent: string,\n\topen: number,\n\tleading_ws: number,\n\ttrimmed: string,\n\tfilename: string,\n): DeclarationYieldExpression[] {\n\tif (!is_declaration_tag_text(trimmed)) {\n\t\treturn [];\n\t}\n\n\tconst source_text = `${trimmed};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"declaration-tag.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt || !ts.isVariableStatement(stmt)) {\n\t\treturn [];\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_text, filename);\n\n\tconst tag_start = open + 1 + leading_ws;\n\n\treturn stmt.declarationList.declarations.flatMap((decl) => {\n\t\tconst expressions: DeclarationYieldExpression[] = [];\n\n\t\tcollect_yield_star_nodes(decl, (yield_node) => {\n\t\t\tconst start = tag_start + yield_node.getStart(source_file);\n\t\t\tconst end = tag_start + yield_node.end;\n\t\t\tconst expr_text = content.slice(start, end).trim();\n\n\t\t\texpressions.push({\n\t\t\t\tstart,\n\t\t\t\tend,\n\t\t\t\texpr_text,\n\t\t\t});\n\t\t});\n\n\t\treturn expressions;\n\t});\n}\n\nfunction is_declaration_tag_text(trimmed: string): boolean {\n\treturn /^(?:const|let)\\s/.test(trimmed);\n}\n\nfunction validate_expression_yield_usage(expr_text: string, filename: string): void {\n\tconst source_text = `const __SER___expr = ${expr_text};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-expression.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt) {\n\t\treturn;\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_text, filename);\n}\n\nfunction is_event_callback_expression(inner: string): boolean {\n\tconst trimmed = inner.trimStart();\n\n\treturn (\n\t\t/^(?:async\\s+)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>/.test(trimmed) ||\n\t\t/^(?:async\\s+)?function\\b/.test(trimmed)\n\t);\n}\n\nfunction analyze_event_yield(inner: string): {\n\thas_top_level_yield_star: boolean;\n} {\n\tconst event = strip_arrow_function(inner);\n\tconst analysis = analyze_event_body_yield_star(event.body);\n\tconst generated_run = new RegExp(\n\t\t`${HELPERS.dispatcher}(?:_\\\\d+)?\\\\.emit\\\\(\\\\{\\\\s*type:\\\\s*${HELPERS.codes}(?:_\\\\d+)?\\\\.Markup\\\\.Run`,\n\t);\n\n\tif (generated_run.test(event.body)) {\n\t\treturn {\n\t\t\thas_top_level_yield_star: false,\n\t\t};\n\t}\n\n\treturn {\n\t\thas_top_level_yield_star:\n\t\t\tanalysis.has_top_level_yield_star ||\n\t\t\tanalysis.has_nested_invalid_yield_star ||\n\t\t\t/\\byield\\s*\\*/.test(event.body),\n\t};\n}\n\nfunction contains_yield_star_in_text(text: string): boolean {\n\tif (!/\\byield\\s*\\*/.test(text)) return false;\n\n\ttry {\n\t\tconst sf = ts.createSourceFile(\n\t\t\t\"expr.ts\",\n\t\t\t`const x = ${text};`,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\t\tconst stmt = sf.statements[0];\n\t\tif (!ts.isVariableStatement(stmt)) return false;\n\t\tconst decl = stmt.declarationList.declarations[0];\n\t\tif (!decl?.initializer) return false;\n\t\treturn contains_top_level_yield_star(decl.initializer);\n\t} catch {\n\t\treturn true;\n\t}\n}\n\n/** Free identifier collection helpers for generated closures. */\n","import {\n\tblank_script_blocks,\n\tcreate_relocations,\n\tcreate_source_map,\n\tinject_helpers,\n\tmake_markup_helper_bindings,\n} from \"./apply.ts\";\nimport type { MarkupTransformOptions, MarkupTransformResult } from \"./types.ts\";\nimport { collect_effect_callback_bindings } from \"./effect-bindings.ts\";\nimport { UnsupportedMarkupEffectPositionError } from \"$/errors.ts\";\nimport { classify_candidates } from \"./classify.ts\";\nimport { type AST, parse } from \"svelte/compiler\";\nimport { emit_replacements } from \"./emit.ts\";\nimport { sanitize_markup } from \"./scan.ts\";\n\nimport MagicString from \"magic-string\";\n\nexport type {\n\tMarkupRelocation,\n\tMarkupTransformOptions,\n\tMarkupTransformResult,\n\tMarkupTransformTarget,\n} from \"./types.ts\";\n\n/**\n * Transforms Svelte markup containing `{yield* expr}` brace expressions\n * into generated dispatcher events.\n *\n * Strategy: first find all brace expressions containing `yield*` via\n * character scanning, replace them with placeholder identifiers, then\n * parse the sanitized markup with Svelte's AST to determine the correct\n * context for each placeholder (plain expression, #each, #await, event\n * handler, etc.).\n *\n * @example\n * ```ts\n * const result = transform_markup_effect(\n * \"<button onclick={yield* save()}>Save</button>\",\n * \"SaveButton.svelte\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param content - The raw `.svelte` file content.\n * @param filename - The source filename, used in error messages.\n * @param options - Optional transform target configuration.\n * @returns The transformed markup and a flag indicating whether yield* was\n * found.\n */\nexport function transform_markup_effect(\n\tcontent: string,\n\tfilename: string,\n\toptions: MarkupTransformOptions = {},\n): MarkupTransformResult {\n\tif (!/\\byield\\s*\\*/.test(content)) {\n\t\treturn { code: content, has_yield: false };\n\t}\n\n\t/** Find all brace expressions containing yield* and replace with placeholders. */\n\tconst work = sanitize_markup(content, filename);\n\tconst effect_context = collect_effect_callback_bindings(content);\n\tconst helper_context = make_markup_helper_bindings(content);\n\n\tif (work.candidates.length === 0) {\n\t\treturn { code: content, has_yield: false };\n\t}\n\n\t/** Parse the sanitized markup with Svelte's AST. Strip <script> blocks\n\t * first so TypeScript syntax (import type, etc.) doesn't break the parser. */\n\tconst clean = blank_script_blocks(work.code);\n\tconst ast = parse(clean, { filename, modern: true }) as AST.Root;\n\n\t/** Match placeholders to their AST context and build replacements. */\n\tconst classified = classify_candidates(ast, work.candidates);\n\tconst matched = new Set(classified.map(({ candidate }) => candidate.placeholder));\n\tconst unmatched = work.candidates.find((candidate) => !matched.has(candidate.placeholder));\n\n\tif (unmatched) {\n\t\tthrow new UnsupportedMarkupEffectPositionError(filename, unmatched.expr_text);\n\t}\n\n\tconst replacements = emit_replacements(\n\t\tclassified,\n\t\teffect_context,\n\t\thelper_context.bindings,\n\t\thelper_context.name_allocator,\n\t\toptions.target ?? \"client\",\n\t);\n\tconst helpers = replacements.flatMap((replacement) => replacement.helpers ?? []);\n\n\tconst magic = new MagicString(content);\n\n\treplacements.sort((a, b) => b.start - a.start);\n\n\tfor (const r of replacements) {\n\t\tmagic.overwrite(r.start, r.end, r.text);\n\t}\n\n\tconst helper_insertion = inject_helpers(magic, content, helpers, helper_context.bindings);\n\tconst relocations = create_relocations(replacements, helper_insertion);\n\n\treturn {\n\t\tcode: magic.toString(),\n\t\thas_yield: true,\n\t\tmap: create_source_map(magic, filename),\n\t\trelocations,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAAgB,aACf,mBACA,uBACA,oBACA,WAAkC;CACjC,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,QAAQ;CACR,SAAS;CACT,SAAS;AACV,GACA,UAAgC,CAAC,GACxB;CACT,MAAM,mBAAmB,QAAQ,oBAAoB;CACrD,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,gBAAgB,QAAQ,iBAAiB;CAE/C,MAAM,oBACL,SAAS,eAAe,mBACrB,gFACA,8BAA8B,SAAS,WAAW;CAEtD,MAAM,iBACL,SAAS,YAAY,YAClB,sCACA,uBAAuB,SAAS,QAAQ;CAE5C,MAAM,gBAAgB,oBACnB,QACA,SAAS,WAAW,WACnB,qCACA,sBAAsB,SAAS,OAAO;CAE1C,OAAO;EACN,oBAAoB,CAAC,yBAAyB;EAC9C,iBAAiB,CAAC,sBAAsB;EACxC,gBAAgB;CACjB,CAAC,CACC,OAAO,OAAO,CAAC,CACf,KAAK,IAAI;AACZ;;;;;;;;;;AAWA,SAAgB,yBACf,aACA,aACA,YACU;CACV,OAAO,YAAY,WAAW,MAAM,SAAS;EAC5C,IACC,CAAC,GAAG,oBAAoB,IAAI,KAC5B,CAAC,GAAG,gBAAgB,KAAK,eAAe,KACxC,KAAK,gBAAgB,SAAS,aAE9B,OAAO;EAGR,MAAM,SAAS,KAAK;EAEpB,IAAI,CAAC,UAAU,OAAO,YACrB,OAAO;EAGR,IAAI,OAAO,MAAM,SAAS,YACzB,OAAO;EAGR,MAAM,iBAAiB,OAAO;EAE9B,IAAI,CAAC,gBACJ,OAAO;EAGR,I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