const e = (e, t) => {
	let n;
	if (e instanceof Blob) n = e;
	else if (e instanceof File) n = e;
	else if (Array.isArray(e) && e.length === 2) {
		let [t, r] = e;
		if (typeof t == "string") n = new Blob([t], { type: r });
		else if (t instanceof ArrayBuffer || ArrayBuffer.isView(t)) n = new Blob([t], { type: r });
		else if (t instanceof Blob) n = new Blob([t], { type: r });
		else throw Error(`Unsupported data type for download. Received data of type ${typeof t}.`);
	} else throw Error("Invalid content type. Content must be a Blob, File, or [data, mimeType] tuple.");
	let r = URL.createObjectURL(n);
	try {
		let e = document.createElement("a");
		e.href = r, e.download = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
	} catch (e) {
		throw Error(`Failed to download ${t}`, { cause: e });
	} finally {
		URL.revokeObjectURL(r);
	}
};
export { e as downloadContent };

//# sourceMappingURL=downloadContent.js.map