code: private function filterOptions(array $allowedSizes): array
      {
          if (empty($allowedSizes)) {
              return [];
          }
  
          $filteredSizes = [];
  
          foreach ($this->options as $group => $sizes) {
              if ('image_sizes' === $group) {
                  $this->filterImageSizes($sizes, $allowedSizes, $filteredSizes, $group);
              } else {
                  $this->filterResizeModes($sizes, $allowedSizes, $filteredSizes, $group);
              }
          }
  
          return $filteredSizes;
      }
docs: Filters the options by the given allowed sizes and returns the result.
  
  @return array<string,string[]>