(()=>{(()=>{"use strict";let m=document.querySelector("html"),A=document.querySelector("body"),h=[];if(wpa.lang&&(m.getAttribute("lang")||(m.setAttribute("lang",wpa.lang),(wpa.errors||wpa.tracking)&&(h.push("html-lang"),console.log("HTML language set by WP Accessibility")))),wpa.dir&&!m.getAttribute("dir")&&wpa.dir!=="ltr"&&(m.setAttributeattr("dir",wpa.dir),(wpa.errors||wpa.tracking)&&(h.push("html-lang-direction"),console.log("HTML language direction set by WP Accessibility"))),wpa.continue){let c=document.querySelectorAll(".wp-block-post-excerpt__more-link");c.length!==0&&c.forEach(a=>{if(!a.hasAttribute("aria-describedby")){let d=a.closest(".wp-block-post"),u=d.getAttribute("class");u=u.replaceAll(" ","-");let i=d.querySelector(".wp-block-post-title");i&&(i.hasAttribute("id")?u=i.getAttribute("id"):i.setAttribute("id",u),a.setAttribute("aria-describedby",u),(wpa.errors||wpa.tracking)&&console.log("Continue Reading link description set by WP Accessibility"))}})}let y=document.querySelector('meta[name="viewport"]');if(y){let c=y.getAttribute("content"),a=y.getAttribute("content");c.search(/user-scalable=no/g)&&(a=c.replace("user-scalable=no","user-scalable=yes"),y.setAttribute("content",a),(wpa.errors||wpa.tracking)&&a!=c&&(h.push("viewport-scalable"),console.log("Viewport made scalable by WP Accessibility"))),c.search(/maximum-scale=1/g)&&(a=c.replace("maximum-scale=1","maximum-scale=5"),a=a.replace("maximum-scale=0","maximum-scale=5"),y.setAttribute("content",a),(wpa.errors||wpa.tracking)&&a!=c&&(h.push("viewport-maxscale"),console.log("Viewport maximum scale set by WP Accessibility")))}if(wpa.skiplinks.enabled&&(A.insertAdjacentHTML("afterbegin",wpa.skiplinks.output),(wpa.errors||wpa.tracking)&&(h.push("skiplinks"),console.log("Skip links added by WP Accessibility"))),wpa.current){let c=document.querySelectorAll(".current-menu-item a, .current_page_item a");c.length!==0&&(c.forEach(a=>{a.setAttribute("aria-current","page")}),(wpa.errors||wpa.tracking)&&(h.push("aria-current"),console.log("ARIA current added by WP Accessibility")))}if(wpa.labels&&["s","author","email","url","comment"].forEach(a=>{let d,u,i,t,e,s,o,n,l,r;a=="comment"?d=document.querySelectorAll("textarea[name="+a+"]"):d=document.querySelectorAll("input[name="+a+"]:not(#adminbar-search)"),d.length!==0&&d.forEach(b=>{b.length!==0&&(u=b.getAttribute("id"),i=b.closest("label"),t=b.getAttribute("aria-label"),e=b.getAttribute("aria-labelledby"),s={},e&&(s=document.getElementById(e)),o=!(t==null||t==""||typeof t>"u"),n=!(e==null||e==""||typeof e>"u"),(!o&&!n||!o&&n&&!s)&&(u?(l=document.querySelector("label[for="+u+"]"),l&&(r=l.innerText,l&&!r&&(l.innerText=wpa.wpalabels[a],(wpa.errors||wpa.tracking)&&(h.push(["empty-label",wpa.wpalabels[a]]),console.log("Empty label on "+wpa.wpalabels[a]+" added by WP Accessibility")))),!l&&!i&&(b.insertAdjacentHTML("beforebegin",""),(wpa.errors||wpa.tracking)&&(h.push(["explicit-label",wpa.wpalabels[a]]),console.log("Explicit label on "+wpa.wpalabels[a]+" added by WP Accessibility")))):i||(b.setAttribute("id","wpa_label_"+a),b.insertAdjacentHTML("beforebegin",""),(wpa.errors||wpa.tracking)&&(h.push(["implicit-label",wpa.wpalabels[a]]),console.log("Implicit label on "+wpa.wpalabels[a]+" added by WP Accessibility")))))})}),wpa.titles){let c=0,a=0,d=0,u=!1,i=document.querySelectorAll("img, a, input, textarea, select, button");i.length!==0&&(i.forEach(t=>{let e=t.getAttribute("title");if(t.classList.contains("nturl")&&(u=!0),e&&e!=="")switch(t.tagName){case"IMG":let s=t.getAttribute("alt");e=t.getAttribute("title"),!s||s===""?(t.setAttribute("alt",e),t.removeAttribute("title")):e===s&&t.removeAttribute("title"),c++;break;case"A":case"BUTTON":let o=x(t);if(!o||o===""){let k=t.getAttribute("aria-label");(!k||k==="")&&(t.setAttribute("aria-label",e),u||t.removeAttribute("title"))}else t.removeAttribute("title");a++;break;case"INPUT":case"SELECT":case"TEXTAREA":let n=t.getAttribute("aria-label"),l=t.getAttribute("aria-labelledby"),r=l?document.getElementById(l):!1,b=t.getAttribute("id"),g=b?document.querySelector('label[for="'+b+'"]'):!1,p=t.closest("label"),f=!!(n&&n!==""),w=!!(g&&x(g)!==""),L=!!(p&&x(p)!==""),E=!!(r&&x(r)!=="");f||w||L||E||t.setAttribute("aria-label",e),t.removeAttribute("title"),d++;break}}),(wpa.errors||wpa.tracking)&&(c>0&&(h.push(["images-titles",c]),console.log(c+" title attributes removed from images by WP Accessibility")),a>0&&(h.push(["control-titles",a]),console.log(a+" title attributes removed from links and buttons by WP Accessibility")),d>0&&(h.push(["input-titles",d]),console.log(d+" title attributes removed from input fields by WP Accessibility"))))}if(wpa.target){let c=document.querySelectorAll("a:not(.wpa-allow-target)"),a=0;c.length!==0&&(c.forEach(d=>{let u=d.getAttribute("target"),i=d.getAttribute("href");if(u)if(i.startsWith("#"))d.removeAttribute("target");else try{new URL(i).hostname.includes("facebook")||(d.removeAttribute("target"),a++)}catch(t){console.log("href value is not a URL or a fragment:",i)}}),a>0&&(wpa.errors||wpa.tracking)&&(h.push(["link-targets",a]),console.log(a+" target attributes removed from links by WP Accessibility")))}if(wpa.tabindex){let c=document.querySelectorAll("input,a[href],select,textarea,button"),a=0;c.length!==0&&(c.forEach(e=>{e.getAttribute("tabindex")&&(e.removeAttribute("tabindex"),a++)}),a>0&&(wpa.errors||wpa.tracking)&&(h.push(["control-tabindex",a]),console.log(a+" tabindex attributes removed from links, buttons and inputs by WP Accessibility")));let d=document.querySelectorAll('[role="button"]:not([tabindex]):not(a):not(button)'),u=document.querySelectorAll('a[role="button"]:not([tabindex]):not([href])'),i=document.querySelectorAll('[role="link"]:not([tabindex]):not(a)'),t=document.querySelectorAll("a:not([href]):not([tabindex])");d.length!==0&&(d.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),d.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["button-add-tabindex",d.length]),console.log(d.length+" tabindex attributes added to divs with the button role by WP Accessibility"))),u!==0&&(u.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),u.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["link-add-tabindex",u.length]),console.log(u.length+" tabindex attributes added to anchor elements with the button role and no href value by WP Accessibility"))),i!==0&&(i.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),i.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["fakelink-add-tabindex",i.length]),console.log(i.length+" tabindex attributes added to elements with the link role not using the a element by WP Accessibility"))),t!==0&&(t.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),t.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["links-add-tabindex",t.length]),console.log(t.length+" tabindex attributes added to a with no href attribute by WP Accessibility")))}if(wpa.url!=="disabled"){let d=function(e,s,o="event"){e=JSON.stringify(e);let n=new FormData;n.append("action",wpa.action),n.append("security",wpa.security),n.append("stats",e),n.append("post_id",wpa.post_id),n.append("title",s),n.append("type",o),fetch(wpa.ajaxurl,{method:"POST",body:n})};class c{constructor(s){var o=Array.prototype.forEach,n=Array.prototype.map;this.each=function(l,r,b){if(l!=null){if(o&&l.forEach===o)l.forEach(r,b);else if(l.length===+l.length){for(var g=0,p=l.length;g
>>16)*g&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*p+(((f>>>16)*p&65535)<<16)&4294967295,r^=f,r=r<<13|r>>>19,b=(r&65535)*5+(((r>>>16)*5&65535)<<16)&4294967295,r=(b&65535)+27492+(((b>>>16)+58964&65535)<<16);switch(f=0,n){case 3:f^=(s.charCodeAt(w+2)&255)<<16;case 2:f^=(s.charCodeAt(w+1)&255)<<8;case 1:f^=s.charCodeAt(w)&255,f=(f&65535)*g+(((f>>>16)*g&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*p+(((f>>>16)*p&65535)<<16)&4294967295,r^=f}return r^=s.length,r^=r>>>16,r=(r&65535)*2246822507+(((r>>>16)*2246822507&65535)<<16)&4294967295,r^=r>>>13,r=(r&65535)*3266489909+(((r>>>16)*3266489909&65535)<<16)&4294967295,r^=r>>>16,r>>>0}}let a=new c().get(),u=document.querySelector(".toggle-contrast");u&&u.addEventListener("click",function(){let e;this.getAttribute("data-id")=="is_normal_contrast"?e={contrast:"disabled"}:e={contrast:"enabled"},d(e,a)});let i=document.querySelector(".toggle-fontsize");i&&i.addEventListener("click",function(){let e;this.getAttribute("data-id")=="is_normal_fontsize"?e={fontsize:"disabled"}:e={fontsize:"enabled"},d(e,a)}),v(".wpa-ld button").then(e=>{e.addEventListener("click",function(s){if(e.getAttribute("aria-expanded")==="true"){let r={longdesc:e.closest("div").getAttribute("class").replace("wpa-ld wp-image-","")};d(r,a)}})});let t=document.querySelectorAll(".wpa-alt button");t.length>0&&t.forEach(e=>{e.addEventListener("click",function(s){if(e.getAttribute("aria-expanded")==="true"){let r={alttext:e.closest("div").getAttribute("class").replace("wpa-alt wp-image-","")};d(r,a)}})}),wpa.tracking&&h.length>=1&&d(h,wpa.url,"view")}if(wpa.underline.enabled){let c=document.querySelectorAll(wpa.underline.target+":not(nav "+wpa.underline.target+"):not(#wpadminbar a), .wpa-focusable[role=link]");c.length>0&&c.forEach(a=>{let d=a.style.outlineWidth,u=a.style.outlineOffset,i=a.style.color,t=a.style.outlineColor;a.style.textDecoration="underline",a.addEventListener("mouseenter",function(){this.style.textDecoration="none"}),a.addEventListener("mouseleave",function(){this.style.textDecoration="underline"}),a.addEventListener("focusin",function(){let e="2px";d=="2px"&&(e="4px"),this.style.outlineWidth=e,this.style.outlineColor=i,this.style.outlineOffset="2px"}),a.addEventListener("focusout",function(){this.style.outlineWidth=d,this.style.outlineColor=t,this.style.outlineOffset=u})})}if(wpa.videos){let c=matchMedia("(prefers-reduced-motion)"),a="false",d=document.querySelectorAll("video[autoplay]:not([controls])");d.length>0&&d.forEach(u=>{c.matches&&(u.pause(),a="true");let i=u.parentElement,t=document.createElement("button"),e=document.createElement("span"),s=document.createElement("span");t.setAttribute("type","button"),t.classList.add("wpa-video"),t.setAttribute("aria-pressed",a),e.classList.add("dashicons-controls-pause","dashicons"),e.setAttribute("aria-hidden","true"),s.classList.add("screen-reader-text"),s.innerText=wpa.pause,t.append(e,s),i.append(t),t.addEventListener("click",function(){let o=this.getAttribute("aria-pressed");console.log(o),o==="true"?(u.play(),this.setAttribute("aria-pressed","false")):(u.pause(),this.setAttribute("aria-pressed","true"))})})}if(wpa.alt){let c=wpa.altSelector?wpa.altSelector:'.hentry img[alt]:not([alt=""]), .comment-content img[alt]:not([alt=""]), #content img[alt]:not([alt=""]),.entry-content img[alt]:not([alt=""])',a=document.querySelectorAll(c),d=(u,i)=>{u.parentElement.insertBefore(i,u),i.appendChild(u)};a.forEach(u=>{let i=u,t=i.closest("a"),e=i.closest("button"),s=!!t,o=!!e,n=i.width,l=i.height;if((n||l)&&(n=n||56,l=l||56,l*n<150*300))return;let r=i.getAttribute("alt"),b=[...i.classList];i.setAttribute("class","");let g=document.createElement("div");g.classList.add("wpa-alt"),d(s||o?s?t:e:i,g),b.forEach(w=>{g.classList.add(w)}),g.insertAdjacentHTML("afterbegin",''),g.insertAdjacentHTML("beforeend",'
');let p=g.querySelector(".wpa-alt-text");p.style.display="none",p.innerText=r,g.querySelector("button").addEventListener("click",function(w){p.checkVisibility()?(this.setAttribute("aria-expanded","false"),p.style.display="none"):(this.setAttribute("aria-expanded","true"),p.style.display="block")})})}if(wpa.ldType){let d=function(i){let t=i.getAttribute("class");(t===null||t==="")&&(parent=i.closest(".wpa-alt"),t=parent.getAttribute("class").replace("wpa-alt ",""));let e=t.replace("wp-image-",""),s=wpa.restUrl+"/"+e;fetch(s).then(o=>o.json()).then(o=>{let n=o.description.rendered;if(n=n.replace(/(<([^>]+)>)/gi,"").trim(),n!==""){let l=new URL(wpa.ldHome);l.searchParams.set("longdesc",e),l.searchParams.set("p",e),l.toString(),u(i,e,l,n)}}).catch(o=>{console.log(o)})},u=function(i,t,e,s){let o=document.createElement("div");o.classList.add("wpa-ld");let n=i.getAttribute("alt");n===""&&(n=""+i.getAttribute("src").replace(wpa.ldHome,"")+"");let l=document.body.className.split(/\s+/),r="";l.forEach(p=>{p.match(/postid-/gi)&&(r=p.replace("postid-","",p)),p.match(/page-id-/gi)&&(r=p.replace("page-id-","",p))});let b=new URL(e);if(b.searchParams.set("referrer",r),b.toString(),[...i.classList].forEach(p=>{o.classList.add(p)}),c(i,o),i.setAttribute("alt",""),i.setAttribute("class",""),wpa.ldType==="link")o.insertAdjacentHTML("beforeend",'Description of '+n+"");else{o.insertAdjacentHTML("beforeend",'"),o.insertAdjacentHTML("beforeend",'');let p=o.querySelector(".longdesc");p.style.display="none",fetch(e).then(f=>{if(f.ok)return f.text();p.insertAdjacentHTML("beforeend",s)}).then(f=>{let L=new DOMParser().parseFromString(f,"text/html");p.insertAdjacentElement("beforeend",L.querySelector("#desc_"+t))}),o.querySelector("button").addEventListener("click",function(f){p.checkVisibility()?(this.setAttribute("aria-expanded","false"),p.style.display="none"):(this.setAttribute("aria-expanded","true"),p.style.display="block")})}},c=(i,t)=>{i.parentElement.insertBefore(t,i),t.appendChild(i)},a=document.querySelectorAll("img[longdesc]");if(wpa.ldType==="link"){a.length>0&&a.forEach(t=>{let e=document.createElement("div");e.classList.add("wpa-ld");let s=t.getAttribute("longdesc"),o=t.getAttribute("alt"),n=[...img.classList];c(t,e),n.forEach(r=>{e.classList.add(r)}),t.setAttribute("class","");let l=document.createElement("a");l.setAttribute("href",s),l.classList.add("longdesc-link"),l.innerHTML='Description of'+o+"",t.insertAdjacentElement("afterend",l)});let i=document.querySelectorAll("figure.is-style-longdesc");i.length>0&&i.forEach(t=>{let e=t.querySelector("img");d(e)})}else{a.length>0&&a.forEach(t=>{c(t,wrapper);let e=t.getAttribute("longdesc"),s=t.getAttribute("class").match(/\S+/g),o="";s.forEach(l=>{l.match(/wp-image-/gi)&&(o=l),wrapper.classList.add(l)}),o===""&&(o=t.getAttribute("id").replace("longdesc-return-","")),t.setAttribute("class",""),wrapper.insertAdjacentHTML("beforeend",'"),wrapper.insertAdjacentHTML('');let n=wrapper.querySelector(".longdesc");n.style.display="none",n.load(e+" #desc_"+o),wrapper.querySelector("button").addEventListener("click",function(){n.checkVisibility()?(this.setAttribute("aria-expanded","false"),n.style.display="none"):(this.setAttribute("aria-expanded","true"),n.style.display="block")})});let i=document.querySelectorAll("figure.is-style-longdesc");i.length>0&&i.forEach(t=>{let e=t.querySelector("img");d(e)})}}})();function x(m){let A="";if(m.nodeType===3||m.nodeType===4)A=m.nodeValue;else if(m.nodeType===1&&(m.tagName.toLowerCase()=="img"||m.tagName.toLowerCase()=="area"||m.tagName.toLowerCase()=="input"&&m.getAttribute("type")&&m.getAttribute("type").toLowerCase()=="image"))A=m.getAttribute("alt")||"";else if(m.nodeType===1&&!m.tagName.match(/^(script|style)$/i)){let h=m.childNodes;for(let y=0,c=h.length;y