(()=>{"use strict";var e,r={20(){const e=window.wp.blocks,r=window.ReactJSXRuntime,{__}=wp.i18n,{Fragment:t}=wp.element,{Component:o}=wp.element,{InspectorControls:s,useBlockProps:n}=wp.blockEditor,{PanelBody:a,SelectControl:l,TextControl:i,TextareaControl:c,ToggleControl:u,RadioControl:p}=wp.components;class d extends o{render(){const{attributes:e,setAttributes:t,className:o}=this.props,n=e.choicearray.join("\n");return(0,r.jsx)(s,{children:(0,r.jsxs)(a,{title:__("Field Properties","rsvpmaker"),children:[(0,r.jsx)(i,{label:__("Label","rsvpmaker"),value:e.label,onChange:r=>function(r){!function({label:e,attributes:r,setAttributes:t,setGuestform:o=!0}){if(r.slug&&("first"===r.slug||"last"===r.slug||"email"===r.slug||r.slug.length>25))return void t({label:e});let s=e.toLowerCase().replaceAll(/[^A-Za-z0-9]+/g,"_");s.length>20&&(s=s.substring(0,20)),s+="_"+Date.now();const n={slug:s,label:e};o&&(n.guestform=!0),t(n)}({label:r,attributes:e,setAttributes:t,setGuestform:!0})}(r)}),(0,r.jsx)(i,{label:__("Field Note (optional additional information)","rsvpmaker"),value:e.fieldnote||"",onChange:e=>t({fieldnote:e})}),(0,r.jsx)(c,{label:__("Choices","rsvpmaker"),value:n,onChange:e=>function(e){t({choicearray:e.split("\n")})}(e)}),(0,r.jsx)("div",{children:(0,r.jsx)("em",{children:"Enter each choice on a separate line"})}),(0,r.jsx)(u,{label:__("Include on Guest Form","rsvpmaker"),checked:e.guestform,help:e.guestform?"Included":"Not included",onChange:e=>{t({guestform:e})}}),(0,r.jsx)(u,{label:__("Check first choice by default","rsvpmaker"),checked:e.defaultToFirst,help:e.defaultToFirst?"First item selected by default":"No default",onChange:e=>{t({defaultToFirst:e})}})]})},"choiceinspector")}}const m=JSON.parse('{"UU":"rsvpmaker/formselect"}');(0,e.registerBlockType)(m.UU,{edit:function(e){const{attributes:{label:o,fieldnote:s,slug:a,choicearray:l,guestform:i},setAttributes:c,isSelected:u}=e,p=n();var m="profile["+a+"]";return(0,r.jsxs)(t,{children:[(0,r.jsx)(d,{...e}),(0,r.jsxs)("div",{...p,children:[(0,r.jsx)("p",{children:(0,r.jsxs)("label",{children:[o,":"]})}),s&&(0,r.jsx)("p",{children:(0,r.jsx)("em",{children:s})}),(0,r.jsx)("div",{style:{marginLeft:"1.25em"},children:(0,r.jsx)("span",{children:(0,r.jsx)("select",{className:a,name:m,id:a,children:l.map(function(e,t){return(0,r.jsx)("option",{value:e,children:e})})})})}),u&&(0,r.jsx)("div",{children:(0,r.jsx)("em",{children:__("Set form label and other properties in sidebar. For use within an RSVPMaker registration form.","rsvpmaker")})})]})]})},save:function(){return null},transforms:{to:[{type:"block",blocks:["core/query"],transform:r=>{const t=r.calendar&&parseInt(r.calendar)?[["rsvpmaker/calendar",r],["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,e.createBlocksFromInnerBlocksTemplate)(t);return(0,e.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)}}]}})}},t={};function o(e){var s=t[e];if(void 0!==s)return s.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(r,t,s,n)=>{if(!t){var a=1/0;for(u=0;u<e.length;u++){for(var[t,s,n]=e[u],l=!0,i=0;i<t.length;i++)(!1&n||a>=n)&&Object.keys(o.O).every(e=>o.O[e](t[i]))?t.splice(i--,1):(l=!1,n<a&&(a=n));if(l){e.splice(u--,1);var c=s();void 0!==c&&(r=c)}}return r}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[t,s,n]},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={1868:0,7988:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var s,n,[a,l,i]=t,c=0;if(a.some(r=>0!==e[r])){for(s in l)o.o(l,s)&&(o.m[s]=l[s]);if(i)var u=i(o)}for(r&&r(t);c<a.length;c++)n=a[c],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(u)},t=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var s=o.O(void 0,[7988],()=>o(20));s=o.O(s)})();