import{_ as v,C as L,I as k,r as c,o as n,b as h,p as d,a as m,q as _,l,v as p,B as D,i as I,G as C,a6 as F,R as N,U as B,w as f,D as P,F as M,e as U}from"./main-DtyiNRRn.js";const S={name:"BrochureTilesFi",components:{CloudImageFi:L,IconFi:k},props:{title:{type:String,default:""},previewText:{type:String,default:""},downloadUrl:{type:String,default:""},thumbnailUrl:{type:String,default:""}}},H=["href"],E={class:"brochure-tile-fi__image-container"},K={class:"brochure-tile-fi__content"},V={key:0,class:"brochure-tile-fi__headline"},G={key:1,class:"brochure-tile-fi__preview-text"};function R(t,i,e,r,a,o){const b=c("cloud-image-fi"),u=c("icon-fi");return e.downloadUrl?(n(),h("a",{key:0,href:e.downloadUrl,class:"brochure-tile-fi",download:""},[d("div",E,[e.thumbnailUrl?(n(),m(b,{key:0,class:"brochure-tile-fi__image",src:e.thumbnailUrl,alt:e.title,params:"func=fit&bg_img_fit=1&bg_opacity=0.7&bg_colourise=black&bg_blur=100&fit_enlarge=1"},null,8,["src","alt"])):_("",!0)]),d("div",K,[l(u,{class:"brochure-tile-fi__file-download-icon",icon:"download"}),e.title?(n(),h("div",V,p(e.title),1)):_("",!0),e.previewText?(n(),h("p",G,p(e.previewText),1)):_("",!0)])],8,H)):_("",!0)}const j=v(S,[["render",R],["__scopeId","data-v-72d05731"]]),q={name:"BrochuresFi",components:{LoadingIndicator:D,ComponentWrapper:I,GridContainerFi:C,TabNavigationFi:F,BrochureTileFi:j,RichtextFi:N},inject:["fields","prefetch"],data(){return{brochureList:[],isLoading:!0,currentTag:{id:0}}},computed:{tags(){var t,i;return(i=(t=this.fields)==null?void 0:t.tags)!=null&&i.length?this.fields.tags.filter(e=>{var r,a;return((a=(r=e.fields)==null?void 0:r.tagName)==null?void 0:a.value)&&e.fields.tagName.value!==""}):[]},tabNavigation(){return this.tags.length?this.tags.map((i,e)=>{var r,a;return{id:e,text:(a=(r=i.fields)==null?void 0:r.tagName)==null?void 0:a.value,tagId:i.id}}):null},fetchParams(){const t=this.$fischer.siteLanguage()||null;if(!t||!this.tabNavigation)return null;const{tagId:i}=this.tabNavigation[0],e=this.currentTag.tagId||i;return{lang:t,tags:e}},cacheKey(){return this.fetchParams?`${this.fetchParams.lang} ${this.fetchParams.tags}`:null}},async serverPrefetch(){await this.fetchData(),this.ctx.prefetch=this.cache},created(){this.cache=this.prefetch||{}},mounted(){this.fetchData()},methods:{tabChanged(t){this.isLoading=!0,this.currentTag=t,this.fetchData()},async fetchData(){var t,i;try{const e=this.cache[this.cacheKey];if(e){this.brochureList=e;return}let r="/api/brochures/get";if(!this.fetchParams){console.error("Missing parameters",this.fetchParams);return}const a=await B.get(r,{params:this.fetchParams});(i=(t=a.data)==null?void 0:t.Data)!=null&&i.TeaserList&&(this.brochureList=a.data.Data.TeaserList,this.cache[this.cacheKey]=this.brochureList)}catch(e){console.error(e)}finally{this.isLoading=!1}}}},O={class:"fi-col-start-1 md:fi-col-start-2 fi-col-end-13 md:fi-col-end-12"},W={class:"fi-col-span-full"},z={class:"fi-col-span-full brochures-fi__container"},A={class:"fi-col-start-1 md:fi-col-start-2 fi-col-end-13 md:fi-col-end-12 brochures-fi__content-wrapper"},J=["innerHTML"],Q=["innerHTML"],X={class:"brochures-fi__brochure-tiles"};function Y(t,i,e,r,a,o){const b=c("richtext-fi"),u=c("grid-container-fi"),w=c("tab-navigation-fi"),T=c("loading-indicator"),y=c("brochure-tile-fi"),x=c("component-wrapper");return n(),m(x,{class:"brochures-fi"},{default:f(()=>[l(u,null,{default:f(()=>{var s,g;return[d("div",O,[(g=(s=o.fields)==null?void 0:s.headline)!=null&&g.value||t.isEditMode?(n(),m(b,{key:0,class:"brochures-fi__headline","html-content":o.fields.headline},null,8,["html-content"])):_("",!0)])]}),_:1}),l(u,{container:!1},{default:f(()=>[d("div",W,[l(w,{"tab-navigation":o.tabNavigation,"is-slider":!0,"no-spacing-below":!0,onChange:i[0]||(i[0]=s=>o.tabChanged(s))},null,8,["tab-navigation"])])]),_:1}),l(u,{container:!1},{default:f(()=>[d("div",z,[l(u,null,{default:f(()=>[d("div",A,[t.isEditMode?(n(),h("h3",{key:0,class:"brochures-fi__tiles-intro-text",innerHTML:o.fields.tilesIntroText.editable},null,8,J)):(n(),h("h3",{key:1,class:"brochures-fi__tiles-intro-text",innerHTML:o.fields.tilesIntroText?o.fields.tilesIntroText.value:""},null,8,Q)),a.isLoading?(n(),m(T,{key:2,variant:"spinnerLocal",class:"spinner-local--rebrush",dark:""})):_("",!0),l(P,{"enter-active-class":"animated fadeIn fastest","leave-active-class":"animated fadeOut fastest",mode:"out-in"},{default:f(()=>[(n(),h("div",{key:a.currentTag.id,class:"brochures-fi__tiles-wrapper"},[d("div",X,[(n(!0),h(M,null,U(a.brochureList,(s,g)=>(n(),m(y,{key:s.Document.Download+g,title:s.Document.BrochureTitle,"preview-text":s.Document.PreviewText,"download-url":s.Document.Download,"thumbnail-url":s.Document.Thumbnail},null,8,["title","preview-text","download-url","thumbnail-url"]))),128))])]))]),_:1})])]),_:1})])]),_:1})]),_:1})}const $=v(q,[["render",Y],["__scopeId","data-v-b0a90187"]]);export{$ as default};