var k=Object.defineProperty;var F=(t,e,s)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var I=(t,e,s)=>F(t,typeof e!="symbol"?e+"":e,s);import{w as A,B as E,$ as b,bU as B,bV as P,d as x,p as w,bj as G,bW as z,bX as H,bY as q,bZ as D,b_ as O,as as N}from"./CfjfYOu4.js";import{u as U}from"./DAfVjtz_.js";import{r as V,g as f,i as M,h as W,f as R,e as y,u as g}from"./BVo-4L0X.js";const j=(t,e,s,n)=>{const a=A(),r={abbreviation:"All",facebook:null,gender:null,global_sport_id:null,global_sport_shortname:null,global_sport_name_slug:null,id:0,instagram:null,non_sport:!1,pinterest:null,short_title:"All",shortname:"all",tickets:null,title:t.defaultSportTitle||"Choose Sport",twitter:null,url:null,youtube:null},i=V(Object.assign({},r)),o=f(()=>{const l=a.getRealSports;return l&&l.length?[Object.assign({},r),...l]:[]}),u=l=>{if(i.value&&l&&l.target){const c=Number.parseInt(l.target.value);h(c),e.value=c,s(n)}},h=l=>{const c=o.value.find(d=>d.id==l);c?i.value=Object.assign({},c):i.value=Object.assign({},o.value[0])};return M(async()=>{t.sportId&&h(t.sportId),W(()=>t.sportId,h)}),{sports:o,selectedSport:i,updateSport:u}},X=t=>{var n,a,r,i;const e="props"in t?t.props:t;return{sportId:"sport_id"in e?e.sport_id=="0"?void 0:e.sport_id:"sportId"in e?e.sportId:void 0,locationIndicator:"extra"in e&&((n=e.extra)!=null&&n.location_indicator)?e.extra.location_indicator:"locationIndicator"in e?e.locationIndicator:void 0,gameId:"extra"in e&&((a=e.extra)!=null&&a.game_id)?e.extra.game_id:"gameId"in e?e.gameId:void 0,spotLight:"extra"in e&&((r=e.extra)!=null&&r.spotlight)?e.extra.spotlight:"spotLight"in e?e.spotLight:void 0,streamingProvider:"extra"in e&&((i=e.extra)!=null&&i.streaming_provider)?e.extra.streaming_provider:"streamingProvider"in e?e.streamingProvider:void 0,ticketedOnly:"ticketedOnly"in e?e.ticketedOnly:void 0,withCoverageOnly:"withCoverageOnly"in e?e.withCoverageOnly:void 0,groupedByDates:"groupedByDates"in e?e.groupedByDates:void 0,startDate:"startDate"in e?e.startDate:void 0,endDate:"endDate"in e?e.endDate:void 0,$pageIndex:"$pageIndex"in e?e.$pageIndex:void 0,$pageSize:"$pageSize"in e?e.$pageSize:void 0}};class Y{constructor(){I(this,"resource","/api/v2/EventsResults/upcoming")}async get(e){var s;try{const n=X(e),a="props"in e&&"start"in e.props?e.props.start:void 0,r="props"in e&&"count"in e.props?e.props.count:void 0;let i;(a||r)&&(i=new E(a,r),n.$pageIndex=i.pageIndex,n.$pageSize=i.pageSize);const o=await b(this.resource,{params:n});if(!o)return[];const u=(s=o.items)==null?void 0:s.map(l=>B(l));return i?i.getData(u):u}catch(n){return console.error("[EventRepo] get() Request error caught",n),[]}}}class Z{constructor(){I(this,"resource","/api/v2/LiveStats")}async getLiveStats(){try{const e=await b(this.resource,{timeout:5e3});return P((e==null?void 0:e.Games)??[])}catch(e){return console.error("[LiveStatsRepo] getLiveStats() Request error failed",e),null}}async getGameLiveStats(e){try{return await b(`${this.resource}/details`,{params:{gameId:e},timeout:5e3})}catch(s){return console.error("[LiveStatsRepo] getGameLiveStats() Request error failed",s),null}}}const C=()=>new Z,J=x("live-stats",{state:()=>({liveStats:null,detailedLiveStats:{},isLoading:!1}),actions:{async fetchLiveStats(){if(!(this!=null&&this.liveStats)){const t=await C().getLiveStats();this.liveStats=t}},async fetchDetailedLiveStats(t){const e=w(`gameId_${t}`);if(!(e in this.detailedLiveStats)){const s=await C().getGameLiveStats(t);this.detailedLiveStats[e]=s}}},getters:{getLiveStats(t){return t.liveStats},getLoadingFlag(t){return t.isLoading},statsAvailable(t){var e;return!!(t.liveStats&&((e=Object.keys(t.liveStats))!=null&&e.length))},getLiveStatsByGameId:t=>e=>{var s,n;if(t.liveStats&&e in t.liveStats&&t.liveStats[e]&&(s=t.liveStats[e])!=null&&s.HasStarted&&!((n=t.liveStats[e])!=null&&n.IsComplete))return t.liveStats[e]},getDetailedLiveStatsByGameId:t=>e=>{const s=w(`gameId_${e}`);return s in t.detailedLiveStats?t.detailedLiveStats[s]:null}}}),T=()=>new Y,K=x("event",{state:()=>({events:{},isLoading:{},isLoadingMore:{},moreToLoad:{}}),actions:{async fetchEvents(t){if(!(t.hash in this.events)){this.isLoading[t.hash]=!0;const e=await T().get(t);this.events[t.hash]=e,this.isLoading[t.hash]=!1}this.fetchGameCenterLiveGames(t)},async fetchMoreEvents(t){const{props:e}=t;this.isLoadingMore[t.hash]=!0;const s=await T().get(t);(!s||!s.length||s.length&&e.count&&s.lengthm&&m.id===d.id);if(p!==void 0&&p>-1){const m=(o=this.events[t.hash])==null?void 0:o[p];let _=H(v,m==null?void 0:m.location_indicator);S&&(_=q(_,S)),(u=this.events)!=null&&u[t.hash]&&((h=this.events[t.hash])!=null&&h.length)&&((c=(l=this.events)==null?void 0:l[t.hash])!=null&&c[p])&&(this.events[t.hash][p]={...m,is_live:!0,livestats:_})}}},async fetchGameCenterLiveGames(t){var n,a,r,i,o,u,h;const e=this.getEvents(t.hash);if(!e||!(e!=null&&e.length))return;const s=U();if(s.liveGamesAvailable||await s.fetchLiveGames(),s.liveGamesAvailable)for(const l of e){const c=s.getLiveGameById(l.id??0);if(!c||!((n=Object.keys(c))!=null&&n.length))continue;const d=(a=this.events[t.hash])==null?void 0:a.findIndex(v=>v&&v.id===l.id);if(d!==void 0&&d>-1){const v=(r=this.events[t.hash])==null?void 0:r[d];(i=this.events)!=null&&i[t.hash]&&((o=this.events[t.hash])!=null&&o.length)&&((h=(u=this.events)==null?void 0:u[t.hash])!=null&&h[d])&&v&&(c.game_state===G.Live||v.game_state!==c.game_state)&&(this.events[t.hash][d]={...v,is_live:c.game_state===G.Live,livestats:c.game_state===G.Live?z(c):null})}}}},getters:{getEvents:t=>e=>e in t.events?t.events[e]:[],getLoadingMoreFlag:t=>e=>e in t.isLoadingMore?t.isLoadingMore[e]??!1:!1,getLoadingFlag:t=>e=>e in t.isLoading?t.isLoading[e]??!1:!1,getMoreToLoad:t=>e=>e in t.moreToLoad?t.moreToLoad[e]??!0:!0}}),Q=R({__name:"EventsComponent",props:{...D},setup(t){const e=K(),s=t,{initialize:n,loadMore:a,getComponentData:r,currentSportId:i,config:o,hash:u}=O(s),{sports:h,selectedSport:l,updateSport:c}=j(s,i,r,e.fetchEvents),d=f(()=>e.getEvents(u())),v=f(()=>e.getMoreToLoad(u())),S=f(()=>e.getLoadingMoreFlag(u())),p=f(()=>e.getLoadingFlag(u()));return M(async()=>{await r(e.fetchEvents),n(e.fetchMoreEvents)}),(m,_)=>y(m.$slots,"content",{data:g(d),config:g(o),loadMore:g(a),moreToLoad:g(v),isLoadingMore:g(S),isLoading:g(p),currentSportId:g(i),sports:g(h),selectedSport:g(l),updateSport:g(c)})}}),ge=Object.assign(Q,{__name:"EventsComponent"}),ee=t=>({abbreviation:t.abbreviation,facebook:null,gender:null,global_sport_id:null,global_sport_shortname:t.globalSportShortName,global_sport_name_slug:null,id:t.id,instagram:null,non_sport:!1,pinterest:null,shortname:t.shortName,title:t.title,tickets:null,twitter:null,youtube:null,short_title:t.shortTitle||null,url:null});function L(t,e){return{credit:t.credit,caption:t.caption,image:N({url:t.imageUrl[e],alt_text:t.caption})}}function te(t){var s,n,a,r,i;return{caption:((s=t.primaryImage)==null?void 0:s.caption)||"",credit:((n=t.primaryImage)==null?void 0:n.credit)||"",date:t.date,gallery_images:(a=t.images)!=null&&a.length?(r=t.images)==null?void 0:r.map(o=>({small:L(o,"small"),medium:L(o,"medium"),large:L(o,"large"),original:L(o,"original")})):null,id:t.id,images:{small:L(t.primaryImage,"small"),medium:L(t.primaryImage,"medium"),large:L(t.primaryImage,"large"),original:L(t.primaryImage,"original")},sport:(i=t.sports)!=null&&i.length?ee(t.sports[0]):null,title:t.title,url:t.url}}const se=t=>{var n;const{props:e}=t,s=new E(e==null?void 0:e.start,e==null?void 0:e.count);return{params:{$pageIndex:s.pageIndex,$pageSize:s.pageSize,sportId:e.sport_id,galleryId:"extra"in e&&((n=e==null?void 0:e.extra)!=null&&n.gallery_id)?e.extra.gallery_id:void 0,includeImages:!0},paginationHandler:s}};class ne{constructor(){I(this,"resource","/api/v2/ImageGalleries")}async get(e){const{params:s,paginationHandler:n}=se(e);try{const a=await b(this.resource,{params:s});if(!a)return[];const r=a.map(i=>te(i));return r!=null&&r.length?n.getData(r):[]}catch(a){return console.error("[GalleryRepo] get() mapping Failed",a),[]}}}const $=()=>new ne,ie=x("gallery",{state:()=>({galleries:{},isLoadingMore:!1,isLoading:!1,moreToLoad:!0}),actions:{async fetchGalleries(t){if(!(t.hash in this.galleries)){this.isLoading=!0;const e=await $().get(t);this.galleries[t.hash]=e,this.isLoading=!1}},async fetchMoreGalleries(t){const{props:e}=t;this.isLoadingMore=!0;const s=await $().get(t);(!s||!s.length||s.length&&e.count&&s.lengthe=>{const s=e;return s in t.galleries&&t.galleries[s]?t.galleries[s]:[]},getLoadingMoreFlag(t){return t.isLoadingMore},getLoadingFlag(t){return t.isLoading},getMoreToLoad(t){return t.moreToLoad}}}),re=R({__name:"GalleriesComponent",props:{...D},setup(t){const e=ie(),s=t,{initialize:n,loadMore:a,getComponentData:r,currentSportId:i,config:o,hash:u}=O(s),{sports:h,selectedSport:l,updateSport:c}=j(s,i,r,e.fetchGalleries),d=f(()=>e.getGalleries(u())),v=f(()=>e.getMoreToLoad),S=f(()=>e.getLoadingMoreFlag),p=f(()=>e.getLoadingFlag);return M(async()=>{await r(e.fetchGalleries),n(e.fetchMoreGalleries)}),(m,_)=>y(m.$slots,"content",{data:g(d),config:g(o),loadMore:g(a),moreToLoad:g(v),isLoadingMore:g(S),isLoading:g(p),currentSportId:g(i),sports:g(h),selectedSport:g(l),updateSport:g(c)})}}),ue=Object.assign(re,{__name:"GalleriesComponent"});export{ge as _,ue as a,K as b,ie as c,j as u};

AltStyle によって変換されたページ (->オリジナル) /