!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,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,a(n.key),n)}}function o(t,e,i){return e&&r(t.prototype,e),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,i){return(e=a(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function a(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 u=function(){return o((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="")}}])}(),c=new WeakMap,s=new WeakSet,d=o((function r(o){var a,u;i(this,r),e(a=this,u=s),u.add(a),l(this,"use strict",void 0),function(t,i,n){e(t,i),i.set(t,n)}(this,c,void 0),l(this,"initialize",(function(){var e=this,i="#form-"+n(c,this).querySelector("input.powermail_form_uid").value+"-actions";if(null===document.querySelector(i))t(s,e,f).call(e);else{var r=JSON.parse(document.querySelector(i).textContent);t(s,e,m).call(e,r)}t(s,e,h).call(e)})),function(e,i,n){e.set(t(e,i),n)}(c,this,o),n(c,this).powermailConditions=this}));function h(){var e=this;t(s,this,v).call(this).forEach((function(i){i.addEventListener("change",(function(i){t(s,e,f).call(e)}))}))}function f(){var e=this;t(s,e,p).call(e),fetch(t(s,this,b).call(this),{body:new FormData(n(c,this)),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(s,e,m).call(e,i)})).catch((function(t){console.log(t)}))}function m(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(s,this,g).call(this,t(s,this,C).call(this,r)),"un_hide"===e.todo[i][r]["#action"]&&t(s,this,q).call(this,t(s,this,C).call(this,r)),e.todo[i][r])"hide"===e.todo[i][r][o]["#action"]&&t(s,this,w).call(this,o),"un_hide"===e.todo[i][r][o]["#action"]&&t(s,this,y).call(this,o);n(c,this).querySelectorAll(".powermail_fieldset").forEach((function(t){"hidden"===window.getComputedStyle(t).visibility&&(t.style.visibility="visible",t.style.opacity=1)}))}function p(){n(c,this).querySelectorAll('[disabled="disabled"]').forEach((function(t){t.removeAttribute("disabled")}))}function v(){return n(c,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 b(){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 y(e){var i=t(s,this,j).call(this,e);null!==i&&u.showElement(i);var n=t(s,this,k).call(this,e);null!==n&&(n.removeAttribute("disabled"),t(s,this,S).call(this,n))}function w(e){var i=t(s,this,j).call(this,e);null!==i&&u.hideElement(i);var n=t(s,this,k).call(this,e);null!==n&&(n.setAttribute("disabled","disabled"),t(s,this,A).call(this,n))}function q(t){u.showElement(t)}function g(t){u.hideElement(t)}function A(t){(t.hasAttribute("required")||t.hasAttribute("data-powermail-required"))&&(t.removeAttribute("required"),t.removeAttribute("data-powermail-required"),t.setAttribute("data-powermailcond-required","required"))}function S(e){"required"===e.getAttribute("data-powermailcond-required")&&(t(s,this,_).call(this)||t(s,this,E).call(this))&&e.setAttribute("required","required"),e.removeAttribute("data-powermailcond-required")}function E(){return"data-powermail-validate"===n(c,this).getAttribute("data-powermail-validate")}function _(){return"html5"===n(c,this).getAttribute("data-validate")}function j(e){var i=t(s,this,T).call(this,e);if(null!==i)return i;var n=t(s,this,k).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 k(t){var e="tx_powermail_pi1[field]["+t+"]";return n(c,this).querySelector('[name="'+e+'"]:not([type="hidden"])')||n(c,this).querySelector('[name="'+e+'[]"]')}function C(t){return n(c,this).querySelector(".powermail_fieldset_"+t)}function T(t){return n(c,this).querySelector(".powermail_fieldwrap_"+t)}document.querySelectorAll(".powermail_form").forEach((function(t){new d(t).initialize()}))}();
