{"version":3,"file":"interpreter.cjs","names":["#initialNode","transformEventArg","INIT_EVENT","#initialConfig","#collectedChildren","#mode","#event","#machine","getTags","#config","#schedulerValue","#schedulerContexts","#schedulerEvent","#schedulerStatus","#resolveNode","#exact","#performConfig","#state","#previousState","#status","#context","#value","#collectEmitterConfigs","#collectChildrenConfig","#throwing","#schedulers","#stop","#warningsCollector","#displayConsole","#errorsCollector","#flush","nodeToValue","#sent","#node","_unknown","#flat","_any","flatMap","#performStates","initialConfig","#iterator","resolveNode","#initialPpc","#initialContext","IS_TEST","#pContext","isPrimitive","getByKey","#setStatus","#innerSubscribers","#subscribers","#collectChildren","#collectPausables","#startStatus","#startPausables","#startInitialEntries","#startChildren","#pause","#isInsideValue","#selfTransitionsCounter","#pauseAllActivities","#performActivities","#stopPausables","#pausePausables","#pauseChildren","#stopChildren","#resumeChildren","#resumePausables","#performSelfTransitions","#throwMaxCounter","#next","#cloneState","DEFAULT_MAX_TIME_PROMISE","#mergeContexts","#timeoutActions","#dispose","#sendTo","#cannotPerformEvents","eventToType","toArray","#currentActivities","#resume","#performSendToAction","#performScheduledAction","#performPauseActivityAction","#performResumeActivityAction","#performStopActivityAction","#performPauseTimerAction","#performResumeTimerAction","#performStopTimerAction","#performForceSendAction","#performResendAction","#makeBusy","#performAction","#performsExtendedActions","#executeAction","#performPredicate","#makeWork","isDefined","#executePredicate","#performDelay","#executeDelay","isDescriber","#performActions","#performPredicates","#diffNext","#performTransition","#sending","#cannotPerform","#changeEvent","ALWAYS_EVENT","#collectedActivities","#collectedAfters","#collectedAlways","#executeActivities","#start","#collectedPausables","#collectedSelfTransitions0","#performAlways","#performAfter","#collectedSelfTransitions","#collectedEmitterConfigs","#collectedChildrenConfig","#performFinally","#executeChild","assignByKey","getEntries","#mapperFn","#close","#open","#unsubscribe","#stopSchedulers","#startingStatus","createSubscriber","isStringEmpty","#extractTransitions","#isInsideValue2","nextSV","switchV","#possibleEvents","possibleEvents","#send","#proposedNextSV","getExits","replaceAll","#returnWithWarning","toAction","reduceDescriber","toPredicate","toDelay","toChildSrc","toEmitterSrc"],"sources":["../../src/interpreters/interpreter.ts"],"sourcesContent":["import { toAction, type ActionConfig } from '#actions';\nimport _any from '#bemedev/features/common/castings/any';\nimport isPrimitive from '#bemedev/features/common/castings/primitive/is';\nimport {\n  DEFAULT_DELIMITER,\n  DEFAULT_MAX_SELF_TRANSITIONS,\n  DEFAULT_MAX_TIME_PROMISE,\n  DEFAULT_MIN_ACTIVITY_TIME,\n} from '#constants';\n\nimport toArray from '#bemedev/features/arrays/castings/toArray';\nimport isDefined from '#bemedev/features/common/castings/is/defined';\nimport { switchV } from '#bemedev/features/functions/functions/switch';\nimport { toDelay } from '#delays';\nimport {\n  ALWAYS_EVENT,\n  eventToType,\n  INIT_EVENT,\n  possibleEvents,\n  transformEventArg,\n  type ActorsConfigMap,\n  type EventArg,\n  type EventArgT,\n  type EventObject,\n  type ToEventObject,\n  type ToEvents,\n  type ToEventsR,\n} from '#events';\nimport { toPredicate, type GuardConfig } from '#guards';\nimport { getEntries, getExits } from '#machine';\nimport {\n  getByKey,\n  getTags,\n  toChildSrc,\n  type Config,\n  type ConfigFrom,\n  type ContextFrom,\n  type DirectMerge_F,\n  type EventsMapFrom,\n  type ExtendedActionsParams,\n  type GetEventsFromConfig,\n  type PrivateContextFrom,\n  type ScheduledData,\n} from '#machines';\nimport {\n  flatMap,\n  initialConfig,\n  nextSV,\n  Node,\n  nodeToValue,\n  resolveNode,\n  type ActivityConfig,\n  type NodeConfig,\n  type State,\n  type StateExtended,\n  type StateValue,\n} from '#states';\nimport type {\n  AlwaysConfig,\n  DelayedTransitions,\n  TransitionConfig,\n} from '#transitions';\nimport {\n  IS_TEST,\n  isStringEmpty,\n  reduceDescriber,\n  replaceAll,\n} from '#utils';\nimport {\n  anyPromises,\n  asyncfy,\n  withTimeout,\n  type TimeoutPromise,\n} from '@bemedev/better-promise';\n\nimport { assignByKey, decomposeSV } from '@bemedev/decompose';\nimport {\n  createInterval,\n  createTimeout,\n  type Interval2,\n  type Timeout2,\n} from '@bemedev/interval2';\nimport { sleep } from '@bemedev/sleep';\nimport cloneDeep from 'clone-deep';\nimport equal from 'fast-deep-equal';\nimport { isDescriber, type RecordS } from '~types';\nimport type {\n  _Send_F,\n  AddSubscriber_F,\n  AnyInterpreter,\n  Collected0,\n  CollectedPausable,\n  CollectedService,\n  CreateInterval2_F,\n  DiffNext,\n  ExecuteActivities_F,\n  Interpreter_F,\n  Mode,\n  PerformAction_F,\n  PerformActionLater_F,\n  PerformAfter_F,\n  PerformAlway_F,\n  PerformDelay_F,\n  PerformPredicate_F,\n  PerformTransition_F,\n  PerformTransitions_F,\n  Selector_F,\n  WorkingStatus,\n} from './interpreter.types';\n\nimport _unknown from '#bemedev/features/common/castings/_unknown';\nimport type {\n  AllowedNames,\n  Fn,\n  PrimitiveObject,\n} from '#bemedev/globals/types';\nimport { toEmitterSrc, type EmitterFunction2 } from '#emitters';\nimport type { Machine } from '#machine';\nimport type {\n  ActorsMapFrom,\n  AnyMachine,\n  ChildFunction2,\n  ExtractTagsFromConfig,\n  GetActorKeysFromConfig,\n} from '#machines';\nimport type { FinallyConfig } from '#actor';\nimport { createScheduler } from '@bemedev/scheduler';\nimport type { ChildConfig, EmitterConfig } from '../actor.types';\nimport { createSubscriber, type SubscriberClass } from './subscriber';\n\n/**\n * The `Interpreter` class is responsible for interpreting and managing the state of a machine.\n * It provides methods to start, stop, pause, and resume the machine, as well as to send events\n * and subscribe to state changes.\n *\n * @template : type {@linkcode Config} [C] - The configuration type of the machine.\n * @template : [Pc] - The private context type, which can be any type.\n * @template : type {@linkcode types} [Tc] - The context type.\n * @template : type {@linkcode EventsMap} [E] - The events map type, which maps event names to their\n * @template : type {@linkcode PromiseeMap} [P] - The promisees map type, which maps promise names to their\n * @template Mo : type {@linkcode SimpleMachineOptions2} - The machine options type, which includes various configurations for the machine. Default to {@linkcode MachineOptions}.\n *\n * @implements : {@linkcode AnyInterpreter}\n *\n * @remarks\n * The `Interpreter` class is a core component of the state machine implementation,\n * allowing for the execution of state transitions, handling of events, and management of the machine's lifecycle.\n * It supports various modes of operation, including strict and normal modes,\n * and provides mechanisms for error and warning handling.\n * * It also allows for the execution of actions, predicates, and delays,\n * * as well as the management of child interpreters and scheduled tasks.\n *\n * @see {@linkcode GetEventsFromConfig} for extracting events from the machine configuration.\n */\nexport class Interpreter<\n  const C extends Config = Config,\n  const Pc = any,\n  const Tc extends PrimitiveObject = PrimitiveObject,\n  E extends GetEventsFromConfig<C> = GetEventsFromConfig<C>,\n  A extends ActorsConfigMap = GetActorKeysFromConfig<C>,\n  Ta extends ExtractTagsFromConfig<C> = ExtractTagsFromConfig<C>,\n  Eo extends ToEventObject<ToEvents<E, A>> = ToEventObject<ToEvents<E, A>>,\n> implements AnyInterpreter<E, A, Pc, Tc> {\n  /**\n   * The {@linkcode Machine} machine being interpreted.\n   */\n  #machine: Machine<C, Pc, Tc, E, A, Ta, Eo>;\n\n  /**\n   * The current {@linkcode WorkingStatus} status of the this {@linkcode Interpreter} service.\n   */\n  #status: WorkingStatus = 'idle';\n\n  /**\n   * The current {@linkcode NodeConfigWithInitials} config state of this {@linkcode Interpreter} service.\n   */\n  #config: NodeConfig;\n\n  /**\n   * The {@linkcode RecordS}<{@linkcode NodeConfigWithInitials}> flat representation of all possible config states of this {@linkcode Interpreter} service.\n   */\n  #flat!: RecordS<NodeConfig>;\n\n  /**\n   * The current {@linkcode StateValue}> of this {@linkcode Interpreter} service.\n   */\n  #value!: StateValue;\n\n  /**\n   * The {@linkcode Mode} of this {@linkcode Interpreter} service\n   */\n  #mode: Mode;\n\n  /**\n   * The initial {@linkcode Node} of the inner {@linkcode Machine}.\n   */\n  readonly #initialNode: Node<Eo, Pc, Tc, Ta>;\n\n  /**\n   * The current {@linkcode Node} of this {@linkcode Interpreter} service.\n   */\n  #node!: Node<Eo, Pc, Tc, Ta>;\n\n  /**\n   * an iiner ietrator to count the number of operations performed by this {@linkcode Interpreter} service.\n   */\n  #iterator = 0;\n\n  /**\n   * The current {@linkcode ToEvents} event of this {@linkcode Interpreter} service.\n   */\n  #event: Eo = transformEventArg(INIT_EVENT);\n\n  /**\n   * The initial {@linkcode NodeConfigWithInitials} of the inner {@linkcode Machine}.\n   */\n  readonly #initialConfig: NodeConfig;\n\n  /**\n   * The initial {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   */\n  #initialPpc!: Pc;\n\n  /**\n   * The initial {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   */\n  #initialContext!: Tc;\n\n  /**\n   * The current {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   */\n  #pContext!: Pc;\n\n  /**\n   * The current {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   */\n  #context!: Tc;\n\n  /**\n   * The previous {@linkcode State} of this {@linkcode Interpreter} service.\n   */\n  #previousState!: State<Eo, Tc, Ta>;\n\n  /**\n   * The current {@linkcode State} of this {@linkcode Interpreter} service.\n   */\n  #state!: State<Eo, Tc, Ta>;\n\n  /**\n   * All {@linkcode AnyInterpreter} service subscribers of this {@linkcode Interpreter} service.\n   */\n\n  #sent = false;\n\n  /**\n   * Public getter of the service subscribers of this {@linkcode Interpreter} service.\n   */\n  get children() {\n    return this.#collectedChildren;\n  }\n\n  /**\n   * Returns a service subscriber of this {@linkcode Interpreter} service with a specific id.\n   * @param id - The id of the service subscriber to get.\n   * @return The service subscriber {@linkcode AnyInterpreter} of this {@linkcode Interpreter} service with the specified id, or undefined if not found.\n   *\n   * @see {@linkcode children} for all children.\n   */\n  getChildAt = (id: string) => this.children.find(f => f.id === id);\n\n  /**\n   * Allias of {@linkcode getChildAt} function.\n   */\n  at = this.getChildAt;\n\n  /**\n   * The id of the current {@linkcode Interpreter} service.\n   * Used for child machines identification.\n   */\n  id?: string;\n\n  from?: string;\n\n  /**\n   * The accessor of {@linkcode Mode} of this {@linkcode Interpreter} service\n   */\n  get mode() {\n    return this.#mode;\n  }\n\n  /**\n   * @deprecated\n   *\n   * Used for typings only\n   * The accessor of current {@linkcode ToEvents} of this {@linkcode Interpreter} service\n   *\n   * @remarks Usually for typings\n   */\n  get event() {\n    return this.#event;\n  }\n\n  /**\n   * The accessor of the map of events from the inner {@linkcode Machine}.\n   */\n  get eventsMap() {\n    return this.#machine.eventsMap;\n  }\n\n  get tags() {\n    return getTags<Ta>(this.#config);\n  }\n\n  readonly #schedulerValue = createScheduler();\n  readonly #schedulerContexts = createScheduler();\n  readonly #schedulerEvent = createScheduler();\n  readonly #schedulerStatus = createScheduler();\n\n  /**\n   * Where everything is initialized\n   * @param machine, the {@linkcode Machine} to interpret.\n   * @param mode, the {@linkcode Mode} of the interpreter, default is 'strict'.\n   * @param exact, whether to use exact intervals or not, default is false.\n   */\n  constructor(\n    machine: AnyMachine<E, A, Pc, Tc>,\n    mode: Mode = 'strict',\n    exact = true,\n  ) {\n    this.#machine = machine.renew;\n    this.#config = this.#initialConfig = this.#machine.initialConfig;\n    this.#initialNode = this.#resolveNode(this.#initialConfig);\n    this.#mode = mode;\n    this.#exact = exact;\n    this.#performConfig(true);\n\n    this.#state = this.#previousState = {\n      status: this.#status,\n      context: this.#context,\n      event: { type: INIT_EVENT, payload: {} } as any,\n      value: this.#value,\n      tags: this.tags,\n    };\n\n    this.#collectEmitterConfigs();\n    this.#collectChildrenConfig();\n    this.#throwing();\n  }\n\n  /**\n   * Checks if the current {@linkcode Mode} mode is 'strict'.\n   */\n  get isStrict() {\n    return this.#mode === 'strict';\n  }\n\n  /**\n   * Checks if the current {@linkcode Mode} mode is 'normal'.\n   */\n  get isNormal() {\n    return this.#mode === 'normal';\n  }\n\n  get #schedulers() {\n    return [\n      this.#schedulerValue,\n      this.#schedulerContexts,\n      this.#schedulerEvent,\n      this.#schedulerStatus,\n    ];\n  }\n\n  // #startSchedulers = () => {\n  //   this.#schedulers.forEach(this.#start);\n  // };\n\n  #stopSchedulers = () => {\n    this.#schedulers.forEach(this.#stop);\n  };\n\n  /**\n   * Use to manage internal errors and warnings.\n   */\n  #throwing = () => {\n    if (this.isStrict) {\n      const check1 = this.#warningsCollector.size > 0;\n      if (check1) {\n        const warnings = this.#displayConsole(this.#warningsCollector);\n        console.log(warnings);\n      }\n\n      /* v8 ignore next 5 */\n      const check2 = this.#errorsCollector.size > 0;\n      if (check2) {\n        const errors = this.#displayConsole(this.#errorsCollector);\n        throw new Error(errors);\n      }\n\n      return;\n    }\n\n    if (this.isNormal) {\n      const check3 = this.#errorsCollector.size > 0;\n      if (check3) {\n        const errors = this.#displayConsole(this.#errorsCollector);\n        console.error(errors);\n      }\n\n      /* v8 ignore next 8 */\n      const check4 = this.#warningsCollector.size > 0;\n      if (check4) {\n        const warnings = this.#displayConsole(this.#warningsCollector);\n        console.log(warnings);\n      }\n\n      return;\n    }\n  };\n\n  /**\n   * Assign the current {@linkcode State} and the previous {@linkcode State} of the {@linkcode Interpreter} service and flush all subscribers.\n   * @param parts, Partial {@linkcode State}\n   *\n   * @see {@linkcode SubscriberClass}\n   * @see {@linkcode SubscriberClass}\n   */\n  #performStates = (parts?: Partial<State<Eo, Tc, Ta>>) => {\n    this.#previousState = cloneDeep(this.#state);\n    this.#state = { ...this.#state, ...parts };\n    const check = !equal(this.#previousState, this.#state);\n    if (check) this.#flush();\n  };\n\n  /**\n   * Performs computations, after transitioning to the next target, to update the current {@linkcode NodeConfigWithInitials} config state of this {@linkcode Interpreter} service\n   */\n  protected _performConfig = () => {\n    const value = nodeToValue(this.#config as any);\n    const cb = () => (this.#value = value);\n    this.#schedulerValue.schedule(cb, this.#sent);\n    this.#node = this.#resolveNode(this.#config);\n    const configForFlat = _unknown<NodeConfig>(this.#config);\n    this.#flat = _any(flatMap(configForFlat, true));\n  };\n\n  /**\n   * Performs computations, to update the current {@linkcode NodeConfigWithInitials} config state of this {@linkcode Interpreter} service\n   * @param target, the target to perform the config for.\n   */\n  #performConfig = (target?: string | true) => {\n    if (target === true) {\n      this._performConfig();\n      const value = this.#value;\n      const tags = this.tags;\n      return this.#performStates({ value, tags });\n    }\n\n    if (target) {\n      this.#config = initialConfig(this.proposedNextConfig(target));\n      const tags = this.tags;\n      this._performConfig();\n      const value = this.#value;\n      return this.#performStates({ tags, value });\n    }\n  };\n\n  protected _iterate = () => this.#iterator++;\n\n  /**\n   * Resolves a {@linkcode Node} from the given {@linkcode NodeConfigWithInitials} configuration.\n   *\n   * @param config of type {@linkcode NodeConfigWithInitials}, the configuration to resolve.\n   *\n   * @returns a {@linkcode Node} resolved from the configuration.\n   *\n   * @see {@linkcode resolveNode} for the actual resolution logic.\n   * @see {@linkcode E}\n   * @see {@linkcode P}\n   * @see {@linkcode Pc}\n   * @see {@linkcode Tc}\n   */\n  #resolveNode = (config: NodeConfig) => {\n    const options = this.#machine.options;\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n\n    return resolveNode<E, A, Pc, Tc, Ta, Eo>(\n      events,\n      actorsMap,\n      config,\n      options as any,\n    );\n  };\n\n  /**\n   * The accessor of initial {@linkcode Node} of the inner {@linkcode Machine}.\n   */\n  get initialNode() {\n    return this.#initialNode;\n  }\n\n  /**\n   * The accessor of current {@linkcode Node} of this {@linkcode Interpreter} service.\n   */\n  get node() {\n    return this.#node;\n  }\n\n  /**\n   * Set the current {@linkcode Mode} of this {@linkcode Interpreter} service to 'strict'.\n   * In this mode, all errors are thrown and warnings are logged to the console.\n   */\n  makeStrict = () => {\n    this.#mode = 'strict';\n  };\n\n  /**\n   * Set the current {@linkcode Mode} of this {@linkcode Interpreter} service to 'normal'.\n   * In this mode, errors are logged to the console, but not thrown.\n   */\n  makeNormal = () => {\n    this.#mode = 'normal';\n  };\n\n  /**\n   * The public accessor of initial {@linkcode WorkingStatus} status of the this {@linkcode Interpreter} service.\n   */\n  get status() {\n    return this.#status;\n  }\n\n  /**\n   * The public accessor of initial {@linkcode NodeConfigWithInitials} of the inner {@linkcode Machine}.\n   */\n  get initialConfig() {\n    return this.#initialConfig;\n  }\n\n  /**\n   * The public accessor of initial {@linkcode StateValue} of the inner {@linkcode Machine}.\n   */\n  get initialValue() {\n    return this.#machine.initialValue;\n  }\n\n  /**\n   * The public accessor of current {@linkcode NodeConfigWithInitials} config state of this {@linkcode Interpreter} service.\n   */\n  get config() {\n    return this.#config;\n  }\n\n  /**\n   * Create a new {@linkcode Interpreter} instance with the same initial configuration as this instance.\n   */\n  get renew() {\n    const out = new Interpreter(this.#machine);\n    out._ppC(this.#initialPpc);\n    out._provideContext(this.#initialContext);\n\n    return out;\n  }\n\n  /**\n   * The public accessor of current {@linkcode StateValue}> of this {@linkcode Interpreter} service.\n   */\n  get value() {\n    return this.#value;\n  }\n\n  /**\n   * The public accessor of current {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   */\n  get context() {\n    return this.#context;\n  }\n\n  /**\n   * @deprecated\n   * Just use for testing\n   * @returns the current {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   * @remarks returns nothing in prod\n   *\n   * @see {@linkcode context} to get the current context.\n   */\n  get _pContext() {\n    if (IS_TEST) {\n      return this.#pContext;\n      /* v8 ignore next 4 */\n    }\n    console.error('pContext is not available in production');\n    return;\n  }\n\n  get isReady() {\n    return this.#status !== 'idle' && this.#status !== 'stopped';\n  }\n\n  /**\n   * Select a path from the current {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   *\n   * @param path, the key to select from the current {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   *\n   * @returns the value from the path from the current {@linkcode Tc} context of this {@linkcode Interpreter} service.\n   *\n   * @see {@linkcode getByKey} for retrieving values by key.\n   */\n\n  get select(): Selector_F<Tc> {\n    const check = isPrimitive(this.#context);\n    if (check) return undefined as any;\n    const out = (path: string) => getByKey(this.#state.context, path);\n    return out as any;\n  }\n\n  /**\n   * @deprecated\n   * Select a path from the current {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   *\n   * @param path, the key to select from the current {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   *\n   * @returns the value from the path from the current {@linkcode Pc} private context of this {@linkcode Interpreter} service.\n   *\n   * @remarks returns nothing in prod\n   *\n   * @see {@linkcode getByKey} for retrieving values by key.\n   */\n  get _pSelect(): Selector_F<Pc> {\n    if (IS_TEST) {\n      const check = this.isReady && isPrimitive(this.#pContext);\n      const pContext = this.#pContext;\n      if (check) return undefined as any;\n      if (pContext) {\n        const out: any = (path: string) => getByKey(pContext, path);\n        return out as any;\n      }\n      /* v8 ignore next 4 */\n    }\n    console.error('pContext is not available in production');\n    return undefined as any;\n  }\n\n  /**\n   * Set the current {@linkcode WorkingStatus} private context of this {@linkcode Interpreter} service.\n   * @returns 'started'.\n   */\n  #startStatus = (): WorkingStatus => {\n    this.#setStatus('started');\n    return 'started';\n  };\n\n  /**\n   * Helper to format inner errors and warnings.\n   * @param messages - an iterable of messages to format.\n   * @returns an array of messages joined by new line.\n   *\n   * @remarks Used to display console messages in a readable format.\n   */\n  #displayConsole = (messages: Iterable<string>) => {\n    return Array.from(messages).join('\\n');\n  };\n\n  /**\n   * Flushes all subscribers and map subscribers of this {@linkcode Interpreter} service.\n   *\n   * @see {@linkcode SubscriberClass} for more information about subscribers.\n   * @see {@linkcode SubscriberClass} for more information about map subscribers.\n   */\n  #flush = () => {\n    const all = [...this.#innerSubscribers, ...this.#subscribers];\n    all.forEach(({ fn }) => fn(this.#previousState, this.#state));\n  };\n\n  /**\n   * All actions that are currently scheduled to be performed.\n   * @returns an array of {@linkcode Timeout2} that are currently scheduled to be performed.\n   */\n  #timeoutActions: Timeout2[] = [];\n\n  #startChildren = () => {\n    this.#collectedChildren.forEach(({ service }) => {\n      service.start();\n    });\n  };\n\n  #pauseChildren = (\n    filter: Parameters<Array<CollectedService>['filter']>[0] = () => true,\n  ) => {\n    this.#collectedChildren\n      .filter(filter)\n      .forEach(({ service }) => service.pause());\n  };\n\n  #stopChildren = (\n    filter: Parameters<Array<CollectedService>['filter']>[0] = () => true,\n  ) => {\n    this.#collectedChildren.filter(filter).forEach(({ service, id }) => {\n      service.stop();\n      this.#collectedChildren = this.#collectedChildren.filter(\n        f => f.id !== id,\n      );\n    });\n  };\n\n  #resumeChildren = (\n    filter: Parameters<Array<CollectedService>['filter']>[0] = () => true,\n  ) => {\n    this.#collectedChildren\n      .filter(filter)\n      .forEach(({ service }) => service.resume());\n  };\n\n  /**\n   * Start this {@linkcode Interpreter} service.\n   */\n  start = async () => {\n    this.#collectChildren();\n    this.#collectPausables();\n    this.#throwing();\n    this.#startStatus();\n    this.#startPausables();\n    this.#flush();\n    this.#startInitialEntries();\n    this.#startChildren();\n    this.#throwing();\n    this._next();\n  };\n\n  /**\n   * Pause the collection of all currents {@linkcode Interval2} intervals, related to current {@linkcode ActivityConfig}s of this {@linkcode Interpreter} service.\n   *\n   */\n  #pauseAllActivities = () => {\n    this._cachedIntervals.forEach(this.#pause);\n  };\n\n  /**\n   * Used to track number of self transitions\n   */\n  #selfTransitionsCounter = 0;\n\n  /**\n   * Performs all self transitions and activities of this {@linkcode Interpreter} service.\n   */\n  #next = () => {\n    const filter: Parameters<\n      Array<{ from: string; id: string }>['filter']\n    >[0] = ({ from, id }, _, all) => {\n      const isOutside = !this.#isInsideValue(from);\n\n      const hasSiblingsWithSameId = all\n        .filter(val => val.from !== from)\n        .map(({ id }) => id)\n        .includes(id);\n\n      const check1 = isOutside && hasSiblingsWithSameId;\n      if (check1) return false;\n      return isOutside;\n    };\n\n    this.#collectChildren();\n    this.#collectPausables();\n    this.#selfTransitionsCounter++;\n    this.#pauseAllActivities();\n    this.#performActivities();\n    this.#stopPausables(filter);\n    this.#pausePausables(({ from }) => this.#isInsideValue(from));\n    this.#pauseChildren(({ from }) => this.#isInsideValue(from));\n    this.#stopChildren(filter);\n    this.#startChildren();\n    this.#resumeChildren(({ from }) => !this.#isInsideValue(from));\n    this.#startPausables();\n    this.#resumePausables(({ from }) => this.#isInsideValue(from));\n\n    return this.#performSelfTransitions();\n  };\n\n  /**\n   * Performs all self transitions and activities of this {@linkcode Interpreter} service.\n   * @remarks Throw if the number of self transitions exceeds {@linkcode DEFAULT_MAX_SELF_TRANSITIONS}.\n   */\n  protected _next = async () => {\n    // eslint-disable-next-line no-useless-assignment\n    let check = false;\n    do {\n      const startTime = Date.now();\n      const previousValue = this.#value;\n\n      const checkCounter =\n        this.#selfTransitionsCounter >= DEFAULT_MAX_SELF_TRANSITIONS;\n      if (checkCounter) return this.#throwMaxCounter();\n      this.#throwing();\n      await this.#next();\n\n      const currentValue = this.#value;\n      check = !equal(previousValue, currentValue);\n      if (check) this.#flush();\n\n      const duration = Date.now() - startTime;\n      const check2 = duration > TIME_TO_RINIT_SELF_COUNTER;\n      if (check2) this.#selfTransitionsCounter = 0;\n    } while (check);\n\n    this.#selfTransitionsCounter = 0;\n  };\n\n  get #cloneState(): StateExtended<Eo, Pc, Tc, Ta> {\n    const pContext = cloneDeep(this.#pContext);\n    return structuredClone({ pContext, ...this.#state });\n  }\n\n  #performAction: PerformActionLater_F<Eo, Pc, Tc, Ta> = action => {\n    this._iterate();\n    const out = withTimeout(\n      async () => action(this.#cloneState),\n      'Action timed out',\n      ...(this.longRuns ? [] : [DEFAULT_MAX_TIME_PROMISE]),\n    );\n\n    return out();\n  };\n\n  #performScheduledAction = (scheduled?: ScheduledData<Pc, Tc>) => {\n    if (!scheduled) return;\n    const { data, ms: timeout, id } = scheduled;\n    const callback = () => this.#mergeContexts(data);\n    this.#timeoutActions.filter(f => f.id === id).forEach(this.#dispose);\n    this.#timeoutActions = this.#timeoutActions.filter(f => f.id !== id);\n    const timer = createTimeout({ callback, timeout, id });\n    this.#timeoutActions.push(timer);\n    timer.start();\n  };\n\n  #performSendToAction = (sentEvent?: { to: string; event: any }) => {\n    if (!sentEvent) return;\n    return this.#sendTo(sentEvent.to, sentEvent.event);\n  };\n\n  #performResendAction = async (resend?: EventArg<E>) => {\n    if (!resend) return;\n    const cannot = this.#cannotPerformEvents(resend);\n    if (cannot) return;\n\n    return this.send(resend);\n  };\n\n  /**\n   * Force transition to performs inner actions despite the current state.\n   * This is useful for sending events that are not part of the current state transitions.\n   * @param transitions, the transitions to perform.\n   * @returns the result of the transitions.\n   *\n   * @see {@linkcode TransitionConfig} for more information about transitions.\n   */\n  #performForceSendAction = async (forceSend?: EventArg<E>) => {\n    if (!forceSend) return;\n    const values = Object.values(this.#machine.flat);\n\n    for (const { on } of values) {\n      const type = eventToType(forceSend);\n      const transitions = toArray.typed(on?.[type]);\n      await this.__performTransitions(...(transitions as any));\n    }\n  };\n\n  #performPauseActivityAction = (id?: string) => {\n    if (!id) return;\n    this.#currentActivities?.filter(f => f.id === id).forEach(this.#pause);\n  };\n\n  #performResumeActivityAction = (id?: string) => {\n    if (!id) return;\n    this.#currentActivities\n      ?.filter(f => f.id === id)\n      .forEach(this.#resume);\n  };\n\n  #performStopActivityAction = (id?: string) => {\n    if (!id) return;\n    this.#currentActivities\n      ?.filter(f => f.id === id)\n      .forEach(this.#dispose);\n  };\n\n  #performPauseTimerAction = (id?: string) => {\n    if (!id) return;\n    this.#timeoutActions.filter(f => f.id === id).forEach(this.#pause);\n  };\n\n  #performResumeTimerAction = (id?: string) => {\n    if (!id) return;\n    this.#timeoutActions.filter(f => f.id === id).forEach(this.#resume);\n  };\n\n  #performStopTimerAction = (id?: string) => {\n    if (!id) return;\n    this.#timeoutActions.filter(f => f.id === id).forEach(this.#stop);\n  };\n\n  #performsExtendedActions = async ({\n    forceSend,\n    resend,\n    scheduled,\n    pauseActivity,\n    resumeActivity,\n    stopActivity,\n    pauseTimer,\n    resumeTimer,\n    stopTimer,\n    sentEvent,\n  }: ExtendedActionsParams<E, Pc, Tc>) => {\n    this.#performSendToAction(sentEvent);\n\n    this.#performScheduledAction(scheduled);\n    this.#performPauseActivityAction(pauseActivity);\n    this.#performResumeActivityAction(resumeActivity);\n    this.#performStopActivityAction(stopActivity);\n    this.#performPauseTimerAction(pauseTimer);\n    this.#performResumeTimerAction(resumeTimer);\n    this.#performStopTimerAction(stopTimer);\n\n    // ForceSendAction returns the result to make further actions\n    const result =\n      (await this.#performForceSendAction(forceSend)) ??\n      (await this.#performResendAction(resend));\n\n    return result;\n  };\n\n  #executeAction: PerformAction_F<Eo, Pc, Tc, Ta> = async action => {\n    this.#makeBusy();\n\n    const { pContext, context, ...extendeds } =\n      await this.#performAction(action);\n\n    this.#mergeContexts({ pContext, context });\n    await this.#performsExtendedActions(extendeds);\n  };\n\n  /**\n   * Throws if the number of self transitions exceeds {@linkcode DEFAULT_MAX_SELF_TRANSITIONS}.\n   */\n  #throwMaxCounter() {\n    const error = `Too much self transitions, exceeded ${DEFAULT_MAX_SELF_TRANSITIONS} transitions`;\n    if (IS_TEST) {\n      this._addError(error);\n      this.#throwing();\n      this.stop();\n      /* v8 ignore next 1 */\n    } else throw error;\n  }\n\n  #performActions = async (...actions: ActionConfig[]) => {\n    const fns = actions.map(this.toActionFn).filter(f => f !== undefined);\n\n    for (const fn of fns) {\n      await this.#executeAction(fn);\n    }\n  };\n\n  #performPredicate: PerformPredicate_F<Eo, Pc, Tc, Ta> = predicate => {\n    this._iterate();\n    return predicate(this.#cloneState);\n  };\n\n  #executePredicate: PerformPredicate_F<Eo, Pc, Tc, Ta> = predicate => {\n    this.#makeBusy();\n    const out = this.#performPredicate(predicate);\n\n    this.#makeWork();\n\n    return out;\n  };\n\n  #performPredicates = (...guards: GuardConfig[]) => {\n    if (guards.length < 1) return true;\n    return guards\n      .map(this.toPredicateFn)\n      .filter(isDefined)\n      .map(this.#executePredicate)\n      .every(b => b);\n  };\n\n  #performDelay: PerformDelay_F<Eo, Pc, Tc, Ta> = delay => {\n    this._iterate();\n    return delay(this.#cloneState);\n  };\n\n  #executeDelay: PerformDelay_F<Eo, Pc, Tc, Ta> = delay => {\n    this.#makeBusy();\n    const out = this.#performDelay(delay);\n    this.#startStatus();\n    return out;\n  };\n\n  #mergeContexts: DirectMerge_F<Pc, Tc> = result => {\n    const cb = () => {\n      this.#pContext = (result?.pContext as any) ?? this.#pContext;\n      const context = (result?.context as any) ?? this.#context;\n      this.#context = context;\n      return this.#performStates({ context });\n    };\n\n    return this.#schedulerContexts.schedule(cb, this.#sent);\n  };\n\n  #executeActivities: ExecuteActivities_F = (from, _activities) => {\n    const entries = Object.entries(_activities);\n    const outs: string[] = [];\n\n    for (const [_delay, _activity] of entries) {\n      const id = `${from}::${_delay}`;\n      let index = -1;\n      const _interval = this._cachedIntervals.find((f, i) => {\n        const check = f.id === id;\n        if (check) index = i;\n        return check;\n      });\n\n      const buildCallback = () => {\n        const delayF = this.toDelayFn(_delay);\n        const check0 = !isDefined(delayF);\n        if (check0) return;\n        const interval = this.#executeDelay(delayF);\n\n        const check11 = interval < DEFAULT_MIN_ACTIVITY_TIME;\n        if (check11) {\n          this._addWarning(`Delay (${_delay}) is too short`);\n          return;\n        }\n\n        const check12 = interval > DEFAULT_MAX_TIME_PROMISE;\n        if (check12) {\n          this._addWarning(`Delay (${_delay}) is too long`);\n          return;\n        }\n\n        const activities = toArray.typed(_activity);\n\n        const callback = async () => {\n          for (const activity of activities) {\n            const check2 = typeof activity === 'string';\n            const check3 = isDescriber(activity);\n            const check4 = check2 || check3;\n\n            if (check4) {\n              await this.#performActions(activity);\n              continue;\n            }\n\n            const check5 = this.#performPredicates(\n              ...toArray.typed(activity.guards),\n            );\n            if (check5) {\n              const actions = toArray.typed(activity.actions);\n              await this.#performActions(...actions);\n            }\n          }\n        };\n\n        const promise = this.createInterval({\n          callback,\n          interval,\n          id,\n        });\n\n        this._cachedIntervals.push(promise);\n\n        return id;\n      };\n\n      if (_interval) {\n        const check =\n          _interval.state === 'idle' || _interval.state === 'paused';\n        if (check) {\n          this._cachedIntervals.splice(index, 1);\n          const result = buildCallback();\n          if (!result) return [];\n          outs.push(result);\n        } else outs.push(id);\n        continue;\n      }\n\n      const result = buildCallback();\n      if (!result) return [];\n\n      outs.push(result);\n    }\n\n    return outs;\n  };\n\n  #exact: boolean;\n\n  protected createInterval: CreateInterval2_F = ({\n    callback,\n    id,\n    interval,\n  }) => {\n    const exact = this.#exact;\n    const out = createInterval({\n      callback,\n      id,\n      interval,\n      exact,\n    });\n\n    return out;\n  };\n\n  /**\n   * Collection of all currents {@linkcode Interval2} intervals, related to current {@linkcode ActivityConfig}s of this {@linkcode Interpreter} service.\n   */\n  protected _cachedIntervals: Interval2[] = [];\n\n  #performTransition: PerformTransition_F = async transition => {\n    const check = typeof transition == 'string';\n    if (check) {\n      const { diffEntries, diffExits } = this.#diffNext(transition);\n      await this.#performActions(...toArray.typed(diffExits));\n      await this.#performActions(...toArray.typed(diffEntries));\n      return transition;\n    }\n    const { guards, actions, target } = transition;\n    const { diffEntries, diffExits } = this.#diffNext(target);\n\n    const response = this.#performPredicates(\n      ...toArray<GuardConfig>(guards),\n    );\n\n    if (response) {\n      await this.#performActions(...toArray.typed(diffExits));\n      await this.#performActions(...toArray.typed(actions));\n      await this.#performActions(...toArray.typed(diffEntries));\n      return target ?? false;\n    }\n    return false;\n  };\n\n  protected __performTransitions: PerformTransitions_F = async (\n    ...transitions\n  ) => {\n    for (const _transition of transitions) {\n      const transition = await this.#performTransition(_transition);\n      const check1 = typeof transition === 'string';\n      if (check1) return transition;\n    }\n\n    return false;\n  };\n\n  #performFinally = (_finally?: FinallyConfig) => {\n    const check1 = _finally === undefined;\n    if (check1) return;\n\n    const finals = toArray.typed(_finally);\n\n    for (const final of finals) {\n      const check2 = typeof final === 'string';\n      const check3 = isDescriber(final);\n\n      const check4 = check2 || check3;\n      if (check4) {\n        this.#performActions(final);\n        continue;\n      }\n\n      const response = this.#performPredicates(\n        ...toArray.typed(final.guards),\n      );\n      if (response) {\n        this.#performActions(...toArray.typed(final.actions));\n      }\n    }\n    return;\n  };\n\n  get #sending() {\n    return this.#status === 'sending';\n  }\n\n  get longRuns() {\n    return this.#machine.longRuns;\n  }\n\n  /**\n   * Checks if sent events cannot be performed.\n   * @param from - the config value from which the events are sent.\n   * @returns true if the events cannot be performed, false otherwise.\n   */\n  #cannotPerform = (from: string) => {\n    const check = this.#sending || !this.#isInsideValue(from);\n    return check;\n  };\n\n  #performAfter: PerformAfter_F = (from, after) => {\n    const entries = Object.entries(after);\n    const promises: TimeoutPromise<string | false>[] = [];\n\n    entries.forEach(([_delay, transition]) => {\n      const delayF = this.toDelayFn(_delay);\n      const check0 = !isDefined(delayF);\n      if (check0) return;\n      const delay = this.#executeDelay(delayF);\n\n      const check1 = delay > DEFAULT_MAX_TIME_PROMISE;\n      if (check1) {\n        this._addWarning(`Delay ${_delay} is too long`);\n        return;\n      }\n\n      const transitions = toArray.typed(transition);\n\n      const _promise = async () => {\n        await sleep(delay);\n        if (this.#cannotPerform(from)) return false;\n\n        const func = () =>\n          this.__performTransitions(...(transitions as any));\n\n        const out = await func();\n\n        if (out === false) {\n          const message = `No transitions reached from \"${from}\" by delay \"${_delay}\" !`;\n\n          throw message;\n        }\n        return out;\n      };\n\n      const promise = withTimeout(\n        _promise,\n        from,\n        ...(this.longRuns ? [] : [DEFAULT_MAX_TIME_PROMISE]),\n      );\n\n      promises.push(promise);\n    });\n\n    const check5 = promises.length < 1;\n    if (check5) return;\n\n    const promise = anyPromises(from, ...promises);\n    return promise;\n  };\n\n  #performAlways: PerformAlway_F = alway => {\n    this.#changeEvent(transformEventArg(ALWAYS_EVENT));\n    const always = toArray<TransitionConfig>(alway);\n    return this.__performTransitions(...always);\n  };\n\n  get #collectedActivities() {\n    const entriesFlat = Object.entries(this.#flat);\n\n    const entries: [from: string, activities: ActivityConfig][] = [];\n\n    entriesFlat.forEach(([from, { activities }]) => {\n      if (activities) {\n        entries.push([from, activities]);\n      }\n    });\n\n    return entries;\n  }\n\n  get #collectedAfters() {\n    const entriesFlat = Object.entries(this.#flat);\n    const entries: [from: string, after: DelayedTransitions][] = [];\n\n    entriesFlat.forEach(([from, node]) => {\n      const after = node.after;\n      if (after) {\n        entries.push([from, after]);\n      }\n    });\n\n    return entries;\n  }\n\n  get #collectedAlways() {\n    const entriesFlat = Object.entries(this.#flat);\n    const entries: [from: string, always: AlwaysConfig][] = [];\n\n    entriesFlat.forEach(([from, node]) => {\n      const always = node.always;\n      if (always) {\n        entries.push([from, always]);\n      }\n    });\n\n    return entries;\n  }\n\n  get #currentActivities() {\n    const collected = this.#collectedActivities.filter(([from]) =>\n      this.#isInsideValue(from),\n    );\n    const check = collected.length < 1;\n    if (check) return;\n\n    const ids: string[] = [];\n    for (const args of collected) {\n      ids.push(...this.#executeActivities(...args));\n    }\n\n    return this._cachedIntervals.filter(({ id }) => ids.includes(id));\n  }\n\n  #performActivities = () => {\n    return this.#currentActivities?.forEach(this.#start);\n  };\n\n  #startPausables = () => {\n    this.#collectedPausables.forEach(({ pausable }) => pausable.start());\n  };\n\n  #resumePausables = (\n    filter: (value: CollectedPausable) => boolean = () => true,\n  ) => {\n    this.#collectedPausables\n      .filter(filter)\n      .forEach(({ pausable }) => pausable.resume());\n  };\n\n  #stopPausables = (\n    filter: Parameters<Array<CollectedPausable>['filter']>[0] = () => true,\n  ) => {\n    this.#collectedPausables.filter(filter).forEach(({ pausable, id }) => {\n      pausable.stop();\n      this.#collectedPausables = this.#collectedPausables.filter(\n        f => f.id !== id,\n      );\n    });\n  };\n\n  #pausePausables = (\n    filter: (value: CollectedPausable) => boolean = () => true,\n  ) => {\n    this.#collectedPausables\n      .filter(filter)\n      .forEach(({ pausable }) => pausable.pause());\n  };\n\n  /**\n   * Get all brut self transitions of the current {@linkcode NodeConfigWithInitials} config state of this {@linkcode Interpreter} service.\n   */\n  get #collectedSelfTransitions0() {\n    const entries = new Map<string, Collected0>();\n\n    this.#collectedAlways.forEach(([from, always]) => {\n      entries.set(from, { always: () => this.#performAlways(always) });\n    });\n\n    this.#collectedAfters.forEach(([from, after]) => {\n      const inner = entries.get(from);\n      if (inner) {\n        inner.after = this.#performAfter(from, after);\n      } else entries.set(from, { after: this.#performAfter(from, after) });\n    });\n\n    return entries;\n  }\n\n  /**\n   * Changes the current {@linkcode ToEvents} event of this {@linkcode Interpreter} service.\n   *\n   * @param event - the {@linkcode ToEventsR} event to change the current {@linkcode Interpreter} service state.\n   */\n  #changeEvent = (event: Eo) => {\n    const cb = () => {\n      this.#performStates({ event });\n      this.#event = event;\n    };\n\n    return this.#schedulerEvent.schedule(cb, this.#sent);\n  };\n\n  get #collectedSelfTransitions() {\n    const entries = Array.from(this.#collectedSelfTransitions0).filter(\n      ([from]) => this.#isInsideValue(from),\n    );\n\n    const out = entries.map(([from, { after, always }]) => {\n      const promise = async () => {\n        if (always) {\n          const target = await always();\n          if (target !== false) return this.#performConfig(target);\n        }\n\n        // const promises: TimeoutPromise<void>[] = [];\n        if (after) {\n          const _after = async () => {\n            await after()\n              .then(transition => {\n                if (transition !== false)\n                  return this.#performConfig(transition);\n              })\n              .catch(() =>\n                this._addWarning(\n                  `${from}::after - No transitions reached!`,\n                ),\n              );\n          };\n          await _after();\n        }\n      };\n\n      return withTimeout(promise, 'self-transition');\n    });\n\n    if (out.length < 1) return;\n    return anyPromises('self-transition', ...out);\n  }\n\n  #collectedEmitterConfigs: [\n    from: string,\n    ...emitters: (EmitterConfig & { id: string })[],\n  ][] = [];\n\n  #collectEmitterConfigs = () => {\n    const entriesFlat = Object.entries(this.#machine.flat);\n    const entries: [\n      from: string,\n      ...emitters: (EmitterConfig & { id: string })[],\n    ][] = [];\n\n    entriesFlat.forEach(([from, node]) => {\n      const actors = Object.entries(node.actors ?? {});\n      const emitters = toArray\n        .typed(actors)\n        .map(([id, actor]) => ({ ...actor, id }))\n        .filter(actor => 'next' in actor);\n      if (node.actors) {\n        entries.push([from, ...emitters]);\n      }\n    });\n\n    this.#collectedEmitterConfigs.push(...entries);\n    return entries;\n  };\n\n  #collectedChildrenConfig: [\n    from: string,\n    ...children: (ChildConfig & { id: string })[],\n  ][] = [];\n\n  #collectChildrenConfig = () => {\n    const entriesFlat = Object.entries(this.#machine.flat);\n    const entries: [\n      from: string,\n      ...children: (ChildConfig & { id: string })[],\n    ][] = [];\n\n    entriesFlat.forEach(([from, node]) => {\n      const actors = Object.entries(node.actors ?? {});\n      const chidlren = toArray\n        .typed(actors)\n        .map(([id, actor]) => ({ ...actor, id }))\n        .filter(actor => 'on' in actor || 'contexts' in actor);\n      if (node.actors) {\n        entries.push([from, ...chidlren]);\n      }\n    });\n\n    this.#collectedChildrenConfig.push(...entries);\n    return entries;\n  };\n\n  #collectedPausables: CollectedPausable[] = [];\n\n  #collectPausables = () => {\n    type _Emitter = EmitterConfig & {\n      emitterFn: EmitterFunction2<Eo, Pc, Tc, Ta>;\n      id: string;\n    };\n    return this.#collectedEmitterConfigs\n      .filter(([from]) => this.#isInsideValue(from))\n      .filter(([from]) => {\n        const froms = this.#collectedPausables.map(({ from }) => from);\n        return !froms.includes(from);\n      })\n      .map(([from, ..._emitters]) => {\n        const emitters = _emitters\n          .map(({ id, ...rest }) => {\n            return { emitterFn: this.toEmitterSrc(id), ...rest, id };\n          })\n          .filter(({ emitterFn }) => !!emitterFn) as _Emitter[];\n\n        return [from, ...emitters] as const;\n      })\n      .map(([from, ...emitters]) => {\n        const pausables = emitters.map(\n          ({ emitterFn, error, next, complete, id }) => {\n            const pausable = emitterFn(this.#cloneState);\n\n            // Wire the interpreter's transition callbacks into the pausable.\n            pausable.subscribe({\n              next: payload => {\n                const event = {\n                  type: `${id}::next`,\n                  payload,\n                } satisfies EventObject;\n\n                this.#changeEvent(_any(event));\n                const transitions = toArray<TransitionConfig>(next);\n                this.__performTransitions(...transitions);\n              },\n              error: payload => {\n                const event = {\n                  type: `${id}::error`,\n                  payload,\n                } satisfies EventObject;\n\n                this.#changeEvent(_any(event));\n                const transitions = toArray<TransitionConfig>(error);\n                this.__performTransitions(...transitions);\n              },\n              complete: () => this.#performFinally(complete),\n            });\n\n            // // Branch on the interpreter's current status so that pausables\n            // // collected during an active session start immediately, while\n            // // those collected during initial start-up are left in 'stopped'\n            // // state and started by the subsequent #startPausables() call.\n            // switch (this.#status) {\n            //   case 'started':\n            //   case 'working':\n            //   case 'sending':\n            //   case 'busy':\n            //     pausable.start();\n            //     break;\n            //   case 'paused':\n            //     pausable.start();\n            //     pausable.pause();\n            //     break;\n            //   // 'idle' | 'starting' | 'stopped' → #startPausables() handles it\n            // }\n\n            return {\n              pausable,\n              id,\n              from,\n            };\n          },\n        );\n\n        this.#collectedPausables.push(...pausables);\n        return pausables;\n      })\n      .flat();\n  };\n\n  #collectedChildren: CollectedService[] = [];\n  #collectChildren = () => {\n    type _Child = ChildConfig & {\n      childFn: ChildFunction2<Eo, Pc, Tc, Ta>;\n      id: string;\n    };\n\n    return this.#collectedChildrenConfig\n      .filter(([from]) => this.#isInsideValue(from))\n      .filter(([from]) => {\n        const froms = this.#collectedChildren.map(({ from }) => from);\n        return !froms.includes(from);\n      })\n      .map(([from, ..._children]) => {\n        const children = _children\n          .map(({ id, ...rest }) => {\n            return { childFn: this.toChildFunction(id), ...rest, id };\n          })\n          .filter(({ childFn }) => !!childFn) as _Child[];\n\n        return [from, ...children] as const;\n      })\n      .map(([from, ..._children]) => {\n        const services = _children.map(({ childFn, ...rest }) => {\n          const service = this.#executeChild(childFn);\n          return {\n            service,\n            ...rest,\n          };\n        });\n\n        return [from, ...services] as const;\n      })\n      .map(([from, ..._services]) => {\n        const services = _services.map(({ service, on, contexts, id }) => {\n          const si = service as AnyInterpreter & {\n            __subscribe: AddSubscriber_F;\n          };\n\n          const checkOn = on !== undefined && Object.keys(on).length > 0;\n          if (checkOn) {\n            si.__subscribe(\n              payload => {\n                const type = eventToType(payload.event);\n\n                const event = {\n                  type: `${id}::on::${type}`,\n                  payload,\n                } satisfies EventObject;\n\n                this.#changeEvent(_any(event));\n                const transitions = toArray<TransitionConfig>(on?.[type]);\n                this.__performTransitions(...transitions);\n              },\n              {\n                equals: (a, b) => a.event.type === b.event.type,\n                id: `${id}::on`,\n              },\n            );\n          }\n\n          const checkContexts =\n            contexts !== undefined && Object.keys(contexts).length > 0;\n\n          if (checkContexts) {\n            si.__subscribe(\n              ({ context }) => {\n                const entries = Object.entries(contexts);\n                entries.forEach(([key, path]) => {\n                  const pContext =\n                    key === '.'\n                      ? structuredClone(context)\n                      : getByKey.low(context, key);\n\n                  if (path === '.')\n                    return this.#mergeContexts({ pContext });\n                  const cb = () => {\n                    return assignByKey.low(this.#pContext, path, pContext);\n                  };\n                  this.#schedulerContexts.schedule(cb);\n                });\n              },\n              {\n                equals: (a, b) => {\n                  const ac = a.context;\n                  const bc = b.context;\n                  if (equal(ac, bc)) return true;\n                  const keys = Object.keys(contexts);\n\n                  for (const key of keys) {\n                    if (key === '.') return equal(ac, bc);\n                    const _a = getByKey.low(ac, key);\n                    const _b = getByKey.low(bc, key);\n                    if (!equal(_a, _b)) return false;\n                  }\n\n                  return true;\n                },\n                id: `${id}::contexts`,\n              },\n            );\n          }\n\n          return {\n            service: si,\n            id,\n            from,\n          };\n        });\n\n        this.#collectedChildren.push(...services);\n        return services;\n      });\n  };\n\n  #executeChild = (child: ChildFunction2<Eo, Pc, Tc, Ta>) => {\n    const instance = child(this.#cloneState);\n    return instance;\n  };\n\n  #performSelfTransitions = async () => {\n    this.#makeBusy();\n    const previousState = structuredClone(this.#state);\n    await this.#collectedSelfTransitions?.();\n    const nextState = structuredClone(this.#state);\n    const check = !equal(previousState, nextState);\n    if (check) this.#flush();\n    this.#makeWork();\n  };\n\n  #startInitialEntries = () => {\n    const actions = getEntries(this.#initialConfig);\n    if (actions.length < 1) return;\n    this.#performActions(...actions);\n  };\n\n  /**\n   * @deprecated\n   * A mapper function that returns a function to call a method on a value.\n   * @param key - the key of the method to be called on the value.\n   * @returns a function that calls the method on the value.\n   *\n   * @see {@linkcode AllowedNames} for more information about allowed names.\n   * @see {@linkcode Fn} for more information about function\n   */\n  #mapperFn = <T>(key: AllowedNames<T, Fn>) => {\n    return (value: T) => (value as any)[key]();\n  };\n\n  #pause = this.#mapperFn('pause');\n\n  #open = this.#mapperFn('open');\n  #start = this.#mapperFn('start');\n\n  #close = this.#mapperFn('close');\n\n  #resume = this.#mapperFn('resume');\n  #unsubscribe = this.#mapperFn('unsubscribe');\n  #stop = this.#mapperFn('stop');\n  #dispose = this.#mapperFn('dispose');\n\n  pause = () => {\n    this.#pauseAllActivities();\n    this.#makeBusy();\n    this.#subscribers.forEach(this.#close);\n    this.#pauseChildren();\n    this.#pausePausables();\n    this.#timeoutActions.forEach(this.#pause);\n    this.#setStatus('paused');\n  };\n\n  resume = () => {\n    if (this.#status === 'paused') {\n      this.#performActivities();\n      this.#makeBusy();\n      this.#subscribers.forEach(this.#open);\n      this.#timeoutActions.forEach(this.#resume);\n      this.#resumeChildren();\n      this.#resumePausables();\n      this.#makeWork();\n    }\n  };\n\n  stop = () => {\n    this.pause();\n    this.#makeBusy();\n    this.#subscribers.forEach(this.#unsubscribe);\n    this.#stopChildren();\n    this._cachedIntervals.forEach(this.#dispose);\n    this.#timeoutActions.forEach(this.#stop);\n    this.#stopPausables();\n    this.#setStatus('stopped');\n    this.#stopSchedulers();\n  };\n\n  #makeBusy = (): WorkingStatus => {\n    this.#setStatus('busy');\n    return 'busy';\n  };\n\n  #setStatus = (status: WorkingStatus) => {\n    const cb = () => {\n      this.#performStates({ status });\n      return (this.#status = status);\n    };\n\n    return this.#schedulerStatus.schedule(cb, this.#sent);\n  };\n\n  #startingStatus = (): WorkingStatus => {\n    this.#setStatus('starting');\n    return 'starting';\n  };\n\n  /**\n   * @deprecated\n   * Used internally\n   */\n  _providePrivateContext = (pContext: Pc) => {\n    this.#initialPpc = this.#pContext = pContext;\n    this.#makeBusy();\n\n    this.#machine.addPrivateContext(this.#initialPpc);\n\n    this.#startingStatus();\n    return this.#machine;\n  };\n\n  /**\n   * @deprecated\n   * Used internally\n   *\n   * Alias of {@linkcode _providePrivateContext}\n   */\n  _ppC = this._providePrivateContext;\n\n  /**\n   * @deprecated\n   * Used internally\n   */\n  _provideContext = (context: Tc) => {\n    this.#initialContext = this.#context = context;\n    this.#performStates({ context });\n    this.#makeBusy();\n\n    this.#machine.addContext(this.#initialContext);\n\n    this.#startingStatus();\n    return this.#machine;\n  };\n\n  /**\n   * Add options to the inner {@linkcode Machine} of this {@linkcode Interpreter} service.\n   */\n  get addOptions() {\n    return this.#machine.addOptions;\n  }\n\n  /**\n   * Provides options for the interpreter and returns a new interpreter instance.\n   *\n   * @param option a function that provides options for the machine.\n   * Options can include actions, predicates, delays, promises, and child machines.\n   * @returns a new interpreter instance with the provided options applied.\n   */\n  provideOptions = (\n    option: Parameters<(typeof this)['addOptions']>[0],\n  ) => {\n    const newMachine = this.#machine.provideOptions(option);\n    const out = new Interpreter(newMachine, this.#mode, this.#exact);\n    out._ppC(this.#initialPpc);\n    out._provideContext(this.#initialContext);\n    return out;\n  };\n\n  #subscribers = new Set<SubscriberClass<E, A, Tc, Ta, Eo>>();\n  #innerSubscribers = new Set<SubscriberClass<E, A, Tc, Ta, Eo>>();\n\n  // @ts-expect-error Already used recursively\n  subscribe: AddSubscriber_F<E, A, Tc, Ta, Eo> = (\n    _subscriber,\n    options,\n  ) => {\n    const eventsMap = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const find = Array.from(this.#subscribers).find(\n      f => f.id === options?.id,\n    );\n    if (find) return find;\n\n    const subcriber = createSubscriber(\n      eventsMap,\n      actorsMap,\n      _subscriber,\n      options,\n    );\n    this.#subscribers.add(subcriber);\n    return subcriber as any;\n  };\n\n  // @ts-expect-error Already used recursively\n  private __subscribe: AddSubscriber_F<E, A, Tc, Ta, Eo> = (\n    _subscriber,\n    options,\n  ) => {\n    const eventsMap = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n\n    const subscriber = createSubscriber(\n      eventsMap,\n      actorsMap,\n      _subscriber,\n      options,\n    );\n    this.#innerSubscribers.add(subscriber);\n    return subscriber;\n  };\n\n  get state() {\n    return Object.freeze(cloneDeep(this.#state));\n  }\n\n  #errorsCollector = new Set<string>();\n  #warningsCollector = new Set<string>();\n\n  /**\n   * @deprecated\n   * Just use for testing\n   * @remarks returns nothing in prod\n   */\n  get _errorsCollector() {\n    if (IS_TEST) {\n      return this.#errorsCollector;\n      /* v8 ignore next 3 */\n    }\n    console.error('errorsCollector is not available in production');\n    return;\n  }\n\n  /**\n   * @deprecated\n   * Just use for testing\n   * @remarks returns nothing in prod\n   */\n  get _warningsCollector() {\n    if (IS_TEST) {\n      return this.#warningsCollector;\n      /* v8 ignore next 3 */\n    }\n    console.error('warningsCollector is not available in production');\n    return;\n  }\n\n  protected _addError = (...errors: string[]) => {\n    errors.forEach(error => this.#errorsCollector.add(error));\n  };\n\n  protected _addWarning = (...warnings: string[]) => {\n    warnings.forEach(warning => this.#warningsCollector.add(warning));\n  };\n\n  // #region Next\n\n  #extractTransitions = (event: Eo) => {\n    type FlatArray = [from: string, transitions: TransitionConfig[]][];\n    const entriesFlat = Object.entries(this.#flat);\n    const flat: FlatArray = [];\n    const flat2: FlatArray = [];\n\n    const type = event.type;\n    entriesFlat.forEach(([from, node]) => {\n      const on = node.on;\n      const trs = on?.[type];\n      if (trs) {\n        const transitions = toArray.typed(trs);\n        flat.push([from, transitions as any]);\n      }\n    });\n\n    flat.forEach(([from, transitions], _, all) => {\n      const canTake = all.every(\n        ([from2]) => !from2.startsWith(`${from}${DEFAULT_DELIMITER}`),\n      );\n      if (canTake) flat2.push([from, transitions]);\n    });\n\n    flat2.sort((a, b) => {\n      const from1 = a[0];\n      const from2 = b[0];\n\n      const split1 = from1\n        .split(DEFAULT_DELIMITER)\n        .filter(val => !isStringEmpty(val)).length;\n\n      const split2 = from2\n        .split(DEFAULT_DELIMITER)\n        .filter(val => !isStringEmpty(val)).length;\n\n      const splitsAreDifferents = split1 !== split2;\n      if (splitsAreDifferents) return split2 - split1;\n      return from2.localeCompare(from1);\n    });\n\n    return flat2;\n  };\n\n  protected _send: _Send_F<Eo> = async event => {\n    this.#sent = true;\n    this.#changeEvent(event);\n    this.#setStatus('sending');\n    let sv = this.#value;\n\n    const flat2 = this.#extractTransitions(event);\n    // #endregion\n\n    for (const [from, transitions] of flat2) {\n      const cannotContinue = !this.#isInsideValue2(sv, from);\n      if (cannotContinue) continue;\n\n      const target = await this.__performTransitions(\n        ...toArray.typed(transitions),\n      );\n\n      const diffTarget = target === false ? undefined : target;\n      sv = nextSV(sv, diffTarget);\n    }\n\n    const next = switchV({\n      condition: equal(this.#value, sv),\n      truthy: undefined,\n      falsy: initialConfig(this.#machine.valueToConfig(sv)),\n    });\n\n    this.#sent = false;\n    return next;\n  };\n\n  get #possibleEvents() {\n    return possibleEvents(this.#flat);\n  }\n\n  #cannotPerformEvents = (_event: EventArg<E>) => {\n    const type = eventToType(_event);\n    const check = !this.#possibleEvents.includes(type);\n    return check;\n  };\n\n  /**\n   * Creates a sender function for the given event type.\n   * @param type - the {@linkcode EventArgT} type of the event to send.\n   * @returns a function with the payload as Parameter that sends the event with the given type and payload.\n   *\n   * @see {@linkcode send} for sending events directly.\n   */\n  sender = <T extends EventArgT<E>>(type: T) => {\n    type Arg = Extract<ToEventsR<E, A>, { type: T }>['payload'];\n    type Payload = object extends Arg ? [] : [Arg];\n\n    return (...data: Payload) => {\n      const payload = data.length === 1 ? data[0] : {};\n      const event = { type, payload } as EventArg<E>;\n      return this.send(event);\n    };\n  };\n\n  /**\n   * Sends an event without cheching to the current {@linkcode Interpreter} service.\n   *\n   * @param _event - the {@linkcode EventArg} event to send.\n   *\n   */\n  #send = async (_event: EventArg<E>) => {\n    const event = transformEventArg(_event);\n    const next = await this._send(event as any);\n\n    if (isDefined(next)) {\n      this.#config = next;\n      this.#performConfig(true);\n      this.#makeWork();\n      this._next();\n    } else return this.#makeWork();\n  };\n\n  /**\n   * Sends an event to the current {@linkcode Interpreter} service.\n   *\n   * @param _event - the {@linkcode EventArg} event to send.\n   *\n   * @remarks\n   * If the event cannot be performed, it will not be sent.\n   * If the event is sent, it will be processed and the state will be updated.\n   */\n  send = async (_event: EventArg<E>) => {\n    const check = this.#cannotPerformEvents(_event);\n    if (check) return;\n    return this.#send(_event);\n  };\n\n  /**\n   * Proposes the next state value based on the current state value and the target.\n   * @param target - the target state to propose the next state value.\n   * @returns the next {@linkcode StateValue} based on the current state value and the target.\n   *\n   * @remarks\n   * This method calculates the next state value based on the current state value and the target.\n   * It does not change the current state value, but returns the proposed next state value.\n   * It is used internally to calculate the next state value before sending an event.\n   */\n  #proposedNextSV = (target: string) => nextSV(this.#value, target);\n\n  /**\n   * Proposes the next configuration based on the current state value and the target.\n   * @param target - the target state to propose the next configuration.\n   * @returns the proposed next {@linkcode NodeConfigWithInitials} based on the current state value and the target.\n   *\n   * @remarks\n   * Only proposes next config, does not change the current config.\n   *\n   * //\n   *\n  //  * @see {@linkcode Machine.valueToConfig} for more details.\n   *\n   * //\n   */\n  protected proposedNextConfig = (target: string) => {\n    const nextValue = this.#proposedNextSV(target);\n    const out = this.#machine.valueToConfig(nextValue);\n\n    return out;\n  };\n\n  /**\n   * Calculates the difference between the current and next configuration.\n   * @param target - the target state to calculate the difference.\n   * @returns an {@linkcode DiffNext} object containing the proposed next state value, entry actions, and exit actions.\n   *\n   * @remarks\n   * This method is used to calculate the entry and exit actions when transitioning to a new state.\n   * It compares the current configuration with the proposed next configuration and returns the differences.\n   */\n  #diffNext = (target?: string): DiffNext => {\n    if (!target) {\n      return { sv: this.#value, diffEntries: [], diffExits: [] };\n    }\n\n    const next = _unknown<NodeConfig>(\n      initialConfig(_unknown(this.proposedNextConfig(target))),\n    );\n    const flatNext = flatMap(next);\n\n    const entriesCurrent = Object.entries(this.#flat);\n    const keysNext = Object.keys(flatNext);\n\n    const keys = entriesCurrent.map(([key]) => key);\n    const diffEntries: ActionConfig[] = [];\n    const diffExits: ActionConfig[] = [];\n\n    // #region Entry actions\n\n    // These actions are from next config states that are not inside the previous\n    keysNext.forEach(key => {\n      const check2 = !keys.includes(key);\n\n      if (check2) {\n        const out2 = (flatNext as any)[key];\n        const _entries = getEntries(out2);\n        diffEntries.push(..._entries);\n      }\n    });\n    // #endregion\n\n    // #region Exit actions\n\n    // These actions are from previous config states that are not inside the next\n    entriesCurrent.forEach(([key, node]) => {\n      const check2 = !keysNext.includes(key);\n\n      if (check2) {\n        const _exits = getExits(node);\n        diffExits.push(..._exits);\n      }\n    });\n    // #endregion\n    const sv = this.#proposedNextSV(target);\n    return { sv, diffEntries, diffExits };\n  };\n\n  /**\n   * Checks if the given value is inside the current state value.\n   * @param value - the state value to check if it is inside the current state value.\n   * @returns true if the value is inside the current state value, false otherwise.\n   */\n  #isInsideValue = (value: string) => {\n    const out = this.#isInsideValue2(this.#value, value);\n    return out;\n  };\n\n  #isInsideValue2 = (sv: StateValue, value: string) => {\n    if (value === DEFAULT_DELIMITER) {\n      return true;\n    }\n    const values = decomposeSV(sv);\n    const entry = value.substring(1);\n    const state = replaceAll({\n      entry,\n      match: DEFAULT_DELIMITER,\n      replacement: '.',\n    });\n\n    return values.includes(state);\n  };\n\n  /**\n   * Changes the current {@linkcode Interpreter} service status to 'working'.\n   * @returns the current {@linkcode WorkingStatus} of this {@linkcode Interpreter} service.\n   */\n  #makeWork = () => this.#setStatus('working');\n\n  // #endregion\n\n  /**\n   * Returns the output value with a warning if it is not defined.\n   * @param out of type [T], the output value to check if it is defined.\n   * @param messages - the messages to add to the warnings collector if the output is not defined. it's a parram array\n   */\n  #returnWithWarning = <T = any>(\n    out: T | undefined,\n    ...messages: string[]\n  ) => {\n    const check = isDefined(out);\n    if (check) return out;\n\n    this._addWarning(...messages);\n    return;\n  };\n\n  toActionFn = (action: ActionConfig) => {\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const actions = this.#machine.actions;\n\n    return this.#returnWithWarning(\n      toAction<E, A, Pc, Tc, Ta, Eo>(events, actorsMap, action, actions),\n      `Action (${reduceDescriber(action)}) is not defined`,\n    );\n  };\n\n  toPredicateFn = (guard: GuardConfig) => {\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const predicates = this.#machine.predicates;\n\n    const { predicate, errors } = toPredicate<E, A, Pc, Tc, Ta, Eo>(\n      events,\n      actorsMap,\n      guard,\n      predicates,\n    );\n\n    return this.#returnWithWarning(predicate, ...errors);\n  };\n\n  toDelayFn = (delay: string) => {\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const delays = this.#machine.delays;\n\n    return this.#returnWithWarning(\n      toDelay<E, A, Pc, Tc, Ta, Eo>(events, actorsMap, delay, delays),\n      `Delay (${delay}) is not defined`,\n    );\n  };\n\n  toChildFunction = (machine: string) => {\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const machines = this.#machine.children;\n\n    return this.#returnWithWarning(\n      toChildSrc<E, A, Pc, Tc, Ta>(\n        events,\n        actorsMap,\n        machine,\n        machines as any,\n      ),\n      `Machine (${reduceDescriber(machine)}) is not defined`,\n    );\n  };\n\n  toEmitterSrc = (emitter: string) => {\n    const events = this.#machine.eventsMap;\n    const actorsMap = this.#machine.actorsMap;\n    const emitters = this.#machine.emitters;\n\n    return this.#returnWithWarning(\n      toEmitterSrc<E, A, Pc, Tc, Ta>(\n        events,\n        actorsMap,\n        emitter,\n        emitters as any,\n      ),\n      `Emitter (${reduceDescriber(emitter)}) is not defined`,\n    );\n  };\n\n  protected interpretChild = interpret;\n\n  /**\n   * Sends an event to a specific child service by its ID.\n   *\n   * @param to - The ID of the child service to which the event will be sent.\n   * @param : the {@linkcode EventObject} event to send to the child service.\n   *\n   * @see {@linkcode send} for sending events to the current service.\n   */\n  #sendTo = async <T extends EventObject>(to: string, event: T) => {\n    const collector = this.#collectedChildren.filter(\n      ({ from, id }) => this.#isInsideValue(from) && id === to,\n    );\n\n    for (const { service } of collector) {\n      await service.send(event);\n    }\n  };\n\n  // #region Disposable\n\n  dispose = () => {\n    this.stop();\n    this.#collectedChildren.forEach(({ service }) => service.dispose());\n    this.#timeoutActions.forEach(this.#dispose);\n  };\n\n  [Symbol.dispose] = this.dispose;\n\n  [Symbol.asyncDispose] = () => {\n    const out = asyncfy(this[Symbol.dispose]);\n    return out();\n  };\n  // #endregion\n}\n\nexport const TIME_TO_RINIT_SELF_COUNTER = DEFAULT_MIN_ACTIVITY_TIME * 2;\n\n/**\n * Retrieves the {@linkcode Interpreter} service from the given {@linkcode AnyMachine} machine.\n *\n * @template : type {@linkcode AnyMachine} [M] - The type of the machine from which to retrieve the interpreter.\n *\n * @see {@linkcode ConfigFrom}\n * @see {@linkcode PrivateContextFrom}\n * @see {@linkcode ContextFrom}\n * @see {@linkcode EventsMapFrom}\n * @see {@linkcode PromiseesMapFrom}\n * @see {@linkcode MachineOptionsFrom}\n */\nexport type InterpreterFrom<M extends AnyMachine> = Interpreter<\n  ConfigFrom<M>,\n  PrivateContextFrom<M>,\n  ContextFrom<M>,\n  EventsMapFrom<M>,\n  ActorsMapFrom<M>\n>;\n\n/**\n * Creates an {@linkcode Interpreter} service from the given {@linkcode MachineConfig} machine.\n *\n * @param machine - The {@linkcode MachineConfig} machine to create the interpreter from.\n * @param options - The options for the interpreter, including context, private context, mode, and exact.\n * @returns an {@linkcode Interpreter} service.\n *\n * @see {@linkcode MachineConfig}\n */\nexport const interpret: Interpreter_F = (..._args) => {\n  const [machine, args] = _args;\n  const { mode, exact, pContext, context } = args ?? {};\n  const out: any = new Interpreter(machine, mode, exact);\n  out._providePrivateContext(pContext);\n  out._provideContext(context);\n  return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JA,IAAa,cAAb,MAAa,YAQ6B;;;;CAIxC;;;;CAKA,UAAyB;;;;CAKzB;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA,YAAY;;;;CAKZ,SAAaC,mCAAAA,kBAAkBC,yBAAAA,WAAW;;;;CAK1C;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAMA,QAAQ;;;;CAKR,IAAI,WAAW;AACb,SAAO,MAAA;;;;;;;;;CAUT,cAAc,OAAe,KAAK,SAAS,MAAK,MAAK,EAAE,OAAO,GAAG;;;;CAKjE,KAAK,KAAK;;;;;CAMV;CAEA;;;;CAKA,IAAI,OAAO;AACT,SAAO,MAAA;;;;;;;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