(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,284007,e=>{"use strict";var t=e.i(981030);let r=Symbol(""),n=e=>"function"==typeof(null==e?void 0:e.then);function a(e=()=>{try{return window.localStorage}catch(e){return}},t){var r;let i,s,o,u,c={getItem:(r,a)=>{var o,u;let c=e=>{if(i!==(e=e||"")){try{s=JSON.parse(e,null==t?void 0:t.reviver)}catch(e){return a}i=e}return s},l=null!=(u=null==(o=e())?void 0:o.getItem(r))?u:null;return n(l)?l.then(c):c(l)},setItem:(r,n)=>{var a;return null==(a=e())?void 0:a.setItem(r,JSON.stringify(n,null==t?void 0:t.replacer))},removeItem:t=>{var r;return null==(r=e())?void 0:r.removeItem(t)}};try{o=null==(r=e())?void 0:r.subscribe}catch(e){}return!o&&"u">typeof window&&"function"==typeof window.addEventListener&&window.Storage&&(o=(t,r)=>{if(!(e()instanceof window.Storage))return()=>{};let n=n=>{n.storageArea===e()&&n.key===t&&r(n.newValue)};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}}),o&&(u=o,c.subscribe=(e,t,r)=>u(e,e=>{let n;try{n=JSON.parse(e||"")}catch(e){n=r}t(n)})),c}let i=a(),s=new WeakMap,o={state:"loading"};e.s(["RESET",0,r,"atomWithStorage",0,function(e,a,s=i,o){let u=null==o?void 0:o.getOnInit,c=(0,t.atom)(u?s.getItem(e,a):a);return c.onMount=t=>{let r;return t(s.getItem(e,a)),s.subscribe&&(r=s.subscribe(e,t,a)),r},(0,t.atom)(e=>e(c),(t,i,o)=>{let u="function"==typeof o?o(t(c)):o;return u===r?(i(c,a),s.removeItem(e)):n(u)?u.then(t=>(i(c,t),s.setItem(e,t))):(i(c,u),s.setItem(e,u))})},"createJSONStorage",0,a,"loadable",0,function(e){let r;return r=()=>{let r=new WeakMap,n=(0,t.atom)([()=>{},0]);n.unstable_onInit=e=>{e.set(n,([,t])=>[()=>e.set(n,([e,t])=>[e,t+1]),t])};let a=(0,t.atom)(t=>{let a,i,[s]=t(n);try{a=t(e)}catch(e){return{state:"hasError",error:e}}if("function"!=typeof(null==(i=a)?void 0:i.then))return{state:"hasData",data:a};let u=a,c=r.get(u);return c?c:(u.then(e=>{r.set(u,{state:"hasData",data:e}),s()},e=>{r.set(u,{state:"hasError",error:e}),s()}),r.get(u)||(r.set(u,o),o))});return(0,t.atom)(e=>e(a))},(s.has(e)?s:s.set(e,r())).get(e)}])},949920,e=>{"use strict";var t=e.i(381477);let r=(0,e.i(66396).withMiddleware)(t.default,e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,e(t,r,n)));e.s(["default",0,r])},990033,e=>{"use strict";let t,r="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),n=new Uint8Array(16),a=[];for(let e=0;e= 16");if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,i){if((u=u||0)i.length)throw RangeError(`UUID byte range ${u}:${u+15} is out of buffer bounds`);for(let e=0;e{"use strict";let t=(0,e.i(981030).atom)();e.s(["pageIdAtom",0,t])},608201,236593,e=>{"use strict";var t=e.i(284007);let r={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function n(){try{return window.sessionStorage}catch{return r}}let a=(0,t.createJSONStorage)(n),i=(0,t.atomWithStorage)("wx-source-page",null,a,{getOnInit:!0});e.s(["sourcePageAtom",0,i],608201);let s=(0,t.createJSONStorage)(n),o=(0,t.atomWithStorage)("wx-source-module",null,s,{getOnInit:!0});e.s(["sourceModuleAtom",0,o],236593)},736677,220126,e=>{"use strict";var t=e.i(284007);let r=(0,t.createJSONStorage)(()=>sessionStorage),n=(0,t.atomWithStorage)("wx-ht-source-page",null,r);e.s(["sourcePageAtom",0,n],736677);let a=(0,t.createJSONStorage)(()=>sessionStorage),i=(0,t.atomWithStorage)("wx-ht-source-module",null,a);e.s(["sourceModuleAtom",0,i],220126)},678651,(e,t,r)=>{"use strict";function n(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))void 0!==n&&t.append(r,n);return t}Object.defineProperty(r,"__esModule",{value:!0}),r.queryStringToSearchParams=n,r.urlFrom=function({host:e,...t}){if(!e)throw Error("Host is missing");let r=new URL(`https://${e}`);return Object.assign(r,{...t,hostname:e}),t.query&&(r.search=n(t.query).toString()),r}},763886,e=>{"use strict";let t=(0,e.i(981030).atom)();e.s(["partnerAtom",0,t])},725296,e=>{"use strict";var t,r=e.i(965586),n=((t={}).CA="ca",t.CA_QC="ca-qc",t.EXEMPT="exempt",t.GDPR="gdpr",t.JP="jp",t.KR="kr",t.LATAM_CO="latam-co",t.LATAM_DO="latam-do",t.LATAM_PE="latam-pe",t.LGPD="lgpd",t.PIPL="pipl",t.TR_KVKK="tr-kvkk",t.USA="usa",t.USA_CCPA="usa-ccpa",t.USA_CO="usa-co",t.USA_CT="usa-ct",t.USA_VA="usa-va",t);Object.values(n);let a={"usa-ut":"usa"},i=e=>e?a[e]??e:void 0;e.s(["RESTRICTIVE_REGIMES",0,["ca-qc","gdpr","latam-co","latam-do","latam-pe","lgpd","pipl","tr-kvkk"],"Regime",()=>n,"US_REGIMES",0,["usa","usa-ccpa","usa-co","usa-ct","usa-va"],"default",0,n,"getRegime",0,()=>(()=>{let e=(0,r.getCookie)("ci")?.toString();if(e)for(let t of e.split("&")){let e=t.indexOf("=");if(e>-1&&"TWC-Privacy"===t.slice(0,e))return i(t.slice(e+1))}})()??i((0,r.getCookie)("twc-privacy")?.toString())??"exempt"])},617874,e=>{"use strict";let t="Imperial",r="Metric",n="Hybrid",a={code:"e",name:t,temp:"F",speed:"mph",distance:"mi",accumulation:"in",precip:"in",pressure:"in"},i={code:"m",name:r,temp:"C",speed:"km/h",distance:"km",accumulation:"cm",precip:"mm",pressure:"mb"},s={code:"h",name:n,temp:"C",speed:"mph",distance:"mi",accumulation:"in",precip:"in",pressure:"mb"};e.s(["UNITS_COOKIE_KEY",0,"unitOfMeasurement","UNIT_HYBRID",0,n,"UNIT_IMPERIAL",0,t,"UNIT_METRIC",0,r,"imperial",0,a,"unitsSystemByCode",0,function(e){switch(e?.toLowerCase()){case"e":case"f":return a;case"m":case"c":return i;case"h":return s;default:return null}},"unitsSystemByName",0,function(e=""){switch(e.toLowerCase()){case"imperial":case"Imperial":return a;case"metric":case"Metric":return i;case"hybrid":case"Hybrid":return s;default:return null}}])},889753,301904,e=>{"use strict";var t=e.i(284007),r=e.i(617874),n=e.i(990033),a=e.i(981030),i=e.i(543512);let s={animationSpeed:1,autoplay:!0,opacity:90,roadOverlay:"default",style:"default"};e.s(["DEFAULT_MAP_SETTINGS",0,s],301904);let o=(0,a.atom)(i.UserSubscriptionTiers.none),u=(0,t.atomWithStorage)("userProfile",null,void 0,{getOnInit:!0}),c=(0,t.atomWithStorage)("userPreferences",{userID:(0,n.v4)(),unit:r.UNIT_IMPERIAL,locations:[],locale:"en_US",mapSettings:s,favoriteWeatherComponents:[],favoriteActivityComponents:[],dashboard:[]},void 0,{getOnInit:!0});e.s(["userPreferencesAtom",0,c,"userProfileAtom",0,u,"userTierAtom",0,o],889753)},905059,e=>{"use strict";let t=(0,e.i(284007).atomWithStorage)("wx-next/user:mapLayerOrder",null,void 0,{getOnInit:!0});e.s(["mapLayerOrderAtom",0,t])},776169,809991,e=>{"use strict";var t=e.i(546446),r=e.i(889753),n=e.i(301904),a=e.i(905059),i=e.i(901351),s=e.i(310847),o=e.i(528600),u=e.i(617874),c=e.i(540768),l=e.i(553329),d=e.i(247865),m=e.i(245943);let p=(0,e.i(695881).createLogger)("useMapSettings");e.s(["WEB_MAP_SETTINGS_PLATFORM",0,"twc","useMapSettings",0,function(e="twc"){let{user:{isUserLoggedIn:r}}=(0,o.useUser)(),n=(0,t.useSetAtom)(a.mapLayerOrderAtom),s=(0,d.useCallback)(async t=>{if(!r)return!1;let{error:n}=await (0,l.tryCatch)(i.upsxClient.preference.updateMapSettings(e,t));if(!n)return!0;if(n instanceof m.APIError&&404===n.code){let{error:r}=await (0,l.tryCatch)(i.upsxClient.preference.createMapSettings(e,t));return!r||(p.warn("Failed to create map settings",r),!1)}return p.warn("Failed to update map settings",n),!1},[r,e]),u=(0,d.useCallback)((e,t)=>{n(e?.layerOrder??t)},[n]),c=(0,d.useCallback)(async t=>{if(!r||0===t.length)return!1;n(t);let{data:a,error:s}=await (0,l.tryCatch)(i.upsxClient.preference.reorderMapSettingsLayers(e,{order:t}));if(!s)return u(a,t),!0;if(s instanceof m.APIError&&404===s.code){let{data:r,error:n}=await (0,l.tryCatch)(i.upsxClient.preference.createMapSettings(e,{layerOrder:t}));if(!n)return u(r,t),!0;if(n instanceof m.APIError&&409===n.code){let{data:r,error:n}=await (0,l.tryCatch)(i.upsxClient.preference.reorderMapSettingsLayers(e,{order:t}));return n?(p.warn("Failed to reorder map layers after create",n),!1):(u(r,t),!0)}return p.warn("Failed to create map settings layer order",n),!1}return p.warn("Failed to reorder map layers",s),!1},[r,e,u,n]),f=(0,d.useCallback)(async(t,a,s)=>{if(!r)return!1;n(s);let{data:o,error:d}=await (0,l.tryCatch)(i.upsxClient.preference.moveMapSettingsLayer(e,t,{placement:a}));return d?d instanceof m.APIError&&(404===d.code||400===d.code)?c(s):(p.warn("Failed to move map layer",d),!1):(u(o,s),!0)},[r,e,u,c,n]);return{saveMapSettings:s,saveLayerOrder:c,moveLayer:f}}],809991),e.s(["usePreferences",0,function(){let{user:{isUserLoggedIn:e}}=(0,o.useUser)(),[d,m]=(0,t.useAtom)(r.userPreferencesAtom),[p,f]=(0,t.useAtom)(s.wxuUserPreferenceAtom),g=(0,t.useSetAtom)(a.mapLayerOrderAtom),y=async()=>{let{data:e,error:t}=await (0,l.tryCatch)(i.upsxClient.preference.getMapSettings("twc"));if(t)return{ok:!1,mapSettings:null,layerOrder:null};if(!e)return{ok:!0,mapSettings:null,layerOrder:null};let{animationSpeed:r,autoplay:n,opacity:a,roadOverlay:s,style:o}=e,u={...void 0!==r&&{animationSpeed:r},...void 0!==n&&{autoplay:n},...void 0!==a&&{opacity:a},...void 0!==s&&{roadOverlay:s},...void 0!==o&&{style:o}};return{ok:!0,mapSettings:Object.keys(u).length>0?u:null,layerOrder:e.layerOrder?.length?e.layerOrder:null}},S=async e=>{try{await i.upsxClient.preference.updatePreference(e)}catch(e){return console.error("Failed to sync preferences with server:",e),null}},h=async(t,r=!0)=>{try{let n,a=(n={...d,...t},m(n),f({...p,...t,locations:n.locations}),n);if(t?.unit){let e=(0,u.unitsSystemByName)(t.unit),r=e?.code||"e";(0,c.setCookie)(u.UNITS_COOKIE_KEY,r,{domain:"weather.com"})}return r&&e&&await S(a),{success:!0}}catch(e){return console.error("Failed to update preferences:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update preferences"}}};return{syncPreferencesFromUpsx:async()=>{try{let[e,t]=await Promise.all([i.upsxClient.preference.getPreference(),y()]);if(!e?.userID)return null;let{mapSettings:r,layerOrder:a,ok:s}=t;s&&g(a);let{mapSettings:o,...u}=e,c={...u,mapSettings:{...n.DEFAULT_MAP_SETTINGS,...r}};return h(c,!1),c}catch{return null}},updatePreferences:h}}],776169)},528600,e=>{"use strict";let t;var r=e.i(247865),n=e.i(546446),a=e.i(949920),i=e.i(889753),s=e.i(901351),o=e.i(310847),u=e.i(543512),c=e.i(990033),l=e.i(333350),d=e.i(495110),m=e.i(513513),p=e.i(960576);e.s(["useUser",0,function(){let[e,f]=(0,n.useAtom)(i.userProfileAtom),[g,y]=(0,n.useAtom)(o.wxuUserAnonymousIdAtom),[S,h]=(0,n.useAtom)(o.wxuUserAccountUserAccountResponseAtom),[w,A]=(0,r.useState)(!1),I=(0,n.useSetAtom)(o.wxuLoginRedirectPageAtom),v=(0,d.useIsHydratingRender)();l.default&&!w&&(I(window.location.href),A(!0));let b=(0,n.useAtomValue)(i.userTierAtom),U=(0,m.isUserLoggedIn)(b),C=g;!C&&l.default&&(t||(t=(0,p.readEarlyAnonId)()??(0,c.v4)()),C=t),l.default&&!g&&C&&y(C),!e&&S&&f(S);let T=(0,a.default)(U?"upsx/id":null,()=>s.upsxClient.account.getAccountId(),{shouldRetryOnError:e=>"APIError"!==e.name}),{userID:O=""}=T?.data||{},P=O&&e?.userID!==O,E=(0,a.default)(P?"upsx/account":null,()=>s.upsxClient.account.getAccount(),{shouldRetryOnError:e=>"APIError"!==e.name,onSuccess:e=>{f(e),h(e)}});return{user:{anonId:C,userID:O,isUserLoggedIn:U,subscriptionTier:b,isUserPremium:(0,m.isUserTierPremium)(b),isUserAdFree:b===u.UserSubscriptionTiers.adFree},userProfile:v?null:e,isUserIdLoading:T.isLoading,profileError:E.error}}])},543512,e=>{"use strict";var t,r=((t={})[t.none=-1]="none",t[t.standard=0]="standard",t[t.premium=1]="premium",t[t.adFree=2]="adFree",t[t.premiumWithAd=3]="premiumWithAd",t);let n=Object.entries(r).reduce((e,[t,r])=>(e[r]=t,e),{});Object.entries(r).reduce((e,[t,r])=>(e[r.toString()]=r,e),{}),e.s(["UserSubscriptionPremiumTiers",0,[1,2,3],"UserSubscriptionTierKeysMap",0,n,"UserSubscriptionTiers",()=>r,"UserSubscriptionTiersMap",0,{standard:0,tier0:1,tier1:1,"ad-free-v2":2,tier3:3}])},960576,e=>{"use strict";let t="wxu-exp-anon-id";e.s(["clearEarlyAnonId",0,function(){try{window.localStorage.removeItem(t)}catch{}},"readEarlyAnonId",0,function(){let e=window.__wxExperimentDeviceId;if("string"==typeof e&&e)return e;try{return window.localStorage.getItem(t)||void 0}catch{return}}])},513513,e=>{"use strict";var t=e.i(543512);t.UserSubscriptionTiers.none,t.UserSubscriptionTiers.standard,t.UserSubscriptionTiers.adFree,t.UserSubscriptionTiers.premium,t.UserSubscriptionTiers.premiumWithAd,e.s(["hasRadarFeature",0,function(e){return void 0!==e&&t.UserSubscriptionPremiumTiers.includes(e)},"isUserLoggedIn",0,function(e){return void 0!==e&&e>t.UserSubscriptionTiers.none},"isUserTierPremium",0,function(e){return t.UserSubscriptionPremiumTiers.includes(e)}],513513)},901351,e=>{"use strict";e.i(288906);let t=new(e.i(245943)).UPSXClient({baseUrl:"https://upsx.weather.com"});e.s(["upsxClient",0,t])},553329,e=>{"use strict";async function t(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}e.s(["tryCatch",0,t])}]);