(()=>{"use strict";var e,r={1183(e,r,o){const a=window.wp.blocks,t=window.wp.i18n,s=window.React,n=window.wp.blockEditor,l=window.wp.element,c=window.wp.apiFetch;var p=o.n(c);const i=window.ReactJSXRuntime,{Panel:u,PanelBody:d,SelectControl:v}=wp.components,m=JSON.parse('{"UU":"rsvpmaker/embedposts"}');(0,a.registerBlockType)(m.UU,{edit:function({attributes:e,setAttributes:r,className:o}){const{selection:a,posts_per_page:c}=e,[m,b]=(0,s.useState)([]),[f,h]=(0,s.useState)(""),k=(0,n.useBlockProps)({className:o});(0,s.useEffect)(()=>{(async()=>{if(0==m.length){const e=await p()({path:"rsvpmaker/v1/postsorcategories"});b(e)}})()},[]);const g=async()=>{const e=`rsvpmaker/v1/preview/emailpostorposts?posts_per_page=${c}&selection=${a}`,r=await p()({path:e});h(r)};return(0,s.useEffect)(()=>{g()},[a,c,g]),(0,i.jsxs)("div",{...k,children:[(0,i.jsx)(n.InspectorControls,{children:(0,i.jsx)(u,{children:(0,i.jsxs)(d,{children:[(0,i.jsx)(v,{label:(0,t.__)("Select Post or Category","rsvpmaker"),options:m,value:a,onChange:e=>r({selection:e})}),(0,i.jsx)(v,{label:(0,t.__)("Number of Posts for Listings","rsvpmaker"),options:[{label:"1",value:1},{label:"2",value:2},{label:"3",value:3},{label:"4",value:4},{label:"5",value:5},{label:"6",value:6},{label:"7",value:7},{label:"8",value:8},{label:"9",value:9},{label:"10",value:10}],value:c,onChange:e=>r({posts_per_page:e})})]})})}),(0,i.jsx)("div",{...k,children:(0,i.jsxs)("div",{className:"mylatests-list",children:[(0,i.jsx)(l.RawHTML,{children:f}),!f||""===f&&(0,i.jsx)("p",{children:"Loading..."})]})})]})},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."}]]]],o=(0,a.createBlocksFromInnerBlocksTemplate)(r);return(0,a.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"},o)}}]}})}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,a),s.exports}a.m=r,e=[],a.O=(r,o,t,s)=>{if(!o){var n=1/0;for(i=0;i<e.length;i++){for(var[o,t,s]=e[i],l=!0,c=0;c<o.length;c++)(!1&s||n>=s)&&Object.keys(a.O).every(e=>a.O[e](o[c]))?o.splice(c--,1):(l=!1,s<n&&(n=s));if(l){e.splice(i--,1);var p=t();void 0!==p&&(r=p)}}return r}s=s||0;for(var i=e.length;i>0&&e[i-1][2]>s;i--)e[i]=e[i-1];e[i]=[o,t,s]},a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},a.d=(e,r)=>{for(var o in r)a.o(r,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={1170:0,2646:0};a.O.j=r=>0===e[r];var r=(r,o)=>{var t,s,[n,l,c]=o,p=0;if(n.some(r=>0!==e[r])){for(t in l)a.o(l,t)&&(a.m[t]=l[t]);if(c)var i=c(a)}for(r&&r(o);p<n.length;p++)s=n[p],a.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return a.O(i)},o=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})();var t=a.O(void 0,[2646],()=>a(1183));t=a.O(t)})();