svelte-effect-runtime 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.dist/chunks/{client-Cruhk6Oo.js → client-DRjQiULJ.js} +10 -9
  2. package/.dist/chunks/client-DRjQiULJ.js.map +1 -0
  3. package/.dist/chunks/{dispatcher-FCsx1Hlh.js → dispatcher-CLSN-Cxn.js} +3 -3
  4. package/.dist/chunks/{dispatcher-FCsx1Hlh.js.map → dispatcher-CLSN-Cxn.js.map} +1 -1
  5. package/.dist/chunks/{dispatcher-CgCdn6bj.js → dispatcher-CZvLODNK.js} +4 -3
  6. package/.dist/chunks/dispatcher-CZvLODNK.js.map +1 -0
  7. package/.dist/chunks/errors-DppSJ83S.js +692 -0
  8. package/.dist/chunks/errors-DppSJ83S.js.map +1 -0
  9. package/.dist/chunks/{runtime-Sl685BVb.js → runtime-BgCRz_rL.js} +4 -3
  10. package/.dist/chunks/runtime-BgCRz_rL.js.map +1 -0
  11. package/.dist/chunks/{transform-BTStPHku.js → transform-B7_CCcvq.js} +3 -213
  12. package/.dist/chunks/transform-B7_CCcvq.js.map +1 -0
  13. package/.dist/dispatcher.js +1 -1
  14. package/.dist/errors.d.ts +544 -0
  15. package/.dist/internal/generators.js +1 -1
  16. package/.dist/internal/remote-client.js +1 -1
  17. package/.dist/markup/promise.js +1 -1
  18. package/.dist/markup/run.js +1 -1
  19. package/.dist/markup/transform.js +1 -1
  20. package/.dist/markup/value.js +1 -1
  21. package/.dist/mod.d.ts +1 -0
  22. package/.dist/mod.js +4 -3
  23. package/.dist/mod.js.map +1 -1
  24. package/.dist/remote/client.js +1 -1
  25. package/.dist/remote/server.js +3 -2
  26. package/.dist/remote/server.js.map +1 -1
  27. package/.dist/runtime/transform.js +2 -1
  28. package/.dist/runtime/transform.js.map +1 -1
  29. package/.dist/server.js +12 -11
  30. package/.dist/server.js.map +1 -1
  31. package/package.json +1 -1
  32. package/.dist/chunks/client-Cruhk6Oo.js.map +0 -1
  33. package/.dist/chunks/dispatcher-CgCdn6bj.js.map +0 -1
  34. package/.dist/chunks/runtime-Sl685BVb.js.map +0 -1
  35. package/.dist/chunks/transform-BTStPHku.js.map +0 -1
  36. package/.dist/error.d.ts +0 -140
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-DppSJ83S.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/errors.ts"],"sourcesContent":["/**\n * Base class for runtime-authored errors. The class gives every local failure\n * a stable JavaScript error name while preserving the technical message that\n * reaches Vite, SvelteKit, and test output.\n *\n * @example\n * ```ts\n * throw new RuntimeError(\"Invariant violated.\");\n * ```\n *\n * @since 2.4.0\n * @param message - Technical diagnostic message describing the failed runtime\n * invariant.\n * @returns A runtime-authored Error instance.\n */\nexport class RuntimeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"RuntimeError\";\n }\n}\n\n/**\n * Formats a runtime-owned error message with a stable screaming-case code.\n *\n * @example\n * ```ts\n * throw new Error(make_error_message(\"DISPATCHER_DISPOSED\", \"Dispatcher has been disposed\"));\n * ```\n *\n * @since 2.0.0\n * @param code - Stable screaming-case identifier for the error category.\n * @param message - Human-readable error message without the leading code.\n * @returns The complete error message prefixed with the stable code.\n */\nexport function make_error_message(code: string, message: string): string {\n return `[${code}]: ${message}`;\n}\n\n/**\n * Base error class for all preprocessor errors emitted during script and\n * markup transformation. Carries the source filename so error messages can\n * reference the affected file.\n *\n * @example\n * ```ts\n * throw new PreprocessError(\"Component.svelte: invalid transform input.\", \"Component.svelte\");\n * ```\n *\n * @since 2.0.0\n * @param message - Technical diagnostic message for the transform failure.\n * @param filename - Source filename that triggered the transform failure.\n * @returns A preprocessor Error instance with source file context.\n */\nexport class PreprocessError extends RuntimeError {\n /**\n * The source filename that triggered this error.\n *\n * @since 2.0.0\n */\n readonly filename: string;\n\n constructor(message: string, filename: string) {\n super(message);\n this.name = \"PreprocessError\";\n this.filename = filename;\n }\n}\n\n/**\n * Thrown when a statement mixes JavaScript `await` with Effect `yield*` work\n * that must be lowered into an `Effect.gen` program.\n *\n * @example\n * ```ts\n * throw new AwaitInEffectWorkError(\"Component.svelte\", \"const value = await load();\");\n * ```\n *\n * @since 2.0.0\n * @param filename - Source filename containing the unsupported statement.\n * @param statement_text - Full source text for the statement containing\n * mixed async work.\n * @returns A preprocessor Error instance with statement context.\n */\nexport class AwaitInEffectWorkError extends PreprocessError {\n /**\n * The full text of the problematic statement containing mixed async work.\n *\n * @since 2.0.0\n */\n readonly statement_text: string;\n\n constructor(filename: string, statement_text: string) {\n super(\n [\n make_error_message(\n \"AWAIT_IN_EFFECT_WORK\",\n `${filename}: await cannot be mixed with yield* in Effect work.`,\n ),\n `Top-level await is supported as ordinary Svelte async rendering, but statements lowered into Effect.gen must use yield* for async Effect work.`,\n \"\",\n `Problematic statement:`,\n statement_text,\n ].join(\"\\n\"),\n filename,\n );\n this.name = \"AwaitInEffectWorkError\";\n this.statement_text = statement_text;\n }\n}\n\n/**\n * Thrown when async Effect work appears inside a Svelte rune position that\n * must stay synchronous.\n *\n * @example\n * ```ts\n * throw new AsyncEffectInSyncRuneError(\"$derived\", \"$derived(yield* load())\", \"Component.svelte\");\n * ```\n *\n * @since 2.0.0\n * @param rune_name - Name of the Svelte rune containing the unsupported async\n * Effect work.\n * @param expression_text - Full source text for the rune expression.\n * @param filename - Source filename containing the unsupported rune.\n * @returns A preprocessor Error instance with rune source context.\n */\nexport class AsyncEffectInSyncRuneError extends PreprocessError {\n /**\n * The name of the rune that contained async Effect work.\n *\n * @since 2.0.0\n */\n readonly rune_name: string;\n\n /**\n * The full text of the expression that triggered the error.\n *\n * @since 2.0.0\n */\n readonly expression_text: string;\n\n constructor(rune_name: string, expression_text: string, filename: string) {\n super(\n [\n make_error_message(\n \"ASYNC_EFFECT_IN_SYNC_RUNE\",\n `${filename}: yield* cannot be used inside ${rune_name}().`,\n ),\n `${rune_name}() must stay synchronous. Do not put async Effect work inside this rune.`,\n \"\",\n `Problematic expression:`,\n expression_text,\n ].join(\"\\n\"),\n filename,\n );\n this.name = \"AsyncEffectInSyncRuneError\";\n this.rune_name = rune_name;\n this.expression_text = expression_text;\n }\n}\n\n/**\n * Thrown when async Effect work appears inside a non-generator callback nested\n * in a markup event handler.\n *\n * @example\n * ```ts\n * throw new AsyncEffectInEventCallbackError(\n * \"Component.svelte\",\n * \"Effect.try(() => yield* save())\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param filename - Source filename containing the invalid event handler.\n * @param expression_text - Event handler expression that contains the nested\n * unsupported async Effect work.\n * @returns A preprocessor Error instance with event expression context.\n */\nexport class AsyncEffectInEventCallbackError extends PreprocessError {\n /**\n * The full text of the problematic event handler body.\n *\n * @since 2.0.0\n */\n readonly expression_text: string;\n\n constructor(filename: string, expression_text: string) {\n super(\n [\n make_error_message(\n \"ASYNC_EFFECT_IN_EVENT_CALLBACK\",\n `${filename}: yield* cannot be used inside a nested non-generator callback in a markup event handler.`,\n ),\n `Move the yield* to the event handler body. Effect.try and Effect.sync callbacks are plain synchronous JavaScript; do not call Effect-returning functions inside them.`,\n \"\",\n `Run the remote Effect directly:`,\n ` onclick={yield* UpvotePost(id)}`,\n \"\",\n `Recover from remote failures by composing the Effect value:`,\n ` onclick={yield* UpvotePost(id).pipe(Effect.catch(() => Effect.void))}`,\n \"\",\n `Problematic expression:`,\n expression_text,\n ].join(\"\\n\"),\n filename,\n );\n this.name = \"AsyncEffectInEventCallbackError\";\n this.expression_text = expression_text;\n }\n}\n\n/**\n * Thrown when an event handler callback contains the old raw `yield*`\n * shorthand. Effectful event handlers must put `yield*` directly in the event\n * attribute so the callback boundary is generated by the markup runtime.\n *\n * @example\n * ```ts\n * throw new YieldStarInEventCallbackError(\"Component.svelte\", \"() => yield* save()\");\n * ```\n *\n * @since 2.0.0\n * @param filename - Svelte component filename used to identify where the\n * invalid event handler callback was found.\n * @param expression_text - Original event handler callback text that contained\n * `yield*` and should be rewritten as a direct event Effect expression.\n * @returns A preprocessor Error instance with event callback context.\n */\nexport class YieldStarInEventCallbackError extends PreprocessError {\n /**\n * The full text of the problematic event handler callback.\n *\n * @since 2.0.0\n */\n readonly expression_text: string;\n\n constructor(filename: string, expression_text: string) {\n super(\n [\n make_error_message(\n \"ASYNC_EFFECT_IN_EVENT_HANDLER_CALLBACK\",\n `${filename}: yield* in markup event handlers must be written directly as the event attribute value.`,\n ),\n `SER generates the event callback for effectful event handlers; do not put yield* inside a JavaScript callback.`,\n \"\",\n `Use this form:`,\n ` onclick={yield* UpvotePost(id)}`,\n \"\",\n `Instead of this form:`,\n ` onclick={() => yield* UpvotePost(id)}`,\n \"\",\n `Problematic expression:`,\n expression_text,\n ].join(\"\\n\"),\n filename,\n );\n this.name = \"YieldStarInEventCallbackError\";\n this.expression_text = expression_text;\n }\n}\n\n/**\n * Thrown when async Effect work appears in a markup position SER cannot lower\n * safely.\n *\n * @example\n * ```ts\n * throw new UnsupportedMarkupEffectPositionError(\n * \"Component.svelte\",\n * \"value={yield* load()}\",\n * );\n * ```\n *\n * @since 2.4.2\n * @param filename - Source filename containing the unsupported markup.\n * @param expression_text - The unsupported markup expression text.\n * @returns A preprocessor Error instance with markup source context.\n */\nexport class UnsupportedMarkupEffectPositionError extends PreprocessError {\n /**\n * The unsupported markup expression text.\n *\n * @since 2.4.2\n */\n readonly expression_text: string;\n\n constructor(filename: string, expression_text: string) {\n super(\n [\n make_error_message(\n \"UNSUPPORTED_MARKUP_EFFECT_POSITION\",\n `${filename}: yield* cannot be used in this markup position.`,\n ),\n `Move the Effect work into a supported expression tag, block expression, render expression, declaration tag, or event handler.`,\n \"\",\n `Problematic expression:`,\n expression_text,\n ].join(\"\\n\"),\n filename,\n );\n this.name = \"UnsupportedMarkupEffectPositionError\";\n this.expression_text = expression_text;\n }\n}\n\n/**\n * Thrown when the request-scoped SvelteKit event context is read outside a\n * remote handler.\n *\n * @example\n * ```ts\n * throw new RequestEventUnavailableError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing missing request context.\n */\nexport class RequestEventUnavailableError extends RuntimeError {\n constructor() {\n super(\n \"RequestEvent is only available while a SER remote handler is executing inside a request-scoped Effect context.\",\n );\n this.name = \"RequestEventUnavailableError\";\n }\n}\n\n/**\n * Thrown when an unchecked Query declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Query overload usage.\n */\nexport class UncheckedQueryHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Query('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute by itself.\",\n );\n this.name = \"UncheckedQueryHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when a batch Query declaration omits the batch handler.\n *\n * @example\n * ```ts\n * throw new BatchQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid batch Query overload usage.\n */\nexport class BatchQueryHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Query.batch requires a concrete batch handler function; the batch helper cannot infer a handler from schema metadata alone.\",\n );\n this.name = \"BatchQueryHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when an unchecked live Query declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedLiveQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid live Query overload usage.\n */\nexport class UncheckedLiveQueryHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Query.live('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce a live source.\",\n );\n this.name = \"UncheckedLiveQueryHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when an unchecked Command declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedCommandHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Command overload usage.\n */\nexport class UncheckedCommandHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Command('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute a command.\",\n );\n this.name = \"UncheckedCommandHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when an unchecked Form declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedFormHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Form overload usage.\n */\nexport class UncheckedFormHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Form('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot process form data.\",\n );\n this.name = \"UncheckedFormHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when an unchecked Prerender declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedPrerenderHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Prerender overload usage.\n */\nexport class UncheckedPrerenderHandlerMissingError extends RuntimeError {\n constructor() {\n super(\n \"Prerender('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce prerendered data.\",\n );\n this.name = \"UncheckedPrerenderHandlerMissingError\";\n }\n}\n\n/**\n * Thrown when a live query handler resolves to a value that cannot be streamed.\n *\n * @example\n * ```ts\n * throw new InvalidLiveQueryReturnError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the expected live query return protocol.\n */\nexport class InvalidLiveQueryReturnError extends RuntimeError {\n constructor() {\n super(\n \"Query.live handler must return an Effect Stream, Iterable, or AsyncIterable; resolved values must expose a streaming protocol that SER can bridge to SvelteKit.\",\n );\n this.name = \"InvalidLiveQueryReturnError\";\n }\n}\n\n/**\n * Thrown when a dispatcher operation is requested after disposal.\n *\n * @example\n * ```ts\n * throw new DispatcherDisposedError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid dispatcher lifecycle transition.\n */\nexport class DispatcherDisposedError extends RuntimeError {\n constructor() {\n super(\n \"Dispatcher has been disposed; no new Effect fibers or promise bridges can be started after component teardown.\",\n );\n this.name = \"DispatcherDisposedError\";\n }\n}\n\n/**\n * Thrown when a generated or native remote query export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidQueryFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid query adapter input.\n */\nexport class InvalidQueryFactoryError extends RuntimeError {\n constructor() {\n super(\n \"Invalid query factory: expected a function or an object exposing query/load methods from SvelteKit remote query generation.\",\n );\n this.name = \"InvalidQueryFactoryError\";\n }\n}\n\n/**\n * Thrown when a generated or native remote live query export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidLiveQueryFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid live query adapter input.\n */\nexport class InvalidLiveQueryFactoryError extends RuntimeError {\n constructor() {\n super(\n \"Invalid live query factory: expected a function or an object exposing a query method from SvelteKit remote live query generation.\",\n );\n this.name = \"InvalidLiveQueryFactoryError\";\n }\n}\n\n/**\n * Thrown when a generated or native remote command export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidCommandFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid command adapter input.\n */\nexport class InvalidCommandFactoryError extends RuntimeError {\n constructor() {\n super(\n \"Invalid command factory: expected a function or an object exposing an invoke method from SvelteKit remote command generation.\",\n );\n this.name = \"InvalidCommandFactoryError\";\n }\n}\n\n/**\n * Thrown when the client-side form adapter cannot derive a remote endpoint.\n *\n * @example\n * ```ts\n * throw new RemoteFormEndpointMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing missing form transport metadata.\n */\nexport class RemoteFormEndpointMissingError extends RuntimeError {\n constructor() {\n super(\n \"Form has no submit method or remote endpoint; the adapted SvelteKit form object does not expose an action id and no remote base URL was generated.\",\n );\n this.name = \"RemoteFormEndpointMissingError\";\n }\n}\n\n/**\n * Thrown when a remote form response envelope is not an object with a response\n * type.\n *\n * @example\n * ```ts\n * throw new InvalidRemoteFormResponseError(envelope);\n * ```\n *\n * @since 2.4.0\n * @param envelope - Raw response envelope returned by the remote form endpoint.\n * @returns An Error describing malformed form response data.\n */\nexport class InvalidRemoteFormResponseError extends RuntimeError {\n /**\n * Raw response envelope returned by the remote form endpoint.\n *\n * @since 2.4.0\n */\n readonly envelope: unknown;\n\n constructor(envelope?: unknown) {\n super(\n \"Invalid remote form response: expected an object envelope with a string type field returned by SvelteKit remote form transport.\",\n );\n this.name = \"InvalidRemoteFormResponseError\";\n this.envelope = envelope;\n }\n}\n\n/**\n * Thrown when a remote form response has a well-formed envelope but an\n * unsupported response type or payload slot.\n *\n * @example\n * ```ts\n * throw new UnsupportedRemoteFormResponseError(envelope);\n * ```\n *\n * @since 2.4.0\n * @param envelope - Raw response envelope returned by the remote form endpoint.\n * @returns An Error describing unsupported form response data.\n */\nexport class UnsupportedRemoteFormResponseError extends RuntimeError {\n /**\n * Raw response envelope returned by the remote form endpoint.\n *\n * @since 2.4.0\n */\n readonly envelope: unknown;\n\n constructor(envelope?: unknown) {\n super(\n \"Unsupported remote form response: expected a result envelope with a devalue-encoded result or data string.\",\n );\n this.name = \"UnsupportedRemoteFormResponseError\";\n this.envelope = envelope;\n }\n}\n\n/**\n * Thrown when a serialized remote failure envelope cannot be decoded.\n *\n * @example\n * ```ts\n * throw new RemoteErrorDecodeError(raw);\n * ```\n *\n * @since 2.4.0\n * @param raw - Raw serialized remote failure payload that failed decoding.\n * @returns An Error describing a malformed remote failure payload.\n */\nexport class RemoteErrorDecodeError extends RuntimeError {\n /**\n * Raw serialized remote failure payload that failed decoding.\n *\n * @since 2.4.0\n */\n readonly raw: unknown;\n\n constructor(raw?: unknown) {\n super(\n \"Failed to decode remote error payload: expected a devalue-encoded SER remote failure envelope compatible with the client decoder.\",\n );\n this.name = \"RemoteErrorDecodeError\";\n this.raw = raw;\n }\n}\n\n/**\n * Thrown when a root server-only helper is imported without Vite rewriting.\n *\n * @example\n * ```ts\n * throw new ServerOnlyImportError(\"Query\");\n * ```\n *\n * @since 2.4.0\n * @param export_name - Name of the server-only root export that was invoked.\n * @returns An Error describing a missing server rewrite.\n */\nexport class ServerOnlyImportError extends RuntimeError {\n /**\n * Name of the server-only root export that was invoked.\n *\n * @since 2.4.0\n */\n readonly export_name: string;\n\n constructor(export_name: string) {\n super(\n `${export_name} is only available in SvelteKit server files. Ensure the SER Vite plugin is enabled so root imports are rewritten to svelte-effect-runtime/server before execution.`,\n );\n this.name = \"ServerOnlyImportError\";\n this.export_name = export_name;\n }\n}\n\n/**\n * Thrown when the publish-time `$app/server` shim executes outside SvelteKit.\n *\n * @example\n * ```ts\n * throw new SvelteKitServerExportUnavailableError(\"query\");\n * ```\n *\n * @since 2.4.0\n * @param export_name - Name of the `$app/server` export that was invoked.\n * @returns An Error describing an unavailable SvelteKit virtual module export.\n */\nexport class SvelteKitServerExportUnavailableError extends RuntimeError {\n /**\n * Name of the `$app/server` export that was invoked.\n *\n * @since 2.4.0\n */\n readonly export_name: string;\n\n constructor(export_name: string) {\n super(\n `SvelteKit virtual $app/server export ${export_name} is only available inside a SvelteKit server module.`,\n );\n this.name = \"SvelteKitServerExportUnavailableError\";\n this.export_name = export_name;\n }\n}\n\n/**\n * Thrown when a SvelteKit remote helper reports that it was called outside the\n * route-scoped remote module context.\n *\n * @example\n * ```ts\n * throw new RemoteHelperContextError(\"Query\");\n * ```\n *\n * @since 2.4.0\n * @param helper_name - SER helper name that triggered the context failure.\n * @returns An Error describing the required `.remote.ts` placement.\n */\nexport class RemoteHelperContextError extends RuntimeError {\n /**\n * SER helper name that triggered the context failure.\n *\n * @since 2.4.0\n */\n readonly helper_name: string;\n\n constructor(helper_name: string) {\n super(\n make_error_message(\n \"REMOTE_HELPER_CONTEXT\",\n `${helper_name} was called outside a .remote.ts file. Ensure the file is named \\`*.remote.ts\\` and is located in a route directory so SvelteKit can bind remote helper context.`,\n ),\n );\n this.name = \"RemoteHelperContextError\";\n this.helper_name = helper_name;\n }\n}\n\n/**\n * Thrown when a SvelteKit remote helper normalizes a non-Error thrown value.\n *\n * @example\n * ```ts\n * throw new RemoteHelperError(\"raw failure\");\n * ```\n *\n * @since 2.4.0\n * @param value - Non-Error value thrown while creating a remote helper.\n * @returns An Error preserving the remote helper failure value.\n */\nexport class RemoteHelperError extends RuntimeError {\n /**\n * Non-Error value that was normalized.\n *\n * @since 2.4.0\n */\n readonly value: unknown;\n\n constructor(value: unknown) {\n super(make_error_message(\"REMOTE_HELPER_ERROR\", String(value)));\n this.name = \"RemoteHelperError\";\n this.value = value;\n }\n}\n\n/**\n * Thrown when a non-Error value must be normalized into an Error instance.\n *\n * @example\n * ```ts\n * throw new UnknownRuntimeError(\"raw failure\");\n * ```\n *\n * @since 2.4.0\n * @param value - Non-Error value that needs Error normalization.\n * @returns An Error preserving the string representation of an unknown value.\n */\nexport class UnknownRuntimeError extends RuntimeError {\n /**\n * Non-Error value that was normalized.\n *\n * @since 2.4.0\n */\n readonly value: unknown;\n\n constructor(value: unknown) {\n super(String(value));\n this.name = \"UnknownRuntimeError\";\n this.value = value;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;;;;;;;;AAeA,SAAgB,mBAAmB,MAAc,SAAyB;CACxE,OAAO,IAAI,KAAK,KAAK;AACvB;;;;;;;;;;;;;;;;AAiBA,IAAa,kBAAb,cAAqC,aAAa;;;;;;CAMhD;CAEA,YAAY,SAAiB,UAAkB;EAC7C,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,WAAW;CAClB;AACF;;;;;;;;;;;;;;;;AAiBA,IAAa,yBAAb,cAA4C,gBAAgB;;;;;;CAM1D;CAEA,YAAY,UAAkB,gBAAwB;EACpD,MACE;GACE,mBACE,wBACA,GAAG,SAAS,oDACd;GACA;GACA;GACA;GACA;EACF,EAAE,KAAK,IAAI,GACX,QACF;EACA,KAAK,OAAO;EACZ,KAAK,iBAAiB;CACxB;AACF;;;;;;;;;;;;;;;;;AAkBA,IAAa,6BAAb,cAAgD,gBAAgB;;;;;;CAM9D;;;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-DppSJ83S.js";
2
+ import { t as Dispatcher } from "./dispatcher-CZvLODNK.js";
2
3
  import { Context, Layer, ManagedRuntime } from "effect";
