(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.components,n=window.wp.apiFetch;var o=e.n(n);const r=window.ReactJSXRuntime,d=e=>{const[n,d]=(0,t.useState)("true"===e.value);return(0,r.jsx)(a.ToggleControl,{checked:n,onChange:t=>{d(t),o()({path:`/wp/v2/interact-interaction/${e.postId}`,method:"POST",data:{status:t?"publish":"interact-inactive"}}).catch(t=>{window.alert(e.errorMessage+"\n\n"+t.message)})}})};var c;c=()=>{document.querySelectorAll(".interact-interaction-active").forEach(e=>{(0,t.createRoot)(e).render((0,r.jsx)(d,{postId:e.dataset.postId,value:e.dataset.value,errorMessage:e.dataset.errorMessage}))})},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",c):c())})();