(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,a=JSON.parse('{"UU":"events-manager/events"}'),n=window.React,l=window.wp.i18n,r=window.wp.blockEditor,o=window.wp.components,s=window.wp.serverSideRender;var _=e.n(s);const m=[{label:(0,l.__)("Ascending","events-manager"),value:"ASC"},{label:(0,l.__)("Descending","events-manager"),value:"DESC"}],v=[{label:(0,l.__)("start date, start time, event name","events-manager"),value:"event_start_date,event_start_time,event_name"},{label:(0,l.__)("name, start date, start time","events-manager"),value:"event_name,event_start_date,event_start_time"},{label:(0,l.__)("name, end date, end time","events-manager"),value:"event_name,event_end_date,event_end_time"},{label:(0,l.__)("end date, end time, event name","events-manager"),value:"event_end_date,event_end_time,event_name"}],i=[{label:(0,l.__)("Future","events-manager"),value:"future"},{label:(0,l.__)("Past","events-manager"),value:"past"},{label:(0,l.__)("All","events-manager"),value:"all"},{label:(0,l.__)("Today","events-manager"),value:"today"},{label:(0,l.__)("This week","events-manager"),value:"this-week"},{label:(0,l.__)("This month","events-manager"),value:"month"}];(0,t.registerBlockType)(a.UU,{edit:function({attributes:e,setAttributes:t}){const{title:a,scope:s,order:g,orderby:d,limit:c,category:u,all_events:b,all_events_text:C,no_events_text:p,format_header:h,format:f,format_footer:w}=e;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(r.InspectorControls,null,(0,n.createElement)(o.PanelBody,{title:(0,l.__)("Events list settings","events-manager")},(0,n.createElement)(o.TextControl,{label:(0,l.__)("Title","events-manager"),value:a,onChange:e=>t({title:e})}),(0,n.createElement)(o.__experimentalNumberControl,{label:(0,l.__)("Number of events","events-manager"),min:1,value:c,onChange:e=>t({limit:parseInt(e,10)||5})}),(0,n.createElement)(o.SelectControl,{label:(0,l.__)("Scope","events-manager"),value:s,options:i,onChange:e=>t({scope:e})}),(0,n.createElement)(o.SelectControl,{label:(0,l.__)("Order by","events-manager"),value:d,options:v,onChange:e=>t({orderby:e})}),(0,n.createElement)(o.SelectControl,{label:(0,l.__)("Order","events-manager"),value:g,options:m,onChange:e=>t({order:e})}),(0,n.createElement)(o.TextControl,{label:(0,l.__)("Category IDs","events-manager"),help:(0,l.__)("1,2,3 or 2 (0 = all)","events-manager"),value:u,onChange:e=>t({category:e})}),(0,n.createElement)(o.ToggleControl,{label:(0,l.__)('Show "all events" link at bottom',"events-manager"),checked:!!b,onChange:e=>t({all_events:!!e})}),b&&(0,n.createElement)(o.TextControl,{label:(0,l.__)('"All events" link text',"events-manager"),value:C,onChange:e=>t({all_events_text:e})}),(0,n.createElement)(o.TextControl,{label:(0,l.__)("No events message","events-manager"),value:p,onChange:e=>t({no_events_text:e})})),(0,n.createElement)(o.PanelBody,{title:(0,l.__)("Output format (advanced)","events-manager"),initialOpen:!1},(0,n.createElement)(o.TextareaControl,{label:(0,l.__)("List header format","events-manager"),value:h,onChange:e=>t({format_header:e})}),(0,n.createElement)(o.TextareaControl,{label:(0,l.__)("List item format","events-manager"),help:(0,l.__)("Leave blank to use the default format from Settings.","events-manager"),value:f,onChange:e=>t({format:e})}),(0,n.createElement)(o.TextareaControl,{label:(0,l.__)("List footer format","events-manager"),value:w,onChange:e=>t({format_footer:e})}))),(0,n.createElement)("div",{...(0,r.useBlockProps)()},(0,n.createElement)(_(),{block:"events-manager/events",attributes:e})))},save:()=>null})})();