3
4
  //#region src/server/runtime.ts
4
5
  /**
@@ -12,7 +13,7 @@ import { Context, Layer, ManagedRuntime } from "effect";
12
13
  * @since 2.0.0
13
14
  */
14
15
  const RequestEvent = Context.Reference("@ser/RequestEvent", { defaultValue: () => {
15
- throw new Error("[REQUEST_EVENT_UNAVAILABLE]: RequestEvent is only available during a remote call");
16
+ throw new RequestEventUnavailableError();
16
17
  } });
17
18
  /**
18
19
  * Builder for the server-side Effect runtime.
@@ -76,4 +77,4 @@ function get_server_dispatcher() {
76
77
  //#endregion
77
78
  export { get_server_runtime_or_throw as i, ServerRuntime as n, get_server_dispatcher as r, RequestEvent as t };
78
79
 
79
- //# sourceMappingURL=runtime-Sl685BVb.js.map
80
+ //# sourceMappingURL=runtime-BgCRz_rL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-BgCRz_rL.js","names":["InternalDispatcher"],"sources":["../../../modules/svelte-effect-runtime/src/server/runtime.ts"],"sourcesContent":["import type { RequestEvent as SvelteKitRequestEvent } from \"@sveltejs/kit\";\nimport { Context, Layer, ManagedRuntime } from \"effect\";\nimport { Dispatcher as InternalDispatcher } from \"$/dispatcher.ts\";\nimport type { ManagedRuntime as ManagedRuntimeType } from \"effect/ManagedRuntime\";\n\nimport { RequestEventUnavailableError } from \"$/errors.ts\";\n\n/**\n * Subset of SvelteKit's `RequestEvent` that remote handlers typically access.\n *\n * @since 2.0.0\n */\nexport interface RequestEvent extends\n Pick<\n SvelteKitRequestEvent,\n | \"cookies\"\n | \"getClientAddress\"\n | \"locals\"\n | \"params\"\n | \"platform\"\n | \"request\"\n | \"route\"\n | \"url\"\n > {}\n\n/**\n * SvelteKit's `RequestEvent` exposed as an Effect {@link Context.Tag}.\n *\n * @example\n * ```ts\n * const event = yield* RequestEvent;\n * ```\n *\n * @since 2.0.0\n */\nexport const RequestEvent: Context.Reference<RequestEvent> = Context\n .Reference<RequestEvent>(\"@ser/RequestEvent\", {\n defaultValue: () => {\n throw new RequestEventUnavailableError();\n },\n });\n\n/**\n * Builder for the server-side Effect runtime.\n *\n * @example\n * ```ts\n * ServerRuntime.make(Db.Live);\n * ```\n *\n * @since 2.0.0\n */\nexport class ServerRuntime {\n /**\n * Build and cache the server-side `ManagedRuntime`.\n *\n * @since 2.0.0\n * @param layer - Optional Effect layer to provide to the runtime.\n * @returns The configured ManagedRuntime.\n */\n static make<R = never>(\n layer?: Layer.Layer<R>,\n ): ManagedRuntime.ManagedRuntime<R, never> {\n const runtime = ManagedRuntime.make(\n layer ?? (Layer.empty as unknown as Layer.Layer<R>),\n );\n\n current_server_runtime = runtime as ManagedRuntime.ManagedRuntime<\n unknown,\n never\n >;\n current_server_dispatcher?.dispose();\n current_server_dispatcher = new InternalDispatcher(\n runtime as unknown as ManagedRuntimeType<unknown, unknown>,\n );\n\n return runtime;\n }\n}\n\nlet current_server_runtime:\n | ManagedRuntime.ManagedRuntime<unknown, never>\n | undefined;\nlet current_server_dispatcher: InternalDispatcher | undefined;\n\n/**\n * Returns the active server runtime, creating a default one if needed.\n *\n * @example\n * ```ts\n * const runtime = get_server_runtime_or_throw();\n * ```\n *\n * @since 2.0.0\n * @returns The current ManagedRuntime instance.\n */\nexport function get_server_runtime_or_throw(): ManagedRuntime.ManagedRuntime<\n unknown,\n never\n> {\n if (!current_server_runtime) {\n current_server_runtime = ManagedRuntime.make(\n Layer.empty,\n ) as ManagedRuntime.ManagedRuntime<unknown, never>;\n }\n\n return current_server_runtime;\n}\n\n/**\n * Returns a dispatcher backed by the active server runtime.\n *\n * @example\n * ```ts\n * const dispatcher = get_server_dispatcher();\n * ```\n *\n * @since 3.0.1\n * @returns The cached server dispatcher, creating one from the current server\n * runtime when needed.\n */\nexport function get_server_dispatcher(): InternalDispatcher {\n current_server_dispatcher ??= new InternalDispatcher(\n get_server_runtime_or_throw() as unknown as ManagedRuntimeType<\n unknown,\n unknown\n >,\n );\n\n return current_server_dispatcher;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAa,eAAgD,QAC1D,UAAwB,qBAAqB,EAC5C,oBAAoB;CAClB,MAAM,IAAI,6BAA6B;AACzC,EACF,CAAC;;;;;;;;;;;AAYH,IAAa,gBAAb,MAA2B;;;;;;;;CAQzB,OAAO,KACL,OACyC;EACzC,MAAM,UAAU,eAAe,KAC7B,SAAU,MAAM,KAClB;EAEA,yBAAyB;EAIzB,2BAA2B,QAAQ;EACnC,4BAA4B,IAAIA,WAC9B,OACF;EAEA,OAAO;CACT;AACF;AAEA,IAAI;AAGJ,IAAI;;;;;;;;;;;;AAaJ,SAAgB,8BAGd;CACA,IAAI,CAAC,wBACH,yBAAyB,eAAe,KACtC,MAAM,KACR;CAGF,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAgB,wBAA4C;CAC1D,8BAA8B,IAAIA,WAChC,4BAA4B,CAI9B;CAEA,OAAO;AACT"}
@@ -1,3 +1,4 @@
1
+ import { E as UnsupportedMarkupEffectPositionError, O as YieldStarInEventCallbackError, t as AsyncEffectInEventCallbackError } from "./errors-DppSJ83S.js";
1
2
  import { contains_top_level_yield_star } from "../detect.js";
