function doAction(e,t,a){url=BACKSERV,fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,params:t})}).then((e=>e.json())).then((e=>{a(e)})).catch((e=>{console.error("Err of request:",e)}))}function getSwitchersVal(e){const t=e.querySelectorAll(".form-check-input"),a={};for(switcher of t)a[switcher.name]=switcher.checked;return a}function entryTypeToView(e){return{cources:"Навчання",catalog:"Фізичний товар",promo:"Промо/Акція"}[e]}function formattedTimestamp(e){const t=new Date(e.replace(" ","T")),a=e=>e.toString().padStart(2,"0");return`${a(t.getDate())}.${a(t.getMonth()+1)}.${t.getFullYear()} ${a(t.getHours())}:${a(t.getMinutes())}`}function paginator_handler(e,t,a){const r=e.querySelector(".pagination");if(r.innerHTML="",t.total_pages<2)return;let n="";for(let e=1;e<=t.total_pages;e++)n+=`<li class="page-item"><span class="page-link" data-pagenum="${e}">${e}</span></li>`;r.innerHTML=n,r.querySelector(`[data-pagenum="${t.pagenum}"]`)?.parentNode.classList.add("active"),r.querySelectorAll(".page-link").forEach((e=>{e.addEventListener("click",(e=>{const t=e.currentTarget.dataset.pagenum;e.currentTarget.parentNode.parentNode.parentNode.dataset.gotoPagenum=t,a()}))}))}function validityChecking(e){e.querySelectorAll(".invalid").forEach((e=>{e.classList.remove("invalid")}));const t=!0;e.querySelectorAll("[required]").forEach((e=>{e.checkValidity()||(e.classList.add("invalid"),t=!1)}));const a=e.querySelector('[name="hlink"]');return a.value.length&&(-1!=a.value.indexOf("https://")&&-1==a.value.indexOf("http://")||(a.classList.add("invalid"),t=!1)),t}document.addEventListener("DOMContentLoaded",(e=>{document.querySelectorAll("[required]").forEach((e=>{e.addEventListener("input",(e=>{e.currentTarget.classList.remove("invalid")}))}));const t=document.location.hash;let a=document.querySelector('#pills-tab [data-coreui-target="#pills-knbase"]');if(-1!=t.indexOf("#target-")){const e=t.split("#target-")[1];a=document.querySelector(`#pills-tab [data-coreui-target="#${e}"]`)}new coreui.Tab(a).show(),document.querySelectorAll("[data-coreui-toggle]").forEach((e=>{e.addEventListener("shown.coreui.tab",(e=>{const t="#target-"+e.target.dataset.coreuiTarget.replace("#","");document.location.hash=t}))}))})); //# sourceMappingURL=main.js.map