(() => { 'use strict'; const link = document.getElementById('invitation-link'); const actions = document.getElementById('share-actions'); const status = document.getElementById('share-status'); if (!link || !actions || !status) return; actions.hidden = false; document.getElementById('copy-invitation').addEventListener('click', async () => { try { await navigator.clipboard.writeText(link.href); status.textContent = 'Link copied.'; } catch { status.textContent = 'Select the invitation above and copy it.'; } }); if (navigator.share) { const share = document.getElementById('share-invitation'); share.hidden = false; share.addEventListener('click', async () => { try { await navigator.share({ url: link.href }); } catch (error) { if (error.name !== 'AbortError') status.textContent = 'Could not share. You can copy the link instead.'; } }); } })();