File: /var/www/html/wp-content/plugins/advanced-ads/assets/dist/frontend-picker.js
(()=>{document.addEventListener("DOMContentLoaded",function(){if(!function(){if(!advads.supports_localstorage())return!1;const e=localStorage.getItem("advads_frontend_picker"),t=localStorage.getItem("advads_frontend_blog_id"),n=localStorage.getItem("advads_frontend_starttime"),o=globalThis.advads_options.blog_id;return!(!e||o&&t&&o!==t||n&&parseInt(n,10)<Date.now()-27e5&&(["advads_frontend_action","advads_frontend_element","advads_frontend_picker","advads_prev_url","advads_frontend_pathtype","advads_frontend_boundary","advads_frontend_blog_id","advads_frontend_starttime"].forEach(e=>localStorage.removeItem(e)),advads.set_cookie("advads_frontend_picker","",-1),1))}())return;let e=null;const t=document.createElement("div");t.id="advads-picker-overlay",Object.assign(t.style,{position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:"1000000",pointerEvents:"none",display:"none"}),document.body.prepend(t),"true"===localStorage.getItem("advads_frontend_boundary")&&(document.body.style.cursor="not-allowed");const n=new Set([document.body,document.documentElement,document]);globalThis.advads.is_boundary_reached=function(e){if("true"!==localStorage.getItem("advads_frontend_boundary"))return!1;const t=document.querySelectorAll(".advads-frontend-picker-boundary-helper"),n=new Set(Array.from(t).map(e=>e.parentElement).filter(Boolean));if(n.forEach(e=>{e.style.cursor="pointer"}),n.has(e))return!0;let o=e.parentElement;for(;o;){if(n.has(o))return!1;o=o.parentElement}return!0};const o="xpath"===localStorage.getItem("advads_frontend_pathtype")?s:d;let a=!1,r=null;document.addEventListener("mousemove",function(d){r=d,a||(a=!0,globalThis.requestAnimationFrame(function(){a=!1;const d=r;if(!d)return;if(d.target===e)return;if(n.has(d.target))return e=null,void(t.style.display="none");if(e=d.target,!o(e))return;const s=e.getBoundingClientRect(),l=window.scrollX||window.pageXOffset,i=window.scrollY||window.pageYOffset;Object.assign(t.style,{top:s.top+i+"px",left:s.left+l+"px",width:s.width+"px",height:s.height+"px",display:"block"})}))}),document.addEventListener("click",function(){if(!e)return;if(advads.is_boundary_reached(e))return;const t=o(e);localStorage.setItem("advads_frontend_element",t),globalThis.location=localStorage.getItem("advads_prev_url")})});const e="advads-picker-overlay",t=3,n=/\d/;function o(e){return n.test(e)}function a(e,t){if(!e)return[];const n=[];for(const a of e.split(/[\s\n]+/))if(a&&!o(a)&&(n.push(a),n.length===t))break;return n}function r(t,n,o,a){if(!t)return{total:0,selfIndex:-1};const r=o.toLowerCase(),d=a&&a.length>0;let s=0,l=-1;for(const o of t.children)if(o.id!==e&&o.nodeName.toLowerCase()===r){if(d){const e=o.className?o.className.split(/\s+/):[],t=new Set(e);if(!a.every(e=>t.has(e)))continue}o===n&&(l=s),s++}return{total:s,selfIndex:l}}function d(e){const n=[];let d=e;for(;d&&"html"!==d.nodeName.toLowerCase()&&n.length<t;){const e=d.nodeName.toLowerCase(),t=d.id,s=a(d.className,2);let l=e;t&&!o(t)?l+="#"+t:s.length&&(l+="."+s.join("."));const{total:i,selfIndex:c}=r(d.parentElement,d,e,s);i>1&&-1!==c&&(l+=":eq("+c+")"),n.unshift(l),d=d.parentElement}return d&&"html"===d.nodeName.toLowerCase()&&n.unshift("html"),n.join(" > ")}function s(e){const n=[];let d=e,s=0;for(;d&&"body"!==d.nodeName.toLowerCase()&&s<t&&!advads.is_boundary_reached(d);){const e=d.nodeName.toLowerCase(),t=d.id,l=a(d.className,2);let i=e;if(t&&!o(t))return n.unshift(i+'[@id="'+t+'"]'),"//"+n.join("/");l.length&&(s++,i+="["+l.map(e=>'(@class and contains(concat(" ", normalize-space(@class), " "), " '+e+' "))').join(" and ")+"]");const{total:c,selfIndex:u}=r(d.parentElement,d,e,l);c>1&&-1!==u&&(i+="["+(u+1)+"]"),n.unshift(i),d=d.parentElement}return n.join("/")}})();