async register(dialog, canForceClose = false) {
    if (typeof dialog !== "object") {
      throw new Error("Not enough parameters.");
    } else if (this.#overlays.has(dialog)) {
      throw new Error("The overlay is already registered.");
    }
    this.#overlays.set(dialog, { canForceClose });

    dialog.addEventListener("cancel", ({ target }) => {
      if (this.#active === target) {
        this.#active = null;
      }
    });
  }
@param {HTMLDialogElement} dialog - The overlay's DOM element.
@param {boolean} [canForceClose] - Indicates if opening the overlay closes
                 an active overlay. The default is `false`.
@returns {Promise} A promise that is resolved when the overlay has been
                   registered.