(()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wp.blocks,o=window.wp.blockEditor,r=window.wp.i18n,s=window.wp.element,n=window.lodash,l=window.wp.apiFetch;var a=t.n(l);const i=window.wp.components,u=window.ReactJSXRuntime;let p=!1;(0,e.registerBlockType)("quform/form",{title:(0,r.__)("Form","quform"),icon:(0,u.jsx)(i.SVG,{version:"1.0",xmlns:"http://www.w3.org/2000/svg",width:"397.000000pt",height:"354.000000pt",viewBox:"0 0 397.000000 354.000000",preserveAspectRatio:"xMidYMid meet",children:(0,u.jsxs)(i.G,{transform:"translate(0.000000,354.000000) scale(0.100000,-0.100000)",fill:"currentColor",stroke:"none",children:[(0,u.jsx)(i.Path,{d:"M1660 3530 c-548 -67 -1036 -347 -1337 -768 -146 -204 -244 -433 -295 -687 -32 -160 -32 -451 0 -614 157 -784 810 -1360 1644 -1450 136 -15 2208 -15 2241 0 53 24 57 47 57 304 0 257 -4 280 -57 304 -16 7 -128 11 -319 11 l-295 0 67 83 c226 277 344 569 376 929 19 224 -6 432 -82 659 -206 622 -766 1089 -1450 1210 -131 24 -428 33 -550 19z m400 -635 c135 -21 230 -49 346 -104 139 -67 244 -140 344 -240 451 -454 449 -1114 -5 -1566 -467 -465 -1243 -473 -1726 -18 -148 140 -275 352 -326 548 -22 87 -26 120 -26 255 0 136 4 168 27 255 46 174 144 355 268 490 272 297 692 443 1098 380z"}),(0,u.jsx)(i.Path,{d:"M1255 2341 c-11 -5 -31 -21 -45 -36 -22 -23 -25 -36 -25 -96 0 -64 2 -71 33 -101 l32 -33 660 0 660 0 32 33 c31 30 33 37 33 102 0 65 -2 72 -33 102 l-32 33 -648 2 c-356 1 -656 -2 -667 -6z"}),(0,u.jsx)(i.Path,{d:"M1255 1901 c-11 -5 -31 -21 -45 -36 -22 -23 -25 -36 -25 -96 0 -64 2 -71 33 -101 l32 -33 405 0 405 0 32 33 c31 30 33 37 33 102 0 65 -2 72 -33 102 l-32 33 -393 2 c-215 1 -401 -2 -412 -6z"}),(0,u.jsx)(i.Path,{d:"M1255 1461 c-11 -5 -31 -21 -45 -36 -22 -23 -25 -36 -25 -96 0 -64 2 -71 33 -101 l32 -33 165 0 165 0 32 33 c31 30 33 37 33 102 0 65 -2 72 -33 102 l-32 33 -153 2 c-83 1 -161 -1 -172 -6z"})]})}),keywords:[(0,r.__)("quform","quform")],attributes:{id:{type:"string",default:""},name:{type:"string",default:""},show_title:{type:"boolean",default:!0},show_description:{type:"boolean",default:!0},popup:{type:"boolean",default:!1},content:{type:"string",default:""},width:{type:"string",default:""},values:{type:"string",default:""}},supports:{html:!1},category:"widgets",edit:t=>(0,u.jsxs)(s.Fragment,{children:[(0,u.jsx)(o.InspectorControls,{children:(0,u.jsxs)(i.PanelBody,{title:(0,r.__)("Form Settings","quform"),children:[(0,u.jsx)(i.SelectControl,{label:(0,r.__)("Select a form","quform"),value:t.attributes.id,options:quformBlockL10n.forms,onChange:e=>{var o;t.setAttributes({id:e,name:(o=e,(0,n.get)((0,n.find)(quformBlockL10n.forms,["value",o]),"label",(0,r.__)("Unknown","quform")))})}}),(0,u.jsx)(i.ToggleControl,{label:(0,r.__)("Show form title","quform"),checked:t.attributes.show_title,onChange:e=>{t.setAttributes({show_title:e})}}),(0,u.jsx)(i.ToggleControl,{label:(0,r.__)("Show form description","quform"),checked:t.attributes.show_description,onChange:e=>{t.setAttributes({show_description:e})}}),(0,u.jsx)(i.ToggleControl,{label:(0,r.__)("Popup form","quform"),checked:t.attributes.popup,onChange:e=>{t.setAttributes({popup:e}),e&&(p||(p=!0,a()({url:quformBlockL10n.ajaxUrl,method:"POST",body:new URLSearchParams({action:"quform_set_popup_enabled",_ajax_nonce:quformBlockL10n.quformEnablePopupNonce})})))}}),t.attributes.popup&&(0,u.jsx)(i.TextareaControl,{label:(0,r.__)("Content","quform"),value:t.attributes.content,help:(0,r.__)("The text or HTML to trigger the popup, shortcodes can also be used.","quform"),onChange:e=>{t.setAttributes({content:e})}}),t.attributes.popup&&(0,u.jsx)(i.TextControl,{label:(0,r.__)("Width (optional)","quform"),value:t.attributes.width,help:(0,r.__)("The width of the popup, any CSS width or number is accepted.","quform"),onChange:e=>{t.setAttributes({width:e})}}),(0,u.jsx)(i.TextareaControl,{label:(0,r.__)("Default values (optional)","quform"),value:t.attributes.values,help:(0,u.jsxs)(s.Fragment,{children:[(0,r.__)("Sets the default values of fields.","quform")," ",(0,u.jsx)(i.ExternalLink,{href:"https://support.themecatcher.net/quform-wordpress-v2/guides/customization/dynamic-default-value",children:(0,r.__)("Learn more","quform")})]}),onChange:e=>{t.setAttributes({values:e})}})]})}),(0,u.jsx)("p",{children:t.attributes.id?t.attributes.popup?/* translators: %s: form name */ /* translators: %s: form name */(0,r.sprintf)((0,r.__)("Popup Form: %s","quform"),t.attributes.name):/* translators: %s: form name */ /* translators: %s: form name */(0,r.sprintf)((0,r.__)("Form: %s","quform"),t.attributes.name):(0,r.__)("No form selected, choose a form in the block settings.","quform")})]}),save:()=>null})})();