PageSourceSearch

https://www.hering.com.br/_next/static/chunks/5693.197ce1ec53b8e618.js

js hering.com.br collected 2026-09-24 09:07:20 UTC 48,711 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5693],{31438:function(e,t,a){"use strict";a.d(t,{W:function(){return request}});var r=a(90849),o=a(55732);function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach(function(t){(0,r.Z)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function _graphqlFetch(){return(_graphqlFetch=(0,o.Z)(function*(e,t){var{operation:a,variables:r,fetchOptions:o}=t,n=a.__meta__;if(!(null!=n&&n.operationName)||!(null!=n&&n.operationHash))return{errors:[{message:"Missing GraphQL operation metadata"}]};var{operationName:l,operationHash:i}=n,s=(null==o?void 0:o.method)!==void 0?o.method.toUpperCase():l.endsWith("Query")?"GET":"POST",c=new URLSearchParams(_objectSpread({operationName:l,operationHash:i},"GET"===s&&{variables:JSON.stringify(r)})),d="POST"===s?JSON.stringify({operationName:l,operationHash:i,variables:r}):void 0,u=yield fetch("".concat(e,"?").concat(c),_objectSpread(_objectSpread({method:s,body:d},o),{},{headers:_objectSpread(_objectSpread({},"POST"===s?{"Content-Type":"application/json"}:{}),null==o?void 0:o.headers)}));return u.ok?u.json():{errors:[{status:u.status,message:u.statusText}]}})).apply(this,arguments)}function request(e,t,a){return _request.apply(this,arguments)}function _request(){return(_request=(0,o.Z)(function*(e,t,a){var{data:r,errors:o}=yield function(e,t){return _graphqlFetch.apply(this,arguments)}("/api/graphql",{operation:e,variables:t,fetchOptions:a});if(null!=o&&o.length)throw o[0];return r})).apply(this,arguments)}},67538:function(e,t,a){"use strict";a.d(t,{CL:function(){return r},Do:function(){return getOAuthLoginUrl},b5:function(){return n},pe:function(){return dispatchLoginSuccessEvent},vT:function(){return o},y2:function(){return mapInitialStep}});var r="hrg:login-headless-modal",o="hrg:login-headless-success",n="hrg:login-headless-logout";function dispatchLoginSuccessEvent(e){window.dispatchEvent(new CustomEvent(o,{detail:e}))}function mapInitialStep(e){switch(e){case"access-key":return"accessKeyEmail";case"password":return"password";default:return"options"}}function getOAuthLoginUrl(e,t){var a=window.location.origin,r=encodeURIComponent(t),o=encodeURIComponent(e);return"".concat(a,"/login?returnUrl=").concat(r,"&oAuthRedirect=").concat(o)}},95693:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eS}});var r=a(90849),o=a(27378),n=a(65218),l=a.n(n),i=a(63424),s=a(65597),c=a(36623),d=a.n(c),u=a(24246),v=(0,o.memo)(e=>{var{states:t,cities:a,neighborhoods:r,selectedState:o,selectedCity:n,selectedNeighborhood:l,loadingStates:i,loadingCities:c,loadingNeighborhoods:v,onSelectState:p,onSelectCity:h,onSelectNeighborhood:m}=e,g=t.map(e=>({value:e.acronym,label:e.descritive})),f=a.map(e=>({value:e.acronym,label:e.descritive})),y=r.map(e=>({value:e.acronym,label:e.descritive}));return(0,u.jsxs)("div",{className:d().filters,children:[(0,u.jsx)(s.Z,{variant:"searchable",placeholder:"Estado",searchPlaceholder:"Busque o estado",options:g,value:o,loading:i,showAll:!0,onChange:e=>p(e.value)}),(0,u.jsx)(s.Z,{variant:"searchable",placeholder:"Cidade",searchPlaceholder:"Busque a cidade",options:f,value:n,disabled:!o,loading:!!o&&c,showAll:!0,onChange:e=>h(e.value)}),(0,u.jsx)(s.Z,{variant:"searchable",placeholder:"Bairro",searchPlaceholder:"Busque o bairro",options:y,value:l,disabled:!n,loading:!!n&&v,showAll:!0,onChange:e=>m(e.value)})]})}),p=a(5106);function toRad(e){return e*Math.PI/180}function calcularDistancia(e,t,a,r){var o=toRad(a-e),n=toRad(r-t),l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(toRad(e))*Math.cos(toRad(a))*Math.sin(n/2)*Math.sin(n/2);return 6371*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}function formatarDistancia(e){return e<1?"".concat(Math.round(1e3*e)," m"):"".concat(e.toFixed(1).replace(".",",")," km")}var h=a(83839),m=a(62766),g=a(69645),f=a(55732),y=a(90832),j=a(6806),_=["VtexIdclientAutCookie_hering","VtexIdclientAutCookie","VtexIdClientAutCookie_hering","VtexIdClientAutCookie"];function getVtexAuthToken(){for(var e of _){var t=(0,j.ej)(e);if(t)return t}return null}var x=a(26545);function navigateToTurboStore(e){var t=function(e){if(!e.sellerId)return null;var t={sellerId:e.sellerId}
1,a=(0,x.m)(t,"/todos-produtos?productclusterids=137"),r=new URL(a,window.location.origin);return e.cep&&r.searchParams.set("zipcode",e.cep.replace(/\D/g,"")),r.href}(e);t&&window.open(t,"_self")}var b=a(9377),S=b.EF,C=b.M5,N=b.yw;function getGraphQLOperationResult(e,t){if(e&&"object"==typeof e){if(e.data&&"object"==typeof e.data){var a=e.data[t];if(a&&"object"==typeof a)return a}var r=e[t];if(r&&"object"==typeof r)return r}}function isFavoriteMutationSuccessful(e,t){var a=getGraphQLOperationResult(e,t);return(null==a?void 0:a.success)===!0}function redirectToLogin(e,t){if(t){t(e);return}var a=new URL(window.location.href);a.searchParams.set("favoriteStore",e.sellerId);var r=encodeURIComponent(a.pathname+a.search);window.location.href="/login?returnUrl=".concat(r)}function useStoreLocatorCard(e){var t,a,r,{store:n,autoFavorite:l=!1,whatsAppDefaultMessage:i,onFavoriteLoginRedirect:s,onFavoriteToggled:c}=e,d=null!==(a=getVtexAuthToken())&&void 0!==a?a:"",{0:u,1:v}=(0,o.useState)(null!==(r=n.favorited)&&void 0!==r&&r),{0:p,1:m}=(0,o.useState)(!1),[g]=(0,y.t)(S,{sellerId:"",token:""}),[j]=(0,y.t)(C,{sellerId:"",token:""}),[_]=(0,y.t)(N,{token:null}),x=(0,o.useCallback)((0,f.Z)(function*(){var e;return(null==(e=getGraphQLOperationResult((yield _({token:d||null})),"getFavoriteStore"))?void 0:e.isAuthenticated)===!0}),[_,d]);(0,o.useEffect)(()=>{if(l&&!u&&!p){var e;(e=(0,f.Z)(function*(){m(!0);try{if(!(yield x()))return;var e=yield g({sellerId:n.sellerId,token:d});if(!isFavoriteMutationSuccessful(e,"favoriteStore"))return;v(!0),null==c||c(n,!0)}finally{m(!1);var t=new URL(window.location.href);t.searchParams.delete("favoriteStore"),window.history.replaceState(null,"",t.toString())}}),function(){return e.apply(this,arguments)})()}},[l]);var b=(0,o.useCallback)(()=>{if(n.whatsapp){(0,h.L)({componentName:"store-locator-click-whatsapp",actionName:n.nomeLoja});var e=n.whatsapp.replace(/\D/g,""),t="https://api.whatsapp.com/send?phone=55".concat(e),a=i?"".concat(t,"&text=").concat(encodeURIComponent(i)):t;window.open(a,"_blank")}},[n.whatsapp,n.nomeLoja,i]),w=(0,o.useCallback)(()=>{n.sellerId&&((0,h.L)({componentName:"store-locator-click-omni",actionName:n.nomeLoja}),navigateToTurboStore(n))},[n]);return{isFavorited:u,isFavoriting:p,handleWhatsApp:b,handleOnlineStore:w,handleRetireAtStore:(0,o.useCallback)(()=>{n.sellerId&&((0,h.L)({componentName:"store-locator-click-retire",actionName:n.nomeLoja}),navigateToTurboStore(n))},[n]),handleNavigate:(0,o.useCallback)(()=>{(0,h.L)({componentName:"store-locator-click-navigate",actionName:n.nomeLoja});var e,t=n.latitude,a=n.longitude,r=t?parseFloat(t.replace(",",".")):NaN,o=a?parseFloat(a.replace(",",".")):NaN;if(isNaN(r)||isNaN(o)){var l=[n.rua,n.bairro,n.cidade,n.estado].filter(Boolean).join(", ");e="https://www.google.com/maps/search/?api=1&query=".concat(encodeURIComponent(l))}else e="https://www.google.com/maps/dir/?api=1&destination=".concat(r,",").concat(o);window.open(e,"_blank","noopener,noreferrer")},[n.nomeLoja,n.latitude,n.longitude,n.rua,n.bairro,n.cidade,n.estado]),toggleFavorite:(0,o.useCallback)((t=(0,f.Z)(function*(e){if(e.stopPropagation(),n.lojaFavoritavel&&!p){m(!0);try{if(!(yield x())){redirectToLogin(n,s);return}if(u){var t=yield j({sellerId:n.sellerId,token:d});if(!isFavoriteMutationSuccessful(t,"unfavoriteStore")){redirectToLogin(n,s);return}(0,h.L)({componentName:"store-locator-unfavorite-store",actionName:n.nomeLoja}),v(!1),null==c||c(n,!1);return}var a=yield g({sellerId:n.sellerId,token:d});if(!isFavoriteMutationSuccessful(a,"favoriteStore")){redirectToLogin(n,s);return}(0,h.L)({componentName:"store-locator-favorite-store",actionName:n.nomeLoja}),v(!0),null==c||c(n,!0)}catch(e){var r,o,l=null!==(r=null==e?void 0:null===(o=e.response)||void 0===o?void 0:o.status)&&void 0!==r?r:null==e?void 0:e.status;(401===l||403===l)&&redirectToLogin(n,s)}finally{m(!1)}}}),function(e){return t.apply(this,arguments)}),[n,p,u,d,x,g,j,s,c])}}var w=a(75406),L=a.n(w),k=(0,o.memo)(e=>{var t,{store:a,isSelected:r,autoFavorite:o=!1,distanceKm:n,showNavigateButton:l=!0,showWhatsAppButton:s=!0,whatsAppDefaultMessage:c,onSelect:d,onFavoriteLoginRedirect:v,onFavoriteToggled:f,forceMobileLayout:y=!1,showOnlineStoreButton:j=!1}=e,{isFavorited:_,isFavoriting:x,handleWhatsApp:b,handleOnlineStore:S,handleNavigate:C,toggleFavorite:N}=useStoreLocatorCard({store:a,autoFavorite:o,whatsAppDefaultMessage:c,onFavoriteLoginRedirect:v,onFavoriteToggled:f}),w=null!==(t=a.rua)&&void 0!==t?t:"",k=[a.bairro,a.cidade].filter(
1Boolean).join(", "),I=a.whatsapp&&"-"!==a.whatsapp,P=a.telefone&&"-"!==a.telefone;return(0,u.jsxs)("article",{className:L().card,"data-store-card-selected":r,"data-store-card-mobile-layout":y,onClick:()=>{(0,h.L)({componentName:"store_locator_card_selection",actionName:a.nomeLoja}),d(a)},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"===e.key&&((0,h.L)({componentName:"store_locator_card_selection",actionName:a.nomeLoja}),d(a))},"aria-label":"Loja ".concat(a.nomeLoja),children:[(0,u.jsxs)("div",{className:L().cardTop,children:[(0,u.jsxs)("div",{className:L().cardMeta,children:[(0,u.jsx)(i.Z,{text:a.nomeLoja,variant:"subtitle04",heading:"h3"}),null!=n&&(0,u.jsx)("span",{className:L().distanceBadge,children:formatarDistancia(n)})]}),a.lojaFavoritavel&&(0,u.jsx)("button",{type:"button",className:L().favoriteBtn,onClick:N,"aria-label":_?"Remover dos favoritos":"Favoritar loja",disabled:x,children:x?(0,u.jsx)(g.Z,{size:20,color:"var(--color-neutral-900)"}):(0,u.jsx)(p.Z,{name:_?"heartFilled":"heart",color:"var(--color-neutral-900)",scale:1})})]}),(0,u.jsx)("hr",{className:L().divider}),(0,u.jsxs)("div",{className:L().cardBody,children:[(0,u.jsxs)("div",{className:L().infoCol,children:[(w||k)&&(0,u.jsxs)("div",{className:L().infoBlock,children:[w&&(0,u.jsx)(i.Z,{text:w,variant:"description"}),k&&(0,u.jsx)(i.Z,{text:k,variant:"description"})]}),P&&(0,u.jsx)(i.Z,{text:"Telefone: ".concat(a.telefone),variant:"description"}),a.openingHours.length>0&&(0,u.jsx)("div",{className:L().infoBlock,children:a.openingHours.map((e,t)=>(0,u.jsx)(i.Z,{text:e,variant:"description"},t))})]}),(0,u.jsxs)("div",{className:L().actionsCol,children:[j&&(0,u.jsx)(m.Z,{variant:"primary",size:"small",onClick:e=>{e.stopPropagation(),S()},children:"Comprar na loja online"}),s&&I&&(0,u.jsx)("div",{className:L().whatsappBtnWrapper,children:(0,u.jsxs)(m.Z,{variant:"secondary",size:"small",onClick:e=>{e.stopPropagation(),b()},children:[(0,u.jsx)(p.Z,{name:"whatsapp"}),"Comprar pelo Whatsapp"]})}),l&&(0,u.jsx)("div",{className:L().navigateBtnWrapper,children:(0,u.jsxs)(m.Z,{variant:"secondary",size:"small",onClick:e=>{e.stopPropagation(),C()},children:[(0,u.jsx)(p.Z,{name:"mapTrifold"}),"Como chegar"]})})]})]})]})}),I=a(30486),P=a.n(I),F={cardLocator:()=>(0,u.jsxs)("div",{className:P().skeleton,"aria-hidden":"true",children:[(0,u.jsxs)("div",{className:P().cardTop,children:[(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().title)}),(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().heart)})]}),(0,u.jsx)("hr",{className:P().divider}),(0,u.jsxs)("div",{className:P().cardBody,children:[(0,u.jsxs)("div",{className:P().infoCol,children:[(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().line," ").concat(P().lineLong)}),(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().line," ").concat(P().lineMedium)}),(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().line," ").concat(P().lineShort)})]}),(0,u.jsxs)("div",{className:P().actionsCol,children:[(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().btn)}),(0,u.jsx)("div",{className:"".concat(P().shimmer," ").concat(P().btn)})]})]})]})},skeleton=e=>{var{variant:t}=e,a=F[t];return(0,u.jsx)(a,{})},Z=(0,o.memo)(()=>(0,u.jsx)(skeleton,{variant:"cardLocator"})),O=a(76536),A=a.n(O),B=(0,o.memo)(e=>{var{stores:t,selectedStore:a,selectedCity:r,selectedState:o,loading:n,favoriteTargetSellerId:l,userLat:s,userLng:c,showNavigateButton:d=!0,showWhatsAppButton:v=!0,whatsAppDefaultMessage:h,onSelectStore:m,onFavoriteStoreChange:g,hasStoreProducts:f}=e;return n?(0,u.jsx)("div",{className:A().list,"aria-busy":"true","aria-label":"Buscando lojas...",children:Array.from({length:3}).map((e,t)=>(0,u.jsx)(Z,{},t))}):o&&r?t.length?(0,u.jsx)("div",{className:A().list,children:t.map(e=>{var t,r=e.latitude?parseFloat(e.latitude.replace(",",".")):NaN,o=e.longitude?parseFloat(e.longitude.replace(",",".")):NaN,n=null==s||null==c||isNaN(r)||isNaN(o)?void 0:calcularDistancia(s,c,r,o);return(0,u.jsx)(k,{store:e,isSelected:(null==a?void 0:a.nomeLoja)===e.nomeLoja&&(null==a?void 0:a.cep)===e.cep,autoFavorite:!!(l&&e.sellerId===l),distanceKm:n,showNavigateButton:d,showWhatsAppButton:v,whatsAppDefaultMessage:h,onSelect:m,onFavoriteToggled:g,showOnlineStoreButton:null!==(t=null==f?void 0:f(e))&&void 0!==t&&t},e.sellerId||"".concat(e.nomeLoja,"-").concat(e.telefone))})}):(0,u.jsxs)("div",{className:A().stateMessage,children:[(0,u.jsx)(p.Z,{name:"noLocation",color:"var(--color-neutral-300)",scale:1.5}),(0,u.jsx)(i.Z,{text:"Nenhuma loja encontrada para a localiza\xe7\xe3o selecionada.",variant:"description",color:"var(--color-neutral-400)",align:"center"})]}):(0,u.jsxs)("div",{className:A().stateMessage,children:[(0,u.jsx)(p.Z,{name:"storefront",color:"var(--color-neutral-300)",scale:1.5}),(0,u.jsx)(i.Z,{text:"Selecione um estado e uma cidade para ver as lojas dispon\xedveis.",variant:"description",color:"var(--color-neutral-400)",align:"center"})]})}),T=a(86677),R=a(43179),M=b.Rk,E=b.rr,D=b.E1,U=b.lq;function useGeolocation(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],{0:t,1:a}=(0,o.useState)(null),{0:r,1:n}=(0,o.useState)(null),{0:l,1:i}=(0,o.useState)("idle");return(0,o.useEffect)(()=>
1{if(e){if("undefined"==typeof navigator||!navigator.geolocation){i("unavailable");return}i("requesting"),navigator.geolocation.getCurrentPosition(e=>{a(e.coords.latitude),n(e.coords.longitude),i("granted")},()=>{i("denied")},{timeout:1e4,maximumAge:6e4})}},[e]),{userLat:t,userLng:r,status:l}}var V=a(67538),q="@hrg:store-locator-favorite";function isRecord(e){return"object"==typeof e&&null!==e}function readFavoriteStoreCache(e){if(!e)return null;var t=localStorage.getItem(q);if(!t)return null;try{var a=JSON.parse(t);if(isRecord(a)&&"string"==typeof a.nomeLoja&&"string"==typeof a.sellerId||!isRecord(a)||"string"!=typeof a.authKey||"boolean"!=typeof a.hasFavoriteStore||null!==a.sellerId&&"string"!=typeof a.sellerId||null!==a.store&&("object"!=typeof a.store||null===a.store)||"number"!=typeof a.expiresAt||a.authKey!==e||!a.expiresAt||Date.now()>=a.expiresAt)return localStorage.removeItem(q),null;return a}catch(e){return localStorage.removeItem(q),null}}function writeFavoriteStoreCache(e,t){if(e){var a={authKey:e,hasFavoriteStore:t.hasFavoriteStore,sellerId:t.sellerId,store:t.store,expiresAt:Date.now()+1728e5};localStorage.setItem(q,JSON.stringify(a))}}function clearFavoriteStoreCache(){localStorage.removeItem(q)}function updateFavoriteStoreCacheOnToggle(e,t,a){if(e){if(a){writeFavoriteStoreCache(e,{hasFavoriteStore:!0,sellerId:t.sellerId,store:t});return}var r=readFavoriteStoreCache(e);null!=r&&r.sellerId&&r.sellerId!==t.sellerId||clearFavoriteStoreCache()}}function readStringField(e,t){for(var a of t){var r=e[a];if("string"==typeof r&&r.length>0)return r}return""}function useFavoriteStore(){var e,t,{enabled:a=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(e=getVtexAuthToken())&&void 0!==e?e:"session",n=(0,o.useRef)(!1),{0:l,1:i}=(0,o.useState)(!0),{0:s,1:c}=(0,o.useState)(null),{0:d,1:u}=(0,o.useState)(0);(0,o.useEffect)(()=>{var handleAuthChange=()=>{clearFavoriteStoreCache(),i(!1),u(e=>e+1)};return window.addEventListener(V.vT,handleAuthChange),window.addEventListener(V.b5,handleAuthChange),()=>{window.removeEventListener(V.vT,handleAuthChange),window.removeEventListener(V.b5,handleAuthChange)}},[]),(0,o.useEffect)(()=>{if(!a){c(null),i(!0);return}var e=readFavoriteStoreCache(r);if(e){n.current=!0,c(e.hasFavoriteStore&&e.store?e.store:null),i(!0);return}i(!1)},[a,r,d]);var v=a&&!l,{data:p}=(0,R.aM)(N,{token:null!==(t=getVtexAuthToken())&&void 0!==t?t:null},{revalidateIfStale:!1,doNotRun:!v});return(0,o.useEffect)(()=>{if(a&&!l&&null!=p&&p.getFavoriteStore){var e,t,o=p.getFavoriteStore;if(!o.isAuthenticated){n.current&&clearFavoriteStoreCache(),n.current=!1,c(null),i(!0);return}n.current=!0;var s=function(e,t){if(!e||"object"!=typeof e)return null;var a=readStringField(e,["sellerId"])||t||"",r=readStringField(e,["nomeLoja","nome","name"]);if(!a&&!r)return null;var o=Array.isArray(e.openingHours)?e.openingHours.filter(e=>"string"==typeof e):[];return{nomeLoja:r,lojaFavoritavel:"boolean"!=typeof e.lojaFavoritavel||e.lojaFavoritavel,favorited:"boolean"!=typeof e.favorited||e.favorited,isTurbo:"boolean"==typeof e.isTurbo&&e.isTurbo,sellerId:a,whatsapp:readStringField(e,["whatsapp"]),telefone:readStringField(e,["telefone"]),latitude:readStringField(e,["latitude"]),longitude:readStringField(e,["longitude"]),cep:readStringField(e,["cep"]),estado:readStringField(e,["estado"]),cidade:readStringField(e,["cidade"]),bairro:readStringField(e,["bairro"]),rua:readStringField(e,["rua"]),openingHours:o}}(o.store,o.sellerId);if(o.hasFavoriteStore){writeFavoriteStoreCache(r,{hasFavoriteStore:!0,sellerId:null!==(e=null!==(t=o.sellerId)&&void 0!==t?t:null==s?void 0:s.sellerId)&&void 0!==e?e:null,store:s}),c(s),i(!0);return}o.message&&writeFavoriteStoreCache(r,{hasFavoriteStore:!1,sellerId:null,store:null}),c(null),i(!0)}},[a,p,l,r]),{favoriteStore:s,handleFavoriteStoreChange:(0,o.useCallback)((e,t)=>{if(t){updateFavoriteStoreCacheOnToggle(r,e,!0),c(e),i(!0);return}updateFavoriteStoreCacheOnToggle(r,e,!1),c(null),i(!0)},[r])}}var W=a(31438),z=a(80816),H=a(93783);function normalizeStoreCep(e){return e.replace(/\D/g,"")}function buildStoreAvailabilityKey(e){return"".concat(e.sellerId,":").concat(normalizeStoreCep(e.cep))}function filterStoresForAvailabilityCheck(e){return e.filter(e=>{var t;return!!e.sellerId&&8===normalizeStoreCep(null!==(t=e.cep)&&void 0!==t?t:"").length})}
1function _fetchHasProductsViaIntelligentSearch(){return(_fetchHasProductsViaIntelligentSearch=(0,f.Z)(function*(e,t){var a,r,o,n,l,i=yield(0,W.W)(z.r,{facets:[{map:"shipping",query:"pickup-in-point"},{map:"pickupPoint",query:(a=e.sellerId,"".concat(a).concat(a.replace("hering","_")))}],page:[1],count:1,sort:"",skipFilter:!0,paginationType:"numeric",zipCode:t});return(null!==(r=null==i?void 0:null===(o=i.getListOfProducts)||void 0===o?void 0:null===(n=o.search)||void 0===n?void 0:null===(l=n.products)||void 0===l?void 0:l.length)&&void 0!==r?r:0)>0})).apply(this,arguments)}function _fetchHasProductsViaPickupPointSearch(){return(_fetchHasProductsViaPickupPointSearch=(0,f.Z)(function*(e,t){var a,r,o=yield(0,W.W)(H.d,{facets:[{map:"trade-policy",query:"1"}],page:[1],count:100,sort:"",skipFilter:!0,paginationType:"numeric",zipCode:t});return(null!==(a=null==o?void 0:null===(r=o.getPickupPointSearch)||void 0===r?void 0:r.pickupPointDistances)&&void 0!==a?a:[]).some(t=>{var a;return(null!==(a=t.pickupId.split("_")[0])&&void 0!==a?a:"")===e.sellerId})})).apply(this,arguments)}function _fetchStoreHasProductsAtCep(){return(_fetchStoreHasProductsAtCep=(0,f.Z)(function*(e){var t,a=normalizeStoreCep(null!==(t=e.cep)&&void 0!==t?t:"");if(!e.sellerId||8!==a.length)return!1;try{if(yield function(e,t){return _fetchHasProductsViaIntelligentSearch.apply(this,arguments)}(e,a))return!0}catch(e){}try{return yield function(e,t){return _fetchHasProductsViaPickupPointSearch.apply(this,arguments)}(e,a)}catch(e){return!1}})).apply(this,arguments)}function useStoreProductsAvailability(e){var{0:t,1:a}=(0,o.useState)({}),{0:r,1:n}=(0,o.useState)(!1),l=(0,o.useRef)(0),i=(0,o.useRef)(e);i.current=e;var s=filterStoresForAvailabilityCheck(e).map(buildStoreAvailabilityKey).sort().join("|");return(0,o.useEffect)(()=>{if(!s){a(e=>Object.keys(e).length?{}:e),n(!1);return}var e,t,r,o=(e=i.current,t=new Set,filterStoresForAvailabilityCheck(e).filter(e=>{var a=buildStoreAvailabilityKey(e);return!t.has(a)&&(t.add(a),!0)})),c=++l.current,d=!1;return(r=(0,f.Z)(function*(){n(!0);var e,t={};yield Promise.all(o.map((e=(0,f.Z)(function*(e){var a=buildStoreAvailabilityKey(e),r=yield function(e){return _fetchStoreHasProductsAtCep.apply(this,arguments)}(e);d||c!==l.current||(t[a]=r)}),function(t){return e.apply(this,arguments)}))),d||c!==l.current||(a(t),n(!1))}),function(){return r.apply(this,arguments)})(),()=>{d=!0}},[s]),{hasStoreProducts:(0,o.useCallback)(e=>{var a;return!!e.sellerId&&8===normalizeStoreCep(null!==(a=e.cep)&&void 0!==a?a:"").length&&!0===t[buildStoreAvailabilityKey(e)]},[t]),isValidatingStoreProducts:r}}function getUrlParam(e,t){var a=e[t];return"string"==typeof a?a:""}function updateUrlParams(e){var t=new URL(window.location.href);Object.entries(e).forEach(e=>{var[a,r]=e;r?t.searchParams.set(a,r):t.searchParams.delete(a)}),window.history.replaceState(null,"",t.toString())}var K="storeLocatorWidget",G="storeLocatorWidgetOpen",J=a(42791),Q=a(97818);function isStoreSegmentationActive(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return!e&&t.length>0}var X=a(38579),Y=a.n(X),$=a(47224),ee=a.n($),et=a(22269),ea=a.n(et),er=(0,o.memo)(e=>{var{title:t,description:a,ctaLabel:r,cardIconImage:n,onClick:l}=e;return(0,u.jsxs)("div",{className:"".concat(ee().trigger," ").concat(ea().trigger),onClick:l,role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&l()},"aria-label":r,children:[(0,u.jsxs)("div",{className:ee().main,children:[n?(0,u.jsx)("div",{className:ee().iconWrapper,children:(0,u.jsx)(Y(),{src:n,alt:"",fill:!0,"data-store-locator-widget-card-icon":!0})}):(0,u.jsx)(o.Fragment,{}),(0,u.jsxs)("div",{className:ee().content,children:[(0,u.jsx)(i.Z,{text:t,variant:"title03",heading:"h3"}),(0,u.jsx)(i.Z,{text:a,variant:"subtitle02",color:"var(--color-neutral-600)"})]})]}),(0,u.jsx)("div",{className:ee().actions,children:(0,u.jsx)("div",{className:ee().primaryButtonWrapper,children:(0,u.jsx)(m.Z,{type:"button",variant:"primary",size:"medium",full:!0,onClick:e=>{e.stopPropagation(),l()},children:(0,u.jsx)(i.Z,{text:r,variant:"subtitle02",color:"var(--color-neutral-50)"})})})})]})}),eo=(0,o.memo)(e=>{var{store:t,title:a,retireLabel:r,findOthersLabel:n,cardIconImage:l,onRetire:s,onOpenFavoriteStoreListing:c,onFindOthers:d,showRetireButton:v=!1}=e;return(0,u.jsxs)("div",{className:ee().trigger,children:[(0,u.jsxs)("div",{className:ee().main,children:[l?(0,u.jsx)("div",{className:ee().iconWrapper,children:(0,u.jsx)(Y(),{src:l,alt:"",fill:!0,"data-store-locator-widget-card-icon":!0})}):(0,u.jsx)(o.Fragment,{}),(0,u.jsxs)("div",{className:ee().content,children:[(0,u.jsx)(i.Z,{text:a,variant:"title03",heading:"h3"}),(0,u.jsx)(m.Z,{type:"button",variant:"neutral",className:ee().textLink,onClick:e=>{e.stopPropagation(),c()},"aria-label":t.nomeLoja,arrow:{position:"right",scale:.7,name:"caretRight",color:"var(--color-neutral-900)"},children:(0,u.jsx)(i.Z,{text:t.nomeLoja,variant:"subtitle02",decoration:"underline"})})]})]}),(0,u.jsxs)("div",{className:ee().actions,children:[v&&(0,u.jsx)("div",{className:ee().primaryButtonWrapper,children:(0,u.jsx)(m.Z,{type:"button",variant:"primary",size:"medium",full:!0,onClick:e=>{e.stopPropagation(),s()},children:(0,u.jsx)(i.Z,{text:r,variant:"subtitle02",color:"var(--color-neutral-50)"})})}),(0,u.jsx)(m.Z,{type:"button",variant:"neutral",className:ee().textLink,onClick:e=>{e.stopPropagation(),d()},children:(0,u.jsx)(i.Z,{text:n,variant:"subtitle02",decoration:"underline"})})]})]})}),en=a(12279),el=a(16323),ei=a(19376),es=a(35225),ec=a.n(es),ed=(0,o.memo)(e=>{var t,{store:a,isSelected:r,autoFavorite:n=!1,distanceKm:l,showNavigateButton:s=!0,showWhatsAppButton:c=!0,whatsAppDefaultMessage:d,retireLabel:v="Retirar gr\xe1tis na loja",onSelect:f,onFavoriteLoginRedirect:y,onFavoriteToggled:j,showOnlineStoreButton:_=!1}=e,{isFavorited:x,isFavoriting:b,handleWhatsApp:S,handleRetireAtStore:C,handleNavigate:N,toggleFavorite:w}=useStoreLocatorCard({store:a,autoFavorite:n,whatsAppDefaultMessage:d,onFavoriteLoginRedirect:y,onFavoriteToggled:j}),L=null!==(t=a.rua)&&void 0!==t?t:"",k=[a.bairro,a.cidade].filter(
1Boolean).join(", "),I=a.whatsapp&&"-"!==a.whatsapp,P=a.telefone&&"-"!==a.telefone,F=(0,o.useCallback)(()=>{(0,h.L)({componentName:"store_locator_card_selection",actionName:a.nomeLoja}),f(a)},[f,a]);return(0,u.jsxs)("article",{className:ec().card,"data-store-card-selected":r,onClick:F,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"===e.key&&F()},"aria-label":"Loja ".concat(a.nomeLoja),children:[(0,u.jsxs)("div",{className:ec().cardTop,children:[(0,u.jsxs)("div",{className:ec().cardMeta,children:[(0,u.jsx)(i.Z,{text:a.nomeLoja,variant:"subtitle04",heading:"h3"}),null!=l&&(0,u.jsx)("span",{className:ec().distanceBadge,children:formatarDistancia(l)})]}),a.lojaFavoritavel&&(0,u.jsx)("button",{type:"button",className:ec().favoriteBtn,onClick:w,"aria-label":x?"Remover dos favoritos":"Favoritar loja",disabled:b,children:b?(0,u.jsx)(g.Z,{size:20,color:"var(--color-neutral-900)"}):(0,u.jsx)(p.Z,{name:x?"heartFilled":"heart",color:"var(--color-neutral-900)",scale:1})})]}),(0,u.jsx)("hr",{className:ec().divider}),(0,u.jsxs)("div",{className:ec().cardBody,children:[!!(L||k)&&(0,u.jsxs)("div",{className:ec().infoRow,children:[(0,u.jsxs)("div",{className:ec().infoContent,children:[L&&(0,u.jsx)(i.Z,{text:L,variant:"description"}),k&&(0,u.jsx)(i.Z,{text:k,variant:"description"})]}),s&&(0,u.jsx)("button",{type:"button",className:ec().sideIconBtn,onClick:e=>{e.stopPropagation(),N()},"aria-label":"Como chegar",children:(0,u.jsx)(p.Z,{name:"mapTrifold",color:"var(--color-neutral-500)",scale:1})})]}),P&&(0,u.jsxs)("div",{className:ec().infoRow,children:[(0,u.jsx)(i.Z,{text:"Telefone: ".concat(a.telefone),variant:"description"}),c&&I&&(0,u.jsx)("button",{type:"button",className:ec().sideIconBtn,onClick:e=>{e.stopPropagation(),S()},"aria-label":"Comprar pelo WhatsApp",children:(0,u.jsx)(p.Z,{name:"whatsapp",color:"var(--color-neutral-500)",scale:1})})]}),a.openingHours.length>
10&&(0,u.jsx)("div",{className:ec().hoursBlock,children:a.openingHours.map((e,t)=>(0,u.jsx)(i.Z,{text:e,variant:"description"},t))})]}),_&&(0,u.jsx)("div",{className:ec().cardFooter,children:(0,u.jsx)(m.Z,{type:"button",variant:"primary",size:"large",full:!0,onClick:e=>{e.stopPropagation(),C()},children:v})})]})}),eu=a(6674),ev=a.n(eu),ep="Estado",eh="Cidade",em="Bairro",eg=(0,o.memo)(e=>{var{states:t,cities:a,neighborhoods:r,stores:n,draftState:l,draftCity:c,draftNeighborhood:d,drawerView:v,loadingStates:h,loadingCities:g,loadingNeighborhoods:f,loadingStores:y,canSearch:j,pendingFavoriteSellerId:_,userLat:x,userLng:b,drawerTitle:S,selectionDescription:C,resultsDescription:N,findStoresLabel:w,emptyTitle:L,emptyDescription:k,emptyCtaLabel:I,showNavigateButton:P=!0,showWhatsAppButton:F=!0,whatsAppDefaultMessage:O,retireLabel:A="Retirar gr\xe1tis na loja",onSelectState:B,onSelectCity:T,onSelectNeighborhood:R,onSearch:M,onReset:E,onClose:D,onFavoriteStoreChange:U,onFavoriteLoginRedirect:V,onPendingFavoriteExecuted:q,hasStoreProducts:W}=e,{pushToast:z,popToast:H}=(0,en.l8)(),K=t.map(e=>({value:e.acronym,label:e.descritive})),G=a.map(e=>({value:e.acronym,label:e.descritive})),J=r.map(e=>({value:e.acronym,label:e.descritive})),Q=(0,o.useCallback)((e,t)=>{U(e,t);var a=t?"Loja adicionada as favoritas":"Loja removida das favoritas";(0,el.Z)({message:a,status:"INFO",pushToast:z,popToast:H}),t&&e.sellerId===_&&q()},[U,z,H,_,q]),X="results"===v&&!y&&0===n.length,Y="results"===v&&!y&&n.length>0;return(0,u.jsxs)("div",{className:ev().content,children:[(0,u.jsxs)("div",{className:ev().body,children:[(0,u.jsx)(ei.Z,{title:S,toggle:D}),(0,u.jsx)(i.Z,{text:"results"===v?N:C,variant:"description",color:"var(--color-neutral-600)",className:ev().description}),"selection"===v&&(0,u.jsxs)("div",{className:ev().fields,children:[(0,u.jsx)(s.Z,{variant:"searchableInline",placeholder:ep,searchPlaceholder:"Digite o ".concat(ep.toLowerCase()),options:K,value:l,loading:h,showAll:!0,fillAvailableHeight:!0,onChange:e=>B(e.value)}),l&&(0,u.jsx)(s.Z,{variant:"searchableInline",placeholder:eh,searchPlaceholder:"Digite a ".concat(eh.toLowerCase()),options:G,value:c,loading:g,showAll:!0,fillAvailableHeight:!0,onChange:e=>T(e.value)}),c&&(0,u.jsx)(s.Z,{variant:"searchableInline",placeholder:em,searchPlaceholder:"Digite o ".concat(em.toLowerCase()),options:J,value:d,loading:f,showAll:!0,fillAvailableHeight:!0,onChange:e=>R(e.value)})]}),"results"===v&&y&&(0,u.jsx)("div",{className:ev().storeList,children:Array.from({length:3}).map((e,t)=>(0,u.jsx)(Z,{},t))}),X&&(0,u.jsxs)("div",{className:ev().emptyState,children:[(0,u.jsx)(p.Z,{name:"noLocation",scale:2,color:"var(--color-neutral-300)"}),(0,u.jsx)(i.Z,{text:L,variant:"subtitle04",heading:"h3",align:"center"}),(0,u.jsx)(i.Z,{text:k,variant:"description",color:"var(--color-neutral-500)",align:"center"})]}),Y&&(0,u.jsx)("div",{className:ev().storeList,children:n.map(e=>{var t,a=e.latitude?parseFloat(e.latitude.replace(",",".")):NaN,r=e.longitude?parseFloat(e.longitude.replace(",",".")):NaN,o=null==x||null==b||isNaN(a)||isNaN(r)?void 0:calcularDistancia(x,b,a,r);return(0,u.jsx)(ed,{store:e,isSelected:!1,autoFavorite:!!(_&&e.sellerId===_),distanceKm:o,showNavigateButton:P,showWhatsAppButton:F,whatsAppDefaultMessage:O,retireLabel:A,onSelect:()=>{},onFavoriteToggled:Q,onFavoriteLoginRedirect:V,showOnlineStoreButton:null!==(t=null==W?void 0:W(e))&&void 0!==t&&t},e.sellerId||"".concat(e.nomeLoja,"-").concat(e.telefone))})})]}),("selection"===v||X)&&(0,u.jsx)("div",{className:ev().footer,children:X?(0,u.jsx)(m.Z,{type:"button",variant:"primary",size:"large",full:!0,onClick:E,children:I}):(0,u.jsx)(m.Z,{type:"button",variant:"primary",size:"large",full:!0,disabled:!j,onClick:M,children:w})})]})}),ef=a(82973),ey=a.n(ef),ej=(0,o.memo)(e=>{var{widgetId:t="store-locator-widget",isActive:a=!0,device:r,cardTitle:n="Encontre a loja mais pr\xf3xima da sua regi\xe3o",cardDescription:l="Veja os produtos das lojas da sua regi\xe3o e retire gr\xe1tis na loja dispon\xedvel.",cardCtaLabel:i="Localizar lojas",cardIconImage:s,favoriteCardTitle:c="Sua loja favorita",favoriteCardRetireLabel:d="Retirar gr\xe1tis na loja",favoriteCardFindOthersLabel:v="Localizar outras lojas",fallbackTitle:p="Encontre a loja mais pr\xf3xima da sua regi\xe3o",fallbackDescription:m="Sua loja favorita n\xe3o est\xe1 dispon\xedvel nesta sele\xe7\xe3o. Encontre outra loja.",fallbackCtaLabel:g="Localizar lojas",drawerTitle:f="Localizador de lojas",drawerSelectionDescription:y="Selecione a sua regi\xe3o para encontrar as lojas pr\xf3ximas de voc\xea.",drawerResultsDescription:j="Lojas encontradas pr\xf3ximo a sua regi\xe3o.",emptyTitle:_="Nenhuma loja foi encontrada",emptyDescription:x="N\xe3o encontramos nenhuma loja nesta regi\xe3o.",emptyCtaLabel:b="Encontrar lojas",findStoresLabel:S="Encontrar lojas",showAllStores:C=!0,stores:N=[],showDistance:w=!1,showNavigateButton:L=!0,showWhatsAppButton:k=!0,whatsAppDefaultMessage:I}=e,P=(0,T.useRouter)(),F=(0,o.useRef)(null),{isOpened:Z,open:O,toggle:A}=(0,Q.O)({blockScroll:!0}),{states:B,cities:V,neighborhoods:q,stores:W,draftState:z,draftCity:H,draftNeighborhood:X,drawerView:Y,favoriteStore:$,loadingStates:ee,loadingCities:et,loadingNeighborhoods:ea,loadingStores:en,userLat:el,userLng:ei,canSearch:es,pendingFavoriteSellerId:ec,handleSelectState:ed,handleSelectCity:eu,handleSelectNeighborhood:ev,handleSearch:ep,handleReset:eh,handleOpenFavoriteStoreListing:em,handleFavoriteStoreChange:ef,handleFavoriteLoginRedirect:ej,clearPendingFavorite:e_,hasStoreProducts:ex}=function(e){var{widgetId:t,isDrawerOpen:a=!1,showAllStores:r=!0,allowedSellerIds:n=[],showDistance:l=!1}=e,i=(0,T.useRouter)(),{userLat:s,userLng:c}=useGeolocation(l&&a),d=getVtexAuthToken(),{0:u,1:v}=(0,o.useState)(""),{0:p,1:h}=(0,o.useState)(""),{0:m,1:g}=(0,o.useState)(""),{0:f,1:y}=(0,o.useState)(""),{0:j,1:_}=(0,o.useState)(""),{0:x,1:b}=(0,o.useState)(""),{0:S,1:C}=(0,o.useState)("selection"),{0:N,1:w}=(0,o.useState)(""),L=isStoreSegmentationActive(r,n),{favoriteStore:k,handleFavoriteStoreChange:I}=useFavoriteStore({enabled:!L}
1);(0,o.useEffect)(()=>{if(i.isReady){var e=getUrlParam(i.query,K);if(e&&e===t){var a=getUrlParam(i.query,"estado"),r=getUrlParam(i.query,"cidade"),o=getUrlParam(i.query,"bairro"),n=getUrlParam(i.query,"favoriteStore");a&&v(a),r&&h(r),o&&g(o),a&&r&&(y(a),_(r),b(o),C("results")),n&&!L&&w(n)}}},[i.isReady,i.query,t,L]);var{data:P,isValidating:F}=(0,R.aM)(M,{},{revalidateIfStale:!1,doNotRun:!a}),Z=(0,o.useMemo)(()=>{var e,t;return(null!==(e=null==P?void 0:null===(t=P.getStoreLocatorChoosesStates)||void 0===t?void 0:t.states)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}})},[P]),{data:O,isValidating:A}=(0,R.aM)(E,{state:u},{revalidateIfStale:!1,doNotRun:!a||!u}),B=(0,o.useMemo)(()=>{var e,t;return u?(null!==(e=null==O?void 0:null===(t=O.getStoreLocatorChoosesCities)||void 0===t?void 0:t.cities)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}}):[]},[O,u]),{data:V,isValidating:q}=(0,R.aM)(D,{state:u,city:p},{revalidateIfStale:!1,doNotRun:!a||!u||!p}),W=(0,o.useMemo)(()=>{var e,t;return u&&p?(null!==(e=null==V?void 0:null===(t=V.getStoreLocatorChoosesNeighborhoods)||void 0===t?void 0:t.bairros)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}}):[]},[V,u,p]),{data:z,isValidating:H}=(0,R.aM)(U,{state:f,city:j,neighborhood:x||null,userToken:d},{revalidateIfStale:!1,doNotRun:!a||!f||!j}),J=(0,o.useMemo)(()=>{if(!f||!j)return[];var e,t,a=(null!==(e=null==z?void 0:null===(t=z.getStoreLocatorChoosesStores)||void 0===t?void 0:t.stores)&&void 0!==e?e:[]).map(e=>{var t,a,r,o,n,l,i,s,c,d,u,v,p,h,m;return{nomeLoja:null!==(t=e.nomeLoja)&&void 0!==t?t:"",lojaFavoritavel:null!==(a=e.lojaFavoritavel)&&void 0!==a&&a,favorited:null!==(r=e.favorited)&&void 0!==r&&r,isTurbo:null!==(o=e.isTurbo)&&void 0!==o&&o,sellerId:null!==(n=e.sellerId)&&void 0!==n?n:"",whatsapp:null!==(l=e.whatsapp)&&void 0!==l?l:"",telefone:null!==(i=e.telefone)&&void 0!==i?i:"",latitude:null!==(s=e.latitude)&&void 0!==s?s:"",longitude:null!==(c=e.longitude)&&void 0!==c?c:"",cep:null!==(d=e.cep)&&void 0!==d?d:"",estado:null!==(u=e.estado)&&void 0!==u?u:"",cidade:null!==(v=e.cidade)&&void 0!==v?v:"",bairro:null!==(p=e.bairro)&&void 0!==p?p:"",rua:null!==(h=e.rua)&&void 0!==h?h:"",openingHours:null!==(m=e.openingHours)&&void 0!==m?m:[]}}).filter(e=>!!e.nomeLoja),o=r||0===n.length?a:a.filter(e=>n.includes(e.sellerId)),l=L?null:null==k?void 0:k.sellerId;if(!l)return o;var i=o.findIndex(e=>e.sellerId===l);if(i<=0)return o;var s=[...o],[c]=s.splice(i,1);return s.unshift(c),s},[z,f,j,r,n,L,null==k?void 0:k.sellerId]),{hasStoreProducts:Q}=useStoreProductsAvailability((0,o.useMemo)(()=>!k||J.some(e=>e.sellerId===k.sellerId&&e.cep===k.cep)?J:[k,...J],[k,J])),X=!!(u&&p),Y=(0,o.useCallback)(e=>{v(e),h(""),g("")},[]),$=(0,o.useCallback)(e=>{h(e),g("")},[]),ee=(0,o.useCallback)(e=>{g(e)},[]),et=(0,o.useCallback)(()=>{u&&p&&(y(u),_(p),b(m),C("results"))},[u,p,m]);return{states:Z,cities:B,neighborhoods:W,stores:J,draftState:u,draftCity:p,draftNeighborhood:m,drawerView:S,favoriteStore:k,loadingStates:F,loadingCities:A,loadingNeighborhoods:q,loadingStores:H,userLat:s,userLng:c,canSearch:X,pendingFavoriteSellerId:N,handleSelectState:Y,handleSelectCity:$,handleSelectNeighborhood:ee,handleSearch:et,handleReset:(0,o.useCallback)(()=>{v(""),h(""),g(""),y(""),_(""),b(""),C("selection"),updateUrlParams({estado:null,cidade:null,bairro:null})},[]),handleOpenFavoriteStoreListing:(0,o.useCallback)(e=>{var{estado:t,cidade:a,bairro:r}=e;t&&a&&(v(t),h(a),g(null!=r?r:""),y(t),_(a),b(null!=r?r:""),C("results"))},[]),handleFavoriteStoreChange:I,handleFavoriteLoginRedirect:(0,o.useCallback)((e,a,r,o)=>{var n=new URL(window.location.href);n.searchParams.set("favoriteStore",e.sellerId),n.searchParams.set(K,t),n.searchParams.set(G,"1"),a?n.searchParams.set("estado",a):n.searchParams.delete("estado"),r?n.searchParams.set("cidade",r):n.searchParams.delete("cidade"),o?n.searchParams.set("bairro",o):n.searchParams.delete("bairro");var l=encodeURIComponent(n.pathname+n.search);window.location.href="/login?returnUrl=".concat(l)},[t]),clearPendingFavorite:(0,o.useCallback)(()=>{w(""),updateUrlParams({favoriteStore:null,[K]:null,[G]:null})},[]),hasStoreProducts:Q}}({widgetId:t,isDrawerOpen:Z,showAllStores:C,allowedSellerIds:N,showDistance:w}),eb=isStoreSegmentationActive(C,N),eS=!eb&&!!$&&(C||0===N.length||N.includes($.sellerId)),eC=!!(!eb&&$&&!eS);(0,o.useEffect)(()=>{P.isReady&&getUrlParam(P.query,K)===t&&"1"===getUrlParam(P.query,G)&&setTimeout(()=>{var e;null===(e=F.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"}),O(),updateUrlParams({[G]:null})},300)},[P.isReady,P.query,t,O]);var eN=(0,o.useCallback)(()=>{null!=$&&$.sellerId&&((0,h.L)({componentName:"store_locator_click_retire",actionName:$.nomeLoja}),navigateToTurboStore($))},[$]),ew=(0,o.useCallback)(()=>{null!=$&&$.estado&&null!=$&&$.cidade&&(em($),Z||O())},[$,em,Z,O]),eL=(0,o.useCallback)(e=>{ej(e,z,H,X)},[ej,z,H,X]),ek=(0,o.useCallback)(()=>{e_()},[e_]),eI=(0,o.useCallback)(()=>{Z&&eh(),A()},[Z,eh,A]),eP=(0,o.useCallback)(()=>{eh(),Z&&A()},[eh,Z,A]);return a?(0,u.jsxs)("div",{ref:F,className:ey().widget,"data-device-control":r,"data-store-locator-widget":t,id:t,children:[eS?(0,u.jsx)(eo,{store:$,title:c,retireLabel:d,findOthersLabel:v,cardIconImage:s,onRetire:eN,onOpenFavoriteStoreListing:ew,onFindOthers:eI,showRetireButton:ex($)}):(0,u.jsx)(er,{title:eC?p:n,description:eC?m:l,ctaLabel:eC?g:i,cardIconImage:s,onClick:eI}),(0,u.jsx)(J.Z,{isOpened:Z,toggle:eI,trigger:(0,u.jsx)(o.Fragment,{}),contentClassName:ey().modalContent,children:(0,u.jsx)(eg,{states:B,cities:V,neighborhoods:q,stores:W,draftState:z,draftCity:H,draftNeighborhood:X,drawerView:Y,loadingStates:ee,loadingCities:et,loadingNeighborhoods:ea,loadingStores:en,canSearch:es,pendingFavoriteSellerId:ec,userLat:el,userLng:ei,drawerTitle:f,selectionDescription:y,resultsDescription:j,findStoresLabel:S,emptyTitle:_,emptyDescription:x,emptyCtaLabel:b,showNavigateButton:L,showWhatsAppButton:k,whatsAppDefaultMessage:I,retireLabel:d,onSelectState:ed,onSelectCity:eu,onSelectNeighborhood:ev,onSearch:ep,onReset:eh,onClose:eP,onFavoriteStoreChange:ef,onFavoriteLoginRedirect:eL,onPendingFavoriteExecuted:ek,hasStoreProducts:ex})})]}):(0,u.jsx)(o.Fragment,{})}),e_=a(2306),ex=a.n(e_);function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};
1t%2?ownKeys(Object(a),!0).forEach(function(t){(0,r.Z)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var eb=l()(()=>a.e(8868).then(a.bind(a,98868)),{ssr:!1,loadableGenerated:{webpack:()=>[98868]}}),StoreLocatorPage=e=>{var{title:t,subtitle:a,showTitle:r=!1,showAllStores:n=!0,showMap:l=!0,showDistance:s=!0,showNavigateButton:c=!0,showWhatsAppButton:d=!0,stores:p=[],device:m,whatsAppDefaultMessage:g}=e,{states:f,cities:y,neighborhoods:j,stores:_,selectedState:x,selectedCity:b,selectedNeighborhood:S,selectedStore:C,favoriteTargetSellerId:N,loadingStates:w,loadingCities:L,loadingNeighborhoods:k,loadingStores:I,userLat:P,userLng:F,handleSelectState:Z,handleSelectCity:O,handleSelectNeighborhood:A,handleSelectStore:V,handleFavoriteStoreChange:q,hasStoreProducts:W}=function(){var{showAllStores:e=!0,showDistance:t=!0,allowedSellerIds:a=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(0,T.useRouter)(),{userLat:n,userLng:l,status:i}=useGeolocation(t),s=getVtexAuthToken(),{0:c,1:d}=(0,o.useState)(""),{0:u,1:v}=(0,o.useState)(""),{0:p,1:m}=(0,o.useState)(""),{0:g,1:f}=(0,o.useState)(null),{0:y,1:j}=(0,o.useState)(""),{handleFavoriteStoreChange:_}=useFavoriteStore();(0,o.useEffect)(()=>{if(r.isReady){var e=getUrlParam(r.query,"estado"),t=getUrlParam(r.query,"cidade"),a=getUrlParam(r.query,"bairro"),o=getUrlParam(r.query,"favoriteStore");e&&d(e),t&&v(t),a&&m(a),o&&j(o)}},[r.isReady]);var{data:x,isValidating:b}=(0,R.aM)(M,{},{revalidateIfStale:!1}),S=(0,o.useMemo)(()=>{var e,t;return(null!==(e=null==x?void 0:null===(t=x.getStoreLocatorChoosesStates)||void 0===t?void 0:t.states)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}})},[x]),{data:C,isValidating:N}=(0,R.aM)(E,{state:c},{revalidateIfStale:!1}),w=(0,o.useMemo)(()=>{var e,t;
1return c?(null!==(e=null==C?void 0:null===(t=C.getStoreLocatorChoosesCities)||void 0===t?void 0:t.cities)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}}):[]},[C,c]),{data:L,isValidating:k}=(0,R.aM)(D,{state:c,city:u},{revalidateIfStale:!1}),I=(0,o.useMemo)(()=>{var e,t;return c&&u?(null!==(e=null==L?void 0:null===(t=L.getStoreLocatorChoosesNeighborhoods)||void 0===t?void 0:t.bairros)&&void 0!==e?e:[]).map(e=>{var t,a;return{descritive:null!==(t=e.descritive)&&void 0!==t?t:"",acronym:null!==(a=e.acronym)&&void 0!==a?a:""}}):[]},[L,c,u]),{data:P,isValidating:F}=(0,R.aM)(U,{state:c,city:u,neighborhood:p||null,userToken:s},{revalidateIfStale:!1}),Z=(0,o.useMemo)(()=>{if(!c||!u)return[];var t,r,o=(null!==(t=null==P?void 0:null===(r=P.getStoreLocatorChoosesStores)||void 0===r?void 0:r.stores)&&void 0!==t?t:[]).map(e=>{var t,a,r,o,n,l,i,s,c,d,u,v,p,h,m;return{nomeLoja:null!==(t=e.nomeLoja)&&void 0!==t?t:"",lojaFavoritavel:null!==(a=e.lojaFavoritavel)&&void 0!==a&&a,favorited:null!==(r=e.favorited)&&void 0!==r&&r,isTurbo:null!==(o=e.isTurbo)&&void 0!==o&&o,sellerId:null!==(n=e.sellerId)&&void 0!==n?n:"",whatsapp:null!==(l=e.whatsapp)&&void 0!==l?l:"",telefone:null!==(i=e.telefone)&&void 0!==i?i:"",latitude:null!==(s=e.latitude)&&void 0!==s?s:"",longitude:null!==(c=e.longitude)&&void 0!==c?c:"",cep:null!==(d=e.cep)&&void 0!==d?d:"",estado:null!==(u=e.estado)&&void 0!==u?u:"",cidade:null!==(v=e.cidade)&&void 0!==v?v:"",bairro:null!==(p=e.bairro)&&void 0!==p?p:"",rua:null!==(h=e.rua)&&void 0!==h?h:"",openingHours:null!==(m=e.openingHours)&&void 0!==m?m:[]}}).filter(e=>!!e.nomeLoja),n=e||0===a.length?o:o.filter(e=>a.includes(e.sellerId));if(!y)return n;var l=n.findIndex(e=>e.sellerId===y);if(l<=0)return n;var i=[...n],[s]=i.splice(l,1);return i.unshift(s),i},[P,c,u,y,e,a]),{hasStoreProducts:O}=useStoreProductsAvailability(Z),A=(0,o.useCallback)(e=>{(0,h.L)({componentName:"store_locator_seletor_estado",actionName:e}),d(e),v(""),m(""),f(null),updateUrlParams({estado:e,cidade:"",bairro:""})},[]);return{states:S,cities:w,neighborhoods:I,stores:Z,selectedState:c,selectedCity:u,selectedNeighborhood:p,selectedStore:g,favoriteTargetSellerId:y,loadingStates:b,loadingCities:N,loadingNeighborhoods:k,loadingStores:F,userLat:n,userLng:l,geolocationStatus:i,handleSelectState:A,handleSelectCity:(0,o.useCallback)(e=>{(0,h.L)({componentName:"store_locator_seletor_cidade",actionName:e}),v(e),m(""),f(null),updateUrlParams({cidade:e,bairro:""})},[]),handleSelectNeighborhood:(0,o.useCallback)(e=>{(0,h.L)({componentName:"store_locator_seletor_bairro",actionName:e}),m(e),f(null),updateUrlParams({bairro:e})},[]),handleSelectStore:(0,o.useCallback)(e=>{f(t=>(null==t?void 0:t.nomeLoja)===e.nomeLoja&&(null==t?void 0:t.cep)===e.cep?null:e)},[]),handleFavoriteStoreChange:_,hasStoreProducts:O}}({showAllStores:n,showDistance:s,allowedSellerIds:p});return(0,u.jsxs)("section",{className:ex().storeLocator,"data-device-control":m,"data-section-store-locator":!0,children:[r&&(t||a)&&(0,u.jsxs)("div",{className:ex().header,children:[t&&(0,u.jsx)(i.Z,{text:t,variant:"title02",heading:"h2"}),a&&(0,u.jsx)(i.Z,{text:a,variant:"body",color:"var(--color-neutral-600)"})]}),(0,u.jsxs)("div",{className:ex().layout,children:[l&&(0,u.jsx)("div",{className:ex().mapColumn,children:(0,u.jsx)(eb,{stores:_,selectedStore:C})}),(0,u.jsxs)("div",{className:ex().contentColumn,children:[(0,u.jsx)(i.Z,{text:"Selecione a sua regi\xe3o, ou use a sua localiza\xe7\xe3o para encontrar as lojas mais pr\xf3ximas de voc\xea.",variant:"description",color:"var(--color-neutral-600)",align:"center"}),(0,u.jsx)(v,{states:f,cities:y,neighborhoods:j,selectedState:x,selectedCity:b,selectedNeighborhood:S,loadingStates:w,loadingCities:L,loadingNeighborhoods:k,onSelectState:Z,onSelectCity:O,onSelectNeighborhood:A}),(0,u.jsx)("div",{className:ex().storeList,children:(0,u.jsx)(B,{stores:_,selectedStore:C,selectedCity:b,selectedState:x,loading:I,favoriteTargetSellerId:N,userLat:P,userLng:F,showNavigateButton:c,showWhatsAppButton:d,whatsAppDefaultMessage:g,onSelectStore:V,onFavoriteStoreChange:q,hasStoreProducts:W})})]})]})]})},eS=(0,o.memo)(e=>{var{isActive:t=!0,variation:a="page"}=e;return t?"widget"===a?(0,u.jsx)(ej,_objectSpread({},e)):(0,u.jsx)(StoreLocatorPage,_objectSpread({},e)):(0,u.jsx)(o.Fragment,{})})},30486:function(e){e.exports={shimmer:"styles_shimmer__W1v3S",skeleton:"styles_skeleton__qQVh1",cardTop:"styles_cardTop__nmJQk",title:"styles_title__AMwCl",heart:"styles_heart__uxMlb",divider:"styles_divider__yjkpS",cardBody:"styles_cardBody__F4Mlb",infoCol:"styles_infoCol___b3Rq",line:"styles_line__unlZN",lineLong:"styles_lineLong__M5j_X",lineMedium:"styles_lineMedium__waPDZ",lineShort:"styles_lineShort__mlE3p",actionsCol:"styles_actionsCol__4lxdO",btn:"styles_btn__ki3fM"}},75406:function(e){e.exports={card:"styles_card___jijU",cardTop:"styles_cardTop__UKetT",cardMeta:"styles_cardMeta__J8XSj",distanceBadge:"styles_distanceBadge__YDGHQ",favoriteBtn:"styles_favoriteBtn__SVak1",divider:"styles_divider__RNDvv",cardBody:"styles_cardBody__Zu3M1",infoCol:"styles_infoCol___YWDw",infoBlock:"styles_infoBlock__F3gO_",actionsCol:"styles_actionsCol__k_3Lg",navigateBtnWrapper:"styles_navigateBtnWrapper__iOETz",whatsappBtnWrapper:"styles_whatsappBtnWrapper__LJB37"}},35225:function(e){e.exports={card:"styles_card__uJWNF",cardTop:"styles_cardTop__FrxGR",cardMeta:"styles_cardMeta__FnpD9",distanceBadge:"styles_distanceBadge__5uhTl",favoriteBtn:"styles_favoriteBtn__jHjGV",divider:"styles_divider__86hs_",cardBody:"styles_cardBody__wX5Wy",infoRow:"styles_infoRow__ifSqV",infoContent:"styles_infoContent__1fjQy",hoursBlock:"styles_hoursBlock__TcV3l",sideIconBtn:"styles_sideIconBtn__uqLVo",cardFooter:"styles_cardFooter__S_vEI"}},36623:function(e){e.exports={filters:"styles_filters__sBlzH"}},76536:function(e){e.exports={list:"styles_list__m4mju",stateMessage:"styles_stateMessage__5zUVZ"}},2306:function(e){e.exports={storeLocator:"styles_storeLocator__bP3xD",header:"styles_header__O7zXY",layout:"styles_layout__8_PGZ",mapColumn:"styles_mapColumn__tAiMK",contentColumn:"styles_contentColumn__To04I",storeList:"styles_storeList__D_eEu"}},6674:function(e){e.exports={content:"styles_content__GVOgd",body:"styles_body__qhCYu",description:"styles_description__kNCV0",fields:"styles_fields__OjMhp",storeList:"styles_storeList__uOWMN",emptyState:"styles_emptyState__L_Lx7",footer
1:"styles_footer__keiGz"}},22269:function(e){e.exports={trigger:"styles_trigger__Nehyo"}},82973:function(e){e.exports={widget:"styles_widget__pntg1",modalContent:"styles_modalContent__vyng4"}},47224:function(e){e.exports={trigger:"widgetCard_trigger__cacia",main:"widgetCard_main__hHzju",iconWrapper:"widgetCard_iconWrapper__utLBZ",content:"widgetCard_content__0IVLK",textLink:"widgetCard_textLink__VL9L_",actions:"widgetCard_actions__5g_2J",primaryButtonWrapper:"widgetCard_primaryButtonWrapper__82Xwf"}}}]);

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.