!function(){function t(){if(null===c)try{c=globalThis.self===globalThis.top?globalThis.FleekDash?.debug||!1:globalThis.parent?.FleekDash?.debug||globalThis.FleekDash?.debug||!1}catch{c=globalThis.FleekDash?.debug||!1}return c}function e(...e){t()}function n(...e){t()}function a(...e){t()}function i(t,e={}){globalThis.self!==globalThis.top&&globalThis.parent.postMessage({type:t,payload:{...e,source:"iframe_interactions",timestamp:Date.now()}},function(){try{if(globalThis.parent?.location?.origin)return globalThis.parent.location.origin}catch{}return"*"}())}function s(){e(),document.addEventListener("input",t=>{const n=t.target;n&&(n.matches('input[type="search"]')||n.matches('input[name="s"]')||n.matches("#plugin-search-input")||n.matches(".search-input")||n.classList.contains("search")||n.id?.includes("search")||n.name?.includes("search")||n.name?.includes("filter")||n.placeholder?.toLowerCase().includes("search")||n.placeholder?.toLowerCase().includes("filter"))&&(o.lastFilterInput=Date.now(),o.lastSearchInput=Date.now(),e((n.name||n.id,n.value)),i("userInteraction",{type:"filter_input",element:n.name||n.id||"unknown",value:n.value}))}),document.addEventListener("click",t=>{const n=t.target.closest("a");if(!n)return;const a=function(t){return t.href.includes("action=activate")||t.href.includes("action=deactivate")||t.href.includes("action=delete")||t.href.includes("action=edit")||t.classList.contains("edit")||t.classList.contains("activate")||t.classList.contains("deactivate")||t.classList.contains("delete")}(n);if(a){o.lastPluginAction=Date.now();const t=function(t){return t.href.includes("action=activate")||t.classList.contains("activate")?"activate":t.href.includes("action=deactivate")||t.classList.contains("deactivate")?"deactivate":t.href.includes("action=delete")||t.classList.contains("delete")?"delete":t.href.includes("action=edit")||t.classList.contains("edit")?"edit":"unknown"}(n),a=function(t){return t.includes("themes.php")?"themes":t.includes("plugins.php")?"plugins":"admin"}(n.href);e(n.textContent.trim()),i("userInteraction",{type:"admin_link_action",action:t,screen:a,href:n.href,text:n.textContent.trim()})}(n.classList.contains("button-primary")||n.classList.contains("button-secondary")||n.textContent.includes("Update")||n.textContent.includes("Save")||n.textContent.includes("Delete")||n.textContent.includes("Install"))&&!a&&i("userInteraction",{type:"admin_action",text:n.textContent.trim(),href:n.href})}),document.addEventListener("submit",function(t){const s=function(t){return"FORM"===t?.tagName?t:t?.closest?.("form")??null}(t.target);if(!s)return;let c="";try{c=function(t){return"string"==typeof t.action?t.action:t.getAttribute?.("action")??""}(s)||""}catch(f){n()}const r=String(c||"");if(!r.includes("admin-ajax.php")&&!s.classList.contains("ajax-form")&&"true"!==s.dataset?.ajax&&"true"!==s.getAttribute?.("data-ajax"))try{e((r||globalThis.location.href,s.method)),i("iframeNavigation",{status:"loading",type:"partial",url:r||globalThis.location.href,reason:"form_submit"}),setTimeout(()=>{i("iframeNavigation",{status:"complete",source:"form_submit_safety_timeout"})},5e3)}catch(f){a()}const l=(s.method||"").toLowerCase();let u=!1;try{u=!(!s.querySelector?.('input[name="s"]')&&!s.querySelector?.('input[type="search"]'))}catch(f){n()}let d=!1;try{d=!!s.classList?.contains("search-form")}catch(f){n()}const h=String(s.id||"");if(-1!==r.indexOf("plugins.php")||"get"===l||u||d||-1!==h.indexOf("search")||-1!==h.indexOf("filter")){o.lastFormSubmit=Date.now();const t=new FormData(s).get("s")||"";e(),i("userInteraction",{type:"form_submit",formType:"filter",searchValue:t,action:r})}}),document.addEventListener("change",t=>{const n=t.target;"action"!==n?.name&&"action2"!==n?.name||(e(n.value),i("userInteraction",{type:"bulk_action",action:n.value})),"checkbox"===n?.type&&n.name?.startsWith("checked[")&&(e((n.checked,n.value)),i("userInteraction",{type:"item_selection",checked:n.checked,value:n.value}))})}let c=null;const o={lastFilterInput:0,lastFormSubmit:0,lastPluginAction:0,lastSearchInput:0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s):s(),globalThis.fleekDashInteractions={getInteractionState:function(){const t=Date.now(),e=5e3;return{hasRecentFilter:t-o.lastFilterInput<e,hasRecentSubmit:t-o.lastFormSubmit<e,hasRecentPluginAction:t-o.lastPluginAction<e,hasRecentSearch:t-o.lastSearchInput<e,recentInteractions:o}},notifyParent:i,recentInteractions:o,debugLog:e,debugWarn:n,debugError:a}}();
//# sourceMappingURL=iframe-interactions.js.map
