"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[361],{1e3:(e,t,r)=>{r.d(t,{E:()=>n});var a=r(95155);r(12115);var o=r(43791);function n(e){let{className:t,width:r,height:n,sx:l,variant:s="text",children:i}=e;return(0,a.jsx)(o.A,{className:t,height:n,sx:l,variant:s,width:r,children:i})}},14402:(e,t,r)=>{r.d(t,{M:()=>a,k:()=>o});var a=function(e){return e.StopId="stopId",e.SamePoleId="samePoleId",e}({}),o=function(e){return e[e.Dropoff=1]="Dropoff",e[e.Pickup=2]="Pickup",e[e.Both=3]="Both",e}({})},36968:(e,t,r)=>{r.d(t,{C:()=>n});var a=r(95155);r(12115);var o=r(99496);function n(e){let{className:t,sx:r,children:n}=e;return(0,a.jsx)(o.A,{className:t,sx:r,children:n})}},40152:(e,t,r)=>{r.d(t,{J:()=>l});var a=r(95155),o=r(92840),n=r(47101);function l(e){let{onClick:t}=e,{t:r}=(0,o.PZ)();return(0,a.jsx)(n.$,{sx:{color:"var(--color-secondary)",fontWeight:"bold",fontSize:"16px"},onClick:t,children:r("action.return.label")})}},47101:(e,t,r)=>{r.d(t,{$:()=>n});var a=r(95155);r(12115);var o=r(27855);function n(e){let{className:t,color:r,disabled:n=!1,href:l,sx:s,variant:i,onClick:u,children:d}=e;return(0,a.jsx)(o.A,{className:t,href:u?void 0:l,color:r,disabled:n,sx:s,variant:i,onClick:u,children:d})}},49866:(e,t,r)=>{r.d(t,{o:()=>n});var a=r(95155);r(12115);var o=r(79488);function n(e){let{sx:t,variant:r="inherit",children:n}=e;return(0,a.jsx)(o.A,{sx:t,variant:r,children:n})}},59849:(e,t,r)=>{r.d(t,{L:()=>n});var a=r(95155);r(12115);var o=r(2021);function n(e){let{className:t,sx:r,children:n}=e;return(0,a.jsx)(o.A,{className:t,sx:r,children:n})}},66197:(e,t,r)=>{r.d(t,{D7:()=>s,N8:()=>c,PV:()=>p,Ti:()=>d,jA:()=>u,mK:()=>i});var a=r(3570),o=r(79348),n=r(14402),l=r(91845);async function s(e){var t,r;let n={Name:e.name||"",Quadkey:e.quadkey||"",Language:null!=(r=e.language)?r:l.q,Lat:e.latitude||"",Lon:e.longitude||"",SamePoleId:"",Limit:(null==(t=e.limit)?void 0:t.toString())||"20"},s=await (0,o.s)("GET","/api/v1/Stops/Search",n,{ttl:a.$.apiV1StopsSearchCacheTTL});return null===s?{list:[]}:s}async function i(e){var t;let r="/api/v1/Stops/SearchByKeitouId/".concat(e.routeId),n={Language:null!=(t=e.language)?t:l.q},s=await (0,o.s)("GET",r,n,{ttl:a.$.apiV1StopsSearchByKeitouIdCacheTTL});return null===s?{list:[]}:s}async function u(e){var t;let r="/api/v1/Stops/".concat(e.stopId),s={Language:null!=(t=e.language)?t:l.q,IdType:e.idType||n.M.StopId};return await (0,o.s)("GET",r,s,{ttl:a.$.apiV1StopsByIdCacheTTL})}async function d(e){var t;let r={StopIdFrom:e.fromStopId,StopIdTo:e.toStopId||"",Date:e.date||"",Language:null!=(t=e.language)?t:l.q,IdType:e.idType||n.M.StopId};return await (0,o.s)("GET","/api/v1/Stops/detailfromto",r,{ttl:a.$.apiV1StopsDetailFromToCacheTTL,refresh:e.refresh})}async function p(e){var t;let r={StopIdFrom:e.fromStopId,StopIdTo:e.toStopId||"",Date:e.date||"",Language:null!=(t=e.language)?t:l.q,IdType:e.idType||n.M.StopId};return await (0,o.s)("GET","/api/v1/Stops/brothersfromto",r,{ttl:a.$.apiV1StopsDetailFromToCacheTTL,refresh:e.refresh})}async function c(e){var t;let r={TripId:e.tripId,StopIdFrom:e.stopIdFrom,StopIdTo:e.stopIdTo||"",Date:e.date||"",Language:null!=(t=e.language)?t:l.q,IdType:n.M.StopId};return await (0,o.s)("GET","/api/v1/Stops/detailtrip",r,{ttl:a.$.apiV1StopsDetailTripCacheTTL})}},70823:(e,t,r)=>{r.d(t,{U:()=>o});let a=r(55631).Geodesic.WGS84,o=(e,t)=>{let r=a.Inverse(e.lat,e.lon,t.lat,t.lon);return r.s12&&Math.round(r.s12)}},73404:(e,t,r)=>{r.d(t,{b:()=>u});var a=r(95155);r(12115);var o=r(40152),n=r(99621),l=r(36968),s=r(59849),i=r(88294);function u(e){let{title:t,description:r,children:u,open:d,slotProps:p,sx:c,onClose:m,onClickReturn:f}=e;return(0,a.jsx)(n.l,{open:d,slotProps:{root:{style:{zIndex:i.R.position.zIndex.centeredDialog},...null==p?void 0:p.root},backdrop:{...null==p?void 0:p.backdrop},container:{...null==p?void 0:p.container},paper:{...null==p?void 0:p.paper}},sx:c,onClose:m,children:(0,a.jsxs)("div",{children:[t&&(0,a.jsxs)(s.L,{children:[(0,a.jsx)("div",{className:"font-bold",children:t}),r&&(0,a.jsx)("div",{className:"text-base",children:r})]}),(0,a.jsxs)(l.C,{children:[u,(0,a.jsx)("div",{children:(0,a.jsx)(o.J,{onClick:f})})]})]})})}},90361:(e,t,r)=>{r.d(t,{M:()=>v});var a=r(95155),o=r(12115),n=r(20063),l=r(92840),s=r(92964),i=r(96096),u=r(73404),d=r(37250),p=r(1e3),c=r(49866);function m(){return(0,a.jsx)(p.E,{sx:{fontSize:"1.5rem"},variant:"text",width:"100%",children:(0,a.jsx)(c.o,{children:"."})})}function f(){return(0,a.jsx)(a.Fragment,{children:Array.from({length:3}).map((e,t)=>(0,a.jsx)("div",{className:"border-b mb-2 pb-2 border-b-(--kobe-light)",children:(0,a.jsx)(m,{})},t))})}var g=r(47101),S=r(14909);function h(e){let{loadablePlatforms:t,onSelect:r}=e,{t:o}=(0,l.PZ)(),{showNotification:n}=(0,l.M)();if("loading"===t.state)return(0,a.jsx)(f,{});if("hasError"===t.state)return n(o("error-message.find-stop-platforms"),{severity:"error"}),null;let s=t.data;return(0,a.jsx)(a.Fragment,{children:s.map(e=>e.desc?(0,a.jsx)("div",{className:"border-b mb-2 pb-2 border-b-(--kobe-light)",children:(0,a.jsxs)(g.$,{sx:{color:"var(--color-primary)",alignItems:"start",display:"flex",textAlign:"left",width:"100%",justifyContent:"space-between"},onClick:()=>r(e),children:[(0,a.jsx)("span",{className:"text-lg",children:(0,d.co)(e)}),(0,a.jsx)(S.I,{name:"advance",color:"black",opacity:"high"})]})},e.id):null)})}function I(e){let{open:t,title:r,originStop:n,onSelect:d,onClose:p}=e,{pathname:c}=(0,l.Sz)(),m=(0,i.GP)(),f=(0,i.wZ)(n.name),g=(0,o.useMemo)(()=>(0,s.cq)(c),[c]),S=(0,o.useMemo)(()=>g?"hasData"!==f.state?null:f.data.length:"hasData"!==m.state?null:m.data.length,[m,f,g]),I=(0,o.useMemo)(()=>g?f:m,[g,m,f]);return(0,a.jsx)(u.b,{description:"".concat(null==S?"...":S,"件ヒットしました。"),open:t,sx:{backgroundColor:"var(--color-overlay-light)",boxShadow:"none","& .MuiDialog-paper":{boxShadow:"none",borderRadius:"16px",margin:"0 0 0 0",width:"90%",maxHeight:"80vh",textAlign:"center"},'& [class*="MuiBackdrop-root-MuiDialog-backdrop"]':{backgroundColor:"transparent"}},title:r,onClickReturn:p,onClose:p,children:(0,a.jsx)("div",{children:(0,a.jsx)(h,{loadablePlatforms:I,onSelect:d})})})}function v(e){let{open:t,title:r,onClose:i}=e,u=(0,n.useRouter)(),{locale:d}=(0,l.PZ)(),{pathname:p,originStop:c,destinationStop:m,setStopPlatform:f,resetDestinationStop:g}=(0,l.Sz)(),[,S]=(0,o.useTransition)(),h=(0,o.useMemo)(()=>(0,s.cq)(p)||(0,s.lw)(p),[p]),v=(0,o.useCallback)(e=>{S(()=>{f(e),i()});let t={stopPlatform:e.id};c&&(t.originStop=c.id),m&&(t.destinationStop=m.id),h&&(delete t.destinationStop,g());let r=(0,s.tQ)(d,t);u.push(r)},[d,u,c,m,i,S]);return c?(0,a.jsx)(I,{open:t,originStop:c,title:r,onClose:i,onSelect:v}):null}},96096:(e,t,r)=>{r.d(t,{vb:()=>X,wm:()=>Z,gW:()=>z,_2:()=>V,NV:()=>Y,GP:()=>J,wZ:()=>Q,Pc:()=>K,XG:()=>H,fB:()=>W,hj:()=>O});var a=r(12115),o=r(77202),n=r(20448),l=r(76767),s=r(92840),i=r(80074),u=r(51208),d=r(86919),p=r(70823),c=r(44330),m=r(14402),f=r(66197),g=r(37250);let S=(0,u.tx)({name:""}),h=(0,u.tx)({latitude:"",longitude:""}),I=(0,u.tx)({routeId:""}),v={findBusStopsByNameParams:S,findNearestBusStopsParams:h,findBusStopsByRouteIdParams:I,findBusStopPlatformsParams:(0,i.eU)({fromStopId:"",toStopId:""}),getBusStopDetailByFromToParams:(0,i.eU)({fromStopId:"",toStopId:""})};var y=r(87927),B=r(50077);let b=(e,t)=>{if(0===e.length||0===t.length)return[];let r=new Set(t.map(e=>e.publisherName));return e.filter(e=>r.has(e.publisherName))},T=(0,d.I)(e=>(0,i.eU)(async t=>{let r=await (0,c.r9)(()=>(0,f.D7)(e),"findBusStops");return null===r?[]:r.list})),x=(0,d.I)(e=>(0,i.eU)(async t=>{let r=t(v.findBusStopsByNameParams);if(!r.name)return[];let a=await t(T(r));return a&&0!==a.length?b(a,t(y.t.agencies)).filter(t=>t.pickupAndDropoff===e||t.pickupAndDropoff===m.k.Both).sort((e,t)=>e.name===t.name?e.id.localeCompare(t.id):0).reduce((e,t)=>{let r=e.find(e=>e.name===t.name&&e.brotherPoleId===t.brotherPoleId);return r?r.agencyNames.includes(t.agencyName)||r.agencyNames.push(t.agencyName):e.push({id:t.id,name:t.name,brotherPoleId:t.brotherPoleId,translationName:t.translationName,agencyNames:[t.agencyName],pickupAndDropoff:t.pickupAndDropoff}),e},[]):[]})),P=(0,d.I)(e=>(0,i.eU)(async t=>{let r=[];return"origin"===e&&(r=await t(x(m.k.Pickup))),"destination"===e&&(r=await t(x(m.k.Dropoff))),r.slice(0,l.q.maxBusStopSuggestions)})),N=(0,d.I)(e=>(0,u.Rq)(P(e))),k=(0,i.eU)(async e=>{let t=e(v.findBusStopsByRouteIdParams);if(!t.routeId)return[];let r=await (0,c.r9)(()=>(0,f.mK)(t),"findBusStopsByRouteId");return null===r?[]:r.list}),D=(0,i.eU)(async e=>{let t=await e(k);if(0===t.length)return[];let r=new Set;return t.filter(e=>!r.has(e.name)&&(r.add(e.name),!0))}),w=(0,u.Rq)(D),j=(0,d.I)(e=>(0,i.eU)(async t=>{if(!e)return[];let r=t(v.findNearestBusStopsParams);if(!r.latitude||!r.longitude)return[];let a=await t(T(r));if(!a||0===a.length)return[];let o=b(a,t(y.t.agencies)),n=Number(r.latitude),s=Number(r.longitude);return o.map(e=>{var t;return{...e,distance:null!=(t=(0,p.U)({lat:n,lon:s},{lat:e.lat,lon:e.lon}))?t:1/0}}).filter(e=>e.distance<=l.q.nearbyBusStopDistanceLimitMeters).sort((e,t)=>e.distance-t.distance).reduce((e,t)=>{let r="".concat(t.name);return e.map.has(r)||(e.map.set(r,!0),e.result.push({id:t.id,name:t.name,lat:t.lat,lon:t.lon,translationName:t.translationName,pickupAndDropoff:t.pickupAndDropoff})),e},{map:new Map,result:[]}).result})),C=(0,d.I)(e=>(0,u.Rq)(j(e))),q=(0,d.I)(e=>(0,i.eU)(async t=>(0,c.r9)(()=>(0,f.Ti)(e),"getBusStopDetailFromTo"))),A=(0,d.I)(e=>(0,i.eU)(async t=>(0,c.r9)(()=>(0,f.PV)(e),"getBusStopBrothersFromTo"))),F=(0,i.eU)(async e=>{let t=e(v.findBusStopPlatformsParams);if(!t.fromStopId)return[];let r=await e(A(t));return null!==r&&r.brothers&&0!==r.brothers.length?[...r.brothers].sort((e,t)=>(null===e.code?1/0:Number(e.code))-(null===t.code?1/0:Number(t.code))||e.id.localeCompare(t.id)).reduce((e,t)=>{if(t.pickupAndDropoff===m.k.Dropoff)return e;let r="".concat(t.code,"-").concat(t.name,"-").concat(t.desc,"-").concat(t.pickupAndDropoff);return e.map.has(r)||(e.map.set(r,!0),e.result.push(t)),e},{map:new Map,result:[]}).result:[]}),R=(0,u.Rq)(F),M=(0,d.I)(e=>(0,i.eU)(async t=>{let r=await t(k);return r&&0!==r.length?[...r.map(e=>(0,g.eD)(e)).filter(t=>t.name===e)].sort((e,t)=>(null===e.code?1/0:Number(e.code))-(null===t.code?1/0:Number(t.code))||e.id.localeCompare(t.id)):[]})),U=(0,d.I)(e=>(0,u.Rq)(M(e))),L=(0,i.eU)(async e=>{let t=e(v.getBusStopDetailByFromToParams);if(!t.fromStopId)return[];let r=await e(q(t));if(!r||0===r.stopTimes.length)return[];let a=r.stopTimes.reduce((e,t)=>{let{trip:r}=t;return r.$id&&(e[r.$id]=r),e},{}),o=r.stopTimes.map(e=>{let{trip:t}=e;return t.$ref?{...e,trip:a[t.$ref]||t}:e}),n=o.reduce((e,t)=>{let{route:r}=t.trip;return r.$id&&(e[r.$id]=r),e},{});return Array.from(o.map(e=>{let{route:t}=e.trip;return t.$ref?{...e,trip:{...e.trip,route:n[t.$ref]||t}}:e})).sort((e,t)=>e.departureTime.localeCompare(t.departureTime))}),$=((0,u.Rq)(L),(0,i.eU)(async e=>{let t=e(v.getBusStopDetailByFromToParams);if(!t.fromStopId)return[];let r=await e(q(t));return r&&r.fares||[]})),_=(0,i.eU)(async e=>{var t;let[r,a,o]=await Promise.all([e(L),e($),e(B.J.updatedTrips)]),n=new Date,s=new Date(n.getTime()-36e5),i=e=>{let[t,r]=e.split(":").map(Number),a=new Date;return a.setHours(t,r,0),a},u=a.sort((e,t)=>e.price-t.price),d=(Array.isArray(o.tripUpdates)?o.tripUpdates:[]).map(e=>{var t;if(!(null==e?void 0:e.trip)||!Array.isArray(e.stop_time_update))return;let{trip:a,stop_time_update:o}=e,l=r.find(e=>e.tripId===a.trip_id);if(!l)return;let d=o.length>0?o[0]:void 0;if(void 0===d||l.stopSequence{var t,a;if(!(null==e?void 0:e.trip)||!Array.isArray(e.stop_time_update))return;let{trip:o,stop_time_update:l}=e,s=o.route_id;if(!s)return;let i=r.find(e=>{var t;return(null==(t=e.trip.route)?void 0:t.routeId)===s});if(!i||1===i.stopSequence)return;let u=l.length>0?l[0]:void 0;if(void 0===u||i.stopSequence<=u.stop_sequence)return;let d=i.stopSequence-u.stop_sequence,p=null==(t=u.departure)?void 0:t.time;if(null!=p&&Number.isFinite(p)){if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(1e3*p),n))return{...i,passedStopsCount:d,congestionLevel:null==(a=o.mobustation)?void 0:a.congestion,isRinji:!0}}}).filter(Boolean),c=d.sort((e,t)=>{let r=i(e.departureTime),a=i(t.departureTime);return r.getTime()-a.getTime()}),m=p.sort((e,t)=>{var r,a;return(null!=(r=e.passedStopsCount)?r:0)-(null!=(a=t.passedStopsCount)?a:0)}),{filteredTimes:f}=c.reduce((e,t)=>{if("passed"!==t.operationStatus)return e.filteredTimes.push(t),e;if(null!==e.latestPassedItem){let t=e.latestPassedItem,r=e.filteredTimes.findIndex(e=>e.$id===t.$id);-1!==r&&e.filteredTimes.splice(r,1)}return e.filteredTimes.push(t),e.latestPassedItem=t,e},{filteredTimes:[],latestPassedItem:null});return[...m,...f.slice(0,l.q.maxBusStopTimes)]}),E={loadableBusStopSuggestionsByTarget:N,loadableBusStopsByRoute:w,loadableNearestBusStops:C,loadableBusStopPlatforms:R,loadableBusStopPlatformsByRoute:U,loadableUpdatedStopTimes:(0,u.Rq)(_)};var G=r(92964);let Z=()=>{let{locale:e}=(0,s.PZ)(),t=(0,o.md)(v.findBusStopsByNameParams),r=(0,o.Xr)(v.findBusStopsByNameParams);return{resetFindBusStopsByNameParams:(0,n.AY)(v.findBusStopsByNameParams),findBusStopsByName:(0,a.useCallback)((a,o,n)=>{let s=null==o?void 0:o.toFixed(6).toString(),i=null==n?void 0:n.toFixed(6).toString();(t.name!==a||t.latitude!==s||t.longitude!==i||t.language!==e)&&r({name:a,latitude:s,longitude:i,limit:l.q.findBusStopsByNameLimit,language:e})},[t,e])}},V=()=>{let{locale:e}=(0,s.PZ)(),t=(0,o.md)(v.findNearestBusStopsParams),r=(0,o.Xr)(v.findNearestBusStopsParams),i=(0,n.AY)(v.findNearestBusStopsParams);return{findNearestBusStops:(0,a.useCallback)((a,o)=>{let n=a.toFixed(6).toString(),s=o.toFixed(6).toString();(t.latitude!==n||t.longitude!==s||t.language!==e)&&r({latitude:n,longitude:s,limit:l.q.maxNearestBusStops,language:e})},[t,e]),resetFindNearestBusStops:i}},z=()=>{let{locale:e}=(0,s.PZ)(),t=(0,o.md)(v.findBusStopsByRouteIdParams),r=(0,o.Xr)(v.findBusStopsByRouteIdParams);return{resetFindBusStopsByRouteIdParams:(0,n.AY)(v.findBusStopsByRouteIdParams),findBusStopsByRouteId:(0,a.useCallback)(a=>{let o={routeId:a,language:e};(t.routeId!==o.routeId||t.language!==e)&&r(o)},[t,e])}},X=()=>{let{locale:e}=(0,s.PZ)(),t=(0,o.md)(v.findBusStopPlatformsParams),r=(0,o.Xr)(v.findBusStopPlatformsParams);return{findBusStopPlatforms:(0,a.useCallback)((a,o)=>{let n={fromStopId:a,toStopId:o||"",language:e};(t.fromStopId!==n.fromStopId||t.toStopId!==n.toStopId||t.language!==e)&&r(n)},[e,t,r])}},Y=()=>{let{locale:e}=(0,s.PZ)(),t=(0,o.md)(v.getBusStopDetailByFromToParams),r=(0,o.Xr)(v.getBusStopDetailByFromToParams);return{getBusStopDetailByFromTo:(a,o)=>{let n={fromStopId:a,toStopId:o||"",language:e};(t.fromStopId!==n.fromStopId||t.toStopId!==n.toStopId||t.language!==e)&&r(n)}}},K=e=>(0,o.md)(E.loadableBusStopSuggestionsByTarget(e)),W=e=>{let t=(0,G.Ad)(e);return(0,o.md)(E.loadableNearestBusStops(t))},H=()=>(0,o.md)(E.loadableBusStopsByRoute),J=()=>(0,o.md)(E.loadableBusStopPlatforms),Q=e=>(0,o.md)(E.loadableBusStopPlatformsByRoute(e)),O=()=>(0,o.md)(E.loadableUpdatedStopTimes)},99621:(e,t,r)=>{r.d(t,{l:()=>n});var a=r(95155);r(12115);var o=r(75265);function n(e){let{className:t,disableRestoreFocus:r=!1,fullScreen:n=!1,fullWidth:l=!1,open:s,slotProps:i,slots:u,sx:d,transitionDuration:p=0,onClose:c,children:m}=e;return(0,a.jsx)(o.A,{className:t,disableRestoreFocus:r,fullScreen:n,fullWidth:l,open:s,slotProps:i,slots:u,sx:d,transitionDuration:p,onClose:c,children:m})}}}]);