getTileSourceOptions(preferredOptions) {
    const options = preferredOptions || {},
      version = this.getImageApiVersion();
    if (version === undefined) {
      return undefined;
    }
    const imageOptions =
      version === undefined ? undefined : versionFunctions[version](this);
    if (imageOptions === undefined) {
      return undefined;
    }
    return {
      url: imageOptions.url,
      version: version,
      size: [this.imageInfo.width, this.imageInfo.height],
      sizes: imageOptions.sizes,
      format:
        options.format !== undefined &&
        imageOptions.formats.includes(options.format)
          ? options.format
          : imageOptions.preferredFormat !== undefined
            ? imageOptions.preferredFormat
            : 'jpg',
      supports: imageOptions.supports,
      quality:
        options.quality && imageOptions.qualities.includes(options.quality)
          ? options.quality
          : imageOptions.qualities.includes('native')
            ? 'native'
            : 'default',
      resolutions: Array.isArray(imageOptions.resolutions)
        ? imageOptions.resolutions.sort(function (a, b) {
            return b - a;
          })
        : undefined,
      tileSize: imageOptions.tileSize,
    };
  }
@param {PreferredOptions} [preferredOptions] Optional options for preferred format and quality.
@return {import("../source/IIIF.js").Options|undefined} IIIF tile source ready constructor options.
@api