const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/maplibre-gl-Dd-ecUuT.js","assets/chunk-B3K2TuZy.js"])))=>i.map(i=>d[i]);
import{n as e}from"./chunk-B3K2TuZy.js";import{_ as t,g as n,o as r}from"./locale-BzBS6Wyn.js";import{r as i,t as a}from"./footer-fchSAZFR.js";var o=e(t(),1),s=r(),c=[-3.7038,40.4168],l=`pharmacy-points`,u=`pharmacy-points-layer`;function d(e){return`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.latitude},${e.longitude}`)}&travelmode=driving`}function f(e,t,n,r){let i=new Set(t.map(e=>e.id));return{type:`FeatureCollection`,features:e.map(e=>({type:`Feature`,geometry:{type:`Point`,coordinates:[e.longitude,e.latitude]},properties:{id:e.id,isActive:e.id===r,isMatch:!n||i.has(e.id)}}))}}function p({pharmacies:t,matchedPharmacies:r,isFiltering:i,activeId:a,onSelect:p}){let m=(0,o.useRef)(null),h=(0,o.useRef)(null),g=(0,o.useRef)(null),_=(0,o.useRef)(p),[v,y]=(0,o.useState)(!1);(0,o.useEffect)(()=>{_.current=p},[p]),(0,o.useEffect)(()=>{if(!m.current||h.current)return;let o=!1;return n(()=>import(`./maplibre-gl-Dd-ecUuT.js`).then(t=>e(t.default,1)).then(e=>{if(o||!m.current)return;let n=e.default;g.current=n;let s=new n.Map({container:m.current,style:`/dermobiotics/pharmacy-map-style.json`,center:c,zoom:5.25,minZoom:4,maxZoom:17,scrollZoom:!1});s.addControl(new n.NavigationControl({showCompass:!1}),`bottom-right`),s.on(`load`,()=>{s.addSource(l,{type:`geojson`,data:f(t,r,i,a)}),s.addLayer({id:u,type:`circle`,source:l,paint:{"circle-radius":[`case`,[`get`,`isActive`],11,9],"circle-color":[`case`,[`get`,`isActive`],`#3a3735`,[`get`,`isMatch`],`#fe5306`,`#928b86`],"circle-opacity":[`case`,[`get`,`isMatch`],1,.48],"circle-stroke-color":`#ffffff`,"circle-stroke-width":3,"circle-blur":0}}),s.on(`click`,u,e=>{let t=e.features?.[0]?.properties?.id;typeof t==`string`&&_.current(t)}),s.on(`mouseenter`,u,()=>{s.getCanvas().style.cursor=`pointer`}),s.on(`mouseleave`,u,()=>{s.getCanvas().style.cursor=``}),o||y(!0)}),h.current=s}),__vite__mapDeps([0,1])),()=>{o=!0,h.current?.remove(),h.current=null,g.current=null,y(!1)}},[]),(0,o.useEffect)(()=>{let e=h.current;!e||!v||e.getSource(l)?.setData(f(t,r,i,a))},[a,i,v,r,t]),(0,o.useEffect)(()=>{let e=h.current,t=g.current;if(!e||!t||!v)return;if(!i){e.stop(),e.flyTo({center:c,zoom:5.25,duration:380});return}if(r.length<=1)return;let n=r.map(e=>[e.longitude,e.latitude]),a=n.reduce((e,t)=>e.extend(t),new t.LngLatBounds(n[0],n[0])),o=e.getContainer().clientWidth<769;e.stop(),e.fitBounds(a,{padding:o?{top:190,right:24,bottom:240,left:24}:{top:72,right:64,bottom:72,left:430},maxZoom:13,duration:380})},[i,v,r]),(0,o.useEffect)(()=>{let e=h.current,n=t.find(e=>e.id===a);if(!e||!n||!v)return;let r=e.getContainer().clientWidth<769,i=new g.current.LngLatBounds([n.longitude-.02,n.latitude-.012],[n.longitude+.02,n.latitude+.012]);e.stop(),e.fitBounds(i,{padding:r?{top:180,right:24,bottom:240,left:24}:{top:72,right:64,bottom:72,left:430},maxZoom:13,duration:380})},[a,v,t]);let b=t.find(e=>e.id===a);return(0,s.jsx)(`div`,{ref:m,className:`pharmacyMap`,"aria-label":`Mapa de farmacias`,children:b&&(0,s.jsxs)(`div`,{className:`pharmacyInfoCard`,role:`status`,children:[(0,s.jsx)(`strong`,{children:b.name}),(0,s.jsx)(`span`,{children:b.address}),(0,s.jsx)(`a`,{href:d(b),target:`_blank`,rel:`noopener noreferrer`,children:`Abrir en Google Maps`})]})})}var m=`name,address,latitude,longitude
"Farmacia Niñerola","Carrer de la Riera Blanca, 11, Les Corts, 08028 Barcelona","41.37706691335457","2.1219012539769153"
"Farmacia Cristina Cárdenes","Calle de Juan Manuel Duran González, 18, C. Ruiz de Alda, 13, 35007 Las Palmas de Gran Canaria, Las Palmas","28.135835581852966","-15.43185561349423"
"Farmacia Irene Martínez Gómez","C. Uruguay, 5, 45004 Toledo","39.86876939707493","-4.032809045545978"
"Farmacia Sanafarmacia Ciudad Expo","Av. las Américas, 13, 41927 Mairena del Aljarafe, Sevilla","37.35009256212398","-6.049608475323587"
"Farmacia San Julián","C. Duque Cornejo, 52, Casco Antiguo, 41003 Sevilla","37.39885288435664","-5.98567244648689"
"Farmacia Lorente","Av. de Europa, s/n, 11405 Jerez de la Frontera, Cádiz","36.69835052784646","-6.109702058154042"
"Farmacia Alicia Ruiz de Villa","C. Mártires, 2, 39300 Torrelavega, Cantabria","43.35085993587937","-4.0484333999999995"
"Farmacia Enrique Maza Pérez","C. Calvo Sotelo, 15, 39002 Santander, Cantabria","43.46179110921941","-3.807885528835257"
"Farmacia La Plazuela","C. la Plazuela, 20, 39700 Castro-Urdiales, Cantabria","43.40286181529416","-3.213033189151049"
"Farmacia de Suesa","C. Calabazas, 30, 39150 Suesa, Cantabria","43.44064015288866","-3.7144493021281675"
"Farmacia 7 Palmas","Av Pintor Felo Monzón, 22, 35019 Las Palmas de Gran Canaria, Las Palmas","28.107075625925546","-15.452536101846801"
"Farmacia Casaudoumecq","Av. de l'Institut Obrer de València, 11, Quatre Carreres, 46013 València, Valencia","39.455492062794455","-0.359137728835257"
"Farmacia 24 horas Benimaclet","Carrer d'Emili Baró, 11, El Pla del Real, 46020 València, Valencia","39.48481112858199","-0.3625105404826864"
"Farmacia Ortopedia Elia Martí","C. de Albacete, 10, 46970 Alaquàs, Valencia","39.4557098783236","-0.4644578865057712"
"Farmacia Mercado Colon","C/ de Ciril Amorós, 66, L'Eixample, 46004 València, Valencia","39.46894904681098","-0.36770812883525705"
"Farmacia Honrubia","C. del Periodista Llorente, 2, La Saïdia, 46009 València, Valencia","39.484497531795725","-0.38199237116474294"
"Farmacia Pablos Mompía","Av. de la Libertad, 15, 39108 Santa Cruz de Bezana, Cantabria","43.433277602629545","-3.919877957670515"
"Farmacia Orbe","C. Fuerteventura, 78, 38632 Fraile, Santa Cruz de Tenerife","28.01175962353894","-16.668643642329485"
"Farmacia Santa Cruz","C. Viera y Clavijo, 2, 38009 Santa Cruz de Tenerife","28.468502408905024","-16.25281894232823"
"Farmacia Cotolino 5","C. Cotolino, 5, 39700 Castro-Urdiales, Cantabria","43.37177867305067","-3.2047329865076524"
"Farmacia Sañudo","P.º de Altamira, 142, 39006 Santander, Cantabria","43.46758215226921","-3.8081663576717686"
"Farmacia Santa Ana","C. Jesús Nazareno, 8, 11130 Chiclana de la Frontera, Cádiz","36.419068608586066","-6.150458719147986"
"Farmacia Payà Serer","C/ de Just Vilar, 8, Poblats Marítims, 46011 València, Valencia","39.46733092211655","-0.33338360000000006"
"Farmacia Arnandis","Carrer de Santa Rosa, 20, 46250 L'Alcúdia, Valencia","39.19139750912188","-0.5068532576717684"
"Farmacia Lavernia","Carrer de Valencia, 22, 46410 Sueca, Valencia","39.20362622559872","-0.3117627175512132"
"Farmacia Belloch","Carrer de Carcaixent, 14, Jesús, 46007 València, Valencia","39.45972681048734","-0.38695101534353665"
"Farmacia Armengol","Plaça d'Alacant, 4, 46600 Alzira, Valencia","39.149168287364134","-0.4321067558205792"
"Farmacia Roda","Carrer Joncar, 1, 46137 La Pobla de Farnals, Valencia","39.56376381167743","-0.2850199576717683"
"Farmacia El Plantío","Carrer 203, 26, 46182 La Canyada, Valencia","39.53925788618917","-0.485309571164116"
"Farmacia Rocafort","Carrer Francesc Carbonell, 30, 46111 Rocafort, Valencia","39.53090378877274","-0.41003656564633884"
"Farmacia Boix","C/ de Xàtiva, 2, Extramurs, 46002 València, Valencia","39.468275024770705","-0.3797402576717682"
"Farmacia Pinedo al Mar","Travessia de Pinedo al Mar, 17, Pobles del Sud, 46012 València, Valencia","39.42150459169338","-0.33915441534353663"
"Farmacia La Avenida Santander","Calle José Hierro, 19, 39007 Santander, Cantabria","43.46069396868386","-3.825753028835884"
"Farmacia Machín","Calle Manuel Urquijo, 2 (Polideportivo Perú Zaballa, 39700 Castro-Urdiales, Cantabria","43.408349199002195","-3.2253931710864485"
"Farmacia Muriedas","Av de la Reina Victoria, 2, 39004 Santander, Cantabria","43.46357850749231","-3.791653015343536"
"Farmacia Garay","C. Mayor, 16, 39200 Reinosa, Cantabria","43.001280889503946","-4.1377271974730405"
"Farmacia Carolina Bonnardeaux","Calle José de Bustamante y Guerra , 4, C. Gral. Díaz de Villegas, 4, 39009 Santander, Cantabria","43.4545330365686","-3.8196558"
"Farmacia Aycart","C. Fuente Nueva, 3, 11203 Algeciras, Cádiz","36.13298083634242","-5.452580332652692"
"Farmacia Avenida","C. Batalla del Salado, 22, 11380 Tarifa, Cádiz","36.01588011219971","-5.605722709132879"
"Farmacia La Arboleda","Av. de la Arboleda, 12, 41940 Tomares, Sevilla","37.37309732256905","-6.03652423259857"
"Farmacia Burgos 9","C. Burgos, 9, 41702 Dos Hermanas, Sevilla","37.27764505018386","-5.9262061191104385"
"Farmacia La Vid","Pl. la Vid, 9, BAJO, 11406 Jerez de la Frontera, Cádiz","36.8850822798685","-6.122093207782954"
"Farmacia Susana Llaudes Valera","Carrer San Cayetano, 2, Bajo, 46650 Canals, Valencia","38.96152482100283","-0.5846733558237147"
"Farmacia Belda","Carrer de Pius XII, 28, 46870 Ontinyent, Valencia","38.822564368828836","-0.6002707353620188"
"Farmacia NuevaFarma - San Antonio de Benagéber","C. Turcas, 19, Local 6, 46184 San Antonio de Benagéber, Valencia","39.558936860754194","-0.5036924423294858"
"Farmacia Blanca Berrazueta Fernández","Pl. Mayor, 6, BAJO, 39300 Torrelavega, Cantabria","43.35051433685669","-4.049228571164743"
"Farmacia La Vid","Pl. la Vid, 9, BAJO, 11406 Jerez de la Frontera, Cádiz","36.68462230402664","-6.121297542329486"
"Farmacia Amaya Blanco Arce","Calle Juan Ajuriaguerra Kalea, 12, Abando, 48009 Bilbao, Bizkaia","43.26575411408783","-2.9319258288352574"
"Farmacia L. Mechen","C. Socuéllamos, 6, 13700 Tomelloso, Ciudad Real","39.15897374405883","-3.021012974858342"
"Farmacia Monica Vergara","C. de Jorge Juan, 104, Salamanca, 28009 Madrid","40.423293084425275","-3.6729622865057725"
"Farmacia Eduardo Morcillo Escudero","C. Sevilla, 40, 04410 Benahadux, Almería","36.928847405473974","-2.4601934883525702"
"Farmacia Ripolles Fuster Pilar","Plaza de la Villa, 5, 04250 Pechina, Almería","36.812080912238685","-2.580045226988457"
"Farmacia de Pechina","Plaza de la Villa, 5, 04250 Pechina, Almería","36.91665861210033","-2.440290728835257"
"Farmacia Gil Vivas Pérez","P.º las Lomas, 123, 04700 El Ejido, Almería","36.77008745133357","-2.813964484658972"
"Farmacia Molino de Velasco","C. Molino Velasco, 8, 29700 Vélez-Málaga, Málaga","36.77507354971571","-4.101122486505771"
"Farmacia MM Escuder","Cam. Suárez, 42, Bailén-Miraflores, 29010 Málaga","36.728220593778175","-4.4402064711647435"
"Farmacia Entrepinos","Av. Miguel Fernández Alcauza, 2, 29620 Torremolinos, Málaga","36.61710843846575","-4.5101237823645075"
"Farmacia Haza de Cuevas","C. Capitán Huelin, 40, Bailén-Miraflores, 29007 Málaga","36.720452599410656","-4.4374326497391445"
"Farmacia Marenga","Av. Juan Sebastián Elcano, 42, Málaga-Este, 29017 Málaga","36.72239728758176","-4.377118343551434"
"Farmacia Zoco","Centro Comercial El Zoco de Calahonda Local 15-16 Urb, 29649 Calahonda, Málaga","36.489931375560104","-4.714952613492348"
"Farmacia Atarazana Cártama","Av. de Andalucía, 53, 29580 Estación de Cártama, Málaga","36.73668237764384","-4.606154402794138"
"Farmacia Blesa","C. la Gloria, 1, 18500 Guadix, Granada","37.29808825684299","-3.1359406584035674"
"Farmacia Auditorio","P.º Juan Carlos I, 32, 04700 El Ejido, Almería","36.772264049784894","-2.8124039196890807"
"Famacia Mejias Navas","Av. de Málaga, 7, 29313 Villanueva del Trabuco, Málaga","37.02773616077502","-4.338753564110173"
"Farmacia Usero Estepona","Av. Andalucía, 168, 29680 Estepona, Málaga","36.43094329695393","-5.148794939547992"
"Farmacia Triana","C. Gral. Polavieja, 35, 52006 Melilla","35.28314923620461","-2.941611778002651"
"Farmacoa Pérez Mansilla Consolación","C. de Sobrarbe, 1, 50015 Zaragoza","41.658761931943374","-0.8746342613779353"
"Antigua Farmacia Bolsa","C. de la Luz, 7, 50006 Zaragoza","41.638366017850885","-0.8894410473235306"
"Farmacia Escorihuela Laborda María Pilar","C. de María Zambrano, 52, 50018 Zaragoza","41.67650267664821","-0.8891348865083628"
"Farmacia SF10","Av. de Sancho el Fuerte, 10, 31007 Pamplona, Navarra","42.809687046610286","-1.6518598850697874"
"Farmacia Machín Alvarez","C. de Lasierra Purroy, 61, Torrero-La Paz, 50007 Zaragoza","41.62800745899655","-0.8836715423277581"
"Farmacia Astor - Elche","Carrer Monserrate Guilabert Valero, 71, 03205 Elx, Alicante","38.269785683435835","-0.7140714167752555"
"Farmacia Zenia Boulevard","C.C. Zenia Boulevard, C. Jade, 2, 03189, Alicante","37.929140646137206","-0.7360474"
"Farmacia Elche - L'Aljub","Carrer Jacarilla, 7, Loc B76b, 03205 Elx, Alicante","38.26258896968394","-0.7187754325418143"
"Farmacia Escanero","Carrer Major, 9, 03140 Guardamar del Segura, Alicante","38.09093199495841","-0.6549138051436519"
"Farmacia Toni Marin","Avinguda Augusta, 22, 03738 Badia de Xàbia, Alicante","38.78439403054096","0.18079267270515992"
"Farmacia Garberi 15 PAU 5","Maestro José Garberí Serrano, 15, 03540 Alicante","38.38504935930509","-0.41750000327901343"
"Farmacia Bristol","Avinguda de la Costa Blanca, 117, 03540 Alacant, Alicante","38.36966230496081","-0.4123202167712548"
"Farmacia Rocío Muñoz Monllor","C. Sant Bartomeu, 26, 03560 El Campello, Alicante","38.42320460745874","-0.39171885319746763"
"Farmacia de Martinet","Carrer del Segre, 21, 25724 Martinet, Lleida","42.3598032684395","1.6942401865057712"
"Farmacia Andalucia","Av. Andalucía, 16, 11008 Cádiz","36.52301595009001","-6.286502885911053"
`;function h(e){return e.toLocaleLowerCase(`es`).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,` `).trim()}function g(e,t){let n=h(t).split(` `).filter(Boolean);if(!n.length)return!0;let r=h(`${e.name} ${e.address}`);return n.every(e=>r.includes(e))}function _(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];a===`"`?r&&e[i+1]===`"`?(n+=`"`,i+=1):r=!r:a===`,`&&!r?(t.push(n.trim()),n=``):n+=a}return t.push(n.trim()),t}function v(e=m){let t=e.replace(/^\uFEFF/,``).split(/\r?\n/).filter(Boolean);if(t.length<2)return[];let[n,...r]=t,i=_(n).map(e=>e.toLowerCase()),a=i.indexOf(`name`),o=i.indexOf(`address`),s=i.indexOf(`latitude`),c=i.indexOf(`longitude`);return[a,o,s,c].some(e=>e<0)?[]:r.flatMap((e,t)=>{let n=_(e),r=n[a],i=n[o],l=Number.parseFloat(n[s]),u=Number.parseFloat(n[c]);return!r||!i||!Number.isFinite(l)||!Number.isFinite(u)||l<27||l>44.5||u<-19||u>5?[]:[{id:`${r}-${t}`,name:r,address:i,latitude:l,longitude:u}]})}function y(e,t){let n=e=>e*Math.PI/180,r=n(t.latitude-e.latitude),i=n(t.longitude-e.longitude),a=Math.sin(r/2)**2+Math.cos(n(e.latitude))*Math.cos(n(t.latitude))*Math.sin(i/2)**2;return 6371*2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var b=v();function x(){let[e,t]=(0,o.useState)(``),[n,r]=(0,o.useState)(null),[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(null);(0,o.useEffect)(()=>{window.scrollTo(0,0)},[]);let f=(0,o.useMemo)(()=>b.filter(t=>g(t,e)).map(e=>({...e,distance:n?y(n,e):void 0})).sort((e,t)=>(e.distance??1/0)-(t.distance??1/0)),[n,e]);(0,o.useEffect)(()=>{if(!e.trim()||f.length!==1){d(null);return}d(f[0].id)},[e,f]);let m=()=>{if(l(``),!navigator.geolocation){l(`Tu navegador no permite usar ubicacion.`);return}navigator.geolocation.getCurrentPosition(e=>r(e.coords),()=>l(`No hemos podido obtener tu ubicacion.`),{enableHighAccuracy:!1,timeout:1e4,maximumAge:3e5})},h=(0,o.useCallback)(e=>d(e),[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i,{staticPosition:!0}),(0,s.jsxs)(`main`,{className:`pharmaciesPage`,children:[(0,s.jsx)(`section`,{className:`pharmaciesIntro`,children:(0,s.jsxs)(`h1`,{children:[`Encuentra una farmacia DermoBiotics`,(0,s.jsx)(`sup`,{children:`®`}),(0,s.jsx)(`br`,{}),`cerca de ti`]})}),(0,s.jsxs)(`section`,{className:`pharmacyLocator`,"aria-label":`Buscador de farmacias`,children:[(0,s.jsx)(p,{pharmacies:b,matchedPharmacies:f,isFiltering:!!e.trim(),activeId:u,onSelect:h}),(0,s.jsxs)(`div`,{className:`pharmacySearchPanel`,children:[(0,s.jsx)(`label`,{htmlFor:`pharmacy-search`,children:`Buscar por lugar`}),(0,s.jsx)(`input`,{id:`pharmacy-search`,value:e,onChange:e=>t(e.target.value),placeholder:`Ciudad, farmacia o Codigo Postal...`,autoComplete:`off`}),(0,s.jsxs)(`button`,{type:`button`,className:`pharmacyLocationButton`,onClick:m,children:[(0,s.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),` Utilizar ubicacion actual`]}),c&&(0,s.jsx)(`p`,{className:`pharmacyLocationError`,role:`status`,children:c})]}),(0,s.jsxs)(`aside`,{className:`pharmacyResults`,"aria-live":`polite`,children:[(0,s.jsxs)(`div`,{className:`pharmacyResultsHeader`,children:[(0,s.jsxs)(`strong`,{children:[f.length,` `,f.length===1?`resultado`:`resultados`]}),(0,s.jsx)(`span`,{"aria-hidden":`true`,children:`⌃`})]}),(0,s.jsxs)(`div`,{className:`pharmacyResultsList`,children:[f.map(e=>(0,s.jsxs)(`button`,{type:`button`,className:u===e.id?`active`:``,onClick:()=>h(e.id),children:[(0,s.jsx)(`strong`,{children:e.name}),(0,s.jsx)(`span`,{children:e.address}),e.distance!==void 0&&(0,s.jsxs)(`em`,{children:[e.distance.toFixed(1),` km`]})]},e.id)),!f.length&&(0,s.jsx)(`p`,{className:`pharmacyEmpty`,children:`El listado de farmacias se actualizara proximamente.`})]})]})]})]}),(0,s.jsx)(a,{})]})}export{x as default};