(()=>{"use strict";var e,i={932(){function e(i){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(i)}function i(e,i){for(var n=0;n<i.length;n++){var o=i[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function t(i){var t=function(i){if("object"!=e(i)||!i)return i;var t=i[Symbol.toPrimitive];if(void 0!==t){var n=t.call(i,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}(i);return"symbol"==e(t)?t:t+""}var n={unclear_how_to_use:["io_text_field_unclear","io_unclear_details"],switched_solution:["io_text_field_switched","io_switched_details"],other:["io_text_field_other","io_other_details"]},o=function(){return e=function e(){!function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.deactivationLink=document.querySelector('[id*="deactivate-image-optimizer"], [id*="deactivate-image-optimization"]'),this.deactivationLink&&(this.originalDeactivationLink=this.deactivationLink.getAttribute("href"),this.init())},t=[{key:"modal",value:function(e,i,t){var n,o;null===(n=(o=window).tb_show)||void 0===n||n.call(o,e,i),setTimeout(function(){var e;return null===(e=document.getElementById("TB_window"))||void 0===e?void 0:e.classList.add(t)},5)}},{key:"hideFields",value:function(){document.querySelectorAll(".image-optimization-feedback-text-field").forEach(function(e){return e.classList.add("text-field-hidden")})}},{key:"toggleField",value:function(e){var i;this.hideFields();var t=null===(i=n[e])||void 0===i?void 0:i[0];t&&document.getElementById(t).classList.remove("text-field-hidden")}},{key:"sendRequest",value:function(e,i){var t;fetch((null===(t=window)||void 0===t||null===(t=t.imageOptimizationDeactivationFeedback)||void 0===t?void 0:t.ajaxurl)||"",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(e)}).finally(i)}},{key:"handleSubmit",value:function(){var e,i,t,o,a=this,r=null===(e=document.querySelector('input[name="image_optimization_deactivation_reason"]:checked'))||void 0===e?void 0:e.value,d=null===(i=n[r])||void 0===i?void 0:i[1],l=d&&(null===(t=document.getElementById(d))||void 0===t?void 0:t.value)||"";r?this.sendRequest({action:"image_optimization_deactivation_feedback",reason:r,additional_data:l,nonce:(null===(o=window)||void 0===o||null===(o=o.imageOptimizationDeactivationFeedback)||void 0===o?void 0:o.nonce)||""},function(){return a.deactivate()}):this.deactivate()}},{key:"deactivate",value:function(){var e,i;null===(e=(i=window).tb_remove)||void 0===e||e.call(i),window.location.href=this.originalDeactivationLink}},{key:"init",value:function(){var e=this;this.deactivationLink.addEventListener("click",function(i){i.preventDefault(),e.hideFields(),e.modal("QUICK FEEDBACK","#TB_inline?width=550&height=auto&inlineId=image-optimization-deactivation-modal","image-optimization-feedback-thickbox")}),document.addEventListener("change",function(i){var t;"image_optimization_deactivation_reason"===(null===(t=i.target)||void 0===t?void 0:t.name)&&e.toggleField(i.target.value)}),document.addEventListener("click",function(i){var t,n;"image-optimization-submit-deactivate"===(null===(t=i.target)||void 0===t?void 0:t.id)&&(i.preventDefault(),e.handleSubmit()),"image-optimization-skip-deactivate"===(null===(n=i.target)||void 0===n?void 0:n.id)&&(i.preventDefault(),e.deactivate())})}}],t&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();document.addEventListener("DOMContentLoaded",function(){return new o})}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var a=t[e]={exports:{}};return i[e](a,a.exports,n),a.exports}n.m=i,e=[],n.O=(i,t,o,a)=>{if(!t){var r=1/0;for(c=0;c<e.length;c++){for(var[t,o,a]=e[c],d=!0,l=0;l<t.length;l++)(!1&a||r>=a)&&Object.keys(n.O).every(e=>n.O[e](t[l]))?t.splice(l--,1):(d=!1,a<r&&(r=a));if(d){e.splice(c--,1);var u=o();void 0!==u&&(i=u)}}return i}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[t,o,a]},n.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var e={790:0,891:0};n.O.j=i=>0===e[i];var i=(i,t)=>{var o,a,[r,d,l]=t,u=0;if(r.some(i=>0!==e[i])){for(o in d)n.o(d,o)&&(n.m[o]=d[o]);if(l)var c=l(n)}for(i&&i(t);u<r.length;u++)a=r[u],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(c)},t=globalThis.webpackChunkimage_optimization=globalThis.webpackChunkimage_optimization||[];t.forEach(i.bind(null,0)),t.push=i.bind(null,t.push.bind(t))})();var o=n.O(void 0,[891],()=>n(932));o=n.O(o)})();