(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var a in s)e.o(s,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,s=window.wp.i18n,a=window.wp.blockEditor,o=window.wp.components,i=window.wp.data,c=window.wp.serverSideRender;var n=e.n(c);const r=window.ReactJSXRuntime;(0,t.registerBlockType)("tsteam/team-showcase",{edit:function({attributes:e,setAttributes:t}){const c=(0,a.useBlockProps)(),{teamId:l}=e,{teamOptions:d,isLoading:w}=(0,i.useSelect)((e=>{const t=e("core").getEntityRecords("postType","tsteam-showcase",{per_page:-1,_fields:["id","title"]});return{teamOptions:t?[{value:"",label:(0,s.__)("Select a Team Showcase","tsteam-showcase")},...t.map((e=>({value:e.id.toString(),label:e.title.rendered||`#${e.id} (No title)`})))]:[],isLoading:e("core/data").isResolving("core","getEntityRecords",["postType","tsteam-showcase",{per_page:-1,_fields:["id","title"]}])}}),[]);return w?(0,r.jsx)("div",{...c,children:(0,r.jsxs)(o.Placeholder,{icon:"groups",label:(0,s.__)("Team Showcase","tsteam-showcase"),children:[(0,r.jsx)(o.Spinner,{}),(0,s.__)("Loading team showcases...","tsteam-showcase")]})}):(0,r.jsxs)("div",{...c,children:[(0,r.jsx)("div",{className:"tsteam-showcase-controls",children:(0,r.jsx)(o.SelectControl,{label:(0,s.__)("Select Team Showcase","tsteam-showcase"),value:l,options:d,onChange:e=>t({teamId:e})})}),l?(0,r.jsx)("div",{className:"tsteam-showcase-preview",children:(0,r.jsx)(n(),{block:"tsteam/team-showcase",attributes:{teamId:l}})}):(0,r.jsx)(o.Placeholder,{icon:"groups",label:(0,s.__)("Team Showcase","tsteam-showcase"),instructions:(0,s.__)("Please select a team showcase to display","tsteam-showcase")})]})},save:function(){return null}})})();