svelte-effect-runtime 3.4.10 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dist/chunks/{client-CsVu54pU.js → client-DcZUV4rR.js} +76 -50
- package/.dist/chunks/client-DcZUV4rR.js.map +1 -0
- package/.dist/chunks/{vite-Dm3bXmR3.js → compiler-BBPNyXmQ.js} +84 -112
- package/.dist/chunks/compiler-BBPNyXmQ.js.map +1 -0
- package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-DOx8iC6r.js} +2 -2
- package/.dist/chunks/{dispatcher-pHH4JcFR.js.map → dispatcher-DOx8iC6r.js.map} +1 -1
- package/.dist/chunks/{dispatcher-LtvFKYUp.js → dispatcher-H-Ia0Os4.js} +3 -3
- package/.dist/chunks/{dispatcher-LtvFKYUp.js.map → dispatcher-H-Ia0Os4.js.map} +1 -1
- package/.dist/chunks/{errors-Dcf0MVbq.js → errors-IJjsUwrE.js} +21 -65
- package/.dist/chunks/errors-IJjsUwrE.js.map +1 -0
- package/.dist/chunks/live-BXAKre_4.js +104 -0
- package/.dist/chunks/live-BXAKre_4.js.map +1 -0
- package/.dist/chunks/{remote-client-Bj1pZXgq.js → remote-client-CVI4t66c.js} +2 -2
- package/.dist/chunks/remote-client-CVI4t66c.js.map +1 -0
- package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-GBQz32DZ.js} +3 -3
- package/.dist/chunks/{runtime-ekkMQ-wL.js.map → runtime-GBQz32DZ.js.map} +1 -1
- package/.dist/chunks/schema-D9pct6Y5.js +89 -0
- package/.dist/chunks/schema-D9pct6Y5.js.map +1 -0
- package/.dist/chunks/server-D1LcDnZE.js +213 -0
- package/.dist/chunks/server-D1LcDnZE.js.map +1 -0
- package/.dist/chunks/source-scan-C4PsggID.js +341 -0
- package/.dist/chunks/source-scan-C4PsggID.js.map +1 -0
- package/.dist/chunks/{transform-CEK6Ccll.js → transform-jNUr65K9.js} +289 -248
- package/.dist/chunks/transform-jNUr65K9.js.map +1 -0
- package/.dist/compiler/source-scan.d.ts +198 -0
- package/.dist/{vite.d.ts → compiler.d.ts} +1 -1
- package/.dist/{vite.js → compiler.js} +1 -1
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +15 -45
- package/.dist/generators.d.ts +3 -1
- package/.dist/internal/generators.js +20 -3
- package/.dist/internal/generators.js.map +1 -0
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/internal/remote-server.js +1 -1
- package/.dist/internal/schema.d.ts +67 -0
- package/.dist/live.d.ts +123 -0
- package/.dist/markup/event-attributes.d.ts +38 -0
- package/.dist/markup/promise.js +1 -1
- package/.dist/markup/run.js +1 -1
- package/.dist/markup/transform/classify.d.ts +12 -4
- package/.dist/markup/transform/constants.d.ts +1 -0
- package/.dist/markup/transform/emit.d.ts +12 -4
- package/.dist/markup/transform/types.d.ts +1 -0
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.js +1 -1
- package/.dist/mod.d.ts +6 -3
- package/.dist/mod.js +5 -4
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/cause-codec.d.ts +53 -0
- package/.dist/remote/client/form-transport.d.ts +4 -1
- package/.dist/remote/client/form.d.ts +10 -1
- package/.dist/remote/client/index.d.ts +1 -1
- package/.dist/remote/client/query.d.ts +6 -16
- package/.dist/remote/client/types.d.ts +32 -13
- package/.dist/remote/client.d.ts +1 -1
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.d.ts +2 -12
- package/.dist/remote/server.js +1 -178
- package/.dist/runtime/transform.js +81 -68
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/imports.d.ts +2 -0
- package/.dist/script-transform/types.d.ts +8 -0
- package/.dist/server/effects.d.ts +7 -7
- package/.dist/server/handler.d.ts +37 -0
- package/.dist/server/index.d.ts +4 -1
- package/.dist/server/schema.d.ts +2 -26
- package/.dist/server/types.d.ts +44 -50
- package/.dist/server/wrappers.d.ts +2 -2
- package/.dist/server.d.ts +2 -2
- package/.dist/server.js +88 -97
- package/.dist/server.js.map +1 -1
- package/.dist/yieldable.d.ts +41 -0
- package/README.md +1 -1
- package/package.json +4 -4
- package/.dist/chunks/client-CsVu54pU.js.map +0 -1
- package/.dist/chunks/descriptors-cOe9uRJz.js +0 -36
- package/.dist/chunks/descriptors-cOe9uRJz.js.map +0 -1
- package/.dist/chunks/errors-Dcf0MVbq.js.map +0 -1
- package/.dist/chunks/remote-client-Bj1pZXgq.js.map +0 -1
- package/.dist/chunks/transform-CEK6Ccll.js.map +0 -1
- package/.dist/chunks/vite-Dm3bXmR3.js.map +0 -1
- package/.dist/remote/server.js.map +0 -1
- /package/.dist/{vite → compiler}/remote-client.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-CsVu54pU.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/remote/client/utils.ts","../../../modules/svelte-effect-runtime/src/remote/client/failures.ts","../../../modules/svelte-effect-runtime/src/remote/client/responses.ts","../../../modules/svelte-effect-runtime/src/remote/client/effect.ts","../../../modules/svelte-effect-runtime/src/remote/client/command.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-data.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-transport.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-enhance.ts","../../../modules/svelte-effect-runtime/src/remote/client/form.ts","../../../modules/svelte-effect-runtime/src/remote/client/query-result.ts","../../../modules/svelte-effect-runtime/src/remote/client/query.ts"],"sourcesContent":["export { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport type { NativeMethod } from \"./types.ts\";\n\n/**\n * Checks whether a value has a callable method property.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @param key - Method key to look up.\n * @returns Whether the value has a function at `key`.\n */\nexport function has_method<K extends PropertyKey>(\n\tvalue: unknown,\n\tkey: K,\n): value is Record<K, NativeMethod> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as Record<PropertyKey, unknown>)[key] === \"function\"\n\t);\n}\n","import {\n\tcreate_remote_http_error,\n\tcreate_remote_transport_error,\n\tis_serialized_remote_failure_envelope,\n} from \"$/remote/shared.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { RemoteErrorDecodeError } from \"$/errors.ts\";\nimport { Option, Schema } from \"effect\";\nimport { parse } from \"devalue\";\n\ntype JsonStringDecode =\n\t| {\n\t\t\treadonly _tag: \"JsonStringDecoded\";\n\t\t\treadonly value: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"JsonStringIgnored\";\n\t };\n\ntype EmbeddedRemoteFailureDecode =\n\t| {\n\t\t\treadonly _tag: \"EmbeddedRemoteFailureDecoded\";\n\t\t\treadonly value: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"EmbeddedRemoteFailureIgnored\";\n\t };\n\ntype SerializedRemoteFailureDecode<ErrorType> =\n\t| {\n\t\t\treadonly _tag: \"SerializedRemoteFailureDecoded\";\n\t\t\treadonly value: RemoteFailure<ErrorType>;\n\t }\n\t| {\n\t\t\treadonly _tag: \"SerializedRemoteFailureInvalid\";\n\t };\n\nconst RemoteErrorMessageEnvelopeSchema = Schema.Struct({\n\tmessage: Schema.String,\n});\n\nconst DecodedRemoteFailureSchema = Schema.Struct({\n\t_tag: Schema.String,\n});\n\nconst DecodeJsonString = Schema.decodeUnknownOption(Schema.UnknownFromJsonString);\nconst is_decoded_remote_failure_value = Schema.is(DecodedRemoteFailureSchema);\nconst is_remote_error_message_envelope = Schema.is(RemoteErrorMessageEnvelopeSchema);\n\n/**\n * Decodes a raw wire value into a remote failure when it uses the runtime\n * failure envelope.\n *\n * @example\n * ```ts\n * const failure = decode_remote_error(body);\n * ```\n *\n * @since 2.0.0\n * @param raw - Raw value received from the network or SvelteKit error body.\n * @param decode - Optional devalue decoder for custom error payloads.\n * @returns The decoded failure/value, or a transport error when decoding fails.\n */\nexport function decode_remote_error<ErrorType = never>(\n\traw: unknown,\n\tdecode?: (encoded: string) => unknown,\n): RemoteFailure<ErrorType> | unknown {\n\tconst embedded = decode_embedded_remote_failure(raw);\n\n\tif (embedded._tag === \"EmbeddedRemoteFailureDecoded\") {\n\t\treturn decode_remote_error<ErrorType>(embedded.value, decode);\n\t}\n\n\tif (is_serialized_remote_failure_envelope(raw)) {\n\t\tconst decoded = decode_serialized_remote_failure<ErrorType>(raw.encoded, decode);\n\n\t\tif (decoded._tag === \"SerializedRemoteFailureInvalid\") {\n\t\t\treturn create_remote_transport_error(new RemoteErrorDecodeError(raw), raw);\n\t\t}\n\n\t\treturn decoded.value;\n\t}\n\n\treturn raw;\n}\n\nfunction decode_embedded_remote_failure(raw: unknown): EmbeddedRemoteFailureDecode {\n\tif (typeof raw === \"string\") {\n\t\treturn decode_embedded_json_remote_failure(raw);\n\t}\n\n\tif (!is_remote_error_message_envelope(raw)) {\n\t\treturn { _tag: \"EmbeddedRemoteFailureIgnored\" };\n\t}\n\n\treturn decode_embedded_json_remote_failure(raw.message);\n}\n\nfunction decode_embedded_json_remote_failure(value: string): EmbeddedRemoteFailureDecode {\n\tconst decoded = decode_json_string(value);\n\n\tif (decoded._tag === \"JsonStringIgnored\") {\n\t\treturn { _tag: \"EmbeddedRemoteFailureIgnored\" };\n\t}\n\n\treturn {\n\t\t_tag: \"EmbeddedRemoteFailureDecoded\",\n\t\tvalue: decoded.value,\n\t};\n}\n\nfunction decode_json_string(value: string): JsonStringDecode {\n\tconst decoded = DecodeJsonString(value);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn { _tag: \"JsonStringIgnored\" };\n\t}\n\n\treturn {\n\t\t_tag: \"JsonStringDecoded\",\n\t\tvalue: decoded.value,\n\t};\n}\n\nfunction decode_serialized_remote_failure<ErrorType>(\n\tencoded: string,\n\tdecode: ((encoded: string) => unknown) | undefined,\n): SerializedRemoteFailureDecode<ErrorType> {\n\ttry {\n\t\tconst decoded = decode ? decode(encoded) : parse(encoded);\n\n\t\treturn {\n\t\t\t_tag: \"SerializedRemoteFailureDecoded\",\n\t\t\tvalue: decoded as RemoteFailure<ErrorType>,\n\t\t};\n\t} catch {\n\t\treturn { _tag: \"SerializedRemoteFailureInvalid\" };\n\t}\n}\n\n/**\n * Checks whether a decoded value is a tagged remote failure.\n *\n * @example\n * ```ts\n * if (is_decoded_remote_failure(value)) throw value;\n * ```\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value carries a `_tag` discriminator.\n */\nexport function is_decoded_remote_failure(value: unknown): value is RemoteFailure<never> {\n\treturn is_decoded_remote_failure_value(value);\n}\n\n/**\n * Normalizes native thrown values into the runtime's remote failure model.\n *\n * @example\n * ```ts\n * const failure = normalize_native_error(error);\n * ```\n *\n * @since 2.0.0\n * @param error - Unknown value thrown by a native remote helper.\n * @returns A typed remote failure.\n */\nexport function normalize_native_error<ErrorType = never>(\n\terror: unknown,\n): RemoteFailure<ErrorType> {\n\tconst body = get_error_body(error);\n\tconst decoded = decode_remote_error<ErrorType>(body);\n\tconst status = get_error_status(error);\n\n\tif (is_decoded_remote_failure(decoded)) {\n\t\treturn decoded;\n\t}\n\n\tif (status !== undefined) {\n\t\treturn create_remote_http_error(status, body, error);\n\t}\n\n\treturn create_remote_transport_error(error);\n}\n\nfunction get_error_status(error: unknown): number | undefined {\n\tif (typeof error !== \"object\" || error === null) {\n\t\treturn undefined;\n\t}\n\n\tconst status = (error as { status?: unknown }).status;\n\n\treturn typeof status === \"number\" ? status : undefined;\n}\n\nfunction get_error_body(error: unknown): unknown {\n\tif (typeof error !== \"object\" || error === null) {\n\t\treturn undefined;\n\t}\n\n\tif (\"body\" in error) {\n\t\treturn (error as { body?: unknown }).body;\n\t}\n\n\tif (\"data\" in error) {\n\t\treturn (error as { data?: unknown }).data;\n\t}\n\n\treturn undefined;\n}\n","import { create_remote_http_error } from \"$/remote/shared.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\n\nimport { decode_remote_error, is_decoded_remote_failure } from \"./failures.ts\";\n\n/**\n * Decodes a failed fetch response into the runtime failure model.\n *\n * @example\n * ```ts\n * const failure = await decode_response_failure(response);\n * ```\n *\n * @since 2.0.0\n * @param response - Failed fetch response returned by the remote endpoint.\n * @returns Remote failure represented by the response.\n */\nexport async function decode_response_failure<ErrorType = never>(\n\tresponse: Response,\n): Promise<RemoteFailure<ErrorType>> {\n\tconst body = await response.json().catch(() => undefined);\n\tconst decoded = decode_remote_error<ErrorType>(body);\n\n\tif (is_decoded_remote_failure(decoded)) {\n\t\treturn decoded;\n\t}\n\n\treturn create_remote_http_error(response.status, body);\n}\n\n/**\n * Decodes either a raw value or `Response` returned by a native remote helper.\n *\n * @example\n * ```ts\n * const output = await decode_response_or_value(result, decode_payload);\n * ```\n *\n * @since 2.0.0\n * @param value - Native result value or fetch response.\n * @param decode_payload - Function used to decode successful payloads.\n * @returns Decoded successful output.\n */\nexport async function decode_response_or_value<Output, ErrorType = never>(\n\tvalue: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Promise<Output> {\n\tif (value instanceof Response) {\n\t\tif (!value.ok) {\n\t\t\tthrow await decode_response_failure<ErrorType>(value);\n\t\t}\n\n\t\tconst data = await decode_success_response_body(value);\n\n\t\treturn decode_payload(data) as Output;\n\t}\n\n\treturn decode_payload(value) as Output;\n}\n\nasync function decode_success_response_body(response: Response): Promise<unknown> {\n\tif (response.status === 204 || response.status === 205) {\n\t\treturn undefined;\n\t}\n\n\tconst text = await response.text();\n\n\tif (text.length === 0) {\n\t\treturn undefined;\n\t}\n\n\treturn JSON.parse(text);\n}\n","import type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { isRedirect } from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nimport { is_decoded_remote_failure, normalize_native_error } from \"./failures.ts\";\n\n/**\n * Wraps a promise-producing remote operation in an Effect with failure mapping.\n *\n * @example\n * ```ts\n * const program = make_effect_from_promise(() => native_remote(input));\n * ```\n *\n * @since 2.0.0\n * @param run - Promise-producing operation that invokes a native remote helper.\n * @returns Effect that maps thrown values into remote failures.\n */\nexport function MakeEffectFromPromise<Output, ErrorType = never>(\n\trun: () => Promise<Output>,\n): Effect.Effect<Output, RemoteFailure<ErrorType>> {\n\treturn Effect.tryPromise({\n\t\ttry: run,\n\t\tcatch: (error: unknown) => {\n\t\t\tif (isRedirect(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (is_decoded_remote_failure(error)) {\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\treturn normalize_native_error<ErrorType>(error);\n\t\t},\n\t}) as Effect.Effect<Output, RemoteFailure<ErrorType>>;\n}\n\n/**\n * Compatibility alias for {@link MakeEffectFromPromise}.\n *\n * @example\n * ```ts\n * const program = make_effect_from_promise(() => native_remote(input));\n * ```\n *\n * @since 2.0.0\n * @param run - Promise-producing operation that invokes a native remote helper.\n * @returns Effect that maps thrown values into remote failures.\n * @internal\n */\nexport const make_effect_from_promise = MakeEffectFromPromise;\n","import { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { decode_response_or_value } from \"./responses.ts\";\nimport { InvalidCommandFactoryError } from \"$/errors.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport type { NativeMethod, Pending } from \"./types.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport type { Effect } from \"effect\";\n\ntype EffectRemoteCommandAdapter<Input, Output, ErrorType = never> = ((\n\tinput: undefined extends Input ? Input | void : Input,\n) => Effect.Effect<Output, RemoteFailure<ErrorType>>) & {\n\treadonly pending: number;\n};\n\n/**\n * Creates a remote command adapter. The adapter preserves the native\n * pending getter and turns each invocation into an Effect.\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native command function or a legacy\n * response factory used by tests.\n * @param decode_payload - Function to decode the response payload.\n * @param _base - Deprecated transport base retained for compatibility.\n * @param pending - Optional pending counter for legacy response factories.\n * @returns A function returning an Effect of the response.\n * @internal\n */\nexport function create_remote_command_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\t_base = \"\",\n\tpending?: Pending,\n): EffectRemoteCommandAdapter<Input, Output, ErrorType> {\n\tconst invoke = has_method(native_factory, \"invoke\") ? native_factory.invoke : undefined;\n\n\tif (typeof native_factory !== \"function\" && !invoke) {\n\t\tthrow new InvalidCommandFactoryError();\n\t}\n\n\tconst count = pending ?? { value: 0 };\n\n\tconst adapter = (input: undefined extends Input ? Input | void : Input) =>\n\t\tMakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\tcount.value += 1;\n\n\t\t\ttry {\n\t\t\t\tconst result = invoke\n\t\t\t\t\t? await invoke(input)\n\t\t\t\t\t: await (native_factory as NativeMethod)(input);\n\n\t\t\t\treturn await decode_response_or_value<Output, ErrorType>(result, decode_payload);\n\t\t\t} finally {\n\t\t\t\tcount.value -= 1;\n\t\t\t}\n\t\t});\n\n\tcopy_property_descriptors(native_factory, adapter);\n\n\tif (!Object.prototype.hasOwnProperty.call(adapter, \"pending\")) {\n\t\tObject.defineProperty(adapter, \"pending\", {\n\t\t\tget: () => count.value,\n\t\t});\n\t}\n\n\treturn adapter as EffectRemoteCommandAdapter<Input, Output, ErrorType>;\n}\n","/**\n * Encodes remote form input into SvelteKit-compatible form data.\n *\n * @since 2.0.0\n * @param input - Input value supplied to the remote form.\n * @returns FormData payload for the remote endpoint.\n */\nexport function to_form_data(input: unknown): FormData {\n\tconst form_data = new FormData();\n\n\tappend_form_value(form_data, \"\", input);\n\n\treturn form_data;\n}\n\nfunction append_form_value(form_data: FormData, path: string, value: unknown): void {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tappend_form_value(form_data, `${path}[]`, item);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (value instanceof Blob) {\n\t\tform_data.append(path, value);\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"object\" && value !== null) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\tconst child_path = path.length === 0 ? key : `${path}.${key}`;\n\n\t\t\tappend_form_value(form_data, child_path, child);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"number\") {\n\t\tform_data.append(`n:${path}`, String(value));\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"boolean\") {\n\t\tif (value) {\n\t\t\tform_data.append(`b:${path}`, \"on\");\n\t\t}\n\n\t\treturn;\n\t}\n\n\tform_data.append(path, value === null ? \"\" : String(value));\n}\n","import {\n\tcreate_remote_http_error,\n\tcreate_remote_transport_error,\n\tcreate_remote_validation_error,\n} from \"$/remote/shared.ts\";\nimport {\n\tInvalidRemoteFormResponseError,\n\tRemoteFormEndpointMissingError,\n\tUnsupportedRemoteFormResponseError,\n} from \"$/errors.ts\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\nimport { Option, Schema } from \"effect\";\nimport { parse } from \"devalue\";\n\nimport { decode_remote_error, is_decoded_remote_failure } from \"./failures.ts\";\nimport { decode_response_failure } from \"./responses.ts\";\nimport { to_form_data } from \"./form-data.ts\";\nimport type { NativeFormRecord } from \"./types.ts\";\n\ntype RemoteFormResponseEnvelope =\n\t| {\n\t\t\treadonly _tag: \"RemoteFormErrorEnvelope\";\n\t\t\treadonly error?: unknown;\n\t\t\treadonly status?: number | undefined;\n\t }\n\t| {\n\t\t\treadonly _tag: \"RemoteFormResultEnvelope\";\n\t\t\treadonly data?: string | undefined;\n\t\t\treadonly result?: string | undefined;\n\t };\n\ntype RemoteFormDecodedPayload<Output> = {\n\treadonly issues?: readonly FormIssue[];\n\treadonly result?: Output;\n};\n\nconst FormIssuePathSegmentSchema = Schema.Union([Schema.String, Schema.Number]);\n\nconst FormIssueSchema = Schema.Struct({\n\tmessage: Schema.String,\n\tpath: Schema.Array(FormIssuePathSegmentSchema),\n});\n\nconst RemoteFormErrorEnvelopeSchema = Schema.Struct({\n\ttype: Schema.Literal(\"error\"),\n\terror: Schema.optional(Schema.Unknown),\n\tstatus: Schema.optional(Schema.Number),\n});\n\nconst RemoteFormResultEnvelopeSchema = Schema.Struct({\n\ttype: Schema.Literal(\"result\"),\n\tdata: Schema.optional(Schema.String),\n\tresult: Schema.optional(Schema.String),\n});\n\nconst RemoteFormResponseEnvelopeSchema = Schema.Union([\n\tRemoteFormErrorEnvelopeSchema,\n\tRemoteFormResultEnvelopeSchema,\n]);\n\nconst RemoteFormDecodedPayloadSchema = Schema.Struct({\n\tissues: Schema.optional(Schema.Array(FormIssueSchema)),\n\tresult: Schema.optional(Schema.Unknown),\n});\n\nconst DecodeRemoteFormResponseEnvelope = Schema.decodeUnknownOption(\n\tRemoteFormResponseEnvelopeSchema,\n);\nconst DecodeRemoteFormPayload = Schema.decodeUnknownOption(RemoteFormDecodedPayloadSchema);\n\n/**\n * Submits a native remote form through the SvelteKit remote endpoint.\n *\n * @since 2.0.0\n * @param form_obj - Native form object being adapted.\n * @param input - Form input value.\n * @param decode_payload - Function to decode successful payloads.\n * @param remote_base - Base URL for the remote endpoint.\n * @returns Decoded form output.\n */\nexport async function submit_remote_form<Output>(\n\tform_obj: NativeFormRecord,\n\tinput: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\tremote_base: string,\n): Promise<Output> {\n\tconst action_id = get_remote_action_id(form_obj);\n\n\tif (!action_id || remote_base.length === 0) {\n\t\tthrow create_remote_transport_error(new RemoteFormEndpointMissingError());\n\t}\n\n\tconst response = await fetch(to_remote_form_url(remote_base, action_id), {\n\t\tmethod: \"POST\",\n\t\tbody: to_form_data(input),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow await decode_response_failure(response);\n\t}\n\n\tconst envelope = await response.json();\n\n\treturn decode_form_response<Output>(envelope, decode_payload);\n}\n\n/**\n * Extracts SvelteKit's remote action id from a native form action URL.\n *\n * @since 2.0.0\n * @param form_obj - Native form object being adapted.\n * @returns Remote action id when present.\n */\nexport function get_remote_action_id(form_obj: NativeFormRecord): string | undefined {\n\tconst action = form_obj.action;\n\n\tif (typeof action !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\tconst fallback = \"http://localhost/\";\n\tconst href = typeof location === \"undefined\" ? fallback : location.href;\n\tconst url = new URL(action, href);\n\n\treturn url.searchParams.get(\"/remote\") ?? url.searchParams.get(\"remote\") ?? undefined;\n}\n\nfunction to_remote_form_url(remote_base: string, action_id: string): string {\n\tconst parts = action_id.split(\"/\");\n\tconst head = parts.slice(0, 2).join(\"/\");\n\tconst tail = parts.slice(2).join(\"/\");\n\tconst normalized_base = remote_base.replace(/\\/$/, \"\");\n\n\tif (tail.length === 0) {\n\t\treturn `${normalized_base}/${head}`;\n\t}\n\n\treturn `${normalized_base}/${head}/${encodeURIComponent(tail)}`;\n}\n\nfunction decode_form_response<Output>(\n\tenvelope: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Output {\n\tconst response = decode_remote_form_response_envelope(envelope);\n\n\tif (!response) {\n\t\tthrow create_remote_transport_error(new InvalidRemoteFormResponseError(envelope), envelope);\n\t}\n\n\tif (response._tag === \"RemoteFormErrorEnvelope\") {\n\t\tconst decoded = decode_remote_error(response.error);\n\n\t\tif (is_decoded_remote_failure(decoded)) {\n\t\t\tthrow decoded;\n\t\t}\n\n\t\tthrow create_remote_http_error(response.status ?? 500, response.error);\n\t}\n\n\tconst result_text = response.result ?? response.data;\n\n\tif (result_text === undefined) {\n\t\tthrow create_remote_transport_error(\n\t\t\tnew UnsupportedRemoteFormResponseError(envelope),\n\t\t\tenvelope,\n\t\t);\n\t}\n\n\tconst parsed = parse(result_text);\n\tconst decoded = decode_remote_form_payload<Output>(decode_payload(parsed));\n\n\tif (!decoded) {\n\t\tthrow create_remote_transport_error(\n\t\t\tnew UnsupportedRemoteFormResponseError(envelope),\n\t\t\tenvelope,\n\t\t);\n\t}\n\n\tif (decoded.issues && decoded.issues.length > 0) {\n\t\tthrow create_remote_validation_error(decoded.issues, decoded, 400);\n\t}\n\n\treturn decoded.result as Output;\n}\n\nfunction decode_remote_form_response_envelope(\n\tenvelope: unknown,\n): RemoteFormResponseEnvelope | undefined {\n\tconst decoded = DecodeRemoteFormResponseEnvelope(envelope);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn undefined;\n\t}\n\n\tif (decoded.value.type === \"error\") {\n\t\treturn {\n\t\t\t_tag: \"RemoteFormErrorEnvelope\",\n\t\t\terror: decoded.value.error,\n\t\t\tstatus: decoded.value.status,\n\t\t};\n\t}\n\n\treturn {\n\t\t_tag: \"RemoteFormResultEnvelope\",\n\t\tdata: decoded.value.data,\n\t\tresult: decoded.value.result,\n\t};\n}\n\nfunction decode_remote_form_payload<Output>(\n\tpayload: unknown,\n): RemoteFormDecodedPayload<Output> | undefined {\n\tconst decoded = DecodeRemoteFormPayload(payload);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn undefined;\n\t}\n\n\treturn decoded.value as RemoteFormDecodedPayload<Output>;\n}\n","import { get_dispatcher } from \"$/dispatcher.ts\";\nimport { Effect } from \"effect\";\n\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport { has_method } from \"./utils.ts\";\nimport type { EffectRemoteFormSubmit, NativeMethod } from \"./types.ts\";\n\n/**\n * Wraps a remote form enhance callback so Effect return values are run.\n *\n * @since 2.0.0\n * @param callback - Native enhance callback to wrap.\n * @returns Wrapped callback or undefined.\n */\nexport function wrap_enhance_callback<Output, ErrorType = never>(\n\tcallback: NativeMethod | undefined,\n): NativeMethod | undefined {\n\tif (!callback) {\n\t\treturn undefined;\n\t}\n\n\treturn (event: unknown) => {\n\t\tconst wrapped_event = wrap_submit_callback<Output, ErrorType>(event);\n\t\tconst result = callback(wrapped_event);\n\n\t\tif (Effect.isEffect(result)) {\n\t\t\treturn get_dispatcher().run(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction wrap_submit_callback<Output, ErrorType>(event: unknown): unknown {\n\tif (typeof event !== \"object\" || event === null || !has_method(event, \"submit\")) {\n\t\treturn event;\n\t}\n\n\tconst original_submit = event.submit;\n\tconst { submit: _submit, ...descriptors } = Object.getOwnPropertyDescriptors(event);\n\n\tvoid _submit;\n\n\treturn Object.defineProperties(\n\t\t{},\n\t\t{\n\t\t\t...descriptors,\n\t\t\tsubmit: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: () => make_submit_effect<Output, ErrorType>(original_submit, event),\n\t\t\t},\n\t\t},\n\t);\n}\n\nfunction make_submit_effect<Output, ErrorType>(\n\toriginal_submit: NativeMethod,\n\tevent: unknown,\n): EffectRemoteFormSubmit<Output, ErrorType> {\n\tlet updates_args: unknown[] | undefined;\n\n\tconst SubmitEffect = MakeEffectFromPromise<Output | undefined, ErrorType>(\n\t\tasync (): Promise<Output | undefined> => {\n\t\t\tconst result = original_submit();\n\t\t\tconst value =\n\t\t\t\tupdates_args && has_method(result, \"updates\")\n\t\t\t\t\t? await Promise.resolve(result.updates(...updates_args))\n\t\t\t\t\t: await Promise.resolve(result);\n\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\treturn read_submit_result<Output>(event);\n\t\t\t}\n\n\t\t\treturn value as Output;\n\t\t},\n\t) as EffectRemoteFormSubmit<Output, ErrorType>;\n\n\tObject.defineProperty(SubmitEffect, \"updates\", {\n\t\tconfigurable: true,\n\t\tenumerable: false,\n\t\tvalue: (...args: unknown[]) => {\n\t\t\tupdates_args ??= args;\n\n\t\t\treturn SubmitEffect;\n\t\t},\n\t});\n\n\treturn SubmitEffect;\n}\n\nfunction read_submit_result<Output>(event: unknown): Output | undefined {\n\tif (typeof event !== \"object\" || event === null || !(\"result\" in event)) {\n\t\treturn undefined;\n\t}\n\n\treturn Reflect.get(event, \"result\") as Output | undefined;\n}\n","import type { RemoteFormInput } from \"@sveltejs/kit\";\n\nimport { decode_response_or_value } from \"./responses.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport { get_remote_action_id, submit_remote_form } from \"./form-transport.ts\";\nimport { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { wrap_enhance_callback } from \"./form-enhance.ts\";\nimport type { EffectRemoteForm, NativeFormRecord, NativeMethod } from \"./types.ts\";\n\ntype RemoteInput<Input> = undefined extends Input ? Input | void : Input;\n\n/**\n * Creates a remote form adapter. The callable preserves SvelteKit's native\n * form descriptors while wrapping `validate`, `enhance`, and programmatic\n * submission in Effect-returning APIs.\n *\n * @example\n * ```ts\n * const createPost = create_remote_form_adapter(nativeForm, (value) => value);\n * yield* createPost.validate({ includeUntouched: true });\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native form object.\n * @param decode_payload - Function to decode the response payload.\n * @param remote_base - Base URL for SvelteKit's remote endpoint.\n * @returns A callable form function whose properties mirror the native form.\n * @internal\n */\nexport function create_remote_form_adapter<\n\tInput extends RemoteFormInput | void,\n\tOutput,\n\tErrorType = never,\n>(\n\tnative_factory: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\tremote_base = \"\",\n): EffectRemoteForm<Input, Output, ErrorType> {\n\tconst form_obj = native_factory as NativeFormRecord;\n\n\tconst submit_effect = (input?: RemoteInput<Input>) =>\n\t\tMakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\tconst can_use_remote_endpoint =\n\t\t\t\tremote_base.length > 0 && get_remote_action_id(form_obj) !== undefined;\n\n\t\t\tif (has_method(form_obj, \"submit\") && !can_use_remote_endpoint) {\n\t\t\t\tconst result = await form_obj.submit(input);\n\n\t\t\t\treturn await decode_response_or_value<Output>(result, decode_payload);\n\t\t\t}\n\n\t\t\treturn await submit_remote_form<Output>(form_obj, input, decode_payload, remote_base);\n\t\t});\n\n\tconst callable = ((input?: RemoteInput<Input>) => submit_effect(input)) as EffectRemoteForm<\n\t\tInput,\n\t\tOutput,\n\t\tErrorType\n\t>;\n\n\tcopy_property_descriptors(\n\t\tform_obj,\n\t\tcallable,\n\t\tnew Set([\"submit\", \"validate\", \"enhance\", \"for\", \"preflight\"]),\n\t);\n\n\tObject.defineProperty(callable, \"submit\", {\n\t\tconfigurable: true,\n\t\tenumerable: false,\n\t\tvalue: submit_effect,\n\t});\n\n\tif (has_method(form_obj, \"validate\")) {\n\t\tObject.defineProperty(callable, \"validate\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (options?: Record<string, unknown>) =>\n\t\t\t\tMakeEffectFromPromise<void, ErrorType>(async () => {\n\t\t\t\t\tawait form_obj.validate(options);\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"enhance\")) {\n\t\tObject.defineProperty(callable, \"enhance\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (callback?: NativeMethod) =>\n\t\t\t\tform_obj.enhance(wrap_enhance_callback<Output, ErrorType>(callback)),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"for\")) {\n\t\tObject.defineProperty(callable, \"for\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (key: string | number | boolean) =>\n\t\t\t\tcreate_remote_form_adapter<Input, Output, ErrorType>(\n\t\t\t\t\tform_obj.for(key),\n\t\t\t\t\tdecode_payload,\n\t\t\t\t\tremote_base,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"preflight\")) {\n\t\tObject.defineProperty(callable, \"preflight\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (schema: unknown) => {\n\t\t\t\tform_obj.preflight(schema);\n\n\t\t\t\treturn callable;\n\t\t\t},\n\t\t});\n\t}\n\n\treturn callable;\n}\n","import { decode_response_or_value } from \"./responses.ts\";\nimport { has_method } from \"./utils.ts\";\n\n/**\n * Resolves native query results, including SvelteKit run handles.\n *\n * @example\n * ```ts\n * const output = await resolve_query_result(result, decode_payload);\n * ```\n *\n * @since 2.0.0\n * @param value - Native query result or query run handle.\n * @param decode_payload - Function used to decode successful payloads.\n * @returns Decoded query output.\n */\nexport async function resolve_query_result<Output>(\n\tvalue: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Promise<Output> {\n\tif (has_method(value, \"then\")) {\n\t\tconst result = await Promise.resolve(value);\n\n\t\treturn decode_response_or_value(result, decode_payload);\n\t}\n\n\tif (has_method(value, \"run\")) {\n\t\tconst result = await value.run();\n\n\t\treturn decode_response_or_value(result, decode_payload);\n\t}\n\n\tconst result = await Promise.resolve(value);\n\n\treturn decode_response_or_value(result, decode_payload);\n}\n","import { InvalidLiveQueryFactoryError, InvalidQueryFactoryError } from \"$/errors.ts\";\nimport { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { normalize_native_error } from \"./failures.ts\";\nimport { resolve_query_result } from \"./query-result.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport type { EffectRemoteQueryUpdateBrand, NativeMethod } from \"./types.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\n\ntype RemoteInput<Input> = undefined extends Input ? Input | void : Input;\n\ntype DecodePayload<Output> = (value: unknown) => Output;\n\ntype NativeQueryFactory<Input> =\n\t| ((input: RemoteInput<Input>) => unknown)\n\t| {\n\t\t\treadonly load: (input: RemoteInput<Input>) => unknown;\n\t };\n\ntype RemoteResourceEffect<Output, ErrorType = never> = Effect.Effect<\n\tOutput,\n\tRemoteFailure<ErrorType>\n> & {\n\treadonly current: Output | undefined;\n\treadonly error: unknown;\n\treadonly loading: boolean;\n\treadonly ready: boolean;\n};\n\ntype RemoteResourceLike<Output, ErrorType = never> =\n\t| RemoteResourceEffect<Output, ErrorType>\n\t| RemoteLiveQueryResource<Output>;\n\ntype RemoteQueryEffect<Output, ErrorType = never> = RemoteResourceEffect<Output, ErrorType> & {\n\treadonly refresh: () => Effect.Effect<void, unknown, never>;\n\treadonly set: (value: Output) => void;\n\treadonly withOverride: (update: (current: Output) => Output) => unknown;\n};\n\ntype RemoteLiveQueryEffect<Output, ErrorType = never> = Effect.Effect<\n\tRemoteLiveQueryResource<Output>,\n\tRemoteFailure<ErrorType>\n>;\n\ntype RemoteLiveQueryResource<Output> = {\n\treadonly connected: boolean;\n\treadonly current: Output | undefined;\n\treadonly done: boolean;\n\treadonly error: unknown;\n\treadonly loading: boolean;\n\treadonly ready: boolean;\n\treadonly reconnect: () => Effect.Effect<void, unknown, never>;\n} & AsyncIterable<Output>;\n\ntype NativeRemoteResource<Output> = {\n\treadonly connected?: boolean;\n\treadonly current?: Output;\n\treadonly done?: boolean;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n\treadonly reconnect?: () => Promise<void>;\n\treadonly refresh?: () => Promise<void>;\n\treadonly set?: (value: Output) => void;\n\treadonly withOverride?: (update: (current: Output) => Output) => unknown;\n\treadonly [Symbol.asyncIterator]?: () => AsyncIterator<Output>;\n};\n\n/**\n * Creates a remote query adapter. The returned function takes input and\n * returns an `Effect` that executes SvelteKit's native query function.\n *\n * @example\n * ```ts\n * const getUser = create_remote_query_adapter(nativeQuery, (value) => value);\n * const user = yield* getUser({ id: 1 });\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native query function or a legacy\n * response factory used by tests.\n * @param decode_payload - Function to decode the response payload.\n * @param _base - Deprecated transport base retained for compatibility.\n * @returns A function returning an Effect of the response.\n * @internal\n */\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: NativeQueryFactory<Input>,\n\tdecode_payload: DecodePayload<Output>,\n\t_base?: string,\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: NativeQueryFactory<Input>,\n\tdecode_payload: (value: unknown) => unknown,\n\t_base?: string,\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\tdecode_payload: DecodePayload<Output>,\n\t_base = \"\",\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>) {\n\tconst load = has_method(native_factory, \"load\") ? native_factory.load : undefined;\n\tconst query =\n\t\ttypeof native_factory === \"function\" ? (native_factory as NativeMethod) : undefined;\n\n\tif (!query && !load) {\n\t\tthrow new InvalidQueryFactoryError();\n\t}\n\n\tconst wrapped = ((input: RemoteInput<Input>) => {\n\t\tif (!query) {\n\t\t\treturn MakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\t\tconst result = await load?.(input);\n\n\t\t\t\treturn await resolve_query_result<Output>(result, decode_payload);\n\t\t\t}) as RemoteQueryEffect<Output, ErrorType>;\n\t\t}\n\n\t\tconst resource = query(input);\n\t\tconst QueryEffect = MakeEffectFromPromise<Output, ErrorType>(\n\t\t\tasync () => await resolve_query_result<Output>(resource, decode_payload),\n\t\t) as RemoteQueryEffect<Output, ErrorType>;\n\n\t\tattach_query_resource(resource, QueryEffect);\n\n\t\treturn QueryEffect;\n\t}) as EffectRemoteQueryUpdateBrand &\n\t\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\n\n\tcopy_property_descriptors(native_factory, wrapped);\n\n\treturn wrapped;\n}\n\n/**\n * Creates a remote live query adapter. The returned function takes input and\n * returns an `Effect` that resolves to a live query resource with stream state\n * and reconnect controls.\n *\n * @example\n * ```ts\n * const getTime = create_remote_live_query_adapter(nativeLive, (value) => value);\n * const time = yield* getTime();\n * const current = time.current;\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native live query function.\n * @param _decode_payload - Deprecated payload decoder retained for parity with\n * other remote adapters.\n * @param _base - Deprecated transport base retained for compatibility.\n * @returns A function returning an Effect-backed live query resource.\n * @internal\n */\nexport function create_remote_live_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\t_decode_payload: (value: unknown) => unknown,\n\t_base = \"\",\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteLiveQueryEffect<Output, ErrorType>) {\n\tconst query =\n\t\ttypeof native_factory === \"function\" ? (native_factory as NativeMethod) : undefined;\n\n\tif (!query) {\n\t\tthrow new InvalidLiveQueryFactoryError();\n\t}\n\n\tconst wrapped = ((input: Input) =>\n\t\tEffect.try({\n\t\t\ttry: () => {\n\t\t\t\tconst resource = query(input);\n\n\t\t\t\treturn make_live_query_resource<Output>(resource);\n\t\t\t},\n\t\t\tcatch: normalize_native_error,\n\t\t}) as RemoteLiveQueryEffect<Output>) as EffectRemoteQueryUpdateBrand &\n\t\t((input: RemoteInput<Input>) => RemoteLiveQueryEffect<Output, ErrorType>);\n\n\tcopy_property_descriptors(native_factory, wrapped);\n\n\treturn wrapped;\n}\n\nfunction is_resource<Output>(resource: unknown): resource is NativeRemoteResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction attach_resource_getters<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: RemoteResourceLike<Output, ErrorType>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n}\n\nfunction attach_query_resource<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: RemoteQueryEffect<Output, ErrorType>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst refresh = methods?.refresh;\n\tconst set = methods?.set;\n\tconst with_override = methods?.withOverride;\n\n\tattach_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tif (typeof refresh === \"function\") {\n\t\tObject.defineProperty(effect, \"refresh\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => MakeEffectFromPromise(() => Promise.resolve(refresh.call(resource))),\n\t\t});\n\t}\n\n\tif (typeof set === \"function\") {\n\t\tObject.defineProperty(effect, \"set\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (value: Output) => set.call(resource, value),\n\t\t});\n\t}\n\n\tif (typeof with_override === \"function\") {\n\t\tObject.defineProperty(effect, \"withOverride\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (update: (current: Output) => Output) => with_override.call(resource, update),\n\t\t});\n\t}\n}\n\nfunction attach_live_query_resource<Output>(\n\tresource: unknown,\n\teffect: RemoteLiveQueryResource<Output>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst async_iterator = methods?.[Symbol.asyncIterator];\n\tconst reconnect = methods?.reconnect;\n\tconst keys = [\"connected\", \"done\"] as const;\n\n\tattach_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n\n\tif (typeof reconnect === \"function\") {\n\t\tObject.defineProperty(effect, \"reconnect\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => MakeEffectFromPromise(() => Promise.resolve(reconnect.call(resource))),\n\t\t});\n\t}\n\n\tif (typeof async_iterator === \"function\") {\n\t\tObject.defineProperty(effect, Symbol.asyncIterator, {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => async_iterator.call(resource),\n\t\t});\n\t}\n}\n\nfunction make_live_query_resource<Output>(resource: unknown): RemoteLiveQueryResource<Output> {\n\tconst live_resource = {} as RemoteLiveQueryResource<Output>;\n\n\tattach_live_query_resource(resource, live_resource);\n\n\treturn live_resource;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,WACf,OACA,KACmC;CACnC,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAuC,SAAS;AAE1D;;;ACiBA,MAAM,mCAAm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AAC;CAEvB,2BAA2B,UAAU,aAAa;CAElD,OAAO;AACR"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//#region src/internal/descriptors.ts
|
|
2
|
-
const default_excluded_descriptor_keys = /* @__PURE__ */ new Set([
|
|
3
|
-
"length",
|
|
4
|
-
"name",
|
|
5
|
-
"prototype"
|
|
6
|
-
]);
|
|
7
|
-
/**
|
|
8
|
-
* Copies own property descriptors from a native helper to a wrapper while
|
|
9
|
-
* skipping function metadata and any caller-specific keys.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* copy_property_descriptors(native_remote, wrapped_remote);
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @since 2.0.0
|
|
17
|
-
* @param source - Source object or function whose descriptors should be
|
|
18
|
-
* mirrored.
|
|
19
|
-
* @param target - Wrapper object or function that receives copied descriptors.
|
|
20
|
-
* @param exclude - Additional property keys that should not be copied.
|
|
21
|
-
* @returns Nothing.
|
|
22
|
-
*/
|
|
23
|
-
function copy_property_descriptors(source, target, exclude = default_excluded_descriptor_keys) {
|
|
24
|
-
if (typeof source !== "object" && typeof source !== "function") return;
|
|
25
|
-
if (source === null) return;
|
|
26
|
-
for (const key of Reflect.ownKeys(source)) {
|
|
27
|
-
if (default_excluded_descriptor_keys.has(key) || exclude.has(key)) continue;
|
|
28
|
-
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
29
|
-
if (!descriptor) continue;
|
|
30
|
-
Object.defineProperty(target, key, descriptor);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { copy_property_descriptors as t };
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=descriptors-cOe9uRJz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors-cOe9uRJz.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/internal/descriptors.ts"],"sourcesContent":["const default_excluded_descriptor_keys = new Set<PropertyKey>([\"length\", \"name\", \"prototype\"]);\n\n/**\n * Copies own property descriptors from a native helper to a wrapper while\n * skipping function metadata and any caller-specific keys.\n *\n * @example\n * ```ts\n * copy_property_descriptors(native_remote, wrapped_remote);\n * ```\n *\n * @since 2.0.0\n * @param source - Source object or function whose descriptors should be\n * mirrored.\n * @param target - Wrapper object or function that receives copied descriptors.\n * @param exclude - Additional property keys that should not be copied.\n * @returns Nothing.\n */\nexport function copy_property_descriptors(\n\tsource: unknown,\n\ttarget: object,\n\texclude: ReadonlySet<PropertyKey> = default_excluded_descriptor_keys,\n): void {\n\tif (typeof source !== \"object\" && typeof source !== \"function\") {\n\t\treturn;\n\t}\n\n\tif (source === null) {\n\t\treturn;\n\t}\n\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tif (default_excluded_descriptor_keys.has(key) || exclude.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(source, key);\n\n\t\tif (!descriptor) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(target, key, descriptor);\n\t}\n}\n"],"mappings":";AAAA,MAAM,mDAAmC,IAAI,IAAiB;CAAC;CAAU;CAAQ;AAAW,CAAC;;;;;;;;;;;;;;;;;AAkB7F,SAAgB,0BACf,QACA,QACA,UAAoC,kCAC7B;CACP,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,YACnD;CAGD,IAAI,WAAW,MACd;CAGD,KAAK,MAAM,OAAO,QAAQ,QAAQ,MAAM,GAAG;EAC1C,IAAI,iCAAiC,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,GAC/D;EAGD,MAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;EAE9D,IAAI,CAAC,YACJ;EAGD,OAAO,eAAe,QAAQ,KAAK,UAAU;CAC9C;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-Dcf0MVbq.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\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RuntimeError\";\n\t}\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\treturn `[${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\t/**\n\t * The source filename that triggered this error.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly filename: string;\n\n\tconstructor(message: string, filename: string) {\n\t\tsuper(message);\n\t\tthis.name = \"PreprocessError\";\n\t\tthis.filename = filename;\n\t}\n}\n\n/**\n * Retained for compatibility when callers need a structured representation of\n * possible Vite plugin ordering conflicts.\n *\n * @example\n * ```ts\n * throw new VitePreTransformPluginConflictError([\"wuchale\"]);\n * ```\n *\n * @since 2.4.0\n * @param plugin_names - Names of Vite plugins that declare pre-transform\n * priority and may parse raw component files before SER lowers them.\n * @returns A runtime-authored Error describing the possible plugin ordering\n * conflict.\n */\nexport class VitePreTransformPluginConflictError extends RuntimeError {\n\t/**\n\t * Names of conflicting Vite plugins.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly plugin_names: readonly string[];\n\n\tconstructor(plugin_names: readonly string[]) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\t`Svelte Effect Runtime noticed possible Vite plugin ordering conflicts.`,\n\t\t\t\t\"\",\n\t\t\t\t`These plugins run before normal Svelte component transforms:`,\n\t\t\t\t...plugin_names.map((plugin_name) => ` - ${plugin_name}`),\n\t\t\t\t\"\",\n\t\t\t\t`This is usually fine, but if you see Svelte parser errors around <script effect>`,\n\t\t\t\t`or yield* in components, one of those plugins may be reading component files before`,\n\t\t\t\t`SER has lowered its syntax.`,\n\t\t\t].join(\"\\n\"),\n\t\t);\n\t\tthis.name = \"VitePreTransformPluginConflictError\";\n\t\tthis.plugin_names = plugin_names;\n\t}\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\t/**\n\t * The full text of the problematic statement containing mixed async work.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly statement_text: string;\n\n\tconstructor(filename: string, statement_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"AWAIT_IN_EFFECT_WORK\",\n\t\t\t\t\t`${filename}: await cannot be mixed with yield* in Effect work.`,\n\t\t\t\t),\n\t\t\t\t`Top-level await is supported as ordinary Svelte async rendering, but statements lowered into Effect.gen must use yield* for async Effect work.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic statement:`,\n\t\t\t\tstatement_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AwaitInEffectWorkError\";\n\t\tthis.statement_text = statement_text;\n\t}\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\t/**\n\t * The name of the rune that contained async Effect work.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly rune_name: string;\n\n\t/**\n\t * The full text of the expression that triggered the error.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(rune_name: string, expression_text: string, filename: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_SYNC_RUNE\",\n\t\t\t\t\t`${filename}: yield* cannot be used inside ${rune_name}().`,\n\t\t\t\t),\n\t\t\t\t`${rune_name}() must stay synchronous. Do not put async Effect work inside this rune.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AsyncEffectInSyncRuneError\";\n\t\tthis.rune_name = rune_name;\n\t\tthis.expression_text = expression_text;\n\t}\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\t/**\n\t * The full text of the problematic event handler body.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_EVENT_CALLBACK\",\n\t\t\t\t\t`${filename}: yield* cannot be used inside a nested non-generator callback in a markup event handler.`,\n\t\t\t\t),\n\t\t\t\t`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\t\t\t\t\"\",\n\t\t\t\t`Run the remote Effect directly:`,\n\t\t\t\t` onclick={yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Recover from remote failures by composing the Effect value:`,\n\t\t\t\t` onclick={yield* UpvotePost(id).pipe(Effect.catch(() => Effect.void))}`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AsyncEffectInEventCallbackError\";\n\t\tthis.expression_text = expression_text;\n\t}\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\t/**\n\t * The full text of the problematic event handler callback.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_EVENT_HANDLER_CALLBACK\",\n\t\t\t\t\t`${filename}: yield* in markup event handlers must be written directly as the event attribute value.`,\n\t\t\t\t),\n\t\t\t\t`SER generates the event callback for effectful event handlers; do not put yield* inside a JavaScript callback.`,\n\t\t\t\t\"\",\n\t\t\t\t`Use this form:`,\n\t\t\t\t` onclick={yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Instead of this form:`,\n\t\t\t\t` onclick={() => yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"YieldStarInEventCallbackError\";\n\t\tthis.expression_text = expression_text;\n\t}\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\t/**\n\t * The unsupported markup expression text.\n\t *\n\t * @since 2.4.2\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"UNSUPPORTED_MARKUP_EFFECT_POSITION\",\n\t\t\t\t\t`${filename}: yield* cannot be used in this markup position.`,\n\t\t\t\t),\n\t\t\t\t`Move the Effect work into a supported expression tag, block expression, render expression, declaration tag, or event handler.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"UnsupportedMarkupEffectPositionError\";\n\t\tthis.expression_text = expression_text;\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"RequestEvent is only available while a SER remote handler is executing inside a request-scoped Effect context.\",\n\t\t);\n\t\tthis.name = \"RequestEventUnavailableError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute by itself.\",\n\t\t);\n\t\tthis.name = \"UncheckedQueryHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query.batch requires a concrete batch handler function; the batch helper cannot infer a handler from schema metadata alone.\",\n\t\t);\n\t\tthis.name = \"BatchQueryHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query.live('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce a live source.\",\n\t\t);\n\t\tthis.name = \"UncheckedLiveQueryHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Command('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute a command.\",\n\t\t);\n\t\tthis.name = \"UncheckedCommandHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Form('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot process form data.\",\n\t\t);\n\t\tthis.name = \"UncheckedFormHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Prerender('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce prerendered data.\",\n\t\t);\n\t\tthis.name = \"UncheckedPrerenderHandlerMissingError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"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\t\t);\n\t\tthis.name = \"InvalidLiveQueryReturnError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Dispatcher has been disposed; no new Effect fibers or promise bridges can be started after component teardown.\",\n\t\t);\n\t\tthis.name = \"DispatcherDisposedError\";\n\t}\n}\n\n/**\n * Thrown when an application attempts to configure a runtime after one has\n * already been initialized.\n *\n * @example\n * ```ts\n * throw new RuntimeAlreadyInitializedError(\"ClientRuntime\");\n * ```\n *\n * @since 3.4.0\n * @param runtime_name - Public runtime API that was initialized more than once.\n * @returns An Error describing the invalid runtime lifecycle transition.\n */\nexport class RuntimeAlreadyInitializedError extends RuntimeError {\n\tconstructor(runtime_name: string) {\n\t\tsuper(\n\t\t\tmake_error_message(\n\t\t\t\t\"RUNTIME_ALREADY_INITIALIZED\",\n\t\t\t\t`${runtime_name}.make(...) cannot be called because the runtime has already been initialized. Configure it once during application startup, before any Effect-backed component, remote handler, or generated runtime code runs.`,\n\t\t\t),\n\t\t);\n\t\tthis.name = \"RuntimeAlreadyInitializedError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid query factory: expected a function or an object exposing query/load methods from SvelteKit remote query generation.\",\n\t\t);\n\t\tthis.name = \"InvalidQueryFactoryError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid live query factory: expected a function or an object exposing a query method from SvelteKit remote live query generation.\",\n\t\t);\n\t\tthis.name = \"InvalidLiveQueryFactoryError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid command factory: expected a function or an object exposing an invoke method from SvelteKit remote command generation.\",\n\t\t);\n\t\tthis.name = \"InvalidCommandFactoryError\";\n\t}\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\tconstructor() {\n\t\tsuper(\n\t\t\t\"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\t\t);\n\t\tthis.name = \"RemoteFormEndpointMissingError\";\n\t}\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\t/**\n\t * Raw response envelope returned by the remote form endpoint.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly envelope: unknown;\n\n\tconstructor(envelope?: unknown) {\n\t\tsuper(\n\t\t\t\"Invalid remote form response: expected an object envelope with a string type field returned by SvelteKit remote form transport.\",\n\t\t);\n\t\tthis.name = \"InvalidRemoteFormResponseError\";\n\t\tthis.envelope = envelope;\n\t}\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\t/**\n\t * Raw response envelope returned by the remote form endpoint.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly envelope: unknown;\n\n\tconstructor(envelope?: unknown) {\n\t\tsuper(\n\t\t\t\"Unsupported remote form response: expected a result envelope with a devalue-encoded result or data string.\",\n\t\t);\n\t\tthis.name = \"UnsupportedRemoteFormResponseError\";\n\t\tthis.envelope = envelope;\n\t}\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\t/**\n\t * Raw serialized remote failure payload that failed decoding.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly raw: unknown;\n\n\tconstructor(raw?: unknown) {\n\t\tsuper(\n\t\t\t\"Failed to decode remote error payload: expected a devalue-encoded SER remote failure envelope compatible with the client decoder.\",\n\t\t);\n\t\tthis.name = \"RemoteErrorDecodeError\";\n\t\tthis.raw = raw;\n\t}\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\t/**\n\t * Name of the server-only root export that was invoked.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly export_name: string;\n\n\tconstructor(export_name: string) {\n\t\tsuper(\n\t\t\t`${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\t\t);\n\t\tthis.name = \"ServerOnlyImportError\";\n\t\tthis.export_name = export_name;\n\t}\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\t/**\n\t * Name of the `$app/server` export that was invoked.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly export_name: string;\n\n\tconstructor(export_name: string) {\n\t\tsuper(\n\t\t\t`SvelteKit virtual $app/server export ${export_name} is only available inside a SvelteKit server module.`,\n\t\t);\n\t\tthis.name = \"SvelteKitServerExportUnavailableError\";\n\t\tthis.export_name = export_name;\n\t}\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\t/**\n\t * SER helper name that triggered the context failure.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly helper_name: string;\n\n\tconstructor(helper_name: string) {\n\t\tsuper(\n\t\t\tmake_error_message(\n\t\t\t\t\"REMOTE_HELPER_CONTEXT\",\n\t\t\t\t`${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\t\t\t),\n\t\t);\n\t\tthis.name = \"RemoteHelperContextError\";\n\t\tthis.helper_name = helper_name;\n\t}\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\t/**\n\t * Non-Error value that was normalized.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly value: unknown;\n\n\tconstructor(value: unknown) {\n\t\tsuper(make_error_message(\"REMOTE_HELPER_ERROR\", String(value)));\n\t\tthis.name = \"RemoteHelperError\";\n\t\tthis.value = value;\n\t}\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\t/**\n\t * Non-Error value that was normalized.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly value: unknown;\n\n\tconstructor(value: unknown) {\n\t\tsuper(String(value));\n\t\tthis.name = \"UnknownRuntimeError\";\n\t\tthis.value = value;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,eAAb,cAAkC,MAAM;CACvC,YAAY,SAAiB;EAC5B,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;AAeA,SAAgB,mBAAmB,MAAc,SAAyB;CACzE,OAAO,IAAI,KAAK,KAAK;AACtB;;;;;;;;;;;;;;;;AAiBA,IAAa,kBAAb,cAAqC,aAAa;;;;;;CAMjD;CAEA,YAAY,SAAiB,UAAkB;EAC9C,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,WAAW;CACjB;AACD;;;;;;;;;;;;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vE;CAEA,YAAY,aAAqB;EAChC,MACC,wCAAwC,YAAY,qDACrD;EACA,KAAK,OAAO;EACZ,KAAK,cAAc;CACpB;AACD;;;;;;;;;;;;;;AAeA,IAAa,2BAAb,cAA8C,aAAa;;;;;;CAM1D;CAEA,YAAY,aAAqB;EAChC,MACC,mBACC,yBACA,GAAG,YAAY,iKAChB,CACD;EACA,KAAK,OAAO;EACZ,KAAK,cAAc;CACpB;AACD;;;;;;;;;;;;;AAcA,IAAa,oBAAb,cAAuC,aAAa;;;;;;CAMnD;CAEA,YAAY,OAAgB;EAC3B,MAAM,mBAAmB,uBAAuB,OAAO,KAAK,CAAC,CAAC;EAC9D,KAAK,OAAO;EACZ,KAAK,QAAQ;CACd;AACD;;;;;;;;;;;;;AAcA,IAAa,sBAAb,cAAyC,aAAa;;;;;;CAMrD;CAEA,YAAY,OAAgB;EAC3B,MAAM,OAAO,KAAK,CAAC;EACnB,KAAK,OAAO;EACZ,KAAK,QAAQ;CACd;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-client-Bj1pZXgq.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/vite/remote-client.ts"],"sourcesContent":["import type {\n\tExpression,\n\tImportDeclaration,\n\tSourceFile,\n\tStatement,\n\tVariableStatement,\n} from \"typescript\";\n\nimport MagicString from \"magic-string\";\nimport ts from \"typescript\";\n\ninterface RemoteClientRewriteOptions {\n\tdebug?: boolean;\n}\n\ntype RemoteClientExportType =\n\t| \"query_batch\"\n\t| \"query_live\"\n\t| \"query\"\n\t| \"command\"\n\t| \"form\"\n\t| \"prerender\";\n\ninterface RemoteNamespaceImport {\n\tname: string;\n\tstatement: ImportDeclaration;\n}\n\ninterface RemoteClientExport {\n\tname: string;\n\ttype: RemoteClientExportType;\n\tstatement: VariableStatement;\n\tnative_call: string;\n}\n\nconst remote_client_export_types = new Set<RemoteClientExportType>([\n\t\"query_batch\",\n\t\"query_live\",\n\t\"query\",\n\t\"command\",\n\t\"form\",\n\t\"prerender\",\n]);\n\n/**\n * Rewrites SvelteKit's generated client remote module into Effect-aware\n * wrappers while preserving the native remote factory calls.\n *\n * @example\n * ```ts\n * const rewritten = rewrite_remote_client_exports(\n * `export const get_post = __remote.query(\"hash/get_post\")`,\n * );\n * ```\n *\n * @since 2.0.0\n * @param code - Generated SvelteKit remote client module source to inspect and\n * rewrite.\n * @param options - Optional rewrite options forwarded from the SER Vite plugin.\n * @returns The rewritten module source, or the original source when no remote\n * exports are found.\n * @internal\n */\nexport function rewrite_remote_client_exports(\n\tcode: string,\n\toptions?: RemoteClientRewriteOptions,\n): string {\n\tconst source_file = ts.createSourceFile(\n\t\t\"sveltekit-remote-client.ts\",\n\t\tcode,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst namespace_import = find_remote_namespace_import(source_file);\n\n\tif (!namespace_import) {\n\t\treturn code;\n\t}\n\n\tconst remote_exports = collect_remote_client_exports(source_file, code, namespace_import.name);\n\n\tif (remote_exports.length === 0) {\n\t\treturn code;\n\t}\n\n\tconst magic = new MagicString(code);\n\tconst imports = [\n\t\t`import { app_dir, base } from \"$app/paths/internal/client\";`,\n\t\t`import { create_remote_query_adapter, create_remote_live_query_adapter, create_remote_command_adapter, create_remote_form_adapter } from \"svelte-effect-runtime/internal/remote-client\";`,\n\t].join(\"\\n\");\n\tconst helpers = [\n\t\t`const __SER___remote_base = \\`\\${base}/\\${app_dir}/remote\\`;`,\n\t\t`function __SER___decode_payload(value) { return value; }`,\n\t].join(\"\\n\");\n\tconst debug_line = options?.debug ? `console.log(\"[ser] remote client wrappers loaded\");` : \"\";\n\tconst injected = [imports, helpers, debug_line].filter(Boolean).join(\"\\n\");\n\n\tmagic.appendRight(namespace_import.statement.end, `\\n${injected}`);\n\n\tfor (const remote_export of remote_exports) {\n\t\tmagic.overwrite(\n\t\t\tremote_export.statement.getStart(source_file),\n\t\t\tremote_export.statement.end,\n\t\t\tmake_remote_export(remote_export.name, remote_export.type, remote_export.native_call),\n\t\t);\n\t}\n\n\treturn magic.toString();\n}\n\nfunction make_remote_export(\n\tname: string,\n\tremote_type: RemoteClientExportType,\n\tnative_call: string,\n): string {\n\tif (remote_type === \"command\") {\n\t\treturn `export const ${name} = create_remote_command_adapter(${native_call}, __SER___decode_payload);`;\n\t}\n\n\tif (remote_type === \"form\") {\n\t\treturn `export const ${name} = create_remote_form_adapter(${native_call}, __SER___decode_payload, __SER___remote_base);`;\n\t}\n\n\tif (remote_type === \"query_live\") {\n\t\treturn `export const ${name} = create_remote_live_query_adapter(${native_call}, __SER___decode_payload);`;\n\t}\n\n\treturn `export const ${name} = create_remote_query_adapter(${native_call}, __SER___decode_payload);`;\n}\n\nfunction find_remote_namespace_import(source_file: SourceFile): RemoteNamespaceImport | undefined {\n\tfor (const statement of source_file.statements) {\n\t\tif (!ts.isImportDeclaration(statement)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst namespace_import = get_remote_namespace_import(statement);\n\n\t\tif (namespace_import) {\n\t\t\treturn namespace_import;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction get_remote_namespace_import(\n\tstatement: ImportDeclaration,\n): RemoteNamespaceImport | undefined {\n\tif (\n\t\t!ts.isStringLiteral(statement.moduleSpecifier) ||\n\t\tstatement.moduleSpecifier.text !== \"__sveltekit/remote\"\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst import_clause = statement.importClause;\n\tconst bindings = import_clause?.namedBindings;\n\n\tif (import_clause?.isTypeOnly || !bindings || !ts.isNamespaceImport(bindings)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tname: bindings.name.text,\n\t\tstatement,\n\t};\n}\n\nfunction collect_remote_client_exports(\n\tsource_file: SourceFile,\n\tcode: string,\n\tnamespace: string,\n): RemoteClientExport[] {\n\treturn source_file.statements.flatMap((statement) =>\n\t\tcollect_remote_client_export(source_file, code, namespace, statement),\n\t);\n}\n\nfunction collect_remote_client_export(\n\tsource_file: SourceFile,\n\tcode: string,\n\tnamespace: string,\n\tstatement: Statement,\n): RemoteClientExport[] {\n\tif (\n\t\t!ts.isVariableStatement(statement) ||\n\t\t!is_export_statement(statement) ||\n\t\t!is_const_declaration_list(statement.declarationList) ||\n\t\tstatement.declarationList.declarations.length !== 1\n\t) {\n\t\treturn [];\n\t}\n\n\tconst declaration = statement.declarationList.declarations[0];\n\tconst initializer = declaration.initializer;\n\n\tif (!ts.isIdentifier(declaration.name) || !initializer) {\n\t\treturn [];\n\t}\n\n\tconst remote_type = get_remote_client_export_type(initializer, namespace);\n\n\tif (!remote_type) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tname: declaration.name.text,\n\t\t\ttype: remote_type,\n\t\t\tstatement,\n\t\t\tnative_call: code.slice(initializer.getStart(source_file), initializer.end),\n\t\t},\n\t];\n}\n\nfunction get_remote_client_export_type(\n\tinitializer: Expression,\n\tnamespace: string,\n): RemoteClientExportType | undefined {\n\tif (!ts.isCallExpression(initializer)) {\n\t\treturn undefined;\n\t}\n\n\tconst expression = initializer.expression;\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn undefined;\n\t}\n\n\tif (!ts.isIdentifier(expression.expression) || expression.expression.text !== namespace) {\n\t\treturn undefined;\n\t}\n\n\tconst remote_type = expression.name.text;\n\n\tif (!is_remote_client_export_type(remote_type)) {\n\t\treturn undefined;\n\t}\n\n\treturn remote_type;\n}\n\nfunction is_remote_client_export_type(value: string): value is RemoteClientExportType {\n\treturn remote_client_export_types.has(value as RemoteClientExportType);\n}\n\nfunction is_export_statement(statement: Statement): boolean {\n\tconst modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n\n\treturn modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;\n}\n\nfunction is_const_declaration_list(declaration_list: ts.VariableDeclarationList): boolean {\n\treturn (ts.getCombinedNodeFlags(declaration_list) & ts.NodeFlags.Const) !== 0;\n}\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pC,IAAI,CAAC,6BAA6B,WAAW,GAC5C;CAGD,OAAO;AACR;AAEA,SAAS,6BAA6B,OAAgD;CACrF,OAAO,2BAA2B,IAAI,KAA+B;AACtE;AAEA,SAAS,oBAAoB,WAA+B;CAG3D,QAFkB,GAAG,iBAAiB,SAAS,IAAI,GAAG,aAAa,SAAS,IAAI,KAAA,EAAA,EAE9D,MAAM,aAAa,SAAS,SAAS,GAAG,WAAW,aAAa,KAAK;AACxF;AAEA,SAAS,0BAA0B,kBAAuD;CACzF,QAAQ,GAAG,qBAAqB,gBAAgB,IAAI,GAAG,UAAU,WAAW;AAC7E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-CEK6Ccll.js","names":["create_source_map","is_yield_star_expression","create_source_map"],"sources":["../../../modules/svelte-effect-runtime/src/script-transform/imports.ts","../../../modules/svelte-effect-runtime/src/markup/transform/constants.ts","../../../modules/svelte-effect-runtime/src/markup/transform/apply.ts","../../../modules/svelte-effect-runtime/src/markup/transform/effect-bindings.ts","../../../modules/svelte-effect-runtime/src/markup/transform/classify.ts","../../../modules/svelte-effect-runtime/src/markup/transform/expressions.ts","../../../modules/svelte-effect-runtime/src/markup/transform/effect-callbacks.ts","../../../modules/svelte-effect-runtime/src/markup/transform/emit.ts","../../../modules/svelte-effect-runtime/src/script-transform/source.ts","../../../modules/svelte-effect-runtime/src/script-transform/runes.ts","../../../modules/svelte-effect-runtime/src/script-transform/ast.ts","../../../modules/svelte-effect-runtime/src/markup/transform/scan.ts","../../../modules/svelte-effect-runtime/src/markup/transform/index.ts"],"sourcesContent":["import type { RuntimeImportBindings } from \"./types.ts\";\n\nimport ts from \"typescript\";\n\ninterface RuntimeImportOptions {\n\tneeds_dispatcher?: boolean;\n\tneeds_effect?: boolean;\n\tneeds_untrack?: boolean;\n}\n\n/**\n * Builds the import statements injected by the script transform.\n *\n * @since 2.0.0\n * @param has_effect_import - Whether the user already imports `Effect`.\n * @param has_dispatcher_import - Whether the user already imports\n * `get_dispatcher`.\n * @param has_untrack_import - Whether the user already imports `untrack`.\n * @param bindings - Local names reserved for generated runtime helpers.\n * @param options - Runtime helper imports required by this transformed script.\n * @returns Newline-separated import statements to inject.\n */\nexport function make_imports(\n\thas_effect_import: boolean,\n\thas_dispatcher_import: boolean,\n\thas_untrack_import: boolean,\n\tbindings: RuntimeImportBindings = {\n\t\tcancel: \"__SER___cancel\",\n\t\tdispatcher: \"get_dispatcher\",\n\t\tdispatcher_value: \"__SER___dispatcher\",\n\t\teffect: \"Effect\",\n\t\tprogram: \"__SER___program\",\n\t\tuntrack: \"untrack\",\n\t},\n\toptions: RuntimeImportOptions = {},\n): string {\n\tconst needs_dispatcher = options.needs_dispatcher ?? true;\n\tconst needs_effect = options.needs_effect ?? true;\n\tconst needs_untrack = options.needs_untrack ?? true;\n\n\tconst dispatcher_import =\n\t\tbindings.dispatcher === \"get_dispatcher\"\n\t\t\t? `import { get_dispatcher } from \"svelte-effect-runtime/internal/generators\";`\n\t\t\t: `import { get_dispatcher as ${bindings.dispatcher} } from \"svelte-effect-runtime/internal/generators\";`;\n\n\tconst untrack_import =\n\t\tbindings.untrack === \"untrack\"\n\t\t\t? `import { untrack } from \"svelte\";`\n\t\t\t: `import { untrack as ${bindings.untrack} } from \"svelte\";`;\n\n\tconst effect_import = has_effect_import\n\t\t? false\n\t\t: bindings.effect === \"Effect\"\n\t\t\t? `import { Effect } from \"effect\";`\n\t\t\t: `import { Effect as ${bindings.effect} } from \"effect\";`;\n\n\treturn [\n\t\tneeds_dispatcher && !has_dispatcher_import && dispatcher_import,\n\t\tneeds_untrack && !has_untrack_import && untrack_import,\n\t\tneeds_effect && effect_import,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Checks whether a source file imports a local binding from a module.\n *\n * @since 2.0.0\n * @param source_file - Parsed TypeScript source file to inspect.\n * @param module_name - Module specifier to match.\n * @param local_name - Local binding name to look for.\n * @returns Whether that binding is already locally available.\n */\nexport function has_local_import_binding(\n\tsource_file: ts.SourceFile,\n\tmodule_name: string,\n\tlocal_name: string,\n): boolean {\n\treturn source_file.statements.some((stmt) => {\n\t\tif (\n\t\t\t!ts.isImportDeclaration(stmt) ||\n\t\t\t!ts.isStringLiteral(stmt.moduleSpecifier) ||\n\t\t\tstmt.moduleSpecifier.text !== module_name\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst clause = stmt.importClause;\n\n\t\tif (!clause || clause.isTypeOnly) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (clause.name?.text === local_name) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst named_bindings = clause.namedBindings;\n\n\t\tif (!named_bindings) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (ts.isNamespaceImport(named_bindings)) {\n\t\t\treturn named_bindings.name.text === local_name;\n\t\t}\n\n\t\treturn named_bindings.elements.some(\n\t\t\t(element) => !element.isTypeOnly && element.name.text === local_name,\n\t\t);\n\t});\n}\n\n/**\n * Checks whether a source file already has any top-level binding with a local\n * name.\n *\n * @since 2.4.2\n * @param source_file - Parsed TypeScript source file to inspect.\n * @param local_name - Local binding name to look for.\n * @returns Whether that local name is already declared in the file.\n */\nexport function has_top_level_binding(source_file: ts.SourceFile, local_name: string): boolean {\n\treturn collect_top_level_binding_names(source_file).includes(local_name);\n}\n\n/**\n * Collects every local binding declared at module top level.\n *\n * @since 2.4.2\n * @param source_file - Parsed TypeScript source file to inspect.\n * @returns Top-level names declared by imports, declarations, and variables.\n */\nexport function collect_top_level_binding_names(source_file: ts.SourceFile): string[] {\n\treturn source_file.statements.flatMap(collect_statement_binding_names);\n}\n\nfunction collect_statement_binding_names(stmt: ts.Statement): string[] {\n\tif (ts.isImportDeclaration(stmt)) {\n\t\treturn collect_import_binding_names(stmt);\n\t}\n\n\tif (ts.isVariableStatement(stmt)) {\n\t\treturn stmt.declarationList.declarations.flatMap((decl) =>\n\t\t\tcollect_binding_name_text(decl.name),\n\t\t);\n\t}\n\n\tif (\n\t\tts.isFunctionDeclaration(stmt) ||\n\t\tts.isClassDeclaration(stmt) ||\n\t\tts.isInterfaceDeclaration(stmt) ||\n\t\tts.isTypeAliasDeclaration(stmt) ||\n\t\tts.isEnumDeclaration(stmt) ||\n\t\tts.isModuleDeclaration(stmt)\n\t) {\n\t\treturn stmt.name ? [stmt.name.text] : [];\n\t}\n\n\treturn [];\n}\n\nfunction collect_import_binding_names(stmt: ts.ImportDeclaration): string[] {\n\tconst clause = stmt.importClause;\n\n\tif (!clause) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\tclause.name?.text,\n\t\tclause.namedBindings && ts.isNamespaceImport(clause.namedBindings)\n\t\t\t? clause.namedBindings.name.text\n\t\t\t: undefined,\n\t\tclause.namedBindings && ts.isNamedImports(clause.namedBindings)\n\t\t\t? clause.namedBindings.elements.map((element) => element.name.text)\n\t\t\t: undefined,\n\t]\n\t\t.flat()\n\t\t.filter((name): name is string => name !== undefined);\n}\n\nfunction collect_binding_name_text(name: ts.BindingName): string[] {\n\tif (ts.isIdentifier(name)) {\n\t\treturn [name.text];\n\t}\n\n\treturn name.elements.flatMap((element) => {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn collect_binding_name_text(element.name);\n\t});\n}\n","export const HELPERS = {\n\tcodes: \"Code\",\n\tdispatcher: \"Dispatcher\",\n} as const;\n","import type MagicString from \"magic-string\";\n\nimport { collect_top_level_binding_names } from \"$/script-transform/imports.ts\";\nimport { HELPERS } from \"./constants.ts\";\nimport type {\n\tHelperDeclaration,\n\tInsertion,\n\tMarkupHelperBindings,\n\tMarkupRelocation,\n\tPendingRelocation,\n\tReplacement,\n} from \"./types.ts\";\nimport ts from \"typescript\";\n\nexport function create_source_map(magic: MagicString, filename: string): Record<string, unknown> {\n\tconst map = magic.generateMap({\n\t\thires: true,\n\t\tincludeContent: true,\n\t\tsource: filename,\n\t});\n\n\treturn map as unknown as Record<string, unknown>;\n}\n\nexport function blank_script_blocks(content: string): string {\n\treturn content.replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script\\s*>/gi, (match) => {\n\t\tconst lines = match.split(\"\\n\");\n\t\treturn lines.map((l) => \" \".repeat(l.length)).join(\"\\n\");\n\t});\n}\n\nexport function inject_helpers(\n\tmagic: MagicString,\n\tcontent: string,\n\thelpers: HelperDeclaration[] = [],\n\tbindings: MarkupHelperBindings = HELPERS,\n): Insertion | undefined {\n\tconst import_helpers = unique_import_helpers(helpers);\n\tconst local_helpers = helpers.filter((helper) => !is_import_helper(helper));\n\n\tconst helper_segments: Array<{\n\t\ttext: string;\n\t\trelocation?: PendingRelocation;\n\t}> = [\n\t\tmake_import_helper(content, make_dispatcher_import(bindings)),\n\t\t...import_helpers,\n\t\t...local_helpers,\n\t]\n\t\t.filter((helper): helper is string | HelperDeclaration => helper !== undefined)\n\t\t.map((helper) => (typeof helper === \"string\" ? { text: helper } : helper));\n\n\tif (helper_segments.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst helper_block = helper_segments.map((segment) => segment.text).join(\"\\n\");\n\n\tconst script_tag = find_instance_script_tag(content);\n\n\tif (script_tag) {\n\t\tconst text = `\\n${helper_block}\\n`;\n\n\t\tmagic.appendLeft(script_tag.end, text);\n\n\t\treturn {\n\t\t\tstart: script_tag.end,\n\t\t\ttext,\n\t\t\trelocations: make_insertion_relocations(helper_segments, \"\\n\"),\n\t\t};\n\t} else {\n\t\tconst text = `<script>\\n${helper_block}\\n</script>\\n\\n`;\n\n\t\tmagic.prepend(text);\n\n\t\treturn {\n\t\t\tstart: 0,\n\t\t\ttext,\n\t\t\trelocations: make_insertion_relocations(helper_segments, \"<script>\\n\"),\n\t\t};\n\t}\n}\n\nexport function make_markup_helper_bindings(content: string): {\n\tbindings: MarkupHelperBindings;\n\tname_allocator: { reserve(name: string): string };\n} {\n\tconst script_tag = find_instance_script_tag(content);\n\tconst binding_names = script_tag\n\t\t? collect_script_binding_names(content.slice(script_tag.start, script_tag.end))\n\t\t: [];\n\tconst name_allocator = make_name_allocator(binding_names);\n\n\treturn {\n\t\tbindings: {\n\t\t\tcodes: name_allocator.reserve(HELPERS.codes),\n\t\t\tdispatcher: name_allocator.reserve(HELPERS.dispatcher),\n\t\t},\n\t\tname_allocator,\n\t};\n}\n\nexport function create_relocations(\n\treplacements: Replacement[],\n\thelper_insertion: Insertion | undefined,\n): MarkupRelocation[] {\n\tconst edits = [\n\t\thelper_insertion && {\n\t\t\tstart: helper_insertion.start,\n\t\t\tremovedLength: 0,\n\t\t\tinsertedLength: helper_insertion.text.length,\n\t\t},\n\t\t...replacements.map((replacement) => ({\n\t\t\tstart: replacement.start,\n\t\t\tremovedLength: replacement.end - replacement.start,\n\t\t\tinsertedLength: replacement.text.length,\n\t\t})),\n\t].filter(Boolean) as Array<{\n\t\tstart: number;\n\t\tremovedLength: number;\n\t\tinsertedLength: number;\n\t}>;\n\n\tconst replacement_relocations = replacements.flatMap((replacement) => {\n\t\tif (!replacement.relocation) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst delta_before = edits\n\t\t\t.filter((edit) => edit.start < replacement.start)\n\t\t\t.reduce((total, edit) => total + edit.insertedLength - edit.removedLength, 0);\n\t\tconst generated_start = replacement.start + delta_before;\n\n\t\treturn [\n\t\t\t{\n\t\t\t\toriginalStart: replacement.relocation.originalStart,\n\t\t\t\toriginalEnd: replacement.relocation.originalEnd,\n\t\t\t\tgeneratedStart:\n\t\t\t\t\tgenerated_start + replacement.relocation.generatedStartInReplacement,\n\t\t\t\tgeneratedEnd: generated_start + replacement.relocation.generatedEndInReplacement,\n\t\t\t},\n\t\t];\n\t});\n\n\tconst helper_relocations =\n\t\thelper_insertion?.relocations?.map((relocation) => ({\n\t\t\toriginalStart: relocation.originalStart,\n\t\t\toriginalEnd: relocation.originalEnd,\n\t\t\tgeneratedStart: helper_insertion.start + relocation.generatedStartInReplacement,\n\t\t\tgeneratedEnd: helper_insertion.start + relocation.generatedEndInReplacement,\n\t\t})) ?? [];\n\n\treturn [...replacement_relocations, ...helper_relocations];\n}\n\nfunction make_import_helper(content: string, import_text: string): string | undefined {\n\tif (content.includes(import_text)) {\n\t\treturn undefined;\n\t}\n\n\treturn import_text;\n}\n\nfunction make_dispatcher_import(bindings: MarkupHelperBindings): string {\n\tconst dispatcher = make_import_specifier(HELPERS.dispatcher, bindings.dispatcher);\n\tconst codes = make_import_specifier(HELPERS.codes, bindings.codes);\n\n\treturn `import { ${dispatcher}, ${codes} } from \"svelte-effect-runtime/internal/generators\";`;\n}\n\nfunction make_import_specifier(imported_name: string, local_name: string): string {\n\tif (imported_name === local_name) {\n\t\treturn imported_name;\n\t}\n\n\treturn `${imported_name} as ${local_name}`;\n}\n\nfunction make_insertion_relocations(\n\tsegments: Array<{\n\t\ttext: string;\n\t\trelocation?: PendingRelocation;\n\t}>,\n\tprefix: string,\n): PendingRelocation[] {\n\tconst relocations: PendingRelocation[] = [];\n\tlet offset = prefix.length;\n\n\tfor (const segment of segments) {\n\t\tif (segment.relocation) {\n\t\t\trelocations.push({\n\t\t\t\toriginalStart: segment.relocation.originalStart,\n\t\t\t\toriginalEnd: segment.relocation.originalEnd,\n\t\t\t\tgeneratedStartInReplacement:\n\t\t\t\t\toffset + segment.relocation.generatedStartInReplacement,\n\t\t\t\tgeneratedEndInReplacement: offset + segment.relocation.generatedEndInReplacement,\n\t\t\t});\n\t\t}\n\n\t\toffset += segment.text.length + 1;\n\t}\n\n\treturn relocations;\n}\n\nfunction find_instance_script_tag(content: string): { start: number; end: number } | undefined {\n\tconst pattern = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n\tfor (const match of content.matchAll(pattern)) {\n\t\tif (match.index === undefined) continue;\n\n\t\tconst attrs = match[1] ?? \"\";\n\t\tif (/\\bcontext\\s*=\\s*[\"']module[\"']/.test(attrs) || /\\bmodule\\b/.test(attrs)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst open_end = match[0].indexOf(\">\") + 1;\n\t\treturn {\n\t\t\tstart: match.index + open_end,\n\t\t\tend: match.index + match[0].length - \"</script>\".length,\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nfunction unique_import_helpers(helpers: HelperDeclaration[]): HelperDeclaration[] {\n\tconst seen = new Set<string>();\n\n\treturn helpers.filter((helper) => {\n\t\tif (!is_import_helper(helper)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (seen.has(helper.text)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(helper.text);\n\n\t\treturn true;\n\t});\n}\n\nfunction is_import_helper(helper: HelperDeclaration): boolean {\n\treturn helper.text.trimStart().startsWith(\"import \");\n}\n\nfunction collect_script_binding_names(script_content: string): string[] {\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-script.ts\",\n\t\tscript_content,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\n\treturn collect_top_level_binding_names(source_file);\n}\n\nfunction make_name_allocator(initial_names: readonly string[]): {\n\treserve(name: string): string;\n} {\n\tconst used_names = new Set(initial_names);\n\n\treturn {\n\t\treserve(name: string): string {\n\t\t\tlet candidate = name;\n\t\t\tlet suffix = 1;\n\n\t\t\twhile (used_names.has(candidate)) {\n\t\t\t\tcandidate = `${name}_${suffix}`;\n\t\t\t\tsuffix += 1;\n\t\t\t}\n\n\t\t\tused_names.add(candidate);\n\n\t\t\treturn candidate;\n\t\t},\n\t};\n}\n","import type { HelperDeclaration } from \"./types.ts\";\n\nimport ts from \"typescript\";\n\nconst EFFECT_PACKAGE_MODULE = \"effect\";\nconst EFFECT_DIRECT_MODULE = \"effect/Effect\";\nconst GENERATED_EFFECT_NAME = \"__SER___Effect\";\n\n/**\n * Describes local bindings that resolve to Effect APIs in markup expressions.\n *\n * @example\n * ```ts\n * const context = collect_effect_callback_bindings(source);\n * context.effect_object_names.has(\"E\");\n * ```\n *\n * @since 2.4.0\n */\nexport interface EffectCallbackRewriteContext {\n\t/** Local names imported as the Effect object, such as `Effect` or `E`. */\n\teffect_object_names: ReadonlySet<string>;\n\t/** Namespace names imported from `effect/Effect`, such as `E.flatMap`. */\n\teffect_module_names: ReadonlySet<string>;\n\t/** Package namespace names imported from `effect`, such as `Fx.Effect`. */\n\teffect_package_names: ReadonlySet<string>;\n\t/** Direct `effect/Effect` imports mapped from local name to exported name. */\n\tdirect_members: ReadonlyMap<string, string>;\n\t/** Expression used for generated `gen`, `sync`, and upgraded direct calls. */\n\twrapper_expression: string;\n\t/** Import inserted when generated code needs a fresh Effect binding. */\n\twrapper_import: HelperDeclaration | undefined;\n}\n\ninterface EffectBindingState {\n\teffect_object_names: string[];\n\teffect_module_names: string[];\n\teffect_package_names: string[];\n\tdirect_members: Map<string, string>;\n\tlocal_names: Set<string>;\n\timplicit_effect_import: boolean;\n}\n\n/**\n * Collects Effect import bindings that markup callback rewriting can trust.\n *\n * @example\n * ```ts\n * const bindings = collect_effect_callback_bindings(\n * `<script>import { Effect as E } from \"effect\";</script>`,\n * );\n * ```\n *\n * @since 2.4.0\n * @param content - Full Svelte component source before markup lowering.\n * @returns Binding metadata used to identify Effect callback combinators.\n */\nexport function collect_effect_callback_bindings(content: string): EffectCallbackRewriteContext {\n\tconst state = make_effect_binding_state();\n\tconst scripts = collect_script_blocks(content);\n\n\tfor (const script of scripts) {\n\t\tconst source_file = ts.createSourceFile(\n\t\t\t\"component-script.ts\",\n\t\t\tscript,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\n\t\tcollect_source_file_bindings(source_file, state);\n\t}\n\n\tensure_implicit_effect_binding(state);\n\n\tconst wrapper = choose_effect_wrapper(state);\n\n\treturn {\n\t\teffect_object_names: new Set(state.effect_object_names),\n\t\teffect_module_names: new Set(state.effect_module_names),\n\t\teffect_package_names: new Set(state.effect_package_names),\n\t\tdirect_members: new Map(state.direct_members),\n\t\twrapper_expression: wrapper.expression,\n\t\twrapper_import: wrapper.import_text ? { text: wrapper.import_text } : undefined,\n\t};\n}\n\nfunction make_effect_binding_state(): EffectBindingState {\n\treturn {\n\t\teffect_object_names: [],\n\t\teffect_module_names: [],\n\t\teffect_package_names: [],\n\t\tdirect_members: new Map(),\n\t\tlocal_names: new Set(),\n\t\timplicit_effect_import: false,\n\t};\n}\n\nfunction collect_script_blocks(content: string): string[] {\n\tconst pattern = /<script\\b[^>]*>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n\treturn [...content.matchAll(pattern)].map((match) => match[1] ?? \"\");\n}\n\nfunction collect_source_file_bindings(source_file: ts.SourceFile, state: EffectBindingState): void {\n\tfor (const statement of source_file.statements) {\n\t\tcollect_statement_binding(statement, state);\n\t}\n}\n\nfunction collect_statement_binding(statement: ts.Statement, state: EffectBindingState): void {\n\tif (ts.isImportDeclaration(statement)) {\n\t\tcollect_import_binding(statement, state);\n\t\treturn;\n\t}\n\n\tif (ts.isImportEqualsDeclaration(statement)) {\n\t\tstate.local_names.add(statement.name.text);\n\t\treturn;\n\t}\n\n\tif (ts.isVariableStatement(statement)) {\n\t\tfor (const declaration of statement.declarationList.declarations) {\n\t\t\tcollect_binding_name(declaration.name, state.local_names);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (\n\t\tts.isFunctionDeclaration(statement) ||\n\t\tts.isClassDeclaration(statement) ||\n\t\tts.isInterfaceDeclaration(statement) ||\n\t\tts.isTypeAliasDeclaration(statement) ||\n\t\tts.isEnumDeclaration(statement) ||\n\t\tts.isModuleDeclaration(statement)\n\t) {\n\t\tif (statement.name) {\n\t\t\tstate.local_names.add(statement.name.text);\n\t\t}\n\t}\n}\n\nfunction collect_import_binding(statement: ts.ImportDeclaration, state: EffectBindingState): void {\n\tif (!ts.isStringLiteral(statement.moduleSpecifier)) {\n\t\treturn;\n\t}\n\n\tconst module_name = statement.moduleSpecifier.text;\n\tconst clause = statement.importClause;\n\n\tif (!clause) {\n\t\treturn;\n\t}\n\n\tif (clause.name) {\n\t\tstate.local_names.add(clause.name.text);\n\t}\n\n\tconst named_bindings = clause.namedBindings;\n\n\tif (!named_bindings) {\n\t\treturn;\n\t}\n\n\tif (ts.isNamespaceImport(named_bindings)) {\n\t\tcollect_namespace_import_binding(module_name, named_bindings.name.text, state);\n\t\treturn;\n\t}\n\n\tfor (const element of named_bindings.elements) {\n\t\tcollect_named_import_binding(module_name, element, state);\n\t}\n}\n\nfunction collect_namespace_import_binding(\n\tmodule_name: string,\n\tlocal_name: string,\n\tstate: EffectBindingState,\n): void {\n\tstate.local_names.add(local_name);\n\n\tif (module_name === EFFECT_DIRECT_MODULE) {\n\t\tadd_ordered_name(state.effect_module_names, local_name);\n\t\treturn;\n\t}\n\n\tif (module_name === EFFECT_PACKAGE_MODULE) {\n\t\tadd_ordered_name(state.effect_package_names, local_name);\n\t}\n}\n\nfunction collect_named_import_binding(\n\tmodule_name: string,\n\telement: ts.ImportSpecifier,\n\tstate: EffectBindingState,\n): void {\n\tconst imported_name = element.propertyName?.text ?? element.name.text;\n\tconst local_name = element.name.text;\n\n\tstate.local_names.add(local_name);\n\n\tif (module_name === EFFECT_PACKAGE_MODULE && imported_name === \"Effect\") {\n\t\tadd_ordered_name(state.effect_object_names, local_name);\n\t\treturn;\n\t}\n\n\tif (module_name === EFFECT_DIRECT_MODULE) {\n\t\tstate.direct_members.set(local_name, imported_name);\n\t}\n}\n\nfunction collect_binding_name(name: ts.BindingName, local_names: Set<string>): void {\n\tif (ts.isIdentifier(name)) {\n\t\tlocal_names.add(name.text);\n\t\treturn;\n\t}\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcollect_binding_name(element.name, local_names);\n\t}\n}\n\nfunction ensure_implicit_effect_binding(state: EffectBindingState): void {\n\tif (has_effect_binding(state) || state.local_names.has(\"Effect\")) {\n\t\treturn;\n\t}\n\n\tadd_ordered_name(state.effect_object_names, \"Effect\");\n\tstate.implicit_effect_import = true;\n}\n\nfunction has_effect_binding(state: EffectBindingState): boolean {\n\treturn (\n\t\tstate.effect_object_names.length > 0 ||\n\t\tstate.effect_module_names.length > 0 ||\n\t\tstate.effect_package_names.length > 0 ||\n\t\tstate.direct_members.size > 0\n\t);\n}\n\nfunction choose_effect_wrapper(state: EffectBindingState): {\n\texpression: string;\n\timport_text?: string;\n} {\n\tconst effect_object = state.effect_object_names[0];\n\n\tif (effect_object) {\n\t\treturn {\n\t\t\texpression: effect_object,\n\t\t\timport_text: state.implicit_effect_import\n\t\t\t\t? `import { Effect } from \"effect\";`\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\n\tconst effect_module = state.effect_module_names[0];\n\n\tif (effect_module) {\n\t\treturn { expression: effect_module };\n\t}\n\n\tconst effect_package = state.effect_package_names[0];\n\n\tif (effect_package) {\n\t\treturn { expression: `${effect_package}.Effect` };\n\t}\n\n\tconst generated_name = make_generated_effect_name(state.local_names);\n\n\treturn {\n\t\texpression: generated_name,\n\t\timport_text: `import { Effect as ${generated_name} } from \"effect\";`,\n\t};\n}\n\nfunction make_generated_effect_name(local_names: ReadonlySet<string>): string {\n\tif (!local_names.has(GENERATED_EFFECT_NAME)) {\n\t\treturn GENERATED_EFFECT_NAME;\n\t}\n\n\tlet index = 1;\n\n\twhile (local_names.has(`${GENERATED_EFFECT_NAME}_${index}`)) {\n\t\tindex += 1;\n\t}\n\n\treturn `${GENERATED_EFFECT_NAME}_${index}`;\n}\n\nfunction add_ordered_name(names: string[], name: string): void {\n\tif (names.includes(name)) {\n\t\treturn;\n\t}\n\n\tnames.push(name);\n}\n","import type { AST } from \"svelte/compiler\";\n\nimport type { MarkupCandidate, TagKind } from \"./types.ts\";\n\n/**\n * Matches sanitized placeholders back to their Svelte AST context.\n *\n * @since 2.0.0\n * @param ast - Parsed Svelte AST for the sanitized component markup.\n * @param candidates - Placeholder candidates produced by the scanner.\n * @returns Candidates paired with the markup context that determines how they\n * should be emitted.\n */\nexport function classify_candidates(\n\tast: AST.Root,\n\tcandidates: MarkupCandidate[],\n): Array<{ candidate: MarkupCandidate; kind: TagKind }> {\n\tconst by_placeholder = new Map(\n\t\tcandidates.map((candidate) => [candidate.placeholder, candidate]),\n\t);\n\n\tconst classified: Array<{ candidate: MarkupCandidate; kind: TagKind }> = [];\n\tconst matched = new Set<string>();\n\n\twalk_ast(ast.fragment, by_placeholder, matched, classified);\n\n\treturn classified;\n}\n\nfunction walk_ast(\n\tfragment: AST.Fragment,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const node of fragment.nodes) {\n\t\tvisit_ast_node(node, candidates, matched, classified);\n\t}\n}\n\nfunction visit_ast_node(\n\tnode: AST.Fragment[\"nodes\"][number],\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tswitch (node.type) {\n\t\tcase \"ExpressionTag\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"IfBlock\":\n\t\t\tclassify_expression(node.test, \"plain\", candidates, matched, classified);\n\t\t\twalk_ast(node.consequent, candidates, matched, classified);\n\t\t\tif (node.alternate) {\n\t\t\t\twalk_ast(node.alternate, candidates, matched, classified);\n\t\t\t}\n\t\t\treturn;\n\n\t\tcase \"EachBlock\":\n\t\t\tclassify_expression(node.expression, \"each\", candidates, matched, classified);\n\t\t\twalk_ast(node.body, candidates, matched, classified);\n\t\t\tif (node.fallback) {\n\t\t\t\twalk_ast(node.fallback, candidates, matched, classified);\n\t\t\t}\n\t\t\treturn;\n\n\t\tcase \"AwaitBlock\":\n\t\t\tclassify_expression(node.expression, \"await\", candidates, matched, classified);\n\t\t\tif (node.pending) {\n\t\t\t\twalk_ast(node.pending, candidates, matched, classified);\n\t\t\t}\n\t\t\tif (node.then) walk_ast(node.then, candidates, matched, classified);\n\t\t\tif (node.catch) walk_ast(node.catch, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"RenderTag\":\n\t\t\tclassify_expression(node.expression, \"render\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"HtmlTag\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"DebugTag\":\n\t\t\tclassify_debug_tag(node, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"ConstTag\":\n\t\tcase \"DeclarationTag\":\n\t\t\tclassify_declaration_tag(node, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"KeyBlock\":\n\t\t\tclassify_expression(node.expression, \"plain\", candidates, matched, classified);\n\t\t\twalk_ast(node.fragment, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tcase \"RegularElement\":\n\t\tcase \"Component\":\n\t\tcase \"TitleElement\":\n\t\tcase \"SlotElement\":\n\t\tcase \"SvelteBody\":\n\t\tcase \"SvelteBoundary\":\n\t\tcase \"SvelteComponent\":\n\t\tcase \"SvelteDocument\":\n\t\tcase \"SvelteElement\":\n\t\tcase \"SvelteFragment\":\n\t\tcase \"SvelteHead\":\n\t\tcase \"SvelteSelf\":\n\t\tcase \"SvelteWindow\":\n\t\t\tvisit_element_attributes(node, candidates, matched, classified);\n\t\t\twalk_ast(node.fragment, candidates, matched, classified);\n\t\t\treturn;\n\n\t\tdefault:\n\t\t\treturn;\n\t}\n}\n\nfunction classify_debug_tag(\n\t_node: Extract<AST.Fragment[\"nodes\"][number], { type: \"DebugTag\" }>,\n\t_candidates: Map<string, MarkupCandidate>,\n\t_matched: Set<string>,\n\t_classified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\treturn;\n}\n\nfunction classify_declaration_tag(\n\tnode: Extract<AST.Fragment[\"nodes\"][number], { type: \"ConstTag\" | \"DeclarationTag\" }>,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const decl of node.declaration.declarations) {\n\t\tclassify_expression(decl as ExpressionLike, \"plain\", candidates, matched, classified);\n\t}\n}\n\ninterface ElementLikeNode {\n\tattributes: Array<{\n\t\ttype: string;\n\t\tname?: string;\n\t\tvalue?: unknown;\n\t\texpression?: unknown;\n\t}>;\n\tfragment: AST.Fragment;\n}\n\nfunction visit_element_attributes(\n\tnode: ElementLikeNode,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tfor (const attr of node.attributes) {\n\t\tif (attr.type === \"Attribute\" && attr.name && is_event_attribute_name(attr.name)) {\n\t\t\tvisit_attribute_value(\n\t\t\t\tattr.value as true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>,\n\t\t\t\t\"event\",\n\t\t\t\tcandidates,\n\t\t\t\tmatched,\n\t\t\t\tclassified,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (attr.type === \"OnDirective\" && attr.expression) {\n\t\t\tclassify_expression(\n\t\t\t\tattr.expression as ExpressionLike,\n\t\t\t\t\"event\",\n\t\t\t\tcandidates,\n\t\t\t\tmatched,\n\t\t\t\tclassified,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t}\n}\n\nfunction is_event_attribute_name(name: string): boolean {\n\treturn name.startsWith(\"on:\") || /^on[a-z]/.test(name);\n}\n\nfunction visit_attribute_value(\n\tvalue: true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>,\n\tkind: TagKind,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tif (value === true) {\n\t\treturn;\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tfor (const part of value) {\n\t\t\tif (part.type === \"ExpressionTag\") {\n\t\t\t\tclassify_expression(part.expression, kind, candidates, matched, classified);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tclassify_expression(value.expression, kind, candidates, matched, classified);\n}\n\ntype ExpressionLike = {\n\ttype: string;\n\tname?: string;\n\tcallee?: { type: string; name?: string };\n};\n\nfunction classify_expression(\n\texpression: ExpressionLike | null | undefined,\n\tkind: TagKind,\n\tcandidates: Map<string, MarkupCandidate>,\n\tmatched: Set<string>,\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n): void {\n\tif (!expression) {\n\t\treturn;\n\t}\n\n\tconst found_candidates = find_candidates(expression, candidates);\n\n\tfor (const candidate of found_candidates) {\n\t\tif (matched.has(candidate.placeholder)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tmatched.add(candidate.placeholder);\n\t\tclassified.push({\n\t\t\tcandidate,\n\t\t\tkind: resolve_candidate_kind(candidate, kind),\n\t\t});\n\t}\n}\n\nfunction resolve_candidate_kind(candidate: MarkupCandidate, context_kind: TagKind): TagKind {\n\tif (candidate.key === \"render_argument\") {\n\t\treturn \"render_argument\";\n\t}\n\n\treturn context_kind;\n}\n\nfunction find_candidates(\n\texpression: ExpressionLike,\n\tcandidates: Map<string, MarkupCandidate>,\n): MarkupCandidate[] {\n\tconst found: MarkupCandidate[] = [];\n\tconst seen_nodes = new Set<unknown>();\n\tconst seen_placeholders = new Set<string>();\n\n\tvisit_expression_value(expression, candidates, seen_nodes, seen_placeholders, found);\n\n\treturn found;\n}\n\nfunction visit_expression_value(\n\tvalue: unknown,\n\tcandidates: Map<string, MarkupCandidate>,\n\tseen_nodes: Set<unknown>,\n\tseen_placeholders: Set<string>,\n\tfound: MarkupCandidate[],\n): void {\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tvisit_expression_value(item, candidates, seen_nodes, seen_placeholders, found);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (!is_record(value) || seen_nodes.has(value)) {\n\t\treturn;\n\t}\n\n\tseen_nodes.add(value);\n\n\tif (value.type === \"Identifier\" && typeof value.name === \"string\") {\n\t\tconst candidate = candidates.get(value.name);\n\n\t\tif (candidate && !seen_placeholders.has(candidate.placeholder)) {\n\t\t\tseen_placeholders.add(candidate.placeholder);\n\t\t\tfound.push(candidate);\n\t\t}\n\t}\n\n\tfor (const child of Object.values(value)) {\n\t\tvisit_expression_value(child, candidates, seen_nodes, seen_placeholders, found);\n\t}\n}\n\nfunction is_record(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n","import ts from \"typescript\";\n\n/**\n * Strips an event handler arrow function down to its executable body.\n *\n * @since 2.0.0\n * @param expr - Event handler expression text from the original markup.\n * @returns Handler parameters, body text, and body offsets inside `expr`.\n */\nexport function strip_arrow_function(expr: string): {\n\tparams: string;\n\tbody: string;\n\tbody_start: number;\n\tbody_end: number;\n} {\n\tconst arrow_idx = expr.indexOf(\"=>\");\n\n\tif (arrow_idx === -1) {\n\t\treturn { params: \"()\", body: expr, body_start: 0, body_end: expr.length };\n\t}\n\n\tconst params = expr.slice(0, arrow_idx).trim();\n\tconst raw_body = expr.slice(arrow_idx + 2);\n\tconst leading_ws = raw_body.length - raw_body.trimStart().length;\n\tlet body_start = arrow_idx + 2 + leading_ws;\n\tlet body_end = expr.length - (raw_body.length - raw_body.trimEnd().length);\n\tlet body = expr.slice(body_start, body_end);\n\n\tif (body.startsWith(\"{\") && body.endsWith(\"}\")) {\n\t\tbody_start += 1;\n\t\tbody_end -= 1;\n\t\tbody = body.slice(1, -1);\n\t}\n\n\tconst body_leading_ws = body.length - body.trimStart().length;\n\tconst body_trailing_ws = body.length - body.trimEnd().length;\n\n\tbody_start += body_leading_ws;\n\tbody_end -= body_trailing_ws;\n\tbody = body.trim();\n\n\tif (body.endsWith(\";\")) {\n\t\tbody = body.slice(0, -1);\n\t\tbody_end -= 1;\n\t}\n\n\treturn { params, body, body_start, body_end };\n}\n\n/**\n * Returns whether an expression is a callback function.\n *\n * @since 2.0.0\n * @param expr - Expression text from a markup attribute or expression tag.\n * @returns Whether the expression parses as an arrow or function expression.\n */\nexport function is_callback_function_expression(expr: string): boolean {\n\tconst wrapped = `const __SER___callback = ${expr};`;\n\tconst sf = ts.createSourceFile(\n\t\t\"callback.ts\",\n\t\twrapped,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = sf.statements[0];\n\n\tif (!ts.isVariableStatement(stmt)) {\n\t\treturn false;\n\t}\n\n\tconst initializer = stmt.declarationList.declarations[0]?.initializer;\n\n\treturn (\n\t\tinitializer !== undefined &&\n\t\t(ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer))\n\t);\n}\n\n/**\n * Classifies `yield*` placement inside an event handler body.\n *\n * @example\n * ```ts\n * analyze_event_body_yield_star(\"yield* save()\");\n * ```\n *\n * @since 2.0.0\n * @param body - Event handler body text after the outer arrow has been\n * stripped.\n * @returns Whether the body has top-level yield* expressions and whether any\n * yield* appears inside a nested non-generator callback.\n */\nexport function analyze_event_body_yield_star(body: string): {\n\thas_top_level_yield_star: boolean;\n\thas_nested_invalid_yield_star: boolean;\n} {\n\tconst wrapped = `function* __SER___event() { ${body}; }`;\n\tconst sf = ts.createSourceFile(\n\t\t\"event.ts\",\n\t\twrapped,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = sf.statements[0];\n\n\tif (!ts.isFunctionDeclaration(stmt) || !stmt.body) {\n\t\treturn {\n\t\t\thas_top_level_yield_star: false,\n\t\t\thas_nested_invalid_yield_star: /\\byield\\s*\\*/.test(body),\n\t\t};\n\t}\n\n\tconst result = {\n\t\thas_top_level_yield_star: false,\n\t\thas_nested_invalid_yield_star: false,\n\t};\n\n\tvisit_event_body(stmt.body, \"top_level\", result);\n\n\treturn result;\n}\n\n/**\n * Collects free identifiers that must be captured as reactive dependencies.\n *\n * @since 2.0.0\n * @param expr_text - Markup expression text to inspect.\n * @returns Identifier names referenced by the expression.\n */\nexport function collect_free_identifiers(expr_text: string): string[] {\n\tconst wrapped = `function* __SER___w() { return (${expr_text}); }`;\n\tlet sf: ts.SourceFile;\n\n\ttry {\n\t\tsf = ts.createSourceFile(\n\t\t\t\"expr.ts\",\n\t\t\twrapped,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\t} catch {\n\t\treturn [];\n\t}\n\n\tconst fn = sf.statements[0];\n\n\tif (!ts.isFunctionDeclaration(fn) || !fn.body) {\n\t\treturn [];\n\t}\n\n\tconst ids: string[] = [];\n\tconst locals = new Set<string>();\n\tconst seen = new Set<string>();\n\n\tvisit_ids(fn.body, locals, seen, ids);\n\n\treturn ids;\n}\n\nfunction visit_ids(node: ts.Node, locals: Set<string>, seen: Set<string>, ids: string[]): void {\n\tif (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isFunctionDeclaration(node)\n\t) {\n\t\tconst scoped = new Set(locals);\n\n\t\tif (ts.isFunctionDeclaration(node) && node.name) {\n\t\t\tscoped.add(node.name.text);\n\t\t}\n\n\t\tfor (const parameter of node.parameters) {\n\t\t\tadd_binding_names(parameter.name, scoped);\n\t\t}\n\n\t\tif (node.body) {\n\t\t\tvisit_ids(node.body, scoped, seen, ids);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (ts.isVariableDeclaration(node)) {\n\t\tif (node.initializer) {\n\t\t\tvisit_ids(node.initializer, locals, seen, ids);\n\t\t}\n\n\t\tadd_binding_names(node.name, locals);\n\n\t\treturn;\n\t}\n\n\tif (ts.isTypeReferenceNode(node)) {\n\t\treturn;\n\t}\n\n\tif (ts.isIdentifier(node)) {\n\t\tif (\n\t\t\tnode.text === \"yield\" ||\n\t\t\tnode.text === \"undefined\" ||\n\t\t\tnode.text === \"null\" ||\n\t\t\tnode.text === \"true\" ||\n\t\t\tnode.text === \"false\" ||\n\t\t\tnode.text === \"this\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_property_access_name(node)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!locals.has(node.text) && !seen.has(node.text)) {\n\t\t\tseen.add(node.text);\n\t\t\tids.push(node.text);\n\t\t}\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => visit_ids(child, locals, seen, ids));\n}\n\nfunction add_binding_names(name: ts.BindingName, locals: Set<string>): void {\n\tif (ts.isIdentifier(name)) {\n\t\tlocals.add(name.text);\n\t\treturn;\n\t}\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tadd_binding_names(element.name, locals);\n\t}\n}\n\ntype EventYieldContext = \"top_level\" | \"nested_generator\" | \"nested_invalid\";\n\ninterface EventYieldAnalysis {\n\thas_top_level_yield_star: boolean;\n\thas_nested_invalid_yield_star: boolean;\n}\n\nfunction visit_event_body(\n\tnode: ts.Node,\n\tcontext: EventYieldContext,\n\tresult: EventYieldAnalysis,\n): void {\n\tif (is_yield_star_expression(node)) {\n\t\tif (context === \"top_level\") {\n\t\t\tresult.has_top_level_yield_star = true;\n\t\t} else if (context === \"nested_invalid\") {\n\t\t\tresult.has_nested_invalid_yield_star = true;\n\t\t}\n\n\t\tnode.forEachChild((child) => visit_event_body(child, context, result));\n\t\treturn;\n\t}\n\n\tif (is_nested_function_boundary(node)) {\n\t\tconst next_context = is_generator_function_boundary(node)\n\t\t\t? \"nested_generator\"\n\t\t\t: \"nested_invalid\";\n\n\t\tnode.forEachChild((child) => visit_event_body(child, next_context, result));\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => visit_event_body(child, context, result));\n}\n\nfunction is_nested_function_boundary(node: ts.Node): boolean {\n\treturn (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isFunctionDeclaration(node) ||\n\t\tts.isMethodDeclaration(node) ||\n\t\tts.isGetAccessorDeclaration(node) ||\n\t\tts.isSetAccessorDeclaration(node)\n\t);\n}\n\nfunction is_generator_function_boundary(node: ts.Node): boolean {\n\treturn (\n\t\t(ts.isFunctionExpression(node) ||\n\t\t\tts.isFunctionDeclaration(node) ||\n\t\t\tts.isMethodDeclaration(node)) &&\n\t\tnode.asteriskToken !== undefined\n\t);\n}\n\nfunction is_yield_star_expression(node: ts.Node): boolean {\n\tif (ts.isYieldExpression(node)) {\n\t\treturn node.asteriskToken !== undefined;\n\t}\n\n\treturn (\n\t\tts.isBinaryExpression(node) &&\n\t\tnode.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n\t\tts.isIdentifier(node.left) &&\n\t\tnode.left.text === \"yield\"\n\t);\n}\n\nfunction is_property_access_name(node: ts.Identifier): boolean {\n\tconst parent = node.parent;\n\n\treturn (\n\t\t(ts.isPropertyAccessExpression(parent) && parent.name === node) ||\n\t\t(ts.isPropertyAssignment(parent) && parent.name === node) ||\n\t\t(ts.isBindingElement(parent) && parent.propertyName === node) ||\n\t\tts.isImportSpecifier(parent) ||\n\t\tts.isExportSpecifier(parent)\n\t);\n}\n","import { contains_top_level_yield_star } from \"$/detect.ts\";\nimport type { EffectCallbackRewriteContext } from \"./effect-bindings.ts\";\nimport type { HelperDeclaration } from \"./types.ts\";\n\nimport MagicString from \"magic-string\";\nimport ts from \"typescript\";\n\nconst match_effect_members = new Map([\n\t[\"match\", \"matchEffect\"],\n\t[\"matchCause\", \"matchCauseEffect\"],\n]);\n\nconst effectful_callback_members = new Set([\n\t\"andThen\",\n\t\"catchAll\",\n\t\"catchAllCause\",\n\t\"catchCause\",\n\t\"catchTag\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"tap\",\n\t\"tapError\",\n\t\"tapErrorCause\",\n]);\n\nconst effectful_handler_members = new Set([\"matchCauseEffect\", \"matchEffect\", \"tapBoth\"]);\n\nconst effectful_handler_property_names = new Set([\"onFailure\", \"onSuccess\"]);\n\ninterface RewriteContext {\n\tsource_file: ts.SourceFile;\n\tsource_text: string;\n\tmagic: MagicString;\n\toffset: number;\n\tbindings: EffectCallbackRewriteContext;\n\tchanged: boolean;\n\tuses_wrapper: boolean;\n}\n\ninterface EffectMember {\n\tname: string;\n\tname_start: number;\n\tname_end: number;\n\tdirect: boolean;\n}\n\ntype EffectWrapperMember = \"gen\" | \"sync\";\n\n/**\n * Rewrites effectful callback shorthand inside event handler expressions.\n *\n * @example\n * ```ts\n * normalize_effect_callback_yields(\n * `yield* action.pipe(Effect.flatMap((value) => yield* next(value)))`,\n * collect_effect_callback_bindings(source),\n * );\n * ```\n *\n * @since 2.0.0\n * @param expr_text - Markup expression text before it is wrapped in the\n * generated Effect runner.\n * @param bindings - Local Effect import bindings collected from the Svelte\n * component's script blocks.\n * @returns The expression with nested Effect callback `yield*` shorthand\n * lowered into explicit Effect callbacks, plus any import needed by generated\n * wrapper calls.\n */\nexport function normalize_effect_callback_yields(\n\texpr_text: string,\n\tbindings: EffectCallbackRewriteContext,\n): { expr_text: string; helpers: HelperDeclaration[] } {\n\tconst prefix = \"const __SER___expression = \";\n\tconst source_text = `${prefix}${expr_text};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"event-expression.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst statement = source_file.statements[0];\n\tconst magic = new MagicString(expr_text);\n\tconst context: RewriteContext = {\n\t\tsource_file,\n\t\tsource_text,\n\t\tmagic,\n\t\toffset: prefix.length,\n\t\tbindings,\n\t\tchanged: false,\n\t\tuses_wrapper: false,\n\t};\n\n\tif (!ts.isVariableStatement(statement)) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tconst expression = statement.declarationList.declarations[0]?.initializer;\n\n\tif (!expression) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tvisit_expression(expression, context);\n\n\tif (!context.changed) {\n\t\treturn { expr_text, helpers: [] };\n\t}\n\n\tconst helpers =\n\t\tcontext.uses_wrapper && bindings.wrapper_import ? [bindings.wrapper_import] : [];\n\n\treturn {\n\t\texpr_text: magic.toString(),\n\t\thelpers,\n\t};\n}\n\nfunction visit_expression(node: ts.Node, context: RewriteContext): void {\n\tif (is_non_generator_callback_with_top_level_yield(node)) {\n\t\treturn;\n\t}\n\n\tif (ts.isCallExpression(node)) {\n\t\trewrite_match_call(node, context);\n\t\trewrite_effectful_handler_call(node, context);\n\t\trewrite_effectful_callback_arguments(node, context);\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tvisit_expression(child, context);\n\t});\n}\n\nfunction rewrite_match_call(call: ts.CallExpression, context: RewriteContext): void {\n\tconst member = get_effect_member(call.expression, context);\n\tconst upgraded_name = member && match_effect_members.get(member.name);\n\tconst options = get_last_object_argument(call);\n\n\tif (!member || !upgraded_name || !options) {\n\t\treturn;\n\t}\n\n\tconst handlers = get_handler_properties(options);\n\tconst should_upgrade = handlers.some(\n\t\t(handler) =>\n\t\t\thandler.callback && is_non_generator_callback_with_top_level_yield(handler.callback),\n\t);\n\n\tif (!should_upgrade) {\n\t\treturn;\n\t}\n\n\trewrite_effect_member_name(member, upgraded_name, context);\n\tcontext.changed = true;\n\n\tfor (const handler of handlers) {\n\t\tif (!handler.callback) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (is_non_generator_callback_with_top_level_yield(handler.callback)) {\n\t\t\trewrite_callback_to_effect_gen(handler.callback, context);\n\t\t} else {\n\t\t\trewrite_callback_to_effect_sync(handler.callback, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_effectful_handler_call(call: ts.CallExpression, context: RewriteContext): void {\n\tconst member = get_effect_member(call.expression, context);\n\tconst options = get_last_object_argument(call);\n\n\tif (!member || !effectful_handler_members.has(member.name) || !options) {\n\t\treturn;\n\t}\n\n\tfor (const handler of get_handler_properties(options)) {\n\t\tif (handler.callback && is_non_generator_callback_with_top_level_yield(handler.callback)) {\n\t\t\trewrite_callback_to_effect_gen(handler.callback, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_effectful_callback_arguments(\n\tcall: ts.CallExpression,\n\tcontext: RewriteContext,\n): void {\n\tconst member = get_effect_member(call.expression, context);\n\n\tif (!member || !effectful_callback_members.has(member.name)) {\n\t\treturn;\n\t}\n\n\tfor (const argument of call.arguments) {\n\t\tif (\n\t\t\tis_callback_expression(argument) &&\n\t\t\tis_non_generator_callback_with_top_level_yield(argument)\n\t\t) {\n\t\t\trewrite_callback_to_effect_gen(argument, context);\n\t\t}\n\t}\n}\n\nfunction rewrite_callback_to_effect_gen(\n\tcallback: ts.ArrowFunction | ts.FunctionExpression,\n\tcontext: RewriteContext,\n): void {\n\tif (is_async_function(callback)) {\n\t\treturn;\n\t}\n\n\tif (ts.isArrowFunction(callback)) {\n\t\trewrite_arrow_callback(callback, \"gen\", context);\n\t\treturn;\n\t}\n\n\trewrite_function_body(callback, \"gen\", context);\n}\n\nfunction rewrite_callback_to_effect_sync(\n\tcallback: ts.ArrowFunction | ts.FunctionExpression,\n\tcontext: RewriteContext,\n): void {\n\tif (is_async_function(callback)) {\n\t\treturn;\n\t}\n\n\tif (ts.isArrowFunction(callback)) {\n\t\trewrite_arrow_callback(callback, \"sync\", context);\n\t\treturn;\n\t}\n\n\trewrite_function_body(callback, \"sync\", context);\n}\n\nfunction rewrite_arrow_callback(\n\tcallback: ts.ArrowFunction,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): void {\n\tconst start = to_expr_pos(callback.getStart(context.source_file), context);\n\tconst end = to_expr_pos(callback.end, context);\n\tconst params_text = context.source_text\n\t\t.slice(\n\t\t\tcallback.getStart(context.source_file),\n\t\t\tcallback.equalsGreaterThanToken.getStart(context.source_file),\n\t\t)\n\t\t.trim();\n\tconst body_text = get_body_text(callback.body, context);\n\tconst rewritten_body = make_effect_body(callback.body, body_text, wrapper, context);\n\tconst replacement = `${params_text} => ${rewritten_body}`;\n\n\tcontext.magic.overwrite(start, end, replacement);\n\tcontext.changed = true;\n}\n\nfunction rewrite_function_body(\n\tcallback: ts.FunctionExpression,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): void {\n\tconst body_start = to_expr_pos(callback.body.getStart(context.source_file), context);\n\tconst body_end = to_expr_pos(callback.body.end, context);\n\tconst body_text = get_body_text(callback.body, context);\n\tconst rewritten_body = make_effect_body(callback.body, body_text, wrapper, context);\n\n\tcontext.magic.overwrite(body_start, body_end, `{ return ${rewritten_body}; }`);\n\tcontext.changed = true;\n}\n\nfunction make_effect_body(\n\tbody: ts.ConciseBody,\n\tbody_text: string,\n\twrapper: EffectWrapperMember,\n\tcontext: RewriteContext,\n): string {\n\tconst wrapper_access = make_effect_access(wrapper, context);\n\n\tif (wrapper === \"gen\") {\n\t\tif (ts.isBlock(body)) {\n\t\t\treturn `${wrapper_access}(function* () ${body_text})`;\n\t\t}\n\n\t\treturn `${wrapper_access}(function* () { return (${body_text}); })`;\n\t}\n\n\tif (ts.isBlock(body)) {\n\t\treturn `${wrapper_access}(() => ${body_text})`;\n\t}\n\n\treturn `${wrapper_access}(() => (${body_text}))`;\n}\n\nfunction get_body_text(body: ts.ConciseBody, context: RewriteContext): string {\n\treturn context.source_text.slice(body.getStart(context.source_file), body.end).trim();\n}\n\nfunction get_handler_properties(object_literal: ts.ObjectLiteralExpression): Array<{\n\tcallback: ts.ArrowFunction | ts.FunctionExpression | undefined;\n}> {\n\treturn object_literal.properties.flatMap((property) => {\n\t\tif (!ts.isPropertyAssignment(property)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst name = get_property_name(property.name);\n\n\t\tif (!name || !effectful_handler_property_names.has(name)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst callback = is_callback_expression(property.initializer)\n\t\t\t? property.initializer\n\t\t\t: undefined;\n\n\t\treturn [{ callback }];\n\t});\n}\n\nfunction get_last_object_argument(call: ts.CallExpression): ts.ObjectLiteralExpression | undefined {\n\tconst last_argument = call.arguments[call.arguments.length - 1];\n\n\tif (!last_argument || !ts.isObjectLiteralExpression(last_argument)) {\n\t\treturn undefined;\n\t}\n\n\treturn last_argument;\n}\n\nfunction get_effect_member(\n\texpression: ts.Expression,\n\tcontext: RewriteContext,\n): EffectMember | undefined {\n\tif (ts.isIdentifier(expression)) {\n\t\tconst direct_member = context.bindings.direct_members.get(expression.text);\n\n\t\tif (!direct_member) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tname: direct_member,\n\t\t\tname_start: to_expr_pos(expression.getStart(context.source_file), context),\n\t\t\tname_end: to_expr_pos(expression.end, context),\n\t\t\tdirect: true,\n\t\t};\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn undefined;\n\t}\n\n\tif (!is_effect_namespace_expression(expression.expression, context)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tname: expression.name.text,\n\t\tname_start: to_expr_pos(expression.name.getStart(context.source_file), context),\n\t\tname_end: to_expr_pos(expression.name.end, context),\n\t\tdirect: false,\n\t};\n}\n\nfunction rewrite_effect_member_name(\n\tmember: EffectMember,\n\tupgraded_name: string,\n\tcontext: RewriteContext,\n): void {\n\tif (member.direct) {\n\t\tcontext.magic.overwrite(\n\t\t\tmember.name_start,\n\t\t\tmember.name_end,\n\t\t\tmake_effect_access(upgraded_name, context),\n\t\t);\n\n\t\treturn;\n\t}\n\n\tcontext.magic.overwrite(member.name_start, member.name_end, upgraded_name);\n}\n\nfunction make_effect_access(member_name: string, context: RewriteContext): string {\n\tcontext.uses_wrapper = true;\n\n\treturn `${context.bindings.wrapper_expression}.${member_name}`;\n}\n\nfunction is_effect_namespace_expression(\n\texpression: ts.Expression,\n\tcontext: RewriteContext,\n): boolean {\n\tif (ts.isIdentifier(expression)) {\n\t\treturn (\n\t\t\tcontext.bindings.effect_object_names.has(expression.text) ||\n\t\t\tcontext.bindings.effect_module_names.has(expression.text)\n\t\t);\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn false;\n\t}\n\n\tif (expression.name.text !== \"Effect\") {\n\t\treturn false;\n\t}\n\n\tif (!ts.isIdentifier(expression.expression)) {\n\t\treturn false;\n\t}\n\n\treturn context.bindings.effect_package_names.has(expression.expression.text);\n}\n\nfunction get_property_name(name: ts.PropertyName): string | undefined {\n\tif (ts.isIdentifier(name) || ts.isStringLiteral(name)) {\n\t\treturn name.text;\n\t}\n\n\treturn undefined;\n}\n\nfunction is_callback_expression(node: ts.Node): node is ts.ArrowFunction | ts.FunctionExpression {\n\treturn ts.isArrowFunction(node) || ts.isFunctionExpression(node);\n}\n\nfunction is_non_generator_callback_with_top_level_yield(\n\tnode: ts.Node,\n): node is ts.ArrowFunction | ts.FunctionExpression {\n\tif (!is_callback_expression(node)) {\n\t\treturn false;\n\t}\n\n\tif (ts.isFunctionExpression(node) && node.asteriskToken) {\n\t\treturn false;\n\t}\n\n\treturn contains_top_level_yield_star(node.body);\n}\n\nfunction is_async_function(node: ts.ArrowFunction | ts.FunctionExpression): boolean {\n\treturn (\n\t\tnode.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword) ?? false\n\t);\n}\n\nfunction to_expr_pos(pos: number, context: RewriteContext): number {\n\treturn pos - context.offset;\n}\n","import { AsyncEffectInEventCallbackError, YieldStarInEventCallbackError } from \"$/errors.ts\";\nimport type { EffectCallbackRewriteContext } from \"./effect-bindings.ts\";\nimport {\n\tanalyze_event_body_yield_star,\n\tcollect_free_identifiers,\n\tis_callback_function_expression,\n} from \"./expressions.ts\";\nimport { normalize_effect_callback_yields } from \"./effect-callbacks.ts\";\nimport type {\n\tHelperDeclaration,\n\tMarkupCandidate,\n\tMarkupHelperBindings,\n\tMarkupNameAllocator,\n\tMarkupTransformTarget,\n\tPendingRelocation,\n\tReplacement,\n\tTagKind,\n} from \"./types.ts\";\n\n/**\n * Emits source edits for classified markup Effect expressions.\n *\n * @since 2.0.0\n * @param classified - Candidates paired with their Svelte markup context.\n * @param effect_context - Effect import bindings available to markup\n * expression rewrites.\n * @returns Replacements ready to apply to the original component source.\n */\nexport function emit_replacements(\n\tclassified: Array<{ candidate: MarkupCandidate; kind: TagKind }>,\n\teffect_context: EffectCallbackRewriteContext,\n\thelper_bindings: MarkupHelperBindings,\n\tname_allocator: MarkupNameAllocator,\n\ttarget: MarkupTransformTarget,\n): Replacement[] {\n\treturn classified.map(({ candidate, kind }) =>\n\t\temit_replacement(candidate, kind, effect_context, helper_bindings, name_allocator, target),\n\t);\n}\n\nfunction emit_replacement(\n\tcandidate: MarkupCandidate,\n\tkind: TagKind,\n\teffect_context: EffectCallbackRewriteContext,\n\thelper_bindings: MarkupHelperBindings,\n\tname_allocator: MarkupNameAllocator,\n\ttarget: MarkupTransformTarget,\n): Replacement {\n\tconst normalized = normalize_effect_callback_yields(candidate.expr_text, effect_context);\n\tconst normalized_candidate = {\n\t\t...candidate,\n\t\texpr_text: normalized.expr_text,\n\t};\n\tconst id = make_cache_id(candidate);\n\tconst id_text = JSON.stringify(id);\n\tconst helper_name = make_helper_name(candidate, name_allocator);\n\tconst is_server_target = target === \"server\";\n\n\tlet replacement_text: string;\n\tlet helpers: HelperDeclaration[];\n\tlet relocation: PendingRelocation | undefined;\n\n\tif (kind === \"await\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_promise_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\t\"undefined\",\n\t\t\t`{ ssr: \"pending\" }`,\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"render\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_render_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\tcandidate,\n\t\t\thelper_bindings,\n\t\t\tis_server_target,\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"render_argument\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"undefined\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"each\") {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"[]\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t} else if (kind === \"event\") {\n\t\tconst event = make_event_handler(normalized_candidate, helper_bindings);\n\n\t\treplacement_text = event.text;\n\t\thelpers = normalized.helpers;\n\t\trelocation = make_relocation(candidate, replacement_text, {\n\t\t\toriginalStart: 0,\n\t\t\toriginalEnd: candidate.expr_text.length,\n\t\t\tgeneratedText: event.expr_text,\n\t\t});\n\t} else {\n\t\tconst effect = make_effect_helper(normalized_candidate, helper_name);\n\n\t\treplacement_text = emit_await_expression(\n\t\t\tid_text,\n\t\t\teffect,\n\t\t\thelper_bindings,\n\t\t\tserver_fallback(is_server_target, \"undefined\"),\n\t\t);\n\t\thelpers = [...normalized.helpers, effect.helper];\n\t}\n\n\treturn {\n\t\tstart: candidate.start,\n\t\tend: candidate.end,\n\t\ttext: replacement_text,\n\t\thelpers,\n\t\trelocation,\n\t};\n}\n\nfunction make_event_handler(\n\tcandidate: MarkupCandidate,\n\thelper_bindings: MarkupHelperBindings,\n): { text: string; expr_text: string } {\n\tconst expr_text = candidate.expr_text;\n\n\tif (is_callback_function_expression(expr_text)) {\n\t\tthrow new YieldStarInEventCallbackError(candidate.filename, expr_text);\n\t}\n\n\tconst analysis = analyze_event_body_yield_star(expr_text);\n\n\tif (analysis.has_nested_invalid_yield_star) {\n\t\tthrow new AsyncEffectInEventCallbackError(candidate.filename, expr_text);\n\t}\n\n\treturn {\n\t\texpr_text,\n\t\ttext: `(event) => { ${helper_bindings.dispatcher}.emit({ type: ${helper_bindings.codes}.Markup.Run, fn: function* () { ${expr_text}; } }); }`,\n\t};\n}\n\nfunction emit_promise_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\thelper_bindings: MarkupHelperBindings,\n\tssr_fallback?: string,\n\toptions?: string,\n): string {\n\tconst properties = [\n\t\t`type: ${helper_bindings.codes}.Markup.Promise`,\n\t\t`id: ${id_text}`,\n\t\t`deps: ${effect.deps_text}`,\n\t\t`fn: () => ${effect.call}`,\n\t\tssr_fallback !== undefined && `ssr_fallback: ${ssr_fallback}`,\n\t\toptions !== undefined && `options: ${options}`,\n\t].filter((property): property is string => property !== false);\n\n\treturn `${helper_bindings.dispatcher}.emit({ ${properties.join(\", \")} })`;\n}\n\nfunction emit_render_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\tcandidate: MarkupCandidate,\n\thelper_bindings: MarkupHelperBindings,\n\tis_server_target: boolean,\n): string {\n\tconst expression = emit_promise_expression(\n\t\tid_text,\n\t\teffect,\n\t\thelper_bindings,\n\t\tserver_fallback(is_server_target, `() => undefined`),\n\t);\n\n\tif (/^\\s*yield\\s*\\*/.test(candidate.expr_text)) {\n\t\treturn `(await ${expression})()`;\n\t}\n\n\treturn `await ${expression}`;\n}\n\nfunction emit_await_expression(\n\tid_text: string,\n\teffect: EffectHelper,\n\thelper_bindings: MarkupHelperBindings,\n\tssr_fallback?: string,\n): string {\n\treturn `await ${emit_promise_expression(id_text, effect, helper_bindings, ssr_fallback)}`;\n}\n\nfunction server_fallback(is_server_target: boolean, fallback: string): string | undefined {\n\treturn is_server_target ? fallback : undefined;\n}\n\ninterface EffectHelper {\n\thelper: HelperDeclaration;\n\tcall: string;\n\tdeps_text: string;\n}\n\nfunction make_effect_helper(candidate: MarkupCandidate, helper_name: string): EffectHelper {\n\tconst deps = collect_free_identifiers(candidate.expr_text);\n\tconst args_text = deps.join(\", \");\n\tconst deps_text = deps.length === 0 ? \"[]\" : `[${args_text}]`;\n\tconst call = `${helper_name}()`;\n\tconst text = `function* ${helper_name}() { return (${candidate.expr_text}); }`;\n\tconst generated_start = text.indexOf(candidate.expr_text);\n\n\treturn {\n\t\tcall,\n\t\tdeps_text,\n\t\thelper: {\n\t\t\ttext,\n\t\t\trelocation: {\n\t\t\t\toriginalStart: candidate.start,\n\t\t\t\toriginalEnd: candidate.end,\n\t\t\t\tgeneratedStartInReplacement: generated_start,\n\t\t\t\tgeneratedEndInReplacement: generated_start + candidate.expr_text.length,\n\t\t\t},\n\t\t},\n\t};\n}\n\nfunction make_cache_id(candidate: MarkupCandidate): string {\n\tconst normalized_filename = candidate.filename.replace(/[?#].*$/, \"\");\n\n\treturn `${normalized_filename}:${candidate.start}:${candidate.end}`;\n}\n\nfunction make_helper_name(candidate: MarkupCandidate, name_allocator: MarkupNameAllocator): string {\n\treturn name_allocator.reserve(`__SER___markup_effect_${candidate.start}_${candidate.end}`);\n}\n\nfunction make_relocation(\n\tcandidate: MarkupCandidate,\n\treplacement_text: string,\n\tinner: {\n\t\toriginalStart: number;\n\t\toriginalEnd: number;\n\t\tgeneratedText: string;\n\t},\n): PendingRelocation | undefined {\n\tconst generated_start = replacement_text.indexOf(inner.generatedText);\n\n\tif (generated_start === -1) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\toriginalStart: candidate.start + inner.originalStart,\n\t\toriginalEnd: candidate.start + inner.originalEnd,\n\t\tgeneratedStartInReplacement: generated_start,\n\t\tgeneratedEndInReplacement: generated_start + inner.generatedText.length,\n\t};\n}\n","import type MagicString from \"magic-string\";\nimport type ts from \"typescript\";\n\n/**\n * Creates a source map from transformed script back to the original block.\n *\n * @since 2.0.0\n * @param magic - MagicString instance holding the transformed source.\n * @param filename - Source filename used for the source map entry.\n * @returns A plain source map object.\n */\nexport function create_source_map(magic: MagicString, filename: string): Record<string, unknown> {\n\tconst map = magic.generateMap({\n\t\thires: true,\n\t\tincludeContent: true,\n\t\tsource: filename,\n\t});\n\n\treturn map as unknown as Record<string, unknown>;\n}\n\n/**\n * Slices a substring matching a node's full source range.\n *\n * @since 2.0.0\n * @param content - Original source text.\n * @param node - AST node whose full range should be extracted.\n * @returns Source text including leading trivia.\n */\nexport function slice(content: string, node: ts.Node): string {\n\treturn content.slice(node.getFullStart(), node.end);\n}\n\n/**\n * Slices a substring matching a node's source range without leading trivia.\n *\n * @since 2.0.0\n * @param content - Original source text.\n * @param node - AST node whose non-trivia range should be extracted.\n * @returns Source text excluding leading trivia.\n */\nexport function slice_start(content: string, node: ts.Node): string {\n\treturn content.slice(node.getStart(), node.end);\n}\n","import { contains_top_level_yield_star } from \"$/detect.ts\";\nimport { AsyncEffectInSyncRuneError } from \"$/errors.ts\";\nimport { slice } from \"./source.ts\";\n\nimport ts from \"typescript\";\n\nconst ASYNC_EXPRESSION_RUNES = new Set([\n\t\"$derived\",\n\t\"$state\",\n\t\"$state.raw\",\n\t\"$state.snapshot\",\n\t\"$bindable\",\n]);\n\nconst CALLBACK_RUNES = new Set([\"$derived.by\", \"$effect\", \"$effect.pre\", \"$effect.root\"]);\n\n/**\n * Validates that `yield*` only appears in rune positions the script-effect\n * transform can lower without changing the rune's normal Svelte contract.\n *\n * @since 2.0.0\n * @param node - AST node to scan.\n * @param content - Original script source used for diagnostics.\n * @param filename - Source filename used for diagnostics.\n * @returns Nothing.\n */\nexport function validate_rune_yield_usage(node: ts.Node, content: string, filename: string): void {\n\tvisit_rune_yield_usage(node, content, filename);\n}\n\nfunction visit_rune_yield_usage(node: ts.Node, content: string, filename: string): void {\n\tif (ts.isCallExpression(node)) {\n\t\tvalidate_call_expression(node, content, filename);\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tvisit_rune_yield_usage(child, content, filename);\n\t});\n}\n\nfunction validate_call_expression(\n\tcall: ts.CallExpression,\n\tcontent: string,\n\tfilename: string,\n): void {\n\tconst rune_name = get_rune_name(call.expression);\n\n\tif (!rune_name) {\n\t\treturn;\n\t}\n\n\tif (!ASYNC_EXPRESSION_RUNES.has(rune_name) && contains_top_level_yield_star(call)) {\n\t\tthrow new AsyncEffectInSyncRuneError(rune_name, slice(content, call), filename);\n\t}\n\n\tif (!CALLBACK_RUNES.has(rune_name)) {\n\t\treturn;\n\t}\n\n\tconst callback = call.arguments[0];\n\n\tif (!callback || !callback_has_top_level_yield_star(callback)) {\n\t\treturn;\n\t}\n\n\tthrow new AsyncEffectInSyncRuneError(rune_name, slice(content, call), filename);\n}\n\nfunction callback_has_top_level_yield_star(node: ts.Expression): boolean {\n\tif ((ts.isArrowFunction(node) || ts.isFunctionExpression(node)) && node.body !== undefined) {\n\t\treturn contains_top_level_yield_star(node.body);\n\t}\n\n\treturn contains_top_level_yield_star(node);\n}\n\nfunction get_rune_name(expr: ts.Expression): string | undefined {\n\tif (ts.isIdentifier(expr) && is_rune_root(expr.text)) {\n\t\treturn expr.text;\n\t}\n\n\tif (!ts.isPropertyAccessExpression(expr)) {\n\t\treturn undefined;\n\t}\n\n\tconst root_name = get_rune_name(expr.expression);\n\n\tif (!root_name) {\n\t\treturn undefined;\n\t}\n\n\treturn `${root_name}.${expr.name.text}`;\n}\n\nfunction is_rune_root(name: string): boolean {\n\treturn (\n\t\tname === \"$bindable\" ||\n\t\tname === \"$derived\" ||\n\t\tname === \"$effect\" ||\n\t\tname === \"$host\" ||\n\t\tname === \"$inspect\" ||\n\t\tname === \"$props\" ||\n\t\tname === \"$state\"\n\t);\n}\n","import ts from \"typescript\";\n\n/**\n * Checks whether a node is a `yield*` binary expression.\n *\n * @since 2.0.0\n * @param node - TypeScript AST node to check.\n * @returns Whether the node represents `yield * operand`.\n */\nexport function is_yield_star_expression(node: ts.Node): boolean {\n\treturn (\n\t\tts.isBinaryExpression(node) &&\n\t\tnode.operatorToken.kind === ts.SyntaxKind.AsteriskToken &&\n\t\tts.isIdentifier(node.left) &&\n\t\tnode.left.text === \"yield\"\n\t);\n}\n\n/**\n * Checks whether a node owns its own yield semantics.\n *\n * @since 2.0.0\n * @param node - TypeScript AST node to check.\n * @returns Whether traversal should stop at this function boundary.\n */\nexport function is_function_boundary_node(node: ts.Node): boolean {\n\treturn (\n\t\tts.isArrowFunction(node) ||\n\t\tts.isFunctionDeclaration(node) ||\n\t\tts.isFunctionExpression(node) ||\n\t\tts.isMethodDeclaration(node) ||\n\t\tts.isGetAccessorDeclaration(node) ||\n\t\tts.isSetAccessorDeclaration(node)\n\t);\n}\n\n/**\n * Returns `true` if the node tree contains a top-level `await`.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @returns Whether a top-level await expression was found.\n */\nexport function contains_top_level_await(node: ts.Node): boolean {\n\tif (ts.isAwaitExpression(node)) {\n\t\treturn true;\n\t}\n\n\treturn node\n\t\t.getChildren()\n\t\t.some((child) => !is_function_boundary_node(child) && contains_top_level_await(child));\n}\n\n/**\n * Collects top-level `yield*` nodes under an expression.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @param on_found - Callback invoked for each matching yield node.\n * @returns Nothing.\n */\nexport function collect_yield_star_nodes(node: ts.Node, on_found: (node: ts.Node) => void): void {\n\tif (is_function_boundary_node(node)) {\n\t\treturn;\n\t}\n\n\tif (is_yield_star_expression(node)) {\n\t\ton_found(node);\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tcollect_yield_star_nodes(child, on_found);\n\t});\n}\n\n/**\n * Finds the first top-level `yield*` expression below a node.\n *\n * @since 2.0.0\n * @param node - Root node to search.\n * @param on_found - Callback invoked with the first matching node.\n * @returns Nothing.\n */\nexport function find_yield_star_node(node: ts.Node, on_found: (node: ts.Node) => void): void {\n\tif (is_function_boundary_node(node)) {\n\t\treturn;\n\t}\n\n\tif (is_yield_star_expression(node)) {\n\t\ton_found(node);\n\t\treturn;\n\t}\n\n\tnode.forEachChild((child) => {\n\t\tfind_yield_star_node(child, on_found);\n\t});\n}\n\n/**\n * Extracts identifier names from a TypeScript binding name.\n *\n * @since 2.0.0\n * @param name - Binding name node to flatten.\n * @returns Identifier names from identifiers and destructuring patterns.\n */\nexport function extract_binding_names(name: ts.BindingName): string[] {\n\tif (ts.isIdentifier(name)) {\n\t\treturn [name.text];\n\t}\n\n\tconst result: string[] = [];\n\n\tfor (const element of name.elements) {\n\t\tif (ts.isOmittedExpression(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult.push(...extract_binding_names(element.name));\n\t}\n\n\treturn result;\n}\n","import { validate_rune_yield_usage } from \"$/script-transform/runes.ts\";\nimport { collect_yield_star_nodes } from \"$/script-transform/ast.ts\";\nimport { contains_top_level_yield_star } from \"$/detect.ts\";\nimport { analyze_event_body_yield_star, strip_arrow_function } from \"./expressions.ts\";\nimport { HELPERS } from \"./constants.ts\";\nimport type { MarkupCandidate, TagKind } from \"./types.ts\";\n\nimport MagicString from \"magic-string\";\n\nimport ts from \"typescript\";\n\ninterface SanitizeResult {\n\tcode: string;\n\tcandidates: MarkupCandidate[];\n}\n\ninterface DeclarationYieldExpression {\n\tstart: number;\n\tend: number;\n\texpr_text: string;\n}\n\ninterface SourceRange {\n\tstart: number;\n\tend: number;\n}\n\n/**\n * Replaces markup `yield*` expressions with placeholders before Svelte parses\n * the component.\n *\n * @example\n * ```ts\n * const sanitized = sanitize_markup(\n * `<p>{yield* loadLabel()}</p>`,\n * \"Label.svelte\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param content - Raw Svelte component source to scan for effectful markup\n * expressions.\n * @param filename - Source filename used when validation errors need to point\n * back to the component being transformed.\n * @returns Sanitized source plus placeholder candidates that should be lowered\n * after Svelte classifies their markup positions.\n */\nexport function sanitize_markup(content: string, filename: string): SanitizeResult {\n\tconst candidates: MarkupCandidate[] = [];\n\tconst excluded_ranges = collect_excluded_ranges(content);\n\tconst magic = new MagicString(content);\n\tlet helper_index = 0;\n\tlet cursor = 0;\n\n\twhile (cursor < content.length) {\n\t\tconst open = content.indexOf(\"{\", cursor);\n\t\tif (open === -1) break;\n\n\t\t/** Skip braces inside <script> and <style> blocks. */\n\t\tconst excluded_range = find_excluded_range(excluded_ranges, open);\n\n\t\tif (excluded_range) {\n\t\t\tcursor = excluded_range.end;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** Find the matching closing brace. */\n\t\tconst close = find_closing_brace(content, open + 1);\n\t\tif (close === -1) {\n\t\t\tcursor = open + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst inner = content.slice(open + 1, close);\n\n\t\tconst trimmed = inner.trimStart();\n\t\tconst leading_ws = inner.length - trimmed.length;\n\n\t\tconst tag_info = get_tag_info(trimmed);\n\n\t\tconst declaration_yields = collect_declaration_yield_expressions(\n\t\t\tcontent,\n\t\t\topen,\n\t\t\tleading_ws,\n\t\t\ttrimmed,\n\t\t\tfilename,\n\t\t);\n\n\t\tif (declaration_yields.length > 0) {\n\t\t\tfor (const declaration_yield of declaration_yields) {\n\t\t\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\t\t\thelper_index += 1;\n\n\t\t\t\tcandidates.push({\n\t\t\t\t\tplaceholder,\n\t\t\t\t\tstart: declaration_yield.start,\n\t\t\t\t\tend: declaration_yield.end,\n\t\t\t\t\texpr_text: declaration_yield.expr_text,\n\t\t\t\t\tfilename,\n\t\t\t\t\tkey: \"plain\",\n\t\t\t\t});\n\n\t\t\t\tmagic.overwrite(declaration_yield.start, declaration_yield.end, placeholder);\n\t\t\t}\n\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet expr_body = trimmed.slice(tag_info.prefix_length);\n\n\t\t/** For @const, only use the RHS after `=` as the expression body. */\n\t\tconst equal_idx =\n\t\t\ttag_info.kind === \"plain\" && trimmed.startsWith(\"@const \")\n\t\t\t\t? expr_body.indexOf(\"=\")\n\t\t\t\t: -1;\n\n\t\t/** Check if this is a callback handler containing yield*. */\n\t\tconst is_event_callback = is_event_callback_expression(inner);\n\n\t\t/** Determine if this brace contains yield* that needs lowering. */\n\t\tconst event_yield = is_event_callback ? analyze_event_yield(inner) : undefined;\n\t\tconst has_yield =\n\t\t\tevent_yield?.has_top_level_yield_star ?? contains_yield_star_in_text(expr_body);\n\n\t\tif (!has_yield) {\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** The expression starts after the tag prefix. For @const, after the `=`. */\n\t\tlet extra_prefix = 0;\n\n\t\tif (equal_idx !== -1) {\n\t\t\tconst after_eq_raw = expr_body.slice(equal_idx + 1);\n\t\t\texpr_body = after_eq_raw.trimStart();\n\t\t\textra_prefix = equal_idx + 1 + (after_eq_raw.length - expr_body.length);\n\t\t}\n\n\t\tconst expr_start = open + 1 + leading_ws + tag_info.prefix_length + extra_prefix;\n\n\t\t/** For each/await, the expression ends before ` as ` or ` then `/` catch `. */\n\t\tlet expr_end = close;\n\n\t\tconst key = tag_info.kind;\n\n\t\tif (key === \"each\") {\n\t\t\tconst as_idx = expr_body.lastIndexOf(\" as \");\n\t\t\tif (as_idx !== -1) expr_end = expr_start + as_idx;\n\t\t}\n\n\t\tif (key === \"await\") {\n\t\t\tconst then_idx = expr_body.indexOf(\" then \");\n\t\t\tconst catch_idx = expr_body.indexOf(\" catch \");\n\t\t\tconst boundary = Math.min(\n\t\t\t\tthen_idx === -1 ? Infinity : then_idx,\n\t\t\t\tcatch_idx === -1 ? Infinity : catch_idx,\n\t\t\t);\n\t\t\tif (boundary !== Infinity) expr_end = expr_start + boundary;\n\t\t}\n\n\t\tconst expr_text = content.slice(expr_start, expr_end).trim();\n\n\t\tif (expr_text.length === 0) {\n\t\t\tcursor = close + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tvalidate_expression_yield_usage(expr_text, filename);\n\n\t\tif (key === \"render\" && !/^\\s*yield\\s*\\*/.test(expr_text)) {\n\t\t\tconst render_arg_yields = collect_expression_yield_expressions(\n\t\t\t\tcontent,\n\t\t\t\texpr_start,\n\t\t\t\texpr_text,\n\t\t\t\tfilename,\n\t\t\t);\n\n\t\t\tif (render_arg_yields.length > 0) {\n\t\t\t\tfor (const render_arg_yield of render_arg_yields) {\n\t\t\t\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\t\t\t\thelper_index += 1;\n\n\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\tstart: render_arg_yield.start,\n\t\t\t\t\t\tend: render_arg_yield.end,\n\t\t\t\t\t\texpr_text: render_arg_yield.expr_text,\n\t\t\t\t\t\tfilename,\n\t\t\t\t\t\tkey: \"render_argument\",\n\t\t\t\t\t});\n\n\t\t\t\t\tmagic.overwrite(render_arg_yield.start, render_arg_yield.end, placeholder);\n\t\t\t\t}\n\n\t\t\t\tcursor = close + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t/** Create a placeholder and replace the expression (preserving tag prefixes). */\n\t\tconst placeholder = `__SER___markup_placeholder_${helper_index}`;\n\t\thelper_index += 1;\n\n\t\tcandidates.push({\n\t\t\tplaceholder,\n\t\t\tstart: expr_start,\n\t\t\tend: expr_end,\n\t\t\texpr_text,\n\t\t\tfilename,\n\t\t\tkey,\n\t\t});\n\n\t\tmagic.overwrite(expr_start, expr_end, key === \"render\" ? `${placeholder}()` : placeholder);\n\n\t\tcursor = close + 1;\n\t}\n\n\treturn { code: magic.toString(), candidates };\n}\n\nfunction collect_expression_yield_expressions(\n\tcontent: string,\n\texpr_start: number,\n\texpr_text: string,\n\tfilename: string,\n): DeclarationYieldExpression[] {\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-expression.ts\",\n\t\t`const __SER___expr = ${expr_text};`,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt || !ts.isVariableStatement(stmt)) {\n\t\treturn [];\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_file.text, filename);\n\n\tconst initializer = stmt.declarationList.declarations[0]?.initializer;\n\n\tif (!initializer || !contains_top_level_yield_star(initializer)) {\n\t\treturn [];\n\t}\n\n\tconst prefix_length = source_file.text.indexOf(expr_text);\n\tconst expressions: DeclarationYieldExpression[] = [];\n\n\tcollect_yield_star_nodes(initializer, (yield_node) => {\n\t\tconst start = expr_start + yield_node.getStart(source_file) - prefix_length;\n\t\tconst end = expr_start + yield_node.end - prefix_length;\n\t\tconst yielded_text = content.slice(start, end).trim();\n\n\t\texpressions.push({\n\t\t\tstart,\n\t\t\tend,\n\t\t\texpr_text: yielded_text,\n\t\t});\n\t});\n\n\treturn expressions;\n}\n\nfunction collect_excluded_ranges(content: string): SourceRange[] {\n\tconst ranges = [\n\t\t...collect_tag_ranges(content, \"script\"),\n\t\t...collect_tag_ranges(content, \"style\"),\n\t\t...collect_html_comment_ranges(content),\n\t];\n\n\tranges.sort((a, b) => a.start - b.start);\n\n\treturn merge_ranges(ranges);\n}\n\nfunction collect_tag_ranges(content: string, tag: string): SourceRange[] {\n\tconst pattern = new RegExp(`<${tag}\\\\b[^>]*>([\\\\s\\\\S]*?)<\\\\/${tag}\\\\s*>`, \"gi\");\n\n\treturn [...content.matchAll(pattern)].flatMap((match) => {\n\t\tif (match.index === undefined) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tstart: match.index,\n\t\t\t\tend: match.index + match[0].length,\n\t\t\t},\n\t\t];\n\t});\n}\n\nfunction collect_html_comment_ranges(content: string): SourceRange[] {\n\tconst ranges: SourceRange[] = [];\n\tlet cursor = 0;\n\n\twhile (cursor < content.length) {\n\t\tconst start = content.indexOf(\"<!--\", cursor);\n\n\t\tif (start === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst close = content.indexOf(\"-->\", start + \"<!--\".length);\n\t\tconst end = close === -1 ? content.length : close + \"-->\".length;\n\n\t\tranges.push({ start, end });\n\n\t\tcursor = end;\n\t}\n\n\treturn ranges;\n}\n\nfunction merge_ranges(ranges: SourceRange[]): SourceRange[] {\n\tconst merged: SourceRange[] = [];\n\n\tfor (const range of ranges) {\n\t\tconst previous = merged.at(-1);\n\n\t\tif (!previous || range.start > previous.end) {\n\t\t\tmerged.push({ ...range });\n\t\t\tcontinue;\n\t\t}\n\n\t\tprevious.end = Math.max(previous.end, range.end);\n\t}\n\n\treturn merged;\n}\n\nfunction find_excluded_range(ranges: SourceRange[], pos: number): SourceRange | undefined {\n\tlet low = 0;\n\tlet high = ranges.length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = Math.floor((low + high) / 2);\n\t\tconst range = ranges[mid];\n\n\t\tif (pos <= range.start) {\n\t\t\thigh = mid - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (pos >= range.end) {\n\t\t\tlow = mid + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn range;\n\t}\n\n\treturn undefined;\n}\n\n/** Brace matching helpers for extracting complete markup expressions. */\n\nfunction find_closing_brace(content: string, start: number): number {\n\tlet depth = 0;\n\n\tfor (let i = start; i < content.length; i += 1) {\n\t\tconst ch = content[i];\n\n\t\tif (ch === \"{\" && content[i - 1] !== \"$\") {\n\t\t\tdepth += 1;\n\t\t} else if (ch === \"}\") {\n\t\t\tif (depth === 0) return i;\n\t\t\tdepth -= 1;\n\t\t} else if (ch === \"'\" || ch === '\"' || ch === \"`\") {\n\t\t\ti = skip_string(content, i, ch);\n\t\t\tif (i === -1) return -1;\n\t\t} else if (ch === \"/\" && content[i + 1] === \"/\") {\n\t\t\ti = skip_line_comment(content, i);\n\t\t} else if (ch === \"/\" && content[i + 1] === \"*\") {\n\t\t\ti = skip_block_comment(content, i);\n\t\t\tif (i === -1) return -1;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction skip_string(content: string, start: number, quote: string): number {\n\tfor (let i = start + 1; i < content.length; i += 1) {\n\t\tif (content[i] === \"\\\\\") {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (content[i] === quote) return i;\n\t}\n\treturn -1;\n}\n\nfunction skip_line_comment(content: string, start: number): number {\n\tfor (let i = start + 2; i < content.length; i += 1) {\n\t\tif (content[i] === \"\\n\") return i;\n\t}\n\treturn content.length;\n}\n\nfunction skip_block_comment(content: string, start: number): number {\n\tfor (let i = start + 2; i < content.length; i += 1) {\n\t\tif (content[i] === \"*\" && content[i + 1] === \"/\") return i + 1;\n\t}\n\treturn -1;\n}\n\ninterface TagInfo {\n\tkind: TagKind;\n\tprefix_length: number;\n}\n\nfunction get_tag_info(trimmed: string): TagInfo {\n\tif (trimmed.startsWith(\"#each \")) {\n\t\treturn { kind: \"each\", prefix_length: \"#each \".length };\n\t}\n\tif (trimmed.startsWith(\"#await \")) {\n\t\treturn { kind: \"await\", prefix_length: \"#await \".length };\n\t}\n\tif (trimmed.startsWith(\"@render \")) {\n\t\treturn { kind: \"render\", prefix_length: \"@render \".length };\n\t}\n\n\t/** Strip prefix-only tags — the expression starts after the tag keyword. */\n\tif (trimmed.startsWith(\"#if \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"#if \".length };\n\t}\n\tif (trimmed.startsWith(\":else if \")) {\n\t\treturn { kind: \"plain\", prefix_length: \":else if \".length };\n\t}\n\tif (trimmed.startsWith(\"#key \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"#key \".length };\n\t}\n\tif (trimmed.startsWith(\"@const \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@const \".length };\n\t}\n\tif (trimmed.startsWith(\"@html \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@html \".length };\n\t}\n\tif (trimmed.startsWith(\"@debug \")) {\n\t\treturn { kind: \"plain\", prefix_length: \"@debug \".length };\n\t}\n\n\treturn { kind: \"plain\", prefix_length: 0 };\n}\n\nfunction collect_declaration_yield_expressions(\n\tcontent: string,\n\topen: number,\n\tleading_ws: number,\n\ttrimmed: string,\n\tfilename: string,\n): DeclarationYieldExpression[] {\n\tif (!is_declaration_tag_text(trimmed)) {\n\t\treturn [];\n\t}\n\n\tconst source_text = `${trimmed};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"declaration-tag.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt || !ts.isVariableStatement(stmt)) {\n\t\treturn [];\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_text, filename);\n\n\tconst tag_start = open + 1 + leading_ws;\n\n\treturn stmt.declarationList.declarations.flatMap((decl) => {\n\t\tconst expressions: DeclarationYieldExpression[] = [];\n\n\t\tcollect_yield_star_nodes(decl, (yield_node) => {\n\t\t\tconst start = tag_start + yield_node.getStart(source_file);\n\t\t\tconst end = tag_start + yield_node.end;\n\t\t\tconst expr_text = content.slice(start, end).trim();\n\n\t\t\texpressions.push({\n\t\t\t\tstart,\n\t\t\t\tend,\n\t\t\t\texpr_text,\n\t\t\t});\n\t\t});\n\n\t\treturn expressions;\n\t});\n}\n\nfunction is_declaration_tag_text(trimmed: string): boolean {\n\treturn /^(?:const|let)\\s/.test(trimmed);\n}\n\nfunction validate_expression_yield_usage(expr_text: string, filename: string): void {\n\tconst source_text = `const __SER___expr = ${expr_text};`;\n\tconst source_file = ts.createSourceFile(\n\t\t\"markup-expression.ts\",\n\t\tsource_text,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst stmt = source_file.statements[0];\n\n\tif (!stmt) {\n\t\treturn;\n\t}\n\n\tvalidate_rune_yield_usage(stmt, source_text, filename);\n}\n\nfunction is_event_callback_expression(inner: string): boolean {\n\tconst trimmed = inner.trimStart();\n\n\treturn (\n\t\t/^(?:async\\s+)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>/.test(trimmed) ||\n\t\t/^(?:async\\s+)?function\\b/.test(trimmed)\n\t);\n}\n\nfunction analyze_event_yield(inner: string): {\n\thas_top_level_yield_star: boolean;\n} {\n\tconst event = strip_arrow_function(inner);\n\tconst analysis = analyze_event_body_yield_star(event.body);\n\tconst generated_run = new RegExp(\n\t\t`${HELPERS.dispatcher}(?:_\\\\d+)?\\\\.emit\\\\(\\\\{\\\\s*type:\\\\s*${HELPERS.codes}(?:_\\\\d+)?\\\\.Markup\\\\.Run`,\n\t);\n\n\tif (generated_run.test(event.body)) {\n\t\treturn {\n\t\t\thas_top_level_yield_star: false,\n\t\t};\n\t}\n\n\treturn {\n\t\thas_top_level_yield_star:\n\t\t\tanalysis.has_top_level_yield_star ||\n\t\t\tanalysis.has_nested_invalid_yield_star ||\n\t\t\t/\\byield\\s*\\*/.test(event.body),\n\t};\n}\n\nfunction contains_yield_star_in_text(text: string): boolean {\n\tif (!/\\byield\\s*\\*/.test(text)) return false;\n\n\ttry {\n\t\tconst sf = ts.createSourceFile(\n\t\t\t\"expr.ts\",\n\t\t\t`const x = ${text};`,\n\t\t\tts.ScriptTarget.Latest,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.TS,\n\t\t);\n\t\tconst stmt = sf.statements[0];\n\t\tif (!ts.isVariableStatement(stmt)) return false;\n\t\tconst decl = stmt.declarationList.declarations[0];\n\t\tif (!decl?.initializer) return false;\n\t\treturn contains_top_level_yield_star(decl.initializer);\n\t} catch {\n\t\treturn true;\n\t}\n}\n\n/** Free identifier collection helpers for generated closures. */\n","import {\n\tblank_script_blocks,\n\tcreate_relocations,\n\tcreate_source_map,\n\tinject_helpers,\n\tmake_markup_helper_bindings,\n} from \"./apply.ts\";\nimport type { MarkupTransformOptions, MarkupTransformResult } from \"./types.ts\";\nimport { collect_effect_callback_bindings } from \"./effect-bindings.ts\";\nimport { UnsupportedMarkupEffectPositionError } from \"$/errors.ts\";\nimport { classify_candidates } from \"./classify.ts\";\nimport { type AST, parse } from \"svelte/compiler\";\nimport { emit_replacements } from \"./emit.ts\";\nimport { sanitize_markup } from \"./scan.ts\";\n\nimport MagicString from \"magic-string\";\n\nexport type {\n\tMarkupRelocation,\n\tMarkupTransformOptions,\n\tMarkupTransformResult,\n\tMarkupTransformTarget,\n} from \"./types.ts\";\n\n/**\n * Transforms Svelte markup containing `{yield* expr}` brace expressions\n * into generated dispatcher events.\n *\n * Strategy: first find all brace expressions containing `yield*` via\n * character scanning, replace them with placeholder identifiers, then\n * parse the sanitized markup with Svelte's AST to determine the correct\n * context for each placeholder (plain expression, #each, #await, event\n * handler, etc.).\n *\n * @example\n * ```ts\n * const result = transform_markup_effect(\n * \"<button onclick={yield* save()}>Save</button>\",\n * \"SaveButton.svelte\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param content - The raw `.svelte` file content.\n * @param filename - The source filename, used in error messages.\n * @param options - Optional transform target configuration.\n * @returns The transformed markup and a flag indicating whether yield* was\n * found.\n */\nexport function transform_markup_effect(\n\tcontent: string,\n\tfilename: string,\n\toptions: MarkupTransformOptions = {},\n): MarkupTransformResult {\n\tif (!/\\byield\\s*\\*/.test(content)) {\n\t\treturn { code: content, has_yield: false };\n\t}\n\n\t/** Find all brace expressions containing yield* and replace with placeholders. */\n\tconst work = sanitize_markup(content, filename);\n\tconst effect_context = collect_effect_callback_bindings(content);\n\tconst helper_context = make_markup_helper_bindings(content);\n\n\tif (work.candidates.length === 0) {\n\t\treturn { code: content, has_yield: false };\n\t}\n\n\t/** Parse the sanitized markup with Svelte's AST. Strip <script> blocks\n\t * first so TypeScript syntax (import type, etc.) doesn't break the parser. */\n\tconst clean = blank_script_blocks(work.code);\n\tconst ast = parse(clean, { filename, modern: true }) as AST.Root;\n\n\t/** Match placeholders to their AST context and build replacements. */\n\tconst classified = classify_candidates(ast, work.candidates);\n\tconst matched = new Set(classified.map(({ candidate }) => candidate.placeholder));\n\tconst unmatched = work.candidates.find((candidate) => !matched.has(candidate.placeholder));\n\n\tif (unmatched) {\n\t\tthrow new UnsupportedMarkupEffectPositionError(filename, unmatched.expr_text);\n\t}\n\n\tconst replacements = emit_replacements(\n\t\tclassified,\n\t\teffect_context,\n\t\thelper_context.bindings,\n\t\thelper_context.name_allocator,\n\t\toptions.target ?? \"client\",\n\t);\n\tconst helpers = replacements.flatMap((replacement) => replacement.helpers ?? []);\n\n\tconst magic = new MagicString(content);\n\n\treplacements.sort((a, b) => b.start - a.start);\n\n\tfor (const r of replacements) {\n\t\tmagic.overwrite(r.start, r.end, r.text);\n\t}\n\n\tconst helper_insertion = inject_helpers(magic, content, helpers, helper_context.bindings);\n\tconst relocations = create_relocations(replacements, helper_insertion);\n\n\treturn {\n\t\tcode: magic.toString(),\n\t\thas_yield: true,\n\t\tmap: create_source_map(magic, filename),\n\t\trelocations,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAAgB,aACf,mBACA,uBACA,oBACA,WAAkC;CACjC,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,QAAQ;CACR,SAAS;CACT,SAAS;AACV,GACA,UAAgC,CAAC,GACxB;CACT,MAAM,mBAAmB,QAAQ,oBAAoB;CACrD,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,gBAAgB,QAAQ,iBAAiB;CAE/C,MAAM,oBACL,SAAS,eAAe,mBACrB,gFACA,8BAA8B,SAAS,WAAW;CAEtD,MAAM,iBACL,SAAS,YAAY,YAClB,sCACA,uBAAuB,SAAS,QAAQ;CAE5C,MAAM,gBAAgB,oBACnB,QACA,SAAS,WAAW,WACnB,qCACA,sBAAsB,SAAS,OAAO;CAE1C,OAAO;EACN,oBAAoB,CAAC,yBAAyB;EAC9C,iBAAiB,CAAC,sBAAsB;EACxC,gBAAgB;CACjB,CAAC,CACC,OAAO,OAAO,CAAC,CACf,KAAK,IAAI;AACZ;;;;;;;;;;AAWA,SAAgB,yBACf,aACA,aACA,YACU;CACV,OAAO,YAAY,WAAW,MAAM,SAAS;EAC5C,IACC,CAAC,GAAG,oBAAoB,IAAI,KAC5B,CAAC,GAAG,gBAAgB,KAAK,eAAe,KACxC,KAAK,gBAAgB,SAAS,aAE9B,OAAO;EAGR,MAAM,SAAS,KAAK;EAEpB,IAAI,CAAC,UAAU,OAAO,YACrB,OAAO;EAGR,IAAI,OAAO,MAAM,SAAS,YACzB,OAAO;EAGR,MAAM,iBAAiB,OAAO;EAE9B,IAAI,CAAC,gBACJ,OAAO;EAGR,IAAI,GAAG,kBAAkB,cAAc,GACtC,OAAO,eAAe,KAAK,SAAS;EAGrC,OAAO,eAAe,SAAS,MAC7B,YAAY,CAAC,QAAQ,cAAc,QAAQ,KAAK,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