import{_ as u,I as y,cK as v,h as w,N as P,bR as C}from"./index.f2790301.js";import{f as T}from"./faComment.30e0d0ca.js";import{I as c,t as a,x as i,N as n,F as x,Y as $,Q as k,P as _,_ as N,W as m,z as p,O as l,L as B,y as L,aA as A,aB as S}from"./vue.02ad7c87.js";import{B as D}from"./blog.acc504fc.js";const I=(s,e)=>{const t=encodeURIComponent(s);return`${t}[]=${e.map(encodeURIComponent).join(`&${t}[]=`)}`};const V={name:"BlogTagList",props:{tags:{type:Array,required:!0},width:{type:String,default:"wide"},container:{type:Boolean}},data(){return{meta:{}}}},O={class:"row"},j={class:"col"};function z(s,e,t,g,h,o){const d=c("tml-tag");return a(),i("div",{class:p(["blog-tag-list d-flex flex-wrap",{[t.width]:t.width,container:t.container}])},[n("div",O,[n("div",j,[(a(!0),i(x,null,$(t.tags,r=>(a(),k(d,{key:r.id,class:"blog-tag-list-item mb-2 mr-3",href:r.url},{default:_(()=>[N(" #"+m(r.name),1)]),_:2},1032,["href"]))),128))])])],2)}const E=u(V,[["render",z],["__scopeId","data-v-5fbbd89b"]]);const M={name:"DisplayPost",components:{BlogTagList:E},inject:["app"],props:{post:{type:Object,required:!0},commentCount:{type:Number}},data(){return{meta:{},faComment:T.faComment}},computed:{isLoggedOutMobile(){return y("md")&&this.app.isTeemill&&v.passes},displayedContent(){return this.post.content.replace(/<img src=/g,'<img class="lazyload" data-src=').replace(/\?w=1140/g,"?w=680").replace('<img class="lazyload" data-src=',"<img src=")}}},R={class:"mb-6"},U={class:"mb-2"},q={key:0},F={key:0},K={key:1},H=["innerHTML"],Q=n("hr",null,null,-1),G=n("h4",null,"Sharing is caring",-1);function W(s,e,t,g,h,o){const d=c("font-awesome-icon"),r=c("tml-anchor"),f=c("blog-tag-list"),b=c("tml-share-buttons");return a(),i("div",{class:p(["blog store-blog-post post",{"teemill-atlas":o.app&&!o.app.isSubdomain,subdomain:o.app&&o.app.isSubdomain,"logged-out-mobile":o.isLoggedOutMobile}])},[n("div",R,[n("h1",U,m(t.post.title),1),t.commentCount!==null?(a(),i("div",q,[l(r,{class:"bold",onClick:e[0]||(e[0]=Y=>s.$emit("click-comment-count"))},{default:_(()=>[l(d,{class:"mr-2",icon:h.faComment},null,8,["icon"]),t.commentCount===0?(a(),i("span",F,"View Comments")):(a(),i("span",K,m(t.commentCount)+" "+m(t.commentCount===1?"New Comment":"New Comments"),1))]),_:1})])):B("",!0)]),n("div",{class:"content",innerHTML:o.displayedContent},null,8,H),l(f,{class:"mt-8 mb-6",tags:t.post.tags,width:"narrow"},null,8,["tags"]),Q,G,l(b,{"icon-set":["facebook","twitter","email","copyUrl"]}),L(s.$slots,"footer")],2)}const et=u(M,[["render",W]]),st={props:{divisions:{type:Array}},computed:{...A("blog",{paginate:"paginate",total:"total",post:"post",posts:"posts",tag:"tag",tags:"tags",next:"next",fetching:"fetching"}),...S("blog",{tagsPosts:"tagsPosts",statePost:"statePost",seoKeywords:"seoKeywords",pageTitle:"pageTitle",listTags:"listTags"}),activeTag(){return this.$store.getters["blog/findActiveTag"](this.$route)},tagItems(){const s=this.$route.params.tag;return this.tags.map(e=>({...e,disabled:e.name===s,text:e.name}))}},methods:{async fetchPaginatedPosts(){return this.divisions?this.total===null||this.total>this.posts.length?new Promise((s,e)=>{this.$store.dispatch("blog/fetchPaginatedPosts",{divisions:this.divisions}).then(t=>s(t)).catch(t=>e(t))}):[]:[]},fetchPost(s){return fetch(w(`/omnis/v3/blog/show/?blogPost=${s}${this.divisions?`&${I("divisions",this.divisions)}`:""}`),{credentials:"include",mode:"no-cors"}).then(e=>{if(e.ok)return e.json();throw e.status===404?new P:new C(`Request to fetch a blog post failed with status ${e.status}`)}).then(e=>(this.$store.commit("blog/setVariable",{key:"post",value:D.map(e)}),e))},async fetchAllPosts(){return new Promise(s=>{this.$store.dispatch("blog/fetchAllPosts",{divisions:this.divisions}).then(e=>s(e))})},async fetchTags(){return new Promise((s,e)=>{this.$store.dispatch("blog/fetchTags",{divisions:this.divisions}).then(t=>s(t)).catch(t=>e(t))})},async fetchTaggedPosts(s){return new Promise(e=>{this.$store.dispatch("blog/fetchTaggedPosts",{divisions:this.divisions,tag:s}).then(t=>e(t)).catch(({status:t,data:g})=>{t===404&&this.$router.replace("/404")})})}},created(){!this.tags.length&&this.meta.indexPage&&this.fetchTags().catch(()=>{})}};export{et as D,E as b,st as d};
//# sourceMappingURL=data-mixin.fd972848.js.map
