function static_vercel_config(builder, config, dir) {
	/** @type {any[]} */
	const prerendered_redirects = [];

	/** @type {Record<string, { path: string }>} */
	const overrides = {};

	/** @type {import('./index.js').ImagesConfig | undefined} */
	const images = config.images;

	for (let [src, redirect] of builder.prerendered.redirects) {
		if (src.replace(/\/$/, '') === redirect.location.replace(/\/$/, '')) {
			// ignore the extreme edge case of a `/foo` -> `/foo/` redirect,
			// which would only arise if the response was generated by a
			// `handle` hook or outside the app altogether (since you
			// can't declaratively create both routes)
		} else {
			// redirect both `/foo` and `/foo/` to `redirect.location`
			src = src.replace(/\/?$/, '/?');
		}

		prerendered_redirects.push({
			src,
			headers: {
				Location: redirect.location
			},
			status: redirect.status
		});
	}

	for (const [path, page] of builder.prerendered.pages) {
		let overrides_path = path.slice(1);

		if (path !== '/') {
			/** @type {string | undefined} */
			let counterpart_route = path + '/';

			if (path.endsWith('/')) {
				counterpart_route = path.slice(0, -1);
				overrides_path = path.slice(1, -1);
			}

			prerendered_redirects.push(
				{ src: path, dest: counterpart_route },
				{ src: counterpart_route, status: 308, headers: { Location: path } }
			);
		}

		overrides[page.file] = { path: overrides_path };
	}

	const routes = [
		...prerendered_redirects,
		{
			src: `/${builder.getAppPath()}/immutable/.+`,
			headers: {
				'cache-control': 'public, immutable, max-age=31536000'
			}
		}
	];

	// https://vercel.com/docs/deployments/skew-protection
	if (process.env.VERCEL_SKEW_PROTECTION_ENABLED) {
		routes.push({
			src: '/.*',
			has: [
				{
					type: 'header',
					key: 'Sec-Fetch-Dest',
					value: 'document'
				}
			],
			headers: {
				'Set-Cookie': `__vdpl=${process.env.VERCEL_DEPLOYMENT_ID}; Path=${builder.config.kit.paths.base}/; SameSite=Strict; Secure; HttpOnly`
			},
			continue: true
		});

		// this is a dreadful hack that is necessary until the Vercel Build Output API
		// allows you to set multiple cookies for a single route. essentially, since we
		// know that the entry file will be requested immediately, we can set the second
		// cookie in _that_ response rather than the document response
		const base = `${dir}/${builder.config.kit.appDir}/immutable/entry`;
		const entry = fs.readdirSync(base).find((file) => file.startsWith('start.'));

		if (!entry) {
			throw new Error('Could not find entry point');
		}

		routes.splice(-2, 0, {
			src: `/${builder.getAppPath()}/immutable/entry/${entry}`,
			headers: {
				'Set-Cookie': `__vdpl=; Path=/${builder.getAppPath()}/version.json; SameSite=Strict; Secure; HttpOnly`
			},
			continue: true
		});
	}

	routes.push({
		handle: 'filesystem'
	});

	return {
		version: 3,
		routes,
		overrides,
		images
	};
}
@param {import('@sveltejs/kit').Builder} builder
@param {import('./index.js').Config} config
@param {string} dir