(()=>{"use strict";var e,r={3910(e,r,t){const o=window.wp.blocks,a=window.wp.i18n,n=(window.React,window.wp.blockEditor),s=window.wp.apiFetch;var l=t.n(s);const i=window.ReactJSXRuntime,{Panel:c,PanelBody:p,SelectControl:u,RadioControl:v,TextControl:d,ColorPalette:m,FontSizePicker:h}=wp.components,f=JSON.parse('{"UU":"rsvpmaker/upcoming-by-json"}');(0,o.registerBlockType)(f.UU,{edit:function(e){const{attributes:{limit:r,url:t,morelink:o},setAttributes:s,isSelected:u}=e;let v="";const m=[{label:(0,a.__)("Choose event"),value:""},{label:(0,a.__)("Next event"),value:"next"},{label:(0,a.__)("Next event - RSVP on"),value:"nextrsvp"}];l()({path:"rsvpmaker/v1/future"}).then(e=>{Array.isArray(e)?e.map(function(e){if(e.ID){var r=e.date?e.post_title+" - "+e.date:e.post_title;m.push({value:e.ID,label:r})}}):Object.values(e).map(function(e){if(e.ID){var r=e.date?e.post_title+" - "+e.date:e.post_title;m.push({value:e.ID,label:r})}})}).catch(e=>{console.log(e)});const h=[{value:"",label:"None selected (optional)"}];return l()({path:"rsvpmaker/v1/types"}).then(e=>{Array.isArray(e)?e.map(function(e){e.slug&&e.name&&h.push({value:e.slug,label:e.name})}):Object.values(e).map(function(e){e.slug&&e.name&&h.push({value:e.slug,label:e.name})})}).catch(e=>{console.log(e)}),m&&m.length>2&&(v="API urls for  this site:\n"+rsvpmaker.json_url+"future\n",h.forEach(function(e,r){r>0&&(v=v.concat(rsvpmaker.json_url+"type/"+e.value+"\n"))})),(0,i.jsxs)("div",{...(0,n.useBlockProps)({className:e.className}),children:[(0,i.jsxs)("p",{class:"dashicons-before dashicons-calendar-alt",children:[(0,i.jsx)("strong",{children:"RSVPMaker "}),": Add an Events Listing that dynamically loads via JSON API endpoint"]}),(0,i.jsx)(n.InspectorControls,{children:(0,i.jsx)(c,{children:(0,i.jsxs)(p,{children:[(0,i.jsx)(d,{label:(0,a.__)("JSON API url","rsvpmaker"),value:t,onChange:e=>s({url:e})}),(0,i.jsx)(d,{label:(0,a.__)("Limit","rsvpmaker"),value:r,help:(0,a.__)("For no limit, enter 0"),onChange:e=>s({limit:e})}),(0,i.jsx)(d,{label:(0,a.__)("Link URL for more results (optional)","rsvpmaker"),value:o,onChange:e=>s({morelink:e})}),(0,i.jsx)("p",{children:(0,i.jsxs)("em",{children:["Enter JSON API url for this site or another in the format:",(0,i.jsx)("br",{}),"https://rsvpmaker.com/wp-json/rsvpmaker/v1/future",(0,i.jsx)("br",{}),"or",(0,i.jsx)("br",{}),"https://rsvpmaker.com/wp-json/rsvpmaker/v1/type/featured"]})}),(0,i.jsx)("pre",{children:v})]})})},"eventlistinginspector")]})},save:function(){return null},transforms:{to:[{type:"block",blocks:["core/query"],transform:e=>{const r=e.calendar&&parseInt(e.calendar)?[["rsvpmaker/calendar",e],["core/post-template",{layout:{type:"grid",columnCount:2}},[["core/post-title",{isLink:!0}],["core/post-featured-image"],["rsvpmaker/loop-blocks"],["core/read-more",{content:"Read More >>"}]]],["core/query-pagination"],["core/query-no-results",{},[["core/paragraph",{content:"No events found."}]]]]:[["core/post-template",{layout:{type:"grid",columnCount:2}},[["core/post-title",{isLink:!0}],["core/post-featured-image"],["rsvpmaker/loop-blocks"],["core/read-more",{content:"Read More >>"}]]],["core/query-pagination"],["core/query-no-results",{},[["core/paragraph",{content:"No events found."}]]]],t=(0,o.createBlocksFromInnerBlocksTemplate)(r);return(0,o.createBlock)("core/query",{queryId:0,query:{perPage:20,pages:0,offset:0,postType:"rsvpmaker",order:"asc",author:"",search:"",exclude:[],sticky:"",inherit:!1},namespace:"rsvpmaker/rsvpmaker-loop"},t)}}]}})}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(r,t,a,n)=>{if(!t){var s=1/0;for(p=0;p<e.length;p++){for(var[t,a,n]=e[p],l=!0,i=0;i<t.length;i++)(!1&n||s>=n)&&Object.keys(o.O).every(e=>o.O[e](t[i]))?t.splice(i--,1):(l=!1,n<s&&(s=n));if(l){e.splice(p--,1);var c=a();void 0!==c&&(r=c)}}return r}n=n||0;for(var p=e.length;p>0&&e[p-1][2]>n;p--)e[p]=e[p-1];e[p]=[t,a,n]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={117:0,8569:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var a,n,[s,l,i]=t,c=0;if(s.some(r=>0!==e[r])){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(i)var p=i(o)}for(r&&r(t);c<s.length;c++)n=s[c],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(p)},t=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var a=o.O(void 0,[8569],()=>o(3910));a=o.O(a)})();