1import{T as F,V as k,an as L,q as B}from"./index-DJ-MIrAB.js";const h=[{id:"cathays",name:"Cathays",lat:51.4932163,lng:-3.1782513,type:"Neighbourhood",intro:"Student homes, neighbourhood life and the stories unfolding beyond the campus gates.",storyIds:["city","community","local-cathays","local-community"]},{id:"main-building",name:"Main Building",lat:51.4876934,lng:-3.1793944,type:"Campus",intro:"The heart of the university: teaching, research and the decisions shaping student life.",storyIds:["lead","campus","local-campus"]},{id:"cardiff-students-union",name:"Studentsâ Union",lat:51.4884777,lng:-3.1774039,type:"Campus",intro:"From societies and student voices to gigs and late-night conversations.",storyIds:["voices","culture-two","local-union"]}],P=h.filter(t=>t.type==="Campus"),A=t=>[...new Set(t.flatMap(e=>e.storyIds))],D=[{id:"all-cardiff",name:"All Cardiff",type:"Across the city",intro:"Reporting from the neighbourhoods and university places that make up Cardiff.",placeIds:h.map(t=>t.id),storyIds:A(h)},{id:"campus",name:"Campus",type:"Around the university",intro:"The stories, people and conversations connecting Cardiffâs university community.",placeIds:P.map(t=>t.id),storyIds:A(P)},...h];function j(t){return D.find(e=>e.id===t)||D[0]}function N(t){const e=j(t);return e.placeIds?h.filter(a=>e.placeIds.includes(a.id)):[e]}const x="2026-09-11",E={lead:["2026-09-10",6,1840],campus:["2026-09-08",4,920],city:["2026-09-05",7,1240],voices:["2026-08-28",3,680],community:["2026-08-14",5,410],"culture-two":["2026-07-22",8,1530],"local-cathays":["2026-05-14",4,740],"local-community":["2026-04-30",2,280],"local-campus":["2026-05-14",6,560],"local-union":["2026-04-30",3,350]},z=["main-building","cardiff-students-union"].map(t=>{const e=h.find(a=>a.id===t);return{id:`pickup-${t}`,placeId:t,name:e.name,lat:e.lat,lng:e.lng,detail:"Example newspaper pickup point"}});function q(t=[]){return t.flatMap(e=>{const a=h.find(i=>i.id===e.locationId)||h.find(i=>i.storyIds.includes(e.id));if(!a)return[];const[l,f,o]=E[e.id]||[];return[{...e,place:a,publishedAt:e.publishedAt||l,readingTimeMinutes:e.readingTimeMinutes??f,readCount:e.readCount??o}]})}function U(t,e){if(!e)return!0;const a=e.west<=e.east?t.lng>=e.west&&t.lng<=e.east:t.lng>=e.west||t.lng<=e.east;return t.lat>=e.south&&t.lat<=e.north&&a}function $(t,e){if(![t==null?void 0:t.lat,t==null?void 0:t.lng,e==null?void 0:e.lat,e==null?void 0:e.lng].every(Number.isFinite))return 1/0;const a=i=>i*Math.PI/180,l=a(e.lat-t.lat),f=a(e.lng-t.lng),o=Math.sin(l/2)**2+Math.cos(a(t.lat))*Math.cos(a(e.lat))*Math.sin(f/2)**2;return 6371e3*2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))}function O({bounds:t=null,placeIds:e=null,minReads:a=0,maxReadingMinutes:l=0,publishedWithinDays:f=0,writer:o="",section:i="",language:u="all",sort:c="latest",origin:d=null,referenceDate:C=x}={},M=q()){const S=Date.parse(`${C}T23:59:59.999Z`),y=Date.parse(`${C}T00:00:00Z`)-f*864e5,w=new Set;return M.filter(n=>{const p=Date.parse(n.publishedAt||"");return w.has(n.id)||!U(n.place,t)||e&&!e.includes(n.place.id)||o&&![n.author,...(n.authors||[]).map(s=>s.name)].some(s=>L(s)===L(o))||i&&![n.primaryCategory,...n.categories||[]].some(s=>L(s)===L(i))||!B(n,u)||a&&!(n.readCount>=a)||l&&!(n.readingTimeMinutes>0&&n.readingTimeMinutes<=l)||f&&!(p>=y&&p<=S)?!1:(w.add(n.id),!0)}).sort((n,p)=>{if(c==="closest"&&d){const s=$(d,n.place)-$(d,p.place);if(Number.isFinite(s)&&Math.abs(s)>.01)return s}if(c==="popular"){const s=(p.readCount||0)-(n.readCount||0);if(s)return s}return(Date.parse(p.publishedAt)||0)-(Date.parse(n.publishedAt)||0)||n.id.localeCompare(p.id)})}function R(t){const e=new Map;return t.forEach(a=>{const l=e.get(a.place.id)||{...a.place,count:0};l.count+=1,e.set(a.place.id,l)}),[...e.values()]}function g(t=""){try{return decodeURIComponent(t)}catch{return t}}function V(t="home",e=q(),a={}){var v,T,b;const l=a.getPlace||j,f=a.getPlaceMembers||N,o=/^(?:section|writer|article|location|campus)\//u.test(t)?t.split("?")[0]:t,[i,...u]=o.split("/");let c="",d="",C,M,S="",y="",w="";if(i==="writer"&&(y=g(u.join("/")),w=((v=(a.stories||e).flatMap(r=>r.authors||[]).find(r=>r.id===y))==null?void 0:v.name)||"This writer"),i==="location"||i==="campus"){const r=l(i==="c
1ampus"?"campus":g(u[0]));C=r.id,S=r.name,M=new Set(f(r.id).map(m=>m.id))}if(i==="section"&&(c=g(u[0])),i==="search"&&(d=g(u.join("/"))),i==="search-section"&&(c=g(u[0]),d=g(u.slice(1).join("/"))),i==="article"){const r=g(u.join("/")),m=e.find(I=>I.id===r)||(a.stories||[]).find(I=>I.id===r);m&&(C=((T=m.place)==null?void 0:T.id)||m.locationId,c=m.primaryCategory)}const n=F(d),p=e.filter(r=>{var m;return i==="writer"&&(!y||!((m=r.authors)!=null&&m.some(I=>I.id===y)))||M&&!M.has(r.place.id)||c&&r.primaryCategory.toLocaleLowerCase()!==c.toLocaleLowerCase()?!1:!n.length||k(r,n)!==null}),s=((b=e.find(r=>r.primaryCategory.toLocaleLowerCase()===c.toLocaleLowerCase()))==null?void 0:b.primaryCategory)||c;return{stories:p,initialPlace:C,label:d?`${s?s+" · ":""}â${d}â`:w||s||S}}export{R as a,O as f,j as g,U as i,q as l,V as m,h as p,z as s};
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.