!function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(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,r(n.key),n)}}function i(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,i){return(e=r(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function r(t){var e=function(t,e){if("object"!=typeof t||null===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:String(e)}function o(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,l(t,e,"get"))}function a(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,l(t,e,"set"),i),i}function l(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function u(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function s(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function c(t,e){s(t,e),e.add(t)}var d=function(){function e(){t(this,e)}return i(e,null,[{key:"hideElement",value:function(t){null!==t&&(t.style.display="none")}},{key:"showElement",value:function(t){null!==t&&(t.style.display="")}}]),e}(),h=new WeakMap,f=new WeakSet,w=new WeakSet,p=new WeakSet,v=new WeakSet,m=new WeakSet,b=new WeakSet,y=new WeakSet,S=new WeakSet,g=new WeakSet,k=new WeakSet,q=new WeakSet,W=new WeakSet,A=new WeakSet,E=new WeakSet,_=new WeakSet,T=new WeakSet,j=new WeakSet,C=new WeakSet,P=i((function e(i){var r,l,d;t(this,e),c(this,C),c(this,j),c(this,T),c(this,_),c(this,E),c(this,A),c(this,W),c(this,q),c(this,k),c(this,g),c(this,S),c(this,y),c(this,b),c(this,m),c(this,v),c(this,p),c(this,w),c(this,f),n(this,"use strict",void 0),d={writable:!0,value:void 0},s(r=this,l=h),l.set(r,d),n(this,"initialize",(function(){var t=this;u(t,w,M).call(t),u(t,f,z).call(t)})),a(this,h,i),o(this,h).powermailConditions=this}));function z(){var t=this;u(this,m,D).call(this).forEach((function(e){e.addEventListener("change",(function(e){u(t,w,M).call(t)}))}))}function M(){var t=this;u(t,v,x).call(t),fetch(u(this,b,F).call(this),{body:new FormData(o(this,h)),method:"post"}).then((function(t){return t.json()})).then((function(e){e.loops>99?console.log("Too much loops reached by parsing conditions and rules. Check for conflicting conditions."):u(t,p,O).call(t,e)})).catch((function(t){console.log(t)}))}function O(t){if(void 0!==t.todo)for(var e in t.todo)for(var i in t.todo[e])for(var n in"hide"===t.todo[e][i]["#action"]&&u(this,k,G).call(this,u(this,j,U).call(this,i)),"un_hide"===t.todo[e][i]["#action"]&&u(this,g,B).call(this,u(this,j,U).call(this,i)),t.todo[e][i])"hide"===t.todo[e][i][n]["#action"]&&u(this,S,N).call(this,n),"un_hide"===t.todo[e][i][n]["#action"]&&u(this,y,L).call(this,n)}function x(){o(this,h).querySelectorAll('[disabled="disabled"]').forEach((function(t){t.removeAttribute("disabled")}))}function D(){return o(this,h).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 F(){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 L(t){var e=u(this,_,Q).call(this,t);null!==e&&d.showElement(e);var i=u(this,T,R).call(this,t);null!==i&&(i.removeAttribute("disabled"),u(this,W,I).call(this,i))}function N(t){var e=u(this,_,Q).call(this,t);null!==e&&d.hideElement(e);var i=u(this,T,R).call(this,t);null!==i&&(i.setAttribute("disabled","disabled"),u(this,q,H).call(this,i))}function B(t){d.showElement(t)}function G(t){d.hideElement(t)}function H(t){(t.hasAttribute("required")||t.hasAttribute("data-powermail-required"))&&(t.removeAttribute("required"),t.removeAttribute("data-powermail-required"),t.setAttribute("data-powermailcond-required","required"))}function I(t){"required"===t.getAttribute("data-powermailcond-required")&&(u(this,E,K).call(this)||u(this,A,J).call(this))&&t.setAttribute("required","required"),t.removeAttribute("data-powermailcond-required")}function J(){return"data-powermail-validate"===o(this,h).getAttribute("data-powermail-validate")}function K(){return"html5"===o(this,h).getAttribute("data-validate")}function Q(t){var e=u(this,C,V).call(this,t);if(null!==e)return e;var i=u(this,T,R).call(this,t);if(null!==i){var n=i.closest(".powermail_fieldwrap");if(null!==n)return n}return console.log('Error: Could not find field by fieldMarker "'+t+'"'),null}function R(t){var e="tx_powermail_pi1[field]["+t+"]";return o(this,h).querySelector('[name="'+e+'"]:not([type="hidden"])')||o(this,h).querySelector('[name="'+e+'[]"]')}function U(t){return o(this,h).querySelector(".powermail_fieldset_"+t)}function V(t){return o(this,h).querySelector(".powermail_fieldwrap_"+t)}document.querySelectorAll(".powermail_form").forEach((function(t){new P(t).initialize()}))}();
