import{_ as T,B as R,i as S,G as N,a6 as P,m as q,r as l,o as r,a as p,w as n,b as _,l as c,p as d,v as h,q as b}from"./main-DtyiNRRn.js";import{S as Q}from"./SearchFactFinderFi-8hERWkix.js";import"./PaginationProgressBar-BeoLQCaE.js";import"./FacetsMenuFi-Bipy54DJ.js";import"./FacetsSelectionFi-DKJ23T6j.js";import"./factFinderNgFacetFragment-CIrlUR3D.js";import"./infinite-loading-vue3-ts.esm-BQzRtQdQ.js";import"./toFilterInput-C87A9-6-.js";import"./index-DMcXiZMh.js";import"./trackingMixin.vue_vue_type_script_lang-GAj9AXmq.js";import"./IconAttributeItemFi-DFWFiX0v.js";import"./catalogAttributesMixin-CL45_ybt.js";import"./catalogMixin-DBTp3kGc.js";import"./priceCurrencyMixin-CKEVFsHP.js";const C={name:"SearchPageFi",components:{LoadingIndicator:R,ComponentWrapper:S,GridContainerFi:N,SearchFactFinderFi:Q,TabNavigationFi:P},props:{fields:{type:Object,default:()=>({})}},data(){return{totalHits:["",""],tabs:{},isMounted:!1}},computed:{...q({suggestionsQuery:"search/suggestionsQuery"}),initId(){return this.$fischer.query("tab")==="website"||!this.hasProducts?1:0},hasProducts(){return this.$store.getters["search/hasProducts"]},noQuery(){return this.suggestionsQuery===""},tabNavigation(){var s,u;const t=((s=this.fields.productsTab)==null?void 0:s.value)||"",a=((u=this.fields.websiteTab)==null?void 0:u.value)||"";return[{id:0,text:this.$dict.replace(t,[this.totalHits[0]]),hidden:!this.hasProducts||!this.totalHits[0]||this.noQuery},{id:1,text:this.$dict.replace(a,[this.totalHits[1]]),hidden:!this.totalHits[1]||this.noQuery}]}},created(){this.$store.commit("navigation/SET_IS_SEARCH_PAGE",!0)},mounted(){this.isMounted=!0,this.changeTabOnNoResults()},methods:{changeTabOnNoResults(){!this.hasProducts||!this.$refs.tabNavigation||!this.tabs[0]||!this.tabs[1]||this.tabs[0].$apollo.queries.searchFactFinderNg.loading||this.tabs[1].$apollo.queries.searchFactFinderNg.loading||(this.totalHits[0]&&!this.totalHits[1]&&this.$refs.tabNavigation.active===1?this.$refs.tabNavigation.changeTab(0):this.totalHits[1]&&!this.totalHits[0]&&this.$refs.tabNavigation.active===0&&this.$refs.tabNavigation.changeTab(1))},onTotalHitsProducts(t){this.totalHits[0]=t,this.changeTabOnNoResults()},onTotalHitsWebsite(t){this.totalHits[1]=t,this.changeTabOnNoResults()},changeTab({id:t}){t?/tab=website/.test(window.location.search)||window.history.replaceState("","",`${window.location.search}${window.location.search?"&":"?"}tab=website`):/tab=website/.test(window.location.search)&&window.history.replaceState("","",String(window.location.search).replace(/&?tab=website/,"")),this.tabs[t].parseUrlParams()},getResultHeadline(t,a){var s;return(t.totalHits===0||a)&&((s=this.fields.noResultsHeadline)!=null&&s.value)?this.$dict.replace(this.fields.noResultsHeadline.value,[a?this.suggestionsQuery:t.query]):this.$dict.get("search.Headline",[t.query])},getResultHeadlineSuper(t,a){var s;return(t.totalHits===0||a)&&((s=this.fields.noResultsHeadlineSuper)!=null&&s.value)?this.fields.noResultsHeadlineSuper.value:this.$dict.get("search.Headline-Super")}}},x={key:0,class:"fi-col-span-full"},k={key:0,class:"search-page-fi__heading"},B={class:"search-page-fi__headline-super fi-col-start-1 fi-col-span-12 sm:fi-col-start-3 sm:fi-col-span-8 lg:fi-col-start-5 lg:fi-col-span-4"},I={class:"search-page-fi__query fi-col-start-1 fi-col-span-12 sm:fi-col-start-2 sm:fi-col-span-10 lg:fi-col-start-4 lg:fi-col-span-6"},O={key:0,class:"search-page-fi__heading"},$={class:"search-page-fi__headline-super fi-col-start-1 fi-col-span-12 sm:fi-col-start-3 sm:fi-col-span-8 lg:fi-col-start-5 lg:fi-col-span-4"},E={class:"search-page-fi__query fi-col-start-1 fi-col-span-12 sm:fi-col-start-2 sm:fi-col-span-10 lg:fi-col-start-4 lg:fi-col-span-6"};function G(t,a,s,u,f,e){const m=l("grid-container-fi"),v=l("search-fact-finder-fi"),H=l("tab-navigation-fi"),w=l("loading-indicator"),y=l("component-wrapper");return r(),p(y,{class:"search-page-fi","data-test":"search-page"},{default:n(()=>[f.isMounted?(r(),_("div",x,[c(H,{ref:"tabNavigation","tab-navigation":e.tabNavigation,"content-loading":!1,"init-id":e.initId,"hide-only":"","line-hidden":"",onChange:e.changeTab},{"tab-content-0":n(({isActive:g})=>[e.hasProducts?(r(),p(v,{key:0,ref:i=>f.tabs[0]=i,class:"fi-col-span-full","click-source":"search",fields:s.fields,"is-active":g,"is-search-page":"",onTotalHits:e.onTotalHitsProducts},{heading:n(({searchFactFinderNg:i,skipSearch:o})=>[(i.query||o)&&!e.noQuery?(r(),_("div",k,[c(m,null,{default:n(()=>[d("div",B,h(e.getResultHeadlineSuper(i,o)),1),d("div",I,h(e.getResultHeadline(i,o)),1)]),_:2},1024)])):b("",!0)]),_:2},1032,["fields","is-active","onTotalHits"])):b("",!0)]),"tab-content-1":n(({isActive:g})=>[c(v,{ref:i=>f.tabs[1]=i,class:"fi-col-span-full","click-source":"search",fields:s.fields,"is-active":g,"is-search-page":"","is-website-search":"",onTotalHits:e.onTotalHitsWebsite},{heading:n(({searchFactFinderNg:i,skipSearch:o})=>[(i.query||o)&&!e.noQuery?(r(),_("div",O,[c(m,null,{default:n(()=>[d("div",$,h(e.getResultHeadlineSuper(i,o)),1),d("div",E,h(e.getResultHeadline(i,o)),1)]),_:2},1024)])):b("",!0)]),_:2},1032,["fields","is-active","onTotalHits"])]),_:1},8,["tab-navigation","init-id","onChange"])])):(r(),p(w,{key:1,variant:"spinnerLocal"}))]),_:1})}const F=T(C,[["render",G],["__scopeId","data-v-18fe054e"]]);export{F as default};