async injectLinkAnnotations({
    inferredLinks,
    viewport,
    structTreeLayer = null,
  }) {
    if (this.#annotations === null) {
      throw new Error(
        "`render` method must be called before `injectLinkAnnotations`."
      );
    }
    if (this._cancelled || this.#linksInjected) {
      return;
    }
    this.#linksInjected = true;

    const newLinks = this.#annotations.length
      ? this.#checkInferredLinks(inferredLinks)
      : inferredLinks;

    if (!newLinks.length) {
      return;
    }

    if (!this.annotationLayer) {
      this.#initAnnotationLayer(viewport, structTreeLayer);
      setLayerDimensions(this.div, viewport);
    }

    await this.annotationLayer.addLinkAnnotations(newLinks, this.linkService);
    // Don't show the annotation layer if it was explicitly hidden previously.
    if (!this.#externalHide) {
      this.div.hidden = false;
    }
  }
@param {InjectLinkAnnotationsOptions} options
@returns {Promise<void>} A promise that is resolved when the inferred links
  are added to the annotation layer.