(()=>{"use strict";const e=window.wp.plugins,t=window.wp.editor,a=window.wp.data,n=window.wp.coreData,l=window.wp.components,_=window.wp.i18n,c=window.ReactJSXRuntime,o=[{label:(0,_.__)("Scheduled","clanbite"),value:"scheduled"},{label:(0,_.__)("Live","clanbite"),value:"live"},{label:(0,_.__)("Finished","clanbite"),value:"finished"},{label:(0,_.__)("Cancelled","clanbite"),value:"cancelled"}];function i(){var e,t,a,i,s,r,u;const[d,h]=(0,n.useEntityProp)("postType","clanbite_match","meta"),m=(e,t)=>{h({...d,[e]:t})},p=null!==(e=d?.cp_match_home_team_id)&&void 0!==e?e:0,x=null!==(t=d?.cp_match_away_team_id)&&void 0!==t?t:0,b=null!==(a=d?.cp_match_scheduled_at)&&void 0!==a?a:"",w=null!==(i=d?.cp_match_status)&&void 0!==i?i:"scheduled",v=null!==(s=d?.cp_match_home_score)&&void 0!==s?s:0,g=null!==(r=d?.cp_match_away_score)&&void 0!==r?r:0,j=null!==(u=d?.cp_match_venue)&&void 0!==u?u:"";return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Home team (post ID)","clanbite"),help:(0,_.__)("Published `cp_team` post ID.","clanbite"),type:"number",value:p||"",onChange:e=>m("cp_match_home_team_id",parseInt(e,10)||0),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Away team (post ID)","clanbite"),help:(0,_.__)("Published `cp_team` post ID.","clanbite"),type:"number",value:x||"",onChange:e=>m("cp_match_away_team_id",parseInt(e,10)||0),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Scheduled at (GMT)","clanbite"),help:(0,_.__)("Format: YYYY-MM-DD HH:MM:SS in GMT. Saved via REST and sanitized server-side.","clanbite"),value:b,onChange:e=>m("cp_match_scheduled_at",e),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.SelectControl,{label:(0,_.__)("Match status","clanbite"),value:w,options:o,onChange:e=>m("cp_match_status",e)})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Home score","clanbite"),type:"number",value:v||"",onChange:e=>m("cp_match_home_score",parseInt(e,10)||0),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Away score","clanbite"),type:"number",value:g||"",onChange:e=>m("cp_match_away_score",parseInt(e,10)||0),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}),(0,c.jsx)(l.PanelRow,{children:(0,c.jsx)(l.TextControl,{label:(0,_.__)("Venue","clanbite"),value:j,onChange:e=>m("cp_match_venue",e),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})})]})}(0,e.registerPlugin)("clanbite-cp-match-sidebar",{render:function(){return"clanbite_match"!==(0,a.useSelect)(e=>e(t.store).getCurrentPostType(),[])?null:(0,c.jsx)(t.PluginDocumentSettingPanel,{name:"clanbite-match-details",title:(0,_.__)("Match details","clanbite"),className:"clanbite-match-document-panel",children:(0,c.jsx)(i,{})})}})})();