1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72],{3022:(e,a,t)=>{Promise.resolve().then(t.bind(t,23507))},22130:(e,a,t)=>{"use strict";t.d(a,{BT:()=>d,Wu:()=>o,ZB:()=>l,Zp:()=>r,aR:()=>n,wL:()=>c});var s=t(95155);t(12115);var i=t(21567);function r(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,i.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function n(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,i.cn)("flex flex-col gap-1.5 px-6",a),...t})}function l(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,i.cn)("leading-none font-semibold",a),...t})}function d(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,i.cn)("text-muted-foreground text-sm",a),...t})}function o(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,i.cn)("px-6",a),...t})}function c(e){let{className:a,...t}=e;return(0,s.jsx)("div",{"data-slot":"card-footer",className:(0,i.cn)("flex items-center px-6",a),...t})}},23507:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>A});var s=t(95155),i=t(58581),r=t(94973),n=t(15255),l=t(12800),d=t(66963),o=t(27112),c=t(16161);function m(e){let{period:a,loading:t=!1,aqiData:m}=e,u=e=>{let t=new Date(e);return"hourly"===a?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"daily"===a?t.toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"}):t.toLocaleDateString([],{month:"short",day:"numeric"})},x=(e,a)=>0===e?"hour"===a?"Now":"Today":1===e?"1 ".concat(a," ago"):"".concat(e," ").concat(a,"s ago"),h=(()=>{if(!m)return[];switch(a){case"hourly":return[{aqi:m.aqi,timestamp:m.lastUpdated},...m.hourlyHistory||[]].slice(0,24).map((e,a)=>({time:e.timestamp?u(e.timestamp):x(23-a,"hour"),aqi:e.aqi})).reverse();case"daily":return[{aqi:m.aqi,timestamp:m.lastUpdated},...m.dailyHistory||[]].slice(0,7).map((e,a)=>({time:e.timestamp?u(e.timestamp):x(6-a,"day"),aqi:e.aqi})).reverse();case"weekly":return[{aqi:m.aqi,timestamp:m.lastUpdated},...m.weeklyHistory||[]].slice(0,4).map((e,a)=>({time:e.timestamp?u(e.timestamp):"Week ".concat(4-a),aqi:e.aqi})).reverse();default:return[]}})();return(0,s.jsx)("div",{className:"h-64 w-full ".concat(t?"opacity-50":""),children:(0,s.jsx)(i.u,{width:"100%",height:"100%",children:(0,s.jsxs)(r.b,{data:h,margin:{top:5,right:10,left:-20,bottom:5},children:[(0,s.jsx)(n.d,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),(0,s.jsx)(l.W,{dataKey:"time",tick:{fontSize:12},interval:2*("hourly"===a),angle:-45,textAnchor:"end",height:60}),(0,s.jsx)(d.h,{domain:[e=>Math.max(0,Math.floor(.8*e)),e=>Math.ceil(1.2*e)],tick:{fontSize:12}}),(0,s.jsx)(o.m,{contentStyle:{backgroundColor:"white",border:"1px solid #e2e8f0",borderRadius:"0.375rem",fontSize:"0.875rem"},formatter:e=>["AQI: ".concat(e),""]}),(0,s.jsx)(c.N,{type:"monotone",dataKey:"aqi",stroke:"#000000",strokeWidth:2,dot:{r:4},activeDot:{r:6}})]})})})}var u=t(36561),x=t(87162),h=t(94430),p=(0,u.gu)({chartName:"BarChart",GraphicalChild:x.y,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:l.W},{axisType:"yAxis",AxisComp:d.h}],formatAxisMap:h.pr});let f={pm25:25,pm10:50,no2:40,o3:100,so2:20,co:4};function j(e){let{aqiData:a,loading:t=!1}=e,r=a?[{name:"PM2.5",value:a.pm25||0,limit:f.pm25},{name:"PM10",value:a.pm10||0,limit:f.pm10},{name:"NO2",value:a.no2||0,limit:f.no2},{name:"O3",value:a.o3||0,limit:f.o3},{name:"SO2",value:a.so2||0,limit:f.so2},{name:"CO",value:a.co||0,limit:f.co}]:[];return(0,s.jsx)("div",{className:"h-64 w-full ".concat(t?"opacity-50":""),children:(0,s.jsx)(i.u,{width:"100%",height:"100%",children:(0,s.jsxs)(p,{data:r,margin:{top:20,right:10,left:-20,bottom:5},children:[(0,s.jsx)(n.d,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),(0,s.jsx)(l.W,{dataKey:"name",tick:{fontSize:12}}),(0,s.jsx)(d.h,{tick:{fontSize:12},domain:[0,e=>Math.ceil(1.2*e)]}),(0,s.jsx)(o.m,{contentStyle:{backgroundColor:"white",border:"1px solid #e2e8f0",borderRadius:"0.375rem",fontSize:"0.875rem"},formatter:(e,a,t)=>{let s=r.find(e=>e.name===t.payload.name),i=s?Math.round(s.value/s.limit*100):0;return["".concat(e," (").concat(i,"% of limit)"),t.payload.name]}}),(0,s.jsx)(x.y,{dataKey:"value",fill:"#000000"})]})})})}var y=t(73312),v=t(22130),g=t(86724),b=t(70050),N=t(36642),w=t(55736),k=t(87364),q=t(48617),C=t(48173),D=t.n(C),S=t(12115);function A(){let{session:e}=(0,b.w)(),[a,t]=(0,S.useState)("hourly"),[i,r]=(0,S.useState)(!1),[n,l]=(0,S.useState)(null),[d,o]=(0,S.useState)(null);return((0,S.useEffect)(()=>
1{if(!e)return;let a=()=>{(0,N.qE)(e=>l(e),e=>o(e),e=>r(e))};a();let t=setInterval(a,3e5);return()=>clearInterval(t)},[e]),e)?(0,s.jsx)("div",{className:"min-h-screen bg-white",children:(0,s.jsxs)("div",{className:"container mx-auto max-w-md p-4",children:[(0,s.jsxs)("header",{className:"mb-6 flex items-center",children:[(0,s.jsx)(D(),{href:"/dashboard",children:(0,s.jsx)(y.$,{variant:"ghost",size:"icon",className:"mr-2",children:(0,s.jsx)(k.A,{className:"h-5 w-5"})})}),(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"Detailed Air Quality"})]}),(0,s.jsxs)(v.Zp,{className:"mb-6 border-gray-200",children:[(0,s.jsx)(v.aR,{className:"pb-2",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(v.ZB,{children:(null==n?void 0:n.name)||"Loading..."}),(0,s.jsx)("div",{className:"text-sm text-gray-500",children:i?"Updating...":(0,s.jsxs)(s.Fragment,{children:["Updated"," ",d?new Date(d.lastUpdated).toLocaleTimeString():"..."]})})]})}),(0,s.jsxs)(v.Wu,{children:[(0,s.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-6xl font-bold ".concat(i?"opacity-50":""),children:d?d.aqi:"..."}),(0,s.jsx)("div",{className:"text-sm font-medium ".concat(i?"opacity-50":""),children:d?(0,w.m9)(d.aqi):"Loading..."})]}),(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3 ".concat(i?"opacity-50":""),children:[(0,s.jsx)("div",{className:"mb-1 text-sm font-medium",children:"Primary Pollutant"}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-xl font-bold",children:"PM2.5"}),(0,s.jsx)("span",{className:"text-sm text-gray-600",children:d?"".concat(d.pm25," \xb5g/m\xb3"):"..."})]})]})]}),(0,s.jsxs)("div",{className:"mb-4 grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Health Risk"}),(0,s.jsx)("div",{className:"font-medium",children:d?d.aqi>150?"High":d.aqi>100?"Moderate":"Low":"..."})]}),(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Visibility"}),(0,s.jsx)("div",{className:"font-medium",children:d?"".concat(d.visibility," km"):"..."})]}),(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Pressure"}),(0,s.jsx)("div",{className:"font-medium",children:d?"".concat(d.pressure," hPa"):"..."})]})]})]})]}),(0,s.jsxs)(v.Zp,{className:"mb-6 border-gray-200",children:[(0,s.jsx)(v.aR,{className:"pb-2",children:(0,s.jsx)(v.ZB,{children:"AQI Trend"})}),(0,s.jsx)(v.Wu,{children:(0,s.jsxs)(g.tU,{defaultValue:"hourly",className:"w-full",value:a,onValueChange:t,children:[(0,s.jsxs)(g.j7,{className:"mb-4 grid w-full grid-cols-3",children:[(0,s.jsx)(g.Xi,{value:"hourly",children:"Hourly"}),(0,s.jsx)(g.Xi,{value:"daily",children:"Daily"}),(0,s.jsx)(g.Xi,{value:"weekly",children:"Weekly"})]}),(0,s.jsx)(g.av,{value:"hourly",className:"mt-0",children:(0,s.jsx)(m,{period:"hourly",loading:i,aqiData:d})}),(0,s.jsx)(g.av,{value:"daily",className:"mt-0",children:(0,s.jsx)(m,{period:"daily",loading:i,aqiData:d})}),(0,s.jsx)(g.av,{value:"weekly",className:"mt-0",children:(0,s.jsx)(m,{period:"weekly",loading:i,aqiData:d})})]})})]}),(0,s.jsxs)(v.Zp,{className:"mb-6 border-gray-200",children:[(0,s.jsx)(v.aR,{className:"pb-2",children:(0,s.jsx)(v.ZB,{children:"Pollutant Breakdown"})}),(0,s.jsxs)(v.Wu,{children:[(0,s.jsxs)("div",{className:"mb-4 grid grid-cols-2 gap-3 ".concat(i?"opacity-50":""),children:[(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"PM2.5"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.pm25," \xb5g/m\xb3"):"..."})]}),(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"PM10"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.pm10," \xb5g/m\xb3"):"..."})]}),(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"NO2"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.no2," ppb"):"..."})]}),(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"O3"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.o3," ppb"):"..."})]}),(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"SO2"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.so2," ppb"):"..."})]}),(0,s.jsxs)("div",{className:"flex justify-between rounded-md border border-gray-100 p-2",children:[(0,s.jsx)("span",{children:"CO"}),(0,s.jsx)("span",{className:"font-medium",children:d?"".concat(d.co," ppm"):"..."})]})]}),(0,s.jsx)(j,{aqiData:d,loading:i}),(0,s.jsxs)("div",{className:"mt-4 rounded-md bg-gray-50 p-3",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center",children:[(0,s.jsx)(q.A,{className:"mr-2 h-4 w-4"}),(0,s.jsx)("span",{className:"font-medium",children:"What does this mean?"})]}),(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:["PM2.5 is the primary pollutant, with levels"," ",d?"".concat((d.pm25/25).toFixed(1),"x"):"..."," higher than WHO guidelines. These fine particles can penetrate deep into the lungs and bloodstream, causing respiratory and cardiovascular issues."]})]})]})]}),(0,s.jsxs)(v.Zp,{className:"mb-6 border-gray-200",children:[(0,s.jsx)(v.aR,{className:"pb-2",children:(0,s.jsx)(v.ZB,{children:"Health Impact"})}),(0,s.jsxs)(v.Wu,{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"font-medium",children:"General Population"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:d&&d.aqi>150?"Everyone may experience more serious health effects. Avoid outdoor activities.":d&&d.aqi>100?"Increased likelihood of respiratory symptoms in sensitive individuals. Everyone may begin to experience health effects.":"Air quality is acceptable. However, there may be a risk for some people, particularly those who are unusually sensitive to air pollution."})]}),(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"font-medium",children:"Sensitive Groups"}),(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:["People with respiratory or heart disease, the elderly and children should"," ",d&&d.aqi>150?"avoid":"limit"," prolonged outdoor exertion."]})]}),(0,s.jsxs)("div",{className:"rounded-md bg-gray-50 p-3",children:[(0,s.jsx)("div",{className:"font-medium",children:"Long-term Exposure"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Prolonged exposure may lead to increased rates of chronic bronchitis, reduced lung function and increased mortality from lung cancer and heart disease."})]})]})]})]})}):(0,s.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-white",children:(0,s.jsx)("p",{className:"text-lg font-medium text-gray-600",children:"Please log in to view air quality data."})})}},48617:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(67401).A)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},71616:(e,a,t)=>{"use strict";function s(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}t.d(a,{_:()=>s})},86724:(e,a,t)=>{"use strict";t.d(a,{tU:()=>A,av:()=>T,j7:()=>M,Xi:()=>P});var s=t(95155),i=t(12115),r=t(93610),n=t(18166),l=t(67357),d=t(17028),o=t(23360),c=t(4256),m=t(1488),u=t(67668),x="Tabs",[h,p]=(0,n.A)(x,[l.RG]),f=(0,l.RG)(),[j,y]=h(x),v=i.forwardRef((e,a)=>{let{__scopeTabs:t,value:i,onValueChange:r,defaultValue:n,orientation:l="horizontal",dir:d,activationMode:x="automatic",...h}=e,p=(0,c.jH)(d),[f,y]=(0,m.i)({prop:i,onChange:r,defaultProp:n});return(0,s.jsx)(j,{scope:t,baseId:(0,u.B)(),value:f,onValueChange:y,orientation:l,dir:p,activationMode:x,children:(0,s.jsx)(o.sG.div,{dir:p,"data-orientation":l,...h,ref:a})})});v.displayName=x;var g="TabsList",b=i.forwardRef((e,a)=>{let{__scopeTabs:t,loop:i=!0,...r}=e,n=y(g,t),d=f(t);return(0,s.jsx)(l.bL,{asChild:!0,...d,orientation:n.orientation,dir:n.dir,loop:i,children:(0,s.jsx)(o.sG.div,{role:"tablist","aria-orientation":n.orientation,...r,ref:a})})});b.displayName=g;var N="TabsTrigger",w=i.forwardRef((e,a)=>{let{__scopeTabs:t,value:i,disabled:n=!1,...d}=e,c=y(N,t),m=f(t),u=C(c.baseId,i),x=D(c.baseId,i),h=i===c.value;return(0,s.jsx)(l.q7,{asChild:!0,...m,focusable:!n,active:h,children:(0,s.jsx)(o.sG.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":x,"data-state":h?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:u,...d,ref:a,onMouseDown:(0,r.m)(e.onMouseDown,e=>{n||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(i)}),onKeyDown:(0,r.m)(e.onKeyDown,e=>
1{[" ","Enter"].includes(e.key)&&c.onValueChange(i)}),onFocus:(0,r.m)(e.onFocus,()=>{let e="manual"!==c.activationMode;h||n||!e||c.onValueChange(i)})})})});w.displayName=N;var k="TabsContent",q=i.forwardRef((e,a)=>{let{__scopeTabs:t,value:r,forceMount:n,children:l,...c}=e,m=y(k,t),u=C(m.baseId,r),x=D(m.baseId,r),h=r===m.value,p=i.useRef(h);return i.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,s.jsx)(d.C,{present:n||h,children:t=>{let{present:i}=t;return(0,s.jsx)(o.sG.div,{"data-state":h?"active":"inactive","data-orientation":m.orientation,role:"tabpanel","aria-labelledby":u,hidden:!i,id:x,tabIndex:0,...c,ref:a,style:{...e.style,animationDuration:p.current?"0s":void 0},children:i&&l})}})});function C(e,a){return"".concat(e,"-trigger-").concat(a)}function D(e,a){return"".concat(e,"-content-").concat(a)}q.displayName=k;var S=t(21567);function A(e){let{className:a,...t}=e;return(0,s.jsx)(v,{"data-slot":"tabs",className:(0,S.cn)("flex flex-col gap-2",a),...t})}function M(e){let{className:a,...t}=e;return(0,s.jsx)(b,{"data-slot":"tabs-list",className:(0,S.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",a),...t})}function P(e){let{className:a,...t}=e;return(0,s.jsx)(w,{"data-slot":"tabs-trigger",className:(0,S.cn)("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex items-center justify-center gap-2 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...t})}function T(e){let{className:a,...t}=e;return(0,s.jsx)(q,{"data-slot":"tabs-content",className:(0,S.cn)("flex-1 outline-none",a),...t})}}},e=>{var a=a=>e(e.s=a);e.O(0,[525,509,547,215,441,761,358],()=>a(3022)),_N_E=e.O()}]);
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.