1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1502],{27084:(e,t,r)=>{r.d(t,{N:()=>c});var a=r(95155),s=r(57830),i=r(26838),n=r(39069),l=r(75889);let o=e=>{let{icon:t,children:r,iconColorClass:s}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(t,{className:(0,l.QP)("h-4 w-4",s)}),(0,a.jsx)(i.E,{size:"p",weight:"normal",className:"text-sm",children:r})]})},c=e=>{let{type:t,forecast:r,accentColor:l="itatiaia"}=e,c=(0,n.JT)("text-")[l];return(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-between pb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["string"==typeof r.icon&&r.icon.includes("http")?(0,a.jsx)("img",{src:r.icon,alt:"\xcdcone do clima",className:"h-6 w-6"}):(0,a.jsx)("span",{className:"text-xl",children:r.icon}),(0,a.jsx)(i.E,{size:"p",weight:"bold",className:"text-sm",children:"today"===t?"Hoje":"Amanh\xe3"})]})}),(0,a.jsxs)(o,{icon:s.VEw,iconColorClass:c,children:[r.temperatureMin," - ",r.temperatureMax,"\xb0C"]}),(0,a.jsx)(o,{icon:s.ssz,iconColorClass:c,children:void 0!==r.humidityMin&&void 0!==r.humidityMax?"".concat(r.humidityMin," - ").concat(r.humidityMax,"%"):"".concat(r.humidity,"%")}),(0,a.jsxs)(o,{icon:s.Mp$,iconColorClass:c,children:[r.windSpeed,"km/h"]}),(0,a.jsxs)(o,{icon:s.jG6,iconColorClass:c,children:[r.precipitation.toFixed(2),"mm"]})]})}},40505:(e,t,r)=>{r.d(t,{s:()=>n});var a=r(95155),s=r(57830),i=r(26838);let n=e=>{let{date:t,forecast:r,hourlyForecast:n}=e,l=(null==n?void 0:n.temperature)||r.temperature,o=(null==n?void 0:n.icon)||r.icon,c=r.temperatureMax,d=r.temperatureMin;return(0,a.jsxs)("div",{className:"mb-0 border-b border-neutral-200 pb-4",children:[(0,a.jsx)(i.E,{size:"meta-200",weight:"normal",className:"mb-0 text-neutral-600",children:t}),(0,a.jsxs)("div",{className:"flex items-center justify-start gap-4",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:"string"==typeof o&&o.includes("http")?(0,a.jsx)("img",{src:o,alt:"\xcdcone do clima",className:"h-16 w-16"}):(0,a.jsx)("div",{className:"text-6xl",children:o})}),(0,a.jsx)("div",{className:"flex items-end gap-3",children:(0,a.jsxs)(i.E,{size:"h1",weight:"bold",className:"leading-12 text-5xl",children:[Math.round(l),"\xb0"]})}),(0,a.jsxs)("div",{className:"mb-2 flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(s.VEw,{className:"h-5 w-5 text-red-500"}),(0,a.jsxs)(i.E,{size:"p",weight:"bold",className:"text-sm",children:[c,"\xb0"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(s.VEw,{className:"h-5 w-5 text-blue-500"}),(0,a.jsxs)(i.E,{size:"p",weight:"bold",className:"text-sm",children:[d,"\xb0"]})]})]})]})]})}},61502:(e,t,r)=>{r.r(t),r.d(t,{Weather:()=>w});var a=r(95155),s=r(75889),i=r(41619),n=r(12115);function l(e){let t=e?new Date(e):new Date;return t.setHours(0,0,0,0),t.getTime()}var o=r(19700);function c(e){var t,r,a,s,i,n,l,o;let c=(null==(t=e.temperature)?void 0:t.average)||0,d=(null==(a=e.icon)||null==(r=a.icon_value)?void 0:r.description_pt)||"Sem informa\xe7\xe3o",u=(null==(i=e.icon)||null==(s=i.icon_value)?void 0:s.resource)||"",m=(null==(n=e.humidity)?void 0:n.average)||0,h=(null==(l=e.wind)?void 0:l.speed)||0,p=(null==(o=e.precipitation)?void 0:o.value)||0;return{dateTime:e.date,temperature:c,description:d,icon:u?"https://www.climatempo.com.br/dist/images/v2/svg/".concat(u,".svg"):"",humidity:m,windSpeed:h,precipitation:p}}var d=r(80259),u=r(54577),m=r(37246);class h{buildCacheTags(e,t,r){let a;r&&(a=u.I.configureProviderForVertical({path:r,provider:this.provider}));let{tags:s}=(0,d.a)({repository:"weather_repository",prefix:e,queryParams:t,vertical:null==a?void 0:a.path});return s}async getLocales(e){try{let t=this.buildCacheTags("get_weather_locales",{path:e},e),r=await this.provider.request("/wp-json/weather/v1/locales",{method:"GET",next:{revalidate:3600,tags:t}});if(!r||!r.items)return m.V.error("[WeatherRepository] [getLocales] Invalid API response structure"),null;return r}catch(e){return m.V.error("[WeatherRepository] [getLocales] Error fetching weather locales",e),null}}async getForecastByLocaleId(e,t){if(!e||"string"==typeof e&&""===e.trim())return m.V.error("[WeatherRepository] [getForecastByLocaleId] Invalid localeId parameter"),null;try{let r=this.buildCacheTags("get_weather_forecast_by_locale_id",{id:e,path:t},t),a=await this.provider.request("/wp-json/weather/v1/forecast/daily?locale_id=".concat(e),{method:"GET",next:{revalidate:3600,tags:r}});if(!a||!a.data)return m.V.error("[WeatherRepository] [getForecastByLocaleId] Invalid API response structure"),null;return a}catch(t){return m.V.error("[WeatherRepository] [getForecastByLocaleId] Error fetching forecast for locale ".concat(e),t),null}}async getForecastHourly(e,t,r,a){if(!e||"string"==typeof e&&""===e.trim())return m.V.error("[WeatherRepository] [getForecastHourly] Invalid localeId parameter"),null;if(!t||""===t.trim())return m.V.error("[WeatherRepository] [getForecastHourly] Invalid startDate parameter"),null;if(!r||""===r.trim())return m.V.error("[WeatherRepository] [getForecastHourly] Invalid endDate parameter"),null;try{let s=this.buildCacheTags("get_weather_forecast_hourly",{id:e,startDate:t,endDate:r,path:a},a),i="locale_id=".concat(e,"&start_date=").concat(encodeURIComponent(t),"&end_date=").concat(encodeURIComponent(r)),n=await this.provider.request("/wp-json/weather/v1/forecast/hourly?".concat(i),{method:"GET",next:{revalidate:3600,tags:s}});if(!n||!n.data)return m.V.error("[WeatherRepository] [getForecastHourly] Invalid API response structure"),null;return n}catch(t){return m.V.error("[WeatherRepository] [getForecastHourly] Error fetching hourly forecast for locale ".concat(e),t),null}}constructor(e){this.provider=e}}
1var p=r(10304),x=r(93806),g=r(40505),v=r(27084);let y=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"animate-pulse space-y-4",children:(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"h-24 w-24 rounded bg-gray-200"}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)("div",{className:"h-6 w-20 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-8 w-32 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-24 rounded bg-gray-200"})]})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"animate-pulse space-y-2",children:[(0,a.jsx)("div",{className:"h-4 w-16 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-24 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-20 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-20 rounded bg-gray-200"})]}),(0,a.jsxs)("div",{className:"animate-pulse space-y-2",children:[(0,a.jsx)("div",{className:"h-4 w-16 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-24 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-20 rounded bg-gray-200"}),(0,a.jsx)("div",{className:"h-4 w-20 rounded bg-gray-200"})]})]})]});var f=r(98864);let w=e=>{let{accentColor:t="itatiaia",className:r,title:d="Previs\xe3o do Tempo",titleUrl:u,titleNewTab:m=!1,actionButtonLabel:w,actionButtonUrl:j,actionButtonNewTab:b=!1,defaultLocaleId:N=3477}=e,{weatherData:C,hourlyForecast:M,error:E,cities:_,currentLocaleId:I,setCurrentLocaleId:D,shouldShowContent:F}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3477,t=(0,n.useMemo)(()=>new h(new p.x),[]),r=(0,n.useRef)(new AbortController),a=(0,n.useRef)(!1),[s,i]=(0,n.useState)(e),[d,u]=(0,n.use
1State)(null),[m,x]=(0,n.useState)(null),[g,v]=(0,n.useState)(null),[y,f]=(0,n.useState)(!1),[w,j]=(0,n.useState)(null),b=(0,n.useCallback)(async(r,s)=>{if(g){f(!0),j(null);try{let e=await t.getForecastByLocaleId(r);if(!e)throw Error("Falha ao buscar previs\xe3o di\xe1ria");let s=function(e){let t=l(),r=e.data.findIndex(e=>l(e.date)===t);-1===r&&(r=0);let a=e.data[r];if(!a||l(a.date)!==t)throw Error("Dados de clima dessincronizados. Esperado: ".concat(new Date().toLocaleDateString(),", Recebido: ").concat(null==a?void 0:a.date));let s=e.data[r+1],i=e.locale.name,n=e.locale.state,o=n?"".concat(i,", ").concat(n):i,c=new Date(a.date).toLocaleDateString("pt-BR",{weekday:"long",day:"numeric",month:"long"});return{location:o,date:c.charAt(0).toUpperCase()+c.slice(1),forecast:{temperature:a.temperature.average,temperatureMax:a.temperature.max,temperatureMin:a.temperature.min,description:a.icon.daily.description_pt,icon:"https://www.climatempo.com.br/dist/images/v2/svg/".concat(a.icon.daily.resource,".svg"),humidity:a.humidity.average,humidityMin:a.humidity.min,humidityMax:a.humidity.max,windSpeed:a.wind.speed,precipitation:a.precipitation.value},today:{temperature:a.temperature.average,temperatureMax:a.temperature.max,temperatureMin:a.temperature.min,description:a.icon.afternoon.description_pt,icon:"https://www.climatempo.com.br/dist/images/v2/svg/".concat(a.icon.afternoon.resource,".svg"),humidity:a.humidity.average,humidityMin:a.humidity.min,humidityMax:a.humidity.max,windSpeed:a.wind.speed,precipitation:a.precipitation.value},tomorrow:s?{temperature:s.temperature.average,temperatureMax:s.temperature.max,temperatureMin:s.temperature.min,description:s.icon.daily.description_pt,icon:"https://www.climatempo.com.br/dist/images/v2/svg/".concat(s.icon.daily.resource,".svg"),humidity:s.humidity.average,humidityMin:s.humidity.min,humidityMax:s.humidity.max,windSpeed:s.wind.speed,precipitation:s.precipitation.value}:void 0}}(e);u(s);let i=new Date,n=(0,o.Yq)(i,"YYYY-MM-DD HH:00:00"),d=new Date(i);d.setDate(d.getDate()+2);let m=(0,o.Yq)(d,"YYYY-MM-DD HH:00:00"),h=await t.getForecastHourly(r,n,m);if(h){let e=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,r=function(e){let t=new Date(e);return t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t}(t),a=(0,o.Yq)(r,"YYYY-MM-DD HH:00:00"),s=e.find(e=>e.date===a);return s?c(s):null}(e.data,r);return{location:(null==(t=e.locale)?void 0:t.name)||"",currentHourForecast:a,allHourlyData:e.data.map(c)}}(h);e.currentHourForecast&&x(e.currentHourForecast)}a.current=!0}catch(n){if(n instanceof Error&&"AbortError"===n.name)return;let t=n instanceof Error?n.message:"Erro ao buscar dados";if(s){let t=(()=>{let[t]=Object.keys(g.items);return t?parseInt(t,10):e})();if(t!==r){a.current=!0,i(t);return}}j(t)}finally{f(!1)}}},[g,t,e]);(0,n.useEffect)(()=>{(async()=>{try{let e=await t.getLocales();v(e)}catch(e){}})()},[t]),(0,n.useEffect)(()=>{var t;if(!g)return;let n=!a.current;if(!g.items[s]){if(n){a.current=!0,i((()=>{let[t]=Object.keys(g.items);return t?parseInt(t,10):e})());return}j("Erro ao buscar dados");return}return null==(t=r.current)||t.abort(),r.current=new AbortController,b(s,n),()=>{var e;null==(e=r.current)||e.abort()}},[s,g,b,e]);let N=(0,n.useMemo)(()=>(null==g?void 0:g.items)?Object.entries(g.items).map(e=>{let[t,r]=e,a=String(r),s=a.includes(" - ")?" - ":",",[i,n]=a.split(s);return{id:parseInt(t,10),name:i.trim(),state:(null==n?void 0:n.trim())||""}}):[],[g]),C=!!(d&&g&&!y);return{weatherData:d,hourlyForecast:m,locations:g,loading:y,error:w,cities:N,currentLocaleId:s,setCurrentLocaleId:i,shouldShowContent:C}}(N);return(0,a.jsxs)("div",{className:(0,s.QP)("flex w-full flex-col gap-4 roun
1ded-md border border-neutral-300 bg-white p-4",r),children:[(0,a.jsx)(i.E,{className:"text-xl",color:t,showGraphic:!0,size:"h2",text:d,weight:"bold",url:u,new_tab:m}),(0,a.jsx)("div",{className:"m-0 p-0",children:(0,a.jsx)(x.CitySelect,{city:F&&C?C.location:"",localeId:I,cities:_,onChange:D,editable:_.length>0})}),E&&(0,a.jsx)("div",{className:"mt-2 text-sm text-red-600",children:E}),F&&C?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.s,{date:C.date,forecast:C.forecast,hourlyForecast:M}),(C.today||C.tomorrow)&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[C.today&&(0,a.jsx)(v.N,{type:"today",forecast:C.today,accentColor:t}),C.tomorrow&&(0,a.jsx)(v.N,{type:"tomorrow",forecast:C.tomorrow,accentColor:t})]})]}):(0,a.jsx)(y,{}),w&&(0,a.jsx)(f.r,{href:j,label:w,accentColor:t,newTab:b})]})}},93806:(e,t,r)=>{r.r(t),r.d(t,{CitySelect:()=>l});var a=r(95155),s=r(12115),i=r(57830),n=r(75889);let l=e=>{let{localeId:t,city:r,cities:l=[],onChange:o,editable:c=!0}=e,[d,u]=(0,s.useState)(!1),[m,h]=(0,s.useState)(""),p=function(e){let t=arguments.length>
11&&void 0!==arguments[1]?arguments[1]:300,[r,a]=(0,s.useState)(e);return(0,s.useEffect)(()=>{let r=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}(m,300),x=(0,s.useRef)(null),g=(0,s.useRef)(null),v=(0,s.useMemo)(()=>{if(""===p.trim())return l;let e=p.toLowerCase();return l.filter(t=>(t.state?"".concat(t.name,", ").concat(t.state):t.name).toLowerCase().includes(e))},[p,l]);(0,s.useEffect)(()=>{d&&g.current&&g.current.focus();let e=e=>{x.current&&!x.current.contains(e.target)&&(u(!1),h(""))};if(d)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[d]);let y=()=>{u(!0)};return c&&o&&0!==l.length?(0,a.jsxs)("div",{ref:x,className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-neutral-100 px-3 py-2",children:[(0,a.jsx)(i.XXh,{className:"h-5 w-5 flex-shrink-0 text-neutral-700"}),(0,a.jsx)("input",{ref:g,type:"text",value:d?m:r,onChange:e=>{h(e.target.value),d||u(!0)},onClick:y,onFocus:y,readOnly:!d,placeholder:d?"Digite para buscar...":r,className:"flex-1 cursor-pointer bg-transparent text-sm font-medium text-neutral-900 outline-none placeholder:text-neutral-500"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[d&&m&&(0,a.jsx)("button",{onClick:()=>{h(""),g.current&&g.current.focus()},className:"p-0.5 text-neutral-500 hover:text-neutral-700",type:"button",children:(0,a.jsx)(i.m6K,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),u(!d)},className:"p-0.5",type:"button",children:(0,a.jsx)(i.gZ7,{className:"h-5 w-5 text-neutral-500"})})]})]}),d&&(0,a.jsx)("div",{className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-64 overflow-y-auto rounded-md border border-neutral-200 bg-white shadow-lg",children:0===v.length?(0,a.jsx)("div",{className:"px-4 py-3 text-sm text-neutral-500",children:"Nenhuma cidade encontrada"}):v.map(e=>{let r=e.state?"".concat(e.name,", ").concat(e.state):e.name,s=t===e.id;return(0,a.jsx)("button",{onClick:()=>{var t;t=e.id,u(!1),h(""),null==o||o(t,r)},className:(0,n.QP)("w-full px-4 py-2.5 text-left text-sm transition-colors hover:bg-neutral-50",s?"bg-neutral-50 font-medium":""),type:"button",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.XXh,{className:"h-4 w-4 flex-shrink-0 text-neutral-400"}),(0,a.jsx)("span",{children:r})]})},e.id)})})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-neutral-100 px-3 py-2",children:[(0,a.jsx)(i.XXh,{className:"h-5 w-5 text-neutral-700"}),(0,a.jsx)("span",{className:"text-sm font-normal text-neutral-900",children:r})]})}},98864:(e,t,r)=>{r.d(t,{r:()=>o});var a=r(95155),s=r(26838),i=r(39069),n=r(57830),l=r(75889);let o=e=>{let{href:t="#",label:r="Veja a previs\xe3o completa",newTab:o=!1,accentColor:c="itatiaia"}=e,d=(0,i.JT)("text-")[c],u=(0,i.JT)("hover:text-")[c];return(0,a.jsxs)("a",{href:t,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,className:(0,l.QP)("flex items-center gap-2 border-t border-neutral-200 pt-4 transition-colors",d,u),children:[(0,a.jsx)(s.E,{size:"p",weight:"medium",className:"text-sm",children:r}),(0,a.jsx)(n.a1M,{className:"h-4 w-4"})]})}}}]);
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.