"use strict";(self.webpackChunkhhgDiscoverV1=self.webpackChunkhhgDiscoverV1||[]).push([[873],{R8q8:function(e,t,n){n.d(t,{Qp:function(){return d},_e:function(){return m},en:function(){return s},gd:function(){return u}});var o=n("Kh6r"),a=n("ysjU"),r=n("TD78"),l=n("m+Kt"),i=n("NBFx"),c=n("fnO6");let s={[c.I.GOOD]:{color:"green",valueColorIndex:7,statusColorIndex:6,borderStartColorIndex:2,borderEndColorIndex:8,informationIcon:o.A},[c.I.MODERATE]:{color:"yellow",valueColorIndex:6,statusColorIndex:5,borderStartColorIndex:2,borderEndColorIndex:6,informationIcon:a.A},[c.I.UNHEALTHY_FOR_SENSITIVE]:{color:"yellow",valueColorIndex:9,statusColorIndex:9,borderStartColorIndex:5,borderEndColorIndex:9,informationIcon:r.A},[c.I.UNHEALTHY]:{color:"red",valueColorIndex:7,statusColorIndex:6,borderStartColorIndex:3,borderEndColorIndex:6,informationIcon:r.A},[c.I.VERY_UNHEALTHY]:{color:"violet",valueColorIndex:8,statusColorIndex:7,borderStartColorIndex:4,borderEndColorIndex:8,informationIcon:l.A},[c.I.HAZARDOUS]:{color:"redViolet",valueColorIndex:9,statusColorIndex:8,borderStartColorIndex:5,borderEndColorIndex:9,informationIcon:i.A}},d="currentLocation",u="airPopulation.getLocation",m={md:240,sm:200}},jWy7:function(e,t,n){n.d(t,{A:function(){return J}});var o=n("BGKE"),a=n("+OUp"),r=n("vH4S"),l=n("dDsW"),i=n("a5vB"),c=n("VNqU"),s=n("JOt+"),d=n("g0uo");let u=(0,d.MI)(e=>{var t,n;return void 0!==e&&e?{province:e.state||"",keyCategory:e.key_category,category:e.category,description:e.description,qualityMin:e.air_quality_min||null,qualityMax:e.air_quality_max||null,currentAqiusValue:(null==e?void 0:null===(t=e.pollution)||void 0===t?void 0:t.aqius)||null,updatedTime:(null==e?void 0:null===(n=e.pollution)||void 0===n?void 0:n.ts)||null}:null}),m=(0,d.MI)(e=>void 0!==e&&e?{title:e.title||"",description:e.description||"",disclaimer:e.disclaimer||"",featuredImage:e.featured_image||""}:null);var g=n("LSb+"),f=n("Wsmx"),h=n("fnO6");function checkValidDataApi(e){var t;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!!e&&"string"==typeof(null==e?void 0:e.state)&&(!!n||""!==e.state)&&"number"==typeof(null==e?void 0:null===(t=e.pollution)||void 0===t?void 0:t.aqius)}let p=(0,c.vt)((e,t)=>({loading:!1,error:null,currentData:null,cardInfo:null,listProvinces:null,currentLocation:null,setCurrentLocation(t){e({currentLocation:t})},fetchInitData:async()=>{let{loading:n,listProvinces:o}=t();if(!n&&!o){e({loading:!0,error:null});try{var a,r;let t=await (0,f.g)(!1),n=(null==t?void 0:t.location)||null,[o,l,i,c]=await Promise.all([(0,s.callApiNew)(g.PATHS.HEALTH_TOOL.GET_AIR_POPULATION_INFO),n?(0,s.callApiNew)(g.PATHS.HEALTH_TOOL.GET_AIR_POPULATION_SPECIFIC_PROVINCE,{params:{type:"geo",lat:n.latitude,lng:n.longitude}}):null,(0,s.callApiNew)(g.PATHS.HEALTH_TOOL.GET_AIR_POPULATION_DEFAULT),(0,s.callApiNew)(g.PATHS.HEALTH_TOOL.GET_AIR_POPULATION_PROVINCE),(0,f.g)(!1)]),d=null==l?void 0:l.data,h=null==i?void 0:i.data,p=checkValidDataApi(d,!0),v=checkValidDataApi(h),y=!!(null==o?void 0:o.data)&&!!(null==c?void 0:null===(a=c.data)||void 0===a?void 0:a.provinces)&&(p||v);if(y){let a=n&&p;e({currentLocation:a?t:null,cardInfo:m(null==o?void 0:o.data),currentData:u(a?d:v?h:null),listProvinces:(null==c?void 0:null===(r=c.data)||void 0===r?void 0:r.provinces)||[]})}else e({error:"General error"})}catch(t){e({error:t.message})}finally{e({loading:!1})}}},retryFetchInitData:async()=>{e({error:null}),await t().fetchInitData()}}));var v=(0,r.createStyles)((e,t)=>{let{backgroundColor:n}=t;return{root:{},inner:{position:"relative",minHeight:260,".error-screen":{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",backgroundColor:n},".chart-screen":{position:"relative",zIndex:0}},icon:{flexShrink:0},errorScreenRoot:{[e.fn.smallerThan("sm")]:{justifyContent:"space-evenly"}}}});let y=(0,a.createContext)({});var x=n("Wbba"),_=n("P+HS"),I=(0,r.createStyles)(e=>({root:{},info:{[e.fn.largerThan("sm")]:{alignItems:"flex-start"}},colLeft:{[e.fn.smallerThan("sm")]:{order:2,textAlign:"center"},[e.fn.largerThan("sm")]:{display:"flex",alignItems:"center"}},colRight:{display:"flex",justifyContent:"center",alignItems:"center"}})),D=n("R8q8"),b=(0,r.createStyles)((e,t)=>{let{size:n,backgroundColor:o}=t;return{root:{display:"flex",gap:24,backgroundColor:o,'button[data-variant="secondary"]':{borderColor:e.colors.gray[2]},[e.fn.smallerThan("sm")]:{gap:16,flexDirection:"column"}},colLeft:{[e.fn.largerThan("sm")]:{order:2}},colRight:{[e.fn.largerThan("sm")]:{width:D._e[n],flexShrink:0,order:1}},locator:{display:"flex",flexDirection:"column",gap:2}}});let Layout=e=>{let{colLeft:t,colRight:n,styles:l,classNames:i,className:c,...s}=e,{size:d,backgroundColor:u}=(0,a.useContext)(y),{classes:m,cx:g}=b({size:d,backgroundColor:u},{name:"AirPopulation__Layout",styles:l,classNames:i});return(0,o.FD)(r.Box,{...s,className:g(c,m.root),children:[(0,o.Y)(r.Box,{className:m.colLeft,children:t}),(0,o.Y)(r.Box,{className:m.colRight,children:n})]})},ErrorScreenGeneral=e=>{let{styles:t,classNames:n,...a}=e,{retryFetchInitData:c}=p(e=>({retryFetchInitData:e.retryFetchInitData}),i.x),{formatMessage:s}=(0,l.A)(),{classes:d}=I(void 0,{name:"AirPopulation__ErrorScreenGeneral",styles:t,classNames:n});return(0,o.Y)(Layout,{...a,classNames:{root:d.root,colLeft:d.colLeft,colRight:d.colRight},colLeft:(0,o.FD)(r.Stack,{spacing:16,className:d.info,children:[(0,o.Y)(_.Text,{size:"h3",children:s({id:"airPopulation.notFound.title",defaultMessage:"Opps!"})}),(0,o.Y)(_.Text,{size:"p2",variant:"secondary",children:s({id:"airPopulation.notFound.description",defaultMessage:"We couldn’t load the Air Pollution Tool right now. Please try again later or refresh the page."})}),(0,o.Y)(_.Button,{size:"lg",variant:"secondary",onClick:c,"data-event-category":"AQI","data-event-action":"retry AQI display","data-event-label":"click to retry",children:s({id:"airPopulation.retryButton.label"})})]}),colRight:(0,o.Y)("img",{loading:"lazy",alt:"Result not found",width:120,height:120,src:x.C.getAssetPath("airPopulation/not-found.svg")})})};var A=(0,r.createStyles)(e=>({root:{},info:{[e.fn.largerThan("sm")]:{alignItems:"flex-start"}},selector:{[e.fn.smallerThan("sm")]:{alignItems:"center"}},desc:{[e.fn.smallerThan("sm")]:{textAlign:"center"}},colLeft:{[e.fn.largerThan("sm")]:{display:"flex",alignItems:"center"}},colRight:{display:"flex",justifyContent:"center",alignItems:"center"}})),S=n("wo9K"),T=n("1Hbx"),C=n("IEKS"),N=n("ChHM"),w=n("a5L+"),Y=(0,r.createStyles)(e=>({root:{position:"relative"},locator:{},locatorValue:{position:"relative",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4,".loading-icon":{padding:8,svg:{width:16,height:16}}},selectTarget:{position:"absolute",left:0,bottom:0,right:0,[e.fn.smallerThan("sm")]:{left:"50%",right:"auto"}}})),E=n("VZtU"),L=n("fEsb"),P=n("69Ac"),k=(0,r.createStyles)(e=>({root:{display:"flex",flexDirection:"column",gap:8,background:"#fff",border:"1px solid ".concat(e.colors.gray[1]),padding:4,borderRadius:12,width:254,boxShadow:"0px 0px 1px 0px #0000000A, 0px 2px 8px 0px #0000000A, 0px 10px 16px 0px #0000000A",[e.fn.smallerThan("sm")]:{transform:"translateX(-50%)"}},input:{input:{paddingLeft:40}},inputWrapper:{position:"relative"},searchIcon:{position:"absolute",top:10,left:16},item:{padding:"".concat((0,r.rem)(8)," ").concat((0,r.rem)(12)),transition:"background .2s ease",cursor:"pointer",'&[data-is-current-loc="true"]':{position:"relative",marginBottom:16,"&:before":{position:"absolute",top:"calc(100% + 8px)",left:0,right:0,content:'""',borderBottom:"1px solid ".concat(e.colors.neutral[1])}},'&[data-selected="true"]':{cursor:"default"},'&[data-selected="true"],&:hover':{backgroundColor:e.colors.gray[1],borderRadius:8}}}));let Select=e=>{let{selectedItem:t,data:n=[],onClickItem:i,styles:c,classNames:s}=e,{formatMessage:d}=(0,l.A)(),{classes:u,theme:m}=k(void 0,{name:"AirPopulation__Select",styles:c,classNames:s}),[g,f]=(0,a.useState)(""),h=(0,a.useMemo)(()=>{let e=(0,P.fQ)(g),t=n.filter(t=>t.value===D.Qp||(0,P.fQ)(t.label).includes((0,P.fQ)(e)));return t.length>0?t:n},[g]);return(0,o.FD)(r.Box,{className:u.root,children:[(0,o.FD)(r.Box,{className:u.inputWrapper,children:[(0,o.Y)(_.Input,{className:u.input,value:g,onChange:f,placeholder:d({id:"airPopulation.locationSelector.placeholder",defaultMessage:"Search for city"}),"data-event-category":"AQI","data-event-action":"search AQI location","data-event-label":g}),(0,o.Y)(E.A,{size:20,color:m.colors.gray[3],className:u.searchIcon})]}),(0,o.Y)(r.ScrollArea.Autosize,{mah:320,type:"auto",scrollbarSize:6,children:h.map((e,n)=>{let a=t===e.label;return(0,o.FD)(r.Flex,{"data-is-current-loc":e.isUseCurrentLocation,"data-selected":a,className:u.item,align:"center",gap:8,onClick:()=>!a&&i(e.value),"data-event-category":"AQI","data-event-action":"choose AQI location","data-event-label":e.label,children:[e.isUseCurrentLocation?(0,o.Y)(C.A,{}):(0,o.Y)(L.A,{}),(0,o.Y)(_.Text,{size:"p2",children:e.label})]},String(n))})})]})},LocationSelector=e=>{let{styles:t,classNames:n}=e,{formatMessage:c}=(0,l.A)(),{data:s,selectedValue:d,setSelectedValue:u,loading:m,firstLoading:g,selectorZIndex:f,onChangeValue:h}=(0,a.useContext)(y),{listProvinces:v}=p(e=>({listProvinces:e.listProvinces||[]}),i.x),x=(0,a.useMemo)(()=>[{label:c({id:D.gd}),value:D.Qp,isUseCurrentLocation:!0,icon:C.A},...(v||[]).map(e=>({label:e,value:e}))],[v]),[I,b]=(0,a.useState)(!1),[A,E]=(0,a.useState)(),L=(0,N.L)(()=>b(!1)),{classes:P}=Y(void 0,{name:"AirPopulation__LocationSelector",styles:t,classNames:n}),k=(0,a.useRef)(null),R=(0,w.a)();return(0,a.useEffect)(()=>{if(k.current){let e=k.current.getBoundingClientRect();E({top:e.bottom+window.scrollY,left:e.left+window.scrollX,width:e.width})}},[g]),(0,a.useEffect)(()=>{if(s&&k.current){let e=k.current.getBoundingClientRect();E({top:e.bottom+window.scrollY,left:e.left+window.scrollX,width:e.width})}},[s]),(0,a.useEffect)(()=>{b(!1)},[R]),(0,o.Y)(r.Box,{className:P.root,children:g?(0,o.Y)(r.Skeleton,{height:24,radius:4,width:140}):(0,o.FD)(r.Box,{className:P.locator,children:[(0,o.FD)(r.Box,{className:P.locatorValue,onClick:()=>{if(!m){if(k.current){let e=k.current.getBoundingClientRect();E({top:e.bottom+window.scrollY,left:e.left+window.scrollX,width:e.width})}b(!0)}},children:[(0,o.Y)(_.Text,{size:"h3",variant:"secondary",children:d===D.Qp?c({id:D.gd}):d}),m?(0,o.Y)(S.L,{hideText:!0,className:"loading-icon"}):(0,o.Y)(T.A,{size:22,color:"#111111",style:{transform:"rotate(".concat(I?"180deg":0,")")}})]}),(0,o.Y)(r.Box,{"data-target":!0,className:P.selectTarget,ref:k}),(0,o.Y)(r.Portal,{children:(0,o.Y)(r.Transition,{mounted:!!(I&&A),transition:"fade",children:e=>(0,o.Y)(r.Box,{ref:L,sx:{position:"absolute",top:null==A?void 0:A.top,left:null==A?void 0:A.left,width:null==A?void 0:A.width,borderRadius:8,zIndex:f,...e},children:(0,o.Y)(Select,{selectedItem:d||"",data:x,onClickItem:e=>{var t,n;u(null===(n=x.filter(t=>t.value===e))||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.label),b(!1),null==h||h(e)}})})})})]})})},ErrorScreenNotFoundResult=e=>{let{styles:t,classNames:n,message:a,...i}=e,{formatMessage:c}=(0,l.A)(),{classes:s}=A(void 0,{name:"AirPopulation__ErrorScreenNotFoundResult",styles:t,classNames:n});return(0,o.Y)(Layout,{...i,classNames:{root:s.root,colLeft:s.colLeft,colRight:s.colRight},colLeft:(0,o.FD)(r.Stack,{spacing:16,className:s.info,children:[(0,o.FD)(r.Stack,{spacing:2,className:s.selector,children:[(0,o.Y)(LocationSelector,{}),(0,o.Y)(_.Text,{size:"p3",variant:"error",children:c({id:"airPopulation.notFoundResult.error",defaultMessage:"Please reselect location"})})]}),(0,o.Y)(_.Text,{size:"p2",variant:"secondary",className:s.desc,children:a||c({id:"airPopulation.notFoundResult.description",defaultMessage:"Looks like there was an issue with your selected location. Try selecting it again!"})})]}),colRight:(0,o.Y)("img",{loading:"lazy",alt:"Result not found",width:120,height:120,src:x.C.getAssetPath("airPopulation/result-not-found.svg")})})};var R=(0,r.createStyles)(e=>({info:{display:"flex",flexDirection:"column",gap:16,[e.fn.largerThan("sm")]:{position:"absolute",top:"20%",left:0,bottom:0}},locator:{display:"flex",flexDirection:"column",gap:2,[e.fn.smallerThan("sm")]:{alignItems:"stretch",textAlign:"center"}},colLeft:{position:"relative",[e.fn.smallerThan("sm")]:{zIndex:2},[e.fn.largerThan("sm")]:{width:"100%"}},colRight:{paddingBottom:20,[e.fn.largerThan("sm")]:{}},infoColLeft:{[e.fn.smallerThan("sm")]:{display:"none"}},infoColRight:{[e.fn.largerThan("sm")]:{display:"none"}},chart:{display:"flex",flexDirection:"column",gap:24,[e.fn.smallerThan("sm")]:{alignItems:"center",gap:32}}}));let F=(0,r.keyframes)({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}});var O=(0,r.createStyles)((e,t)=>{var n,o,a,l,i;let{color:c,borderStartColorIndex:s,borderEndColorIndex:d,statusColorIndex:u,valueColorIndex:m,endCircleAngle:g,gapAngleLeft:f,circleAngle:h,firstLoading:p,size:v,borderOutsideColor:y,backgroundChartColor:x}=t,I=null===(n=e.colors[c])||void 0===n?void 0:n[s],b=null===(o=e.colors[c])||void 0===o?void 0:o[d],A=null===(a=e.colors[c])||void 0===a?void 0:a[u],S=null===(l=e.colors[c])||void 0===l?void 0:l[m],T={display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%"},C=D._e[v];return{root:{position:"relative",borderRadius:"50%",width:C,height:C,backgroundColor:y,...p&&{overflow:"hidden"}},border:{...T,width:C,height:"".concat(C,"px"),position:"relative",background:"conic-gradient(\n from 180deg,\n ".concat(x," 0deg ").concat(f,"deg,\n ").concat(y," ").concat(f,"deg,\n ").concat(y," ").concat(g,"deg,\n ").concat(x," ").concat(g,"deg ").concat(h,"deg\n )"),"&:before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,inset:0,borderRadius:"inherit",background:"conic-gradient(\n from 180deg,\n transparent 0deg ".concat(f,"deg,\n ").concat(I," ").concat(f,"deg,\n ").concat(b," var(--deg),\n transparent var(--deg) ").concat(g,"deg,\n transparent ").concat(g,"deg ").concat(h,"deg\n )"),...p&&{animation:"".concat(F," 2s linear infinite"),opacity:.5}}},borderWhite:{...T,width:C-6,height:C-6,backgroundColor:"#fff",zIndex:1},background:{...T,width:"100%",height:"100%",position:"relative","&:before":{content:'""',position:"absolute",top:6,left:6,width:C-18,height:C-18,background:p?e.colors.neutral[0]:null===(i=e.colors[c])||void 0===i?void 0:i[0],opacity:.5,borderRadius:"inherit"}},mainCircle:{...T,position:"relative",flexDirection:"column",width:C-68,height:C-68,backgroundColor:"#fff",boxShadow:"5px 7px 20px ".concat(S,"1F,\n 21px 30px 37px ").concat(S,"1A,\n 48px 67px 50px ").concat(S,"0F"),transition:"all .3s ease",...p&&{boxShadow:"5px 6px 8px ".concat(e.colors.gray[7],"1F,\n 8px 9px 10px ").concat(e.colors.gray[7],"1A,\n 10px 12px 14px ").concat(e.colors.gray[7],"0F")}},label:{},value:{fontSize:(0,r.rem)("sm"===v?56:64),lineHeight:(0,r.rem)(64),fontWeight:"sm"===v?_.FontWeight.halfBold:_.FontWeight.semiBold,color:S,marginTop:-10},status:{lineHeight:"".concat((0,r.rem)(20)," !important"),color:"#fff"},tagArea:{position:"absolute",top:"calc(100% - 26px)",left:0,right:0,zIndex:1,display:"flex",justifyContent:"center",textAlign:"center"},tag:{backgroundColor:A,borderRadius:20,padding:"".concat((0,r.rem)("sm"===v?3:4)," ").concat((0,r.rem)(16)," ").concat((0,r.rem)("sm"===v?5:4)),minHeight:"sm"===v?28:32,display:"flex",alignItems:"center",justifyContent:"center",transition:"all .3s ease",opacity:p?0:1}}});n("vHLl");let B=(0,a.memo)(e=>{let{data:t}=(0,a.useContext)(y),{currentAqiusValue:l=0}=t||{},i=(0,a.useRef)(null),c=(0,a.useRef)(null),[s,d]=(0,a.useState)(null),u=(0,a.useRef)(0);return(0,a.useEffect)(()=>{n.e(6975).then(n.t.bind(n,"qTOg",23)).then(e=>{let{default:t}=e;d(()=>t)})},[]),(0,a.useEffect)(()=>{if(!s||!i.current)return;i.current.innerHTML="";let e=document.createElement("span");e.textContent=String(Math.round(Number(l))||0),i.current.appendChild(e);let t=new s({el:e,value:Math.round(Number(l))||0,theme:"default",format:"(,ddd)"});c.current=t,u.current=Math.round(Number(l))||0,setTimeout(()=>t.update(u.current),100)},[s]),(0,a.useEffect)(()=>{if(!c.current)return;let e=Math.round(Number(l))||0,t=u.current;if(u.current=e,e===t)return;let n=Math.abs(e-t),o=Math.max(200,Math.min(30*n,300)),a=document.querySelectorAll(".odometer-ribbon-inner");a.forEach(e=>{e.setAttribute("style","transition-duration: ".concat(o,"ms !important; transition-timing-function: cubic-bezier(0.4,0,0.2,1) !important;"))}),c.current.update(e)},[l]),(0,o.Y)(r.Box,{...e,ref:i,sx:{overflow:"hidden"}})}),H=(0,a.memo)(e=>{let{styles:t,classNames:n}=e,{data:l,firstLoading:i,size:c,borderOutsideColor:s,backgroundChartColor:d}=(0,a.useContext)(y),{color:u="gray",valueColorIndex:m=7,statusColorIndex:g=6,borderEndColorIndex:f=7,borderStartColorIndex:h=3,category:p,currentAqiusValue:v=0}=l||{},x=(0,a.useMemo)(()=>{let e=Math.min((v||0)/500*270,270),t=i?120:e+45;return{gapAngleLeft:45,selectedDeg:t,endCircleAngle:315,circleAngle:360}},[v,i]),{classes:I,cx:D}=O({color:i?"neutral":u,borderEndColorIndex:f,borderStartColorIndex:h,statusColorIndex:g,valueColorIndex:m,firstLoading:i,size:c,borderOutsideColor:s,backgroundChartColor:d,...x},{name:"AirPopulation__Chart",styles:t,classNames:n}),[b,A]=(0,a.useState)(x.selectedDeg),S=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=x.selectedDeg,t=e-b,n=performance.now(),animate=e=>{let o=Math.min((e-n)/200,1);A(b+t*(1-Math.pow(1-o,3))),o<1&&(S.current=requestAnimationFrame(animate))};return cancelAnimationFrame(S.current),S.current=requestAnimationFrame(animate),()=>cancelAnimationFrame(S.current)},[x.selectedDeg]),(0,o.FD)(r.Box,{className:D(I.root,"chart-root"),style:{"--deg":"".concat(b,"deg")},children:[(0,o.Y)(r.Box,{className:D(I.border,"chart-border"),children:(0,o.Y)(r.Box,{className:D(I.borderWhite,"chart-border-white"),children:(0,o.Y)(r.Box,{className:D(I.background,"chart-background"),children:(0,o.Y)(r.Box,{className:I.mainCircle,children:!i&&(0,o.FD)(o.FK,{children:[(0,o.Y)(_.Text,{size:"title2",variant:"tertiary",className:D(I.label,"chart-label"),children:"AQI"}),(0,o.Y)(B,{className:I.value},"main-value")]})})})})}),(0,o.Y)("div",{className:I.tagArea,children:(0,o.Y)("div",{className:I.tag,children:(0,o.Y)(_.Text,{size:"sm"===c?"p3":"title2",className:I.status,weight:"semiBold",color:"#fff",children:p})})})]})}),Information=e=>{var t;let n=(0,r.useMantineTheme)(),{firstLoading:l,data:i}=(0,a.useContext)(y),{color:c="gray",description:s,informationIcon:d,valueColorIndex:u=7}=i||{},m="function"==typeof d?d:null;return l?(0,o.FD)(r.Stack,{spacing:8,...e,children:[(0,o.Y)(r.Skeleton,{height:16,radius:4,width:200}),(0,o.Y)(r.Skeleton,{height:16,radius:4,width:200}),(0,o.Y)(r.Skeleton,{height:16,radius:4,width:130})]}):s?(0,o.FD)(r.Box,{sx:{position:"relative",".info-label":{"&:before":{content:'""',display:"inline-block",width:20}},".info-icon":{position:"absolute",top:2,left:0}},...e,children:[m&&(0,o.Y)(m,{size:16,color:null===(t=n.colors[c])||void 0===t?void 0:t[u],className:"info-icon"}),(0,o.Y)(_.Text,{size:"p3",className:"info-label",children:s})]}):null};var M=n("8BcA"),U=n.n(M);let TimeStatus=()=>{let{firstLoading:e,data:t}=(0,a.useContext)(y),{updatedTime:n}=t||{},{formatMessage:i}=(0,l.A)();return e?(0,o.Y)(r.Skeleton,{sx:{marginTop:6},height:12,radius:4,width:120}):(0,o.Y)(_.Text,{size:"p3",variant:"tertiary",children:i({id:"airPopulation.timeUpdate",defaultMessage:"{time} Update every {from} - {to}h"},{time:U()(n).format("HH:mm"),from:1,to:2})})},Form=e=>{let{styles:t,classNames:n,className:a,...l}=e,{classes:i}=R(void 0,{name:"AirPopulation__Form",styles:t,classNames:n});return(0,o.Y)(Layout,{...l,classNames:{colLeft:i.colLeft,colRight:i.colRight},colLeft:(0,o.FD)(r.Box,{className:i.info,children:[(0,o.FD)(r.Box,{className:i.locator,children:[(0,o.Y)(LocationSelector,{}),(0,o.Y)(TimeStatus,{})]}),(0,o.Y)(r.Box,{className:i.infoColLeft,children:(0,o.Y)(Information,{})})]}),colRight:(0,o.FD)(r.Box,{className:i.chart,children:[(0,o.Y)(H,{}),(0,o.Y)(r.Box,{className:i.infoColRight,children:(0,o.Y)(Information,{})})]})})},z={in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30%)"},transitionProperty:"transform, opacity"},Body=e=>{let{className:t,styles:n,classNames:c,...s}=e,{notShareLocationErr:d,notLoadResultError:u,backgroundColor:m,size:g}=(0,a.useContext)(y),{formatMessage:f}=(0,l.A)(),{classes:h,cx:x}=v({size:g,backgroundColor:m},{name:"AirPopulation__Body",styles:n,classNames:c}),{errorInitLoad:_}=p(e=>({errorInitLoad:e.error}),i.x),I="string"==typeof _,D="string"==typeof u;return(0,o.Y)(r.Box,{...s,className:x(h.root,t,"air-population-body"),children:(0,o.FD)(r.Box,{className:h.inner,children:[(0,o.Y)(r.Transition,{keepMounted:!0,mounted:!I&&!D,transition:z,children:e=>(0,o.Y)(r.Box,{className:"chart-screen",style:e,children:(0,o.Y)(Form,{})})}),(0,o.Y)(r.Transition,{mounted:I,keepMounted:!0,transition:z,children:e=>(0,o.Y)(r.Box,{style:e,className:"error-screen",children:(0,o.Y)(ErrorScreenGeneral,{classNames:{root:h.errorScreenRoot}})})}),(0,o.Y)(r.Transition,{mounted:D||d,transition:z,children:e=>(0,o.Y)(r.Box,{style:e,className:"error-screen",children:(0,o.Y)(ErrorScreenNotFoundResult,{classNames:{root:h.errorScreenRoot},message:d?f({id:"airPopulation.notShareLocation.error",defaultMessage:"Cannot find your location. Please try again."}):""})})})]})})};var V=n("TD78"),K=(0,r.createStyles)(e=>({root:{backgroundColor:e.colors.neutral[0],padding:12},icon:{flexShrink:0}})),icons_AirPopulation=e=>{let{size:t=40,color:n="#595959",...a}=e;return(0,o.FD)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a,children:[(0,o.Y)("path",{d:"M21 17.96a4.01 4.01 0 0 0 2-3.46c0-2.2-1.8-4-4-4-.3-3.9-3.5-7-7.5-7S4.2 6.7 4 10.6c-1.7.4-3 2-3 3.9 0 1.473.807 2.766 2 3.46M11.5 6v0M15 7.3h0m-7 0h0m8.5 3.2h0m-10 0h0m4.8.5 2-2",stroke:n,"stroke-width":"1.25","stroke-miterlimit":"10","stroke-linecap":"round"}),(0,o.Y)("path",{d:"M11.254 11.5a.421.421 0 1 0 0-.842.421.421 0 0 0 0 .842Z",fill:n,stroke:n,"stroke-width":"1.25","stroke-miterlimit":"10","stroke-linecap":"round"}),(0,o.Y)("path",{d:"m4.8 20.5.75-1.5m4.25 1.5L9.05 19m-3.5 0 1.526-3.053a.25.25 0 0 1 .447 0L9.05 19m-3.5 0h3.5m6.05 1a2.5 2.5 0 1 0-3-4 2.5 2.5 0 0 0 3 4Zm0 0 1 1m2.2-5.5v5",stroke:n,"stroke-width":"1.25","stroke-linecap":"round"})]})},W=(0,r.createStyles)(()=>({root:{position:"relative",cursor:"pointer",height:40,width:40},item:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",position:"absolute",top:0,left:0,right:0,bottom:0}})),G=(0,r.createStyles)(e=>({root:{},body:{padding:16,[e.fn.largerThan("sm")]:{padding:"".concat((0,r.rem)(24)," ").concat((0,r.rem)(24)," ").concat((0,r.rem)(24)," ").concat((0,r.rem)(48))}},modalBody:{padding:0},disclaimer:{justifyContent:"center"}}));let ModalDetail=e=>{let{className:t,...n}=e,{classes:a}=G(void 0,{name:"AirPopulation__ModalDetail"});return(0,o.Y)(J,{selectorZIndex:500,children:e=>{var t;return(0,o.FD)(_.Modal,{...n,title:null==e?void 0:null===(t=e.cardInfo)||void 0===t?void 0:t.title,size:600,classNames:{body:a.modalBody},zIndex:500,children:[(0,o.Y)(Body,{className:a.body}),(0,o.Y)(J.Disclaimer,{className:a.disclaimer})]})}})};var j=n("iBNF"),icons_WarningCircle=e=>{let{size:t=24,color:n=j.w.colors.yellow600,...a}=e;return(0,o.FD)("svg",{width:t,height:t,viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a,children:[(0,o.Y)("g",{"clip-path":"url(#a)",children:(0,o.Y)("path",{d:"M4 .444A3.56 3.56 0 0 0 .444 4 3.56 3.56 0 0 0 4 7.555 3.56 3.56 0 0 0 7.555 4 3.56 3.56 0 0 0 4 .444m-.333 1.97a.333.333 0 0 1 .666 0v1.808a.333.333 0 0 1-.666 0zM4 5.963a.445.445 0 1 1 0-.89.445.445 0 0 1 0 .89",fill:n})}),(0,o.Y)("defs",{children:(0,o.Y)("clipPath",{id:"a",children:(0,o.Y)("path",{fill:"#fff",d:"M0 0h8v8H0z"})})})]})};let q=(0,r.keyframes)({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}});var Q=(0,r.createStyles)((e,t)=>{var n,o,a,l;let{color:i,borderStartColorIndex:c,borderEndColorIndex:s,valueColorIndex:d,endCircleAngle:u,gapAngleLeft:m,circleAngle:g,firstLoading:f,selectedDeg:h,size:p}=t,v=null===(n=e.colors[i])||void 0===n?void 0:n[c],y=null===(o=e.colors[i])||void 0===o?void 0:o[s],x=null===(a=e.colors[i])||void 0===a?void 0:a[d],I={display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%"},D="md"===p?40:32,b="md"===p?40:32;return{root:{position:"relative",borderRadius:"50%",width:D,height:b,".warning-icon":{position:"absolute",top:0,left:"95%",zIndex:1}},border:{...I,width:D,height:D,position:"relative",background:null===(l=e.colors[i])||void 0===l?void 0:l[0],"&:before":{transform:"rotate(135deg)",content:'""',position:"absolute",inset:0,borderRadius:"inherit",background:"conic-gradient(\n from 180deg,\n transparent 0deg ".concat(m,"deg,\n ").concat(v," ").concat(m,"deg,\n ").concat(y," ").concat(h,"deg,\n transparent ").concat(h,"deg ").concat(u,"deg,\n transparent ").concat(u,"deg ").concat(g,"deg\n )"),...f&&{animation:"".concat(q," 2s linear infinite"),opacity:.5}}},borderWhite:{...I,flexDirection:"column",justifyContent:"center",width:D-4,height:D-4,backgroundColor:e.colors.neutral[0],zIndex:1},label:{fontSize:(0,r.rem)("md"===p?8:6),lineHeight:(0,r.rem)("md"===p?12:10)},value:{fontSize:(0,r.rem)("md"===p?15:13),lineHeight:(0,r.rem)("md"===p?15:13),fontWeight:"md"===p?_.FontWeight.semiBold:_.FontWeight.halfBold,color:x}}});let X=(0,a.memo)(e=>{let{size:t,styles:n,classNames:l}=e,{data:i,firstLoading:c,size:s}=(0,a.useContext)(y),{color:d="gray",valueColorIndex:u=7,borderEndColorIndex:m=7,borderStartColorIndex:g=3,currentAqiusValue:f=0,keyCategory:p}=i||{},v=(0,a.useMemo)(()=>{let e=Math.min((f||0)/500*270,270),t=c?120:e+45;return{gapAngleLeft:45,selectedDeg:t,endCircleAngle:315,circleAngle:360}},[f,c]),{classes:x,cx:I}=Q({color:c?"neutral":d,borderEndColorIndex:m,borderStartColorIndex:g,valueColorIndex:u,firstLoading:c,size:t||s,...v,selectedDeg:v.selectedDeg},{name:"AirPopulation__SimpleChart",styles:n,classNames:l});return(0,o.FD)(r.Box,{className:x.root,children:[(0,o.Y)(r.Box,{className:x.border,children:(0,o.Y)(r.Box,{className:x.borderWhite,children:!c&&(0,o.FD)(o.FK,{children:[(0,o.Y)(_.Text,{size:"title2",variant:"secondary",className:I(x.label,"chart-label"),children:"AQI"}),(0,o.Y)(r.Box,{className:x.value,children:f})]})})}),p===h.I.HAZARDOUS&&(0,o.Y)(icons_WarningCircle,{className:"warning-icon",color:"red",size:12})]})}),Z={in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(50%)"},transitionProperty:"transform, opacity"};var J=Object.assign(e=>{let{children:t,size:n="md",borderOutsideColor:c,backgroundChartColor:d,backgroundColor:m="#fff",selectorZIndex:v}=e,{formatMessage:I}=(0,l.A)(),{cardInfo:b,currentLocation:A,setCurrentLocation:S,listProvinces:T,currentData:C,fetchInitData:N}=p(e=>({cardInfo:e.cardInfo,listProvinces:e.listProvinces,currentData:e.currentData,currentLocation:e.currentLocation,fetchInitData:e.fetchInitData,setCurrentLocation:e.setCurrentLocation}),i.x),[w,Y]=(0,a.useState)(null),[E,L]=(0,a.useState)(null),[P,k]=(0,a.useState)(!0),[R,F]=(0,a.useState)(!1),[O,B]=(0,a.useState)(null),[H,M]=(0,a.useState)(!1),U=(0,r.useMantineTheme)(),z=(0,a.useCallback)(async()=>{try{if(F(!0),null==A?void 0:A.location)handleFetchResult({type:"geo",lat:String(A.location.latitude),lng:String(A.location.longitude)});else{let e=await (0,f.g)();(null==e?void 0:e.location)?(handleFetchResult({type:"geo",lat:String(e.location.latitude),lng:String(e.location.longitude)}),S(e)):(S(e),M(!0))}}catch(e){}finally{F(!1)}},[]),handleFetchResult=async e=>{try{var t;F(!0);let n=await (0,s.callApiNew)(g.PATHS.HEALTH_TOOL.GET_AIR_POPULATION_SPECIFIC_PROVINCE,{params:e}),o=u(null==n?void 0:n.data),a=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!!e&&"string"==typeof(null==e?void 0:e.province)&&(!!t||""!==e.province)&&"number"==typeof(null==e?void 0:e.currentAqiusValue)}(o,"geo"===e.type);if(a&&(null==o?void 0:o.keyCategory)&&(t=o.keyCategory,Object.values(h.I).includes(t))){let e=D.en[null==o?void 0:o.keyCategory];L({...e,...o}),B(null)}else B("")}catch(e){B("")}finally{F(!1),M(!1)}};return(0,a.useEffect)(()=>{N()},[N]),(0,a.useEffect)(()=>{(null==T?void 0:T.length)&&"number"==typeof(null==C?void 0:C.currentAqiusValue)&&k(!1)},[T,C]),(0,a.useEffect)(()=>{if(!C)return;let e=D.en[null==C?void 0:C.keyCategory];L({...e,...C}),Y(A?I({id:D.gd}):null==C?void 0:C.province)},[C]),(0,o.Y)(_.TemplateProvider,{variant:_.CustomStylesType.LEADGEN,children:(0,o.Y)(y.Provider,{value:{notShareLocationErr:H,notLoadResultError:O,data:E,setData:L,loading:R,firstLoading:P,heading:"Air polulation",disclaimer:"Information is for reference only and not a substitute for medical advice.",avatar:x.C.getAssetPath("tiki/maskcot.png"),size:n,borderOutsideColor:c||U.colors.neutral[0],backgroundChartColor:d||"#fff",backgroundColor:m,selectorZIndex:v,selectedValue:w,setSelectedValue:Y,onChangeValue:e=>{e===D.Qp?z():handleFetchResult({type:"state",name:e})},handleClickCurrentLocation:z},children:"function"==typeof t?t({cardInfo:b,result:E}):t||(0,o.Y)(Body,{})})})},{Disclaimer:e=>{let{className:t,...n}=e,{classes:a,theme:l,cx:c}=K(void 0,{name:"AirPopulation__Disclaimer"}),{disclaimer:s}=p(e=>{var t;return{disclaimer:null===(t=e.cardInfo)||void 0===t?void 0:t.disclaimer}},i.x);return s?(0,o.FD)(r.Flex,{gap:4,...n,className:c(t,a.root),children:[(0,o.Y)(V.A,{size:16,color:l.colors.yellow[8],className:a.icon}),(0,o.Y)(_.Text,{size:"c1",children:s})]}):null},Heading:()=>{let{heading:e}=(0,a.useContext)(y);return e?(0,o.Y)(_.Text,{size:"h3",children:e}):null},Body:Body,Chart:H,IconChart:e=>{let{dataTracking:t,className:n,...l}=e,{firstLoading:i,size:c}=(0,a.useContext)(y),[s,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),{classes:h,cx:p}=W(void 0,{name:"AirPopulation__IconChart"});return(0,a.useEffect)(()=>{i||(m(e=>!e),d(!0))},[i]),(0,a.useEffect)(()=>{if(!s)return;let e=setInterval(()=>{m(e=>!e)},4e3);return()=>clearInterval(e)},[s]),(0,o.FD)(o.FK,{children:[(0,o.FD)(r.Box,{...l,className:p(h.root,n),onClick:()=>f(!0),"data-event-category":null==t?void 0:t.dataEventCategory,"data-event-action":null==t?void 0:t.dataEventAction,"data-event-label":null==t?void 0:t.dataEventLabel,children:[(0,o.Y)(r.Box,{className:h.item,children:(0,o.Y)(r.Transition,{mounted:!u,transition:Z,duration:400,timingFunction:"ease",children:e=>(0,o.Y)(r.Box,{style:e,children:(0,o.Y)(r.Indicator,{inline:!0,processing:!0,color:"green",size:8,sx:{marginTop:3},children:(0,o.Y)(icons_AirPopulation,{size:"md"===c?32:24})})})})}),(0,o.Y)(r.Box,{className:h.item,children:(0,o.Y)(r.Transition,{mounted:u,transition:Z,duration:400,timingFunction:"ease",children:e=>(0,o.Y)(r.Box,{style:e,children:(0,o.Y)(X,{size:c})})})})]}),(0,o.Y)(ModalDetail,{opened:g,onClose:()=>f(!1)})]})}})},OWsn:function(e,t,n){n.d(t,{A$:function(){return getDueDateIUI},Eo:function(){return getDueDateLastPeriod},Ui:function(){return g},Xj:function(){return f},_L:function(){return getDueDateIVF},by:function(){return h},ix:function(){return getDueDateUltrasound},lC:function(){return getDueDateConception},z3:function(){return r},z5:function(){return DateToInputValue}});var o,a,r,l,i=n("8BcA"),c=n.n(i),s=n("VNqU"),d=n("JOt+"),u=n("LSb+"),m=n("9brV");let g="duedateInfo";(o=r||(r={}))[o.lastPeriod=0]="lastPeriod",o[o.conception=1]="conception",o[o.IVF=2]="IVF",o[o.IUI=3]="IUI",o[o.ultrasound=4]="ultrasound",(a=l||(l={})).lastPeriod="lmp",a.conception="cd",a.IVF="ivf",a.IUI="iui",a.ultrasound="us";let f={[String(0)]:{value:String(0),imageSrc:"".concat(m.nS,"/due-date-last-period-icon-revamp.png"),label:"dueDatePage.lastPeriod"},[String(2)]:{value:String(2),imageSrc:"".concat(m.nS,"/due-date-ivf-icon.png"),label:"dueDatePage.ivf"},[String(1)]:{value:String(1),imageSrc:"".concat(m.nS,"/due-date-conception-date-icon.png"),label:"dueDatePage.conceptionDate"},[String(3)]:{value:String(3),imageSrc:"".concat(m.nS,"/due-date-iui-icon.png"),label:"dueDatePage.IUI"},[String(4)]:{value:String(4),imageSrc:"".concat(m.nS,"/due-date-ultrasound-icon.png"),label:"dueDatePage.ultrasound"}},getDueDateLastPeriod=async(e,t)=>{let n=Number(t),o=["method=lmp","circle_length=".concat(n),"date=".concat(c()(e).format(m.K_))].join("&"),a="".concat(u.PATHS.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(o),r={method:1,first_day:c()(e).format(m.a7),cycle_length_days:n,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var l,i;let{data:e}=await (0,d.callApiNew)(a);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(i=e.gestational_week)||void 0===i?void 0:null===(l=i[1])||void 0===l?void 0:l.from))return{startDate:null,dueDate:null,otherInfo:r};return{startDate:c()(e.gestational_week[1].from,m.K_).toDate(),dueDate:c()(e.due_date,m.K_).toDate(),otherInfo:r}}catch(e){return{startDate:null,dueDate:null,otherInfo:r}}},getDueDateIUI=async e=>{let t=["method=iui","date=".concat(c()(e).format(m.K_))].join("&"),n="".concat(u.PATHS.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(t),o={method:4,insemination_date:c()(e).format(m.a7),cycle_length_days:null,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var a,r;let{data:e}=await (0,d.callApiNew)(n);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(r=e.gestational_week)||void 0===r?void 0:null===(a=r[1])||void 0===a?void 0:a.from))return{startDate:null,dueDate:null,otherInfo:o};return{startDate:c()(e.gestational_week[1].from,m.K_).toDate(),dueDate:c()(e.due_date,m.K_).toDate(),otherInfo:o}}catch(e){return{startDate:null,dueDate:null,otherInfo:o}}},getDueDateUltrasound=async(e,t)=>{let[n,o]=t.split("|"),[a,r]=[Number(n),Number(o)],l=["method=us","date=".concat(c()(e).format(m.K_)),a?"crl=".concat(a):"",!a&&r?"msd=".concat(r):""].join("&"),i="".concat(u.PATHS.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(l),s={method:5,measurement_date:c()(e).format(m.a7),crl_value:a,msd_value:r,insemination_date:null,cycle_length_days:null,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var g,f;let{data:e}=await (0,d.callApiNew)(i);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(f=e.gestational_week)||void 0===f?void 0:null===(g=f[1])||void 0===g?void 0:g.from))return{startDate:null,dueDate:null,otherInfo:s};return{startDate:c()(e.gestational_week[1].from,m.K_).toDate(),dueDate:c()(e.due_date,m.K_).toDate(),otherInfo:s}}catch(e){return{startDate:null,dueDate:null,otherInfo:s}}},getDueDateConception=async e=>{let t=["method=cd","date=".concat(c()(e).format(m.K_))].join("&"),n="".concat(u.PATHS.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(t),o={method:2,conception_date:c()(e).format(m.a7),insemination_date:null,measurement_date:null,first_day:null,cycle_length_days:null,ivf_transfer_date:null,days_transfer:null};try{var a,r;let{data:e}=await (0,d.callApiNew)(n);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(r=e.gestational_week)||void 0===r?void 0:null===(a=r[1])||void 0===a?void 0:a.from))return{startDate:null,dueDate:null,otherInfo:o};return{startDate:c()(e.gestational_week[1].from,m.K_).toDate(),dueDate:c()(e.due_date,m.K_).toDate(),otherInfo:o}}catch(e){return{startDate:null,dueDate:null,otherInfo:o}}},getDueDateIVF=async(e,t)=>{let n=Number(t),o=["method=ivf","embryo_transfer_date=".concat(n),"date=".concat(c()(e).format(m.K_))].join("&"),a="".concat(u.PATHS.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(o),r={method:3,ivf_transfer_date:c()(e).format(m.a7),measurement_date:null,insemination_date:null,days_transfer:n,conception_date:null,first_day:null,cycle_length_days:null};try{var l,i;let{data:e}=await (0,d.callApiNew)(a);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(i=e.gestational_week)||void 0===i?void 0:null===(l=i[1])||void 0===l?void 0:l.from))return{startDate:null,dueDate:null,otherInfo:r};return{startDate:c()(e.gestational_week[1].from,m.K_).toDate(),dueDate:c()(e.due_date,m.K_).toDate(),otherInfo:r}}catch(e){return{startDate:null,dueDate:null,otherInfo:r}}},DateToInputValue=e=>"".concat(e.getFullYear(),"-").concat(String(e.getMonth()+1).padStart(2,"0"),"-").concat(String(e.getDate()).padStart(2,"0")),h=(0,s.vt)(e=>({isCalculating:!1,isRecalculate:!1,navResultTarget:"due_date_revealed",setNavResultTarget:t=>e({navResultTarget:t}),calculatorType:0,setCalculatorType:t=>e(()=>({calculatorType:t})),setIsCalculating:t=>e(()=>({isCalculating:t})),setIsRecalculate:t=>e(()=>({isRecalculate:t}))}))},fnO6:function(e,t,n){var o,a;n.d(t,{I:function(){return o}}),(a=o||(o={})).GOOD="Good",a.MODERATE="Moderate",a.UNHEALTHY_FOR_SENSITIVE="Unhealthy for Sensitive Groups",a.UNHEALTHY="Unhealthy",a.VERY_UNHEALTHY="Very Unhealthy",a.HAZARDOUS="Hazardous"},Wsmx:function(e,t,n){n.d(t,{g:function(){return getLocation}});let getLocation=async function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(!("geolocation"in navigator))return{location:null,error:"NOT_SUPPORTED",message:"Geolocation not supported"};if(!e&&"permissions"in navigator)try{let e=await navigator.permissions.query({name:"geolocation"});if("granted"!==e.state)return{location:null,error:"NO_PERMISSION",message:"User has not granted geolocation permission"}}catch(e){return console.warn("Permission query failed:",e),{location:null,error:"UNKNOWN",message:"Permission check failed"}}return new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>{e({location:{longitude:t.coords.longitude,latitude:t.coords.latitude},error:null})},t=>{let n="UNKNOWN";switch(t.code){case t.PERMISSION_DENIED:n="PERMISSION_DENIED";break;case t.POSITION_UNAVAILABLE:n="POSITION_UNAVAILABLE";break;case t.TIMEOUT:n="TIMEOUT"}e({location:null,error:n,message:t.message})},{timeout:3e4,maximumAge:0})})}}}]);