1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8070],{4402:()=>{},5876:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var i=r(37876);r(14232);var a=r(28766);let n=({text:e,className:t=""})=>(0,i.jsxs)("div",{className:`flex flex-col justify-center items-center ${t}`,children:[(0,i.jsxs)("div",{className:"relative w-10 h-10","aria-hidden":!0,children:[(0,i.jsx)("div",{className:"absolute inset-0 rounded-full border-2 border-gray-200 border-t-blue-600 animate-spin"}),(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,i.jsx)("img",{src:a.A.src??a.A,alt:"",className:"w-6 h-6 object-contain pointer-events-none"})})]}),e&&(0,i.jsx)("p",{className:"mt-2 text-sm text-gray-600",children:e})]})},68070:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>x});var i=r(37876),a=r(28168),n=r(14232);r(4402);var s=r(5876),o=r(48166),l=r(99904),c=r(74880),u=r(78240),d=r(91482),g=r(19701),m=r(19533),f=r(59025),p=r(59531),y=r(10714),h=r(21691),v=r(10880);let w=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)&&e>=-90&&e<=90&&t>=-180&&t<=180,x=({citySlug:e,initialCenter:t=[40.7128,-74.006],initialZoom:r=11,height:x=600})=>{let _=(0,m._)(),{trains:C,isLoading:N}=(0,u.nC)(),[b,j]=(0,n.useState)(!1),L=(0,n.useRef)(null),z=(0,n.useRef)(null),[,k]=(0,n.useState)(!1),M=(0,n.useRef)(new Set),{units:E,convertSpeed:S,formatSpeed:A}=(0,o.t)(),$=(0,n.useMemo)(()=>l.L.getCity(e)?c.Y.getNetworksByCity(e):[],[e]),T=(0,n.useMemo)(()=>c.Y.getAllNetworks(),[]),F=(0,u.s1)(),R=(0,n.useMemo)(()=>new Set($.map(e=>(e.slug||"").toLowerCase())),[$]),B=(0,n.useMemo)(()=>C?.trains?C.trains.filter(e=>e.agency&&R.has(e.agency.toLowerCase())):[],[C,R]),{networksBySlug:Y,layerName:D}=(0,u.o8)(),G=(0,n.useMemo)(()=>{let e=[...B],t=F?.trains||[];return t.length&&$.forEach(r=>{let i=(r.slug||"").toLowerCase(),a=t.filter(e=>e.agency&&e.agency.toLowerCase()===i);if(!a.length)return;let n=e.filter(e=>e.agency&&e.agency.toLowerCase()===i),s=a.filter(e=>!n.some(t=>t.gtfs?.trip_id&&e.gtfs?.trip_id&&t.gtfs.trip_id===e.gtfs.trip_id));e.push(...s)}),e.filter(e=>w(e.lat,e.lng))},[B,$,F]),I=N||F.isLoading,O=Number(t?.[0]),J=Number(t?.[1]);(0,n.useEffect)(()=>{if(L.current&&!z.current&&w(O,J)){let e=(0,p.pI)();z.current=new a.A.Map({container:L.current,style:e,center:[J,O],zoom:r,antialias:!0}),z.current.on("load",()=>{(0,p.z7)(z.current),(0,d.TL)(z.current,T,y.A),(0,f.E)(z.current,k,{initialMode:"2d",interactiveOnDemand:!0}),(0,h.MB)(z.current),j(!0)})}return()=>{z.current&&(z.current.remove(),z.current=null)}},[O,J,r,T]),(0,n.useEffect)(()=>{b&&z.current&&$.forEach(e=>{let t=(e.slug||"").toLowerCase();if(M.current.has(t))return;let r=Y[t];if(r?.tile_url_template)try{let i=`city-route-tiles-${t}`,a=`city-route-line-${t}`,n=e.color||"#000000";z.current.getSource(i)||z.current.addSource(i,{type:"vector",tiles:[r.tile_url_template],minzoom:r.min_zoom,maxzoom:r.max_zoom}),z.current.getLayer(a)||z.current.addLayer({id:a,type:"line",source:i,"source-layer":D,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":["case",["all",["has","route_color"],["!=",["get","route_color"],""]],["concat","#",["get","route_color"]],n],"line-width":2.5,"line-opacity":.6}},"train-points"),M.current.add(t)}catch(e){console.error(`[CityTrainMap] Error adding route tiles for ${t}:`,e)}})},[b,$,Y,D]);let P=(0,n.useCallback)(()=>{if(!b||!z.current)return;let e=G.map(e=>{let t,r=c.Y.getNetwork(e.agency.toLowerCase()),i=(0,g.IR)(e,r?.color||"#000000",_),a=r?.darkerColor||"#000000";if("ttc"===e.agency.toLowerCase()||"route"===_){let r=null!=e.dir&&""!==e.dir;t=`train-icon-color-${i}-${a}-${r?"moving":"stopped"}`,(0,d.X4)(z.current,t,i,a,r)}let n="N/A";return e.normalized.speed.has_speed&&(n=A(S(e.normalized.speed.value,e.normalized.speed.unit,E),(0,v.rT)(E))),{type:"Feature",geometry:{type:"Point",coordinates:[e.lng,e.lat]},properties:{...t?{icon:t}:{},id:e.id,vid:e.vid,color:i,borderColor:a,name:e.name,agency:e.agency,spd:n,org:e.org,dst:e.dst,updated_ago:e.updated_ago,gtfs:JSON.stringify(e.gtfs),direction:e.dir,vehicleClassificationText:e.normalized.vehicle.type.name||"Train",isGhost:e.isGhost||!1}}}),t=z.current.getSource("trains");if(t)try{t.setData({type:"FeatureCollection",features:e}),(0,h.pt)(e)}catch(e){console.error("[CityTrainMap] Failed to set train data:",e)}},[b,G,E,S,A,_]);return(0,n.useEffect)(()=>{b&&z.current&&C?.trains&&P()},[b,C,P]),(0,i.jsxs)("div",{className:"relative",style:{height:`${x}px`,width:"100%"},children:[I&&(0,i.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-gray-50",children:(0,i.jsx)(s.A,{text:"Loading map..."})}),(0,i.jsx)("div",{ref:L,style:{height:"100%",width:"100%"}})]})}}}]);
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.