2
3
  import { parse } from "svelte/compiler";
3
4
  import MagicString from "magic-string";
@@ -528,217 +529,6 @@ function add_ordered_name(names, name) {
528
529
  names.push(name);
529
530
  }
530
531
  //#endregion
531
- //#region src/error.ts
532
- /**
533
- * Formats a runtime-owned error message with a stable screaming-case code.
534
- *
535
- * @example
536
- * ```ts
537
- * throw new Error(make_error_message("DISPATCHER_DISPOSED", "Dispatcher has been disposed"));
538
- * ```
539
- *
540
- * @since 2.0.0
541
- * @param code - Stable screaming-case identifier for the error category.
542
- * @param message - Human-readable error message without the leading code.
543
- * @returns The complete error message prefixed with the stable code.
544
- */
545
- function make_error_message(code, message) {
546
- return `[${code}]: ${message}`;
547
- }
548
- /**
549
- * Base error class for all transform errors emitted during script and
550
- * markup transformation. Carries the source filename so error messages can
551
- * reference the affected file.
552
- *
553
- * @since 2.0.0
554
- */
555
- var PreprocessError = class extends Error {
556
- /**
557
- * The source filename that triggered this error.
558
- *
559
- * @since 2.0.0
560
- */
561
- filename;
562
- constructor(message, filename) {
563
- super(message);
564
- this.name = "PreprocessError";
565
- this.filename = filename;
566
- }
567
- };
568
- /**
569
- * Thrown when a statement mixes JavaScript `await` with Effect `yield*` work
570
- * that must be lowered into an `Effect.gen` program.
571
- *
572
- * @since 2.0.0
573
- */
574
- var AwaitInEffectWorkError = class extends PreprocessError {
575
- /**
576
- * The full text of the problematic statement containing mixed async work.
577
- *
578
- * @since 2.0.0
579
- */
580
- statement_text;
581
- constructor(filename, statement_text) {
582
- super([
583
- make_error_message("AWAIT_IN_EFFECT_WORK", `${filename}: await cannot be mixed with yield* in Effect work.`),
584
- `Top-level await is supported as ordinary Svelte async rendering, but statements lowered into Effect.gen must use yield* for async Effect work.`,
585
- "",
586
- `Problematic statement:`,
587
- statement_text
588
- ].join("\n"), filename);
589
- this.name = "AwaitInEffectWorkError";
590
- this.statement_text = statement_text;
591
- }
592
- };
593
- /**
594
- * Thrown when async Effect work appears inside a Svelte rune position that
595
- * must stay synchronous.
596
- *
597
- * @since 2.0.0
598
- */
599
- var AsyncEffectInSyncRuneError = class extends PreprocessError {
600
- /**
601
- * The name of the rune that contained async Effect work.
602
- *
603
- * @since 2.0.0
604
- */
605
- rune_name;
606
- /**
607
- * The full text of the expression that triggered the error.
608
- *
609
- * @since 2.0.0
610
- */
611
- expression_text;
612
- constructor(rune_name, expression_text, filename) {
613
- super([
614
- make_error_message("ASYNC_EFFECT_IN_SYNC_RUNE", `${filename}: yield* cannot be used inside ${rune_name}().`),
615
- `${rune_name}() must stay synchronous. Do not put async Effect work inside this rune.`,
616
- "",
617
- `Problematic expression:`,
618
- expression_text
619
- ].join("\n"), filename);
620
- this.name = "AsyncEffectInSyncRuneError";
621
- this.rune_name = rune_name;
622
- this.expression_text = expression_text;
623
- }
624
- };
625
- /**
626
- * Thrown when async Effect work appears inside a non-generator callback nested
627
- * in a markup event handler.
628
- *
629
- * @example
630
- * ```ts
631
- * throw new AsyncEffectInEventCallbackError(
632
- * "Component.svelte",
633
- * "Effect.try(() => yield* save())",
634
- * );
635
- * ```
636
- *
637
- * @since 2.0.0
638
- */
639
- var AsyncEffectInEventCallbackError = class extends PreprocessError {
640
- /**
641
- * The full text of the problematic event handler body.
642
- *
643
- * @since 2.0.0
644
- */
645
- expression_text;
646
- constructor(filename, expression_text) {
647
- super([
648
- make_error_message("ASYNC_EFFECT_IN_EVENT_CALLBACK", `${filename}: yield* cannot be used inside a nested non-generator callback in a markup event handler.`),
649
- `Move the yield* to the event handler body. Effect.try and Effect.sync callbacks are plain synchronous JavaScript; do not call Effect-returning functions inside them.`,
650
- "",
651
- `Run the remote Effect directly:`,
652
- ` onclick={yield* UpvotePost(id)}`,
653
- "",
654
- `Recover from remote failures by composing the Effect value:`,
655
- ` onclick={yield* UpvotePost(id).pipe(Effect.catch(() => Effect.void))}`,
656
- "",
657
- `Problematic expression:`,
658
- expression_text
659
- ].join("\n"), filename);
660
- this.name = "AsyncEffectInEventCallbackError";
661
- this.expression_text = expression_text;
662
- }
663
- };
664
- /**
665
- * Thrown when an event handler callback contains the old raw `yield*`
666
- * shorthand. Effectful event handlers must put `yield*` directly in the event
667
- * attribute so the callback boundary is generated by the markup runtime.
668
- *
669
- * @example
670
- * ```ts
671
- * throw new YieldStarInEventCallbackError(
672
- * "Component.svelte",
673
- * "() => yield* save()",
674
- * );
675
- * ```
676
- *
677
- * @since 2.0.0
678
- * @param filename - Svelte component filename used to identify where the
679
- * invalid event handler callback was found.
680
- * @param expression_text - Original event handler callback text that contained
681
- * `yield*` and should be rewritten as a direct event Effect expression.
682
- */
683
- var YieldStarInEventCallbackError = class extends PreprocessError {
684
- /**
685
- * The full text of the problematic event handler callback.
686
- *
687
- * @since 2.0.0
688
- */
689
- expression_text;
690
- constructor(filename, expression_text) {
691
- super([
692
- make_error_message("ASYNC_EFFECT_IN_EVENT_HANDLER_CALLBACK", `${filename}: yield* in markup event handlers must be written directly as the event attribute value.`),
693
- `SER generates the event callback for effectful event handlers; do not put yield* inside a JavaScript callback.`,
694
- "",
695
- `Use this form:`,
696
- ` onclick={yield* UpvotePost(id)}`,
697
- "",
698
- `Instead of this form:`,
699
- ` onclick={() => yield* UpvotePost(id)}`,
700
- "",
701
- `Problematic expression:`,
702
- expression_text
703
- ].join("\n"), filename);
704
- this.name = "YieldStarInEventCallbackError";
705
- this.expression_text = expression_text;
706
- }
707
- };
708
- /**
709
- * Thrown when async Effect work appears in a markup position SER cannot lower
710
- * safely.
711
- *
712
- * @example
713
- * ```ts
714
- * throw new UnsupportedMarkupEffectPositionError(
715
- * "Component.svelte",
716
- * "value={yield* load()}",
717
- * );
718
- * ```
719
- *
720
- * @since 2.4.2
721
- */
722
- var UnsupportedMarkupEffectPositionError = class extends PreprocessError {
723
- /**
724
- * The unsupported markup expression text.
725
- *
726
- * @since 2.4.2
727
- */
728
- expression_text;
729
- constructor(filename, expression_text) {
730
- super([
731
- make_error_message("UNSUPPORTED_MARKUP_EFFECT_POSITION", `${filename}: yield* cannot be used in this markup position.`),
732
- `Move the Effect work into a supported expression tag, block expression, render expression, declaration tag, or event handler.`,
733
- "",
734
- `Problematic expression:`,
735
- expression_text
736
- ].join("\n"), filename);
737
- this.name = "UnsupportedMarkupEffectPositionError";
738
- this.expression_text = expression_text;
739
- }
740
- };
741
- //#endregion
742
532
  //#region src/markup/transform/expressions.ts
