(()=>{"use strict";var e,r={817(){function e(r){var o,a,t="";if("string"==typeof r||"number"==typeof r)t+=r;else if("object"==typeof r)if(Array.isArray(r)){var l=r.length;for(o=0;o<l;o++)r[o]&&(a=e(r[o]))&&(t&&(t+=" "),t+=a)}else for(a in r)r[a]&&(t&&(t+=" "),t+=a);return t}const r=function(){for(var r,o,a=0,t="",l=arguments.length;a<l;a++)(r=arguments[a])&&(o=e(r))&&(t&&(t+=" "),t+=o);return t},o=window.wp.blocks,a=window.wp.components,t=window.wp.blockEditor,l=window.wp.i18n,n=JSON.parse('{"UU":"pronamic/form-control"}'),s=window.ReactJSXRuntime,i=["textarea","text","search","url","tel","email","password","number"];(0,o.registerBlockType)(n.UU,{edit:({attributes:e,setAttributes:o})=>{const{name:n,value:p,reference:c,required:m,placeholder:u}=e,_={autoComplete:"off",placeholder:e.placeholder,type:e.type,onChange:e=>{o({value:e.target.value})}},f=(0,t.useBlockProps)(),d=(0,t.__experimentalUseColorProps)(e),x=(0,t.__experimentalUseBorderProps)(e),h=r("wp-block-pronamic-form-control__element",d.className,x.className);_.className=h,_.style={...d.style,...x.style},_.defaultValue=e.value;const v="textarea"===e.type?"textarea":"input";return["textarea","radio","checkbox"].includes(e.type)||(_.type="pronamic-"+e.type),(0,s.jsxs)("div",{...f,children:[(0,s.jsx)(t.InspectorControls,{children:(0,s.jsxs)(a.PanelBody,{title:(0,l.__)("Settings","pronamic-forms"),children:[(0,s.jsx)(a.SelectControl,{label:(0,l.__)("Type","pronamic-forms"),value:e.type,options:[{label:(0,l.__)("Text","pronamic-forms"),value:"text"},{label:(0,l.__)("Textarea","pronamic-forms"),value:"textarea"},{label:(0,l.__)("Password","pronamic-forms"),value:"password"},{label:(0,l.__)("URL","pronamic-forms"),value:"url"},{label:(0,l.__)("Email address","pronamic-forms"),value:"email"},{label:(0,l.__)("Telephone number","pronamic-forms"),value:"tel"},{label:(0,l.__)("Checkbox","pronamic-forms"),value:"checkbox"},{label:(0,l.__)("Radio","pronamic-forms"),value:"radio"}],onChange:e=>{o({type:e})}}),(0,s.jsx)(a.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,l.__)("Required","pronamic-forms"),help:(0,l.__)("Select this option to make the input required.","pronamic-forms"),checked:m,onChange:e=>{o({required:e})}}),i.includes(e.type)&&(0,s.jsx)(a.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,l.__)("Placeholder","pronamic-forms"),help:(0,l.__)("Text that appears in the form element when no value has been entered.","pronamic-forms"),value:u,onChange:e=>{o({placeholder:e})}})]})}),(0,s.jsxs)(t.InspectorControls,{group:"advanced",children:[(0,s.jsx)(a.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off",label:(0,l.__)("Name","pronamic-forms"),value:n,onChange:e=>{o({name:e})}}),(0,s.jsx)(a.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off",label:(0,l.__)("Value","pronamic-forms"),value:p,onChange:e=>{o({value:e})}}),(0,s.jsx)(a.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off",label:(0,l.__)("Reference","pronamic-forms"),value:c,onChange:e=>{o({reference:e})}})]}),(0,s.jsx)(v,{..._})]})},save:({attributes:e})=>{const o=(0,t.__experimentalGetColorClassesAndStyles)(e),a=(0,t.__experimentalGetBorderClassesAndStyles)(e),l=function(e,o={}){return e.name&&(o.name=e.name),e.required&&(o.required="required"),i.includes(e.type)&&e.placeholder&&(o.placeholder=e.placeholder),o.className=r("wp-block-pronamic-form-control__element",o.className),o.value=e.value,"textarea"===e.type?(0,s.jsx)("textarea",{...o}):(o.type||(o.type=e.type),(0,s.jsx)("input",{...o}))}(e,{className:r(o.className,a.className),style:{...o.style,...a.style}}),n=t.useBlockProps.save();return(0,s.jsx)("div",{...n,children:l})}})}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var l=o[e]={exports:{}};return r[e](l,l.exports,a),l.exports}a.m=r,e=[],a.O=(r,o,t,l)=>{if(!o){var n=1/0;for(c=0;c<e.length;c++){for(var[o,t,l]=e[c],s=!0,i=0;i<o.length;i++)(!1&l||n>=l)&&Object.keys(a.O).every(e=>a.O[e](o[i]))?o.splice(i--,1):(s=!1,l<n&&(n=l));if(s){e.splice(c--,1);var p=t();void 0!==p&&(r=p)}}return r}l=l||0;for(var c=e.length;c>0&&e[c-1][2]>l;c--)e[c]=e[c-1];e[c]=[o,t,l]},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={336:0,40:0};a.O.j=r=>0===e[r];var r=(r,o)=>{var t,l,[n,s,i]=o,p=0;if(n.some(r=>0!==e[r])){for(t in s)a.o(s,t)&&(a.m[t]=s[t]);if(i)var c=i(a)}for(r&&r(o);p<n.length;p++)l=n[p],a.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return a.O(c)},o=globalThis.webpackChunkpronamic_pay=globalThis.webpackChunkpronamic_pay||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})();var t=a.O(void 0,[40],()=>a(817));t=a.O(t)})();