var WPFormsBuilder=window.WPFormsBuilder||function(r,l,b){var m,v,y={},i=!0,a=!1,k={settings:{spinner:'',spinnerInline:'',tinymceDefaults:{tinymce:{toolbar1:"bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link"},quicktags:!0},pagebreakTop:!1,pagebreakBottom:!1,upload_img_modal:!1},init:function(){var e=this;wpforms_panel_switch=!0,m=this.settings,b(k.ready),b(l).on("load",function(){"function"==typeof b.ready.then?b.ready.then(k.load):k.load()}),b(l).on("beforeunload",function(){if(!e.formIsSaved()&&i)return wpforms_builder.are_you_sure_to_close})},load:function(){if(wpf.getQueryString("newform")&&k.formSave(!1),"revisions"===b("#wpforms-panels-toggle .active").data("panel")&&k.updateRevisionPreview(),WPFormsUtils.triggerEvent(v,"wpformsBuilderReady").isDefaultPrevented())return!1;k.hideLoadingOverlay(),"1"==wpforms_builder.template_modal_display&&"fields"===wpf.getQueryString("view")&&b.alert({title:wpforms_builder.template_modal_title,content:wpforms_builder.template_modal_msg,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}})},ready:function(){k.isVisitedViaBackButton()?location.reload():(v=b("#wpforms-builder"),y.$helpButton=b("#wpforms-help"),y.$previewButton=b("#wpforms-preview-btn"),y.$embedButton=b("#wpforms-embed"),y.$saveButton=b("#wpforms-save"),y.$exitButton=b("#wpforms-exit"),y.$noFieldsOptions=b("#wpforms-panel-fields .wpforms-no-fields-holder .no-fields"),y.$noFieldsPreview=b("#wpforms-panel-fields .wpforms-no-fields-holder .no-fields-preview"),y.$formPreview=b("#wpforms-panel-fields .wpforms-preview-wrap"),y.$revisionPreview=b("#wpforms-panel-revisions .wpforms-panel-content"),y.defaultEmailSelector=".wpforms-field-option-email .wpforms-field-option-row-default_value input",y.$defaultEmail=b(y.defaultEmailSelector),y.$focusOutTarget=null,y.$nextFieldId=b("#wpforms-field-id"),y.$fieldOptions=b("#wpforms-field-options"),y.$fieldsPreviewWrap=b("#wpforms-panel-fields .wpforms-panel-content-wrap"),y.$sortableFieldsWrap=b("#wpforms-panel-fields .wpforms-field-wrap"),y.$addFieldsButtons=b(".wpforms-add-fields-button").not(".not-draggable").not(".warning-modal").not(".education-modal"),y.$fieldsSidebar=b("#wpforms-panel-fields .wpforms-add-fields"),y.$searchInput=b("#wpforms-search-fields-input"),y.$sidebarToggle=b(".wpforms-panels .wpforms-panel-sidebar-content .wpforms-panel-sidebar-toggle"),k.isBuilderInPopup()&&(y.$embedButton.remove(),y.$previewButton.addClass("wpforms-alone")),k.loadMsWinCSS(),k.bindUIActions(),m.formID=b("#wpforms-builder-form").data("id"),m.pagebreakTop=b(".wpforms-pagebreak-top").length,m.pagebreakBottom=b(".wpforms-pagebreak-bottom").length,v.on("keypress","#wpforms-builder-form :input:not(textarea)",function(e){13===e.keyCode&&e.preventDefault()}),b(".wpforms-panel").each(function(e,i){var o,t=b(this),r=t.find(".wpforms-panel-sidebar-section.configured").first();r.length?(o=r.data("section"),r.addClass("active"),t.find(".wpforms-panel-content-section-"+o).show().addClass("active"),t.find(".wpforms-panel-content-section-default").hide()):(t.find(".wpforms-panel-content-section:first-of-type").show().addClass("active"),t.find(".wpforms-panel-sidebar-section:first-of-type").addClass("active"))}),k.loadEntryPreviewFields(),k.fieldChoiceSortable("select"),k.fieldChoiceSortable("radio"),k.fieldChoiceSortable("checkbox"),k.fieldChoiceSortable("payment-multiple"),k.fieldChoiceSortable("payment-checkbox"),k.fieldChoiceSortable("payment-select"),b(".wpforms-add-fields-group").each(function(e,i){k.fieldGroupToggle(b(this),"load")}),k.registerTemplates(),k.trimFormTitle(),wpf.initTooltips(),k.loadColorPickers(),k.captchaToggle(),k.confirmationsSetup(),k.notificationToggle(),k.notificationsByStatusAlerts(),k.builderHotkeys(),b("#wpforms-setup-name").val(b("#wpforms-panel-field-settings-form_title").val()),jconfirm.defaults={closeIcon:!1,backgroundDismiss:!1,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"400px",animateFromElement:!1,content:wpforms_builder.something_went_wrong},k.dropdownField.init(),k.iconChoices.init(),k.checkEmptyDynamicChoices(),k.initSomeFieldOptions(),k.dismissNotice())},checkEmptyDynamicChoices:function(){var e=wpf.orders.choices||{};Object.keys(e).length&&wpf.orders.fields.forEach(function(i){if(k.dropdownField.helpers.isDynamicChoices(i)){var o=b("#wpforms-field-"+i),t=k.dropdownField.helpers.getDynamicChoicesOptionType(i),r=k.dropdownField.helpers.getDynamicChoicesOptionSource(i),n=k.dropdownField.helpers.isDynamicChoicesOptionModern(i);let e=n?o.find(".has-no-choices").length:0===o.find(".primary-input option:not(.placeholder), .primary-input li").length;n&&!e&&(o=b("#wpforms-field-option-"+i+"-placeholder").val(),n=k.dropdownField.helpers.getInitialChoices(i),e=1===n.length&&n[0].label===o&&!0===n[0].placeholder),e&&k.emptyChoicesNotice(i,r,t)}})},loadMsWinCSS:function(){var e=navigator.userAgent;e.indexOf("Windows")<0||e.indexOf("Chrome")<0&&e.indexOf("Firefox")<0||b("").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:wpforms_builder.ms_win_css_url})},isVisitedViaBackButton:function(){var i;return!!performance&&(i=!1,performance.getEntriesByType("navigation").forEach(function(e){"back_forward"===e.type&&(i=!0)}),i)},hideLoadingOverlay:function(){var e=b("#wpforms-builder-overlay");e.addClass("fade-out"),setTimeout(function(){e.hide()},250)},showLoadingOverlay:function(){var e=b("#wpforms-builder-overlay");e.removeClass("fade-out"),e.show()},initSomeFieldOptions:function(){k.toggleAllOptionGroups(v),v.find(".wpforms-field-option-row-date .type select").trigger("change")},dropdownField:{config:{modernClass:"choicesjs-select",args:{searchEnabled:!1,searchChoices:!1,renderChoiceLimit:1,shouldSort:!1,callbackOnInit:function(){var e=b(this.containerOuter.element),i=e.closest(".wpforms-field").find("select");e.hasClass("is-disabled")&&e.removeClass("is-disabled"),i.is("[readonly]")&&(this.disable(),i.prop("disabled",!1)),this.passedElement.element.multiple&&this.getValue(!0).length&&b(this.input.element).addClass("choices__input--hidden")}}},init:function(){v.find("."+k.dropdownField.config.modernClass).each(function(){k.dropdownField.events.choicesInit(b(this))}),v.on("change",".wpforms-field-option-select .wpforms-field-option-row-multiple input",k.dropdownField.events.multiple),v.on("change",".wpforms-field-option-select .wpforms-field-option-row-style select, .wpforms-field-option-payment-select .wpforms-field-option-row-style select",k.dropdownField.events.applyStyle),v.on("click",".choices",function(e){var i=b(this),o=i.find("select").data("choicesjs");o&&i.hasClass("is-open")&&e.target.classList.contains("choices__inner")&&o.hideDropdown()})},events:{choicesInit:function(e){let i=1===e.data("choicesjs-use-ajax"),o;o="select_pages"===e.data("choicesjs-callback-fn")?WPForms.Admin.Builder.WPFormsChoicesJS.setup(e[0],k.dropdownField.config.args,{action:"wpforms_ajax_search_pages_for_dropdown",nonce:i?wpforms_builder.nonce:null}):new Choices(e[0],k.dropdownField.config.args),k.dropdownField.helpers.setInstance(e,o),k.dropdownField.helpers.addPlaceholderChoice(e,o),e.closest(".choices").toggleClass("wpforms-hidden",!o.config.choices.length)},multiple:function(e){var i=b(this).closest(".wpforms-field-option-row-multiple").data().fieldId,o=k.dropdownField.helpers.getPrimarySelector(i),t=b("#wpforms-field-option-row-"+i+"-choices input.default"),r=o.find(".placeholder"),n=k.dropdownField.helpers.isDynamicChoices(i),e=e.target.checked,s=e?"checkbox":"radio";o.prop("multiple",e),t.prop("type",s),n&&o.find("option:selected").prop("selected",!1),s=t.filter(":checked"),!e&&s.length&&(t.prop("checked",!1),b(s.get(0)).prop("checked",!0)),r.length&&r.prop("selected",!e),k.dropdownField.helpers.update(i,n)},applyStyle:function(){var e=b(this),i=e.closest(".wpforms-field-option-row-style").data().fieldId;"modern"===e.val()?k.dropdownField.helpers.convertClassicToModern(i):k.dropdownField.helpers.convertModernToClassic(i)}},helpers:{convertModernToClassic:function(e){var i=k.dropdownField.helpers.getPrimarySelector(e),o=k.dropdownField.helpers.isDynamicChoices(e),i=k.dropdownField.helpers.getInstance(i);i&&"function"==typeof i.destroy&&(i.destroy(),k.dropdownField.helpers.updatePlaceholderChoice(i,e)),o||k.fieldChoiceUpdate("select",e)},getInitialChoices(e){e=k.dropdownField.helpers.getPrimarySelector(e);return k.dropdownField.helpers.getInstance(e).config.choices},convertClassicToModern:function(e){var i=k.dropdownField.helpers.getPrimarySelector(e);k.dropdownField.helpers.isDynamicChoices(e)||k.fieldChoiceUpdate("select",e),k.dropdownField.events.choicesInit(i)},update:function(e,i){var o=k.dropdownField.helpers.getPrimarySelector(e);k.dropdownField.helpers.isModernSelect(o)?(k.dropdownField.helpers.convertModernToClassic(e),i||k.dropdownField.events.choicesInit(o)):i||k.fieldChoiceUpdate("select",e)},addPlaceholderChoice:function(e,i){var o,t,e=e.closest(".wpforms-field");return!(e.length<=0||(e=e.data().fieldId,o=k.dropdownField.helpers.hasDefaults(e),k.dropdownField.helpers.isDynamicChoices(e)&&(o=!1),!1!==k.dropdownField.helpers.searchPlaceholderChoice(i))||!i.config.choices.length||(e=i.config.choices[0].label,t=b(i.passedElement.element).prop("multiple"),i.setChoices([{value:"",label:e,selected:!(t||o),placeholder:!0}],"value","label",!1),t&&b(i.input.element).prop("placeholder",e),0))},searchPlaceholderChoice:function(e){var t=!1;return e.config.choices.forEach(function(e,i,o){if(void 0!==e.placeholder&&!0===e.placeholder)return!(t={key:i,item:e})}),t},updatePlaceholderChoice:function(e,i){var o=b(e.passedElement.element),i=wpf.sanitizeHTML(b("#wpforms-field-option-"+i+"-placeholder").val()),e=k.dropdownField.helpers.searchPlaceholderChoice(e),t={};"object"==typeof e&&(t=b(o.find("option").get(e.key))),""!==i?!b.isEmptyObject(t)&&t.length?t.addClass("placeholder").text(i):o.prepend('"):t.length&&t.remove()},isModernSelect:function(e){e=k.dropdownField.helpers.getInstance(e);return"object"==typeof e&&!b.isEmptyObject(e)&&e.initialised},setInstance:function(e,i){e.data("choicesjs",i)},getInstance:function(e){return e.data("choicesjs")},getDynamicChoicesOption:function(e){e=b("#wpforms-field-option-"+e+"-dynamic_choices");return!!e.length&&e},isDynamicChoices:function(e){e=k.dropdownField.helpers.getDynamicChoicesOption(e);return!!e.length&&""!==e.val()},isDynamicChoicesOptionModern:function(e){e=b("#wpforms-field-option-"+e+"-style");return!!e.length&&"modern"===e.val()},getDynamicChoicesOptionType:function(e){e=k.dropdownField.helpers.getDynamicChoicesOption(e);return!!e.length&&e.val()},getDynamicChoicesOptionSource:function(e){var i=k.dropdownField.helpers.getDynamicChoicesOptionType(e),e=b("#wpforms-field-option-"+e+"-dynamic_"+i);return!!e.length&&e.find("option:selected").text()},hasDefaults:function(e){return!!b("#wpforms-field-option-row-"+e+"-choices .choices-list").find("input.default:checked").length},getPrimarySelector:function(e){return b("#wpforms-field-"+e+" .primary-input")}}},numberSliderEvents:function(e){e.on("focusout",".wpforms-field-option-row-min_max .wpforms-input-row .wpforms-number-slider-min",k.fieldNumberSliderUpdateMin),e.on("focusout",".wpforms-field-option-row-min_max .wpforms-input-row .wpforms-number-slider-max",k.fieldNumberSliderUpdateMax),e.on("input",".wpforms-number-slider-default-value",_.debounce(k.changeNumberSliderDefaultValue,500)),e.find(".wpforms-number-slider-default-value").trigger("input"),e.on("input",".wpforms-number-slider-step",_.debounce(k.changeNumberSliderStep,500)),e.on("focusout",".wpforms-number-slider-step",k.checkNumberSliderStep),e.on("input",".wpforms-number-slider-value-display",_.debounce(k.changeNumberSliderValueDisplay,500)),e.on("input",".wpforms-number-slider-min",_.debounce(k.changeNumberSliderMin,500)),e.on("input",".wpforms-number-slider-max",_.debounce(k.changeNumberSliderMax,500))},changeNumberSliderMin:function(e){var i=b(e.target).parents(".wpforms-field-option-row").data("fieldId"),o=parseFloat(e.target.value);isNaN(o)||k.updateNumberSliderDefaultValueAttr(i,e.target.value,"min")},changeNumberSliderMax:function(e){var i=b(e.target).parents(".wpforms-field-option-row").data("fieldId"),o=parseFloat(e.target.value);isNaN(o)||k.updateNumberSliderDefaultValueAttr(i,e.target.value,"max").updateNumberSliderStepValueMaxAttr(i,e.target.value)},changeNumberSliderValueDisplay:function(e){var i=e.target.value,e=b(e.target).parents(".wpforms-field-option-row").data("fieldId"),o=r.getElementById("wpforms-field-option-"+e+"-default_value");o&&k.updateNumberSliderHintStr(e,i).updateNumberSliderHint(e,o.value)},changeNumberSliderStep(e){var i,o=parseFloat(e.target.value);isNaN(o)||o<=0||((i=parseFloat(e.target.max))

${e}

`))},removeNotice(e){e.length&&e.find(".wpforms-alert").length&&e.find(".wpforms-alert").remove()},checkNumberSliderStep:function(e){var e=parseFloat(e.target.value),i=b(this);!isNaN(e)&&0"+i+"")),this},fieldNumberSliderUpdateMin:function(e){var i=b(e.target).parents(".wpforms-field-option-row-min_max"),o=parseFloat(i.find(".wpforms-number-slider-max").val()),t=parseFloat(e.target.value);isNaN(t)||(o<=t?(e.preventDefault(),this.value=o):(e=i.data("field-id"),v.find("#wpforms-field-"+e+' input[type="range"]').attr("min",t)))},fieldNumberSliderUpdateMax:function(e){var i=b(e.target).parents(".wpforms-field-option-row-min_max"),o=parseFloat(i.find(".wpforms-number-slider-min").val()),t=parseFloat(e.target.value);isNaN(t)||(t<=o?(e.preventDefault(),this.value=o):(e=i.data("field-id"),v.find("#wpforms-field-"+e+' input[type="range"]').attr("max",t)))},updateNumberSliderStepValueMaxAttr:function(e,i){var o,e=r.getElementById("wpforms-field-option-"+e+"-step");return e&&(o=parseFloat(e.value),e.setAttribute("max",i),(i=parseFloat(i)) .label-title .text").text(r)}),v.on("input",".wpforms-field-option-row-description textarea",function(){var e=b(this),i=wpf.sanitizeHTML(e.val()),o=e.parent().data("field-id"),t=b("#wpforms-field-"+o).find(".description");k.updateDescription(t,i),e.trigger("wpformsDescriptionFieldUpdated",{id:o,descField:t,value:i})}),v.on("change",".wpforms-field-option-row-required input",function(e){var i=b(this).closest(".wpforms-field-option-row").data("field-id");b("#wpforms-field-"+i).toggleClass("required")}),v.on("change",".wpforms-field-option-row-confirmation input",function(e){var i=b(this).closest(".wpforms-field-option-row").data("field-id");b("#wpforms-field-"+i).find(".wpforms-confirm").toggleClass("wpforms-confirm-enabled wpforms-confirm-disabled"),b("#wpforms-field-option-"+i).toggleClass("wpforms-confirm-enabled wpforms-confirm-disabled")}),v.on("change",".wpforms-field-option-row-filter_type select",function(){var e=b(this).parent().data("field-id"),e=b("#wpforms-field-option-"+e);b(this).val()?(e.removeClass("wpforms-filter-allowlist"),e.removeClass("wpforms-filter-denylist"),e.addClass("wpforms-filter-"+b(this).val())):(e.removeClass("wpforms-filter-allowlist"),e.removeClass("wpforms-filter-denylist"))}),v.on("focusout",".wpforms-field-option-row-allowlist textarea,.wpforms-field-option-row-denylist textarea",function(){const e=b(".wpforms-field-option-row-allowlist textarea"),i=b(".wpforms-field-option-row-denylist textarea"),o=b(this);let t="allow";""!==o.val()&&(o.is(i)&&(t="deny"),b.get(wpforms_builder.ajax_url,{nonce:wpforms_builder.nonce,content:JSON.stringify({allow:e.val(),deny:i.val(),current:t}),action:"wpforms_sanitize_restricted_rules"},function(e){e.success&&(o.val(e.data.currentField),0!==(e=e.data.intersect).length)&&(e="

"+wpforms_builder.allow_deny_lists_intersect+'

'+e+"

",b.alert({title:wpforms_builder.heads_up,content:e,icon:"fa fa-exclamation-circle",type:"red",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}))}))}),v.on("click",function(){k.focusOutEvent()}),v.on("focusout",y.defaultEmailSelector,function(){y.$focusOutTarget=b(this)}),v.on("change",".wpforms-field-option-row-size select",function(e){var i=b(this),o=i.val(),i=i.parent().data("field-id");b("#wpforms-field-"+i).removeClass("size-small size-medium size-large").addClass("size-"+o)}),v.on("input",".wpforms-field-option-row-placeholder input",function(){var e=b(this),i=e.parent().data("field-id"),o=b("#wpforms-field-"+i),t=o.find(".primary-input");let r=wpf.sanitizeHTML(e.val());"payment-single"===o.data("field-type")&&""===r&&(r=b("#wpforms-field-option-"+i+"-price").prop("placeholder")),t.is("select")?k.dropdownField.helpers.isModernSelect(t)?(e=k.dropdownField.helpers.getInstance(t),t.prop("multiple")?b(e.input.element).prop("placeholder",r):(e.setChoiceByValue(""),t.closest(".choices").find(".choices__inner .choices__placeholder").text(r),o=b("#wpforms-field-option-"+i+"-dynamic_choices").val(),k.dropdownField.helpers.update(i,o))):(e=t.find(".placeholder"),!r.length&&e.length?e.remove():(e.length?e.text(r):t.prepend('"),t.find(".placeholder").prop("selected",!t.prop("multiple")))):t.prop("placeholder",r)}),v.on("input",".wpforms-field-option-row-confirmation_placeholder input",function(e){var i=b(this),o=i.val(),i=i.parent().data("field-id");b("#wpforms-field-"+i).find(".secondary-input").attr("placeholder",o)}),v.on("input",".wpforms-field-option .format-selected input.placeholder",function(){var e=b(this),i=e.val(),e=e.closest(".wpforms-field-option-row"),o=e.data("field-id"),e=e.data("subfield");b("#wpforms-field-"+o).find(".wpforms-"+e+" input").attr("placeholder",i)}),v.on("input",".wpforms-field-option-address input.placeholder",function(){var e=b(this),i=e.closest(".wpforms-field-option-row"),o=i.data("field-id"),t=i.data("subfield"),r=b("#wpforms-field-"+o+" .wpforms-"+t).find("input, select"),i=i.find("#wpforms-field-option-"+o+"-"+t+"_default");const n=i.val(),s=i.find("option:selected").text();let l=e.val();r.each(function(){var e,i,o=b(this);o.is("select")?(e=o.find(".placeholder"),i=""===n&&""!==l?l:s,e.text(i)):o.attr("placeholder",l)})}),v.on("input",".wpforms-field-option-row-default_value input",function(){var e=b(this),i=wpf.sanitizeHTML(e.val()),e=e.closest(".wpforms-field-option-row").data("field-id");b("#wpforms-field-"+e+" .primary-input").val(i)}),v.on("input",".wpforms-field-options-column input.default",function(){var e=b(this),i=wpf.sanitizeHTML(e.val()),e=e.closest(".wpforms-field-option-row"),o=e.data("field-id"),e=e.data("subfield");b("#wpforms-field-"+o+" .wpforms-"+e+" input").val(i)}),v.on("change",".wpforms-field-option-address select.default",function(){var e=b(this),i=e.val(),o=e.find("option:selected").text(),e=e.closest(".wpforms-field-option-row"),t=e.data("field-id"),r=e.data("subfield"),n=b("#wpforms-field-option-"+t+"-scheme").val(),e=e.find("#wpforms-field-option-"+t+"-"+r+"_placeholder").val(),t=b("#wpforms-field-"+t+" .wpforms-address-scheme-"+n+" .wpforms-"+r+" .placeholder");""===i&&0{hh}'.replace(/{hh}/g,o);_.forEach(["start","end"],function(e){var i=v.find("#wpforms-field-option-"+r+"-time_limit_hours_"+e+"_hour"),e=v.find("#wpforms-field-option-"+r+"-time_limit_hours_"+e+"_ampm");let o=parseInt(i.val(),10),t=e.val();o=(o=24==s?"pm"===t?o+12:o:(t=12 i.fa").css("color",k.getValidColorPickerValue(e))}),b(r).on("change",".wpforms-field-option-row-disclaimer_format input",function(){var e=b(this).closest(".wpforms-field-option-row").data("field-id");b("#wpforms-field-"+e+" .description").toggleClass("disclaimer")}),v.on("change",".wpforms-field-option-row-limit_enabled input",function(e){k.updateTextFieldsLimitControls(b(e.target).closest(".wpforms-field-option-row-limit_enabled").data().fieldId,e.target.checked)}),v.on("change",".wpforms-field-option-row-password-strength input",function(e){k.updatePasswordStrengthControls(b(e.target).parents(".wpforms-field-option-row-password-strength").data().fieldId,e.target.checked)}),v.on("change",".wpforms-field-option-richtext .wpforms-field-option-row-media_enabled input",k.updateRichTextMediaFieldsLimitControls),v.on("change",".wpforms-field-option-richtext .wpforms-field-option-row-style select",k.updateRichTextStylePreview),v.on("change",".wpforms-field-option-file-upload .wpforms-field-option-row-style select, .wpforms-field-option-file-upload .wpforms-field-option-row-max_file_number input",function(e){k.fieldFileUploadPreviewUpdate(e.target)}),k.numberSliderEvents(v),k.fieldDynamicChoiceToggleImageChoices(),k.fieldDynamicChoiceToggleIconChoices(),v.on("change",".wpforms-field-option-row-show_price_after_labels input",function(e){var i=b(this).closest(".wpforms-field-option-group-basic").find(".wpforms-field-option-row-choices .choices-list");k.fieldChoiceUpdate(i.data("field-type"),i.data("field-id"))}),v.on("input",".wpforms-field-option-row-preview-notice textarea",k.updatePreviewNotice).on("change",".wpforms-field-option-row-preview-notice-enable input",k.toggleEntryPreviewNotice).on("wpformsFieldAdd",k.maybeLockEntryPreviewGroupOnAdd).on("wpformsFieldMove",k.maybeLockEntryPreviewGroupOnMove).on("click",".wpforms-entry-preview-block",k.entryPreviewBlockField),k.defaultStateEntryPreviewNotice()},focusOutEvent:function(){if(null!==y.$focusOutTarget){if(y.$defaultEmail.is(y.$focusOutTarget)){var i=y.$focusOutTarget;if(""===i.val())return;b.get(wpforms_builder.ajax_url,{nonce:wpforms_builder.nonce,content:i.val(),action:"wpforms_sanitize_default_email"},function(e){e.success&&(i.val(e.data),i.trigger("input"))})}y.$focusOutTarget=null}},isFieldPreviewActionsDisabled:function(e){return k.isFormPreviewActionsDisabled(e)||b(e).closest(".wpforms-field").hasClass("ui-sortable-disabled")},isFormPreviewActionsDisabled:function(e){return b(e).closest(".wpforms-field-wrap").hasClass("ui-sortable-disabled")},fieldGroupToggle:function(e,i){var e=b(e),o=e.next(".wpforms-add-fields-buttons"),t=o.parent(),r=e.find("i"),n="wpforms_field_group_"+e.data("group");"click"===i?(t.hasClass("wpforms-closed")?wpCookies.remove(n):wpCookies.set(n,"true",2592e3),r.toggleClass("wpforms-angle-right"),o.stop().slideToggle("",function(){t.toggleClass("wpforms-closed")})):"load"===i&&(o=e.find(".wpforms-add-fields-buttons"),r=e.find(".wpforms-add-fields-heading i"),n=e.find(".wpforms-add-fields-heading").data("group"),"true"===wpCookies.get("wpforms_field_group_"+n))&&(r.toggleClass("wpforms-angle-right"),o.hide(),e.toggleClass("wpforms-closed"))},updateDescription:function(e,i){e.hasClass("nl2br")&&(i=i.replace(/\n/g,"
")),e.html(i)},defaultStateEntryPreviewNotice:function(){b(".wpforms-field-option-row-preview-notice-enable input").each(function(){b(this).trigger("change")})},updatePreviewNotice:function(){var e=b(this),i=wpf.sanitizeHTML(e.val()).trim(),e=e.parent().data("field-id"),e=b("#wpforms-field-"+e).find(".wpforms-entry-preview-notice"),i=i||wpforms_builder.entry_preview_default_notice;k.updateDescription(e,i)},toggleEntryPreviewNotice:function(){var e=b(this),i=e.closest(".wpforms-field-option").data("field-id"),o=b("#wpforms-field-"+i),i=b("#wpforms-field-option-"+i+" .wpforms-field-option-row-preview-notice"),t=o.find(".wpforms-entry-preview-notice"),o=o.find(".wpforms-alert-info");(e.is(":checked")?(o.hide(),t.show(),i):(i.hide(),t.hide(),o)).show()},fieldDelete:function(e){var i=b("#wpforms-field-"+e),o=i.data("field-type");"pagebreak"===o&&i.hasClass("wpforms-field-entry-preview-not-deleted")?k.youCantRemovePageBreakFieldPopup():i.hasClass("no-delete")?k.youCantRemoveFieldPopup():k.confirmFieldDeletion(e,o)},youCantRemovePageBreakFieldPopup:function(){b.alert({title:wpforms_builder.heads_up,content:wpforms_builder.entry_preview_require_page_break,icon:"fa fa-exclamation-circle",type:"red",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})},youCantReorderFieldPopup:function(){console.warn('WARNING! Function "WPFormsBuilder.youCantReorderFieldPopup()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.youCantReorderFieldPopup()" function instead!'),WPForms.Admin.Builder.DragFields.youCantReorderFieldPopup()},youCantRemoveFieldPopup:function(){b.alert({title:wpforms_builder.field_locked,content:wpforms_builder.field_locked_no_delete_msg,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}})},validationErrorNotificationPopup:function(e){b.alert({title:wpforms_builder.heads_up,content:e,icon:"fa fa-exclamation-circle",type:"red",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}})},confirmFieldDeletion:function(e,i){var o={id:e,message:wpforms_builder.delete_confirm};WPFormsUtils.triggerEvent(v,"wpformsBeforeFieldDeleteAlert",[o,i]).isDefaultPrevented()||b.confirm({title:!1,content:o.message,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){k.fieldDeleteById(e)}},cancel:{text:wpforms_builder.cancel}}})},fieldDeleteById:function(t,e=0,i=400){b("#wpforms-field-"+t).fadeOut(i,function(){var e=b(this),i=e.data("field-type"),e=(v.trigger("wpformsBeforeFieldDelete",[t,i]),e.remove(),b("#wpforms-field-option-"+t).remove(),b(".wpforms-field, .wpforms-title-desc").removeClass("active"),k.fieldTabToggle("add-fields"),b(".wpforms-field-option")),o=v.find(".wpforms-field-submit");e.length<1&&(y.$sortableFieldsWrap.append(y.$noFieldsPreview.clone()),y.$fieldOptions.append(y.$noFieldsOptions.clone()),o.hide()),e.filter(":not(.wpforms-field-option-layout)").length||o.hide(),v.trigger("wpformsFieldDelete",[t,i])})},loadEntryPreviewFields:function(){var e=b("#wpforms-panel-fields .wpforms-field-wrap .wpforms-field-entry-preview");e.length&&e.each(function(){k.lockEntryPreviewFieldsPosition(b(this).data("field-id"))})},fieldEntryPreviewDelete:function(e,i,o){"entry-preview"===o&&(i=(o=b("#wpforms-field-"+i)).prevAll(".wpforms-field-pagebreak").first(),o=o.nextAll(".wpforms-field-pagebreak").first().data("field-id"),o=b("#wpforms-field-option-"+o),i.removeClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),o.find(".wpforms-entry-preview-block").removeClass("wpforms-entry-preview-block"),v.trigger("wpformsFieldDragToggle",[i.data("field-id"),i.data("field-type")]))},maybeLockEntryPreviewGroupOnMove:function(e,i){i.item.hasClass("wpforms-field-pagebreak")&&k.maybeLockEntryPreviewGroupOnAdd(e,i.item.data("field-id"),"pagebreak")},maybeLockEntryPreviewGroupOnAdd:function(e,i,o){var t,r,n,s,l,a,d,f,p;"pagebreak"===o&&(t=b("#wpforms-field-"+i),n=(r=b("#wpforms-field-option-"+i+" .wpforms-field-option-row-prev_toggle")).find("input"),l=(s=t.prevAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first()).data("field-id"),d=(a=b("#wpforms-field-option-"+l+" .wpforms-field-option-row-prev_toggle")).find("input"),f=t.nextAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first(),p=b("#wpforms-field-option-"+f.data("field-id")+" .wpforms-field-option-row-prev_toggle"),s.hasClass("wpforms-field-entry-preview")||f.hasClass("wpforms-field-entry-preview"))&&(s.hasClass("wpforms-field-entry-preview")?(n.attr("checked","checked").trigger("change"),r.addClass("wpforms-entry-preview-block"),p.removeClass("wpforms-entry-preview-block")):(t.addClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),v.trigger("wpformsFieldDragToggle",[i,o]),s.removeClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),v.trigger("wpformsFieldDragToggle",[l,s.data("field-type")]),s.prevAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first().hasClass("wpforms-field-entry-preview")&&(d.attr("checked","checked").trigger("change"),a.addClass("wpforms-entry-preview-block"))))},entryPreviewBlockField:function(e){e.preventDefault(),b.alert({title:wpforms_builder.heads_up,content:wpforms_builder.entry_preview_require_previous_button,icon:"fa fa-exclamation-circle",type:"red",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})},isUncheckedEntryPreviewField:function(e,i){return!("entry-preview"!==e||i&&i.passed)},addEntryPreviewField:function(e,i){var o,t,r,n=b("#wpforms-add-fields-entry-preview");n.hasClass("wpforms-entry-preview-adding")||(r=b("#wpforms-panel-fields .wpforms-field-wrap > .wpforms-field"),o=i&&i.position?i.position:r.length,t=k.isEntryPreviewFieldRequiresPageBreakBefore(r,o),r=k.isEntryPreviewFieldRequiresPageBreakAfter(r,o),n.addClass("wpforms-entry-preview-adding"),(i=i||{}).passed=!0,t||r?t?k.addPageBreakAndEntryPreviewFields(i,o):k.addEntryPreviewAndPageBreakFields(i,o):k.fieldAdd("entry-preview",i).done(function(e){k.lockEntryPreviewFieldsPosition(e.data.field.id)}))},addEntryPreviewFieldAfterPageBreak:function(e){var i=setInterval(function(){2===b("#wpforms-panel-fields .wpforms-field-wrap").find(".wpforms-pagebreak-bottom, .wpforms-pagebreak-top").length&&(k.fieldAdd("entry-preview",e).done(function(e){k.lockEntryPreviewFieldsPosition(e.data.field.id)}),clearInterval(i))},100)},addPageBreakAndEntryPreviewFields:function(i,o){var t=3<=b("#wpforms-panel-fields .wpforms-field-wrap > .wpforms-field-pagebreak").length;k.fieldAdd("pagebreak",{position:o}).done(function(e){i.position=t?o+1:o+2,k.addEntryPreviewFieldAfterPageBreak(i);e=b("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-row-prev_toggle");e.find("input").attr("checked","checked").trigger("change"),e.addClass("wpforms-entry-preview-block")})},fieldDuplicate:function(o){const t=b("#wpforms-field-"+o);t.hasClass("no-duplicate")?b.alert({title:wpforms_builder.field_locked,content:wpforms_builder.field_locked_no_duplicate_msg,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}}):b.confirm({title:!1,content:wpforms_builder.duplicate_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e,i;this.$$confirm.prop("disabled",!0),WPFormsUtils.triggerEvent(v,"wpformsBeforeFieldDuplicate",[o,t]).isDefaultPrevented()||(e=k.fieldDuplicateRoutine(o),i=b("#wpforms-field-"+e),k.increaseNextFieldIdAjaxRequest(),WPFormsUtils.triggerEvent(v,"wpformsFieldDuplicated",[o,t,e,i]))}},cancel:{text:wpforms_builder.cancel}}})},increaseNextFieldIdAjaxRequest:function(){b.post(wpforms_builder.ajax_url,{form_id:m.formID,field_id:y.$nextFieldId.val(),nonce:wpforms_builder.nonce,action:"wpforms_builder_increase_next_field_id"})},fieldDuplicateRoutine:function(e){var i=b("#wpforms-field-"+e),o=b("#wpforms-field-option-"+e),t=y.$sortableFieldsWrap.find(">.active"),r=y.$fieldOptions.find(">:visible"),n=r.find(">.active"),s=i.data("field-type"),l=o.attr("class"),a=k.dropdownField.helpers.isModernSelect(i.find("> .choices .primary-input"));wpf.restoreTooltips(o),a&&k.dropdownField.helpers.convertModernToClassic(e);let d=o.html();const f=i.clone(),p=parseInt(y.$nextFieldId.val(),10),c=b(`#wpforms-field-option-${e}-label`),m=(c.length?c:b(`#wpforms-field-option-${e}-name`)).val(),u=p+1,w={};var h=""!==m?m+" "+wpforms_builder.duplicate_copy:wpforms_builder.field+` #${e} `+wpforms_builder.duplicate_copy;w.fieldOptionsID=new RegExp("ID #"+e,"g"),w.fieldID=new RegExp("fields\\["+e+"\\]","g"),w.dataFieldID=new RegExp('data-field-id="'+e+'"',"g"),w.referenceID=new RegExp('data-reference="'+e+'"',"g"),w.elementID=new RegExp('\\b(id|for)="wpforms-(.*?)'+e+'(.*?)"',"ig"),i.after(f),t.removeClass("active"),f.addClass("active").attr({id:"wpforms-field-"+p,"data-field-id":p}),w.elementIdReplace=function(e,i,o,t,r,n){return`${i}="wpforms-${o}${p}${t}"`},d=(d=(d=(d=(d=d.replace(w.fieldOptionsID,"ID #"+p)).replace(w.fieldID,`fields[${p}]`)).replace(w.dataFieldID,`data-field-id="${p}"`)).replace(w.referenceID,`data-reference="${p}"`)).replace(w.elementID,w.elementIdReplace),r.hide(),o.after(`
${d}
`);const g=b("#wpforms-field-option-"+p);return t.data("field-id")===e&&n.length&&(i=n.attr("class").match(/wpforms-field-option-group-\S*/i)[0],r=g.find(">."+i),g.find(">").removeClass("active"),r.addClass("active")),t.data("field-id")!==e&&n.length&&(g.find(">").removeClass("active"),g.find(">.wpforms-field-option-group-basic").addClass("active")),o.find(":input").each(function(e,i){var o=b(this),t=o.attr("name");if(!t)return"continue";var t=t.replace(w.fieldID,`fields[${p}]`),r=o.attr("type");"checkbox"===r||"radio"===r?o.is(":checked")?g.find(`[name="${t}"]`).prop("checked",!0).attr("checked","checked"):g.find(`[name="${t}"]`).prop("checked",!1).attr("checked",!1):o.is("select")?o.find("option:selected").length&&(r=o.find("option:selected").val(),g.find(`[name="${t}"]`).find(`[value="${r}"]`).prop("selected",!0)):""===(r=o.val())&&o.hasClass("wpforms-money-input")?g.find(`[name="${t}"]`).val(wpf.numberFormat("0",wpforms_builder.currency_decimals,wpforms_builder.currency_decimal,wpforms_builder.currency_thousands)):g.find(`[name="${t}"]`).val(r)}),g.find(".wpforms-field-option-hidden-id").val(p),y.$nextFieldId.val(u),b("html"===s?`#wpforms-field-option-${p}-name`:`#wpforms-field-option-${p}-label`).val(h).trigger("input"),v.trigger("wpformsFieldAdd",[p,s]),wpf.initTooltips(),a&&(k.dropdownField.helpers.convertClassicToModern(e),k.dropdownField.helpers.convertClassicToModern(p)),k.fieldChoiceUpdate(f.data("field-type"),p),k.loadColorPickers(),p},addEntryPreviewAndPageBreakFields:function(e,o){k.fieldAdd("entry-preview",e).done(function(e){var i=e.data.field.id;k.fieldAdd("pagebreak",{position:o+1}).done(function(e){k.lockEntryPreviewFieldsPosition(i);e=b("#wpforms-field-"+e.data.field.id).nextAll(".wpforms-field-pagebreak, .wpforms-field-entry-preview").first();e.hasClass("wpforms-field-entry-preview")&&k.lockEntryPreviewFieldsPosition(e.data("field-id"))})})},lockEntryPreviewFieldsPosition:function(e){var i=b("#wpforms-field-"+e),o=i.prevAll(".wpforms-field-pagebreak:not(.wpforms-pagebreak-bottom)").first(),t=i.nextAll(".wpforms-field-pagebreak").first().data("field-id"),t=b("#wpforms-field-option-"+t).find(".wpforms-field-option-row-prev_toggle"),r=t.find("input");i.addClass("wpforms-field-not-draggable"),o.addClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),r.attr("checked","checked").trigger("change"),t.addClass("wpforms-entry-preview-block"),b("#wpforms-add-fields-entry-preview").removeClass("wpforms-entry-preview-adding"),v.trigger("wpformsFieldDragToggle",[e,i.data("field-type")]),v.trigger("wpformsFieldDragToggle",[o.data("field-id"),o.data("field-type")])},isEntryPreviewFieldRequiresPageBreakBefore:function(e,i){var e=e.slice(0,i).filter(".wpforms-field-pagebreak,.wpforms-field-entry-preview"),o=!0;return e.length&&b(e.get().reverse()).each(function(){var e=b(this);return!e.hasClass("wpforms-field-entry-preview")&&(e.hasClass("wpforms-field-pagebreak")&&!e.hasClass("wpforms-field-stick")?o=!1:void 0)}),o},isEntryPreviewFieldRequiresPageBreakAfter:function(e,i){var e=e.slice(i).filter(".wpforms-field-pagebreak,.wpforms-field-entry-preview"),o=Boolean(e.length);return e.length&&e.each(function(){var e=b(this);return!e.hasClass("wpforms-field-entry-preview")&&(e.hasClass("wpforms-field-pagebreak")?o=!1:void 0)}),o},fieldAdd:function(n,s){var e=b("#wpforms-add-fields-"+n);if(!(e.hasClass("upgrade-modal")||e.hasClass("education-modal")||e.hasClass("warning-modal")))if(["captcha_turnstile","captcha_hcaptcha","captcha_recaptcha","captcha_none"].includes(n))k.captchaUpdate();else{if(a=!0,WPForms.Admin.Builder.DragFields.disableDragAndDrop(),k.disableFormActions(),!k.isUncheckedEntryPreviewField(n,s))return s=b.extend({},{position:"bottom",$sortable:"base",placeholder:!1,scroll:!0,defaults:!1},s),e={action:"wpforms_new_field_"+n,id:m.formID,type:n,defaults:s.defaults,nonce:wpforms_builder.nonce},b.post(wpforms_builder.ajax_url,e,function(i){if(i.success){var o=y.$sortableFieldsWrap,t=b(i.data.preview),r=b(i.data.options);let e=s.$sortable;a=!1,t.css("display","none"),s.placeholder&&s.placeholder.remove(),"default"!==s.$sortable&&s.$sortable.length||(e=o.find(".wpforms-fields-sortable-default")),"base"!==s.$sortable&&e.length||(e=o);o=WPFormsUtils.triggerEvent(v,"wpformsBeforeFieldAddToDOM",[s,t,r,e]);o.isDefaultPrevented()||(o.skipAddFieldToBaseLevel||k.fieldAddToBaseLevel(s,t,r),t.fadeIn(),v.find(".no-fields, .no-fields-preview").remove(),b(".wpforms-field-option:not(.wpforms-field-option-layout)").length&&v.find(".wpforms-field-submit").show(),s.scroll&&s.position.length&&k.scrollPreviewToField(i.data.field.id),y.$nextFieldId.val(i.data.field.id+1),wpf.initTooltips(),k.loadColorPickers(),k.toggleAllOptionGroups(),v.trigger("wpformsFieldAdd",[i.data.field.id,n]))}else wpf.debug("Add field AJAX call is unsuccessful:",i)}).fail(function(e,i,o){a=!1,wpf.debug("Add field AJAX call failed:",e.responseText)}).always(function(){a||(WPForms.Admin.Builder.DragFields.enableDragAndDrop(),k.enableFormActions())});k.addEntryPreviewField(n,s)}},fieldAddToBaseLevel:function(e,i,o){var t=y.$sortableFieldsWrap,r=t.find("> :not(.wpforms-field-drag-pending)"),n=r.last(),r=r.length,s=y.$fieldOptions;"top"===e.position?(t.prepend(i),s.prepend(o)):"bottom"!==e.position||n.length&&n.hasClass("wpforms-field-stick")?("bottom"===e.position&&(e.position=r),e.position===r&&n.length&&n.hasClass("wpforms-field-stick")?(r=n.data("field-id"),n.before(i),s.find("#wpforms-field-option-"+r).before(o)):(n=t.children(":not(.wpforms-field-drag-pending)").eq(e.position)).length?(r=n.data("field-id"),n.before(i),s.find("#wpforms-field-option-"+r).before(o)):(t.append(i),s.append(o))):(t.append(i),s.append(o))},scrollPreviewToField(e){var e=b("#wpforms-field-"+e),i=y.$fieldsPreviewWrap.scrollTop(),o=e.closest(".wpforms-field-layout");let t=e.position().top;e=(t=o.length?o.position().top+t+20:t)>i?t-i:t+i;y.$fieldsPreviewWrap.scrollTop(e)},captchaUpdate(){var e={action:"wpforms_update_field_captcha",id:m.formID,nonce:wpforms_builder.nonce};return b.post(wpforms_builder.ajax_url,e,function(e){var i,o,t;e.success?(i={title:!1,content:!1,icon:"fa fa-exclamation-circle",type:"orange",boxWidth:"450px",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}},o=b("#wpforms-panel-field-settings-recaptcha"),t=e.data.current,o.data("provider",e.data.provider),"configured_not_enabled"!==t&&"configured_enabled"!==t||(t=o.prop("checked")?"configured_enabled":"configured_not_enabled",i.buttons.confirm.action=function(){o.prop("checked","configured_not_enabled"===t).trigger("change")}),i.title=e.data.cases[t].title,i.content=e.data.cases[t].content,e.data.cases[t].cancel&&(i.buttons.cancel={text:wpforms_builder.cancel,keys:["esc"]}),b.confirm(i)):console.log(e)}).fail(function(e,i,o){console.log(e.responseText)})},disableDragAndDrop:function(){console.warn('WARNING! Function "WPFormsBuilder.disableDragAndDrop()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.disableDragAndDrop()" function instead!'),WPForms.Admin.Builder.DragFields.disableDragAndDrop()},enableDragAndDrop:function(){console.warn('WARNING! Function "WPFormsBuilder.enableDragAndDrop()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.enableDragAndDrop()" function instead!'),WPForms.Admin.Builder.DragFields.enableDragAndDrop()},disableFormActions:function(){b.each([y.$previewButton,y.$embedButton,y.$saveButton,y.$exitButton],function(e,i){i.prop("disabled",!0).addClass("wpforms-disabled")})},enableFormActions:function(){b.each([y.$previewButton,y.$embedButton,y.$saveButton,y.$exitButton],function(e,i){i.prop("disabled",!1).removeClass("wpforms-disabled")})},fieldSortable:function(){console.warn('WARNING! Function "WPFormsBuilder.fieldSortable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.initSortableFields()" function instead!'),WPForms.Admin.Builder.DragFields.initSortableFields()},fieldDragDisable:function(e,i=!0){console.warn('WARNING! Function "WPFormsBuilder.fieldDragDisable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.fieldDragDisable()" function instead!'),WPForms.Admin.Builder.DragFields.fieldDragDisable(e,i)},fieldDragEnable:function(e){console.warn('WARNING! Function "WPFormsBuilder.fieldDragEnable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.fieldDragEnable()" function instead!'),WPForms.Admin.Builder.DragFields.fieldDragEnable(e)},fieldChoiceAdd:function(e,i){e.preventDefault();var e=b(i),i=e.parent(),o=i.find("input.default").is(":checked"),e=e.closest(".wpforms-field-option-row-choices").data("field-id"),t=i.parent().attr("data-next-id"),r=i.parent().data("field-type"),n=i.clone().insertAfter(i);n.attr("data-key",t),n.find("input.label").val("").attr("name","fields["+e+"][choices]["+t+"][label]"),n.find("input.value").val("").attr("name","fields["+e+"][choices]["+t+"][value]"),n.find(".wpforms-image-upload input.source").val("").attr("name","fields["+e+"][choices]["+t+"][image]"),n.find(".wpforms-icon-select input.source-icon").val(wpforms_builder.icon_choices.default_icon).attr("name","fields["+e+"][choices]["+t+"][icon]"),n.find(".wpforms-icon-select input.source-icon-style").val(wpforms_builder.icon_choices.default_icon_style).attr("name","fields["+e+"][choices]["+t+"][icon_style]"),n.find(".wpforms-icon-select .ic-fa-preview").removeClass().addClass("ic-fa-preview ic-fa-"+wpforms_builder.icon_choices.default_icon_style+" ic-fa-"+wpforms_builder.icon_choices.default_icon),n.find(".wpforms-icon-select .ic-fa-preview + span").text(wpforms_builder.icon_choices.default_icon),n.find("input.default").attr("name","fields["+e+"][choices]["+t+"][default]").prop("checked",!1),n.find(".preview").empty(),n.find(".wpforms-image-upload-add").show(),n.find(".wpforms-money-input").trigger("focusout"),!0===o&&i.find("input.default").prop("checked",!0),t++,i.parent().attr("data-next-id",t),v.trigger("wpformsFieldChoiceAdd"),k.fieldChoiceUpdate(r,e)},fieldChoiceDelete:function(e,i){e.preventDefault();var o,t=b(i),r=t.parent().parent(),e=r.find("li").length,i={id:r.data("field-id"),choiceId:t.closest("li").data("key"),message:""+wpforms_builder.delete_choice_confirm+"",trigger:!1};v.trigger("wpformsBeforeFieldDeleteAlert",[i]),1===e?k.fieldChoiceDeleteAlert():(o=function(){t.parent().remove(),k.fieldChoiceUpdate(r.data("field-type"),r.data("field-id")),v.trigger("wpformsFieldChoiceDelete")},i.trigger?b.confirm({title:!1,content:i.message,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){o()}},cancel:{text:wpforms_builder.cancel}}}):o())},fieldChoiceDeleteAlert:function(){b.alert({title:!1,content:wpforms_builder.error_choice,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})},fieldChoiceSortable:function(t,e){b(e=void 0!==e?e:".wpforms-field-option-"+t+" .wpforms-field-option-row-choices ul").sortable({items:"li",axis:"y",delay:100,opacity:.6,handle:".move",stop:function(e,i){var o=i.item.parent().data("field-id");k.fieldChoiceUpdate(t,o),v.trigger("wpformsFieldChoiceMove",i)},update:function(e,i){}})},fieldChoiceLabel:function(e,i){let o=void 0!==e.settings.choices[i].label&&0!==e.settings.choices[i].label.length?wpf.sanitizeHTML(e.settings.choices[i].label,wpforms_builder.allowed_label_html_tags):wpforms_builder.choice_empty_label_tpl.replace("{number}",i);return e.settings.show_price_after_labels&&(o+=" - "+wpf.amountFormatCurrency(e.settings.choices[i].value)),o},fieldChoiceUpdate:function(s,r){const l=k.dropdownField.helpers.isDynamicChoices(r);if("radio"===s||"checkbox"===s||"payment-multiple"===s||"payment-checkbox"===s){var a=wpf.getChoicesOrder(r),d=wp.template("wpforms-field-preview-checkbox-radio-payment-multiple");let i=wpf.getField(r),o={},e=a.slice(0,20),t={settings:i,order:e,type:"radio"};i.choices_icons&&(t.settings.choices_icons_color=k.getValidColorPickerValue(b("#wpforms-field-option-"+r+"-choices_icons_color"))),e.forEach(function(e){o[e]=i.choices[e]}),i.choices=o,"checkbox"!==s&&"payment-checkbox"!==s||(t.type="checkbox"),l||b("#wpforms-field-"+r).find("ul.primary-input").replaceWith(d(t)),void k.firstNChoicesAlert(r,a.length)}else{"payment-select"===(s="payment-checkbox"===(s="payment-multiple"===s?"radio":s)?"checkbox":s)&&(s="select");const f=b("#wpforms-field-"+r+" .primary-input");let n="";"select"===s?l||(n='',f.find("option").not(".placeholder").remove()):"radio"!==s&&"checkbox"!==s&&"gdpr-checkbox"!==s||(s="gdpr-checkbox"===s?"checkbox":s,f.find("li").remove(),n='
  • {label}
  • ');const e=b("#wpforms-field-option-row-"+r+"-choices .choices-list"),i=e.find("li").slice(0,20),o=!!e.find("input.default:checked").length,p=[],c=b("#wpforms-field-option-"+r+"-show_price_after_labels").prop("checked"),m=k.dropdownField.helpers.isModernSelect(f);i.each(function(){var e=b(this),i=e.find("input.value").val(),o=e.data("key");let t=wpf.sanitizeHTML(e.find("input.label").val().trim(),wpforms_builder.allowed_label_html_tags),r;if(t=""!==t?t:wpforms_builder.choice_empty_label_tpl.replace("{number}",o),t+=c&&i?" - "+wpf.amountFormatCurrency(i):"",m?p.push({value:t,label:t}):l||(r=b(n.replace(/{label}/g,t)),f.append(r)),!0===e.find("input.default").is(":checked"))switch(s){case"select":m?p[p.length-1].selected=!0:k.setClassicSelectedChoice(r);break;case"radio":case"checkbox":r.find("input").prop("checked","true")}}),m&&(d=f.prop("multiple")?"input.choices__input":".choices__inner .choices__placeholder",a=k.dropdownField.helpers.getInstance(f),l||a.removeActiveItems(),a.setChoices(p,"value","label",!0),k.dropdownField.helpers.update(r,l),f.closest(".choices").find(d).toggleClass("wpforms-hidden",o))}},setClassicSelectedChoice:function(e){void 0!==e&&e.prop("selected","true")},fieldChoiceBulkAddToggle:function(e){var e=b(e),i=e.closest("label");if(e.hasClass("bulk-add-showing")){var o=i.next(".bulk-add-display");o.slideUp(400,function(){o.remove()}),e.find("span").text(wpforms_builder.bulk_add_show)}else{var t,r=(r='
    ')+('

    '+wpforms_builder.bulk_add_heading+' '+wpforms_builder.bulk_add_presets_show+"

    ")+"")+(''))+('"),i.after(r+="
    "),i.next(".bulk-add-display").slideDown(400,function(){b(this).find("textarea").trigger("focus")}),e.find("span").text(wpforms_builder.bulk_add_hide)}e.toggleClass("bulk-add-showing")},fieldChoiceBulkAddInsert:function(e){var i,o,t,e=b(e),r=e.closest(".wpforms-field-option-row"),n=r.find("textarea"),s=r.find(".choices-list"),l=s.find("li:first-of-type").clone().wrap("
    ").parent(),a=r.data("field-id"),d=s.data("field-type"),f=Number(s.attr("data-next-id")),p=n.val().split("\n"),c="";for(o in e.prop("disabled",!0).html(e.html()+" "+m.spinner),l.find("input.value,input.label").attr("value",""),l.find("input.default").attr("checked",!1),l.find("input.source-icon").attr("value",wpforms_builder.icon_choices.default_icon),l.find("input.source-icon-style").attr("value",wpforms_builder.icon_choices.default_icon_style),l.find(".ic-fa-preview").removeClass().addClass(`ic-fa-preview ic-fa-${wpforms_builder.icon_choices.default_icon_style} ic-fa-`+wpforms_builder.icon_choices.default_icon),l.find(".ic-fa-preview + span").text(wpforms_builder.icon_choices.default_icon),i=l.html(),p)p.hasOwnProperty(o)&&(t=wpf.sanitizeHTML(p[o]).trim().replace(/"/g,"""),c+=i.replace(/\[choices\]\[(\d+)\]/g,"[choices]["+f+"]").replace(/data-key="(\d+)"/g,'data-key="'+f+'"').replace(/value="" class="label"/g,'value="'+t+'" class="label"').replace(/class="label" type="text" value=""/g,'class="label" type="text" value="'+t+'"'),f++);s.attr("data-next-id",f).append(c),k.fieldChoiceUpdate(d,a),v.trigger("wpformsFieldChoiceAdd"),k.fieldChoiceBulkAddToggle(r.find(".toggle-bulk-add-display"))},fieldTabToggle:function(e){var i;if(WPFormsUtils.triggerEvent(v,"wpformsFieldTabToggle",[e]).isDefaultPrevented())return!1;b(".wpforms-tab a").removeClass("active"),b(".wpforms-field, .wpforms-title-desc").removeClass("active"),"add-fields"===e?(b("#add-fields a").addClass("active"),b(".wpforms-field-options").hide(),b(".wpforms-add-fields").show()):(b("#field-options a").addClass("active"),"field-options"===e?((i=b(".wpforms-field").first()).addClass("active"),e=i.data("field-id")):b("#wpforms-field-"+e).addClass("active"),b(".wpforms-field-option").hide(),b("#wpforms-field-option-"+e).show(),b(".wpforms-add-fields").hide(),b(".wpforms-field-options").show(),v.trigger("wpformsFieldOptionTabToggle",[e]))},fieldPagebreakAdd:function(e,i,o){"pagebreak"===o&&(m.pagebreakTop?m.pagebreakBottom||(m.pagebreakBottom=!0,k.fieldAdd("pagebreak",{position:"bottom",scroll:!1,defaults:{position:"bottom"}}).done(function(e){m.pagebreakBottom=e.data.field.id;var i=b("#wpforms-field-"+e.data.field.id);b("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-bottom"),i.addClass("wpforms-field-stick wpforms-pagebreak-bottom")})):(m.pagebreakTop=!0,k.fieldAdd("pagebreak",{position:"top",scroll:!1,defaults:{position:"top",nav_align:"left"}}).done(function(e){m.pagebreakTop=e.data.field.id;var i=b("#wpforms-field-"+e.data.field.id);b("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-top"),i.addClass("wpforms-field-stick wpforms-pagebreak-top")})))},fieldPagebreakDelete:function(e,i,o){var t,r,n;"pagebreak"!==o||b("#wpforms-panel-fields .wpforms-field-pagebreak").not(".wpforms-pagebreak-top, .wpforms-pagebreak-bottom").length||(r=(t=(o=b("#wpforms-panel-fields .wpforms-preview-wrap")).find(".wpforms-pagebreak-top")).data("field-id"),n=(o=o.find(".wpforms-pagebreak-bottom")).data("field-id"),t.remove(),b("#wpforms-field-option-"+r).remove(),m.pagebreakTop=!1,o.remove(),b("#wpforms-field-option-"+n).remove(),m.pagebreakBottom=!1)},fieldPageBreakInitDisplayPrevious:function(e){var i=e.data("field-id"),o=b("#wpforms-field-option-row-"+i+"-prev_toggle"),i=b("#wpforms-field-option-row-"+i+"-prev"),t=e.find(".wpforms-pagebreak-prev");0":">")+d[a].label+"",f.append(c)}else for(a in r="radio",e.hasClass("wpforms-field-checkbox")&&(r="checkbox"),f.empty(),d)c='
  • ":">")+d[a].label+"
  • ",f.append(c);n.find("ul").removeClass("wpforms-hidden"),n.find(".wpforms-alert").addClass("wpforms-hidden"),f.removeClass("wpforms-hidden")}wpf.fieldOptionLoading(i,!0)}},fieldDynamicChoiceSource:function(e){var e=b(e),o=e.parent(),e=e.val(),t=o.data("field-id"),i=b("#wpforms-builder-form").data("id"),r=b("#wpforms-field-option-row-"+t+"-choices"),n=b("#wpforms-field-"+t),s=b("#wpforms-field-option-"+t+"-dynamic_choices option:selected").val(),l=20,s=(wpf.fieldOptionLoading(o),{type:s,source:e,field_id:t,form_id:i,action:"wpforms_builder_dynamic_source",nonce:wpforms_builder.nonce});b.post(wpforms_builder.ajax_url,s,function(i){if(i.success){if(r.find(".dynamic-name").text(i.data.source_name),r.find(".dynamic-type").text(i.data.type_name),r.find("ul").addClass("wpforms-hidden"),r.find(".wpforms-alert").removeClass("wpforms-hidden"),k.fieldDynamicChoiceSourceItems(n,i.data.items),n.hasClass("wpforms-field-select")&&(l=200),n.find(".wpforms-notice-dynamic-empty").remove(),Number(i.data.total)>l){let e=wpforms_builder.dynamic_choices.limit_message;e=(e=(e=(e=e.replace("{source}",i.data.source_name)).replace("{type}",i.data.type_name)).replace("{limit}",l)).replace("{total}",i.data.total),b.alert({title:wpforms_builder.heads_up,content:e,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})}k.firstNChoicesAlert(t,i.data.total),0===Number(i.data.total)&&k.emptyChoicesNotice(t,i.data.source_name,i.data.type)}else console.log(i);wpf.fieldOptionLoading(o,!0)}).fail(function(e,i,o){console.log(e.responseText)})},fieldDynamicChoiceSourceItems:function(e,i){var o=e.find(".primary-input"),t=0;if(e.hasClass("wpforms-field-select"))k.dropdownField.helpers.isModernSelect(o)?k.fieldDynamicChoiceSourceForModernSelect(o,i):k.fieldDynamicChoiceSourceForClassicSelect(o,i);else{var r="radio";for(t in e.hasClass("wpforms-field-checkbox")&&(r="checkbox"),o.empty(),i)o.append('
  • '+wpf.sanitizeHTML(i[t])+"
  • ")}},fieldDynamicChoiceSourceForModernSelect:function(e,i){var o=k.dropdownField.helpers.getInstance(e),t=e.closest(".wpforms-field").data().fieldId;o.destroy(),k.dropdownField.helpers.updatePlaceholderChoice(o,t),k.fieldDynamicChoiceSourceForClassicSelect(e,i),k.dropdownField.events.choicesInit(e)},fieldDynamicChoiceSourceForClassicSelect:function(e,i){var o=0,t=i.length;for(e.find("option").not(".placeholder").remove();o'+r+"")}e.toggleClass("wpforms-hidden",!t)},fieldDynamicChoiceToggleImageChoices:function(){b("#wpforms-builder .wpforms-field-options .wpforms-field-option").each(function(e,i){var i=b(i),o=i.find(".wpforms-field-option-row-dynamic_choices select").val(),o=void 0!==o&&""!==o,t=i.find(".wpforms-field-option-row-choices_images input").is(":checked");i.find(".wpforms-field-option-row-choices_images").toggleClass("wpforms-hidden",o),t&&!o||i.find(".wpforms-field-option-row-choices_images_style").addClass("wpforms-hidden")})},fieldDynamicChoiceToggleIconChoices:function(){b("#wpforms-builder .wpforms-field-options .wpforms-field-option").each(function(e,i){var i=b(i),o=i.find(".wpforms-field-option-row-dynamic_choices select").val(),o=void 0!==o&&""!==o,t=i.find(".wpforms-field-option-row-choices_icons input").is(":checked");i.find(".wpforms-field-option-row-choices_icons").toggleClass("wpforms-hidden",o),t&&!o||(i.find(".wpforms-field-option-row-choices_icons_color").addClass("wpforms-hidden"),i.find(".wpforms-field-option-row-choices_icons_size").addClass("wpforms-hidden"),i.find(".wpforms-field-option-row-choices_icons_style").addClass("wpforms-hidden"))})},firstNChoicesAlert:function(e,i){var o=wp.template("wpforms-choices-limit-message"),t={total:i},e=b("#wpforms-field-"+e);e.hasClass("wpforms-field-select")||(e.find(".wpforms-alert-dynamic").remove(),20 .layout-selector-display`);if(!e.length){var t,r={"layout-1":[{class:"one-half",data:"wpforms-one-half wpforms-first"},{class:"one-half",data:"wpforms-one-half"}],"layout-2":[{class:"one-third",data:"wpforms-one-third wpforms-first"},{class:"one-third",data:"wpforms-one-third"},{class:"one-third",data:"wpforms-one-third"}],"layout-3":[{class:"one-fourth",data:"wpforms-one-fourth wpforms-first"},{class:"one-fourth",data:"wpforms-one-fourth"},{class:"one-fourth",data:"wpforms-one-fourth"},{class:"one-fourth",data:"wpforms-one-fourth"}],"layout-4":[{class:"one-third",data:"wpforms-one-third wpforms-first"},{class:"two-third",data:"wpforms-two-thirds"}],"layout-5":[{class:"two-third",data:"wpforms-two-thirds wpforms-first"},{class:"one-third",data:"wpforms-one-third"}],"layout-6":[{class:"one-fourth",data:"wpforms-one-fourth wpforms-first"},{class:"one-fourth",data:"wpforms-one-fourth"},{class:"two-fourth",data:"wpforms-two-fourths"}],"layout-7":[{class:"two-fourth",data:"wpforms-two-fourths wpforms-first"},{class:"one-fourth",data:"wpforms-one-fourth"},{class:"one-fourth",data:"wpforms-one-fourth"}],"layout-8":[{class:"one-fourth",data:"wpforms-one-fourth wpforms-first"},{class:"two-fourth",data:"wpforms-two-fourths"},{class:"one-fourth",data:"wpforms-one-fourth"}]};let e,i=`

    ${wpforms_builder.layout_selector_layout}

    `;for(t in r){for(var n in e=r[t],i+='
    ',e)i+=``;i+="
    "}i+="
    ",b(`#wpforms-field-option-row-${o}-css > label`).after(i)}},fieldLayoutSelectorLayout:function(e){e=b(e);e.parent().find(".layout-selector-display-layout").not(e).remove(),e.parent().find(".heading").text(wpforms_builder.layout_selector_column),e.toggleClass("layout-selector-display-layout layout-selector-display-columns")},fieldLayoutSelectorInsert:function(e){var e=b(e),i=e.closest(".layout-selector-display"),o=i.parent(),t=o.find("label"),o=o.find("input[type=text]"),e=e.data("classes");o.val()&&(e=" "+e),o.insertAtCaret(e),i.slideUp(400,function(){i.remove()}),t.find(".toggle-layout-selector-display").removeClass("layout-selector-showing"),t.find(".toggle-layout-selector-display span").text(wpforms_builder.layout_selector_show)},bindUIActionsSettings:function(){v.on("click","#wpforms-panel-fields .wpforms-title-desc, #wpforms-panel-fields .wpforms-field-submit-button, .wpforms-center-form-name",function(e){e.preventDefault(),k.panelSwitch("settings"),(b(this).hasClass("wpforms-center-form-name")||b(this).hasClass("wpforms-title-desc"))&&setTimeout(function(){b("#wpforms-panel-field-settings-form_title").trigger("focus")},300)}),v.on("click",".wpforms-field-pagebreak-last button",function(e){e.preventDefault(),k.panelSwitch("settings"),b("#wpforms-panel-field-settings-pagebreak_prev").trigger("focus")}),v.on("click",".wpforms-panel-content-also-available-item-add-captcha",function(e){e.preventDefault();e=v.find("#wpforms-add-fields-captcha");e.data("action")?e.trigger("click"):k.fieldAdd("captcha",{}).done(function(){k.panelSwitch("fields")})}),v.on("input","#wpforms-panel-field-settings-pagebreak_prev",function(){b(".wpforms-field-pagebreak-last button").text(b(this).val())}),v.on("input","#wpforms-panel-field-settings-form_title, #wpforms-setup-name",function(){var e=b(this).val().toString().trim();b(".wpforms-preview .wpforms-form-name").text(e),b(".wpforms-center-form-name.wpforms-form-name").text(e),k.trimFormTitle()}),v.on("input","#wpforms-panel-field-settings-form_desc",function(){b(".wpforms-form-desc").text(b(this).val())}),v.on("input","#wpforms-panel-field-settings-submit_text",function(){b(".wpforms-field-submit input[type=submit]").val(b(this).val())}),v.on("change","#wpforms-panel-field-settings-recaptcha",function(){k.captchaToggle()}),v.on("change",".wpforms-panel-field-confirmations-type",function(){k.confirmationFieldsToggle(b(this))}),v.on("change",".wpforms-panel-field-confirmations-message_entry_preview",k.confirmationEntryPreviewToggle),v.on("change","#wpforms-panel-field-settings-notification_enable",function(){k.notificationToggle()}),v.on("click",".wpforms-builder-settings-block-add",function(e){e.preventDefault(),wpforms_builder.pro&&k.settingsBlockAdd(b(this))}),v.on("click",".wpforms-builder-settings-block-edit",function(e){e.preventDefault();e=b(this);e.parents(".wpforms-builder-settings-block-header").find(".wpforms-builder-settings-block-name").hasClass("editing")?k.settingsBlockNameEditingHide(e):k.settingsBlockNameEditingShow(e)}),v.on("blur",".wpforms-builder-settings-block-name-edit input",function(e){b(e.relatedTarget).hasClass("wpforms-builder-settings-block-edit")||k.settingsBlockNameEditingHide(b(this))}),v.on("keypress",".wpforms-builder-settings-block-name-edit input",function(e){13===e.keyCode&&(k.settingsBlockNameEditingHide(b(this)),e.preventDefault())}),v.on("click",".wpforms-builder-settings-block-clone",function(e){e.preventDefault(),k.settingsBlockPanelClone(b(this))}),v.on("click",".wpforms-builder-settings-block-toggle",function(e){e.preventDefault(),k.settingsBlockPanelToggle(b(this))}),v.on("click",".wpforms-builder-settings-block-delete",function(e){e.preventDefault(),k.settingsBlockDelete(b(this))})},captchaToggle:function(){var e=v.find(".wpforms-field-recaptcha"),i=b("#wpforms-panel-field-settings-recaptcha"),o=i.data("provider")||"recaptcha";e.length&&(i.is(":checked")?e.show().toggleClass("is-recaptcha","recaptcha"===o):e.hide())},confirmationsSetup:function(){b(".wpforms-panel-field-confirmations-type").each(function(){k.confirmationFieldsToggle(b(this))}),b(".wpforms-panel-field-confirmations-message").each(function(){"undefined"!=typeof tinymce&&void 0!==wp.editor&&wp.editor.initialize(b(this).attr("id"),m.tinymceDefaults)}),v.on("focusout",".wpforms-panel-field-confirmations-redirect",function(e){const i=b(this);var o=i.val().trim();i.val(o),wpf.isURL(o)||""===o||k.confirmationRedirectValidationError(function(){i.trigger("focus")})}),v.on("wpformsBeforeSave wpformsPanelSectionSwitch wpformsPanelSwitch",function(r){b(".wpforms-confirmation").each(function(e,i){var i=b(i),o=i.find(".wpforms-panel-field-confirmations-type");const t=i.find(".wpforms-panel-field-confirmations-redirect");if(!t.is(":hidden")&&!("redirect"!==o.val()||0',o='

    '+wpforms_builder[f+"_error"]+"

    ",t=b.confirm({container:v,title:!1,content:e+i+o,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e=this.$content.find("input#settings-block-name").val().toString().trim(),i=this.$content.find(".error");if(""===e)return i.show(),!1;{var i=l.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block").first(),o=(wpf.restoreTooltips(i),i.clone()),t=i.data("block-id");o.attr("data-block-id",a),o.find(".wpforms-builder-settings-block-header span").text(e);o.find("input, textarea, select").each(function(){var e=b(this),i=e.parent();e.hasClass("wpforms-disabled")&&(i.hasClass("from-name")||i.hasClass("from-email"))||(i=e).attr("name")&&(i.val("").attr("name",i.attr("name").replace(/\[(\d+)\]/,"["+a+"]")),i.is("select")?(i.find("option").prop("selected",!1).attr("selected",!1),i.find("option").first().prop("selected",!0).attr("selected","selected")):"checkbox"===i.attr("type")?i.prop("checked",!1).attr("checked",!1).val("1"):i.val("").attr("value",""))});var n="wpforms-panel-field-"+d+"-",s=n+t,r=(o.find('[id^="'+s+'"], [for^="'+s+'"]').each(function(e,i){var o=b(this),t="LABEL"===o.prop("tagName")?"for":"id",r=o.attr(t).replace(new RegExp(s,"g"),n+a);o.attr(t,r)}),t+"-notification-by-status"),t=(o.find('[data-radio-group="'+r+'"]').each(function(e,i){b(this).removeClass("wpforms-radio-group-"+r).addClass("wpforms-radio-group-"+a+"-notification-by-status").attr("data-radio-group",a+"-notification-by-status")}),o.find(".wpforms-builder-settings-block-header input").val(e).attr("value",e),"notification"===f&&(o.find(".email-msg textarea").val("{all_fields}").attr("value","{all_fields}"),o.find(".email-recipient input").val("{admin_email}").attr("value","{admin_email}")),o.removeClass("wpforms-builder-settings-block-default"),"confirmation"===f&&(o.find(".wpforms-panel-field-tinymce").remove(),"undefined"!=typeof WPForms)&&o.find(".wpforms-panel-field-confirmations-type-wrap").after(WPForms.Admin.Builder.Templates.get("wpforms-builder-confirmations-message-field")({id:a})),o.find(".wpforms-conditional-block")),e=(t.length&&"undefined"!=typeof WPForms&&t.html(WPForms.Admin.Builder.Templates.get("wpforms-builder-conditional-logic-toggle-field")({id:a,type:f,actions:JSON.stringify(o.find(".wpforms-panel-field-conditional_logic-checkbox").data("actions")),actionDesc:o.find(".wpforms-panel-field-conditional_logic-checkbox").data("action-desc")})),o.find(".wpforms-field-map-table")),e=(e.length&&e.each(function(e,i){var i=b(i),o=(i.find("tr:not(:first-child)").remove(),i.find(".key input")),i=i.find(".field select"),t=i.data("name");o.attr("value",""),i.attr("name","").attr("data-name",t.replace(/\[(\d+)\]/,"["+a+"]"))}),t=(t=o.wrap("
    ").parent().html()).replace(/\[conditionals\]\[(\d+)\]\[(\d+)\]/g,"[conditionals][0][0]"),i.before(t),i.prev());"confirmation"===f&&(k.prepareChoicesJSField(e,a),k.confirmationFieldsToggle(b(".wpforms-panel-field-confirmations-type").first())),"undefined"!=typeof tinymce&&void 0!==wp.editor&&"confirmation"===f&&wp.editor.initialize("wpforms-panel-field-confirmations-message-"+a,m.tinymceDefaults),wpf.initTooltips(),v.trigger("wpformsSettingsBlockAdded",[e]),l.attr("data-next-id",a+1)}}},cancel:{text:wpforms_builder.cancel}}});v.on("keypress","#settings-block-name",function(e){13===e.keyCode&&b(t.buttons.confirm.el).trigger("click")})},prepareChoicesJSField:function(e,i){var o,e=e.find(`#wpforms-panel-field-confirmations-${i}-page-wrap`);e.length<=0||(i=e.find(`#wpforms-panel-field-confirmations-${i}-page`)).length<=0&&!i.hasClass("choicesjs-select")||(o=e.find(".choices")).length<=0||((i=i.first()).removeAttr("data-choice"),i.removeAttr("hidden"),i.removeClass("choices__input"),b(i).appendTo(e.first()),o.first().remove(),k.dropdownField.events.choicesInit(i))},settingsBlockNameEditingShow:function(e){e=e.parents(".wpforms-builder-settings-block-header");e.find(".wpforms-builder-settings-block-name").addClass("editing").hide(),e.find(".wpforms-builder-settings-block-name-edit").addClass("active"),wpf.focusCaretToEnd(e.find("input"))},settingsBlockNameEditingHide:function(e){var i=e.parents(".wpforms-builder-settings-block-header"),o=i.find(".wpforms-builder-settings-block-name"),i=i.find(".wpforms-builder-settings-block-name-edit"),t=i.find("input").val().trim(),e=e.closest(".wpforms-builder-settings-block").data("block-type");t.length||(t=wpforms_builder[e+"_def_name"]),i.find("input").val(t),o.text(t),o.removeClass("editing").show(),i.removeClass("active")},settingsBlockPanelClone:function(e){var i=e.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block-add"),e=e.closest(".wpforms-builder-settings-block"),o=e.find(".wpforms-builder-settings-block-content"),t=parseInt(i.attr("data-next-id"),10),r=e.data("block-type"),n=e.find(".wpforms-builder-settings-block-name").text().trim()+wpforms_builder[r+"_clone"],o=o.is(":hidden"),s=(wpf.restoreTooltips(e),e.clone(!1,!0));k.settingsBlockUpdateState(o,t,r),s.data("block-id",t),s.find(".wpforms-builder-settings-block-header span").text(n),s.find(".wpforms-builder-settings-block-header input").val(n),s.removeClass("wpforms-builder-settings-block-default"),i.attr("data-next-id",t+1),s.find("input, textarea, select").each(function(){var e=b(this);e.attr("name")&&e.attr("name",e.attr("name").replace(/\[(\d+)\]/,"["+t+"]")),e.data("name")&&e.data("name",e.data("name").replace(/\[(\d+)\]/,"["+t+"]")),e.attr("class")&&e.attr("class",e.attr("class").replace(/-(\d+)/,"-"+t)),e.attr("data-radio-group")&&e.attr("data-radio-group",e.attr("data-radio-group").replace(/(\d+)-/,t+"-"))}),s.find("*").each(function(){var e=b(this);e.attr("id")&&e.attr("id",e.attr("id").replace(/-(\d+)/,"-"+t)),e.attr("for")&&e.attr("for",e.attr("for").replace(/-(\d+)-/,"-"+t+"-")),e.data("input-name")&&e.data("input-name",e.data("input-name").replace(/\[(\d+)\]/,"["+t+"]"))}),e.find("select").each(function(){var e=b(this).attr("name"),i=b(this).attr("name").replace(/\[(\d+)\]/,"["+t+"]");s.find('select[name="'+i+'"]').val(b(this).attr("name",e).val())}),s.css("display","none").insertBefore(e).show("fast",function(){wpf.initTooltips()}),v.trigger("wpformsSettingsBlockCloned",[s,e.data("block-id")])},settingsBlockPanelToggle:function(e){var i=e.closest(".wpforms-builder-settings-block"),o=i.data("block-id"),t=i.data("block-type"),r=i.find(".wpforms-builder-settings-block-content"),n=r.is(":visible");r.stop().slideToggle({duration:400,start:function(){k.settingsBlockUpdateState(n,o,t)},always:function(){r.is(":visible")?e.html(''):e.html('')}})},settingsBlockDelete:function(e){var i=e.closest(".wpforms-panel-content-section"),o=e.closest(".wpforms-builder-settings-block"),t=o.data("block-type");i.find(".wpforms-builder-settings-block").length<2||b.confirm({title:!1,content:wpforms_builder[t+"_delete"],icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e=o.data("block-id"),i=o.data("block-type");b.post(wpforms_builder.ajax_url,{action:"wpforms_builder_settings_block_state_remove",nonce:wpforms_builder.nonce,block_id:e,block_type:i,form_id:m.formID}),o.remove(),v.trigger("wpformsSettingsBlockDeleted",[t,e])}},cancel:{text:wpforms_builder.cancel}}})},settingsBlockUpdateState:function(e,i,o){b.post(wpforms_builder.ajax_url,{action:"wpforms_builder_settings_block_state_save",state:e?"closed":"opened",form_id:m.formID,block_id:i,block_type:o,nonce:wpforms_builder.nonce})},bindUIActionsRevisions:function(){v.on("wpformsPanelSwitched",function(e,i){"revisions"===i&&(k.updateRevisionsList(),k.updateRevisionPreview())}),v.on("wpformsSaved",function(e){"revisions"===wpf.getQueryString("view")&&k.updateRevisionsList()})},updateRevisionsList:function(){var t=b("#wpforms-panel-revisions .wpforms-revisions-content"),i=b(".wpforms-panel-revisions-button .badge-exclamation");i.length&&b.post(wpforms_builder.ajax_url,{action:"wpforms_mark_panel_viewed",form_id:m.formID,nonce:wpforms_builder.nonce}).done(function(e){e.success?i.remove():wpf.debug(e)}).fail(function(e,i,o){wpf.debug(e.responseText||i||"")}),v.hasClass("wpforms-revisions-enabled")&&t.fadeTo(250,.25,function(){b.post(wpforms_builder.ajax_url,{action:"wpforms_get_form_revisions",form_id:m.formID,revision_id:wpf.getQueryString("revision_id"),nonce:wpforms_builder.nonce}).done(function(e){e.success?t.replaceWith(e.data.html):wpf.debug(e)}).fail(function(e,i,o){wpf.debug(e.responseText||i||""),t.fadeTo(250,1)})})},updateRevisionPreview:function(){var e=y.$formPreview.clone();e.find(".wpforms-field-duplicate, .wpforms-field-delete, .wpforms-field-helper, .wpforms-debug").remove().end(),e.find(".wpforms-field-wrap").removeClass("ui-sortable").addClass("ui-sortable-disabled"),e.find(".wpforms-field").removeClass("ui-sortable-handle ui-draggable ui-draggable-handle active").removeAttr("id data-field-id data-field-type").removeData(),e.find(".wpforms-field-submit-button").prop("disabled",!0),y.$revisionPreview.hasClass("has-preview")?y.$revisionPreview.find(".wpforms-preview-wrap").replaceWith(e):y.$revisionPreview.append(e).addClass("has-preview")},confirmSaveRevision:function(){b.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.revision_update_confirm,icon:"fa fa-exclamation-circle",type:"orange",closeIcon:!1,buttons:{confirm:{text:wpforms_builder.save,btnClass:"btn-confirm",keys:["enter"],action:function(){v.addClass("wpforms-revision-is-saving"),WPFormsBuilder.formSave(!1).done(k.revisionSavedReload)}},cancel:{text:wpforms_builder.cancel,action:function(){WPFormsBuilder.setCloseConfirmation(!0)}}}})},revisionSavedReload:function(){wpf.updateQueryString("view",wpf.getQueryString("view")),wpf.removeQueryParam("revision_id"),l.location.reload()},bindUIActionsSaveExit:function(){v.on("click","#wpforms-embed",function(e){e.preventDefault(),b(this).hasClass("wpforms-disabled")||WPFormsFormEmbedWizard.openPopup()}),v.on("click","#wpforms-save",function(e){e.preventDefault(),k.formSave(!1)}),v.on("click","#wpforms-exit",function(e){e.preventDefault(),k.formExit()}),v.on("wpformsSaved",function(e,i){wpf.removeQueryParam("newform")})},formSave:function(i){var e=y.$saveButton,o=e.find("i.fa-check"),t=e.find("i.wpforms-loading-spinner"),r=e.find("span"),n=r.text();if(v.hasClass("wpforms-is-revision")&&!v.hasClass("wpforms-revision-is-saving"))k.confirmSaveRevision();else{"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();var s=WPFormsUtils.triggerEvent(v,"wpformsBeforeSave");if(!s.isDefaultPrevented())return r.text(wpforms_builder.saving),e.prop("disabled",!0),o.addClass("wpforms-hidden"),t.removeClass("wpforms-hidden"),s={action:"wpforms_save_form",data:JSON.stringify(b("#wpforms-builder-form").serializeArray()),id:m.formID,nonce:wpforms_builder.nonce},b.post(wpforms_builder.ajax_url,s,function(e){e.success?(wpf.savedState=wpf.getFormState("#wpforms-builder-form"),wpf.initialSave=!1,v.trigger("wpformsSaved",e.data),!0===i&&k.isBuilderInPopup()?k.builderInPopupClose("saved"):!0===i&&(l.location.href=wpforms_builder.exit_url)):(wpf.debug(e),k.formSaveError(e.data))}).fail(function(e,i,o){wpf.debug(e),k.formSaveError()}).always(function(){r.text(n),e.prop("disabled",!1),t.addClass("wpforms-hidden"),o.removeClass("wpforms-hidden")})}},formSaveError:function(e){wpf.empty(e)&&(e=wpforms_builder.error_save_form),b.confirm({title:wpforms_builder.heads_up,content:"

    "+e+"

    "+wpforms_builder.error_contact_support+"

    ",icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})},formExit:function(){k.isBuilderInPopup()&&k.formIsSaved()?k.builderInPopupClose("saved"):k.formIsSaved()?l.location.href=wpforms_builder.exit_url:b.confirm({title:!1,content:wpforms_builder.exit_confirm,icon:"fa fa-exclamation-circle",type:"orange",closeIcon:!0,buttons:{confirm:{text:wpforms_builder.save_exit,btnClass:"btn-confirm",keys:["enter"],action:function(){k.formSave(!0)}},cancel:{text:wpforms_builder.exit,action:function(){i=!1,k.isBuilderInPopup()?k.builderInPopupClose("canceled"):l.location.href=wpforms_builder.exit_url}}}})},setCloseConfirmation:function(e){i=!!e},formIsSaved:function(){return wpf.savedState==wpf.getFormState("#wpforms-builder-form")},isBuilderInPopup:function(){return l.self!==l.parent&&"wpforms-builder-iframe"===l.self.frameElement.id},builderInPopupClose:function(e){var i=l.parent.jQuery(".wpforms-builder-popup"),o=b(".wpforms-center-form-name").text();i.find("#wpforms-builder-iframe").attr("src","about:blank"),i.fadeOut(),i.trigger("wpformsBuilderInPopupClose",[e,m.formID,o])},bindUIActionsGeneral:function(){v.on("click",".toggle-smart-tag-display",k.smartTagToggle),v.on("click",".smart-tags-list-display a",k.smartTagInsert),v.on("click",".wpforms-panel-fields-group.unfoldable .wpforms-panel-fields-group-title",k.toggleUnfoldableGroup),v.on("click",".wpforms-field-helper-hide ",k.hideFieldHelper),v.on("input",".wpforms-field-map-table .key-source",function(){var e=b(this).val(),i=b(this).parent().parent().find(".key-destination"),o=i.data("name");e&&i.attr("name",o.replace("{source}",e.replace(/[^0-9a-zA-Z_-]/gi,"")))}),v.on("click",".wpforms-field-map-table .remove",function(e){e.preventDefault(),k.fieldMapTableDeleteRow(e,b(this))}),v.on("click",".wpforms-field-map-table .add",function(e){e.preventDefault(),k.fieldMapTableAddRow(e,b(this))}),b(r).on("wpformsFieldUpdate",k.fieldMapSelect),v.on("input",".wpforms-money-input",function(e){var i=b(this),o=i.val(),t=i[0].selectionStart,r=i[0].selectionEnd;i.val(o.replace(/[^0-9.,]/g,"")),i[0].setSelectionRange(t,r)}),v.on("focusout",".wpforms-money-input",function(e){var i=b(this),o=i.val();if(!o)return o;o=wpf.amountSanitize(o),o=wpf.amountFormat(o);i.val(o)}),v.on("change",".wpforms-panel-field-toggle",function(){var e=b(this);e.prop("disabled")||(e.prop("disabled",!0),k.toggleOptionsGroup(e))}),v.on("change",k.getPaymentsTogglesSelector(),function(e){var i=b(this),o=i.attr("id").replace(/wpforms-panel-field-|-enable|_one_time|_recurring/gi,""),t=b('.wpforms-panel-content-section-notifications [id*="-'+o+'-wrap"]');i.prop("checked")||b("#wpforms-panel-field-"+o+"-enable_one_time").prop("checked")||b("#wpforms-panel-field-"+o+"-enable_recurring").prop("checked")?b("#wpforms-panel-field-settings-disable_entries").prop("checked")?(b.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.payments_entries_off,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}),i.prop("checked",!1)):t.removeClass("wpforms-hidden"):(t.addClass("wpforms-hidden"),t.find('input[id*="-'+o+'"]').prop("checked",!1))}),v.on("change","#wpforms-panel-field-settings-disable_entries",function(e){var i=b(this);i.prop("checked")&&(k.isPaymentsEnabled()?(b.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.payments_on_entries_off,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}),i.prop("checked",!1)):b.alert({title:wpforms_builder.heads_up,content:wpforms_builder.disable_entries,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}))}),v.on("click",".wpforms-image-upload-add",function(e){e.preventDefault();var i=b(this),o=i.parent(),t=wp.media.frames.wpforms_media_frame=wp.media({className:"media-frame wpforms-media-frame",frame:"select",multiple:!1,title:wpforms_builder.upload_image_title,library:{type:"image"},button:{text:wpforms_builder.upload_image_button}});t.on("select",function(){var e=t.state().get("selection").first().toJSON();o.find(".source").val(e.url),o.find(".preview").empty(),o.find(".preview").prepend(''),"hide"===i.data("after-upload")&&i.hide(),v.trigger("wpformsImageUploadAdd",[i,o])}),t.open()}),v.on("click",".wpforms-image-upload-remove",function(e){e.preventDefault();e=b(this).parent().parent();e.find(".preview").empty(),e.find(".wpforms-image-upload-add").show(),e.find(".source").val(""),v.trigger("wpformsImageUploadRemove",[b(this),e])}),v.on("blur",".wpforms-notification .wpforms-panel-field-text input",function(){k.validateEmailSmartTags(b(this))}),v.on("blur",".wpforms-notification .wpforms-panel-field-textarea textarea",function(){k.validateEmailSmartTags(b(this))}),v.on("focusout",".wpforms-notification .wpforms-panel-field.js-wpforms-from-email-validation input",k.validateFromEmail),v.on("wpformsPanelSectionSwitch",k.notificationsPanelSectionSwitch),v.on("click","#wpforms-builder-mobile-notice .wpforms-fullscreen-notice-button-primary, #wpforms-builder-mobile-notice .close",function(){l.location.href=wpforms_builder.exit_url}),v.on("click","#wpforms-builder-mobile-notice .wpforms-fullscreen-notice-button-secondary",function(){l.location.href=wpf.updateQueryString("force_desktop_view",1,l.location.href)}),b("#wpforms-builder-license-alert .close").on("click",function(){l.location.href=wpforms_builder.exit_url}),b("#wpforms-builder-license-alert .dismiss").on("click",function(e){e.preventDefault(),b("#wpforms-builder-license-alert").remove(),wpCookies.set("wpforms-builder-license-alert","true",3600)}),v.on("change","#wpforms-panel-field-settings-akismet.wpforms-akismet-disabled",function(e){const i=b(this),o=i.data("akismet-status");i.prop("checked")&&b.alert({title:wpforms_builder.heads_up,content:wpforms_builder[o],icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}},onClose:function(){i.prop("checked",!1)}})})},notificationsPanelSectionSwitch:function(e,i){"notifications"===i&&b(".wpforms-notification .wpforms-panel-field.js-wpforms-from-email-validation input").trigger("focusout")},isPaymentsEnabled:function(){var e=!1;return b(k.getPaymentsTogglesSelector()).each(function(){if(b(this).prop("checked"))return!(e=!0)}),e},getPaymentsTogglesSelector:function(){return`.wpforms-panel-content-section-payment-toggle-one-time input, .wpforms-panel-content-section-payment-toggle-recurring input, #wpforms-panel-field-stripe-enable, #wpforms-panel-field-paypal_standard-enable, #wpforms-panel-field-authorize_net-enable, #wpforms-panel-field-square-enable`},toggleOptionsGroup:function(e){function i(){e.prop("disabled",!1)}var o=e.attr("name"),t=e.attr("type"),r="",o=b('.wpforms-panel-field-toggle-body[data-toggle="'+o+'"]');0===o.length?i():(r="checkbox"!==t&&"radio"!==t||e.prop("checked")?e.val():"0",o.each(function(){var e=b(this);e.attr("data-toggle-value").toString()===r.toString()?e.slideDown("",i):e.slideUp("",i)}))},toggleAllOptionGroups:function(e){(e=e||v||b("#wpforms-builder")||b("body"))&&e.find(".wpforms-panel-field-toggle").each(function(){var e=b(this);e.prop("disabled",!0),k.toggleOptionsGroup(e)})},toggleUnfoldableGroup:function(e){e.preventDefault();var i=b(e.target).closest(".wpforms-panel-fields-group"),e=i.find(".wpforms-panel-fields-group-inner"),o="wpforms_fields_group_"+i.data("group");i.hasClass("opened")?(wpCookies.remove(o),e.stop().slideUp(150,function(){i.removeClass("opened")})):(wpCookies.set(o,"true",2592e3),i.addClass("opened"),e.stop().slideDown(150))},hideFieldHelper:function(e){e.preventDefault(),e.stopPropagation();e=b(".wpforms-field-helper");wpCookies.set("wpforms_field_helper_hide","true",2592e3),e.hide()},smartTagToggle:function(e){e.preventDefault(),y.$focusOutTarget=null;var e=b(this),i=e.closest(".wpforms-panel-field,.wpforms-field-option-row");i.hasClass("smart-tags-toggling")||(i.addClass("smart-tags-toggling"),e.hasClass("smart-tag-showing")?k.removeSmartTagsList(e):k.insertSmartTagsList(e))},removeSmartTagsList:function(e){var i=e.closest(".wpforms-panel-field,.wpforms-field-option-row"),o=i.find(".smart-tags-list-display");e.find("span").text(wpforms_builder.smart_tags_show),o.slideUp("",function(){o.remove(),e.removeClass("smart-tag-showing"),i.removeClass("smart-tags-toggling")})},insertSmartTagsList:function(e){var i,o=e.closest(".wpforms-panel-field,.wpforms-field-option-row"),t=e.closest("label"),r=!0;t.length||(t=o.find("label"),r=!1),i=k.getSmartTagsList(e,-1!==t.attr("for").indexOf("wpforms-field-option-")),(r?t:e).after(i),e.find("span").text(wpforms_builder.smart_tags_hide),o.find(".smart-tags-list-display").slideDown("",function(){e.addClass("smart-tag-showing"),o.removeClass("smart-tags-toggling")})},getSmartTagsList:function(e,i){var o='
      ';return(o+=k.getSmartTagsListFieldsElements(e))+k.getSmartTagsListOtherElements(e,i)+"
    "},getSmartTagsListFieldsElements:function(e){var i,o=e.data("type"),t=k.getSmartTagsFields(e),r="";if(!["fields","all"].includes(o))return"";if(!t)return'
  • '+wpforms_builder.fields_unavailable+"
  • ";for(i in r+='
  • '+wpforms_builder.fields_available+"
  • ",wpf.orders.fields){var n=wpf.orders.fields[i];t[n]&&(r+=k.getSmartTagsListFieldsElement(t[n]))}return r},getSmartTagsFields:function(e){e=e.data("fields");return e&&e.length?wpf.getFields(e.split(","),!0):wpf.getFields(!1,!0)},getSmartTagsListFieldsElement:function(e){var i=e.label?wpf.encodeHTMLEntities(wpf.sanitizeHTML(e.label)):wpforms_builder.field+" #"+e.id;return'
  • "+i+"
  • "},getSmartTagsListOtherElements:function(e,i){var o,t,e=e.data("type");if("other"!==e&&"all"!==e)return"";for(t in o='
  • '+wpforms_builder.other+"
  • ",wpforms_builder.smart_tags)i&&-1"+wpforms_builder.smart_tags[t]+"");return o},smartTagInsert:function(e){e.preventDefault();var i,e=b(this),o=e.closest(".smart-tags-list-display"),t=o.closest(".wpforms-panel-field,.wpforms-field-option-row"),r=t.find(".toggle-smart-tag-display"),n=t.find("input[type=text], textarea"),s=e.data("meta"),e="field"===e.data("type")?'{field_id="'+s+'"}':"{"+s+"}";"undefined"!=typeof tinyMCE&&(i=tinyMCE.get(n.prop("id")))&&!i.hasFocus()&&i.focus(!0),i&&!i.isHidden()?i.insertContent(e):(n.insertAtCaret(" "+e+" "),n.val(n.val().trim().replace(" "," ")),n.trigger("focus").trigger("input")),o.slideUp("",function(){o.remove()}),r.find("span").text(wpforms_builder.smart_tags_show),t.find(".toggle-smart-tag-display").removeClass("smart-tag-showing")},fieldMapTableDeleteRow:function(e,i){var i=b(i),o=i.closest("tr"),i=i.closest("table"),t=o.closest(".wpforms-builder-settings-block");"1"",{value:"",text:s})),void 0!==n&&n){if(n=n.split(" "),a&&!b.isEmptyObject(a))for(var l in wpf.orders.fields)Object.prototype.hasOwnProperty.call(wpf.orders.fields,l)&&(l=wpf.orders.fields[l],o="",a[l])&&(o=void 0!==a[l].label&&""!==a[l].label.toString().trim()?wpf.sanitizeHTML(a[l].label.toString().trim()):wpforms_builder.field+" #"+l,0<=b.inArray(a[l].type,n)||0<=b.inArray("all-fields",n))&&t.append(b("