(function () {
  document.addEventListener('click', function (event) {
    var open = event.target.closest('[data-mic-form-id]');
    if (open && open.matches('.myron-form-cta')) {
      var dialog = document.getElementById('myron-form-dialog-' + open.getAttribute('data-mic-form-id'));
      if (dialog && typeof dialog.showModal === 'function') dialog.showModal();
    }
    var close = event.target.closest('[data-mic-form-close]');
    if (close) {
      var parent = close.closest('dialog');
      if (parent) parent.close();
    }
  });
})();
