import { b as CLAIM, f as Computed, w as SEED } from "../children-s3nFjpLA.mjs"; //#region src/utilities/promise.d.ts /** * A `Promise` subclass that exposes its state as reactive signals. * * Prefer the {@link promise} factory for most use cases — it returns a * `ComputedPromise` that is both awaitable and callable as a signal. * Use `ReactivePromise` directly when you need the lower-level class — * for example, to wrap a promise and expose `.state`, `.value`, `.reason`, * and `.result` without the `Computed` callable interface. * * @example * ```ts * const rp = ReactivePromise.from(fetch("/api/data")); * * effect(() => { * if (rp.state === "fulfilled") console.log(rp.value); * }); * ``` */ declare class ReactivePromise extends Promise { #private; get state(): "pending" | "fulfilled" | "rejected"; get value(): T | undefined; get reason(): E | undefined; get result(): T | E | undefined; constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void); static from(p: Promise): ReactivePromise; /** * @internal Hydration seeding: settle the reactive state from a serialized * server snapshot. The underlying promise is untouched — when it actually * resolves or rejects, its handlers overwrite the seeded state * (stale-while-revalidate). `await` still waits for the real settlement. */ [SEED](value: unknown): void; /** * @internal Hydrate claim protocol: seed from the server record while the * underlying promise is still pending. The promise fired at construction — * there is no run to skip here (see `Async[CLAIM]` for that). */ [CLAIM](record: { value: unknown; } | undefined): void; } /** @internal Cross-instance-safe `ReactivePromise` detection. */ declare function isReactivePromiseLike(value: unknown): value is ReactivePromise; /** * A {@link ReactivePromise} that is also callable as a `Computed`. * * Invoking it (`p()`) reads the current `.result` — so it drops into any * reactive context that expects a zero-arg getter. */ type ComputedPromise = ReactivePromise & Computed; type Executor = (resolve: (value: T | PromiseLike) => void, reject: (reason?: E) => void) => void; /** * Wraps a promise, executor, or `ReactivePromise` into a `ComputedPromise` — * an object that is both awaitable like a regular Promise and reactive like a * `Computed` signal. * * **Awaitable:** `await promise(fetch(...))` resolves to the fulfilled value, * or rejects with the rejection reason, just like a native Promise. * * **Reactive:** calling the returned value as a function (`cp()`) reads the * current result inside an `effect` or `computed`, tracking it as a dependency. * Equivalent to `.result` — returns `undefined` while pending, the fulfilled * value when resolved, or the rejection reason when rejected. * * Reactive state is also accessible via: * - `.state` — `"pending" | "fulfilled" | "rejected"` * - `.value` — the resolved value (or `undefined` while pending) * - `.reason` — the rejection reason (or `undefined` while pending/fulfilled) * - `.result` — `T | E | undefined`; the resolved value, rejection reason, or `undefined` while pending */ declare function promise(p: ReactivePromise): ComputedPromise; declare function promise(p: Promise): ComputedPromise; declare function promise(executor: Executor): ComputedPromise; //#endregion export { ComputedPromise, ReactivePromise, isReactivePromiseLike, promise };