{"version":3,"file":"dvirus-js-angular-signals.mjs","sources":["../../../../packages/angular-signals/src/lib/utils/signals.utils.ts","../../../../packages/angular-signals/src/lib/utils/signal-notifier.ts","../../../../packages/angular-signals/src/lib/utils/try-catch.ts","../../../../packages/angular-signals/src/lib/utils/signal-debounce.ts","../../../../packages/angular-signals/src/lib/utils/writable-signal.ts","../../../../packages/angular-signals/src/lib/utils/signal-set.ts","../../../../packages/angular-signals/src/lib/utils/signal-map.ts","../../../../packages/angular-signals/src/lib/utils/signal-object.ts","../../../../packages/angular-signals/src/lib/utils/control-signal.ts","../../../../packages/angular-signals/src/dvirus-js-angular-signals.ts"],"sourcesContent":["import { isSignal, signal, Signal, WritableSignal } from '@angular/core';\nimport { ObjectType } from './object-type';\n\n\n/**\n * Represents an object where each property is a read-only Signal.\n * Useful for mapping state objects to their signal equivalents.\n */\nexport type SignalObj<T extends ObjectType = ObjectType> = {\n  [Key in keyof T]: Signal<T[Key]>;\n};\n\n/**\n * Represents an object where each property is a WritableSignal.\n * Allows for direct modification of the signal values within the object structure.\n */\nexport type SignalObjWritable<T extends ObjectType> = {\n  [Key in keyof T]: WritableSignal<T[Key]>;\n};\n\n/**\n * A type representing either a Signal of type T or the raw value of type T.\n * Useful for inputs that can accept both static values and reactive signals.\n */\nexport type SignalOrValue<T> = Signal<T> | T;\n\n/**\n * Represents an object where each property can be either a Signal of a certain type\n * or the raw value of that type.\n *\n * @template TValues The type of the values contained within the SignalOrValue properties.\n *                   Defaults to a union of ObjectType, string, number, or undefined.\n */\nexport type SignalOrValueObj<TValues = ObjectType | string | number | boolean | undefined> =\n  TValues extends object\n    ? { [Key in keyof TValues]: SignalOrValue<TValues[Key]> }\n    : Record<string, SignalOrValue<TValues>>;\n\n/**\n * Converts a plain object into a writable signal object.\n * Each property of the source object becomes a WritableSignal initialized with the property's value.\n *\n * @param src - The source object to convert.\n * @returns An object with the same keys as the source, but with values wrapped in WritableSignals.\n */\nexport function toSignalObj<T extends ObjectType>(src: T): SignalObjWritable<T> {\n  return Object.entries(src).reduce(\n    (prev, [key, value]) => ({ ...prev, [key]: signal(value) }),\n    {} as SignalObjWritable<T>,\n  );\n}\n\n/**\n * Converts a signal object into a plain object.\n * Each property of the signal object becomes a value from the signal.\n *\n * @param src - The signal object to convert.\n * @returns An object with the same keys as the source, but with values from the signals.\n */\nexport function fromSignalObj<TData extends ObjectType>(src: SignalOrValueObj<TData>): TData {\n  return Object.entries(src).reduce<TData>(\n    (prev, [key, $value]) => ({ ...prev, [key]: signalOrValue($value) }),\n    {} as TData,\n  );\n}\n\n/**\n * Unwraps a value that might be a Signal.\n * If the input is a Signal, it returns the signal's value.\n * If the input is a raw value, it returns the value itself.\n *\n * @param value - The signal or value to unwrap.\n * @returns The raw value of type T.\n */\nexport function signalOrValue<T>(value: SignalOrValue<T>): T {\n  return isSignal(value) ? value() : value;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function signalOrFunction<T, FnArgs extends any[] = []>(\n  value: SignalOrValue<T> | ((...args: FnArgs) => T),\n  ...fnArgs: FnArgs\n): T {\n  let res = value;\n  if (isSignal(res)) {\n    res = res();\n  }\n  if (typeof res == 'function') {\n    res = (res as (...args: FnArgs[]) => T)(...fnArgs);\n  }\n\n  return res;\n}\n\n// function main() {\n//   const signalOrValue1: SignalOrValue<number> = signal(42);\n//   const signalOrValue2: SignalOrValue<string> = 'Hello, World!';\n\n//   console.log(signalOrValue(signalOrValue1)); // 42\n//   console.log(signalOrValue(signalOrValue2)); // \"Hello, World!\"\n\n//   // #############################################################\n\n//   const signalOrFunction1: SignalOrValue<number> | (() => number) = signal(100);\n//   const signalOrFunction2: SignalOrValue<number> | (() => number) = () => 200;\n//   const signalOrFunction3: SignalOrValue<number> | (() => number) = 300;\n//   const signalOrFunction4: SignalOrValue<number> | ((a: number, b: number) => number) = (a, b) => {\n//     return a + b;\n//   };\n\n//   console.log(signalOrFunction(signalOrFunction1)); // 100\n//   console.log(signalOrFunction(signalOrFunction2)); // 200\n//   console.log(signalOrFunction(signalOrFunction3)); // 300\n//   console.log(signalOrFunction(signalOrFunction4, 5, 10)); // 15\n\n//   // #############################################################\n\n//   const signalObj1: SignalObj<{ a: number; b: string }> = {\n//     a: signal(10),\n//     b: computed(() => 'Test'),\n//   };\n//   console.log(signalObj1); // { a: Signal<number>, b: Signal<string> }\n\n//   const signalObjWritable1: SignalObjWritable<{ a: number; b: string }> = toSignalObj({\n//     a: 10,\n//     b: 'Test',\n//   });\n//   console.log(signalObjWritable1); // { a: WritableSignal<number>, b: WritableSignal<string> }\n\n//   const plainObj1 = fromSignalObj(signalObj1);\n//   console.log(plainObj1); // { a: 10, b: 'Test' }\n\n//   const plainObj2 = fromSignalObj(signalObjWritable1);\n//   console.log(plainObj2); // { a: 10, b: 'Test' }\n// }\n","import { signal } from '@angular/core';\n\n/**\n * A function interface for a signal-based notification mechanism.\n * Calling the function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n */\nexport interface SignalNotifier {\n  (): number;\n  /**\n   * Triggers a notification by incrementing the internal signal value.\n   */\n  notify: () => void;\n}\n\n/**\n * Creates a signal-based notifier function.\n *\n * Each call to the returned function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n *\n * @returns {SignalNotifier} A notifier function with a `notify` method.\n *\n * @example\n * const notifier = signalNotifier();\n * effect(() => {\n *   notifier(); // Reacts to notifications\n * });\n * notifier.notify(); // Triggers the effect\n */\nexport function signalNotifier(): SignalNotifier {\n  const _signal = signal(0);\n\n  function get(): number {\n    return _signal();\n  }\n\n  get.notify = (): void => _signal.update((n) => n + 1);\n\n  return get;\n}\n","/**\n * Types for the result tuple with discriminated union\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n */\ntype TryResult<T, E = Error> = [T, null] | [null, E];\n\n/**\n * Main wrapper function to handle promise with try-catch\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n * @param {()=> T} fn - The function to handle\n * @returns {TryResult<T, E>} - A tuple with either the result or the error\n */\nexport function tryCatch<T, E = Error>(fn: () => T): TryResult<T, E> {\n  try {\n    const val = fn();\n    return [val, null];\n  } catch (error) {\n    return [null, error as E];\n  }\n}\n","import {\n  DestroyRef,\n  effect,\n  inject,\n  Injector,\n  Signal,\n  signal,\n  untracked,\n  WritableSignal,\n} from '@angular/core';\nimport { tryCatch } from './try-catch';\n\n/**\n * A writable signal enhanced with debounce capabilities.\n *\n * Extends `WritableSignal<T>` so it can be read and written like a normal signal,\n * but also exposes a `setDebounced` method that applies values after a configurable delay\n * and an `isLoading` signal that indicates whether a debounced update is pending.\n *\n * @typeParam T - The type of the signal's value.\n */\nexport interface SignalDebounce<T> extends WritableSignal<T> {\n  /** Sets the signal value after the configured debounce delay. */\n  setDebounced(value: T): void;\n  /** Reactive flag that is `true` while a debounced update is pending. */\n  isLoading: Signal<boolean>;\n}\n\n/**\n * Creates a debounced writable signal.\n *\n * The returned signal can be written to instantly via its `WritableSignal` interface\n * **or** through `setDebounced(value)` which delays the commit by `debounceTime` ms.\n * While a debounced write is pending, `isLoading()` returns `true`.\n *\n * If a reactive `params` function is supplied, the signal will also track that\n * source and debounce upstream changes (requires an injection context).\n *\n * @typeParam T - The type of the signal's value.\n * @param options - Configuration object.\n * @param options.source - Optional reactive source function whose return value\n *   is tracked and debounced into the signal.\n * @param options.debounceTime - Delay in milliseconds before a debounced value\n *   is committed.\n * @param options.initialValue - Optional initial value for the signal.\n * @param options.injector - Optional Angular `Injector` to use for setting up\n *   reactive tracking. Required if `source` is provided and this function is called\n *   outside of an injection context.\n * @returns A `SignalDebounce<T>` instance.\n *\n * @example\n * ```ts\n * // Simple debounced signal with an initial value\n * const search = signalDebounce<string>({ debounceTime: 300, initialValue: '' });\n * search.setDebounced('hello'); // commits after 300 ms\n *\n * // Tracking a reactive source\n * const query = signal('angular');\n * const debounced = signalDebounce({ source: () => query(), debounceTime: 500 });\n * ```\n */\nexport function signalDebounce<T>(options: {\n  source?: () => T;\n  debounceTime: number;\n  initialValue?: T;\n  injector?: unknown;\n}): SignalDebounce<T> {\n  const timeout = signal<ReturnType<typeof setTimeout> | null>(null);\n  const isLoading = signal(false);\n  const _sig = signal(options.initialValue) as WritableSignal<T>;\n\n  const scheduleDebounce = (value: T): void => {\n    clearPendingTimeout(timeout);\n    isLoading.set(true);\n    timeout.set(\n      setTimeout(() => {\n        isLoading.set(false);\n        _sig.set(value);\n      }, options.debounceTime),\n    );\n  };\n\n  if (options.source) {\n    trackSource({\n      source: options.source,\n      scheduleDebounce,\n      timeout,\n      injector: options.injector as Injector,\n    });\n  }\n\n  return Object.assign(_sig, {\n    setDebounced: scheduleDebounce,\n    isLoading: isLoading.asReadonly(),\n  }) as SignalDebounce<T>;\n}\n\n/**\n * Clears a pending debounce timeout if one exists.\n * @internal\n */\nfunction clearPendingTimeout(\n  timeout: WritableSignal<ReturnType<typeof setTimeout> | null>,\n): void {\n  const t = timeout();\n  if (t) clearTimeout(t);\n}\n\n/**\n * Sets up an effect that tracks a reactive source and debounces its changes.\n *\n * Requires an Angular injection context. If called outside one, logs a warning\n * and returns without setting up tracking (manual `setDebounced` still works).\n *\n * @typeParam T - The type of the source value.\n * @param source - Reactive function to track.\n * @param scheduleDebounce - Callback that schedules a debounced write.\n * @param timeout - Shared timeout handle for cleanup on destroy.\n * @internal\n */\nfunction trackSource<T>({\n  source,\n  scheduleDebounce,\n  timeout,\n  injector,\n}: {\n  source: () => T;\n  scheduleDebounce: (value: T) => void;\n  timeout: WritableSignal<ReturnType<typeof setTimeout> | null>;\n  injector?: Injector;\n}): void {\n  if (!isInInjectionContext() && !injector) {\n    console.error(\n      'Warning: signalDebounce is being used outside of an injection context. The debounced signal will not update based on the provided signal.\\n\\n',\n      \"Still can be used with manual value updates via setDebounced, but won't react to changes in the provided signal.\",\n    );\n    return;\n  }\n\n  const _injector = injector ?? inject(Injector);\n  const destroyRef = _injector.get(DestroyRef) ?? inject(DestroyRef);\n\n  effect(\n    () => {\n      const val = source();\n      untracked(() => scheduleDebounce(val));\n    },\n    { injector: _injector },\n  );\n\n  destroyRef.onDestroy(() => clearPendingTimeout(timeout));\n}\n\n/**\n * Checks if the current execution context has access to Angular's dependency injection.\n * @returns `true` when inside an injection context, `false` otherwise.\n * @internal\n */\nfunction isInInjectionContext(): boolean {\n  const [, error] = tryCatch(() => inject(DestroyRef));\n  return !error;\n}\n","import {\n  computed,\n  Signal,\n  signal,\n  untracked,\n  WritableSignal,\n} from '@angular/core';\n\n/**\n * Type for value equality comparison function\n */\ntype ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * Creates a `WritableSignal` whose value is derived from a computation function,\n * but can also be overridden manually via `.set()` / `.update()`.\n * When the reactive dependencies inside the computation change, the signal resets to the new derived value.\n *\n * Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param computation - A computation function that returns the derived value\n * @param options - Optional configuration (equal, debugName)\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<D>(\n  computation: () => D,\n  options?: {\n    equal?: ValueEqualityFn<D>;\n    debugName?: string;\n  },\n): WritableSignal<D>;\n\n/**\n *  Creates a `WritableSignal` with explicit source tracking and computation.\n *  The `source` function provides the reactive dependencies, and the `computation` function derives the value from the source.\n *  Manual overrides via `.set()` / `.update()` are only valid for the specific source state they were set against.\n *\n *  Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param options - Configuration object with source tracking and computation\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<S, D>(options: {\n  source: () => S;\n  computation: (source: S, previous?: { source: S; value: D }) => D;\n  equal?: ValueEqualityFn<D>;\n  debugName?: string;\n}): WritableSignal<D>;\n\nexport function writableSignal<D, S = unknown>(\n  computationOrOptions:\n    | (() => D)\n    | {\n        source: () => S;\n        computation: (source: S, previous?: { source: S; value: D }) => D;\n        equal?: ValueEqualityFn<D>;\n        debugName?: string;\n      },\n  maybeOptions?: {\n    equal?: ValueEqualityFn<D>;\n    debugName?: string;\n  },\n): WritableSignal<D> {\n  // Determine if input is a function or options object\n  const isFunction = typeof computationOrOptions === 'function';\n\n  if (isFunction) {\n    return writableSignalFunctionOverload(computationOrOptions, maybeOptions);\n  } else {\n    return writableSignalOptionsOverload(computationOrOptions);\n  }\n}\n\nfunction writableSignalFunctionOverload<D>(\n  computation: () => D,\n  options?: {\n    equal?: ValueEqualityFn<D>;\n    debugName?: string;\n  },\n): WritableSignal<D> {\n  // Create a fresh token whenever the source recomputes, even if the value is equal.\n  const sourceState = computed(() => ({ value: computation() }), {\n    equal: (a, b) =>\n      options?.equal ? options.equal(a.value, b.value) : a.value === b.value,\n  });\n\n  // Manual overrides are only valid for the source-state token they were set against.\n  const override = signal<{ state: { value: D }; value: D } | undefined>(\n    undefined,\n  );\n\n  const result = computed<D>(\n    () => {\n      const state = sourceState();\n      const currentOverride = override();\n      if (currentOverride !== undefined && currentOverride.state === state) {\n        return currentOverride.value;\n      }\n      return state.value;\n    },\n    { equal: options?.equal },\n  );\n\n  return Object.assign(result, {\n    set(v: D): void {\n      override.set({ state: untracked(sourceState), value: v });\n    },\n    update(updater: (value: D) => D): void {\n      override.set({\n        state: untracked(sourceState),\n        value: updater(untracked(result)),\n      });\n    },\n    asReadonly(): Signal<D> {\n      return result;\n    },\n  }) as WritableSignal<D>;\n}\n\nfunction writableSignalOptionsOverload<S, D>(options: {\n  source: () => S;\n  computation: (source: S, previous?: { source: S; value: D }) => D;\n  equal?: ValueEqualityFn<D>;\n  debugName?: string;\n}): WritableSignal<D> {\n  let previousState: { source: S; value: D } | undefined;\n  const sourceState = computed(() => ({ value: options.source() }));\n  const override = signal<{ state: { value: D }; value: D } | undefined>(\n    undefined,\n  );\n\n  const result = computed<D>(\n    () => {\n      const state = sourceState();\n\n      const currentOverride = override();\n\n      if (\n        currentOverride !== undefined &&\n        (currentOverride.state as unknown as { value: S }) === state\n      ) {\n        // Update previous state for next computation\n        previousState = { source: state.value, value: currentOverride.value };\n        return currentOverride.value;\n      }\n\n      const computedValue = options.computation(state.value, previousState);\n\n      // Update previous state for next computation\n      previousState = { source: state.value, value: computedValue };\n\n      return computedValue;\n    },\n    { equal: options.equal },\n  );\n\n  return Object.assign(result, {\n    set(v: D): void {\n      override.set({\n        state: untracked(sourceState) as unknown as { value: D },\n        value: v,\n      });\n    },\n    update(updater: (value: D) => D): void {\n      override.set({\n        state: untracked(sourceState) as unknown as { value: D },\n        value: updater(untracked(result)),\n      });\n    },\n    asReadonly(): Signal<D> {\n      return result;\n    },\n  }) as WritableSignal<D>;\n}\n","import { computed, Signal, } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * A reactive wrapper around a `Set` backed by Angular signals.\n * All mutations produce a new `Set` instance, ensuring signal-based change detection works correctly.\n *\n * @template T The type of elements stored in the set. Defaults to `number`.\n */\nexport interface SignalSet<T = number> {\n  /** The current underlying `Set` (read via signal). */\n  (): Set<T>;\n  /** The number of elements in the set (reactive). */\n  size: Signal<number>;\n  /** A computed signal that returns the set contents as an array. */\n  toArray: Signal<T[]>;\n  /** Adds the element if absent, removes it if present. */\n  toggle: (id: T) => void;\n  /** Returns `true` if the element exists in the set. */\n  has: (id: T) => boolean;\n  /** Adds an element to the set. */\n  add: (id: T) => void;\n  /** Removes an element from the set. */\n  delete: (id: T) => void;\n  /** Removes all elements from the set. */\n  clear: () => void;\n  /** Returns a human-readable string representation, e.g. `SignalSet(1, 2, 3)`. */\n  toString: () => string;\n  /** Converts the set to a JSON-compatible array. e.g. `[1, 2, \"a\"]` */\n  toJSON: () => T[];\n}\n\n/**\n * Creates a reactive `SignalSet` backed by Angular signals.\n *\n * Every mutation creates a new `Set`, so Angular's signal equality check triggers updates.\n *\n * @template T The element type. Defaults to `number`.\n * @param initialValue An optional iterable to seed the set with.\n * @returns A {@link SignalSet} instance.\n *\n * @example\n * ```ts\n * const selected = signalSet<number>();\n * selected.add(1);\n * selected.toggle(2);\n * console.log(selected.toArray()); // [1, 2]\n * selected.toggle(1);\n * console.log(selected.has(1));    // false\n * ```\n */\nexport function signalSet<T = number>(\n  initialValue: Iterable<T> | (() => Iterable<T>) = new Set<T>(),\n): SignalSet<T> {\n  // writableSignal = linkedSignal \n  const setSignal = writableSignal(\n    () => new Set(typeof initialValue === 'function' ? initialValue() : initialValue),\n  );\n  const toArray = computed(() => Array.from(setSignal()));\n\n  return Object.assign(() => setSignal(), {\n    toArray,\n    size: computed(() => setSignal().size),\n    toggle: (id: T): void => {\n      setSignal.update((set) => {\n        const next = new Set(set);\n        if (next.has(id)) next.delete(id);\n        else next.add(id);\n        return next;\n      });\n    },\n    has: (id: T): boolean => setSignal().has(id),\n    add: (id: T): void => {\n      setSignal.update((set) => {\n        const next = new Set(set);\n        next.add(id);\n        return next;\n      });\n    },\n    delete: (id: T): void => {\n      setSignal.update((set) => {\n        const next = new Set(set);\n        next.delete(id);\n        return next;\n      });\n    },\n    clear: (values?: Iterable<T>): void => {\n      setSignal.set(new Set(values));\n    },\n    toString: (): string => {\n      return `SignalSet(${toArray().join(', ')})`;\n    },\n    toJSON: (): T[] => {\n      return toArray();\n    },\n  });\n}\n","import { computed, Signal } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * Resolves `T` to itself when it is a valid object key (`string | number | symbol`),\n * otherwise falls back to `string`. Used to type-safe `Record` conversions.\n */\ntype ToKey<T> = T extends string | number | symbol ? T : string;\n\n/**\n * if an object have Symbol.iterator, treat it as Iterable<[K, V]>\n * @param value Iterable<[K, V]> or Record<ToKey<K>, V>\n * @returns Iterable<[K, V]>\n */\nfunction getIterable<K, V>(\n  value: Iterable<[K, V]> | Record<ToKey<K>, V>,\n): Iterable<[K, V]> {\n  if (Symbol.iterator in Object(value)) {\n    return value as Iterable<[K, V]>;\n  } else {\n    return Object.entries(value as Record<ToKey<K>, V>) as Iterable<[K, V]>;\n  }\n}\n\n/**\n * A reactive wrapper around a `Map` backed by Angular signals.\n * All mutations produce a new `Map` instance, ensuring signal-based change detection works correctly.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n */\nexport interface SignalMap<K = string, V = unknown> {\n  /** The current underlying `Map` (read via signal). */\n  (): Map<K, V>;\n  /** The number of entries in the map (reactive). */\n  size: Signal<number>;\n  /** A computed signal that returns the map keys as an array. */\n  keys: Signal<K[]>;\n  /** A computed signal that returns the map values as an array. */\n  values: Signal<V[]>;\n  /** A computed signal that returns the map entries as an array of `[key, value]` tuples. */\n  entries: Signal<[K, V][]>;\n  /** Returns the value associated with `key`, or `undefined` if absent. */\n  get: (key: K) => V | undefined;\n  /** Returns `true` if the map contains the given `key`. */\n  has: (key: K) => boolean;\n  /** Sets (or overwrites) the value for `key` and returns the updated `Map`. */\n  set: (key: K, value: V) => Map<K, V>;\n  /** Removes the entry for `key`. Returns `true` if the key existed. */\n  delete: (key: K) => boolean;\n  /** Removes all entries from the map. */\n  clear: () => void;\n  /** Returns a human-readable string, e.g. `SignalMap(a => 1, b => 2)`. */\n  toString: () => string;\n  /** Converts the map to a JSON-compatible object. */\n  toJSON: () => Record<ToKey<K>, V>;\n}\n\n/**\n * Creates a reactive `SignalMap` backed by Angular signals.\n *\n * Every mutation creates a new `Map`, so Angular's signal equality check triggers updates.\n * Accepts either an iterable of `[key, value]` pairs or a plain object as the initial value.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n * @param initialValue An optional iterable of entries or a plain object to seed the map.\n * @returns A {@link SignalMap} instance.\n *\n * @example\n * ```ts\n * const cache = signalMap<string, number>({ a: 1, b: 2 });\n * cache.set('c', 3);\n * console.log(cache.keys());   // ['a', 'b', 'c']\n * cache.delete('a');            // true\n * console.log(cache.toJSON());  // {b:2,c:3}\n * ```\n */\nexport function signalMap<K = string, V = unknown>(\n  initialValue:\n    | Iterable<[K, V]>\n    | Record<ToKey<K>, V>\n    | (() => Iterable<[K, V]> | Record<ToKey<K>, V>) = new Map<K, V>(),\n): SignalMap<K, V> {\n  // writableSignal = linkedSignal \n  const mapSignal = writableSignal(() => {\n    const _val =\n      typeof initialValue === 'function' ? initialValue() : initialValue;\n    const init = getIterable(_val);\n    return new Map<K, V>(init);\n  });\n  const entries = computed(() => Array.from(mapSignal().entries()));\n  const keys = computed(() => Array.from(mapSignal().keys()));\n  const values = computed(() => Array.from(mapSignal().values()));\n  const size = computed(() => mapSignal().size);\n\n  return Object.assign(() => mapSignal(), {\n    entries,\n    keys,\n    values,\n    size,\n    get: (key: K): V | undefined => mapSignal().get(key),\n    has: (key: K): boolean => mapSignal().has(key),\n    set: (key: K, value: V): Map<K, V> => {\n      mapSignal.update((map) => {\n        const next = new Map(map);\n        next.set(key, value);\n        return next;\n      });\n      return mapSignal();\n    },\n    delete: (key: K): boolean => {\n      let deleted = false;\n      mapSignal.update((map) => {\n        const next = new Map(map);\n        deleted = next.delete(key);\n        return next;\n      });\n      return deleted;\n    },\n    clear: (values?: Iterable<[K, V]> | Record<ToKey<K>, V>): void => {\n      mapSignal.set(new Map(values ? getIterable(values) : undefined));\n    },\n    toString: (): string => {\n      return `SignalMap(${entries()\n        .map(([k, v]) => `${k} => ${v}`)\n        .join(', ')})`;\n    },\n    toJSON: (): Record<ToKey<K>, V> => {\n      return Object.fromEntries(entries());\n    },\n    toObject: (): Record<ToKey<K>, V> => {\n      return Object.fromEntries(entries());\n    },\n  });\n}\n","import { computed, signal, Signal, WritableSignal } from '@angular/core';\n\nconst SIGNAL_OBJECT = Symbol('SignalObject');\n\n/**\n * A reactive object backed by Angular signals.\n * Each property is stored as a WritableSignal, so reads are tracked\n * by Angular's reactive system (templates, computed, effect).\n *\n * Usage:\n *   const person = signalObject({ name: 'dvirus', age: 30 });\n *   person.name;              // reads the signal → 'dvirus' (tracked)\n *   person['name'] = 'new';   // sets the signal (triggers reactivity)\n *   person.age;               // reads the signal → 30 (tracked)\n */\nclass _SignalObject<T extends Record<string, unknown>> {\n  readonly [SIGNAL_OBJECT] = true;\n  readonly #signals = new Map<string, WritableSignal<unknown>>();\n  readonly #version = signal(0);\n  readonly #boundCache = new Map<string | symbol, _Function>();\n\n  constructor(initialValue: T) {\n    for (const [key, value] of Object.entries(initialValue)) {\n      this.#signals.set(key, signal(value));\n    }\n\n    // Use a function as the proxy target so the `apply` trap works (makes it callable).\n    // All traps delegate to `self` (the real class instance) for property/signal access.\n\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    const self = this;\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\n    const callable = (() => {}) as unknown as this;\n\n    return new Proxy(callable, {\n      apply(): T {\n        return self.$snapshot();\n      },\n\n      get(_, prop): unknown {\n        // Symbols & class own members go through normally\n        if (typeof prop === 'symbol' || prop in self) {\n          const value = Reflect.get(self, prop, self);\n          // Bind methods to the real target so private fields (#signals) work.\n          // Cache the bound function so the same reference is returned each time\n          // (important for Angular signal identity tracking on $snapshot).\n          if (typeof value === 'function') {\n            let bound = self.#boundCache.get(prop);\n            if (!bound) {\n              bound = value.bind(self) as _Function;\n              self.#boundCache.set(prop, bound);\n            }\n            return bound;\n          }\n          return value;\n        }\n        // Read the signal — this is tracked by Angular's reactive context\n        const s = self.#signals.get(prop)?.();\n        /** create new signal if it doesn't exist */\n        if (s === undefined && !self.#signals.has(prop)) {\n          const newSignal = signal(undefined);\n          self.#signals.set(prop, newSignal);\n          return newSignal();\n        }\n        return s;\n      },\n\n      set(_, prop, value): boolean {\n        if (typeof prop === 'symbol' || prop in self) {\n          return Reflect.set(self, prop, value);\n        }\n        const existing = self.#signals.get(prop);\n        if (existing) {\n          existing.set(value);\n        } else {\n          // Dynamic property — create a new signal and bump version\n          self.#signals.set(prop, signal(value));\n          self.#version.update(addVersion);\n        }\n        return true;\n      },\n\n      deleteProperty(_, prop): boolean {\n        // Prevent accidental deletion of internal methods or symbols\n        if (typeof prop === 'symbol' || prop in self) {\n          return false;\n        }\n        // If it's a tracked signal property, remove it and bump the version\n        if (self.#signals.has(prop)) {\n          self.#signals.delete(prop);\n          self.#version.update(addVersion);\n          return true;\n        }\n        // Standard JS behavior: deleting a non-existent property returns true\n        return true;\n      },\n\n      has(_, prop): boolean {\n        if (typeof prop === 'string' && self.#signals.has(prop)) {\n          return true;\n        }\n        return Reflect.has(self, prop);\n      },\n\n      ownKeys(): string[] {\n        return Array.from(self.#signals.keys());\n      },\n\n      getOwnPropertyDescriptor(_, prop): PropertyDescriptor | undefined {\n        if (typeof prop === 'string' && self.#signals.has(prop)) {\n          return {\n            configurable: true,\n            enumerable: true,\n            writable: true,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            value: self.#signals.get(prop)!(),\n          };\n        }\n        return Reflect.getOwnPropertyDescriptor(self, prop);\n      },\n    }) as unknown as this;\n  }\n\n  /**\n   * A computed signal that returns a plain snapshot of all properties.\n   * Reading this tracks ALL properties — so any property change triggers reactivity.\n   *\n   * Usage:\n   *   effect(() => console.log(person.$snapshot()));\n   *   // logs whenever ANY property changes\n   */\n  private readonly $snapshot: Signal<T> = computed(() => {\n    this.#version(); // track structural changes (new/removed props)\n    return this.toJSON();\n  });\n\n  /**\n   * Spreads one or more objects (plain or reactive) into this SignalObject.\n   * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n   *\n   * - Existing keys → updates the signal (triggers reactivity)\n   * - New keys → creates a new signal and bumps the version\n   * - Accepts plain objects and ReactiveObjects interchangeably\n   *\n   * @example\n   *   const person = signalObject({ name: 'dvirus' });\n   *   person.$assign({ age: 30 }, otherSignalObj);\n   */\n  $assign(...sources: object[]): void {\n    for (const source of sources) {\n      const entries = isSignalObject(source)\n        ? Object.entries(\n            (source as unknown as { $snapshot: Signal<object> }).$snapshot(),\n          )\n        : Object.entries(source);\n\n      for (const [key, value] of entries) {\n        const existing = this.#signals.get(key);\n        if (existing) {\n          existing.set(value);\n        } else {\n          this.#signals.set(key, signal(value));\n        }\n      }\n    }\n    this.#version.update(addVersion);\n  }\n\n  toJSON(): T {\n    this.#version(); // track structural changes (new/removed props)\n    const result: Record<string, unknown> = {};\n    for (const [key, sig] of this.#signals) {\n      result[key] = sig();\n    }\n    return result as T;\n  }\n\n  toString(): string {\n    return JSON.stringify(this.toJSON());\n  }\n}\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * // person.name = 'changed';   → triggers re-render\n * // person['age'] = 31;        → triggers re-render\n */\nexport type SignalObject<T> = T & {\n  /**\n   * Call the SignalObject as a function to get a reactive snapshot.\n   *\n   * @example\n   * const person = signalObject({ name: 'dvirus', age: 30 });\n   * person(); // { name: 'dvirus', age: 30 } — tracked by Angular\n   */\n  (): T;\n\n  /**\n   * A computed signal that returns a plain snapshot of all properties.\n   * Reading this tracks ALL properties — any property change triggers reactivity.\n   *\n   * @example\n   * effect(() => console.log(person.$snapshot()));\n   * // logs whenever ANY property changes\n   *\n   * const label = computed(() => {\n   *   const snap = person.$snapshot();\n   *   return `${snap.name} (${snap.age})`;\n   * });\n   */\n  // readonly $snapshot: Signal<T>;\n\n  /**\n   * Spreads one or more objects (plain or reactive) into this SignalObject.\n   * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n   *\n   * - Existing keys → updates the signal (triggers reactivity)\n   * - New keys → creates a new signal and bumps the version\n   * - Accepts plain objects and SignalObjects interchangeably\n   *\n   * @param sources - One or more plain objects or SignalObjects to merge in\n   *\n   * @example\n   * const person = signalObject({ name: 'dvirus' });\n   * person.$assign({ age: 30 }, otherSignalObj);\n   */\n  $assign(...sources: Partial<T>[]): void;\n};\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @param initialValue - The plain object to make reactive\n * @returns A `SignalObject<T>` proxy with reactive property access, `$snapshot`, and `$assign`\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * person.name = 'changed';   // triggers re-render\n * person['age'] = 31;        // triggers re-render\n *\n * // Spread (plain snapshot):\n * const copy = { ...person }; // { name: 'changed', age: 31 }\n *\n * // Track all properties reactively:\n * effect(() => console.log(person.$snapshot()));\n */\nexport function signalObject<T extends object>(\n  initialValue: T,\n): SignalObject<T> {\n  return new _SignalObject(\n    initialValue as Record<string, unknown>,\n  ) as unknown as SignalObject<T>;\n}\n\n/**\n * Type guard — checks if a value is a reactive SignalObject proxy.\n *\n * @example\n * isSignalObject(signalObject({ a: 1 })); // true\n * isSignalObject({ a: 1 });               // false\n * isSignalObject({ ...signalObject({ a: 1 }) }); // false (spread = plain copy)\n */\nexport function isSignalObject<T extends Record<string, unknown>>(\n  value: unknown,\n): value is SignalObject<T> {\n  return (\n    typeof value === 'object' &&\n    value !== null &&\n    (value as Record<symbol, unknown>)[SIGNAL_OBJECT] === true\n  );\n}\n\n/**\n * Reactively merges multiple SignalObjects (like `{ ...a, ...b }`).\n * Returns a `Signal` that re-evaluates whenever any source property changes.\n * Later sources win on key conflicts, just like spread.\n *\n * same as `computed(() => ({ ...a, ...b }))`\n * but with proper tracking of nested properties and support for non-reactive objects as sources.\n *\n * @example\n * const objA = signalObject({ name: 'dvirus', role: 'dev' });\n * const objB = signalObject({ age: 30, role: 'admin' });\n * const merged = mergeSignalObjects(objA, objB);\n * merged(); // { name: 'dvirus', role: 'admin', age: 30 }\n */\nexport function mergeSignalObjects<T extends object[]>(\n  ...sources: [...{ [K in keyof T]: T[K] | SignalObject<T[K]> }]\n): Signal<UnionToIntersection<T[number]>> {\n  return computed(() => {\n    let result = {};\n    for (const source of sources) {\n      // Spreading a SignalObject triggers its Proxy traps (ownKeys + getOwnPropertyDescriptor),\n      // which reads every signal — so it's automatically tracked by Angular's reactive context.\n      // Plain objects are just spread normally.\n      result = { ...result, ...source };\n    }\n    return result as UnionToIntersection<T[number]>;\n  });\n}\n\n/**\n * Extracts the plain object type `U` from a `SignalObject<U>`.\n * Returns `T` as-is if it's not a `SignalObject`.\n */\n// type SnapshotOf<T> = T extends SignalObject<infer U> ? U : T;\n\n/**\n * Converts a union of types into an intersection.\n * Used to merge multiple object types from `mergeSignalObjects` into a single combined type.\n *\n * @example\n * // UnionToIntersection<{ a: 1 } | { b: 2 }> → { a: 1 } & { b: 2 }\n */\ntype UnionToIntersection<U> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never;\n\ntype _Function = (...args: unknown[]) => unknown;\n\nfunction addVersion(prev: number): number {\n  if (prev > 1000) return 1;\n  return prev + 1;\n}\n","import {\n  computed,\n  DestroyRef,\n  inject,\n  Signal,\n  signal,\n  untracked,\n} from '@angular/core';\nimport {\n  FormControl,\n  FormGroup,\n  AbstractControl,\n  FormControlStatus,\n  ValidationErrors,\n  FormArray,\n  FormControlState,\n} from '@angular/forms';\nimport { Observable, startWith, Subscription } from 'rxjs';\nimport { tryCatch } from './try-catch';\nimport { writableSignal } from './writable-signal';\n\ninterface ControlEvent<T> {\n  /**\n   * Form control from which this event is originated.\n   *\n   * Note: the type of the control can't be inferred from T as the event can be emitted by any of child controls\n   */\n  readonly source: AbstractControl<unknown | T>;\n}\n\n// ########## CONTROL SIGNAL ##########\n\n/**\n * A reactive signal-based wrapper around an `AbstractControl`, exposing\n * the control's state (value, status, touched, dirty, errors, etc.) as\n * Angular signals for use in templates and computed expressions.\n *\n * @template T - The value type of the underlying form control.\n * @template TControl - The specific `AbstractControl` type being wrapped (e.g., `FormControl`, `FormGroup`, `FormArray`).\n */\nexport interface ControlSignal<\n  T,\n  TControl extends AbstractControl<unknown> = AbstractControl<T>,\n> {\n  /** Signal returning the underlying `AbstractControl` instance with its specific type. */\n  control: TControl;\n  /** Signal returning the current value of the control. */\n  value: Signal<UnwrapFromControlState<T> | null | undefined>;\n  /** Signal returning the current validation status (`VALID`, `INVALID`, `PENDING`, `DISABLED`). */\n  status: Signal<FormControlStatus | null | undefined>;\n  /** Signal returning the most recent `ControlEvent` emitted by the control. */\n  events: Signal<ControlEvent<T> | null | undefined>;\n  /** Signal that is `true` when the control status is `DISABLED`. */\n  disabled: Signal<boolean>;\n  /** Signal that is `true` when the control status is `VALID`. */\n  valid: Signal<boolean>;\n  /** Signal that is `true` when the control status is `INVALID`. */\n  invalid: Signal<boolean>;\n  /** Signal that is `true` when the control has been touched. */\n  touched: Signal<boolean>;\n  /** Signal that is `true` when the control is dirty. */\n  dirty: Signal<boolean>;\n  /** Signal returning the current validation errors, or `null` if there are none. */\n  errors: Signal<ValidationErrors | null>;\n  /** Signal returning the key of the first validation error, or `null`. */\n  firstErrorKey: Signal<string | null>;\n  /** Signal that is `true` when the control is both touched and invalid. */\n  touchedAndInvalid: Signal<boolean>;\n  /**\n   * Signal returning the control's synchronous validators as a `ValidationErrors`-like object, or `null` if there are none.\n   * @Note  that this does not include asynchronous validators, and the shape of the returned object may differ from the actual validation errors emitted by the control.\n   */\n  validators: Signal<ValidationErrors | null>;\n  /** Tears down all internal subscriptions and effects. */\n  unsubscribe(): void;\n}\n\n/**\n * Creates a {@link ControlSignal} that mirrors an `AbstractControl`'s\n * reactive state as Angular signals.\n *\n * **Important:** If called outside an injection context, you must manually handle\n * un-subscription by either:\n * - Calling the `unsubscribe()` method on the returned {@link ControlSignal}, or\n * - Passing a `DestroyRef` via the `options` parameter for automatic cleanup.\n *\n * If called within an injection context without providing a `DestroyRef`, the\n * subscriptions will be automatically cleaned up on component destruction.\n *\n * @template T - The value type of the form control.\n * @param control - The form control or a signal wrapping one.\n * @param options - Optional configuration object containing:\n *   - `destroyRef`: A `DestroyRef` used for automatic cleanup on destruction.\n *     If not provided, the function will attempt to inject one from the current\n *     injection context. If neither is available, manual un-subscription is required.\n * @returns A {@link ControlSignal} exposing the control's state as signals.\n * @throws If `control` is a signal and no `Injector` is available.\n */\nexport function controlSignal<\n  T,\n  TControl extends AbstractControl<unknown> = FormControl<T>,\n>(\n  control: TControl,\n  options?: { destroyRef?: DestroyRef | null },\n): ControlSignal<T, TControl> {\n  const destroyRef =\n    options?.destroyRef ??\n    tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n  let subscriptions: Subscription[] = [];\n  const unsubscribe = (): void => {\n    subscriptions.forEach((s) => s.unsubscribe());\n    subscriptions = [];\n  };\n  // cleanUp\n  unsubscribe();\n  destroyRef?.onDestroy(() => unsubscribe());\n\n  const $value = signal<T | null | undefined>(undefined);\n  const $status = signal<FormControlStatus | null | undefined>(undefined);\n  const _events = signal<ControlEvent<T> | null>(null);\n  const $events = writableSignal<ControlEvent<T> | null | undefined>(() => {\n    $value();\n    $status();\n    return _events();\n  });\n\n  subscriptions.push(\n    control.valueChanges\n      .pipe(startWith(control.value))\n      .subscribe((x) => untracked(() => $value.set(x as T))),\n\n    control.statusChanges\n      .pipe(startWith(control.status))\n      .subscribe((x) => untracked(() => $status.set(x))),\n\n    // control.events.subscribe((x) => untracked(() => $events.set(x))),\n  );\n\n  // Subscribe to control.events if available (Angular v18+)\n  const ctrl = control as unknown as { events: Observable<ControlEvent<T>> };\n  if (ctrl.events && typeof ctrl.events.subscribe === 'function') {\n    subscriptions.push(\n      ctrl.events.subscribe((x: ControlEvent<T>) =>\n        untracked(() => {\n          _events.set(x);\n        }),\n      ),\n    );\n  }\n\n  const invalid = computed(() => ($status(), control.invalid));\n  const touched = computed(() => ($events(), control.touched));\n  const errors = computed<ValidationErrors | null>(\n    () => ($events(), control.errors),\n  );\n\n  return {\n    control: control as TControl,\n    value: computed(() => {\n      $value();\n      $events();\n      return control.value as UnwrapFromControlState<T>;\n    }),\n    status: $status.asReadonly(),\n    events: $events.asReadonly(),\n\n    invalid: invalid,\n    errors: errors,\n    touched: touched,\n\n    valid: computed(() => ($status(), control.valid)),\n    dirty: computed(() => ($events(), control.dirty)),\n    disabled: computed(() => ($status(), control.disabled)),\n    touchedAndInvalid: computed(() => touched() && invalid()),\n    firstErrorKey: computed<string | null>(\n      () => Object.keys(errors() ?? {})[0] ?? null,\n    ),\n    validators: computed(\n      () => ($events(), control.validator?.({} as AbstractControl) ?? null),\n    ),\n    unsubscribe: (): void => unsubscribe(),\n  };\n}\n\n// ############ FORM GROUP SIGNAL ############\n\n/**\n * Extends {@link ControlSignal} with a strongly-typed `controls` map,\n * providing a `ControlSignal` for every control in the `FormGroup`.\n *\n * @template T - An object type whose keys correspond to the group's control names\n *   and whose values are the respective control value types.\n */\nexport interface FormGroupSignal<TControls extends TypedControlMap>\n  extends ControlSignal<ControlsValue<TControls>, FormGroup<TControls>> {\n  /** The underlying `FormGroup` instance. */\n  control: FormGroup<TControls>;\n  /** A map of child control names to their individual {@link ControlSignal} instances. */\n  controls: {\n    [K in keyof TControls]: NestedControlSignal<TControls[K]>;\n  };\n}\n\n/**\n * Creates a {@link FormGroupSignal} for a `FormGroup`. Child controls are\n * converted recursively, so nested `FormGroup` and `FormArray` structures\n * are supported.\n *\n * @template TControls - A typed map of control names to `AbstractControl` instances.\n * @param formGroup - The `FormGroup` to wrap.\n * @param options - Optional `DestroyRef` and `Injector` forwarded to\n *   each underlying {@link controlSignal} call.\n * @returns A {@link FormGroupSignal} with both group-level and per-control signals.\n */\nexport function formGroupSignal<TControls extends TypedControlMap>(\n  formGroup: FormGroup<TControls>,\n  options?: { destroyRef?: DestroyRef | null },\n): FormGroupSignal<TControls> {\n  const destroyRef =\n    options?.destroyRef ??\n    tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n  const controls = Object.fromEntries(\n    Object.entries(formGroup.controls).map(([key, ctrl]) => {\n      return [key, nestedControlSignal(ctrl, { destroyRef })];\n    }),\n  ) as { [K in keyof TControls]: NestedControlSignal<TControls[K]> };\n\n  const groupSignal = controlSignal(formGroup);\n  const selfUnsubscribe = groupSignal.unsubscribe.bind(groupSignal);\n\n  return Object.assign(groupSignal, {\n    controls,\n    unsubscribe: () => {\n      selfUnsubscribe();\n      Object.values(controls).forEach((c) => c.unsubscribe());\n    },\n  }) as FormGroupSignal<TControls>;\n}\n\n// ############ FORM ARRAY SIGNAL ############\n\nexport interface FormArraySignal<TControl extends AbstractControl<unknown>>\n  extends ControlSignal<ControlValue<TControl>[], FormArray<TControl>> {\n  /** The underlying `FormArray` instance. */\n  control: FormArray<TControl>;\n  controls: NestedControlSignal<TControl>[];\n}\n\n/**\n * Creates a {@link FormArraySignal} for a `FormArray`. Child controls are\n * converted recursively, so arrays of `FormGroup`, arrays of `FormArray`,\n * and arrays of `FormControl` are all supported.\n */\nexport function formArraySignal<TControl extends AbstractControl<unknown>>(\n  formArray: FormArray<TControl>,\n  options?: { destroyRef?: DestroyRef | null },\n): FormArraySignal<TControl> {\n  const destroyRef =\n    options?.destroyRef ??\n    tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n  const controls = formArray.controls.map((ctrl) =>\n    nestedControlSignal(ctrl, { destroyRef }),\n  ) as NestedControlSignal<TControl>[];\n\n  const arraySignal = controlSignal(formArray);\n  const selfUnsubscribe = arraySignal.unsubscribe.bind(arraySignal);\n\n  return Object.assign(arraySignal, {\n    controls,\n    unsubscribe: () => {\n      selfUnsubscribe();\n      controls.forEach((c) => c.unsubscribe());\n    },\n  }) as FormArraySignal<TControl>;\n}\n\n// ############ HELPERS ############\n\ntype UnwrapFromControlState<T> =\n  T extends FormControlState<unknown> ? T['value'] : T;\n\ntype TypedControlMap = Record<string, AbstractControl<unknown>>;\n\ntype ControlValue<TControl extends AbstractControl<unknown>> =\n  TControl extends AbstractControl<infer TValue> ? TValue : never;\n\ntype ControlsValue<TControls extends TypedControlMap> = {\n  [K in keyof TControls]: ControlValue<TControls[K]>;\n};\n\nexport type NestedControlSignal<TControl extends AbstractControl<unknown>> =\n  TControl extends FormGroup<infer TControls>\n    ? FormGroupSignal<TControls & TypedControlMap> //& TypedControlMap\n    : TControl extends FormArray<infer TItemControl>\n      ? FormArraySignal<TItemControl & AbstractControl<unknown>>\n      : ControlSignal<ControlValue<TControl>, TControl>;\n\nfunction nestedControlSignal<TControl extends AbstractControl<unknown>>(\n  control: TControl,\n  options?: { destroyRef?: DestroyRef | null },\n): NestedControlSignal<TControl> {\n  if (control instanceof FormGroup) {\n    return formGroupSignal(\n      control as FormGroup<TypedControlMap>,\n      options,\n    ) as NestedControlSignal<TControl>;\n  }\n\n  if (control instanceof FormArray) {\n    return formArraySignal(\n      control as FormArray<AbstractControl<unknown>>,\n      options,\n    ) as NestedControlSignal<TControl>;\n  }\n\n  return controlSignal(\n    control as AbstractControl<ControlValue<TControl>>,\n    options,\n  ) as NestedControlSignal<TControl>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAsCA;;;;;;AAMG;AACG,SAAU,WAAW,CAAuB,GAAM,EAAA;AACtD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAC3D,EAA0B,CAC3B;AACH;AAEA;;;;;;AAMG;AACG,SAAU,aAAa,CAA2B,GAA4B,EAAA;AAClF,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EACpE,EAAW,CACZ;AACH;AAEA;;;;;;;AAOG;AACG,SAAU,aAAa,CAAI,KAAuB,EAAA;AACtD,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK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