{"version":3,"file":"src.cjs","names":["reduceFnMap"],"sources":["../../../src/machine/functions/src.ts"],"sourcesContent":["import { PrimitiveObject } from '#bemedev/globals/types';\nimport {\n  ActorsConfigMap,\n  EventsMap,\n  ToEventObject,\n  ToEvents,\n} from '#events';\nimport { reduceFnMap } from '#utils';\nimport type { ChildFunction2, ChildrenMap } from '../types';\n\nexport type ToChildSrc_F = <\n  E extends EventsMap = EventsMap,\n  A extends ActorsConfigMap = ActorsConfigMap,\n  Pc = any,\n  Tc extends PrimitiveObject = PrimitiveObject,\n  T extends string = string,\n  Eo extends ToEventObject<ToEvents<E, A>> = ToEventObject<ToEvents<E, A>>,\n  R extends { eventsMap: any } = { eventsMap: any },\n>(\n  events: E,\n  actorsMap: A,\n  child: string,\n  children?: ChildrenMap<Eo, Pc, Tc, T>,\n) => ChildFunction2<Eo, Pc, Tc, T, R> | undefined;\n\n/**\n * Converts a child configuration to a child machine object.\n * @param _child of type {@linkcode EmitterSrcConfig}, the machine configuration to convert.\n * @param children of type {@linkcode EmitterMap}, the map of emitters to look up the emitter configuration.\n * @returns an emitter object with an id, or undefined if the emitter is not found.\n *\n * @see {@linkcode EventsMap} for the events map\n * @see {@linkcode ActorsConfigMap} for the actors map\n */\nexport const toChildSrc: ToChildSrc_F = (\n  events,\n  actorsMap,\n  child,\n  children,\n) => {\n  const fn = children?.[child];\n  const func = fn ? reduceFnMap(events, actorsMap, fn as any) : undefined;\n  return func as any;\n};\n"],"mappings":";;;;;;;;;;;;;AAkCA,MAAa,cACX,QACA,WACA,OACA,aACG;CACH,MAAM,KAAK,WAAW;AAEtB,QADa,KAAKA,0BAAAA,YAAY,QAAQ,WAAW,GAAU,GAAG,KAAA"}