//#region src/components/table/Actions/component/ExportImport/utils/download.ts
const windowOpen = (url, target) => {
	let oWindow = window.open("", target || "_blank");
	oWindow.location = url;
};
var download_default = (sUrl, fileName) => {
	let isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
	let isSafari = navigator.userAgent.toLowerCase().indexOf("safari") > -1;
	if (/(iP)/g.test(navigator.userAgent)) {
		alert("Your device does not support files downloading. Please try again in desktop browser.");
		return false;
	}
	if (isChrome || isSafari) {
		let link = document.createElement("a");
		link.href = sUrl;
		if (link.download !== void 0) link.download = fileName || sUrl.substring(sUrl.lastIndexOf("/") + 1, sUrl.length);
		if (document.createEvent) {
			let e = document.createEvent("MouseEvents");
			e.initEvent("click", true, true);
			link.dispatchEvent(e);
			return true;
		}
	}
	if (sUrl.indexOf("?") === -1) sUrl += "?download";
	windowOpen(sUrl, "_self");
	return true;
};
//#endregion
export { download_default as default };
