(()=>{"use strict";const e=window.wp.blocks,t=window.wp.i18n,a=window.wp.blockEditor,n=window.wp.components,l=window.React,r=function(e){var n=e.attributes,r=e.setAttributes,c=n.label,i=n.hide_label,o=n.required,u=n.instructions,s=function(){return Math.random().toString(36).substring(2,10)};return(0,l.useEffect)((function(){if(!(!1 in n)){n.field_key||r({field_key:s()});var e=n.field_key;if(Array.from(document.querySelectorAll(".fea-field-key")).filter((function(t){return t.textContent===e})).length>1){var t=s();r({field_key:t})}}}),[]),React.createElement("div",{className:"acf-field"},React.createElement("span",{hidden:!0,className:"fea-field-key"},n.field_key),React.createElement("div",{className:"acf-label"},React.createElement("label",null,!i&&React.createElement(a.RichText,{tagName:"span",onChange:function(e){return r({label:e})},withoutInteractiveFormatting:!0,placeholder:(0,t.__)("Text Field","frontend-admin"),value:c}),o&&React.createElement("span",{className:"acf-required"},"*"))),React.createElement("div",{className:"acf-input"},u&&React.createElement(a.RichText,{tagName:"p",className:"description",onChange:function(e){return r({instructions:e})},withoutInteractiveFormatting:!0,value:u}),React.createElement("div",{className:"acf-input-wrap"+(e.wrapperClass?" "+e.wrapperClass:""),style:{display:"flex",width:"100%"}},e.children)))};var c="frontend-admin";const i=function(e){var l=e.attributes,r=e.setAttributes,i=l.label,o=l.hide_label,u=l.required,s=l.instructions,d=function(e){return e.toLowerCase().replace(/[^a-z0-9 _]/g,"").replace(/\s+/g,"_")};return React.createElement(a.InspectorControls,{field_key:"fea-inspector-controls"},React.createElement(n.PanelBody,{title:(0,t.__)("General",c),initialOpen:!0},React.createElement(n.TextControl,{label:(0,t.__)("Label",c),value:i,onChange:function(e){return r({label:e})}}),React.createElement(n.ToggleControl,{label:(0,t.__)("Hide Label",c),checked:o,onChange:function(e){return r({hide_label:e})}}),"name"in l&&React.createElement(n.TextControl,{label:(0,t.__)("Name",c),value:l.name||d(i),onChange:function(e){return r({name:d(e)})}}),"field_key"in l&&React.createElement(n.TextControl,{label:(0,t.__)("Field Key",c),value:l.field_key,readOnly:!0,onChange:function(e){}}),React.createElement(n.TextareaControl,{label:(0,t.__)("Instructions",c),rows:"3",value:s,onChange:function(e){return r({instructions:e})}}),React.createElement(n.ToggleControl,{label:(0,t.__)("Required",c),checked:u,onChange:function(e){return r({required:e})}}),e.children))};var o="frontend-admin";const u=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"frontend-admin/textarea","title":"Textarea","description":"Displays a textarea.","category":"frontend-admin","textdomain":"frontend-admin","supports":{"align":["wide"]},"attributes":{"field_key":{"type":"string","default":""},"name":{"type":"string","default":""},"label":{"type":"string","default":"Textarea"},"hide_label":{"type":"boolean","default":""},"required":{"type":"boolean","default":""},"default_value":{"type":"string","default":""},"placeholder":{"type":"string","default":""},"instructions":{"type":"string","default":""},"maxlength":{"type":"number","default":""},"rows":{"type":"number","default":""}},"editorScript":"file:../../textarea/index.js"}');(0,e.registerBlockType)(u,{edit:function(e){var l=e.attributes,c=e.setAttributes,u=l.default_value,s=l.placeholder,d=l.maxlength,f=l.rows,m=(l.cols,(0,a.useBlockProps)());return React.createElement("div",m,React.createElement(i,e,React.createElement(n.TextareaControl,{label:(0,t.__)("Default Value",o),value:u,onChange:function(e){return c({default_value:e})}}),React.createElement(n.TextareaControl,{label:(0,t.__)("Placeholder",o),value:s,onChange:function(e){return c({placeholder:e})}}),React.createElement(n.TextControl,{type:"number",label:(0,t.__)("Character Limit",o),value:d,onChange:function(e){return c({maxlength:e})}}),React.createElement(n.TextControl,{type:"number",label:(0,t.__)("Rows",o),value:f,onChange:function(e){return c({rows:e})}})),React.createElement(r,e,React.createElement("textarea",{maxLength:d,placeholder:s,rows:f,value:u,onChange:function(e){c({default_value:e.target.value})}},u)))},save:function(){return null}})})();