<div id="account_map_export" style="display: none; max-width: 500px;">
    <h1>Export Wallet</h1>
    <h2>Scan this with your wallet software</h2>
    <br>
    <qr-code value='{{ wallet.account_map }}' width="400"></qr-code>
    <br>
    <h2>Import this JSON file</h2>
    <a download="{{ wallet.name }}.json" class="btn centered padded" id="export_wallet_file">Save wallet file</a>
<pre id="account_map" style="white-space: -moz-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; text-align: left;">
{{ wallet.account_map }}
</pre>
    <button onclick="copyText(document.getElementById('account_map').innerText, 'Copied wallet data')" type="button" class="btn centered padded">Copy wallet data</button>
    <br />
    <hr />
    <h4>Create Electrum Wallet</h4>
    If electrum supports your device, you'll get a regular wallet in electrum, otherwise a watch-only-wallet.
    <a
	id="electrum_export"
	download="{{ wallet.alias | ascii20 }}_electrum.backup"
	onclick="showNotification(`Import wallet file to your Electrum: File -> Open -> Choose... -> {{ wallet.alias | ascii20 }}_electrum.backup`, 0)"
	class="btn centered padded">
	    Download Electrum (Watch-Only) File
    </a>
</div>
<script>
document.addEventListener("DOMContentLoaded", function(){
    let accountMap = encodeURIComponent(`{{ wallet.account_map|tojson }}`)
    document.getElementById('export_wallet_file').href = "data:text/json;charset=utf-8," + accountMap.substring(3, accountMap.length - 3);
});
document.addEventListener("DOMContentLoaded", function(){
    document.getElementById('electrum_export').href = 'data:text/plain,' + encodeURIComponent('{{ wallet.get_electrum_file()|tojson }}');
});
</script>
