"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[926],{863:(e,r,t)=>{t.d(r,{R:()=>s});var a=t(80074);let s={getTripUpdateParams:(0,a.eU)({tripId:""}),findTripUpdatesParams:(0,a.eU)({fromStopId:"",toStopId:""})}},3570:(e,r,t)=>{t.d(r,{$:()=>a});let a={maxCacheEntries:100,defaultCacheTTL:3e5,apiV1StopsSearchCacheTTL:6e4,apiV1StopsSearchByKeitouIdCacheTTL:6e4,apiV1StopsByIdCacheTTL:6e4,apiV1StopsDetailFromToCacheTTL:6e4,apiV1StopsDetailTripCacheTTL:6e4,apiV1KeitousSearchCacheTTL:6e4,apiV1KeitousCacheTTL:6e4,apiV1TripsTripIdCacheTTL:6e4,apiV1TripUpdatesTripIdCacheTTL:1e4,apiV1TripUpdatesSearchByStopFromToCacheTTL:1e4}},37250:(e,r,t)=>{t.d(r,{eD:()=>o,co:()=>c,aA:()=>i});var a=t(80074),s=t(58640),n=t(7720);function o(e){return{id:e.id,sameId:e.sameId,code:e.code,name:e.name,desc:e.desc,translationName:e.translationName,lat:e.lat,lon:e.lon,pickupAndDropoff:e.pickupAndDropoff}}function i(e,r,t){var a;let s=[r,function(e){if(!e.includes("@"))return e;let r=e.indexOf("@");return e.slice(r+1)}(t)].join("-");return null==(a=e.find(e=>e.id.startsWith(s)))?void 0:a.price}function c(e){if(!e.desc)return"";let r=(0,a.zp)().get(n.T.locale);return(0,s.g)(r)?"".concat(e.desc,"行き"):"To ".concat(e.desc)}},44330:(e,r,t)=>{t.d(r,{r9:()=>p,sq:()=>d,H4:()=>c});var a=t(80074),s=t(87094);let n={badRequestErrorMessage:"リクエストが無効です。",unauthorizedErrorMessage:"認証が必要です。",forbiddenErrorMessage:"アクセス権限がありません。",internalServerErrorMessage:"サーバーエラーが発生しました。",httpErrorMessage:"エラーが発生しました。"};var o=t(46985),i=t(97129);let c=(e,r)=>{s.K.isProd;let t="Unknown Error";e instanceof o.v7?(t=n.badRequestErrorMessage,console.warn("Bad Request Error:",e.message,{context:r})):e instanceof o.D_?(t=n.unauthorizedErrorMessage,console.error("Unauthorized Error:",e.message,{context:r})):e instanceof o.qQ?(t=n.forbiddenErrorMessage,console.error("Forbidden Error:",e.message,{context:r})):e instanceof o.PO?(t=n.internalServerErrorMessage,console.error("Internal Server Error:",e.message,{context:r})):e instanceof o.j$?(t=n.httpErrorMessage,console.error("Http Error:",e.message,{context:r})):console.error("Unexpected Error:",e.message,{context:r}),(0,a.zp)().set(i.N.errorState,{error:e,errorMessage:t})},d=async(e,r)=>{try{return await e()}catch(e){return c(e,r),null}},p=async(e,r)=>d(e,"API: ".concat(r||"unknown"))},46985:(e,r,t)=>{t.d(r,{v7:()=>a,Qy:()=>d,qQ:()=>n,j$:()=>c,PO:()=>i,m_:()=>o,D_:()=>s});class a extends Error{constructor(e="Bad Request"){super(e),this.statusCode=400,this.name="BadRequestError"}}class s extends Error{constructor(e="Unauthorized"){super(e),this.statusCode=401,this.name="UnauthorizedError"}}class n extends Error{constructor(e="forbidden"){super(e),this.statusCode=403,this.name="ForbiddenError"}}class o extends Error{constructor(e="not found"){super(e),this.statusCode=404,this.name="NotFoundError"}}class i extends Error{constructor(e="internal server error"){super(e),this.statusCode=500,this.name="InternalServerError"}}class c extends Error{constructor(e,r){super(r),this.name="HttpError",this.statusCode=e}}class d extends Error{constructor(e="Bookmark limit exceeded"){super(e),this.statusCode=400,this.name="BookmarkLimitError"}}},50077:(e,r,t)=>{t.d(r,{J:()=>f});var a=t(80074),s=t(44330),n=t(79399),o=t(76767),i=t(3570),c=t(79348);async function d(e){let r="/api/v1/TripUpdates/".concat(e.tripId);return await (0,c.s)("GET",r,{},{ttl:i.$.apiV1TripUpdatesTripIdCacheTTL,refresh:e.refresh})}async function p(e){let r="/api/v1/BusPositions/".concat(e.busId),t={gtfs_feed_id:e.feedId};return await (0,c.s)("GET",r,t,{ttl:i.$.apiV1TripUpdatesTripIdCacheTTL,refresh:e.refresh})}async function u(e){var r,t;let a=o.q.findBusTripsPastMinutes,s={StopIdFrom:e.fromStopId||"",StopIdTo:e.toStopId||"",TimeFrom:(null==(r=e.timeFrom)?void 0:r.toString())||a.toString(),TimeTo:(null==(t=e.timeTo)?void 0:t.toString())||""};return await (0,c.s)("GET","/api/v1/TripUpdates/SearchByStopFromTo",s,{ttl:i.$.apiV1TripUpdatesSearchByStopFromToCacheTTL,refresh:e.refresh})}var l=t(863);let f={updatedTripDetail:(0,a.eU)(async e=>{var r;let t=e(l.R.getTripUpdateParams);if(""===t.tripId)return null;t.refresh=!!e(n.w.refreshTrigger);let a=await (0,s.r9)(()=>d(t),"getTripUpdate");if(null===a)return null;let[o="",i=""]=((null==(r=a.vehicle)?void 0:r.id)||"").split("@");if(!o||!i)return a;let c=await (0,s.r9)(()=>p({feedId:o,busId:i,refresh:t.refresh}),"getBusPosition");return null!==c&&Number.isFinite(c.lat)&&Number.isFinite(c.lon)?{...a,position:{...a.position,latitude:c.lat,longitude:c.lon}}:a}),updatedTrips:(0,a.eU)(async e=>{let r=e(l.R.findTripUpdatesParams);if(""===r.fromStopId)return{tripUpdates:[],tripUpdatesRinji:[]};r.refresh=!!e(n.w.refreshTrigger);let t=await (0,s.r9)(()=>u(r),"findTripUpdates");return null===t?{tripUpdates:[],tripUpdatesRinji:[]}:{tripUpdates:Array.isArray(t.tripUpdates)?t.tripUpdates:[],tripUpdatesRinji:Array.isArray(t.tripUpdatesRinji)?t.tripUpdatesRinji:[]}})}},58640:(e,r,t)=>{t.d(r,{g:()=>s});var a=t(91845);let s=e=>e===a.y1},79348:(e,r,t)=>{t.d(r,{s:()=>u});var a=t(65776),s=t(87094),n=t(3570),o=t(29382),i=t.n(o),c=t(46985);async function d(e,r,t){let a=new URL("".concat(s.K.mobustation.apiBaseUrl).concat(r));if("GET"===e&&Object.keys(t).length>0){let e=new URLSearchParams;Object.entries(t).forEach(r=>{let[t,a]=r;Array.isArray(a)?a.forEach(r=>e.append(t,String(r))):e.append(t,String(a))}),a.search=e.toString()}let n={method:e,mode:"cors",credentials:"include",headers:new Headers({"Content-Type":"application/json","x-api-key":s.K.mobustation.apiKey||""})};"GET"!==e&&Object.keys(t).length>0&&(n.body=JSON.stringify(t));let o=await fetch(a.toString(),n);if(!o.ok){if(400===o.status)throw new c.v7("バリデーションエラーが発生しました");if(401===o.status)throw new c.D_("認証に失敗しました");if(403===o.status)throw new c.qQ("アクセスが禁止されています");if(500===o.status)throw new c.PO("サーバーエラーが発生しました");throw new c.j$(o.status,o.statusText)}return 204===o.status?null:await o.json()}let p=new a.q({max:n.$.maxCacheEntries,ttl:n.$.defaultCacheTTL});async function u(e,r,t,a){let{ttl:s=n.$.defaultCacheTTL,refresh:o=!1}=a||{};if("GET"!==e)return d(e,r,t);let c=(!function e(r){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"params";if("number"==typeof r){if(!Number.isFinite(r))throw Error('Invalid number at "'.concat(t,'": ').concat(r));return}if("bigint"==typeof r)throw Error('BigInt not supported at "'.concat(t,'": ').concat(r,"n"));if(Array.isArray(r))return void r.forEach((r,a)=>{e(r,"".concat(t,"[").concat(a,"]"))});null!==r&&"object"==typeof r&&Object.entries(r).forEach(r=>{let[a,s]=r;e(s,"".concat(t,".").concat(a))})}(t),"".concat(e,"_").concat(r,"_").concat(i()(t)));if(!o){let e=p.get(c);if(e)return e}let u=await d(e,r,t);return null!==u&&p.set(c,u,{ttl:s}),u}},79399:(e,r,t)=>{t.d(r,{w:()=>a});let a={refreshTrigger:(0,t(80074).eU)(0)}},87927:(e,r,t)=>{t.d(r,{t:()=>n});var a=t(80074),s=t(89769);let n={agencies:(0,a.eU)(e=>e(s.C.busCompanyData).companies.map(e=>({gtfsFeedId:e.gtfsFeedId,agencyCode:e.agencyCode,publisherName:e.name})))}},97129:(e,r,t)=>{t.d(r,{N:()=>a});let a={errorState:(0,t(80074).eU)({error:null,errorMessage:null,timestamp:void 0})}}}]);