window.addEventListener("DOMContentLoaded",t=>{let{getCookie:e,removeCookie:s,setCookie:a}=GSCookService;function l(t,e){let s=JSON.stringify(t);localStorage.setItem(e,s)}function c(t){return JSON.parse(localStorage.getItem(t))}let i=document.getElementsByClassName("gspb__switcher-element");for(let o=0;o<i.length;o++){let n=i[o],d=n.id;n.dataset.status;let r=n.dataset.local,u=n.dataset.storage,f=n.dataset.class,b=n.dataset.cookname,g=n.dataset.cookdays||30,h=b||"gspbswitchers"+d,p=n.closest(".gspb__switcher-container").querySelector(".gspb-switchbox-checkbox");if("true"==r){let k="",w="",m=[];"cookie"==u?k=e(h):"local"==u&&null!=(m=c("gspbswitchers"))&&(w=m.includes(d))&&(k=d);let y=n.dataset.status;k&&f&&document.body.classList.add(f),k&&"off"==y&&!p.checked&&(p.click(),n.setAttribute("data-status","on")),n.addEventListener("click",function(t){if(t.preventDefault(),f&&document.body.classList.toggle(f),k){if("cookie"==u)s(h);else if("local"==u){let e=m.indexOf(d);e>-1&&m.splice(e,1),l(m,"gspbswitchers")}n.setAttribute("data-status","off")}else"cookie"==u?a(h,"on",g):"local"==u&&(null==m&&(m=[]),m.push(d),l(m,"gspbswitchers")),n.setAttribute("data-status","on");p.click()})}}});