window.Zammad={},function(){function e(){}e.generateIcon=function(e,t){return t?'&#x'+e+"":''},Zammad.Util=e}(),function(){function i(e){e.stopPropagation(),e.preventDefault();var t=document.querySelector(".dropdown-menu"),n=t.classList.toggle("is-open");t.setAttribute&&t.setAttribute("aria-expanded",n?"true":"false"),n?window.addEventListener("click",i):window.removeEventListener("click",i)}document.addEventListener("DOMContentLoaded",function(){document.querySelector('[data-toggle="dropdown"]').addEventListener("click",i),document.querySelector(".dropdown-menu").addEventListener("click",function(e){e.stopPropagation()})})}(),function(){function n(i){this.el=document.createElement("div"),this.render=function(){this.el.innerHTML=this.constructor.template,this.el.querySelector("a").href=this.itemPath()||this.kbPath(),this.el.querySelector(".close").addEventListener("click",this.close.bind(this))},this.kbPath=function(){return document.querySelector("html").dataset.basePath.replace(encodeURIComponent("{locale}"),i)},this.close=function(){this.el.remove()},this.itemPath=function(){var e=document.querySelector("main");if(!e)return null;var t=e.dataset.basePath,n=e.dataset.availableLocales;return t&&n?(n=n.split(","),a.includes(n,i)?t=t.replace(encodeURIComponent("{locale}"),i):null):null},this.render()}function a(){}n.template='
'+Zammad.Util.generateIcon("mood-supergood")+'

The Knowledge Base is available in your language activate

'+Zammad.Util.generateIcon("diagonal-cross")+"
",a.html=function(){return document.querySelector("html")},a.document_languages=function(){return this.html().dataset.availableLocales.split(",")},a.user_languages=function(){var e=navigator.userLanguage||navigator.languages||navigator.language;return Array.isArray(e)?e:e?[e]:[]},a.is_current=function(e){return this.extract_language(this.html().lang)===this.extract_language(e)},a.includes=function(e,t){return t=this.extract_language(t),e.filter(function(e){return this.extract_language(e)===t},this)[0]!==undefined},a.offer_language=function(){return this.includes(this.user_languages(),this.html().lang)?null:this.document_languages().filter(function(e){return this.includes(this.user_languages(),e)},this)[0]},a.extract_language=function(e){return e.split("-")[0]},a.checkIfBetterLanguageAvailable=function(){var e=this.offer_language();e&&this.show(e)},a.show=function(e){var t=new n(e);document.querySelector(".js-wrapper").prepend(t.el)},a.checkIfBetterLanguageAvailable()}(),function(){function t(){}function i(e){this.el=document.createElement("li"),this.render=function(){this.el.classList.add("result"),this.el.innerHTML=this.constructor.template,this.setTitle(e.title,e.tags),this.setSubtitle(e.subtitle),this.setPreview(e.body),this.setURL(e.url),this.setIcon(e.icon,e.type)},this.setTitle=function(e){var t=e||"";this.el.querySelector(".result-title").innerHTML=t},this.setSubtitle=function(e){this.el.querySelector(".result-category").innerHTML=e||""},this.setPreview=function(e){this.el.querySelector(".result-preview").innerHTML=e||""},this.setURL=function(e){this.el.querySelector("a").href=e||"#"},this.setIcon=function(e,t){this.el.querySelector(".result-icon").innerHTML=this.generateIcon(e,t)},this.generateIcon=function(e,t){switch(t){case"KnowledgeBase::Category::Translation":return iconset=document.querySelector("html").dataset.iconset,Zammad.Util.generateIcon(e,iconset);default:return Zammad.Util.generateIcon(e)}},this.render()}function a(e){this.el=document.createElement("li"),this.el.classList.add("search-message"),this.el.textContent=e.text}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".js-search-input");t.bindEvent(e)}),t.lookup=function(e){this.timeoutIdentifier&&clearTimeout(this.timeoutIdentifier),this.clearContainer();var t=this;this.timeoutIdentifier=setTimeout(function(){t.lookupAction(e)},300)},t.lookupAction=function(e){var t={knowledge_base_id:document.querySelector("html").dataset.id,locale:document.querySelector("html").lang,query:e,flavor:"public"};if(""!==e){var n=this;fetch("/api/v1/knowledge_bases/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(function(e){return e.json()}).then(function(e){(0===e.details.length?[new a({text:n.container().dataset.emptyPlaceholder})]:e.details.map(function(e){return new i(e)})).forEach(function(e){n.container().appendChild(e.el)})})["catch"](function(e){var t=new a({text:e.message});n.container().appendChild(t.el)})}},t.container=function(){return document.querySelector(".js-search-results")},t.clearContainer=function(){for(var e=this.container();null!==e.firstChild;)e.removeChild(e.firstChild)},t.bindEvent=function(e){e.addEventListener("input",function(){t.lookup(e.value)})},i.template='

'}(); //# sourceMappingURL=data:application/json;charset=utf-8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