1import{_ as b}from"./BzeN7z0j.js";import{_ as x,a as n,w as o,az as c,p as w,aA as I,m as L,k as A,l as P,ay as $,aI as N,y as k,aG as C,o as r,s as T,c as O,b as m,q as D,e as d,d as l,A as i}from"./Bv6rD22K.js";import{_ as H}from"./BKVVQxuU.js";import{_ as R}from"./BwOs6Znr.js";import{_ as v}from"./D9n9N6J4.js";import{S as B}from"./QHpKS67c.js";import{c as E}from"./ZNiQiSmP.js";import{u as M}from"./BLpgbMCi.js";import"./COtxoU-H.js";import"./ChFH_etC.js";import"./DJ6jjTd3.js";import"./KjFEp5XW.js";import"./NdmdrM1v.js";import"./DhxosPtj.js";import"./B7hmZjMN.js";import"./CXJsqkHJ.js";import"./DIPFThub.js";import"./B2INmLdn.js";import"./C7yT8Dih.js";import"./CeJCG0WW.js";import"./CCxC4gXk.js";import"./z4ZVdS0n.js";const U={name:"StoriesIndexPage",setup(){const t=$(),e=N(),u=k(),p=C(),{pageIsOnTwoOrMore:s}=M();return{route:t,router:e,userStore:u,dataLayerStore:p,pageIsOnTwoOrMore:s}},data(){return{search:null,dataLayer:{},posts:[],totalCount:0,perPage:20,sidebarAdSections:P.sidebarAdSections}},computed:{...L(A,["siteHasFeature"]),currentPage(){const t=this.route.params.pageNumber||this.route.query.page;return t?Number(t):1},totalPages(){return Math.ceil(this.totalCount/this.perPage)},metaDescription(){const t=`page ${this.currentPage} of ${this.totalPages}`;return`${this.$site.defaultMeta["metadesc-story"]} ${t}`},userIsLoggedIn(){return this.userStore.userIsLoggedIn},userIsUnverified(){return this.userStore.userIsUnverified}},watch:{posts(t){t&&this.onLoad()}},created(){const{$hostname:t}=c();w({title:"Stories Archive",meta:i(()=>{const e=[{name:"description",content:this.metaDescription},{property:"og:description",content:this.metaDescription},{property:"twitter:description",content:this.metaDescription}];return(!this.siteHasFeature("Stories")||this.pageIsOnTwoOrMore)&&e.push({name:"robots",content:"noindex"}),e}),link:i(()=>!this.siteHasFeature("Stories")||this.pageIsOnTwoOrMore?[{rel:"canonical",content:null}]:[])}),I([i(()=>E("Stories",this.totalCount,`https://${this.$hostname}${this.route.path}`,t,this.$site.settings.condition_name))])},methods:{tryToAddNewStory(t){if(this.userIsLoggedIn&&!this.userIsUnverified){const{$snowplow:e}=c();e.trackButtonEvent({data:{type:"add story",text:t.target.textContent.trim(),classes:t.target.classList,id:t.target.id}})}this.router.push("/stories/new")},onLoad(){this.dataLayerStore.setDataLayer(this.dataLayer)}},apollo:{search:{query:B,variables(){return{page:this.currentPage,query:"*",index:"POST",searchSort:"DATE",postTypes:["story"],limit:this.perPage}},update(t){return t?.search&&(this.dataLayer=JSON.parse(t.search.dataLayer||"{}"),this.totalCount=t.search.total||0,this.posts=t.search.searchResults||[]),t?.search||null}}}},q={key:1,class:"collection-page"};function F(t,e,u,p,s,a){const h=b,_=T,g=H,y=R,S=v;return r(),n(S,{name:"sidebar","show-leaderboard-ad":!t.$apollo.loading},{hero:o(()=>[m(h,{class:"ugc-index-header--stories",heading:"Stories"},{subtitle:o(()=>[...e[1]||(e[1]=[l(" Read personal stories and experiences submitted by your community members.",-1),d("br",null,null,-1),l(" Have a story to share? ",-1)])]),cta:o(()=>[d("button",{id:"submit-story-button",type:"button",class:"button","data-test-id":"new-story-button",onClick:e[0]||(e[0]=(...f)=>a.tryToAddNewStory&&a.tryToAddNewStory(...f))},"Submit your story")]),_:1})]),"sidebar-ads":o(()=>[t.$apollo.loading?D("",!0):(r(),n(y,{key:0,sections:s.sidebarAdSections},null,8,["sections"]))]),default:o(()=>[t.$apollo.loading?(r(),n(_,{key:0})):(r(),O("div",q,[m(g,{items:s.posts,"current-page":a.currentPage,"per-page":s.perPage,"total-count":s.totalCount},null,8,["items","current-page","per-page","total-count"])]))]),_:1},8,["show-leaderboard-ad"])}const mt=x(U,[["render",F]]);export{mt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.