PageSourceSearch

https://www.flexcar.com/lp/assets/MetroMap-_aLnVgZ9.js

js flexcar.com collected 2026-09-24 09:47:36 UTC 3,234 bytes, 7 lines download raw bytes

1import{r as a,a as y,j as c}from"./index-BUm1srQw.js";import{m as w,p as A,a as Z}from"./mapStyle-DYe8PKmd.js";import{A as $}from"./arrow-left-lbY8bjPQ.js";function N({market:s,hoveredId:b,onPinHover:d,onBack:E,onZoomOut:m}){const u=a.useRef(null),h=a.useRef(null),p=a.useRef(new Map),g=a.useRef(0),x=a.useRef(m),v=y();return x.current=m,a.useEffect(()=>{if(!u.current)return;const l=p.current,o=new w.Map({container:u.current,style:A(),center:[s.coords.lng,s.coords.lat],zoom:10,attributionControl:{compact:!0},dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0});o.touchZoomRotate.disableRotation(),h.current=o,requestAnimationFrame(()=>o.resize());const f=new ResizeObserver(()=>o.resize());f.observe(u.current),o.once("load",()=>{const e=new Z.LngLatBounds;if(s.hubs.forEach(n=>e.extend([n.coords.lng,n.coords.lat])),s.hubs.length===1){const{lng:n,lat:r}=s.hubs[0].coords;e.extend([n-.05,r-.05]),e.extend([n+.05,r+.05])}if(s.slug==="new-york"){const{lng:n,lat:r}=s.hubs[0].coords;e.extend([n-.35,r-.35])}const t=s.slug==="boston"?{top:160,right:320,bottom:160,left:80}:s.slug==="new-york"?{top:80,right:80,bottom:320,left:80}:{top:80,right:80,bottom:80,left:80};o.fitBounds(e,{padding:t,duration:600,maxZoom:14}),o.once("moveend",()=>{g.current=o.getZoom()})}),s.hubs.forEach(e=>{const t=document.createElement("div");t.className="flx-hub-marker",t.dataset.hubId=`${s.slug}::${e.name}`,t.innerHTML=`
2        <div class="flx-hub-dot" aria-hidden="true">
3          <span class="flx-hub-pulse"></span>
4          <span class="flx-hub-core"></span>
5        </div>
6        <div class="flx-hub-label">${e.name.replace(/,.*$/,"")}</div>
7      `,t.style.cursor="pointer",t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",`View ${e.name} hub details`),t.addEventListener("mouseenter",()=>d?.(t.dataset.hubId??null)),t.addEventListener("mouseleave",()=>d?.(null));const n=e.name.replace(/\s+/g,"-").toLowerCase(),r=()=>{v({to:"/locations/$market",params:{market:s.slug},hash:`hub-${n}`})};t.addEventListener("click",i=>{i.stopPropagation(),r()}),t.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),r())});const L=new w.Marker({element:t,anchor:"center"}).setLngLat([e.coords.lng,e.coords.lat]).addTo(o);l.set(t.dataset.hubId,L)});const R=()=>{const e=g.current;e&&o.getZoom()<e-1.5&&x.current()};return o.on("zoomend",R),()=>{f.disconnect(),l.forEach(e=>e.remove()),l.clear(),o.remove(),h.current=null}},[s,v,d]),a.useEffect(()=>{p.current.forEach((l,o)=>{l.getElement().classList.toggle("is-hovered",o===b)})},[b]),c.jsxs("div",{className:"absolute inset-0 h-full w-full overflow-hidden",children:[c.jsx("div",{ref:u,className:"absolute inset-0 h-full w-full",style:{width:"100%",height:"100%"}}),c.jsxs("button",{type:"button",onClick:E,className:"absolute right-4 top-4 z-10 inline-flex items-center gap-1.5 rounded-full bg-white px-3 py-1.5 text-[13px] font-semibold text-neutral-900 shadow-md ring-1 ring-neutral-200 transition hover:bg-neutral-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#3A00E5]","aria-label":"Back to all markets",children:[c.jsx($,{className:"h-4 w-4","aria-hidden":!0}),"All markets"]})]})}export{N as default};

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.