!function(){"use strict";function t(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}function e(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(e,i){return e.get(t(e,i))}function r(t,i,n){e(t,i),i.set(t,n)}function o(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function a(t,e,i){return e&&o(t.prototype,e),i&&o(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,i){return(e=u(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function u(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var c=function(){return a(function t(){i(this,t)},null,[{key:"hideElement",value:function(t){null!==t&&(t.style.display="none")}},{key:"showElement",value:function(t){null!==t&&(t.style.display="")}}])}(),s=new WeakMap,d=new WeakMap,h=new WeakSet,f=a(function o(a){var u,c;i(this,o),e(u=this,c=h),c.add(u),l(this,"use strict",void 0),r(this,s,void 0),r(this,d,"data-powermail-cond-excluded-fields"),l(this,"initialize",function(){var e=this,i="#form-"+n(s,this).querySelector("input.powermail_form_uid").value+"-actions";if(null===document.querySelector(i))t(h,e,p).call(e);else{var r=JSON.parse(document.querySelector(i).textContent);t(h,e,b).call(e,r)}t(h,e,v).call(e),t(h,e,m).call(e)}),function(e,i,n){e.set(t(e,i),n)}(s,this,a),n(s,this).powermailConditions=this});function m(){var t=this;"true"!==n(s,this).getAttribute("data-powermail-ajax")&&n(s,this).addEventListener("submit",function(e){if(e.preventDefault(),document.activeElement&&document.activeElement.tagName){var i=document.activeElement,r=i.tagName.toLowerCase();if(("input"===r||"textarea"===r||"select"===r)&&n(s,t).contains(i))return i.blur(),void setTimeout(function(){n(s,t).submit()},50)}n(s,t).submit()})}function v(){var e=this;t(h,this,y).call(this).forEach(function(i){i.addEventListener("change",function(i){t(h,e,p).call(e)})})}function p(){var e=this;t(h,e,w).call(e);var i=new FormData(n(s,this));n(s,this).hasAttribute(n(d,this))&&n(s,this).querySelectorAll(n(s,this).getAttribute(n(d,this))).forEach(function(t){t.hasAttribute("name")&&i.delete(t.getAttribute("name"))});fetch(t(h,this,g).call(this),{body:i,method:"post"}).then(function(t){return t.json()}).then(function(i){i.loops>99?console.log("Too much loops reached by parsing conditions and rules. Check for conflicting conditions."):t(h,e,b).call(e,i)}).catch(function(t){console.log(t)})}function b(e){if(void 0!==e.todo)for(var i in e.todo)for(var r in e.todo[i])for(var o in"hide"===e.todo[i][r]["#action"]&&t(h,this,S).call(this,t(h,this,P).call(this,r)),"un_hide"===e.todo[i][r]["#action"]&&t(h,this,E).call(this,t(h,this,P).call(this,r)),e.todo[i][r])"hide"===e.todo[i][r][o]["#action"]&&t(h,this,A).call(this,o),"un_hide"===e.todo[i][r][o]["#action"]&&t(h,this,q).call(this,o);n(s,this).querySelectorAll(".powermail_fieldset").forEach(function(t){"hidden"===window.getComputedStyle(t).visibility&&(t.style.visibility="visible",t.style.opacity=1)})}function w(){n(s,this).querySelectorAll('[disabled="disabled"]').forEach(function(t){t.removeAttribute("disabled")})}function y(){return n(s,this).querySelectorAll('input:not([data-powermail-validation="disabled"]):not([type="hidden"]):not([type="submit"]), textarea:not([data-powermail-validation="disabled"]), select:not([data-powermail-validation="disabled"])')}function g(){var t=document.querySelector("[data-condition-uri]");return null===t&&console.log("Tag with data-condition-uri not found. Maybe TypoScript was not included."),t.getAttribute("data-condition-uri")}function q(e){var i=t(h,this,T).call(this,e);null!==i&&c.showElement(i);var n=t(h,this,x).call(this,e);null!==n&&(n.removeAttribute("disabled"),t(h,this,j).call(this,n))}function A(e){var i=t(h,this,T).call(this,e);null!==i&&c.hideElement(i);var n=t(h,this,x).call(this,e);null!==n&&(n.setAttribute("disabled","disabled"),t(h,this,_).call(this,n))}function E(t){c.showElement(t)}function S(t){c.hideElement(t)}function _(t){(t.hasAttribute("required")||t.hasAttribute("data-powermail-required"))&&(t.removeAttribute("required"),t.removeAttribute("data-powermail-required"),t.setAttribute("data-powermailcond-required","required"))}function j(e){"required"===e.getAttribute("data-powermailcond-required")&&(t(h,this,C).call(this)||t(h,this,k).call(this))&&e.setAttribute("required","required"),e.removeAttribute("data-powermailcond-required")}function k(){return"data-powermail-validate"===n(s,this).getAttribute("data-powermail-validate")}function C(){return"html5"===n(s,this).getAttribute("data-validate")}function T(e){var i=t(h,this,L).call(this,e);if(null!==i)return i;var n=t(h,this,x).call(this,e);if(null!==n){var r=n.closest(".powermail_fieldwrap");if(null!==r)return r}return console.log('Error: Could not find field by fieldMarker "'+e+'"'),null}function x(t){var e="tx_powermail_pi1[field]["+t+"]";return n(s,this).querySelector('[name="'+e+'"]:not([type="hidden"])')||n(s,this).querySelector('[name="'+e+'[]"]')}function P(t){return n(s,this).querySelector(".powermail_fieldset_"+t)}function L(t){return n(s,this).querySelector(".powermail_fieldwrap_"+t)}window.addEventListener("pageshow",function(){document.querySelectorAll(".powermail_form").forEach(function(t){new f(t).initialize()})})}();
