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