(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]||(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]=[])).push(["object"==typeof document?document.currentScript:void 0,471652,(e,a,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.AlmanacInterval=void 0,(n=r||(t.AlmanacInterval=r={})).DAILY="D",n.MONTHLY="M"},141050,(e,a,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transformAlmanac=void 0,t.getDailyAlmanac=d,t.getSingleDayAlmanac=s,t.getMonthlyAlmanac=c;let r=e.r(103763),n=e.r(678651),i=e.r(414655),l=e.r(992591),o=e.r(471652);async function d(e){let a=(0,r.getDailyAlmanacUrlConfig)(e),l=(0,n.urlFrom)(a),o=await fetch(l,{headers:{"Accept-Encoding":"gzip"},next:{revalidate:86400}}),d=await (0,i.handleFetchResponse)(o);return(0,t.transformAlmanac)(d)}async function s(e){let a=(0,r.getSingleDayAlmanacUrlConfig)(e),l=(0,n.urlFrom)(a),o=await fetch(l,{headers:{"Accept-Encoding":"gzip"},next:{revalidate:86400}}),d=await (0,i.handleFetchResponse)(o);return(0,t.transformAlmanac)(d)}async function c(e){let a=(0,r.getMonthlyAlmanacUrlConfig)(e),l=(0,n.urlFrom)(a),o=await fetch(l,{headers:{"Accept-Encoding":"gzip"},next:{revalidate:86400}}),d=await (0,i.handleFetchResponse)(o);return(0,t.transformAlmanac)(d)}t.transformAlmanac=(0,l.createTransformer)(e=>{var a;return{almanacInterval:(a=e.almanacInterval)===o.AlmanacInterval.DAILY||a===o.AlmanacInterval.MONTHLY?a:void 0,almanacRecordDate:e.almanacRecordDate??void 0,almanacRecordPeriod:e.almanacRecordPeriod??void 0,almanacRecordYearMax:e.almanacRecordYearMax??void 0,almanacRecordYearMin:e.almanacRecordYearMin??void 0,precipitationAverage:e.precipitationAverage??void 0,snowAccumulationAverage:e.snowAccumulationAverage??void 0,stationId:e.stationId??void 0,stationName:e.stationName??void 0,temperatureAverageMax:e.temperatureAverageMax??void 0,temperatureAverageMin:e.temperatureAverageMin??void 0,temperatureMean:e.temperatureMean??void 0,temperatureRecordMax:e.temperatureRecordMax??void 0,temperatureRecordMin:e.temperatureRecordMin??void 0}})},103763,(e,a,t)=>{"use strict";e.i(288906),Object.defineProperty(t,"__esModule",{value:!0}),t.getDailyAlmanacUrlConfig=function({geocode:e,units:a,startDay:t,startMonth:r,days:n}){return{host:"api.weather.com",protocol:"https",pathname:`/v3/wx/almanac/daily/${n}day`,query:{geocode:e,units:a,startDay:String(t),startMonth:String(r),format:"json",apiKey:"71f92ea9dd2f4790b92ea9dd2f779061"}}},t.getSingleDayAlmanacUrlConfig=function({geocode:e,units:a,day:t,month:r}){return{host:"api.weather.com",protocol:"https",pathname:"/v3/wx/almanac/daily/1day",query:{geocode:e,units:a,day:String(t),month:String(r),format:"json",apiKey:"71f92ea9dd2f4790b92ea9dd2f779061"}}},t.getMonthlyAlmanacUrlConfig=function({geocode:e,units:a,startMonth:t,months:r}){return{host:"api.weather.com",protocol:"https",pathname:`/v3/wx/almanac/monthly/${r}month`,query:{geocode:e,units:a,startMonth:String(t),format:"json",apiKey:"71f92ea9dd2f4790b92ea9dd2f779061"}}}},704162,(e,a,t)=>{"use strict";e.i(288906),Object.defineProperty(t,"__esModule",{value:!0}),t.getCurrentDateTimeUrlConfig=i,t.getCurrentDateTime=l;let r=e.r(678651),n=e.r(414655);function i({geocode:e}){return{host:"api.weather.com",protocol:"https",pathname:"/v3/dateTime",query:{geocode:e,format:"json",apiKey:"71f92ea9dd2f4790b92ea9dd2f779061"}}}async function l(e){let a=i(e),t=(0,r.urlFrom)(a),l=await fetch(t,{headers:{"Accept-Encoding":"gzip"},next:{revalidate:300}});return await (0,n.handleFetchResponse)(l)}},146230,e=>{"use strict";var a=e.i(902875),t=e.i(64412),r=e.i(247865),n=e.i(546446),i=e.i(725287),l=e.i(674885),o=e.i(617874),d=e.i(581014),s=e.i(380993),c=e.i(368847),m=e.i(632137);let u=({isLoading:e,barWidth:t="w-8",children:r})=>(0,a.jsx)(c.default,{variant:"Body.S",children:e?(0,a.jsx)("span",{className:(0,m.cn)("inline-block h-3 animate-pulse rounded bg-gray-200 align-middle",t)}):r}),h=({todayNormals:e,today:t,reportedConditions:r,monthlyAverages:n,locale:i,isLoading:l,error:o,formatTemperature:m,formatPrecip:h,isReportedPending:p,isMonthlyPending:y})=>{let g=(0,d.useTranslations)("Almanac"),x=t?new Intl.DateTimeFormat(i,{month:"short",day:"numeric",timeZone:"UTC"}).format(new Date(`${t}T00:00:00Z`)):void 0;if(o)return(0,a.jsx)(s.Card,{"aria-label":g("almanac"),"data-testid":"almanac",children:(0,a.jsx)(s.CardContent,{children:(0,a.jsx)(c.default,{variant:"Display.S",children:o.message||g("unableToLoadData")})})});let f=y?Array.from({length:3}):n;return(0,a.jsxs)(s.Card,{className:"not-prose @container/almanac","aria-label":g("almanac"),"data-testid":"almanac","aria-busy":l||p||y||void 0,children:[(0,a.jsx)(c.default,{variant:"Title.S",elementType:"h2",className:"mb-4",children:g("almanac")}),(0,a.jsxs)(s.CardContent,{className:"flex flex-col gap-6 p-0",children:[(0,a.jsxs)("table",{className:"w-full text-left",children:[(0,a.jsx)("caption",{className:"sr-only",children:g("todayAlmanacCaption")}),(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{scope:"col",className:"py-1",children:(0,a.jsx)(c.default,{variant:"Caption.S.Bold",children:x??g("today")})}),(0,a.jsx)("th",{scope:"col",className:"py-1",children:(0,a.jsx)(c.default,{variant:"Caption.S.Bold",children:g("high")})}),(0,a.jsx)("th",{scope:"col",className:"py-1",children:(0,a.jsx)(c.default,{variant:"Caption.S.Bold",children:g("low")})}),(0,a.jsx)("th",{scope:"col",className:"py-1",children:(0,a.jsx)(c.default,{variant:"Caption.S.Bold",children:g("precip")})})]})}),(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,a.jsx)("th",{scope:"row",className:"py-1.5",children:(0,a.jsx)(c.default,{variant:"Body.S",children:g("averages")})}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)(u,{isLoading:l,children:m(e?.temperatureAverageMax)})}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)(u,{isLoading:l,children:m(e?.temperatureAverageMin)})}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)(u,{isLoading:l,barWidth:"w-14",children:h(e?.precipitationAverage)})})]}),(0,a.jsxs)("tr",{className:"align-top",children:[(0,a.jsx)("th",{scope:"row",className:"py-1.5",children:(0,a.jsx)(c.default,{variant:"Body.S",children:g("records")})}),(0,a.jsxs)("td",{className:"py-1.5",children:[(0,a.jsx)(u,{isLoading:l,children:m(e?.temperatureRecordMax)}),l?(0,a.jsx)(c.default,{variant:"Body.S",elementType:"span",className:"block text-gray-700",children:(0,a.jsx)("span",{className:"inline-block h-3 w-10 animate-pulse rounded bg-gray-200 align-middle"})}):e?.almanacRecordYearMax!==void 0&&(0,a.jsx)(c.default,{variant:"Body.S",elementType:"span",className:"block text-gray-700",children:`(${e.almanacRecordYearMax})`})]}),(0,a.jsxs)("td",{className:"py-1.5",children:[(0,a.jsx)(u,{isLoading:l,children:m(e?.temperatureRecordMin)}),l?(0,a.jsx)(c.default,{variant:"Body.S",elementType:"span",className:"block text-gray-700",children:(0,a.jsx)("span",{className:"inline-block h-3 w-10 animate-pulse rounded bg-gray-200 align-middle"})}):e?.almanacRecordYearMin!==void 0&&(0,a.jsx)(c.default,{variant:"Body.S",elementType:"span",className:"block text-gray-700",children:`(${e.almanacRecordYearMin})`})]}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)(c.default,{variant:"Body.S",children:"--"})})]})]})]}),(0,a.jsxs)("table",{className:"w-full text-left",children:[(0,a.jsx)("caption",{className:"text-left",children:(0,a.jsx)(c.default,{variant:"Body.S.Bold",children:g("reportedConditions")})}),(0,a.jsx)("tbody",{children:[["yesterday",r?.yesterday],["lastSevenDays",r?.lastSevenDays],["monthToDate",r?.monthToDate]].map(([e,t],r,n)=>(0,a.jsxs)("tr",{className:r(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)(u,{isLoading:p,barWidth:2===t?"w-14":"w-8",children:e})},t))]},e))})]}),(0,a.jsxs)("table",{className:"w-full text-left",children:[(0,a.jsx)("caption",{className:"text-left",children:(0,a.jsx)(c.default,{variant:"Body.S.Bold",children:g("historicalMonthlyAvg")})}),(0,a.jsx)("tbody",{children:(f??[]).map((e,t)=>(0,a.jsxs)("tr",{className:te?e.slice(0,10):void 0;function v(e){let a=e.map(e=>e.temperatureMax).filter(e=>"number"==typeof e),t=e.map(e=>e.temperatureMin).filter(e=>"number"==typeof e),r=e.map(e=>e.precip24Hour).filter(e=>"number"==typeof e);return{temperatureMax:a.length?Math.max(...a):void 0,temperatureMin:t.length?Math.min(...t):void 0,precipTotal:r.length?r.reduce((e,a)=>e+a,0):void 0,dayCount:e.length}}let j=({location:e,initializing:t,initialError:d})=>{let s=(0,i.useParams)(),c=s?.locale||"en-US",m=(0,n.useAtomValue)(l.userUnitPreferenceAtom),u=(0,o.unitsSystemByName)(m),{todayNormals:j,reportedConditions:b,monthlyAverages:A,today:M,isLoading:N,isReportedPending:w,isMonthlyPending:T,error:S}=function(e){let a=(0,i.useParams)(),t=a?.locale||"en-US",d=(0,n.useAtomValue)(l.userUnitPreferenceAtom),s=(0,o.unitsSystemByName)(d)?.code,c=e?.geocode,{data:m,isLoading:u}=(0,p.default)(c?["almanac-date-time",c]:null,([,e])=>(0,x.getCurrentDateTime)({geocode:e}),{revalidateOnFocus:!1,dedupingInterval:6e4}),h=(0,r.useMemo)(()=>{if(m?.dateTime)return m.dateTime.slice(0,10);if(e?.ianaTimeZone){var a;return a=e.ianaTimeZone,new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}},[m?.dateTime,e?.ianaTimeZone]),{data:j,error:b}=(0,p.default)(c&&h?["almanac-today",c,s,h]:null,([,e,a,t])=>(0,y.getSingleDayAlmanac)({geocode:e,units:a,day:Number(t.slice(8,10)),month:Number(t.slice(5,7))}),{dedupingInterval:6e4}),{data:A,error:M}=(0,p.default)(c&&h?["almanac-monthly",c,s,h.slice(5,7)]:null,([,e,a,t])=>(0,y.getMonthlyAlmanac)({geocode:e,units:a,startMonth:Number(t),months:3}),{dedupingInterval:6e4}),{data:N,error:w}=(0,p.default)(c?["almanac-daily-summary",c,s,t]:null,([,e,a,t])=>(0,g.getHistoricalDailySummary)({geocode:e,units:a,language:t}),{dedupingInterval:6e4}),T=(0,r.useMemo)(()=>N&&h?function({days:e,today:a}){let t=e.filter(e=>{let t=f(e.validTimeLocal);return!!t&&t(f(e.validTimeLocal)??"").localeCompare(f(a.validTimeLocal)??"")),r=a.slice(0,7);return{yesterday:v(t.slice(-1)),lastSevenDays:v(t.slice(-7)),monthToDate:v(t.filter(e=>f(e.validTimeLocal)?.startsWith(r)))}}({days:N,today:h}):void 0,[N,h]);return{todayNormals:j?.[0],reportedConditions:T,monthlyAverages:A,today:h,isLoading:u||!h||!j&&!b,isReportedPending:!N&&!w,isMonthlyPending:!A&&!M,error:b||M||w||void 0}}(e),C=(0,r.useCallback)(e=>void 0===e?"--":`${Math.round(e)}\xb0`,[]),D=(0,r.useCallback)(e=>void 0===e?"--":`${e.toFixed(2)} ${u?.precip??""}`.trim(),[u?.precip]);return(0,a.jsx)(h,{todayNormals:j,today:M,reportedConditions:b,monthlyAverages:A,locale:c,isLoading:!!t||N,isReportedPending:!!t||w,isMonthlyPending:!!t||T,error:d??S,formatTemperature:C,formatPrecip:D})},b=()=>{let{location:e,isLoading:r,error:n}=(0,t.useLocation)();return(0,a.jsx)(j,{location:e,initializing:r,initialError:n})};e.s(["AlmanacBlockClient",0,b,"default",0,b],146230)},499484,function(e){e.n(e.i(146230))}]);