async function FetchDlcCapsules( applicationConfig, appid, achievementUpdates )
{
	const dlcAppIds = [];

	/** @type {Set<number>} */
	const uniqueAppIds = new Set();

	/** @type {Map<number, string>} */
	const images = new Map();

	for( const update of achievementUpdates )
	{
		const dlcAppId = update.dlcAppId;
		const logoAppId = update.logoAppId || dlcAppId;

		if( logoAppId && logoAppId !== appid && !uniqueAppIds.has( logoAppId ) )
		{
			uniqueAppIds.add( logoAppId );

			const knownCapsule = SessionStorageGet( `steamdb_capsule_${logoAppId}` );

			if( knownCapsule )
			{
				images.set( logoAppId, knownCapsule );
				continue;
			}

			dlcAppIds.push( {
				appid: logoAppId
			} );
		}
	}

	if( dlcAppIds.length === 0 )
	{
		return Promise.resolve( images );
	}

	const request =
	{
		ids: dlcAppIds,
		context:
		{
			language: applicationConfig.LANGUAGE,
			country_code: applicationConfig.COUNTRY,
			steam_realm: applicationConfig.EREALM,
		},
		data_request:
		{
			include_assets: true
		}
	};

	const params = new URLSearchParams();
	params.set( 'origin', location.origin );
	params.set( 'format', 'json' );

	if( applicationConfig.WEBAPI_ACCESS_TOKEN )
	{
		params.set( 'access_token', applicationConfig.WEBAPI_ACCESS_TOKEN );
	}

	params.set( 'input_json', JSON.stringify( request ) );

	// Request header field x-requested-with is not allowed
	// by Access-Control-Allow-Headers in preflight response.
	params.set( 'x_requested_with', 'SteamDB' );

	const assetsToTry =
	[
		'small_capsule',
		'main_capsule',
		'header',
	];

	const itemsFetch = await fetch( `${applicationConfig.WEBAPI_BASE_URL}IStoreBrowseService/GetItems/v1/?${params.toString()}` );
	const response = await itemsFetch.json();

	if( !response || !response.response || !response.response.store_items )
	{
		return images;
	}

	for( const item of response.response.store_items )
	{
		if( !item.assets )
		{
			continue;
		}

		for( const assetKey of assetsToTry )
		{
			if( item.assets[ assetKey ] )
			{
				// eslint-disable-next-line no-template-curly-in-string
				const name = item.assets.asset_url_format.replace( "${FILENAME}", item.assets[ assetKey ] );
				const url = `${applicationConfig.STORE_ITEM_BASE_URL}${name}`;
				images.set( item.appid, url );

				SessionStorageSet( `steamdb_capsule_${item.appid}`, url );

				break;
			}
		}
	}

	WriteLog( 'Loaded', images.size, 'capsules' );

	return images;
}
@param {ApplicationConfig} applicationConfig
@param {number} appid
@param {AchievementGroup[]} achievementUpdates