"use strict";function categorySelectedEvent(e){var t=$(e.currentTarget).find(":selected"),a=$(t).closest(".KategorieSchnellsuche"),s=$(a).data("portlet-option-method");if(-1==$(t).val())window.location.href=$(t).data("target");else{$.ajax({url:$(".KategorieSchnellsuche").data("portlet-src")+"ajax.php",type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify({action:"loadSubCategories",category:$(e.currentTarget).find(":selected").val()}),success:function(e){e.data.forEach(function(e){let a=document.createElement("option");a.value=e.hasSubcategories?e.id:-1,a.textContent=e.cName,a.dataset.target=e.url,$(t).closest("ul").find("select:last").append(a)}),$(t).closest("ul").find("select:last").on("change",categorySelectedEvent),$(t).closest(".row").find(".btn-backward").attr("disabled",!1)},error:function(){}});const n=document.createElement("li"),l=document.createElement("div"),c=document.createElement("div"),o=document.createElement("select"),i=document.createElement("option");if(n.classList.add("container-item"),l.classList.add("form-group"),l.classList.add("text-left-util"),c.classList.add("cin-ks-header"),o.classList.add("form-control"),o.classList.add("custom-select"),o.classList.add("left-select"),i.setAttribute("disabled",!0),i.setAttribute("selected",!0),i.value="--init",i.textContent=$(a).data("portlet-option-text"),"auto"==s&&(i.textContent+=$(t).text()),"defaultHead"==s)c.innerHTML=$(t).text();else if("custom"==s){var r=$(a).data("portlet-option-aliaslist")[$(".select-container li",a).length]?$(a).data("portlet-option-aliaslist")[$(".select-container li",a).length]:"&nbsp;";c.innerHTML=r}else c.innerHTML="&nbsp;";o.append(i),"defaultHead"!=s&&"custom"!=s||l.append(c),l.append(o),n.append(l),$(t).closest("ul").append(n),"defaultHead"!=s&&"custom"!=s||$(t).closest(".form-group").find(".cin-ks-header").addClass("v-none");const d=document.createElement("li");d.classList.add("breadcrumb-item"),d.classList.add("breadcrumb-arrow-right");const u=document.createElement("a");u.classList.add("breadcrumb-link"),u.setAttribute("target","_self"),u.setAttribute("href",$(t).data("target"));const m=document.createElement("span");m.setAttribute("itemprop","name"),m.innerHTML=$(t).text(),u.append(m),d.append(u),$("ol.breadcrumb li:first",a).replaceWith(d);const p=document.createElement("li");p.classList.add("breadcrumb-item"),p.classList.add("active"),1==$("ol.breadcrumb li",a).length&&p.classList.add("first"),p.setAttribute("itemprop","itemListElement"),p.setAttribute("itemtype","https://schema.org/ListItem");const b=document.createElement("a");b.classList.add("breadcrumb-link"),b.setAttribute("title",$(t).text()),b.setAttribute("target","_self"),b.setAttribute("href",$(t).data("target")),b.setAttribute("itemprop","url");const f=document.createElement("span");f.setAttribute("itemprop","name"),f.innerHTML=$(t).text(),b.append(f),p.append(b),$("ol.breadcrumb li",a).length>1&&$("ol.breadcrumb li:not(:first)",a).removeClass("active"),$("ol.breadcrumb",a).append(p),setTimeout(function(){n.classList.add("show"),setTimeout(function(){l.classList.add("show")},150)},15)}}function removeListItem(e){var t=$(e.currentTarget),a=$(t).closest(".KategorieSchnellsuche"),s=$(t).closest(".row"),r=$(s).find("li:last"),n=$(".cin-ks-header",s),l=$(n).length;$(t).attr("disabled",2==$(".select-container li",s).length),$($(n)[l-2]).removeClass("v-none"),$(a).data("portlet-option-reset")&&$("+ select",$($(n)[l-2])).val("--init"),console.log($("+ select",$($(n)[l-2]))),$(r).removeClass("show");const c=$(r).find(".form-group");r[0].ontransitionend=function(){r[0].remove()},$(c).removeClass("show");var o=$("ol.breadcrumb li:last",a);o[0]&&o[0].remove(),$("ol.breadcrumb li",a).length>1&&$("ol.breadcrumb li:last",a).addClass("active");var i=$("ol.breadcrumb li:first",a);if($(t).attr("disabled"))$("a",$(i)).attr("href",""),$("a span",$(i)).text(""),$(i).removeClass("breadcrumb-arrow-right");else{var d=$($("li.container-item .form-group select",a)[$("ol.breadcrumb li",a).length-2]);$("a",$(i)).attr("href",""),$("a span",$(i)).text($("option:selected",$(d)).text())}}document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&($(".KategorieSchnellsuche select.left-select").on("input",categorySelectedEvent),$(".KategorieSchnellsuche .btn-backward").on("click",removeListItem))});