class_docstr: The layout for a prompt_toolkit
  :class:`~prompt_toolkit.application.Application`.
  This also keeps track of which user control is focused.
  
  :param container: The "root" container for the layout.
  :param focused_element: element to be focused initially. (Can be anything
      the `focus` function accepts.)
class_docstr_tok: ["The","layout","for","a","prompt_toolkit",":","class",":","`","~prompt_toolkit.application.Application","`",".","This","also","keeps","track","of","which","user","control","is","focused",".",":","param","container",":","The","``","root","''","container","for","the","layout",".",":","param","focused_element",":","element","to","be","focused","initially",".","(","Can","be","anything","the","`","focus","`","function","accepts",".",")"]
code: def __init__(
      self,
      container: AnyContainer,
      focused_element: FocusableElement | None = None,
  ) -> None:
      self.container = to_container(container)
      self._stack: list[Window] = []
  
      # Map search BufferControl back to the original BufferControl.
      # This is used to keep track of when exactly we are searching, and for
      # applying the search.
      # When a link exists in this dictionary, that means the search is
      # currently active.
      # Map: search_buffer_control -> original buffer control.
      self.search_links: dict[SearchBufferControl, BufferControl] = {}
  
      # Mapping that maps the children in the layout to their parent.
      # This relationship is calculated dynamically, each time when the UI
      # is rendered.  (UI elements have only references to their children.)
      self._child_to_parent: dict[Container, Container] = {}
  
      if focused_element is None:
          try:
              self._stack.append(next(self.find_all_windows()))
          except StopIteration as e:
              raise InvalidLayoutError(
                  "Invalid layout. The layout does not contain any Window object."
              ) from e
      else:
          self.focus(focused_element)
  
      # List of visible windows.
      self.visible_windows: list[Window] = []
  
imports: from __future__ import annotations
  from typing import Generator, Iterable, Union
  from prompt_toolkit.buffer import Buffer
  from .containers import AnyContainer, ConditionalContainer, Container, Window, to_container
  from .controls import BufferControl, SearchBufferControl, UIControl
label_desc: Use image node_id 1 to create a new Layout object  with example: obj = Layout(container, focused_element)