window.abrirManual = function (url) {
    window.open(url, '_blank');
};


window.mostrarPdf = function (base64Data) {
    let byteArray = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0));
    let blob = new Blob([byteArray], { type: "application/pdf" });
    let url = URL.createObjectURL(blob);
    window.open(url, "_blank");
};


window.obtenerPDFImprimir = function (paginaImprimir) {
    let DespachoImprimir = document.getElementById(paginaImprimir);

    let html = DespachoImprimir.outerHTML;
    return html;
};


window.descargarExcel = function (fileName, base64Data) {
    const link = document.createElement('a');
    link.href = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + base64Data;
    link.download = fileName;
    link.click();
};


window.descargarPdf = function (fileName, base64Data) {
    const link = document.createElement('a');
    link.href = 'data:application/pdf;base64,' + base64Data;
    link.download = fileName;
    link.click();
};


window.verRutaReferrer = function () {
    try {
        return window.parent.location.href;
    } catch (e) {
        return document.referrer;
    }
};