var O=(o,a)=>()=>(a||o((a={exports:{}}).exports,a),a.exports);var P=O((c,f)=>{(function(o,a){typeof c=="object"&&typeof f<"u"?f.exports=a():typeof define=="function"&&define.amd?define(a):(o=typeof globalThis<"u"?globalThis:o||self,o.FormValidation=o.FormValidation||{},o.FormValidation.plugins=o.FormValidation.plugins||{},o.FormValidation.plugins.Mailgun=a())})(void 0,function(){function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function d(t,e,r){return e&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},s(t)}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},u(t,e)}function y(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function l(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function g(t){var e=y();return function(){var i=s(t),n;if(e){var b=s(this).constructor;n=Reflect.construct(i,arguments,b)}else n=i.apply(this,arguments);return m(this,n)}}var h=FormValidation.Plugin,_=FormValidation.plugins.Alias,v=function(t){p(r,t);var e=g(r);function r(i){var n;return o(this,r),n=e.call(this,i),n.opts=Object.assign({},{suggestion:!1},i),n.messageDisplayedHandler=n.onMessageDisplayed.bind(l(n)),n}return d(r,[{key:"install",value:function(){this.opts.suggestion&&this.core.on("plugins.message.displayed",this.messageDisplayedHandler);var n={mailgun:"remote"};this.core.registerPlugin("___mailgunAlias",new _(n)).addField(this.opts.field,{validators:{mailgun:{crossDomain:!0,data:{api_key:this.opts.apiKey},headers:{"Content-Type":"application/json"},message:this.opts.message,name:"address",url:"https://api.mailgun.net/v3/address/validate",validKey:"is_valid"}}})}},{key:"uninstall",value:function(){this.opts.suggestion&&this.core.off("plugins.message.displayed",this.messageDisplayedHandler),this.core.removeField(this.opts.field)}},{key:"onMessageDisplayed",value:function(n){n.field===this.opts.field&&n.validator==="mailgun"&&n.meta&&n.meta.did_you_mean&&(n.messageElement.innerHTML="Did you mean ".concat(n.meta.did_you_mean,"?"))}}]),r}(h);return v})});export default P();
