// Transport bundle export — browser-side download trigger.
//
// The TransportExport wizard (T21) computes a bundle byte[] server-side, encodes
// it to base64, and hands it to this helper to push to the user's browser as a
// file download. The base64 detour avoids binary marshalling headaches over the
// SignalR JS-interop boundary — Blazor Server cannot stream a byte[] back to
// the browser directly without a [JSInvokable] dance.
//
// The link is built fresh and removed each call so back-to-back exports don't
// keep stale URLs around in the DOM.
window.scadabridgeTransport = {
    downloadBundle: function (filename, base64Data) {
        const link = document.createElement('a');
        link.href = "data:application/octet-stream;base64," + base64Data;
        link.download = filename;
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
    }
};
