import { Controller } from "@hotwired/stimulus" export default class extends Controller { static values = { url: String } async share() { const url = this.urlValue || window.location.origin if (navigator.share) { try { await navigator.share({ url }) return } catch (e) { if (e.name === "AbortError") return } } try { await navigator.clipboard.writeText(url) } catch {} } }