!function(){"use strict";const e="atc",t={success:{bg:"lime",outline:"#000",text:"#000"},error:{bg:"#EB0000",outline:"#fff",text:"#fff"},warning:{bg:"orange",outline:"#000",text:"#000"},excluded:{bg:"#e0e0e0",outline:"#666",text:"#333"},info:{bg:"yellow",outline:"#000",text:"#000"}},n={success:"OK",error:"FEHLER",warning:"WARNUNG",excluded:"AUSGESCHLOSSEN",info:"INFO"},o={"font-family":"sans-serif","font-size":"small",padding:"5px 8px",outline:"2px dotted #000","outline-offset":"-3px",border:"0",cursor:"default","z-index":"2147483647"};function l(){return"alt-text-checker:excluded:"+location.href}function r(){try{const e=localStorage.getItem(l());return e?JSON.parse(e):[]}catch(e){return[]}}function i(e){return e.currentSrc||e.src||null}function a(e){const t=i(e);if(null===t)return;const n=r(),o=n.indexOf(t);-1===o?n.push(t):n.splice(o,1),function(e){try{localStorage.setItem(l(),JSON.stringify(e))}catch(e){}}(n)}function c(e,t,n){let o=0;return Array.from((t||document).querySelectorAll(e)).forEach(e=>{n(e),o+=1}),Array.from((t||document).querySelectorAll("*")).forEach(t=>{t.shadowRoot&&(o+=c(e,t.shadowRoot,n))}),o}function s(e){return!(!e.parentNode||"A"!==e.parentNode.tagName&&!s(e.parentNode))}function u(l,r,i,a){const c=t[r],s=!!(a=a||{}).global,u=document.createElement(s?"label":"button");u.className=`${e} ${e}-${r}`.trim();const d=Object.assign({},o,{"background-color":c.bg,"outline-color":c.outline,color:c.text});var f;"absolute"===a.position&&l.offsetParent&&l.offsetParent!==document.body&&(d.left=`${l.offsetLeft}px`,d.top=`${l.offsetTop}px`),a.extraStyle&&Object.assign(d,a.extraStyle),u.setAttribute("style",(f=d,Object.keys(f).map(e=>`${e}:${f[e]}`).join(";")));const g=a.icon||"";if(s)u.textContent=g?`${g} ${i}`:i;else{u.appendChild(document.createTextNode(g));const t=document.createElement("span");t.className=`${e}-badge`,t.textContent=n[r]||"",t.style.marginLeft="4px",t.style.fontWeight="700",u.appendChild(t);const o=document.createElement("span");if(o.className=`${e}-details`,o.appendChild(function(e){const t=document.createDocumentFragment();return e.forEach(e=>{if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(void 0!==e.code){const n=document.createElement("code");n.textContent=e.code,t.appendChild(n)}else if(void 0!==e.strike){const n=document.createElement("s");n.textContent=e.strike,t.appendChild(n)}}),t}(i)),o.style.color="inherit",o.style.marginLeft="4px",u.appendChild(o),!a.alwaysOpen){o.style.display="none";const t=()=>{0===document.querySelectorAll(`.${e}-toggle:checked`).length&&(o.style.display="inline")},n=()=>{0===document.querySelectorAll(`.${e}-toggle:checked`).length&&(o.style.display="none")};u.addEventListener("focus",t),u.addEventListener("mouseover",t),u.addEventListener("blur",n),u.addEventListener("mouseout",n)}}if(a.onClick&&u.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),a.onClick()}),s&&a.withToggle){u.appendChild(document.createTextNode(" — alle Details anzeigen"));const t=document.createElement("input");t.type="checkbox",t.className=`${e}-toggle`,t.style.margin="0 0 0 4px",t.style.verticalAlign="baseline",t.addEventListener("change",function(){document.querySelectorAll(`.${e}-details`).forEach(e=>{e.style.display=this.checked?"inline":"none"})}),u.appendChild(t)}return s&&(document.querySelectorAll(`.${e}-global`).forEach(e=>e.remove()),u.className+=` ${e}-global`),"absolute"===a.position&&l.parentNode?l.parentNode.insertBefore(u,l.nextSibling):(a.insertInto||l.parentNode).appendChild(u),u}function d(e,t){const n=t.getAttribute(e);if(!n)return null;const o=n.split(" ").map(e=>e.trim()).filter(Boolean),l=[];return o.forEach(n=>{const o=document.getElementById(n);if(!o)return;u(o,"warning",[`Referenziert von [${e}="`,{code:t.id||"…"},'"]'],{icon:"⚠️",position:"absolute"});const r=o.textContent.trim();r&&l.push(r)}),l.length?l.join(" "):null}!function t(){c(`.${e}`,document,e=>e.remove());const n=r(),o={ok:0,error:0,warning:0,excluded:0,total:0};c("a[alt], button[alt], label[alt]",document,e=>{u(e,"error",[`<${e.tagName.toLowerCase()}> mit ungültigem `,{code:`alt="${e.getAttribute("alt")}"`}],{icon:"✖",position:"absolute"})}),c('img, [role="img"]',document,e=>{if(o.total+=1,function(e,t){const n=i(e);return null!==n&&t.includes(n)}(e,n))return o.excluded+=1,void u(e,"excluded",["Ausgeschlossen (manuell als dekorativ markiert)"],{icon:"⦸",position:"absolute",onClick:()=>{a(e),t()}});const l=e.hasAttribute("alt"),r=l?e.getAttribute("alt"):null,c=e.hasAttribute("aria-label"),f=d("aria-describedby",e),g=d("aria-labelledby",e),p=e.hasAttribute("title"),m=e.hasAttribute("longdesc"),b=c||null!==f||null!==g,h=s(e)?"Bild in Link: ":"",y=[];let x,$;if(p&&y.push(" ",{code:`title="${e.getAttribute("title")}"`}),m&&y.push(" ",{code:`longdesc="${e.getAttribute("longdesc")}"`}),l){const e=0===r.trim().length;x=[h,{code:`alt="${r}"`},...y],$=e?"warning":"success"}else if(b){x=[p?"":h,{strike:"alt"}," fehlt, aber ARIA-Name vorhanden: ",{code:c?e.getAttribute("aria-label"):g||f},...y],$="warning"}else x=[h,{strike:"alt"}," fehlt",...y],$="error";o["success"===$?"ok":$]+=1,u(e,$,x,{icon:"success"===$?"✔":"error"===$?"✖":"⚠️",position:"absolute",onClick:()=>{a(e),t()}})});const l=o.error>0?"error":o.warning>0?"warning":"success",f=o.total?`Bilder: ${o.total} · ✔ ${o.ok} OK · ✖ ${o.error} Fehler · ⚠️ ${o.warning} Warnung · ⦸ ${o.excluded} ausgeschlossen`:"Keine Bilder auf dieser Seite gefunden.";u(document.body,o.total?l:"info",f,{global:!0,withToggle:!!o.total,extraStyle:{position:"fixed",top:"0",left:"0"}})}()}();