(function () {
  'use strict';

  document.addEventListener('click', function (event) {
    var link = event.target.closest('[data-custausu-doctor-warning-confirm]');

    if (!link) {
      return;
    }

    var config = window.CUSTAUSU_DOCTOR_WARNING_ACK || {};
    var message = config.confirm_text || 'Confirm this plugin warning acknowledgement?';

    if (!window.confirm(message)) {
      event.preventDefault();
    }
  });
}());
