(()=>{"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:l}=wp.blockEditor,{PanelBody:n,SelectControl:a,TextControl:i,TextareaControl:c,ToggleControl:p,RadioControl:u}=wp.components;class d extends o{render(){const{attributes:e,setAttributes:t,className:o}=this.props,l=e.choicearray.join("\n");return(0,r.jsx)(s,{children:(0,r.jsxs)(n,{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 l={slug:s,label:e};o&&(l.guestform=!0),t(l)}({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)(a,{label:__("Field Label Position","rsvpmaker"),value:e.labelPosition||"stacked",options:[{label:__("On separate line","rsvpmaker"),value:"stacked"},{label:__("Inline (left of field)","rsvpmaker"),value:"inline"}],onChange:e=>t({labelPosition:e})}),(0,r.jsx)(c,{label:__("Choices","rsvpmaker"),value:l,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)(p,{label:__("Include on Guest Form","rsvpmaker"),checked:e.guestform,help:e.guestform?"Included":"Not included",onChange:e=>{t({guestform:e})}}),(0,r.jsx)(p,{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:n,choicearray:a,guestform:i,labelPosition:c},setAttributes:p,isSelected:u}=e;var m="profile["+n+"]";const h=l({className:"inline"===c?"rsvp-label-inline":""});return(0,r.jsxs)(t,{children:[(0,r.jsx)(d,{...e}),(0,r.jsxs)("div",{...h,children:[(0,r.jsx)("p",{children:(0,r.jsxs)("label",{children:[o,":"]})}),(0,r.jsx)("div",{className:"rsvp-input-line",children:(0,r.jsx)("span",{children:(0,r.jsx)("select",{className:n,name:m,id:n,children:a.map(function(e,t){return(0,r.jsx)("option",{value:e,children:e})})})})})]}),s&&(0,r.jsx)("div",{className:"rsvp-fieldnote",children:s}),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 l=t[e]={exports:{}};return r[e](l,l.exports,o),l.exports}o.m=r,e=[],o.O=(r,t,s,l)=>{if(!t){var n=1/0;for(p=0;p<e.length;p++){for(var[t,s,l]=e[p],a=!0,i=0;i<t.length;i++)(!1&l||n>=l)&&Object.keys(o.O).every(e=>o.O[e](t[i]))?t.splice(i--,1):(a=!1,l<n&&(n=l));if(a){e.splice(p--,1);var c=s();void 0!==c&&(r=c)}}return r}l=l||0;for(var p=e.length;p>0&&e[p-1][2]>l;p--)e[p]=e[p-1];e[p]=[t,s,l]},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,l,[n,a,i]=t,c=0;if(n.some(r=>0!==e[r])){for(s in a)o.o(a,s)&&(o.m[s]=a[s]);if(i)var p=i(o)}for(r&&r(t);c<n.length;c++)l=n[c],o.o(e,l)&&e[l]&&e[l][0](),e[l]=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 s=o.O(void 0,[7988],()=>o(20));s=o.O(s)})();