1import{PageElementBase as o}from"./CdQXFjpm.js";import{d as h}from"./ghde6Rcn.js";import{z as n}from"./CvD9y-X6.js";import"./CATxlt2j.js";import"./CXTOca8g.js";import"./0xmjySIm.js";class r extends o{constructor(t="root",a){super(t,a),this.widgetType="WidgetPDCStreamlineVideoCarousel",this.widgetName="Video Carousel",this.component="WidgetStreamlineCarousel",this.icon={icon:"carousel",pack:"cms"},this.pseudoWidgetType="widget",this.title="",this.showTitle=!1,this.themeSelected=!1,this.search="",this.category="",this.query={queryType:"latest",searchTerm:""},this.categoryOptions=void 0,this.participantOptions=void 0,this.seasonOptions=void 0,this.tournamentTypeOptions=void 0,this.eventOptions=void 0,this.buildContentFields=e=>[{heading:"Title",options:[{type:"input",attributeKey:"title",placeholder:"Enter Title"}]},{heading:"Filter Query",options:[{heading:"Filter By",type:"select",attributeKey:["query","queryType"],items:[{name:"Latest",id:"latest"},{name:"Search Term",id:"search"},{name:"Category",id:"category"},{name:"Participant",id:"participant"},{name:"Tournament",id:"tournamentType"},{name:"Event",id:"event"}],callback:()=>this.setSearchFields(e)},{heading:"Search Term",type:"input",attributeKey:["query","searchTerm"],placeholder:"Enter Search Term",hidden:e.query.queryType!=="search",callback:()=>this.setSearchFields(e)},{heading:"Category",type:"select",attributeKey:["query","category"],maxHeight:250,hidden:e.query.queryType!=="category",items:this.fetchCategoryOptions(),callback:()=>this.setSearchFields(e)},{heading:"Participant",type:"select",attributeKey:["query","participantID"],maxHeight:250,hidden:e.query.queryType!=="participant",items:this.fetchParticipantOptions(),callback:()=>this.setSearchFields(e)},{heading:"Tournament Type",type:"select",attributeKey:["query","tournamentType"],maxHeight:250,hidden:e.query.queryType!=="tournamentType",items:this.fetchTournamentTypeOptions(),callback:()=>this.setSearchFields(e)},{heading:"Season",type:"select",attributeKey:["query","seasonID"],maxHeight:250,hidden:e.query.queryType!=="event",items:this.fetchSeasonOptions(),callback:()=>{this.setSearchFields(e),this.eventOptions=void 0}},{heading:"Event",type:"select",attributeKey:["query","eventID"],maxHeight:250,disabled:!e.query.seasonID,hidden:e.query.queryType!=="event",items:this.fetchEventOptions(e),callback:()=>this.setSearchFields(e)}]}],this.buildStyleFields=()=>[{heading:"Theme",toggleable:!0,toggleAttributeKey:"themeSelected",options:[{type:"radio",subType:"list",attributeKey:"theme",options:[{label:"Light",id:"light"},{label:"Dark",id:"dark"},{label:"Accent",id:"club"}]}]}],this.getSidebarTabs=e=>[{name:"Layout",fields:this.buildLayoutFields(),disabled:!0},{name:"Content",fields:this.buildContentFields(e),default:!0},{name:"Style",fields:this.buildStyleFields()}],this.setSearchFields=e=>{e.search=e.getSearchString(e),e.category=e.query.queryType==="category"&&e.query.category||""},Object.assign(this,a)}serializeElement(){return{...super.serializeBaseElement(),title:this.title,search:this.getSearchString(this),category:this.query.queryType==="category"&&this.query.category||"",theme:this.themeSelected?this.theme:void 0,themeSelected:this.themeSelected,query:this.query}}duplicateElement(){return new r(this.parentID,h({...this,uuid:void 0}))}getSearchString(t){switch(t.query.queryType){case"latest":case"category":return;case"search":return t.query.searchTerm||"";case"participant":return"tag_players_"+t.query.participantID;case"tournamentType":return"tag_tournament_type_"+t.query.tournamentType;case"event":return"tag_event_"+t.query.eventID;default:return""}}fetchCategoryOptions(){const{$gc:t}=n();return this.categoryOptions?this.categoryOptions:t().videos.web().getCategories().then(a=>(this.categoryOptions=a.data.map(e=>({id:e.attributes.name||"",name:e.attributes.name||""})),this.categoryOptions||[]))}fetchParticipantOptions(){const{$gc:t}=n();return this.participantOptions?this.participantOptions:t().darts.web().getParticipants().then(a=>(this.participantOptions=a.data.map(e=>{var i,s;return{id:e.id,name:`${((i=e.attributes)==null?void 0:i.firstName)||""} ${((s=e.attributes)==null?void 0:s.lastName)||""}`.trim()}}),this.participantOptions||[]))}fetchTournamentTypeOptions(){const{$gc:t}=n();return this.tournamentTypeOptions?this.tournamentTypeOptions:t().darts.web().getTournaments().then(a=>{var e;return this.tournamentTypeOptions=(e=a.included)==null?void 0:e.filter(i=>i.type==="tournament-type").map(i=>{var s;return{id:i.id,name:((s=i.attributes)==null?void 0:s.name)||""}}),this.tournamentTypeOptions||[]})}fetchSeasonOptions(){const{$gc:t}=n();return this.seasonOptions?this.seasonOptions:t().darts.web().getTournaments().then(a=>{var e;return this.seasonOptions=(e=a.included)==null?void 0:e.filter(i=>i.type==="season").map(i=>{var s;return{id:i.id,name:((s=i.attributes)==null?void 0:s.name)||""}}),this.seasonOptions||[]})}fetchEventOptions(t){const{$gc:a}=n();return this.eventOptions?this.eventOptions:a().darts.web().getTournaments({seasonID:t.query.seasonID}).then(e=>(this.eventOptions=e.data.map(i=>{var s;return{id:i.id,name:((s=i.attributes)==null?void 0:s.name)||""}}),this.eventOptions||[]))}}export{r 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.