code: def _all_objs(objs: Sequence[HasProps | Document]) -> set[HasProps]:
      all_objs: set[HasProps] = set()
  
      for obj in objs:
          if isinstance(obj, Document):
              for root in obj.roots:
                  all_objs |= root.references()
          else:
              all_objs |= obj.references()
  
      return all_objs
  
imports: from __future__ import annotations
  import logging
  import hashlib
  import json
  import os
  from dataclasses import dataclass
  from os.path import normpath
  from pathlib import Path
  from typing import TYPE_CHECKING, Callable, Iterator, Sequence, TypedDict
  from urllib.parse import urljoin
  from ..core.has_props import HasProps
  from ..core.templates import CSS_RESOURCES, JS_RESOURCES
  from ..document.document import Document
  from ..resources import Resources
  from ..settings import settings
  from ..util.compiler import bundle_models
  from .util import contains_tex_string
label_desc: Use image node_id 4 for calling a global function with example usage: _all_objs(objs) and returns: all_objs