743
533
  /**
744
534
  * Strips an event handler arrow function down to its executable body.
@@ -1686,6 +1476,6 @@ function transform_markup_effect(content, filename) {
1686
1476
  };
1687
1477
  }
1688
1478
  //#endregion
1689
- export { find_yield_star_node as a, AsyncEffectInSyncRuneError as c, collect_top_level_binding_names as d, has_local_import_binding as f, extract_binding_names as i, AwaitInEffectWorkError as l, collect_yield_star_nodes as n, is_yield_star_expression as o, make_imports as p, contains_top_level_await as r, collect_free_identifiers as s, transform_markup_effect as t, PreprocessError as u };
1479
+ export { find_yield_star_node as a, collect_top_level_binding_names as c, extract_binding_names as i, has_local_import_binding as l, collect_yield_star_nodes as n, is_yield_star_expression as o, contains_top_level_await as r, collect_free_identifiers as s, transform_markup_effect as t, make_imports as u };
1690
1480
 
1691
- //# sourceMappingURL=transform-BTStPHku.js.map
1481
+ //# sourceMappingURL=transform-B7_CCcvq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-B7_CCcvq.js","names":["is_yield_star_expression"],"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/classify.ts","../../../modules/svelte-effect-runtime/src/markup/transform/effect-bindings.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/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 needs_dispatcher?: boolean;\n needs_effect?: boolean;\n needs_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 has_effect_import: boolean,\n has_dispatcher_import: boolean,\n has_untrack_import: boolean,\n bindings: RuntimeImportBindings = {\n cancel: \"__SER___cancel\",\n dispatcher: \"get_dispatcher\",\n dispatcher_value: \"__SER___dispatcher\",\n effect: \"Effect\",\n program: \"__SER___program\",\n untrack: \"untrack\",\n },\n options: RuntimeImportOptions = {},\n): string {\n const needs_dispatcher = options.needs_dispatcher ?? true;\n const needs_effect = options.needs_effect ?? true;\n const needs_untrack = options.needs_untrack ?? true;\n\n const dispatcher_import = bindings.dispatcher === \"get_dispatcher\"\n ? `import { get_dispatcher } from \"svelte-effect-runtime/internal/generators\";`\n : `import { get_dispatcher as ${bindings.dispatcher} } from \"svelte-effect-runtime/internal/generators\";`;\n\n const untrack_import = bindings.untrack === \"untrack\"\n ? `import { untrack } from \"svelte\";`\n : `import { untrack as ${bindings.untrack} } from \"svelte\";`;\n\n const effect_import = has_effect_import\n ? false\n : bindings.effect === \"Effect\"\n ? `import { Effect } from \"effect\";`\n : `import { Effect as ${bindings.effect} } from \"effect\";`;\n\n return [\n needs_dispatcher && !has_dispatcher_import && dispatcher_import,\n needs_untrack && !has_untrack_import && untrack_import,\n needs_effect && effect_import,\n ]\n .filter(Boolean)\n .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 source_file: ts.SourceFile,\n module_name: string,\n local_name: string,\n): boolean {\n return source_file.statements.some((stmt) => {\n if (\n !ts.isImportDeclaration(stmt) ||\n !ts.isStringLiteral(stmt.moduleSpecifier) ||\n stmt.moduleSpecifier.text !== module_name\n ) {\n return false;\n }\n\n const clause = stmt.importClause;\n\n if (!clause || clause.isTypeOnly) {\n return false;\n }\n\n if (clause.name?.text === local_name) {\n return true;\n }\n\n const named_bindings = clause.namedBindings;\n\n if (!named_bindings) {\n return false;\n }\n\n if (ts.isNamespaceImport(named_bindings)) {\n return named_bindings.name.text === local_name;\n }\n\n return named_bindings.elements.some(\n (element) => !element.isTypeOnly && element.name.text === local_name,\n );\n });\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(\n source_file: ts.SourceFile,\n local_name: string,\n): boolean {\n return 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(\n source_file: ts.SourceFile,\n): string[] {\n return source_file.statements.flatMap(collect_statement_binding_names);\n}\n\nfunction collect_statement_binding_names(stmt: ts.Statement): string[] {\n if (ts.isImportDeclaration(stmt)) {\n return collect_import_binding_names(stmt);\n }\n\n if (ts.isVariableStatement(stmt)) {\n return stmt.declarationList.declarations.flatMap((decl) =>\n collect_binding_name_text(decl.name)\n );\n }\n\n if (\n ts.isFunctionDeclaration(stmt) ||\n ts.isClassDeclaration(stmt) ||\n ts.isInterfaceDeclaration(stmt) ||\n ts.isTypeAliasDeclaration(stmt) ||\n ts.isEnumDeclaration(stmt) ||\n ts.isModuleDeclaration(stmt)\n ) {\n return stmt.name ? [stmt.name.text] : [];\n }\n\n return [];\n}\n\nfunction collect_import_binding_names(stmt: ts.ImportDeclaration): string[] {\n const clause = stmt.importClause;\n\n if (!clause) {\n return [];\n }\n\n return [\n clause.name?.text,\n clause.namedBindings && ts.isNamespaceImport(clause.namedBindings)\n ? clause.namedBindings.name.text\n : undefined,\n clause.namedBindings && ts.isNamedImports(clause.namedBindings)\n ? clause.namedBindings.elements.map((element) => element.name.text)\n : undefined,\n ].flat().filter((name): name is string => name !== undefined);\n}\n\nfunction collect_binding_name_text(name: ts.BindingName): string[] {\n if (ts.isIdentifier(name)) {\n return [name.text];\n }\n\n return name.elements.flatMap((element) => {\n if (ts.isOmittedExpression(element)) {\n return [];\n }\n\n return collect_binding_name_text(element.name);\n });\n}\n","export const HELPERS = {\n value: \"__SER___markup_value\",\n promise: \"__SER___markup_promise\",\n run: \"__SER___markup_run\",\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 HelperDeclaration,\n Insertion,\n MarkupHelperBindings,\n MarkupRelocation,\n PendingRelocation,\n Replacement,\n} from \"./types.ts\";\nimport ts from \"typescript\";\n\nexport function create_source_map(\n magic: MagicString,\n filename: string,\n): Record<string, unknown> {\n const map = magic.generateMap({\n hires: true,\n includeContent: true,\n source: filename,\n });\n\n return map as unknown as Record<string, unknown>;\n}\n\nexport function blank_script_blocks(content: string): string {\n return content.replace(\n /<script\\b[^>]*>[\\s\\S]*?<\\/script\\s*>/gi,\n (match) => {\n const lines = match.split(\"\\n\");\n return lines.map((l) => \" \".repeat(l.length)).join(\"\\n\");\n },\n );\n}\n\nexport function inject_helpers(\n magic: MagicString,\n content: string,\n helpers: HelperDeclaration[] = [],\n bindings: MarkupHelperBindings = HELPERS,\n): Insertion | undefined {\n const import_helpers = unique_import_helpers(helpers);\n const local_helpers = helpers.filter((helper) => !is_import_helper(helper));\n\n const helper_segments: Array<{\n text: string;\n relocation?: PendingRelocation;\n }> = [\n make_import_helper(\n content,\n `import { value as ${bindings.value} } from \"svelte-effect-runtime/internal/generators\";`,\n ),\n make_import_helper(\n content,\n `import { promise as ${bindings.promise} } from \"svelte-effect-runtime/internal/generators\";`,\n ),\n make_import_helper(\n content,\n `import { run as ${bindings.run} } from \"svelte-effect-runtime/internal/generators\";`,\n ),\n ...import_helpers,\n ...local_helpers,\n ].filter((helper): helper is string | HelperDeclaration =>\n helper !== undefined\n ).map((helper) => typeof helper === \"string\" ? { text: helper } : helper);\n\n if (helper_segments.length === 0) {\n return undefined;\n }\n\n const helper_block = helper_segments.map((segment) => segment.text).join(\n \"\\n\",\n );\n\n const script_tag = find_instance_script_tag(content);\n\n if (script_tag) {\n const text = `\\n${helper_block}\\n`;\n\n magic.appendLeft(script_tag.end, text);\n\n return {\n start: script_tag.end,\n text,\n relocations: make_insertion_relocations(helper_segments, \"\\n\"),\n };\n } else {\n const text = `<script>\\n${helper_block}\\n</script>\\n\\n`;\n\n magic.prepend(text);\n\n return {\n start: 0,\n text,\n relocations: make_insertion_relocations(helper_segments, \"<script>\\n\"),\n };\n }\n}\n\nexport function make_markup_helper_bindings(\n content: string,\n): {\n bindings: MarkupHelperBindings;\n name_allocator: { reserve(name: string): string };\n} {\n const script_tag = find_instance_script_tag(content);\n const binding_names = script_tag\n ? collect_script_binding_names(\n content.slice(script_tag.start, script_tag.end),\n )\n : [];\n const name_allocator = make_name_allocator(binding_names);\n\n return {\n bindings: {\n value: name_allocator.reserve(HELPERS.value),\n promise: name_allocator.reserve(HELPERS.promise),\n run: name_allocator.reserve(HELPERS.run),\n },\n name_allocator,\n };\n}\n\nexport function create_relocations(\n replacements: Replacement[],\n helper_insertion: Insertion | undefined,\n): MarkupRelocation[] {\n const edits = [\n helper_insertion && {\n start: helper_insertion.start,\n removedLength: 0,\n insertedLength: helper_insertion.text.length,\n },\n ...replacements.map((replacement) => ({\n start: replacement.start,\n removedLength: replacement.end - replacement.start,\n insertedLength: replacement.text.length,\n })),\n ].filter(Boolean) as Array<{\n start: number;\n removedLength: number;\n insertedLength: number;\n }>;\n\n const replacement_relocations = replacements.flatMap((replacement) => {\n if (!replacement.relocation) {\n return [];\n }\n\n const delta_before = edits\n .filter((edit) => edit.start < replacement.start)\n .reduce(\n (total, edit) => total + edit.insertedLength - edit.removedLength,\n 0,\n );\n const generated_start = replacement.start + delta_before;\n\n return [{\n originalStart: replacement.relocation.originalStart,\n originalEnd: replacement.relocation.originalEnd,\n generatedStart: generated_start +\n replacement.relocation.generatedStartInReplacement,\n generatedEnd: generated_start +\n replacement.relocation.generatedEndInReplacement,\n }];\n });\n\n const helper_relocations = helper_insertion?.relocations?.map(\n (relocation) => ({\n originalStart: relocation.originalStart,\n originalEnd: relocation.originalEnd,\n generatedStart: helper_insertion.start +\n relocation.generatedStartInReplacement,\n generatedEnd: helper_insertion.start +\n relocation.generatedEndInReplacement,\n }),\n ) ?? [];\n\n return [\n ...replacement_relocations,\n ...helper_relocations,\n ];\n}\n\nfunction make_import_helper(\n content: string,\n import_text: string,\n): string | undefined {\n if (content.includes(import_text)) {\n return undefined;\n }\n\n return import_text;\n}\n\nfunction make_insertion_relocations(\n segments: Array<{\n text: string;\n relocation?: PendingRelocation;\n }>,\n prefix: string,\n): PendingRelocation[] {\n const relocations: PendingRelocation[] = [];\n let offset = prefix.length;\n\n for (const segment of segments) {\n if (segment.relocation) {\n relocations.push({\n originalStart: segment.relocation.originalStart,\n originalEnd: segment.relocation.originalEnd,\n generatedStartInReplacement: offset +\n segment.relocation.generatedStartInReplacement,\n generatedEndInReplacement: offset +\n segment.relocation.generatedEndInReplacement,\n });\n }\n\n offset += segment.text.length + 1;\n }\n\n return relocations;\n}\n\nfunction find_instance_script_tag(\n content: string,\n): { start: number; end: number } | undefined {\n const pattern = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n for (const match of content.matchAll(pattern)) {\n if (match.index === undefined) continue;\n\n const attrs = match[1] ?? \"\";\n if (\n /\\bcontext\\s*=\\s*[\"']module[\"']/.test(attrs) ||\n /\\bmodule\\b/.test(attrs)\n ) {\n continue;\n }\n\n const open_end = match[0].indexOf(\">\") + 1;\n return {\n start: match.index + open_end,\n end: match.index + match[0].length - \"</script>\".length,\n };\n }\n\n return undefined;\n}\n\nfunction unique_import_helpers(\n helpers: HelperDeclaration[],\n): HelperDeclaration[] {\n const seen = new Set<string>();\n\n return helpers.filter((helper) => {\n if (!is_import_helper(helper)) {\n return false;\n }\n\n if (seen.has(helper.text)) {\n return false;\n }\n\n seen.add(helper.text);\n\n return true;\n });\n}\n\nfunction is_import_helper(helper: HelperDeclaration): boolean {\n return helper.text.trimStart().startsWith(\"import \");\n}\n\nfunction collect_script_binding_names(script_content: string): string[] {\n const source_file = ts.createSourceFile(\n \"markup-script.ts\",\n script_content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n\n return collect_top_level_binding_names(source_file);\n}\n\nfunction make_name_allocator(initial_names: readonly string[]): {\n reserve(name: string): string;\n} {\n const used_names = new Set(initial_names);\n\n return {\n reserve(name: string): string {\n let candidate = name;\n let suffix = 1;\n\n while (used_names.has(candidate)) {\n candidate = `${name}_${suffix}`;\n suffix += 1;\n }\n\n used_names.add(candidate);\n\n return candidate;\n },\n };\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 ast: AST.Root,\n candidates: MarkupCandidate[],\n): Array<{ candidate: MarkupCandidate; kind: TagKind }> {\n const by_placeholder = new Map(\n candidates.map((candidate) => [candidate.placeholder, candidate]),\n );\n\n const classified: Array<{ candidate: MarkupCandidate; kind: TagKind }> = [];\n const matched = new Set<string>();\n\n walk_ast(ast.fragment, by_placeholder, matched, classified);\n\n return classified;\n}\n\nfunction walk_ast(\n fragment: AST.Fragment,\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n for (const node of fragment.nodes) {\n visit_ast_node(node, candidates, matched, classified);\n }\n}\n\nfunction visit_ast_node(\n node: AST.Fragment[\"nodes\"][number],\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n switch (node.type) {\n case \"ExpressionTag\":\n classify_expression(\n node.expression,\n \"plain\",\n candidates,\n matched,\n classified,\n );\n return;\n\n case \"IfBlock\":\n classify_expression(node.test, \"plain\", candidates, matched, classified);\n walk_ast(node.consequent, candidates, matched, classified);\n if (node.alternate) {\n walk_ast(node.alternate, candidates, matched, classified);\n }\n return;\n\n case \"EachBlock\":\n classify_expression(\n node.expression,\n \"each\",\n candidates,\n matched,\n classified,\n );\n walk_ast(node.body, candidates, matched, classified);\n if (node.fallback) {\n walk_ast(node.fallback, candidates, matched, classified);\n }\n return;\n\n case \"AwaitBlock\":\n classify_expression(\n node.expression,\n \"await\",\n candidates,\n matched,\n classified,\n );\n if (node.pending) {\n walk_ast(node.pending, candidates, matched, classified);\n }\n if (node.then) walk_ast(node.then, candidates, matched, classified);\n if (node.catch) walk_ast(node.catch, candidates, matched, classified);\n return;\n\n case \"RenderTag\":\n classify_expression(\n node.expression,\n \"render\",\n candidates,\n matched,\n classified,\n );\n return;\n\n case \"HtmlTag\":\n classify_expression(\n node.expression,\n \"plain\",\n candidates,\n matched,\n classified,\n );\n return;\n\n case \"DebugTag\":\n classify_debug_tag(node, candidates, matched, classified);\n return;\n\n case \"ConstTag\":\n case \"DeclarationTag\":\n classify_declaration_tag(node, candidates, matched, classified);\n return;\n\n case \"KeyBlock\":\n classify_expression(\n node.expression,\n \"plain\",\n candidates,\n matched,\n classified,\n );\n walk_ast(node.fragment, candidates, matched, classified);\n return;\n\n case \"RegularElement\":\n case \"Component\":\n case \"TitleElement\":\n case \"SlotElement\":\n case \"SvelteBody\":\n case \"SvelteBoundary\":\n case \"SvelteComponent\":\n case \"SvelteDocument\":\n case \"SvelteElement\":\n case \"SvelteFragment\":\n case \"SvelteHead\":\n case \"SvelteSelf\":\n case \"SvelteWindow\":\n visit_element_attributes(node, candidates, matched, classified);\n walk_ast(node.fragment, candidates, matched, classified);\n return;\n\n default:\n return;\n }\n}\n\nfunction classify_debug_tag(\n _node: Extract<AST.Fragment[\"nodes\"][number], { type: \"DebugTag\" }>,\n _candidates: Map<string, MarkupCandidate>,\n _matched: Set<string>,\n _classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n return;\n}\n\nfunction classify_declaration_tag(\n node: Extract<\n AST.Fragment[\"nodes\"][number],\n { type: \"ConstTag\" | \"DeclarationTag\" }\n >,\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n for (const decl of node.declaration.declarations) {\n if (!decl.init) {\n continue;\n }\n\n classify_expression(decl.init, \"plain\", candidates, matched, classified);\n }\n}\n\ninterface ElementLikeNode {\n attributes: Array<{\n type: string;\n name?: string;\n value?: unknown;\n expression?: unknown;\n }>;\n fragment: AST.Fragment;\n}\n\nfunction visit_element_attributes(\n node: ElementLikeNode,\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n for (const attr of node.attributes) {\n if (\n attr.type === \"Attribute\" &&\n attr.name &&\n is_event_attribute_name(attr.name)\n ) {\n visit_attribute_value(\n attr.value as\n | true\n | AST.ExpressionTag\n | Array<AST.Text | AST.ExpressionTag>,\n \"event\",\n candidates,\n matched,\n classified,\n );\n continue;\n }\n\n if (attr.type === \"OnDirective\" && attr.expression) {\n classify_expression(\n attr.expression as ExpressionLike,\n \"event\",\n candidates,\n matched,\n classified,\n );\n continue;\n }\n }\n}\n\nfunction is_event_attribute_name(name: string): boolean {\n return name.startsWith(\"on:\") || /^on[a-z]/.test(name);\n}\n\nfunction visit_attribute_value(\n value: true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>,\n kind: TagKind,\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n if (value === true) {\n return;\n }\n\n if (Array.isArray(value)) {\n for (const part of value) {\n if (part.type === \"ExpressionTag\") {\n classify_expression(\n part.expression,\n kind,\n candidates,\n matched,\n classified,\n );\n }\n }\n return;\n }\n\n classify_expression(\n value.expression,\n kind,\n candidates,\n matched,\n classified,\n );\n}\n\ntype ExpressionLike = {\n type: string;\n name?: string;\n callee?: { type: string; name?: string };\n};\n\nfunction classify_expression(\n expression: ExpressionLike | null | undefined,\n kind: TagKind,\n candidates: Map<string, MarkupCandidate>,\n matched: Set<string>,\n classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n if (!expression) {\n return;\n }\n\n const found_candidates = find_candidates(expression, candidates);\n\n for (const candidate of found_candidates) {\n if (matched.has(candidate.placeholder)) {\n continue;\n }\n\n matched.add(candidate.placeholder);\n classified.push({\n candidate,\n kind: resolve_candidate_kind(candidate, kind),\n });\n }\n}\n\nfunction resolve_candidate_kind(\n candidate: MarkupCandidate,\n context_kind: TagKind,\n): TagKind {\n if (candidate.key === \"render_argument\") {\n return \"render_argument\";\n }\n\n return context_kind;\n}\n\nfunction find_candidates(\n expression: ExpressionLike,\n candidates: Map<string, MarkupCandidate>,\n): MarkupCandidate[] {\n const found: MarkupCandidate[] = [];\n const seen_nodes = new Set<unknown>();\n const seen_placeholders = new Set<string>();\n\n visit_expression_value(\n expression,\n candidates,\n seen_nodes,\n seen_placeholders,\n found,\n );\n\n return found;\n}\n\nfunction visit_expression_value(\n value: unknown,\n candidates: Map<string, MarkupCandidate>,\n seen_nodes: Set<unknown>,\n seen_placeholders: Set<string>,\n found: MarkupCandidate[],\n): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n visit_expression_value(\n item,\n candidates,\n seen_nodes,\n seen_placeholders,\n found,\n );\n }\n\n return;\n }\n\n if (!is_record(value) || seen_nodes.has(value)) {\n return;\n }\n\n seen_nodes.add(value);\n\n if (value.type === \"Identifier\" && typeof value.name === \"string\") {\n const candidate = candidates.get(value.name);\n\n if (candidate && !seen_placeholders.has(candidate.placeholder)) {\n seen_placeholders.add(candidate.placeholder);\n found.push(candidate);\n }\n }\n\n for (const child of Object.values(value)) {\n visit_expression_value(\n child,\n candidates,\n seen_nodes,\n seen_placeholders,\n found,\n );\n }\n}\n\nfunction is_record(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\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 /** Local names imported as the Effect object, such as `Effect` or `E`. */\n effect_object_names: ReadonlySet<string>;\n /** Namespace names imported from `effect/Effect`, such as `E.flatMap`. */\n effect_module_names: ReadonlySet<string>;\n /** Package namespace names imported from `effect`, such as `Fx.Effect`. */\n effect_package_names: ReadonlySet<string>;\n /** Direct `effect/Effect` imports mapped from local name to exported name. */\n direct_members: ReadonlyMap<string, string>;\n /** Expression used for generated `gen`, `sync`, and upgraded direct calls. */\n wrapper_expression: string;\n /** Import inserted when generated code needs a fresh Effect binding. */\n wrapper_import: HelperDeclaration | undefined;\n}\n\ninterface EffectBindingState {\n effect_object_names: string[];\n effect_module_names: string[];\n effect_package_names: string[];\n direct_members: Map<string, string>;\n local_names: Set<string>;\n implicit_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(\n content: string,\n): EffectCallbackRewriteContext {\n const state = make_effect_binding_state();\n const scripts = collect_script_blocks(content);\n\n for (const script of scripts) {\n const source_file = ts.createSourceFile(\n \"component-script.ts\",\n script,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n\n collect_source_file_bindings(source_file, state);\n }\n\n ensure_implicit_effect_binding(state);\n\n const wrapper = choose_effect_wrapper(state);\n\n return {\n effect_object_names: new Set(state.effect_object_names),\n effect_module_names: new Set(state.effect_module_names),\n effect_package_names: new Set(state.effect_package_names),\n direct_members: new Map(state.direct_members),\n wrapper_expression: wrapper.expression,\n wrapper_import: wrapper.import_text\n ? { text: wrapper.import_text }\n : undefined,\n };\n}\n\nfunction make_effect_binding_state(): EffectBindingState {\n return {\n effect_object_names: [],\n effect_module_names: [],\n effect_package_names: [],\n direct_members: new Map(),\n local_names: new Set(),\n implicit_effect_import: false,\n };\n}\n\nfunction collect_script_blocks(content: string): string[] {\n const pattern = /<script\\b[^>]*>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n return [...content.matchAll(pattern)].map((match) => match[1] ?? \"\");\n}\n\nfunction collect_source_file_bindings(\n source_file: ts.SourceFile,\n state: EffectBindingState,\n): void {\n for (const statement of source_file.statements) {\n collect_statement_binding(statement, state);\n }\n}\n\nfunction collect_statement_binding(\n statement: ts.Statement,\n state: EffectBindingState,\n): void {\n if (ts.isImportDeclaration(statement)) {\n collect_import_binding(statement, state);\n return;\n }\n\n if (ts.isImportEqualsDeclaration(statement)) {\n state.local_names.add(statement.name.text);\n return;\n }\n\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n collect_binding_name(declaration.name, state.local_names);\n }\n\n return;\n }\n\n if (\n ts.isFunctionDeclaration(statement) ||\n ts.isClassDeclaration(statement) ||\n ts.isInterfaceDeclaration(statement) ||\n ts.isTypeAliasDeclaration(statement) ||\n ts.isEnumDeclaration(statement) ||\n ts.isModuleDeclaration(statement)\n ) {\n if (statement.name) {\n state.local_names.add(statement.name.text);\n }\n }\n}\n\nfunction collect_import_binding(\n statement: ts.ImportDeclaration,\n state: EffectBindingState,\n): void {\n if (!ts.isStringLiteral(statement.moduleSpecifier)) {\n return;\n }\n\n const module_name = statement.moduleSpecifier.text;\n const clause = statement.importClause;\n\n if (!clause) {\n return;\n }\n\n if (clause.name) {\n state.local_names.add(clause.name.text);\n }\n\n const named_bindings = clause.namedBindings;\n\n if (!named_bindings) {\n return;\n }\n\n if (ts.isNamespaceImport(named_bindings)) {\n collect_namespace_import_binding(\n module_name,\n named_bindings.name.text,\n state,\n );\n return;\n }\n\n for (const element of named_bindings.elements) {\n collect_named_import_binding(module_name, element, state);\n }\n}\n\nfunction collect_namespace_import_binding(\n module_name: string,\n local_name: string,\n state: EffectBindingState,\n): void {\n state.local_names.add(local_name);\n\n if (module_name === EFFECT_DIRECT_MODULE) {\n add_ordered_name(state.effect_module_names, local_name);\n return;\n }\n\n if (module_name === EFFECT_PACKAGE_MODULE) {\n add_ordered_name(state.effect_package_names, local_name);\n }\n}\n\nfunction collect_named_import_binding(\n module_name: string,\n element: ts.ImportSpecifier,\n state: EffectBindingState,\n): void {\n const imported_name = element.propertyName?.text ?? element.name.text;\n const local_name = element.name.text;\n\n state.local_names.add(local_name);\n\n if (module_name === EFFECT_PACKAGE_MODULE && imported_name === \"Effect\") {\n add_ordered_name(state.effect_object_names, local_name);\n return;\n }\n\n if (module_name === EFFECT_DIRECT_MODULE) {\n state.direct_members.set(local_name, imported_name);\n }\n}\n\nfunction collect_binding_name(\n name: ts.BindingName,\n local_names: Set<string>,\n): void {\n if (ts.isIdentifier(name)) {\n local_names.add(name.text);\n return;\n }\n\n for (const element of name.elements) {\n if (ts.isOmittedExpression(element)) {\n continue;\n }\n\n collect_binding_name(element.name, local_names);\n }\n}\n\nfunction ensure_implicit_effect_binding(state: EffectBindingState): void {\n if (has_effect_binding(state) || state.local_names.has(\"Effect\")) {\n return;\n }\n\n add_ordered_name(state.effect_object_names, \"Effect\");\n state.implicit_effect_import = true;\n}\n\nfunction has_effect_binding(state: EffectBindingState): boolean {\n return state.effect_object_names.length > 0 ||\n state.effect_module_names.length > 0 ||\n state.effect_package_names.length > 0 ||\n state.direct_members.size > 0;\n}\n\nfunction choose_effect_wrapper(\n state: EffectBindingState,\n): { expression: string; import_text?: string } {\n const effect_object = state.effect_object_names[0];\n\n if (effect_object) {\n return {\n expression: effect_object,\n import_text: state.implicit_effect_import\n ? `import { Effect } from \"effect\";`\n : undefined,\n };\n }\n\n const effect_module = state.effect_module_names[0];\n\n if (effect_module) {\n return { expression: effect_module };\n }\n\n const effect_package = state.effect_package_names[0];\n\n if (effect_package) {\n return { expression: `${effect_package}.Effect` };\n }\n\n const generated_name = make_generated_effect_name(state.local_names);\n\n return {\n expression: generated_name,\n import_text: `import { Effect as ${generated_name} } from \"effect\";`,\n };\n}\n\nfunction make_generated_effect_name(local_names: ReadonlySet<string>): string {\n if (!local_names.has(GENERATED_EFFECT_NAME)) {\n return GENERATED_EFFECT_NAME;\n }\n\n let index = 1;\n\n while (local_names.has(`${GENERATED_EFFECT_NAME}_${index}`)) {\n index += 1;\n }\n\n return `${GENERATED_EFFECT_NAME}_${index}`;\n}\n\nfunction add_ordered_name(names: string[], name: string): void {\n if (names.includes(name)) {\n return;\n }\n\n names.push(name);\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(\n expr: string,\n): { params: string; body: string; body_start: number; body_end: number } {\n const arrow_idx = expr.indexOf(\"=>\");\n\n if (arrow_idx === -1) {\n return { params: \"()\", body: expr, body_start: 0, body_end: expr.length };\n }\n\n const params = expr.slice(0, arrow_idx).trim();\n const raw_body = expr.slice(arrow_idx + 2);\n const leading_ws = raw_body.length - raw_body.trimStart().length;\n let body_start = arrow_idx + 2 + leading_ws;\n let body_end = expr.length - (raw_body.length - raw_body.trimEnd().length);\n let body = expr.slice(body_start, body_end);\n\n if (body.startsWith(\"{\") && body.endsWith(\"}\")) {\n body_start += 1;\n body_end -= 1;\n body = body.slice(1, -1);\n }\n\n const body_leading_ws = body.length - body.trimStart().length;\n const body_trailing_ws = body.length - body.trimEnd().length;\n\n body_start += body_leading_ws;\n body_end -= body_trailing_ws;\n body = body.trim();\n\n if (body.endsWith(\";\")) {\n body = body.slice(0, -1);\n body_end -= 1;\n }\n\n return { 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 const wrapped = `const __SER___callback = ${expr};`;\n const sf = ts.createSourceFile(\n \"callback.ts\",\n wrapped,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n const stmt = sf.statements[0];\n\n if (!ts.isVariableStatement(stmt)) {\n return false;\n }\n\n const initializer = stmt.declarationList.declarations[0]?.initializer;\n\n return initializer !== undefined &&\n (ts.isArrowFunction(initializer) ||\n ts.isFunctionExpression(initializer));\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 has_top_level_yield_star: boolean;\n has_nested_invalid_yield_star: boolean;\n} {\n const wrapped = `function* __SER___event() { ${body}; }`;\n const sf = ts.createSourceFile(\n \"event.ts\",\n wrapped,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n const stmt = sf.statements[0];\n\n if (!ts.isFunctionDeclaration(stmt) || !stmt.body) {\n return {\n has_top_level_yield_star: false,\n has_nested_invalid_yield_star: /\\byield\\s*\\*/.test(body),\n };\n }\n\n const result = {\n has_top_level_yield_star: false,\n has_nested_invalid_yield_star: false,\n };\n\n visit_event_body(stmt.body, \"top_level\", result);\n\n return 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 const wrapped = `function* __SER___w() { return (${expr_text}); }`;\n let sf: ts.SourceFile;\n\n try {\n sf = ts.createSourceFile(\n \"expr.ts\",\n wrapped,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n } catch {\n return [];\n }\n\n const fn = sf.statements[0];\n\n if (!ts.isFunctionDeclaration(fn) || !fn.body) {\n return [];\n }\n\n const ids: string[] = [];\n const locals = new Set<string>();\n const seen = new Set<string>();\n\n visit_ids(fn.body, locals, seen, ids);\n\n return ids;\n}\n\nfunction visit_ids(\n node: ts.Node,\n locals: Set<string>,\n seen: Set<string>,\n ids: string[],\n): void {\n if (\n ts.isArrowFunction(node) ||\n ts.isFunctionExpression(node) ||\n ts.isFunctionDeclaration(node)\n ) {\n const scoped = new Set(locals);\n\n if (ts.isFunctionDeclaration(node) && node.name) {\n scoped.add(node.name.text);\n }\n\n for (const parameter of node.parameters) {\n add_binding_names(parameter.name, scoped);\n }\n\n if (node.body) {\n visit_ids(node.body, scoped, seen, ids);\n }\n\n return;\n }\n\n if (ts.isVariableDeclaration(node)) {\n if (node.initializer) {\n visit_ids(node.initializer, locals, seen, ids);\n }\n\n add_binding_names(node.name, locals);\n\n return;\n }\n\n if (ts.isTypeReferenceNode(node)) {\n return;\n }\n\n if (ts.isIdentifier(node)) {\n if (\n node.text === \"yield\" ||\n node.text === \"undefined\" ||\n node.text === \"null\" ||\n node.text === \"true\" ||\n node.text === \"false\" ||\n node.text === \"this\"\n ) {\n return;\n }\n\n if (is_property_access_name(node)) {\n return;\n }\n\n if (!locals.has(node.text) && !seen.has(node.text)) {\n seen.add(node.text);\n ids.push(node.text);\n }\n return;\n }\n\n node.forEachChild((child) => visit_ids(child, locals, seen, ids));\n}\n\nfunction add_binding_names(name: ts.BindingName, locals: Set<string>): void {\n if (ts.isIdentifier(name)) {\n locals.add(name.text);\n return;\n }\n\n for (const element of name.elements) {\n if (ts.isOmittedExpression(element)) {\n continue;\n }\n\n add_binding_names(element.name, locals);\n }\n}\n\ntype EventYieldContext = \"top_level\" | \"nested_generator\" | \"nested_invalid\";\n\ninterface EventYieldAnalysis {\n has_top_level_yield_star: boolean;\n has_nested_invalid_yield_star: boolean;\n}\n\nfunction visit_event_body(\n node: ts.Node,\n context: EventYieldContext,\n result: EventYieldAnalysis,\n): void {\n if (is_yield_star_expression(node)) {\n if (context === \"top_level\") {\n result.has_top_level_yield_star = true;\n } else if (context === \"nested_invalid\") {\n result.has_nested_invalid_yield_star = true;\n }\n\n node.forEachChild((child) => visit_event_body(child, context, result));\n return;\n }\n\n if (is_nested_function_boundary(node)) {\n const next_context = is_generator_function_boundary(node)\n ? \"nested_generator\"\n : \"nested_invalid\";\n\n node.forEachChild((child) => visit_event_body(child, next_context, result));\n return;\n }\n\n node.forEachChild((child) => visit_event_body(child, context, result));\n}\n\nfunction is_nested_function_boundary(node: ts.Node): boolean {\n return (\n ts.isArrowFunction(node) ||\n ts.isFunctionExpression(node) ||\n ts.isFunctionDeclaration(node) ||\n ts.isMethodDeclaration(node) ||\n ts.isGetAccessorDeclaration(node) ||\n ts.isSetAccessorDeclaration(node)\n );\n}\n\nfunction is_generator_function_boundary(node: ts.Node): boolean {\n return (\n (ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) ||\n ts.isMethodDeclaration(node)) &&\n node.asteriskToken !== undefined\n );\n}\n\nfunction is_yield_star_expression(node: ts.Node): boolean {\n if (ts.isYieldExpression(node)) {\n return node.asteriskToken !== undefined;\n }\n\n return (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n ts.isIdentifier(node.left) &&\n node.left.text === \"yield\"\n );\n}\n\nfunction is_property_access_name(node: ts.Identifier): boolean {\n const parent = node.parent;\n\n return (\n (ts.isPropertyAccessExpression(parent) && parent.name === node) ||\n (ts.isPropertyAssignment(parent) && parent.name === node) ||\n (ts.isBindingElement(parent) && parent.propertyName === node) ||\n ts.isImportSpecifier(parent) ||\n ts.isExportSpecifier(parent)\n );\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 [\"match\", \"matchEffect\"],\n [\"matchCause\", \"matchCauseEffect\"],\n]);\n\nconst EFFECTFUL_CALLBACK_MEMBERS = new Set([\n \"andThen\",\n \"catchAll\",\n \"catchAllCause\",\n \"catchCause\",\n \"catchTag\",\n \"flatMap\",\n \"forEach\",\n \"tap\",\n \"tapError\",\n \"tapErrorCause\",\n]);\n\nconst EFFECTFUL_HANDLER_MEMBERS = new Set([\n \"matchCauseEffect\",\n \"matchEffect\",\n \"tapBoth\",\n]);\n\ninterface RewriteContext {\n source_file: ts.SourceFile;\n source_text: string;\n magic: MagicString;\n offset: number;\n bindings: EffectCallbackRewriteContext;\n changed: boolean;\n uses_wrapper: boolean;\n}\n\ninterface EffectMember {\n name: string;\n name_start: number;\n name_end: number;\n direct: 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 expr_text: string,\n bindings: EffectCallbackRewriteContext,\n): { expr_text: string; helpers: HelperDeclaration[] } {\n const prefix = \"const __SER___expression = \";\n const source_text = `${prefix}${expr_text};`;\n const source_file = ts.createSourceFile(\n \"event-expression.ts\",\n source_text,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n const statement = source_file.statements[0];\n const magic = new MagicString(expr_text);\n const context: RewriteContext = {\n source_file,\n source_text,\n magic,\n offset: prefix.length,\n bindings,\n changed: false,\n uses_wrapper: false,\n };\n\n if (!ts.isVariableStatement(statement)) {\n return { expr_text, helpers: [] };\n }\n\n const expression = statement.declarationList.declarations[0]?.initializer;\n\n if (!expression) {\n return { expr_text, helpers: [] };\n }\n\n visit_expression(expression, context);\n\n if (!context.changed) {\n return { expr_text, helpers: [] };\n }\n\n const helpers = context.uses_wrapper && bindings.wrapper_import\n ? [bindings.wrapper_import]\n : [];\n\n return {\n expr_text: magic.toString(),\n helpers,\n };\n}\n\nfunction visit_expression(node: ts.Node, context: RewriteContext): void {\n if (is_non_generator_callback_with_top_level_yield(node)) {\n return;\n }\n\n if (ts.isCallExpression(node)) {\n rewrite_match_call(node, context);\n rewrite_effectful_handler_call(node, context);\n rewrite_effectful_callback_arguments(node, context);\n }\n\n node.forEachChild((child) => {\n visit_expression(child, context);\n });\n}\n\nfunction rewrite_match_call(\n call: ts.CallExpression,\n context: RewriteContext,\n): void {\n const member = get_effect_member(call.expression, context);\n const upgraded_name = member && MATCH_EFFECT_MEMBERS.get(member.name);\n const options = get_last_object_argument(call);\n\n if (!member || !upgraded_name || !options) {\n return;\n }\n\n const handlers = get_handler_properties(options);\n const should_upgrade = handlers.some((handler) =>\n handler.callback &&\n is_non_generator_callback_with_top_level_yield(handler.callback)\n );\n\n if (!should_upgrade) {\n return;\n }\n\n rewrite_effect_member_name(member, upgraded_name, context);\n context.changed = true;\n\n for (const handler of handlers) {\n if (!handler.callback) {\n continue;\n }\n\n if (is_non_generator_callback_with_top_level_yield(handler.callback)) {\n rewrite_callback_to_effect_gen(handler.callback, context);\n } else {\n rewrite_callback_to_effect_sync(handler.callback, context);\n }\n }\n}\n\nfunction rewrite_effectful_handler_call(\n call: ts.CallExpression,\n context: RewriteContext,\n): void {\n const member = get_effect_member(call.expression, context);\n const options = get_last_object_argument(call);\n\n if (!member || !EFFECTFUL_HANDLER_MEMBERS.has(member.name) || !options) {\n return;\n }\n\n for (const handler of get_handler_properties(options)) {\n if (\n handler.callback &&\n is_non_generator_callback_with_top_level_yield(handler.callback)\n ) {\n rewrite_callback_to_effect_gen(handler.callback, context);\n }\n }\n}\n\nfunction rewrite_effectful_callback_arguments(\n call: ts.CallExpression,\n context: RewriteContext,\n): void {\n const member = get_effect_member(call.expression, context);\n\n if (!member || !EFFECTFUL_CALLBACK_MEMBERS.has(member.name)) {\n return;\n }\n\n for (const argument of call.arguments) {\n if (\n is_callback_expression(argument) &&\n is_non_generator_callback_with_top_level_yield(argument)\n ) {\n rewrite_callback_to_effect_gen(argument, context);\n }\n }\n}\n\nfunction rewrite_callback_to_effect_gen(\n callback: ts.ArrowFunction | ts.FunctionExpression,\n context: RewriteContext,\n): void {\n if (is_async_function(callback)) {\n return;\n }\n\n if (ts.isArrowFunction(callback)) {\n rewrite_arrow_callback(callback, \"gen\", context);\n return;\n }\n\n rewrite_function_body(callback, \"gen\", context);\n}\n\nfunction rewrite_callback_to_effect_sync(\n callback: ts.ArrowFunction | ts.FunctionExpression,\n context: RewriteContext,\n): void {\n if (is_async_function(callback)) {\n return;\n }\n\n if (ts.isArrowFunction(callback)) {\n rewrite_arrow_callback(callback, \"sync\", context);\n return;\n }\n\n rewrite_function_body(callback, \"sync\", context);\n}\n\nfunction rewrite_arrow_callback(\n callback: ts.ArrowFunction,\n wrapper: EffectWrapperMember,\n context: RewriteContext,\n): void {\n const start = to_expr_pos(callback.getStart(context.source_file), context);\n const end = to_expr_pos(callback.end, context);\n const params_text = context.source_text\n .slice(\n callback.getStart(context.source_file),\n callback.equalsGreaterThanToken.getStart(context.source_file),\n )\n .trim();\n const body_text = get_body_text(callback.body, context);\n const rewritten_body = make_effect_body(\n callback.body,\n body_text,\n wrapper,\n context,\n );\n const replacement = `${params_text} => ${rewritten_body}`;\n\n context.magic.overwrite(start, end, replacement);\n context.changed = true;\n}\n\nfunction rewrite_function_body(\n callback: ts.FunctionExpression,\n wrapper: EffectWrapperMember,\n context: RewriteContext,\n): void {\n const body_start = to_expr_pos(\n callback.body.getStart(context.source_file),\n context,\n );\n const body_end = to_expr_pos(callback.body.end, context);\n const body_text = get_body_text(callback.body, context);\n const rewritten_body = make_effect_body(\n callback.body,\n body_text,\n wrapper,\n context,\n );\n\n context.magic.overwrite(\n body_start,\n body_end,\n `{ return ${rewritten_body}; }`,\n );\n context.changed = true;\n}\n\nfunction make_effect_body(\n body: ts.ConciseBody,\n body_text: string,\n wrapper: EffectWrapperMember,\n context: RewriteContext,\n): string {\n const wrapper_access = make_effect_access(wrapper, context);\n\n if (wrapper === \"gen\") {\n if (ts.isBlock(body)) {\n return `${wrapper_access}(function* () ${body_text})`;\n }\n\n return `${wrapper_access}(function* () { return (${body_text}); })`;\n }\n\n if (ts.isBlock(body)) {\n return `${wrapper_access}(() => ${body_text})`;\n }\n\n return `${wrapper_access}(() => (${body_text}))`;\n}\n\nfunction get_body_text(body: ts.ConciseBody, context: RewriteContext): string {\n return context.source_text\n .slice(body.getStart(context.source_file), body.end)\n .trim();\n}\n\nfunction get_handler_properties(\n object_literal: ts.ObjectLiteralExpression,\n): Array<{\n callback: ts.ArrowFunction | ts.FunctionExpression | undefined;\n}> {\n return object_literal.properties.flatMap((property) => {\n if (!ts.isPropertyAssignment(property)) {\n return [];\n }\n\n const name = get_property_name(property.name);\n\n if (name !== \"onFailure\" && name !== \"onSuccess\") {\n return [];\n }\n\n const callback = is_callback_expression(property.initializer)\n ? property.initializer\n : undefined;\n\n return [{ callback }];\n });\n}\n\nfunction get_last_object_argument(\n call: ts.CallExpression,\n): ts.ObjectLiteralExpression | undefined {\n const last_argument = call.arguments[call.arguments.length - 1];\n\n if (!last_argument || !ts.isObjectLiteralExpression(last_argument)) {\n return undefined;\n }\n\n return last_argument;\n}\n\nfunction get_effect_member(\n expression: ts.Expression,\n context: RewriteContext,\n): EffectMember | undefined {\n if (ts.isIdentifier(expression)) {\n const direct_member = context.bindings.direct_members.get(expression.text);\n\n if (!direct_member) {\n return undefined;\n }\n\n return {\n name: direct_member,\n name_start: to_expr_pos(\n expression.getStart(context.source_file),\n context,\n ),\n name_end: to_expr_pos(expression.end, context),\n direct: true,\n };\n }\n\n if (!ts.isPropertyAccessExpression(expression)) {\n return undefined;\n }\n\n if (!is_effect_namespace_expression(expression.expression, context)) {\n return undefined;\n }\n\n return {\n name: expression.name.text,\n name_start: to_expr_pos(\n expression.name.getStart(context.source_file),\n context,\n ),\n name_end: to_expr_pos(expression.name.end, context),\n direct: false,\n };\n}\n\nfunction rewrite_effect_member_name(\n member: EffectMember,\n upgraded_name: string,\n context: RewriteContext,\n): void {\n if (member.direct) {\n context.magic.overwrite(\n member.name_start,\n member.name_end,\n make_effect_access(upgraded_name, context),\n );\n\n return;\n }\n\n context.magic.overwrite(member.name_start, member.name_end, upgraded_name);\n}\n\nfunction make_effect_access(\n member_name: string,\n context: RewriteContext,\n): string {\n context.uses_wrapper = true;\n\n return `${context.bindings.wrapper_expression}.${member_name}`;\n}\n\nfunction is_effect_namespace_expression(\n expression: ts.Expression,\n context: RewriteContext,\n): boolean {\n if (ts.isIdentifier(expression)) {\n return context.bindings.effect_object_names.has(expression.text) ||\n context.bindings.effect_module_names.has(expression.text);\n }\n\n if (!ts.isPropertyAccessExpression(expression)) {\n return false;\n }\n\n if (expression.name.text !== \"Effect\") {\n return false;\n }\n\n if (!ts.isIdentifier(expression.expression)) {\n return false;\n }\n\n return context.bindings.effect_package_names.has(expression.expression.text);\n}\n\nfunction get_property_name(name: ts.PropertyName): string | undefined {\n if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {\n return name.text;\n }\n\n return undefined;\n}\n\nfunction is_callback_expression(\n node: ts.Node,\n): node is ts.ArrowFunction | ts.FunctionExpression {\n return ts.isArrowFunction(node) || ts.isFunctionExpression(node);\n}\n\nfunction is_non_generator_callback_with_top_level_yield(\n node: ts.Node,\n): node is ts.ArrowFunction | ts.FunctionExpression {\n if (!is_callback_expression(node)) {\n return false;\n }\n\n if (ts.isFunctionExpression(node) && node.asteriskToken) {\n return false;\n }\n\n return contains_top_level_yield_star(node.body);\n}\n\nfunction is_async_function(\n node: ts.ArrowFunction | ts.FunctionExpression,\n): boolean {\n return node.modifiers?.some(\n (modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword,\n ) ?? false;\n}\n\nfunction to_expr_pos(pos: number, context: RewriteContext): number {\n return pos - context.offset;\n}\n","import {\n AsyncEffectInEventCallbackError,\n YieldStarInEventCallbackError,\n} from \"$/errors.ts\";\nimport type { EffectCallbackRewriteContext } from \"./effect-bindings.ts\";\nimport {\n analyze_event_body_yield_star,\n collect_free_identifiers,\n is_callback_function_expression,\n} from \"./expressions.ts\";\nimport { normalize_effect_callback_yields } from \"./effect-callbacks.ts\";\nimport type {\n HelperDeclaration,\n MarkupCandidate,\n MarkupHelperBindings,\n MarkupNameAllocator,\n PendingRelocation,\n Replacement,\n TagKind,\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 classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n effect_context: EffectCallbackRewriteContext,\n helper_bindings: MarkupHelperBindings,\n name_allocator: MarkupNameAllocator,\n): Replacement[] {\n return classified.map(({ candidate, kind }) =>\n emit_replacement(\n candidate,\n kind,\n effect_context,\n helper_bindings,\n name_allocator,\n )\n );\n}\n\nfunction emit_replacement(\n candidate: MarkupCandidate,\n kind: TagKind,\n effect_context: EffectCallbackRewriteContext,\n helper_bindings: MarkupHelperBindings,\n name_allocator: MarkupNameAllocator,\n): Replacement {\n const normalized = normalize_effect_callback_yields(\n candidate.expr_text,\n effect_context,\n );\n const normalized_candidate = {\n ...candidate,\n expr_text: normalized.expr_text,\n };\n const id = make_cache_id(candidate);\n const id_text = JSON.stringify(id);\n const helper_name = make_helper_name(candidate, name_allocator);\n\n let replacement_text: string;\n let helpers: HelperDeclaration[];\n let relocation: PendingRelocation | undefined;\n\n if (kind === \"await\") {\n const effect = make_effect_helper(normalized_candidate, helper_name);\n\n replacement_text = emit_promise_expression(\n id_text,\n effect,\n helper_bindings,\n \"undefined\",\n `{ ssr: \"pending\" }`,\n );\n helpers = [...normalized.helpers, effect.helper];\n } else if (kind === \"render\") {\n const effect = make_effect_helper(normalized_candidate, helper_name);\n\n replacement_text = emit_render_expression(\n id_text,\n effect,\n candidate,\n helper_bindings,\n );\n helpers = [...normalized.helpers, effect.helper];\n } else if (kind === \"render_argument\") {\n const effect = make_effect_helper(normalized_candidate, helper_name);\n\n replacement_text = emit_each_expression(id_text, effect, helper_bindings);\n helpers = [...normalized.helpers, effect.helper];\n } else if (kind === \"each\") {\n const effect = make_effect_helper(normalized_candidate, helper_name);\n\n replacement_text = emit_each_expression(\n id_text,\n effect,\n helper_bindings,\n \"[]\",\n );\n helpers = [...normalized.helpers, effect.helper];\n } else if (kind === \"event\") {\n const event = make_event_handler(normalized_candidate, helper_bindings);\n\n replacement_text = event.text;\n helpers = normalized.helpers;\n relocation = make_relocation(candidate, replacement_text, {\n originalStart: 0,\n originalEnd: candidate.expr_text.length,\n generatedText: event.expr_text,\n });\n } else {\n const effect = make_effect_helper(normalized_candidate, helper_name);\n\n replacement_text = emit_each_expression(id_text, effect, helper_bindings);\n helpers = [...normalized.helpers, effect.helper];\n }\n\n return {\n start: candidate.start,\n end: candidate.end,\n text: replacement_text,\n helpers,\n relocation,\n };\n}\n\nfunction make_event_handler(\n candidate: MarkupCandidate,\n helper_bindings: MarkupHelperBindings,\n): { text: string; expr_text: string } {\n const expr_text = candidate.expr_text;\n\n if (is_callback_function_expression(expr_text)) {\n throw new YieldStarInEventCallbackError(\n candidate.filename,\n expr_text,\n );\n }\n\n const analysis = analyze_event_body_yield_star(expr_text);\n\n if (analysis.has_nested_invalid_yield_star) {\n throw new AsyncEffectInEventCallbackError(\n candidate.filename,\n expr_text,\n );\n }\n\n return {\n expr_text,\n text:\n `(event) => { ${helper_bindings.run}(function* () { ${expr_text}; }); }`,\n };\n}\n\nfunction emit_promise_expression(\n id_text: string,\n effect: EffectHelper,\n helper_bindings: MarkupHelperBindings,\n ssr_fallback?: string,\n options?: string,\n): string {\n const args = [\n id_text,\n effect.deps_text,\n `() => ${effect.call}`,\n ssr_fallback,\n options,\n ].filter((arg): arg is string => arg !== undefined);\n\n return `${helper_bindings.promise}(${args.join(\", \")})`;\n}\n\nfunction emit_render_expression(\n id_text: string,\n effect: EffectHelper,\n candidate: MarkupCandidate,\n helper_bindings: MarkupHelperBindings,\n): string {\n const expression = emit_promise_expression(id_text, effect, helper_bindings);\n\n if (/^\\s*yield\\s*\\*/.test(candidate.expr_text)) {\n return `(await ${expression})()`;\n }\n\n return `await ${expression}`;\n}\n\nfunction emit_each_expression(\n id_text: string,\n effect: EffectHelper,\n helper_bindings: MarkupHelperBindings,\n ssr_fallback?: string,\n): string {\n return `await ${\n emit_promise_expression(\n id_text,\n effect,\n helper_bindings,\n ssr_fallback,\n )\n }`;\n}\n\ninterface EffectHelper {\n helper: HelperDeclaration;\n call: string;\n deps_text: string;\n}\n\nfunction make_effect_helper(\n candidate: MarkupCandidate,\n helper_name: string,\n): EffectHelper {\n const deps = collect_free_identifiers(candidate.expr_text);\n const args_text = deps.join(\", \");\n const deps_text = deps.length === 0 ? \"[]\" : `[${args_text}]`;\n const call = `${helper_name}()`;\n const text =\n `function* ${helper_name}() { return (${candidate.expr_text}); }`;\n const generated_start = text.indexOf(candidate.expr_text);\n\n return {\n call,\n deps_text,\n helper: {\n text,\n relocation: {\n originalStart: candidate.start,\n originalEnd: candidate.end,\n generatedStartInReplacement: generated_start,\n generatedEndInReplacement: generated_start +\n candidate.expr_text.length,\n },\n },\n };\n}\n\nfunction make_cache_id(candidate: MarkupCandidate): string {\n const normalized_filename = candidate.filename.replace(/[?#].*$/, \"\");\n\n return `${normalized_filename}:${candidate.start}:${candidate.end}`;\n}\n\nfunction make_helper_name(\n candidate: MarkupCandidate,\n name_allocator: MarkupNameAllocator,\n): string {\n return name_allocator.reserve(\n `__SER___markup_effect_${candidate.start}_${candidate.end}`,\n );\n}\n\nfunction make_relocation(\n candidate: MarkupCandidate,\n replacement_text: string,\n inner: {\n originalStart: number;\n originalEnd: number;\n generatedText: string;\n },\n): PendingRelocation | undefined {\n const generated_start = replacement_text.indexOf(inner.generatedText);\n\n if (generated_start === -1) {\n return undefined;\n }\n\n return {\n originalStart: candidate.start + inner.originalStart,\n originalEnd: candidate.start + inner.originalEnd,\n generatedStartInReplacement: generated_start,\n generatedEndInReplacement: generated_start + inner.generatedText.length,\n };\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 return (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n ts.isIdentifier(node.left) &&\n node.left.text === \"yield\"\n );\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 return (\n ts.isArrowFunction(node) ||\n ts.isFunctionDeclaration(node) ||\n ts.isFunctionExpression(node) ||\n ts.isMethodDeclaration(node) ||\n ts.isGetAccessorDeclaration(node) ||\n ts.isSetAccessorDeclaration(node)\n );\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 if (ts.isAwaitExpression(node)) {\n return true;\n }\n\n return node.getChildren().some(\n (child) =>\n !is_function_boundary_node(child) && contains_top_level_await(child),\n );\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(\n node: ts.Node,\n on_found: (node: ts.Node) => void,\n): void {\n if (is_function_boundary_node(node)) {\n return;\n }\n\n if (is_yield_star_expression(node)) {\n on_found(node);\n return;\n }\n\n node.forEachChild((child) => {\n collect_yield_star_nodes(child, on_found);\n });\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(\n node: ts.Node,\n on_found: (node: ts.Node) => void,\n): void {\n if (is_function_boundary_node(node)) {\n return;\n }\n\n if (is_yield_star_expression(node)) {\n on_found(node);\n return;\n }\n\n node.forEachChild((child) => {\n find_yield_star_node(child, on_found);\n });\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 if (ts.isIdentifier(name)) {\n return [name.text];\n }\n\n const result: string[] = [];\n\n for (const element of name.elements) {\n if (ts.isOmittedExpression(element)) {\n continue;\n }\n\n result.push(...extract_binding_names(element.name));\n }\n\n return result;\n}\n","import { collect_yield_star_nodes } from \"$/script-transform/ast.ts\";\nimport { contains_top_level_yield_star } from \"$/detect.ts\";\nimport MagicString from \"magic-string\";\nimport ts from \"typescript\";\n\nimport {\n analyze_event_body_yield_star,\n strip_arrow_function,\n} from \"./expressions.ts\";\nimport { HELPERS } from \"./constants.ts\";\nimport type { MarkupCandidate, TagKind } from \"./types.ts\";\n\ninterface SanitizeResult {\n code: string;\n candidates: MarkupCandidate[];\n}\n\ninterface DeclarationYieldExpression {\n start: number;\n end: number;\n expr_text: string;\n}\n\nexport function sanitize_markup(\n content: string,\n filename: string,\n): SanitizeResult {\n const candidates: MarkupCandidate[] = [];\n const magic = new MagicString(content);\n let helper_index = 0;\n let cursor = 0;\n\n while (cursor < content.length) {\n const open = content.indexOf(\"{\", cursor);\n if (open === -1) break;\n\n /** Skip braces inside <script> and <style> blocks. */\n if (\n is_inside_excluded_block(content, open) ||\n is_inside_html_comment(content, open)\n ) {\n cursor = open + 1;\n continue;\n }\n\n /** Find the matching closing brace. */\n const close = find_closing_brace(content, open + 1);\n if (close === -1) {\n cursor = open + 1;\n continue;\n }\n\n const inner = content.slice(open + 1, close);\n\n const trimmed = inner.trimStart();\n const leading_ws = inner.length - trimmed.length;\n\n const tag_info = get_tag_info(trimmed);\n\n const declaration_yields = collect_declaration_yield_expressions(\n content,\n open,\n leading_ws,\n trimmed,\n );\n\n if (declaration_yields.length > 0) {\n for (const declaration_yield of declaration_yields) {\n const placeholder = `__SER___markup_placeholder_${helper_index}`;\n helper_index += 1;\n\n candidates.push({\n placeholder,\n start: declaration_yield.start,\n end: declaration_yield.end,\n expr_text: declaration_yield.expr_text,\n filename,\n key: \"plain\",\n });\n\n magic.overwrite(\n declaration_yield.start,\n declaration_yield.end,\n placeholder,\n );\n }\n\n cursor = close + 1;\n continue;\n }\n\n let expr_body = trimmed.slice(tag_info.prefix_length);\n\n /** For @const, only use the RHS after `=` as the expression body. */\n const equal_idx = tag_info.kind === \"plain\" && trimmed.startsWith(\"@const \")\n ? expr_body.indexOf(\"=\")\n : -1;\n\n /** Check if this is a callback handler containing yield*. */\n const is_event_callback = is_event_callback_expression(inner);\n\n /** Determine if this brace contains yield* that needs lowering. */\n const event_yield = is_event_callback\n ? analyze_event_yield(inner)\n : undefined;\n const has_yield = event_yield?.has_top_level_yield_star ??\n contains_yield_star_in_text(expr_body);\n\n if (!has_yield) {\n cursor = close + 1;\n continue;\n }\n\n /** The expression starts after the tag prefix. For @const, after the `=`. */\n let extra_prefix = 0;\n\n if (equal_idx !== -1) {\n const after_eq_raw = expr_body.slice(equal_idx + 1);\n expr_body = after_eq_raw.trimStart();\n extra_prefix = equal_idx + 1 + (after_eq_raw.length - expr_body.length);\n }\n\n const expr_start = open + 1 + leading_ws + tag_info.prefix_length +\n extra_prefix;\n\n /** For each/await, the expression ends before ` as ` or ` then `/` catch `. */\n let expr_end = close;\n\n const key = tag_info.kind;\n\n if (key === \"each\") {\n const as_idx = expr_body.lastIndexOf(\" as \");\n if (as_idx !== -1) expr_end = expr_start + as_idx;\n }\n\n if (key === \"await\") {\n const then_idx = expr_body.indexOf(\" then \");\n const catch_idx = expr_body.indexOf(\" catch \");\n const boundary = Math.min(\n then_idx === -1 ? Infinity : then_idx,\n catch_idx === -1 ? Infinity : catch_idx,\n );\n if (boundary !== Infinity) expr_end = expr_start + boundary;\n }\n\n const expr_text = content.slice(expr_start, expr_end).trim();\n\n if (expr_text.length === 0) {\n cursor = close + 1;\n continue;\n }\n\n if (key === \"render\" && !/^\\s*yield\\s*\\*/.test(expr_text)) {\n const render_arg_yields = collect_expression_yield_expressions(\n content,\n expr_start,\n expr_text,\n );\n\n if (render_arg_yields.length > 0) {\n for (const render_arg_yield of render_arg_yields) {\n const placeholder = `__SER___markup_placeholder_${helper_index}`;\n helper_index += 1;\n\n candidates.push({\n placeholder,\n start: render_arg_yield.start,\n end: render_arg_yield.end,\n expr_text: render_arg_yield.expr_text,\n filename,\n key: \"render_argument\",\n });\n\n magic.overwrite(\n render_arg_yield.start,\n render_arg_yield.end,\n placeholder,\n );\n }\n\n cursor = close + 1;\n continue;\n }\n }\n\n /** Create a placeholder and replace the expression (preserving tag prefixes). */\n const placeholder = `__SER___markup_placeholder_${helper_index}`;\n helper_index += 1;\n\n candidates.push({\n placeholder,\n start: expr_start,\n end: expr_end,\n expr_text,\n filename,\n key,\n });\n\n magic.overwrite(\n expr_start,\n expr_end,\n key === \"render\" ? `${placeholder}()` : placeholder,\n );\n\n cursor = close + 1;\n }\n\n return { code: magic.toString(), candidates };\n}\n\nfunction collect_expression_yield_expressions(\n content: string,\n expr_start: number,\n expr_text: string,\n): DeclarationYieldExpression[] {\n const source_file = ts.createSourceFile(\n \"markup-expression.ts\",\n `const __SER___expr = ${expr_text};`,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n const stmt = source_file.statements[0];\n\n if (!stmt || !ts.isVariableStatement(stmt)) {\n return [];\n }\n\n const initializer = stmt.declarationList.declarations[0]?.initializer;\n\n if (!initializer || !contains_top_level_yield_star(initializer)) {\n return [];\n }\n\n const prefix_length = source_file.text.indexOf(expr_text);\n const expressions: DeclarationYieldExpression[] = [];\n\n collect_yield_star_nodes(initializer, (yield_node) => {\n const start = expr_start + yield_node.getStart(source_file) -\n prefix_length;\n const end = expr_start + yield_node.end - prefix_length;\n const yielded_text = content.slice(start, end).trim();\n\n expressions.push({\n start,\n end,\n expr_text: yielded_text,\n });\n });\n\n return expressions;\n}\n\nfunction is_inside_excluded_block(content: string, pos: number): boolean {\n const script = find_tag_end(content, \"script\", pos);\n const style = find_tag_end(content, \"style\", pos);\n\n return (\n (script !== undefined && pos < script.end && pos > script.start) ||\n (style !== undefined && pos < style.end && pos > style.start)\n );\n}\n\nfunction is_inside_html_comment(content: string, pos: number): boolean {\n const open = content.lastIndexOf(\"<!--\", pos);\n const close = content.lastIndexOf(\"-->\", pos);\n\n return open !== -1 && open > close;\n}\n\nfunction find_tag_end(\n content: string,\n tag: string,\n after_pos: number,\n): { start: number; end: number } | undefined {\n const pattern = new RegExp(\n `<${tag}\\\\b[^>]*>([\\\\s\\\\S]*?)<\\\\/${tag}\\\\s*>`,\n \"gi\",\n );\n\n for (const match of content.matchAll(pattern)) {\n if (match.index === undefined) continue;\n const end_pos = match.index + match[0].length;\n if (match.index <= after_pos && after_pos < end_pos) {\n return { start: match.index, end: end_pos };\n }\n }\n\n return undefined;\n}\n\n/** Brace matching helpers for extracting complete markup expressions. */\n\nfunction find_closing_brace(content: string, start: number): number {\n let depth = 0;\n\n for (let i = start; i < content.length; i += 1) {\n const ch = content[i];\n\n if (ch === \"{\" && content[i - 1] !== \"$\") {\n depth += 1;\n } else if (ch === \"}\") {\n if (depth === 0) return i;\n depth -= 1;\n } else if (ch === \"'\" || ch === '\"' || ch === \"`\") {\n i = skip_string(content, i, ch);\n if (i === -1) return -1;\n } else if (ch === \"/\" && content[i + 1] === \"/\") {\n i = skip_line_comment(content, i);\n } else if (ch === \"/\" && content[i + 1] === \"*\") {\n i = skip_block_comment(content, i);\n if (i === -1) return -1;\n }\n }\n\n return -1;\n}\n\nfunction skip_string(content: string, start: number, quote: string): number {\n for (let i = start + 1; i < content.length; i += 1) {\n if (content[i] === \"\\\\\") {\n i += 1;\n continue;\n }\n if (content[i] === quote) return i;\n }\n return -1;\n}\n\nfunction skip_line_comment(content: string, start: number): number {\n for (let i = start + 2; i < content.length; i += 1) {\n if (content[i] === \"\\n\") return i;\n }\n return content.length;\n}\n\nfunction skip_block_comment(content: string, start: number): number {\n for (let i = start + 2; i < content.length; i += 1) {\n if (content[i] === \"*\" && content[i + 1] === \"/\") return i + 1;\n }\n return -1;\n}\n\ninterface TagInfo {\n kind: TagKind;\n prefix_length: number;\n}\n\nfunction get_tag_info(trimmed: string): TagInfo {\n if (trimmed.startsWith(\"#each \")) {\n return { kind: \"each\", prefix_length: \"#each \".length };\n }\n if (trimmed.startsWith(\"#await \")) {\n return { kind: \"await\", prefix_length: \"#await \".length };\n }\n if (trimmed.startsWith(\"@render \")) {\n return { kind: \"render\", prefix_length: \"@render \".length };\n }\n\n /** Strip prefix-only tags — the expression starts after the tag keyword. */\n if (trimmed.startsWith(\"#if \")) {\n return { kind: \"plain\", prefix_length: \"#if \".length };\n }\n if (trimmed.startsWith(\":else if \")) {\n return { kind: \"plain\", prefix_length: \":else if \".length };\n }\n if (trimmed.startsWith(\"#key \")) {\n return { kind: \"plain\", prefix_length: \"#key \".length };\n }\n if (trimmed.startsWith(\"@const \")) {\n return { kind: \"plain\", prefix_length: \"@const \".length };\n }\n if (trimmed.startsWith(\"@html \")) {\n return { kind: \"plain\", prefix_length: \"@html \".length };\n }\n if (trimmed.startsWith(\"@debug \")) {\n return { kind: \"plain\", prefix_length: \"@debug \".length };\n }\n\n return { kind: \"plain\", prefix_length: 0 };\n}\n\nfunction collect_declaration_yield_expressions(\n content: string,\n open: number,\n leading_ws: number,\n trimmed: string,\n): DeclarationYieldExpression[] {\n if (!is_declaration_tag_text(trimmed)) {\n return [];\n }\n\n const source_file = ts.createSourceFile(\n \"declaration-tag.ts\",\n `${trimmed};`,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n\n const stmt = source_file.statements[0];\n\n if (!stmt || !ts.isVariableStatement(stmt)) {\n return [];\n }\n\n const tag_start = open + 1 + leading_ws;\n\n return stmt.declarationList.declarations.flatMap((decl) => {\n const initializer = decl.initializer;\n\n if (!initializer || !contains_top_level_yield_star(initializer)) {\n return [];\n }\n\n const expressions: DeclarationYieldExpression[] = [];\n\n collect_yield_star_nodes(initializer, (yield_node) => {\n const start = tag_start + yield_node.getStart(source_file);\n const end = tag_start + yield_node.end;\n const expr_text = content.slice(start, end).trim();\n\n expressions.push({\n start,\n end,\n expr_text,\n });\n });\n\n return expressions;\n });\n}\n\nfunction is_declaration_tag_text(trimmed: string): boolean {\n return /^(?:const|let)\\s/.test(trimmed);\n}\n\nfunction is_event_callback_expression(inner: string): boolean {\n const trimmed = inner.trimStart();\n\n return /^(?:async\\s+)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>/.test(trimmed) ||\n /^(?:async\\s+)?function\\b/.test(trimmed);\n}\n\nfunction analyze_event_yield(\n inner: string,\n): {\n has_top_level_yield_star: boolean;\n} {\n const event = strip_arrow_function(inner);\n const analysis = analyze_event_body_yield_star(event.body);\n const generated_run = new RegExp(`${HELPERS.run}(?:_\\\\d+)?\\\\(function\\\\*`);\n\n if (generated_run.test(event.body)) {\n return {\n has_top_level_yield_star: false,\n };\n }\n\n return {\n has_top_level_yield_star: analysis.has_top_level_yield_star ||\n analysis.has_nested_invalid_yield_star ||\n /\\byield\\s*\\*/.test(event.body),\n };\n}\n\nfunction contains_yield_star_in_text(text: string): boolean {\n if (!/\\byield\\s*\\*/.test(text)) return false;\n\n try {\n const sf = ts.createSourceFile(\n \"expr.ts\",\n `const x = ${text};`,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n );\n const stmt = sf.statements[0];\n if (!ts.isVariableStatement(stmt)) return false;\n const decl = stmt.declarationList.declarations[0];\n if (!decl?.initializer) return false;\n return contains_top_level_yield_star(decl.initializer);\n } catch {\n return true;\n }\n}\n\n/** Free identifier collection helpers for generated closures. */\n","import { type AST, parse } from \"svelte/compiler\";\n\nimport MagicString from \"magic-string\";\n\nimport {\n blank_script_blocks,\n create_relocations,\n create_source_map,\n inject_helpers,\n make_markup_helper_bindings,\n} from \"./apply.ts\";\nimport { classify_candidates } from \"./classify.ts\";\nimport { collect_effect_callback_bindings } from \"./effect-bindings.ts\";\nimport { emit_replacements } from \"./emit.ts\";\nimport { sanitize_markup } from \"./scan.ts\";\nimport { UnsupportedMarkupEffectPositionError } from \"$/errors.ts\";\nimport type { MarkupTransformResult } from \"./types.ts\";\n\nexport type { MarkupRelocation, MarkupTransformResult } from \"./types.ts\";\n\n/**\n * Transforms Svelte markup containing `{yield* expr}` brace expressions\n * into calls to the markup runtime helpers (`value`, `promise`, `run`).\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 * @since 2.0.0\n * @param content - The raw `.svelte` file content.\n * @param filename - The source filename, used in error messages.\n * @returns The transformed markup and a flag indicating whether yield* was\n * found.\n */\nexport function transform_markup_effect(\n content: string,\n filename: string,\n): MarkupTransformResult {\n if (!/\\byield\\s*\\*/.test(content)) {\n return { code: content, has_yield: false };\n }\n\n /** Find all brace expressions containing yield* and replace with placeholders. */\n const work = sanitize_markup(content, filename);\n const effect_context = collect_effect_callback_bindings(content);\n const helper_context = make_markup_helper_bindings(content);\n\n if (work.candidates.length === 0) {\n return { code: content, has_yield: false };\n }\n\n /** Parse the sanitized markup with Svelte's AST. Strip <script> blocks\n * first so TypeScript syntax (import type, etc.) doesn't break the parser. */\n const clean = blank_script_blocks(work.code);\n const ast = parse(clean, { filename, modern: true }) as AST.Root;\n\n /** Match placeholders to their AST context and build replacements. */\n const classified = classify_candidates(\n ast,\n work.candidates,\n );\n const matched = new Set(\n classified.map(({ candidate }) => candidate.placeholder),\n );\n const unmatched = work.candidates.find((candidate) =>\n !matched.has(candidate.placeholder)\n );\n\n if (unmatched) {\n throw new UnsupportedMarkupEffectPositionError(\n filename,\n unmatched.expr_text,\n );\n }\n\n const replacements = emit_replacements(\n classified,\n effect_context,\n helper_context.bindings,\n helper_context.name_allocator,\n );\n const helpers = replacements.flatMap((replacement) =>\n replacement.helpers ?? []\n );\n\n const magic = new MagicString(content);\n\n replacements.sort((a, b) => b.start - a.start);\n\n for (const r of replacements) {\n magic.overwrite(r.start, r.end, r.text);\n }\n\n const helper_insertion = inject_helpers(\n magic,\n content,\n helpers,\n helper_context.bindings,\n );\n const relocations = create_relocations(replacements, helper_insertion);\n\n return {\n code: magic.toString(),\n has_yield: true,\n map: create_source_map(magic, filename),\n relocations,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAAgB,aACd,mBACA,uBACA,oBACA,WAAkC;CAChC,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,QAAQ;CACR,SAAS;CACT,SAAS;AACX,GACA,UAAgC,CAAC,GACzB;CACR,MAAM,mBAAmB,QAAQ,oBAAoB;CACrD,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,gBAAgB,QAAQ,iBAAiB;CAE/C,MAAM,oBAAoB,SAAS,eAAe,mBAC9C,gFACA,8BAA8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T;AACF;;;;;;;;;;;;;;;;;;;;ACjcA,SAAgB,wBACd,SACA,UACuB;CACvB,IAAI,CAAC,eAAe,KAAK,OAAO,GAC9B,OAAO;EAAE,MAAM;EAAS,WAAW;CAAM;;CAI3C,MAAM,OAAO,gBAAgB,SAAS,QAAQ;CAC9C,MAAM,iBAAiB,iCAAiC,OAAO;CAC/D,MAAM,iBAAiB,4BAA4B,OAAO;CAE1D,IAAI,KAAK,WAAW,WAAW,GAC7B,OAAO;EAAE,MAAM;EAAS,WAAW;CAAM;;CAS3C,MAAM,aAAa,oBAHP,MADE,oBAAoB,KAAK,IACjB,GAAG;EAAE;EAAU,QAAQ;CAAK,CAI9C,GACF,KAAK,UACP;CACA,MAAM,UAAU,IAAI,IAClB,WAAW,KAAK,EAAE,gBAAgB,UAAU,WAAW,CACzD;CACA,MAAM,YAAY,KAAK,WAAW,MAAM,cACtC,CAAC,QAAQ,IAAI,UAAU,WAAW,CACpC;CAEA,IAAI,WACF,MAAM,IAAI,qCACR,UACA,UAAU,SACZ;CAGF,MAAM,eAAe,kBACnB,YACA,gBACA,eAAe,UACf,eAAe,cACjB;CACA,MAAM,UAAU,aAAa,SAAS,gBACpC,YAAY,WAAW,CAAC,CAC1B;CAEA,MAAM,QAAQ,IAAI,YAAY,OAAO;CAErC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;CAE7C,KAAK,MAAM,KAAK,cACd,MAAM,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI;CASxC,MAAM,cAAc,mBAAmB,cANd,eACvB,OACA,SACA,SACA,eAAe,QAEmD,CAAC;CAErE,OAAO;EACL,MAAM,MAAM,SAAS;EACrB,WAAW;EACX,KAAK,kBAAkB,OAAO,QAAQ;EACtC;CACF;AACF"}
@@ -1,2 +1,2 @@
1
- import { n as get_dispatcher, r as reset_dispatcher, t as Dispatcher } from "./chunks/dispatcher-CgCdn6bj.js";
1
+ import { n as get_dispatcher, r as reset_dispatcher, t as Dispatcher } from "./chunks/dispatcher-CZvLODNK.js";
2
2
  export { Dispatcher, get_dispatcher, reset_dispatcher };