/**
 * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */

/**
 * Fetches a stylesheet from the given URL and returns its content.
 *
 * @param url The URL of the stylesheet to fetch.
 * @returns A promise that resolves with the stylesheet content.
 */
export async function fetchStylesheet( url ) {
	try {
		const response = await fetch( url );

		if ( !response.ok ) {
			throw new Error( `Failed to fetch stylesheet: ${ response.status } ${ response.statusText }` );
		}

		return await response.text();
	} catch ( error ) {
		console.error( `Error fetching stylesheet from ${ url }:`, error );
		throw error;
	}
}
