protected function getLocalImageSettings(
        $image, ?string $alt, array $extra, bool $default, bool $storage = false
    ): ResourceSettings {
        if ($image instanceof LocalSettings) {
            $settings = $image;
        } elseif (is_array($image)) {
            if (!empty($extra)) {
                $image['extra'] = array_merge($image['extra'] ?? [], $extra);
            }

            $settings = new LocalSettings($image);
        } else {
            $settings = new LocalSettings([
                'image' => $image,
                'alt'   => $alt ?? $image,
                'extra' => $extra,
            ]);
        }

        $settings->theme        = $storage ? null : ($default ? $this->getDefaultTheme() : $this->getTheme());
        $settings->default      = $storage ? false : $default;
        $settings->url          = $storage ?
            $this->getStorageUrl($settings->image) :
            $this->getThemeResourceUrl($settings->image, $settings->theme);

        return $settings;
    }