1import{j as e,a2 as B,E as g,I as _,a3 as U,a4 as O,J as S,r as o,o as u,q as j,t as P,H as k,U as K,$ as V}from"./index-B-aW8nfO.js";import{D as T,a as q,W as $,b as J}from"./WeatherPanel-_9OLZqWt.js";import{I as W}from"./image-DT_FW9BN.js";import{d as p}from"./decodeEntities-CLxPUvbq.js";import{S as Y}from"./shield-check-CEU2Qoqb.js";import{A as Z}from"./arrow-right-BrU8GfYA.js";import"./NewsletterCard-ChlYSjEX.js";import{P as G}from"./PullToRefresh-8WbXmq1m.js";import"./cloud-nrip0MQu.js";import"./input-6P2YZOqi.js";import"./button-bHHZALAg.js";import"./send-Cu0XwZf9.js";function Q({alert:t}){return t?e.jsxs("div",{className:"rounded-2xl border border-red-700/60 bg-gradient-to-br from-emerald-950 to-red-950/40 overflow-hidden",children:[e.jsxs("div",{className:"bg-red-700 text-white px-3 py-1.5 flex items-center gap-2 text-[10px] font-bold uppercase tracking-widest",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," ",t.source," ",t.kind," alert"]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("p",{className:"text-red-400 text-[11px] font-bold uppercase tracking-widest",children:[t.urgency," urgency"]}),e.jsx("h3",{className:"font-heading font-extrabold text-white text-xl leading-tight mt-1",children:t.title}),e.jsx("p",{className:"text-emerald-100/70 text-sm mt-2 leading-relaxed",children:t.summary}),e.jsxs("div",{className:"flex items-center justify-between mt-4",children:[e.jsxs("span",{className:"text-amber-500 text-[11px] font-bold uppercase tracking-wider inline-flex items-center gap-1",children:[t.link_label," ",e.jsx(Z,{className:"w-3 h-3"})]}),e.jsx("span",{className:"text-emerald-200/50 text-[11px]",children:g(t.created_date)})]})]})]}):null}const F={normal:{bg:"bg-[#F2F8F5]",text:"text-[#14765F]",icon:"text-[#14765F]",label:"Normal"},developing:{bg:"bg-[#F2F8F5]",text:"text-[#082E29]",icon:"text-[#14765F]",label:"Developing"},advisory:{bg:"bg-amber-50",text:"text-amber-800",icon:"text-amber-600",label:"Advisory"},watch:{bg:"bg-orange-50",text:"text-orange-800",icon:"text-orange-600",label:"Watch"},warning:{bg:"bg-red-50",text:"text-red-800",icon:"text-red-600",label:"Warning"}};function X({location:t,alert:s=null}){var b;if(!t)return null;const l=t.current_temp!==void 0&&t.current_temp!==null,x=_(t);if(!l||x)return e.jsxs("div",{className:"rounded-[20px] bg-white p-8 text-center",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-[#E2ECE8] border-t-[#14765F] rounded-full animate-spin mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-[#66736F]",children:"Refreshing weatherâ¦"})]});const a=t.precip_chance??0,i=s?F[(b=s.urgency)==null?void 0:b.toLowerCase()]||F.developing:F.normal,d=t.weather_updated_at||t.updated_date,c=d?new Date(d).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZone:t.time_zone||void 0}):"â",N=[{Icon:T,color:"#2563EB",label:"Rain",value:`${a}%`,bar:a},{Icon:q,color:"#14765F",label:"Wind",value:t.wind||"â"},{Icon:U,color:"#F4B529",label:"Sunrise",value:t.sunrise||"â"},{Icon:O,color:"#FB923C",label:"Sunset",value:t.sunset||"â"}];return e.jsxs("div",{className:"rounded-[20px] bg-white shadow-[0_1px_3px_rgba(0,0,0,0.04)] overflow-hidden",children:[e.jsxs("div",{className:"px-5 pt-5 pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("p",{className:"text-[11px] font-bold uppercase tracking-[0.14em] text-[#14765F]",children:[t.city,", ",t.state_abbr]}),e.jsxs("p",{className:"text-[11px] text-[#66736F]",children:["Updated ",c]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx($,{condition:t.condition,size:28,className:"shrink-0 mt-1"}),e.jsxs("span",{className:"text-[58px] font-extrabold leading-[0.9] tracking-tight text-[#082E29]",children:[t.current_temp,"°"]})]}),t.condition&&e.jsx("p",{className:"text-[17px] font-semibold text-[#082E29] mt-2 leading-snug",children:t.condition}),e.jsxs("div",{className:"flex items-center gap-5 mt-2",children:[e.jsxs("span",{className:"text-[13px] text-[#66736F]",children:["Feels like ",e.jsxs("span",{className:"font-semibold text-[#082E29]",children:[t.feels_like,"°"]})]}),e.jsxs("span",{className:"text-[13px] text-[#66736F]",children:["H ",e.jsxs("span",{className:"font-semibold text-[#082E29]",children:[t.high,"°"]}),e.jsx("span",{className:"mx-1.5 text-[#E2ECE8]",children:"/"}),"L ",e.jsxs("span",{className:"font-semibold text-[#082E29]",children:[t.low,"°"]})]})]})]}
1),e.jsx("div",{className:"grid grid-cols-4 border-t border-[#E2ECE8]",children:N.map((r,v)=>e.jsxs("div",{className:`px-2 py-3 text-center ${v<3?"border-r border-[#E2ECE8]":""}`,children:[e.jsx(r.Icon,{className:"w-4 h-4 mx-auto mb-1.5",style:{color:r.color}}),e.jsx("p",{className:"text-[15px] font-bold text-[#082E29] leading-none",children:r.value}),e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-wider text-[#66736F] mt-1",children:r.label}),r.bar!==void 0&&e.jsx("div",{className:"mt-1.5 h-0.5 rounded-full bg-[#E2ECE8] overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(r.bar,100)}%`}})})]},r.label))}),e.jsxs("div",{className:`px-5 py-3.5 flex items-center gap-3 ${i.bg} border-t border-[#E2ECE8]`,children:[e.jsx(S,{className:`w-4 h-4 ${i.icon} shrink-0 rotate-90`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:`text-[13px] font-semibold ${i.text}`,children:s?s.title:"Weather may impact your plans"}),(s==null?void 0:s.summary)&&e.jsx("p",{className:"text-[11px] text-[#66736F] mt-0.5 truncate",children:s.summary})]}),e.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wider px-2 py-0.5 rounded-full ${i.bg} ${i.text} border border-current/20`,children:i.label})]})]})}function ee({location:t}){const[s,l]=o.useState(null),[x,a]=o.useState(!0);return o.useEffect(()=>{if(!(t!=null&&t.state_abbr)){a(!1);return}let i=!1;return(async()=>{a(!0);try{const d=await u.functions.invoke("getLatestWeatherArticle",{city:t.city||void 0,state_abbr:t.state_abbr,county:t.county||void 0}),c=d.data||d;!i&&(c!=null&&c.article)?l(c.article):i||l(null)}catch{i||l(null)}i||a(!1)})(),()=>{i=!0}},[t==null?void 0:t.state_abbr,t==null?void 0:t.city,t==null?void 0:t.county]),x?e.jsxs("div",{className:"mb-5 rounded-2xl bg-white border border-[#E2ECE8] overflow-hidden animate-pulse",children:[e.jsx("div",{className:"aspect-video bg-[#F2F8F5]"}),e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx("div",{className:"h-3 w-24 rounded bg-[#F2F8F5]"}),e.jsx("div",{className:"h-4 w-full rounded bg-[#F2F8F5]"})]})]}):s?e.jsx(j,{to:k(s),className:"block mb-5 group",children:e.jsxs("div",{className:"rounded-2xl bg-white border border-[#E2ECE8] overflow-hidden shadow-[0_1px_3px_rgba(0,0,0,0.04)] transition-shadow hover:shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[s.image_url&&e.jsxs("div",{className:"relative aspect-video overflow-hidden",children:[e.jsx(W,{src:s.image_url,alt:s.image_alt||p(s.headline),className:"w-full h-full"}),e.jsxs("div",{className:"absolute top-2.5 left-2.5 flex items-center gap-1 bg-[#14765F] text-white text-[10px] font-bold uppercase tracking-wider px-2.5 py-1 rounded-full",children:[e.jsx(P,{className:"w-3 h-3"}),"Latest Weather"]})]}),e.jsxs("div",{className:"p-4",children:[!s.image_url&&e.jsxs("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-[#14765F] mb-1 flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3"}),"Latest Weather"]}),e.jsx("h2",{className:"font-heading font-bold text-[16px] leading-snug text-[#082E29] group-hover:text-[#14765F] transition-colors line-clamp-2",children:p(s.headline)}),e.jsxs("p",{className:"text-[11px] text-[#66736F] mt-1.5 flex items-center gap-1",children:[g(s.published_at),e.jsx(S,{className:"w-3 h-3"})]})]})]})}):null}function te({hourly:t=[]}){return t.length?e.jsx("div",{className:"no-scrollbar flex gap-2 overflow-x-auto pb-1 snap-x snap-mandatory",children:t.map((s,l)=>e.jsxs("div",{className:`shrink-0 snap-start w-[72px] rounded-2xl p-2.5 text-center transition-colors ${l===0?"bg-[#F2F8F5] ring-1 ring-[#14765F]/15":"bg-[#F8FAF9] hover:bg-[#F2F8F5] active:bg-[#E8F1ED]"}`,children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-[#66736F]",children:l===0?"NOW":s.hour}),e.jsx("div",{className:"flex justify-center my-1.5",children:e.jsx($,{condition:s.condition,size:22})}),e.jsxs("p",{className:"text-[18px] font-extrabold text-[#082E29] leading-none",children:[s.temp,"°"]}),e.jsxs("p",{className:"text-[11px] font-semibold text-blue-500 mt-1",children:[s.precip,"%"]})]},s.hour))}):null}function se({outlook:t=[]}){if(!t.length)return null;const s=Math.max(...t.map(a=>a.high)),l=Math.min(...t.map(a=>a.low)),x=s-l||1;return e.jsx("div",{className:"rounded-[16px] bg-white overflow-hidden",children:t.map((a,i)=>{var c;const d=i===0;return e.jsxs("div",{className:`flex items-center gap-2.5 px-3 py-3.5 transition-colors active:bg-[#F2F8F5] ${d?"bg-[#F2F8F5]":""}
1 ${i<t.length-1?"border-b border-[#E2ECE8]":""}`,children:[e.jsx("span",{className:"w-11 text-[14px] font-bold text-[#082E29] shrink-0",children:d?"Today":(c=a.day)==null?void 0:c.slice(0,3)}),e.jsx($,{condition:a.condition,size:22,className:"shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 text-[13px] text-[#082E29] truncate font-medium",children:a.condition}),e.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] font-semibold text-blue-500 shrink-0 w-9",children:[e.jsx(T,{className:"w-3 h-3"}),a.precip,"%"]}),e.jsxs("span",{className:"text-[13px] text-[#66736F] w-7 text-right shrink-0",children:[a.low,"°"]}),e.jsx("span",{className:"hidden sm:block relative h-1 w-16 rounded-full bg-[#E2ECE8] shrink-0",children:e.jsx("span",{className:"absolute h-1 rounded-full bg-gradient-to-r from-[#14765F] to-[#F4B529]",style:{left:`${(a.low-l)/x*100}%`,right:`${(s-a.high)/x*100}%`}})}),e.jsxs("span",{className:"text-[14px] font-bold text-[#082E29] w-7 text-right shrink-0",children:[a.high,"°"]})]},a.day)})})}function E({title:t,to:s,action:l="See all"}){return e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"font-heading font-bold text-[19px] text-[#082E29] leading-tight",children:t}),s&&e.jsx(j,{to:s,className:"text-[12px] font-semibold text-[#14765F] hover:text-[#003C32] transition-colors",children:l})]})}function H(){return e.jsxs("div",{className:"flex items-start gap-1.5 px-1 py-2",children:[e.jsx(Y,{className:"w-3 h-3 text-[#14765F] shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-[11px] text-[#66736F] leading-snug",children:["Weather data from NOAA / National Weather Service.",e.jsx("br",{}),"Weather experience sponsored by WeatherMVP."]})]})}function ue(){var C,A,R;const{location:t,refreshWeatherFor:s}=K(),[l,x]=o.useState([]),[a,i]=o.useState([]),[d,c]=o.useState(0);o.useEffect(()=>{!(t!=null&&t.id)||!_(t)||s(t)},[t==null?void 0:t.id,t==null?void 0:t.weather_updated_at,s]),o.useEffect(()=>{t&&(async()=>{const[n,M,z,I]=await Promise.all([u.entities.Alert.filter({active:!0,state_abbr:t.state_abbr},"-created_date",5).catch(()=>[]),t.city?u.entities.Article.filter({category:"Weather",status:"published",state_abbr:t.state_abbr,city:t.city},"-published_at",8).catch(()=>[]):Promise.resolve([]),t.county?u.entities.Article.filter({category:"Weather",status:"published",state_abbr:t.state_abbr,county:t.county},"-published_at",12).catch(()=>[]):Promise.resolve([]),u.entities.Article.filter({category:"Weather",status:"published",state_abbr:t.state_abbr},"-published_at",24).catch(()=>[])]),L=[],D=new Set,f=h=>h.forEach(m=>{!(m!=null&&m.id)||D.has(m.id)||(D.add(m.id),L.push(m))});f(M),f(z),f(I.filter(h=>h.geographic_scope==="state"||!h.city)),f(I.filter(h=>h.geographic_scope!=="state"&&h.city)),x(n),i(L.slice(0,8))})()},[t,d]);const N=async()=>{t&&await s(t),c(n=>n+1)};if(!t)return null;const b=l[0]||null,r=a[0]||null,v=a.slice(1),w=_(t),y=((C=t.outlook)==null?void 0:C.length)||7;return e.jsx(G,{onRefresh:N,children:e.jsxs("div",{className:"max-w-[840px] mx-auto px-5 md:px-6 pt-6 pb-24 md:pb-8 overflow-x-hidden",children:[e.jsx(V,{title:`${t.city}, ${t.state_abbr} Weather Forecast | Country Herald`,description:`Current conditions, hourly outlook, and ${y}-day forecast for ${t.city}, ${t.state_abbr}. Severe weather alerts, hourly temperatures, and precipitation chances.`,canonical:`${window.location.origin}/weather`}),e.jsxs("header",{className:"mb-5",children:[e.jsx("p",{className:"text-[12px] font-bold uppercase tracking-[0.16em] text-[#14765F] mb-1",children:"Weather"}),e.jsxs("h1",{className:"font-heading font-extrabold text-[28px] md:text-[32px] leading-[1.1] text-[#082E29]",children:[t.city,", ",t.state_abbr]}),e.jsxs("p",{className:"text-[15px] text-[#66736F] mt-0.5",children:[y,"-Day Forecast"]})]}),e.jsx(ee,{location:t}),e.jsxs("section",{className:"mb-7",children:[w?e.jsxs("div",{className:"rounded-[20px] bg-white p-8 text-center border border-[#E2ECE8]",children:[e.jsx("div",{className:"w-7 h-7 border-2 border-[#E2ECE8] border-t-[#14765F] rounded-full animate-spin mx-auto mb-3"}),e.jsx("p",{className:"font-semibold text-[#082E29]",children:"Refreshing current conditionsâ¦"}),e.jsx("p",{className:"text-xs text-[#66736F] mt-1",children:"Cached weather is older than 30 minutes and will not be shown as current."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"md:hidden",children:e.jsx(X,{location:t,alert:b})}),e.jsx("div",{className:"hidden md:block",children:e.jsx(J,{location:t})})]}),e.jsx("div",{className:"md:hidden",children:e.jsx(H,{})})]}),l.length>1&&e.jsx("section",{className:"mb-7 space-y-3",children:l.slice(1).map(n=>e.jsx(Q,{alert:n},n.id))}),!w&&((A=t.hourly)==null?void 0:A.length)>0&&e.jsxs("section",{className:"mb-7",children:[e.jsx(E,{title:"Hourly",to:"/weather-data",action:"Next 12 hours"}),e.jsx(te,{hourly:t.hourly})]}),!w&&((R=t.outlook)==null?void 0:R.length)>0&&e.jsxs("section",{className:"mb-7",children:[e.jsx(E,{title:`${y}-Day Forecast`}),e.jsx(se,{outlook:t.outlook})]}),a.length>0&&e.jsxs("section",{className:"mb-7",children:[e.jsx(E,{title:`Weather News Near ${t.city}`,to:"/local",action:"See all"}),r&&e.jsxs(j,{to:k(r),className:"block mb-4 group",children:[e.jsxs("div",{className:"relative rounded-2xl overflow-hidden aspect-video mb-2.5",children:[e.jsx(W,{src:r.image_url,alt:p(r.headline),className:"w-full h-full"}),r.label!=="none"&&e.jsx("span",{className:"absolute top-2.5 left-2.5 bg-[#1476
15F] text-white text-[10px] font-bold uppercase tracking-wider px-2.5 py-1 rounded-full",children:r.label})]}),e.jsx("h3",{className:"font-heading font-bold text-[17px] leading-snug text-[#082E29] group-hover:text-[#14765F] transition-colors",children:p(r.headline)}),e.jsxs("p",{className:"text-[12px] text-[#66736F] mt-1",children:[r.city?`${r.city}, ${r.state_abbr}`:"National"," · ",g(r.published_at)]})]}),e.jsx("div",{className:"space-y-3",children:v.map(n=>e.jsxs(j,{to:k(n),className:"flex gap-3 items-center group",children:[n.image_url&&e.jsx("div",{className:"w-20 h-20 rounded-xl overflow-hidden shrink-0",children:e.jsx(W,{src:n.image_url,alt:p(n.headline),className:"w-full h-full"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[n.label!=="none"&&e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider text-[#14765F]",children:n.label}),e.jsx("h3",{className:"font-heading font-bold text-[14px] leading-snug text-[#082E29] group-hover:text-[#14765F] transition-colors line-clamp-2",children:p(n.headline)}),e.jsx("p",{className:"text-[11px] text-[#66736F] mt-0.5",children:g(n.published_at)})]}),e.jsx(S,{className:"w-4 h-4 text-[#66736F] shrink-0"})]},n.id))})]}),e.jsx("div",{className:"hidden md:block space-y-4",children:e.jsx(H,{})})]})})}export{ue 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.